diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-24 15:54:42 +0000 |
commit | 990d0f63eeb502c8762076e5c5499196e09cba55 (patch) | |
tree | 30a2091a8159b1694d65f9952e2aba2667d7dc11 /networking/slattach.c | |
parent | bcb66ec22e82f6b1ab93f3aec917269393a5b464 (diff) | |
download | busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.gz busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.tar.bz2 busybox-w32-990d0f63eeb502c8762076e5c5499196e09cba55.zip |
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.c | 21 |
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 @@ | |||
16 | #include "libbb.h" | 16 | #include "libbb.h" |
17 | #include "libiproute/utils.h" /* invarg() */ | 17 | #include "libiproute/utils.h" /* invarg() */ |
18 | 18 | ||
19 | /* Line discipline code table */ | ||
20 | static const char *const proto_names[] = { | ||
21 | "cslip"+1, /* 0 */ | ||
22 | "cslip", /* 1 */ | ||
23 | "cslip6"+1, /* 2 */ | ||
24 | "cslip6", /* 3 */ | ||
25 | "adaptive", /* 8 */ | ||
26 | NULL | ||
27 | }; | ||
28 | |||
29 | struct globals { | 19 | struct globals { |
30 | int handle; | 20 | int handle; |
31 | int saved_disc; | 21 | int saved_disc; |
@@ -132,6 +122,15 @@ static void sig_handler(int signo) | |||
132 | int slattach_main(int argc, char **argv); | 122 | int slattach_main(int argc, char **argv); |
133 | int slattach_main(int argc, char **argv) | 123 | int slattach_main(int argc, char **argv) |
134 | { | 124 | { |
125 | /* Line discipline code table */ | ||
126 | static const char proto_names[] = | ||
127 | "slip\0" /* 0 */ | ||
128 | "cslip\0" /* 1 */ | ||
129 | "slip6\0" /* 2 */ | ||
130 | "cslip6\0" /* 3 */ | ||
131 | "adaptive\0" /* 8 */ | ||
132 | ; | ||
133 | |||
135 | int i, encap, opt; | 134 | int i, encap, opt; |
136 | struct termios state; | 135 | struct termios state; |
137 | const char *proto = "cslip"; | 136 | const char *proto = "cslip"; |
@@ -160,7 +159,7 @@ int slattach_main(int argc, char **argv) | |||
160 | if (!*argv) | 159 | if (!*argv) |
161 | bb_show_usage(); | 160 | bb_show_usage(); |
162 | 161 | ||
163 | encap = index_in_str_array(proto_names, proto); | 162 | encap = index_in_strings(proto_names, proto); |
164 | 163 | ||
165 | if (encap < 0) | 164 | if (encap < 0) |
166 | invarg(proto, "protocol"); | 165 | invarg(proto, "protocol"); |