<arg choice="opt"><option>-l <replaceable>logfile</replaceable></option></arg>
<arg choice="opt"><option>-p <replaceable>pidfile</replaceable></option></arg>
<arg choice="opt"><option>-u <replaceable>ID</replaceable></option></arg>
+ <arg choice="opt"><option>-w <replaceable>dir</replaceable></option></arg>
<arg choice="opt"><option>-X</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
</varlistentry>
<varlistentry>
+ <term>-w <replaceable>dir</replaceable></term>
+ <listitem><para>
+ Changes working directory to <replaceable>dir</replaceable>.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>-X</term>
<listitem><para>
Makes Metaproxy operate in debug mode.
#include "router_flexml.hpp"
#include "factory_static.hpp"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
namespace mp = metaproxy_1;
static void handler(void *data)
const char *pidfile = 0;
const char *uid = 0;
- while ((ret = options("c{config}:Dh{help}l:p:u:V{version}X",
+ while ((ret = options("c{config}:Dh{help}l:p:u:V{version}w:X",
argv, argc, &arg)) != -2)
{
switch (ret)
" -l f log file f\n"
" -p f pid file f\n"
" -u id change uid to id\n"
+ " -w dir changes working directory to dir\n"
" -X debug mode (no fork/daemon mode)\n"
<< std::endl;
break;
std::cout << VERSION "\n";
std::exit(0);
break;
+ case 'w':
+ if (chdir(arg))
+ {
+ std::cerr << "chdir " << arg << " failed" << std::endl;
+ std::exit(1);
+ }
case 'X':
mode = YAZ_DAEMON_DEBUG;
break;