IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 13, 2008, 5:53:35 PM (18 years ago)
Author:
eugene
Message:

unique exit codes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/lib.shell/SocketOps.c

    r12332 r16472  
    3636  if (!status) {
    3737    gprint (GP_ERR, "invalid address\n");
    38     exit (2);
     38    exit (4);
    3939  }
    4040# endif
     
    4545  if (InitSocket == -1) {
    4646    perror ("socket: ");
    47     exit (2);
     47    exit (5);
    4848  }
    4949
     
    7272    if (errno == EADDRINUSE) {
    7373        Address[0].sin_port ++;
    74         if (Address[0].sin_port > MY_PORT + 10) exit (2);
     74        if (Address[0].sin_port > MY_PORT + 10) {
     75          fprintf (stderr, "failed to find a usable port\n");
     76          exit (6);
     77        }
    7578        goto retry_server;
    7679    }
    7780    perror ("bind: ");
    78     exit (2);
     81    exit (7);
    7982  }
    8083  /* repeated starts of the server are limited by xinetd or something:
     
    8588  if (status == -1) {
    8689    perror ("listen: ");
    87     exit (2);
     90    exit (8);
    8891  }
    8992  return (InitSocket);
     
    109112  if (BindSocket == -1) {
    110113    perror ("accept: ");
    111     exit (2);
     114    exit (9);
    112115  }
    113116
     
    175178  if (!status) {
    176179    gprint (GP_ERR, "invalid address\n");
    177     exit (2);
     180    exit (10);
    178181  }
    179182
     
    183186  if (InitSocket == -1) {
    184187    perror ("socket: ");
    185     exit (2);
     188    exit (11);
    186189  }
    187190
     
    190193    if (errno == ECONNREFUSED) {
    191194      Address.sin_port ++;
    192       if (Address.sin_port > MY_PORT + 10) exit (2);
     195      if (Address.sin_port > MY_PORT + 10) exit (12);
    193196      goto retry_client;
    194197    }
    195198    perror ("connect: ");
    196     exit (2);
     199    exit (13);
    197200  }
    198201
     
    222225  if (!status) {
    223226    gprint (GP_ERR, "invalid address\n");
    224     exit (2);
     227    exit (14);
    225228  }
    226229
     
    230233  if (InitSocket == -1) {
    231234    perror ("socket: ");
    232     exit (2);
     235    exit (15);
    233236  }
    234237
     
    237240  if (status == -1) {
    238241    perror ("bind: ");
    239     exit (2);
     242    exit (16);
    240243  }
    241244
     
    243246  if (status == -1) {
    244247    perror ("listen: ");
    245     exit (2);
     248    exit (17);
    246249  }
    247250
     
    269272    if (!test) {
    270273      gprint (GP_ERR, "invalid IP address %s\n", string);
    271       exit (2);
     274      exit (18);
    272275    }
    273276    VALID[Nvalid] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
Note: See TracChangeset for help on using the changeset viewer.