aboutsummaryrefslogtreecommitdiff
path: root/networking/slattach.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-24 15:54:42 +0000
commit990d0f63eeb502c8762076e5c5499196e09cba55 (patch)
tree30a2091a8159b1694d65f9952e2aba2667d7dc11 /networking/slattach.c
parentbcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff)
downloadbusybox-990d0f63eeb502c8762076e5c5499196e09cba55.tar.gz
Replace index_in_[sub]str_array with index_in_[sub]strings,
which scans thru "abc\0def\0123\0\0" type strings. Saves 250 bytes. text data bss dec hex filename 781266 1328 11844 794438 c1f46 busybox_old 781010 1328 11844 794182 c1e46 busybox_unstripped
Diffstat (limited to 'networking/slattach.c')
-rw-r--r--networking/slattach.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/networking/slattach.c b/networking/slattach.c
index 1a4423b72..4bac879d2 100644
--- a/networking/slattach.c
+++ b/networking/slattach.c
@@ -16,16 +16,6 @@
#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;
@@ -132,6 +122,15 @@ static void sig_handler(int signo)
int slattach_main(int argc, char **argv);
int slattach_main(int argc, char **argv)
{
+ /* Line discipline code table */
+ static const char proto_names[] =
+ "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";
@@ -160,7 +159,7 @@ int slattach_main(int argc, char **argv)
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");