[BusyBox] nameif: getopt_long removed

Nick Fedchik fnm at fusion.ukrsat.com
Sun Jan 19 06:21:03 UTC 2003


Hi All!

getopt_long() removed as useless, getopt() used instead.
Minor change in the nameif usage message.

2948 bytes - nameif.o
3140 bytes - nameif-longopt.o

-- 
Nick Fedchik, FNM3-RIPE(UANIC)
Internet Dept./ISP UkrSat, Kiev, Ukraine
-------------- next part --------------
diff -urN busybox/include/usage.h busybox-nameif/include/usage.h
--- busybox/include/usage.h	2003-01-14 08:42:56 +0200
+++ busybox-nameif/include/usage.h	2003-01-19 15:09:25 +0200
@@ -1505,11 +1505,11 @@
 	"$ mv /tmp/foo /bin/bar\n" 
 
 #define nameif_trivial_usage \
-	"[OPTIONS] [{IFNAME MACADDR}]"
+	"[-s] [-c FILE] [{IFNAME MACADDR}]"
 #define nameif_full_usage \
 		"Nameif renaming network interface while it in the down state.\n\n" \
 		"Options:\n" \
-		"\t-c FILE\t\tUse another configuration file (default is /etc/mactab)\n" \
+		"\t-c FILE\t\tUse configuration file (default is /etc/mactab)\n" \
 		"\t-s\t\tUse syslog (LOCAL0 facility).\n" \
 		"\tIFNAME MACADDR\tnew_interface_name interface_mac_address\n" 
 #define nameif_example_usage \
diff -urN busybox/networking/nameif.c busybox-nameif/networking/nameif.c
--- busybox/networking/nameif.c	2003-01-16 13:37:57 +0200
+++ busybox-nameif/networking/nameif.c	2003-01-19 15:12:02 +0200
@@ -36,7 +36,7 @@
 #include "busybox.h"
 
 /* take from linux/sockios.h */
-#define SIOCSIFNAME	0x8923		/* set interface name */
+#define SIOCSIFNAME	0x8923	/* set interface name */
 
 /* Octets in one ethernet addr, from <linux/if_ether.h> */
 #define ETH_ALEN	6
@@ -101,13 +101,8 @@
 	int if_index = 1;
 	mactable_t *ch;
 
-	static struct option opts[] = {
-		{"syslog", 0, NULL, 's'},
-		{"configfile", 1, NULL, 'c'},
-		{NULL},
-	};
 
-	while ((opt = getopt_long(argc, argv, "c:s", opts, NULL)) != -1) {
+	while ((opt = getopt(argc, argv, "c:s")) != -1) {
 		switch (opt) {
 		case 'c':
 			fname = optarg;
@@ -152,8 +147,7 @@
 			ch = xcalloc(1, sizeof(mactable_t));
 			ch->ifname = xstrndup(line_ptr, name_length);
 			if (name_length > IF_NAMESIZE)
-			    serror("interface name `%s' too long",
-					   ch->ifname);
+				serror("interface name `%s' too long", ch->ifname);
 			line_ptr += name_length;
 			line_ptr += strspn(line_ptr, " \t");
 			name_length = strspn(line_ptr, "0123456789ABCDEFabcdef:");


More information about the busybox mailing list