Another update from Larry:
[oweals/busybox.git] / route.c
diff --git a/route.c b/route.c
index d98d9a0b6248f1f4ca6b10c6caec3701aabd6e52..d571fc5a3a770065792777d3662c9b547dd535a1 100644 (file)
--- a/route.c
+++ b/route.c
  * Foundation;  either  version 2 of the License, or  (at
  * your option) any later version.
  *
- * $Id: route.c,v 1.6 2001/02/18 20:12:25 andersen Exp $
+ * $Id: route.c,v 1.10 2001/03/21 07:34:26 andersen Exp $
  *
  * displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
- * busybox style adjustments by Larry Doolittle  <LRDoolittle@lbl.gov>
- * displayroute() format now matches net-tools-1.57/lib/inet_gr.c line 173.
+ * adjustments by Larry Doolittle  <LRDoolittle@lbl.gov>
  */
 
-#include "busybox.h"
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
@@ -38,6 +36,7 @@
 #include <getopt.h>
 #include <unistd.h>
 #include <ctype.h>
+#include "busybox.h"
 
 #define _(x) x
 
 static int
 INET_resolve(char *name, struct sockaddr *sa)
 {
-       struct sockaddr_in *sin = (struct sockaddr_in *)sa;
+       struct sockaddr_in *s_in = (struct sockaddr_in *)sa;
        
-       sin->sin_family = AF_INET;
-       sin->sin_port = 0;
+       s_in->sin_family = AF_INET;
+       s_in->sin_port = 0;
 
        /* Default is special, meaning 0.0.0.0. */
        if (strcmp(name, "default")==0) {
-               sin->sin_addr.s_addr = INADDR_ANY;
+               s_in->sin_addr.s_addr = INADDR_ANY;
                return 1;
        }
        /* Look to see if it's a dotted quad. */
-       if (inet_aton(name, &sin->sin_addr)) {
+       if (inet_aton(name, &s_in->sin_addr)) {
                return 0;
        }
        /* guess not.. */
@@ -347,7 +346,7 @@ INET_setroute(int action, int options, char **args)
        return EXIT_SUCCESS;
 }
 
-void displayroutes(void)
+static void displayroutes(void)
 {
        char buff[256];
        int  nl = 0 ;
@@ -394,7 +393,7 @@ void displayroutes(void)
                                        inet_ntoa(dest)));
                        strcpy(sgw,    (gw.s_addr==0   ? "*"       :
                                        inet_ntoa(gw)));
-                       printf("%-15s %-15s %-15s %-5s %-6d %-2d %7d %s\n",
+                       printf("%-16s%-16s%-16s%-6s%-6d %-2d %7d %s\n",
                                sdest, sgw,
                                inet_ntoa(mask),
                                flags, metric, ref, use, buff);
@@ -412,7 +411,7 @@ int route_main(int argc, char **argv)
 
        if (*argv == NULL) {
                displayroutes();
-               exit(EXIT_SUCCESS);
+               return EXIT_SUCCESS;
        } else {
                /* check verb */
                if (strcmp(*argv, "add")==0)