xatonum.h: add comment
[oweals/busybox.git] / networking / slattach.c
index 1a4423b725af78bdd4bbd6edaa9d5f15c8c75c7a..17df4fa9e67851d8233c6347fa4c62a213eac190 100644 (file)
 #include "libbb.h"
 #include "libiproute/utils.h" /* invarg() */
 
-/* Line discipline code table */
-static const char *const proto_names[] = {
-       "cslip"+1,      /* 0 */
-       "cslip",        /* 1 */
-       "cslip6"+1,     /* 2 */
-       "cslip6",       /* 3 */
-       "adaptive",     /* 8 */
-       NULL
-};
-
 struct globals {
        int handle;
        int saved_disc;
@@ -129,9 +119,18 @@ static void sig_handler(int signo)
        restore_state_and_exit(0);
 }
 
-int slattach_main(int argc, char **argv);
+int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int slattach_main(int argc, char **argv)
 {
+       /* Line discipline code table */
+       static const char proto_names[] ALIGN1 =
+               "slip\0"        /* 0 */
+               "cslip\0"       /* 1 */
+               "slip6\0"       /* 2 */
+               "cslip6\0"      /* 3 */
+               "adaptive\0"    /* 8 */
+               ;
+
        int i, encap, opt;
        struct termios state;
        const char *proto = "cslip";
@@ -153,14 +152,14 @@ int slattach_main(int argc, char **argv)
        INIT_G();
 
        /* Parse command line options */
-       opt = getopt32(argc, argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd);
+       opt = getopt32(argv, "p:s:c:ehmLF", &proto, &baud_str, &extcmd);
        /*argc -= optind;*/
        argv += optind;
 
        if (!*argv)
                bb_show_usage();
 
-       encap = index_in_str_array(proto_names, proto);
+       encap = index_in_strings(proto_names, proto);
 
        if (encap < 0)
                invarg(proto, "protocol");