diff options
author | Rob Landley <rob@landley.net> | 2005-10-28 09:24:33 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2005-10-28 09:24:33 +0000 |
commit | 1b751c894b520846af8575d09187ce342e88778c (patch) | |
tree | ea1bfb15742becbaab52960ee9fad82aba9fbcee /networking | |
parent | 0f34a821ab99e4936c7aa4974f58784442172211 (diff) | |
download | busybox-w32-1b751c894b520846af8575d09187ce342e88778c.tar.gz busybox-w32-1b751c894b520846af8575d09187ce342e88778c.tar.bz2 busybox-w32-1b751c894b520846af8575d09187ce342e88778c.zip |
Rob Sullivan sent in some cleanups, which I beat on slightly.
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ifupdown.c | 26 | ||||
-rw-r--r-- | networking/telnet.c | 36 |
2 files changed, 12 insertions, 50 deletions
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index d23c9f70a..757827858 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -12,19 +12,7 @@ | |||
12 | * Lines in the interfaces file cannot wrap. | 12 | * Lines in the interfaces file cannot wrap. |
13 | * To adhere to the FHS, the default state file is /var/run/ifstate. | 13 | * To adhere to the FHS, the default state file is /var/run/ifstate. |
14 | * | 14 | * |
15 | * This program is free software; you can redistribute it and/or modify | 15 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
16 | * it under the terms of the GNU General Public License as published by | ||
17 | * the Free Software Foundation; either version 2 of the License, or | ||
18 | * (at your option) any later version. | ||
19 | * | ||
20 | * This program is distributed in the hope that it will be useful, | ||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | * GNU General Public License for more details. | ||
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, write to the Free Software | ||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
28 | */ | 16 | */ |
29 | 17 | ||
30 | /* TODO: standardise execute() return codes to return 0 for success and 1 for failure */ | 18 | /* TODO: standardise execute() return codes to return 0 for success and 1 for failure */ |
@@ -819,7 +807,7 @@ static struct interfaces_file_t *read_interfaces(const char *filename) | |||
819 | } | 807 | } |
820 | 808 | ||
821 | /* Add the interface to the list */ | 809 | /* Add the interface to the list */ |
822 | defn->autointerfaces = llist_add_to_end(defn->autointerfaces, strdup(firstword)); | 810 | defn->autointerfaces = llist_add_to_end(defn->autointerfaces, bb_xstrdup(firstword)); |
823 | debug_noise("\nauto %s\n", firstword); | 811 | debug_noise("\nauto %s\n", firstword); |
824 | } | 812 | } |
825 | currently_processing = NONE; | 813 | currently_processing = NONE; |
@@ -1254,7 +1242,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1254 | const llist_t *list = state_list; | 1242 | const llist_t *list = state_list; |
1255 | while (list) { | 1243 | while (list) { |
1256 | new_item = xmalloc(sizeof(llist_t)); | 1244 | new_item = xmalloc(sizeof(llist_t)); |
1257 | new_item->data = strdup(list->data); | 1245 | new_item->data = bb_xstrdup(list->data); |
1258 | new_item->link = NULL; | 1246 | new_item->link = NULL; |
1259 | list = target_list; | 1247 | list = target_list; |
1260 | if (list == NULL) | 1248 | if (list == NULL) |
@@ -1273,7 +1261,7 @@ extern int ifupdown_main(int argc, char **argv) | |||
1273 | /* iface_down */ | 1261 | /* iface_down */ |
1274 | const llist_t *list = state_list; | 1262 | const llist_t *list = state_list; |
1275 | while (list) { | 1263 | while (list) { |
1276 | target_list = llist_add_to_end(target_list, strdup(list->data)); | 1264 | target_list = llist_add_to_end(target_list, bb_xstrdup(list->data)); |
1277 | list = list->link; | 1265 | list = list->link; |
1278 | } | 1266 | } |
1279 | target_list = defn->autointerfaces; | 1267 | target_list = defn->autointerfaces; |
@@ -1294,15 +1282,15 @@ extern int ifupdown_main(int argc, char **argv) | |||
1294 | int okay = 0; | 1282 | int okay = 0; |
1295 | int cmds_ret; | 1283 | int cmds_ret; |
1296 | 1284 | ||
1297 | iface = strdup(target_list->data); | 1285 | iface = bb_xstrdup(target_list->data); |
1298 | target_list = target_list->link; | 1286 | target_list = target_list->link; |
1299 | 1287 | ||
1300 | pch = strchr(iface, '='); | 1288 | pch = strchr(iface, '='); |
1301 | if (pch) { | 1289 | if (pch) { |
1302 | *pch = '\0'; | 1290 | *pch = '\0'; |
1303 | liface = strdup(pch + 1); | 1291 | liface = bb_xstrdup(pch + 1); |
1304 | } else { | 1292 | } else { |
1305 | liface = strdup(iface); | 1293 | liface = bb_xstrdup(iface); |
1306 | } | 1294 | } |
1307 | 1295 | ||
1308 | if (!force) { | 1296 | if (!force) { |
diff --git a/networking/telnet.c b/networking/telnet.c index 24160057b..d9f0e94bc 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -8,19 +8,7 @@ | |||
8 | * Created: Thu Apr 7 13:29:41 1994 too | 8 | * Created: Thu Apr 7 13:29:41 1994 too |
9 | * Last modified: Fri Jun 9 14:34:24 2000 too | 9 | * Last modified: Fri Jun 9 14:34:24 2000 too |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
19 | * General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
24 | * | 12 | * |
25 | * HISTORY | 13 | * HISTORY |
26 | * Revision 3.1 1994/04/17 11:31:54 too | 14 | * Revision 3.1 1994/04/17 11:31:54 too |
@@ -636,10 +624,6 @@ extern int telnet_main(int argc, char** argv) | |||
636 | int maxfd; | 624 | int maxfd; |
637 | #endif | 625 | #endif |
638 | 626 | ||
639 | #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN | ||
640 | int opt; | ||
641 | #endif | ||
642 | |||
643 | #ifdef CONFIG_FEATURE_AUTOWIDTH | 627 | #ifdef CONFIG_FEATURE_AUTOWIDTH |
644 | get_terminal_width_height(0, &win_width, &win_height); | 628 | get_terminal_width_height(0, &win_width, &win_height); |
645 | #endif | 629 | #endif |
@@ -661,20 +645,10 @@ extern int telnet_main(int argc, char** argv) | |||
661 | bb_show_usage(); | 645 | bb_show_usage(); |
662 | 646 | ||
663 | #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN | 647 | #ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN |
664 | autologin = NULL; | 648 | unsigned long flags = bb_getopt_ulflags(argc, argv, "al:", &autologin); |
665 | while ((opt = getopt(argc, argv, "al:")) != EOF) { | 649 | if (flags & 1) |
666 | switch (opt) { | 650 | autologin = getenv("USER"); |
667 | case 'l': | 651 | |
668 | autologin = optarg; | ||
669 | break; | ||
670 | case 'a': | ||
671 | autologin = getenv("USER"); | ||
672 | break; | ||
673 | case '?': | ||
674 | bb_show_usage(); | ||
675 | break; | ||
676 | } | ||
677 | } | ||
678 | if (optind < argc) { | 652 | if (optind < argc) { |
679 | bb_lookup_host(&s_in, argv[optind++]); | 653 | bb_lookup_host(&s_in, argv[optind++]); |
680 | s_in.sin_port = bb_lookup_port((optind < argc) ? argv[optind++] : | 654 | s_in.sin_port = bb_lookup_port((optind < argc) ? argv[optind++] : |