Index: trunk/Ohana/src/opihi/lib.shell/SocketOps.c
===================================================================
--- trunk/Ohana/src/opihi/lib.shell/SocketOps.c	(revision 12332)
+++ trunk/Ohana/src/opihi/lib.shell/SocketOps.c	(revision 16472)
@@ -36,5 +36,5 @@
   if (!status) {
     gprint (GP_ERR, "invalid address\n");
-    exit (2);
+    exit (4);
   }
 # endif
@@ -45,5 +45,5 @@
   if (InitSocket == -1) {
     perror ("socket: ");
-    exit (2);
+    exit (5);
   }
 
@@ -72,9 +72,12 @@
     if (errno == EADDRINUSE) {
 	Address[0].sin_port ++;
-	if (Address[0].sin_port > MY_PORT + 10) exit (2);
+	if (Address[0].sin_port > MY_PORT + 10) {
+	  fprintf (stderr, "failed to find a usable port\n");
+	  exit (6);
+	}
 	goto retry_server;
     }
     perror ("bind: ");
-    exit (2);
+    exit (7);
   }
   /* repeated starts of the server are limited by xinetd or something:
@@ -85,5 +88,5 @@
   if (status == -1) {
     perror ("listen: ");
-    exit (2);
+    exit (8);
   }
   return (InitSocket);
@@ -109,5 +112,5 @@
   if (BindSocket == -1) {
     perror ("accept: ");
-    exit (2);
+    exit (9);
   }
 
@@ -175,5 +178,5 @@
   if (!status) {
     gprint (GP_ERR, "invalid address\n");
-    exit (2);
+    exit (10);
   }
 
@@ -183,5 +186,5 @@
   if (InitSocket == -1) {
     perror ("socket: ");
-    exit (2);
+    exit (11);
   }
 
@@ -190,9 +193,9 @@
     if (errno == ECONNREFUSED) {
       Address.sin_port ++;
-      if (Address.sin_port > MY_PORT + 10) exit (2);
+      if (Address.sin_port > MY_PORT + 10) exit (12);
       goto retry_client;
     }
     perror ("connect: ");
-    exit (2);
+    exit (13);
   }
 
@@ -222,5 +225,5 @@
   if (!status) {
     gprint (GP_ERR, "invalid address\n");
-    exit (2);
+    exit (14);
   }
 
@@ -230,5 +233,5 @@
   if (InitSocket == -1) {
     perror ("socket: ");
-    exit (2);
+    exit (15);
   }
 
@@ -237,5 +240,5 @@
   if (status == -1) {
     perror ("bind: ");
-    exit (2);
+    exit (16);
   }
 
@@ -243,5 +246,5 @@
   if (status == -1) {
     perror ("listen: ");
-    exit (2);
+    exit (17);
   }
 
@@ -269,5 +272,5 @@
     if (!test) {
       gprint (GP_ERR, "invalid IP address %s\n", string);
-      exit (2);
+      exit (18);
     }
     VALID[Nvalid] = ip1 | (ip2 << 8) | (ip3 << 16) | (ip4 << 24);
