chiark / gitweb /
init script always address local instance of daemon
authorrjk@greenend.org.uk <>
Fri, 23 Nov 2007 14:32:18 +0000 (14:32 +0000)
committerrjk@greenend.org.uk <>
Fri, 23 Nov 2007 14:32:18 +0000 (14:32 +0000)
clients/disorder.c
examples/disorder.init.in

index 58177668ba2b05550e480e57ed578b94eb4549e8..9513b05daf5f0dd62917d844da33d0e1aa8bc31d 100644 (file)
@@ -61,6 +61,7 @@ static const struct option options[] = {
   { "version", no_argument, 0, 'V' },
   { "config", required_argument, 0, 'c' },
   { "debug", no_argument, 0, 'd' },
+  { "local", no_argument, 0, 'l' },
   { "help-commands", no_argument, 0, 'H' },
   { 0, 0, 0, 0 }
 };
@@ -74,6 +75,7 @@ static void help(void) {
          "  --help-commands, -H     List commands\n"
          "  --version, -V           Display version number\n"
          "  --config PATH, -c PATH  Set configuration file\n"
+         "  --local, -l             Force connection to local server\n"
          "  --debug, -d             Turn on debugging\n");
   xfclose(stdout);
   exit(0);
@@ -531,7 +533,7 @@ static void help_commands(void) {
 }
 
 int main(int argc, char **argv) {
-  int n, i, j;
+  int n, i, j, local = 0;
   disorder_client *c = 0;
   int status = 0;
   struct vector args;
@@ -541,17 +543,20 @@ int main(int argc, char **argv) {
   pcre_malloc = xmalloc;
   pcre_free = xfree;
   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
-  while((n = getopt_long(argc, argv, "hVc:dHL", options, 0)) >= 0) {
+  while((n = getopt_long(argc, argv, "hVc:dHl", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
     case 'H': help_commands();
     case 'V': version();
     case 'c': configfile = optarg; break;
     case 'd': debugging = 1; break;
+    case 'l': local = 1; break;
     default: fatal(0, "invalid option");
     }
   }
   if(config_read(0)) fatal(0, "cannot read configuration");
+  if(local)
+    config->connect.n = 0;
   if(!(c = disorder_new(1))) exit(EXIT_FAILURE);
   if(disorder_connect(c)) exit(EXIT_FAILURE);
   n = optind;
index 06a5c0fbbc730fb941ad4e2976095499282a2255..9c912e4121c96997c1fe4bbbaabc923d95773e5e 100644 (file)
@@ -22,7 +22,7 @@
 set -e
 
 DAEMON=sbindir/disorderd
-CLIENT=bindir/disorder
+CLIENT="bindir/disorder --local"
 
 PATH="$PATH:sbindir"