Ignore:
Timestamp:
May 9, 2007 8:58:18 AM (16 years ago)
Author:
nkissebe
Message:

daemonize by default, use -f (debug flag) to run in the foreground

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanoscale/server.c

    r715 r716  
    183183{
    184184  fprintf(stderr,
    185           "Syntax: %s -b <broadcast port> -l <listen port> -s <subnet> -c 'command'\n",
     185          "Syntax: %s [-d] -b <broadcast port> -l <listen port> -s <subnet> -c 'command'\n",
    186186          argv0);
    187187  exit(1);
     
    215215  int connected_fds[10] = {0};
    216216  int subnet_addr;
     217  int debug_flag = 0;
    217218  int n;
    218219
     
    229230    };
    230231
    231     c = getopt_long(argc, argv, "+b:c:l:s:", long_options, &option_index);
     232    c = getopt_long(argc, argv, "+b:c:l:s:d", long_options, &option_index);
    232233    if (c == -1)
    233234      break;
    234235
    235236    switch(c) {
     237          case 'd':
     238            debug_flag = 1;
     239                break;
    236240      case 'b':
    237241        recv_port = strtoul(optarg,0,0);
     
    386390
    387391  FD_SET(send_fd, &saved_rfds);
     392
     393  if (debug_flag == 0) {
     394      if ( daemon(0,0) != 0 ) {
     395              perror("daemon");
     396                  exit(1);
     397          }
     398  }
     399
    388400  while(1) {
    389401
Note: See TracChangeset for help on using the changeset viewer.