--- svn/softsqueeze/SlimProtoLib/src/squeezeslave/squeezeslave.c 2007-04-13 09:46:55.000000000 -0400 +++ patch_bkg/squeezeslave.c 2007-05-19 10:50:39.000000000 -0400 @@ -42,8 +42,10 @@ char *slimserver_address = "127.0.0.1"; int output_device_id = -1; char c; - int i; + // Dr C -- Added backgnd as flag if squeezeslave should be backgrounded -- 1=yes, 0=no + int i,backgnd; + backgnd = 0; while (1) { static struct option long_options[] = { {"help", no_argument, 0, 'h'}, @@ -56,18 +58,23 @@ /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long (argc, argv, "hd:m:o:", + c = getopt_long (argc, argv, "hbd:m:o:", long_options, &option_index); + // Dr C -- On Ubuntu for ppc, c is 255 if there are no arguments + // Strange, but works. - if (c == -1) + if (c == -1 || c == 255) break; switch (c) { case 'h': fprintf(stderr, "help ... todo\n"); exit(0); - + // Dr C -- Added (another) undocumented switch -- 'b' if process to be run in background + case 'b': + backgnd=1; + break; case 'd': #ifdef SLIMPROTO_DEBUG if (strcmp(optarg, "slimproto") == 0) @@ -145,8 +152,15 @@ exit(-1); } - getc(stdin); - + // Dr C -- If backgrounded, go into infinite loop + if (backgnd == 1) { + fprintf(stderr,"Backgrounding. . .\n"); + for ( ; ; ) + {sleep(5000);}; + } + else { + getc(stdin); + }; #if 0 int ch = getc(stdin); // This does not work on all platforms and I don't have time to sort it out right