Removed return codes from icmpmonitor.c.
[icmpmonitor] / icmpmonitor.c
index e119dbe..64fa630 100644 (file)
 
 #include "cfg.h"
 
 
 #include "cfg.h"
 
-/* return codes */
-#define RET_OK         0
-#define RET_NO_HOSTS   1
-#define RET_INIT_ERROR 2
-#define RET_BAD_CFG    3
-#define RET_BAD_OPT    4
-
 #define        MAXPACKET       (65536 - 60 - 8) /* max packet size     */
 #define        DEFDATALEN      (64 - 8)         /* default data length */
 
 #define        MAXPACKET       (65536 - 60 - 8) /* max packet size     */
 #define        DEFDATALEN      (64 - 8)         /* default data length */
 
@@ -80,7 +73,6 @@ static void pinger(int);
 static int  in_cksum(u_short *addr, int len);
 static void read_icmp_data(monitor_host_t *p);
 static void tvsub(struct timeval *out, struct timeval *in);
 static int  in_cksum(u_short *addr, int len);
 static void read_icmp_data(monitor_host_t *p);
 static void tvsub(struct timeval *out, struct timeval *in);
-static void done(int code);
 static int gcd(int x, int y);
 
 /* globals */
 static int gcd(int x, int y);
 
 /* globals */
@@ -123,8 +115,8 @@ int main(int ac, char **av)
            cfgfile=strdup(optarg);  
            break;  
        default: 
            cfgfile=strdup(optarg);  
            break;  
        default: 
-           fprintf(stderr,"Usage: icmpmonitor [-v] [-r] [-f cfgfile]\n");
-            done(RET_BAD_OPT);
+            fprintf(stderr,"Usage: icmpmonitor [-v] [-r] [-f cfgfile]\n");
+            exit(EXIT_FAILURE);
        } 
     
     if (!cfgfile) {
        } 
     
     if (!cfgfile) {
@@ -142,8 +134,8 @@ int main(int ac, char **av)
     alarm(send_delay); 
 
     get_response();
     alarm(send_delay); 
 
     get_response();
-    
-    done(RET_OK);
+
+    exit(EXIT_SUCCESS);
 }
 
 
 }
 
 
@@ -527,11 +519,6 @@ tvsub(register struct timeval *out, register struct timeval *in)
        out->tv_sec -= in->tv_sec;
 }
 
        out->tv_sec -= in->tv_sec;
 }
 
-void done(int code)
-{
-    exit(code);
-}
-
 static int gcd(int x, int y)
 {
     int remainder = x % y;
 static int gcd(int x, int y)
 {
     int remainder = x % y;