|
Lines 177-200
Link Here
|
| 177 |
static void |
177 |
static void |
| 178 |
usage(void) |
178 |
usage(void) |
| 179 |
{ |
179 |
{ |
| 180 |
char options[1024]; |
|
|
| 181 |
struct option *p; |
180 |
struct option *p; |
|
|
181 |
char optC[8] = {0}; |
| 182 |
char optL[8] = {0}; |
| 183 |
char optg[32] = {0}; |
| 182 |
|
184 |
|
| 183 |
/* XXX not right but close enough for now */ |
185 |
/* Create strings for "opts" options */ |
| 184 |
options[0] = '\0'; |
|
|
| 185 |
for (p = opts; p != NULL; p = p->next) { |
186 |
for (p = opts; p != NULL; p = p->next) { |
| 186 |
strlcat(options, p->opt_usage, sizeof(options)); |
187 |
if (p->opt[0] == 'g') { |
| 187 |
strlcat(options, " ", sizeof(options)); |
188 |
strlcat(optg, " ", sizeof(optg)); |
|
|
189 |
strlcat(optg, p->opt_usage, sizeof(optg)); |
| 190 |
} else if (p->opt[0] == 'L') { |
| 191 |
strlcat(optL, " ", sizeof(optL)); |
| 192 |
strlcat(optL, p->opt_usage, sizeof(optL)); |
| 193 |
} else if (p->opt[0] == 'C') { |
| 194 |
strlcat(optC, " ", sizeof(optC)); |
| 195 |
strlcat(optC, p->opt_usage, sizeof(optC)); |
| 196 |
} |
| 188 |
} |
197 |
} |
| 189 |
|
198 |
|
| 190 |
fprintf(stderr, |
199 |
fprintf(stderr, |
| 191 |
"usage: ifconfig [-f type:format] %sinterface address_family\n" |
200 |
"usage: ifconfig [-f type:format[,type:format]]%s [-k] [-m] [-n] interface\n" |
| 192 |
" [address [dest_address]] [parameters]\n" |
201 |
" [create] address_family [address [dest_address]] [parameters]\n" |
| 193 |
" ifconfig interface create\n" |
202 |
" ifconfig interface destroy\n" |
| 194 |
" ifconfig -a %s[-d] [-m] [-u] [-v] [address_family]\n" |
203 |
" ifconfig -a%s [-d]%s [-m] [-u] [-v] [address_family]\n" |
| 195 |
" ifconfig -l [-d] [-u] [address_family]\n" |
204 |
" ifconfig -l [-d] [-u] [address_family]\n" |
| 196 |
" ifconfig %s[-d] [-m] [-u] [-v]\n", |
205 |
" ifconfig%s [-d] [-k] [-m] [-u] [-v]%s\n", |
| 197 |
options, options, options); |
206 |
optL, optL, optg, optL, optC); |
|
|
207 |
if (optg[0] != 0) { |
| 208 |
fprintf(stderr, " ifconfig%s\n", optg); |
| 209 |
} |
| 198 |
exit(1); |
210 |
exit(1); |
| 199 |
} |
211 |
} |
| 200 |
|
212 |
|