summaryrefslogtreecommitdiff
path: root/networking/udhcp/files.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-23 12:57:49 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-23 12:57:49 +0000
commitc90c3f30a899b5f0aae58e54839109aa9b3eaee6 (patch)
tree190c1a90f38aa4ddbfdddf52ea89978d42536606 /networking/udhcp/files.c
parent48237b0c88343154d58854020c3a9c8b07c61b10 (diff)
downloadbusybox-w32-c90c3f30a899b5f0aae58e54839109aa9b3eaee6.tar.gz
busybox-w32-c90c3f30a899b5f0aae58e54839109aa9b3eaee6.tar.bz2
busybox-w32-c90c3f30a899b5f0aae58e54839109aa9b3eaee6.zip
add "wpad" DHCP option. Spotted some optimization opportunities: -80 bytes
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r--networking/udhcp/files.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c
index 2c2c5422c..829d7e960 100644
--- a/networking/udhcp/files.c
+++ b/networking/udhcp/files.c
@@ -95,7 +95,8 @@ struct option_set *find_option(struct option_set *opt_list, char code)
95 95
96 96
97/* add an option to the opt_list */ 97/* add an option to the opt_list */
98static void attach_option(struct option_set **opt_list, struct dhcp_option *option, char *buffer, int length) 98static void attach_option(struct option_set **opt_list,
99 const struct dhcp_option *option, char *buffer, int length)
99{ 100{
100 struct option_set *existing, *new, **curr; 101 struct option_set *existing, *new, **curr;
101 102
@@ -135,7 +136,7 @@ static int read_opt(const char *const_line, void *arg)
135{ 136{
136 struct option_set **opt_list = arg; 137 struct option_set **opt_list = arg;
137 char *opt, *val, *endptr; 138 char *opt, *val, *endptr;
138 struct dhcp_option *option; 139 const struct dhcp_option *option;
139 int retval = 0, length; 140 int retval = 0, length;
140 char buffer[8]; 141 char buffer[8];
141 char *line; 142 char *line;
@@ -144,16 +145,21 @@ static int read_opt(const char *const_line, void *arg)
144 145
145 /* Cheat, the only const line we'll actually get is "" */ 146 /* Cheat, the only const line we'll actually get is "" */
146 line = (char *) const_line; 147 line = (char *) const_line;
147 if (!(opt = strtok(line, " \t="))) return 0; 148 opt = strtok(line, " \t=");
149 if (!opt) return 0;
148 150
149 for (option = dhcp_options; option->code; option++) 151 option = dhcp_options;
152 while (1) {
153 if (!option->code)
154 return 0;
150 if (!strcasecmp(option->name, opt)) 155 if (!strcasecmp(option->name, opt))
151 break; 156 break;
152 157 option++;
153 if (!option->code) return 0; 158 }
154 159
155 do { 160 do {
156 if (!(val = strtok(NULL, ", \t"))) break; 161 val = strtok(NULL, ", \t");
162 if (!val) break;
157 length = option_lengths[option->flags & TYPE_MASK]; 163 length = option_lengths[option->flags & TYPE_MASK];
158 retval = 0; 164 retval = 0;
159 opt = buffer; /* new meaning for variable opt */ 165 opt = buffer; /* new meaning for variable opt */