diff options
-rw-r--r-- | include/libbb.h | 11 | ||||
-rw-r--r-- | libbb/compare_string_array.c | 9 | ||||
-rw-r--r-- | miscutils/adjtimex.c | 98 | ||||
-rw-r--r-- | miscutils/hdparm.c | 27 | ||||
-rw-r--r-- | networking/ifconfig.c | 88 |
5 files changed, 129 insertions, 104 deletions
diff --git a/include/libbb.h b/include/libbb.h index 71f439fa9..77c678cee 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -846,10 +846,13 @@ extern int correct_password(const struct passwd *pw); | |||
846 | /* Returns a ptr to static storage */ | 846 | /* Returns a ptr to static storage */ |
847 | extern char *pw_encrypt(const char *clear, const char *salt); | 847 | extern char *pw_encrypt(const char *clear, const char *salt); |
848 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); | 848 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); |
849 | extern int index_in_str_array(const char *const string_array[], const char *key); | 849 | |
850 | extern int index_in_strings(const char *strings, const char *key); | 850 | int index_in_str_array(const char *const string_array[], const char *key); |
851 | extern int index_in_substr_array(const char *const string_array[], const char *key); | 851 | int index_in_strings(const char *strings, const char *key); |
852 | extern int index_in_substrings(const char *strings, const char *key); | 852 | int index_in_substr_array(const char *const string_array[], const char *key); |
853 | int index_in_substrings(const char *strings, const char *key); | ||
854 | const char *nth_string(const char *strings, int n); | ||
855 | |||
853 | extern void print_login_issue(const char *issue_file, const char *tty); | 856 | extern void print_login_issue(const char *issue_file, const char *tty); |
854 | extern void print_login_prompt(void); | 857 | extern void print_login_prompt(void); |
855 | 858 | ||
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index 731d3d8c1..7b5ce856d 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c | |||
@@ -67,3 +67,12 @@ int index_in_substrings(const char *strings, const char *key) | |||
67 | } | 67 | } |
68 | return -1; | 68 | return -1; |
69 | } | 69 | } |
70 | |||
71 | const char *nth_string(const char *strings, int n) | ||
72 | { | ||
73 | while (n) { | ||
74 | n--; | ||
75 | strings += strlen(strings) + 1; | ||
76 | } | ||
77 | return strings; | ||
78 | } | ||
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 67dd0a93b..07f083428 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c | |||
@@ -14,34 +14,46 @@ | |||
14 | #include "libbb.h" | 14 | #include "libbb.h" |
15 | #include <sys/timex.h> | 15 | #include <sys/timex.h> |
16 | 16 | ||
17 | static const struct { | 17 | static const uint16_t statlist_bit[] = { |
18 | int bit; | 18 | STA_PLL, |
19 | const char *name; | 19 | STA_PPSFREQ, |
20 | } statlist[] = { | 20 | STA_PPSTIME, |
21 | { STA_PLL, "PLL" }, | 21 | STA_FLL, |
22 | { STA_PPSFREQ, "PPSFREQ" }, | 22 | STA_INS, |
23 | { STA_PPSTIME, "PPSTIME" }, | 23 | STA_DEL, |
24 | { STA_FLL, "FFL" }, | 24 | STA_UNSYNC, |
25 | { STA_INS, "INS" }, | 25 | STA_FREQHOLD, |
26 | { STA_DEL, "DEL" }, | 26 | STA_PPSSIGNAL, |
27 | { STA_UNSYNC, "UNSYNC" }, | 27 | STA_PPSJITTER, |
28 | { STA_FREQHOLD, "FREQHOLD" }, | 28 | STA_PPSWANDER, |
29 | { STA_PPSSIGNAL, "PPSSIGNAL" }, | 29 | STA_PPSERROR, |
30 | { STA_PPSJITTER, "PPSJITTER" }, | 30 | STA_CLOCKERR, |
31 | { STA_PPSWANDER, "PPSWANDER" }, | 31 | 0 |
32 | { STA_PPSERROR, "PPSERROR" }, | ||
33 | { STA_CLOCKERR, "CLOCKERR" }, | ||
34 | { 0, NULL } | ||
35 | }; | 32 | }; |
33 | static const char statlist_name[] = | ||
34 | "PLL" "\0" | ||
35 | "PPSFREQ" "\0" | ||
36 | "PPSTIME" "\0" | ||
37 | "FFL" "\0" | ||
38 | "INS" "\0" | ||
39 | "DEL" "\0" | ||
40 | "UNSYNC" "\0" | ||
41 | "FREQHOLD" "\0" | ||
42 | "PPSSIGNAL" "\0" | ||
43 | "PPSJITTER" "\0" | ||
44 | "PPSWANDER" "\0" | ||
45 | "PPSERROR" "\0" | ||
46 | "CLOCKERR" | ||
47 | ; | ||
36 | 48 | ||
37 | static const char *const ret_code_descript[] = { | 49 | static const char ret_code_descript[] = |
38 | "clock synchronized", | 50 | "clock synchronized" "\0" |
39 | "insert leap second", | 51 | "insert leap second" "\0" |
40 | "delete leap second", | 52 | "delete leap second" "\0" |
41 | "leap second in progress", | 53 | "leap second in progress" "\0" |
42 | "leap second has occurred", | 54 | "leap second has occurred" "\0" |
43 | "clock not synchronized" | 55 | "clock not synchronized" |
44 | }; | 56 | ; |
45 | 57 | ||
46 | int adjtimex_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 58 | int adjtimex_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
47 | int adjtimex_main(int argc, char **argv) | 59 | int adjtimex_main(int argc, char **argv) |
@@ -52,7 +64,7 @@ int adjtimex_main(int argc, char **argv) | |||
52 | unsigned opt; | 64 | unsigned opt; |
53 | char *opt_o, *opt_f, *opt_p, *opt_t; | 65 | char *opt_o, *opt_f, *opt_p, *opt_t; |
54 | struct timex txc; | 66 | struct timex txc; |
55 | int i, ret, sep; | 67 | int i, ret; |
56 | const char *descript; | 68 | const char *descript; |
57 | txc.modes=0; | 69 | txc.modes=0; |
58 | 70 | ||
@@ -81,33 +93,42 @@ int adjtimex_main(int argc, char **argv) | |||
81 | 93 | ||
82 | ret = adjtimex(&txc); | 94 | ret = adjtimex(&txc); |
83 | 95 | ||
84 | if (ret < 0) perror("adjtimex"); | 96 | if (ret < 0) { |
97 | bb_perror_nomsg_and_die(); | ||
98 | } | ||
99 | |||
100 | if (!(opt & OPT_quiet)) { | ||
101 | int sep; | ||
102 | const char *name; | ||
85 | 103 | ||
86 | if (!(opt & OPT_quiet) && ret>=0) { | ||
87 | printf( | 104 | printf( |
88 | " mode: %d\n" | 105 | " mode: %d\n" |
89 | "-o offset: %ld\n" | 106 | "-o offset: %ld\n" |
90 | "-f frequency: %ld\n" | 107 | "-f frequency: %ld\n" |
91 | " maxerror: %ld\n" | 108 | " maxerror: %ld\n" |
92 | " esterror: %ld\n" | 109 | " esterror: %ld\n" |
93 | " status: %d ( ", | 110 | " status: %d (", |
94 | txc.modes, txc.offset, txc.freq, txc.maxerror, | 111 | txc.modes, txc.offset, txc.freq, txc.maxerror, |
95 | txc.esterror, txc.status); | 112 | txc.esterror, txc.status); |
96 | 113 | ||
97 | /* representative output of next code fragment: | 114 | /* representative output of next code fragment: |
98 | "PLL | PPSTIME" */ | 115 | "PLL | PPSTIME" */ |
99 | sep=0; | 116 | name = statlist_name; |
100 | for (i=0; statlist[i].name; i++) { | 117 | sep = 0; |
101 | if (txc.status & statlist[i].bit) { | 118 | for (i = 0; statlist_bit[i]; i++) { |
102 | if (sep) fputs(" | ",stdout); | 119 | if (txc.status & statlist_bit[i]) { |
103 | fputs(statlist[i].name,stdout); | 120 | if (sep) |
104 | sep=1; | 121 | fputs(" | ", stdout); |
122 | fputs(name, stdout); | ||
123 | sep = 1; | ||
105 | } | 124 | } |
125 | name += strlen(name) + 1; | ||
106 | } | 126 | } |
107 | 127 | ||
108 | descript = "error"; | 128 | descript = "error"; |
109 | if (ret >= 0 && ret <= 5) descript = ret_code_descript[ret]; | 129 | if (ret <= 5) |
110 | printf(" )\n" | 130 | descript = nth_string(ret_code_descript, ret); |
131 | printf(")\n" | ||
111 | "-p timeconstant: %ld\n" | 132 | "-p timeconstant: %ld\n" |
112 | " precision: %ld\n" | 133 | " precision: %ld\n" |
113 | " tolerance: %ld\n" | 134 | " tolerance: %ld\n" |
@@ -119,5 +140,6 @@ int adjtimex_main(int argc, char **argv) | |||
119 | txc.precision, txc.tolerance, txc.tick, | 140 | txc.precision, txc.tolerance, txc.tick, |
120 | (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript); | 141 | (long)txc.time.tv_sec, (long)txc.time.tv_usec, ret, descript); |
121 | } | 142 | } |
122 | return (ret<0); | 143 | |
144 | return 0; | ||
123 | } | 145 | } |
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index c8129d791..93b1aacb3 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -491,15 +491,6 @@ static uint8_t mode_loop(uint16_t mode_sup, uint16_t mode_sel, int cc, uint8_t * | |||
491 | return err_dma; | 491 | return err_dma; |
492 | } | 492 | } |
493 | 493 | ||
494 | static const char *nth_str(const char *strings, int n) | ||
495 | { | ||
496 | while (n) { | ||
497 | n--; | ||
498 | strings += strlen(strings) + 1; | ||
499 | } | ||
500 | return strings; | ||
501 | } | ||
502 | |||
503 | static const char pkt_str[] ALIGN1 = | 494 | static const char pkt_str[] ALIGN1 = |
504 | "Direct-access device" "\0" /* word 0, bits 12-8 = 00 */ | 495 | "Direct-access device" "\0" /* word 0, bits 12-8 = 00 */ |
505 | "Sequential-access device" "\0" /* word 0, bits 12-8 = 01 */ | 496 | "Sequential-access device" "\0" /* word 0, bits 12-8 = 01 */ |
@@ -710,7 +701,7 @@ static void identify(uint16_t *val) | |||
710 | } else if (!(val[GEN_CONFIG] & NOT_ATAPI)) { | 701 | } else if (!(val[GEN_CONFIG] & NOT_ATAPI)) { |
711 | dev = ATAPI_DEV; | 702 | dev = ATAPI_DEV; |
712 | eqpt = (val[GEN_CONFIG] & EQPT_TYPE) >> SHIFT_EQPT; | 703 | eqpt = (val[GEN_CONFIG] & EQPT_TYPE) >> SHIFT_EQPT; |
713 | printf("ATAPI %s, with ", eqpt <= 0xf ? nth_str(pkt_str, eqpt) : "unknown"); | 704 | printf("ATAPI %s, with ", eqpt <= 0xf ? nth_string(pkt_str, eqpt) : "unknown"); |
714 | like_std = 3; | 705 | like_std = 3; |
715 | } else | 706 | } else |
716 | /* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */ | 707 | /* "Unknown device type:\n\tbits 15&14 of general configuration word 0 both set to 1.\n" */ |
@@ -748,7 +739,7 @@ static void identify(uint16_t *val) | |||
748 | if (val[MINOR] && (val[MINOR] <= MINOR_MAX)) { | 739 | if (val[MINOR] && (val[MINOR] <= MINOR_MAX)) { |
749 | if (like_std < 3) like_std = 3; | 740 | if (like_std < 3) like_std = 3; |
750 | std = actual_ver[val[MINOR]]; | 741 | std = actual_ver[val[MINOR]]; |
751 | if (std) printf("\n\tUsed: %s ", nth_str(minor_str, val[MINOR])); | 742 | if (std) printf("\n\tUsed: %s ", nth_string(minor_str, val[MINOR])); |
752 | 743 | ||
753 | } | 744 | } |
754 | /* looks like when they up-issue the std, they obsolete one; | 745 | /* looks like when they up-issue the std, they obsolete one; |
@@ -847,7 +838,7 @@ static void identify(uint16_t *val) | |||
847 | jj = val[GEN_CONFIG] >> 1; | 838 | jj = val[GEN_CONFIG] >> 1; |
848 | for (ii = 1; ii < 15; ii++) { | 839 | for (ii = 1; ii < 15; ii++) { |
849 | if (jj & 0x0001) | 840 | if (jj & 0x0001) |
850 | printf("\t%s\n", nth_str(ata1_cfg_str, ii)); | 841 | printf("\t%s\n", nth_string(ata1_cfg_str, ii)); |
851 | jj >>=1; | 842 | jj >>=1; |
852 | } | 843 | } |
853 | } | 844 | } |
@@ -1070,7 +1061,7 @@ static void identify(uint16_t *val) | |||
1070 | jj = val[CMDS_SUPP_0]; | 1061 | jj = val[CMDS_SUPP_0]; |
1071 | kk = val[CMDS_EN_0]; | 1062 | kk = val[CMDS_EN_0]; |
1072 | for (ii = 0; ii < NUM_CMD_FEAT_STR; ii++) { | 1063 | for (ii = 0; ii < NUM_CMD_FEAT_STR; ii++) { |
1073 | const char *feat_str = nth_str(cmd_feat_str, ii); | 1064 | const char *feat_str = nth_string(cmd_feat_str, ii); |
1074 | if ((jj & 0x8000) && (*feat_str != '\0')) { | 1065 | if ((jj & 0x8000) && (*feat_str != '\0')) { |
1075 | printf("\t%s\t%s\n", (kk & 0x8000) ? " *" : "", feat_str); | 1066 | printf("\t%s\t%s\n", (kk & 0x8000) ? " *" : "", feat_str); |
1076 | } | 1067 | } |
@@ -1088,7 +1079,7 @@ static void identify(uint16_t *val) | |||
1088 | } | 1079 | } |
1089 | /* Removable Media Status Notification feature set */ | 1080 | /* Removable Media Status Notification feature set */ |
1090 | if ((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP) | 1081 | if ((val[RM_STAT] & RM_STAT_BITS) == RM_STAT_SUP) |
1091 | printf("\t%s supported\n", nth_str(cmd_feat_str, 27)); | 1082 | printf("\t%s supported\n", nth_string(cmd_feat_str, 27)); |
1092 | 1083 | ||
1093 | /* security */ | 1084 | /* security */ |
1094 | if ((eqpt != CDROM) && (like_std > 3) | 1085 | if ((eqpt != CDROM) && (like_std > 3) |
@@ -1100,7 +1091,7 @@ static void identify(uint16_t *val) | |||
1100 | jj = val[SECU_STATUS]; | 1091 | jj = val[SECU_STATUS]; |
1101 | if (jj) { | 1092 | if (jj) { |
1102 | for (ii = 0; ii < NUM_SECU_STR; ii++) { | 1093 | for (ii = 0; ii < NUM_SECU_STR; ii++) { |
1103 | printf("\t%s\t%s\n", (!(jj & 0x0001)) ? "not" : "", nth_str(secu_str, ii)); | 1094 | printf("\t%s\t%s\n", (!(jj & 0x0001)) ? "not" : "", nth_string(secu_str, ii)); |
1104 | jj >>=1; | 1095 | jj >>=1; |
1105 | } | 1096 | } |
1106 | if (val[SECU_STATUS] & SECU_ENABLED) { | 1097 | if (val[SECU_STATUS] & SECU_ENABLED) { |
@@ -1182,13 +1173,13 @@ static void dump_identity(const struct hd_driveid *id) | |||
1182 | id->model, id->fw_rev, id->serial_no); | 1173 | id->model, id->fw_rev, id->serial_no); |
1183 | for (i = 0; i <= 15; i++) { | 1174 | for (i = 0; i <= 15; i++) { |
1184 | if (id->config & (1<<i)) | 1175 | if (id->config & (1<<i)) |
1185 | printf(" %s", nth_str(cfg_str, i)); | 1176 | printf(" %s", nth_string(cfg_str, i)); |
1186 | } | 1177 | } |
1187 | printf(" }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n" | 1178 | printf(" }\n RawCHS=%u/%u/%u, TrkSize=%u, SectSize=%u, ECCbytes=%u\n" |
1188 | " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u", | 1179 | " BuffType=(%u) %s, BuffSize=%ukB, MaxMultSect=%u", |
1189 | id->cyls, id->heads, id->sectors, id->track_bytes, | 1180 | id->cyls, id->heads, id->sectors, id->track_bytes, |
1190 | id->sector_bytes, id->ecc_bytes, | 1181 | id->sector_bytes, id->ecc_bytes, |
1191 | id->buf_type, nth_str(BuffType, (id->buf_type > 3) ? 0 : id->buf_type), | 1182 | id->buf_type, nth_string(BuffType, (id->buf_type > 3) ? 0 : id->buf_type), |
1192 | id->buf_size/2, id->max_multsect); | 1183 | id->buf_size/2, id->max_multsect); |
1193 | if (id->max_multsect) { | 1184 | if (id->max_multsect) { |
1194 | printf(", MultSect="); | 1185 | printf(", MultSect="); |
@@ -1294,7 +1285,7 @@ static void dump_identity(const struct hd_driveid *id) | |||
1294 | if ((id->minor_rev_num && id->minor_rev_num <= 31) | 1285 | if ((id->minor_rev_num && id->minor_rev_num <= 31) |
1295 | || (id->major_rev_num && id->minor_rev_num <= 31) | 1286 | || (id->major_rev_num && id->minor_rev_num <= 31) |
1296 | ) { | 1287 | ) { |
1297 | printf("\n Drive conforms to: %s: ", (id->minor_rev_num <= 31) ? nth_str(minor_str, id->minor_rev_num) : "unknown"); | 1288 | printf("\n Drive conforms to: %s: ", (id->minor_rev_num <= 31) ? nth_string(minor_str, id->minor_rev_num) : "unknown"); |
1298 | if (id->major_rev_num != 0x0000 && /* NOVAL_0 */ | 1289 | if (id->major_rev_num != 0x0000 && /* NOVAL_0 */ |
1299 | id->major_rev_num != 0xFFFF) { /* NOVAL_1 */ | 1290 | id->major_rev_num != 0xFFFF) { /* NOVAL_1 */ |
1300 | for (i = 0; i <= 15; i++) { | 1291 | for (i = 0; i <= 15; i++) { |
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 3dcb118ee..fff5f5d2e 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -164,7 +164,7 @@ struct in6_ifreq { | |||
164 | 164 | ||
165 | struct arg1opt { | 165 | struct arg1opt { |
166 | const char *name; | 166 | const char *name; |
167 | int selector; | 167 | unsigned short selector; |
168 | unsigned short ifr_offset; | 168 | unsigned short ifr_offset; |
169 | }; | 169 | }; |
170 | 170 | ||
@@ -183,70 +183,70 @@ struct options { | |||
183 | #define ifreq_offsetof(x) offsetof(struct ifreq, x) | 183 | #define ifreq_offsetof(x) offsetof(struct ifreq, x) |
184 | 184 | ||
185 | static const struct arg1opt Arg1Opt[] = { | 185 | static const struct arg1opt Arg1Opt[] = { |
186 | {"SIOCSIFMETRIC", SIOCSIFMETRIC, ifreq_offsetof(ifr_metric)}, | 186 | { "SIFMETRIC", SIOCSIFMETRIC, ifreq_offsetof(ifr_metric) }, |
187 | {"SIOCSIFMTU", SIOCSIFMTU, ifreq_offsetof(ifr_mtu)}, | 187 | { "SIFMTU", SIOCSIFMTU, ifreq_offsetof(ifr_mtu) }, |
188 | {"SIOCSIFTXQLEN", SIOCSIFTXQLEN, ifreq_offsetof(ifr_qlen)}, | 188 | { "SIFTXQLEN", SIOCSIFTXQLEN, ifreq_offsetof(ifr_qlen) }, |
189 | {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, | 189 | { "SIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr) }, |
190 | {"SIOCSIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask)}, | 190 | { "SIFNETMASK", SIOCSIFNETMASK, ifreq_offsetof(ifr_netmask) }, |
191 | {"SIOCSIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr)}, | 191 | { "SIFBRDADDR", SIOCSIFBRDADDR, ifreq_offsetof(ifr_broadaddr) }, |
192 | #if ENABLE_FEATURE_IFCONFIG_HW | 192 | #if ENABLE_FEATURE_IFCONFIG_HW |
193 | {"SIOCSIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr)}, | 193 | { "SIFHWADDR", SIOCSIFHWADDR, ifreq_offsetof(ifr_hwaddr) }, |
194 | #endif | 194 | #endif |
195 | {"SIOCSIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr)}, | 195 | { "SIFDSTADDR", SIOCSIFDSTADDR, ifreq_offsetof(ifr_dstaddr) }, |
196 | #ifdef SIOCSKEEPALIVE | 196 | #ifdef SIOCSKEEPALIVE |
197 | {"SIOCSKEEPALIVE", SIOCSKEEPALIVE, ifreq_offsetof(ifr_data)}, | 197 | { "SKEEPALIVE", SIOCSKEEPALIVE, ifreq_offsetof(ifr_data) }, |
198 | #endif | 198 | #endif |
199 | #ifdef SIOCSOUTFILL | 199 | #ifdef SIOCSOUTFILL |
200 | {"SIOCSOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data)}, | 200 | { "SOUTFILL", SIOCSOUTFILL, ifreq_offsetof(ifr_data) }, |
201 | #endif | 201 | #endif |
202 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ | 202 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ |
203 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start)}, | 203 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.mem_start) }, |
204 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr)}, | 204 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.base_addr) }, |
205 | {"SIOCSIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq)}, | 205 | { "SIFMAP", SIOCSIFMAP, ifreq_offsetof(ifr_map.irq) }, |
206 | #endif | 206 | #endif |
207 | /* Last entry if for unmatched (possibly hostname) arg. */ | 207 | /* Last entry if for unmatched (possibly hostname) arg. */ |
208 | #if ENABLE_FEATURE_IPV6 | 208 | #if ENABLE_FEATURE_IPV6 |
209 | {"SIOCSIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr)}, /* IPv6 version ignores the offset */ | 209 | { "SIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr) }, /* IPv6 version ignores the offset */ |
210 | {"SIOCDIFADDR", SIOCDIFADDR, ifreq_offsetof(ifr_addr)}, /* IPv6 version ignores the offset */ | 210 | { "DIFADDR", SIOCDIFADDR, ifreq_offsetof(ifr_addr) }, /* IPv6 version ignores the offset */ |
211 | #endif | 211 | #endif |
212 | {"SIOCSIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr)}, | 212 | { "SIFADDR", SIOCSIFADDR, ifreq_offsetof(ifr_addr) }, |
213 | }; | 213 | }; |
214 | 214 | ||
215 | static const struct options OptArray[] = { | 215 | static const struct options OptArray[] = { |
216 | {"metric", N_ARG, ARG_METRIC, 0}, | 216 | { "metric", N_ARG, ARG_METRIC, 0 }, |
217 | {"mtu", N_ARG, ARG_MTU, 0}, | 217 | { "mtu", N_ARG, ARG_MTU, 0 }, |
218 | {"txqueuelen", N_ARG, ARG_TXQUEUELEN, 0}, | 218 | { "txqueuelen", N_ARG, ARG_TXQUEUELEN, 0 }, |
219 | {"dstaddr", N_ARG, ARG_DSTADDR, 0}, | 219 | { "dstaddr", N_ARG, ARG_DSTADDR, 0 }, |
220 | {"netmask", N_ARG, ARG_NETMASK, 0}, | 220 | { "netmask", N_ARG, ARG_NETMASK, 0 }, |
221 | {"broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST}, | 221 | { "broadcast", N_ARG | M_CLR, ARG_BROADCAST, IFF_BROADCAST }, |
222 | #if ENABLE_FEATURE_IFCONFIG_HW | 222 | #if ENABLE_FEATURE_IFCONFIG_HW |
223 | {"hw", N_ARG, ARG_HW, 0}, | 223 | { "hw", N_ARG, ARG_HW, 0 }, |
224 | #endif | 224 | #endif |
225 | {"pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT}, | 225 | { "pointopoint", N_ARG | M_CLR, ARG_POINTOPOINT, IFF_POINTOPOINT }, |
226 | #ifdef SIOCSKEEPALIVE | 226 | #ifdef SIOCSKEEPALIVE |
227 | {"keepalive", N_ARG, ARG_KEEPALIVE, 0}, | 227 | { "keepalive", N_ARG, ARG_KEEPALIVE, 0 }, |
228 | #endif | 228 | #endif |
229 | #ifdef SIOCSOUTFILL | 229 | #ifdef SIOCSOUTFILL |
230 | {"outfill", N_ARG, ARG_OUTFILL, 0}, | 230 | { "outfill", N_ARG, ARG_OUTFILL, 0 }, |
231 | #endif | 231 | #endif |
232 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ | 232 | #if ENABLE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ |
233 | {"mem_start", N_ARG, ARG_MEM_START, 0}, | 233 | { "mem_start", N_ARG, ARG_MEM_START, 0 }, |
234 | {"io_addr", N_ARG, ARG_IO_ADDR, 0}, | 234 | { "io_addr", N_ARG, ARG_IO_ADDR, 0 }, |
235 | {"irq", N_ARG, ARG_IRQ, 0}, | 235 | { "irq", N_ARG, ARG_IRQ, 0 }, |
236 | #endif | 236 | #endif |
237 | #if ENABLE_FEATURE_IPV6 | 237 | #if ENABLE_FEATURE_IPV6 |
238 | {"add", N_ARG, ARG_ADD_DEL, 0}, | 238 | { "add", N_ARG, ARG_ADD_DEL, 0 }, |
239 | {"del", N_ARG, ARG_ADD_DEL, 0}, | 239 | { "del", N_ARG, ARG_ADD_DEL, 0 }, |
240 | #endif | 240 | #endif |
241 | {"arp", N_CLR | M_SET, 0, IFF_NOARP}, | 241 | { "arp", N_CLR | M_SET, 0, IFF_NOARP }, |
242 | {"trailers", N_CLR | M_SET, 0, IFF_NOTRAILERS}, | 242 | { "trailers", N_CLR | M_SET, 0, IFF_NOTRAILERS }, |
243 | {"promisc", N_SET | M_CLR, 0, IFF_PROMISC}, | 243 | { "promisc", N_SET | M_CLR, 0, IFF_PROMISC }, |
244 | {"multicast", N_SET | M_CLR, 0, IFF_MULTICAST}, | 244 | { "multicast", N_SET | M_CLR, 0, IFF_MULTICAST }, |
245 | {"allmulti", N_SET | M_CLR, 0, IFF_ALLMULTI}, | 245 | { "allmulti", N_SET | M_CLR, 0, IFF_ALLMULTI }, |
246 | {"dynamic", N_SET | M_CLR, 0, IFF_DYNAMIC}, | 246 | { "dynamic", N_SET | M_CLR, 0, IFF_DYNAMIC }, |
247 | {"up", N_SET, 0, (IFF_UP | IFF_RUNNING)}, | 247 | { "up", N_SET, 0, (IFF_UP | IFF_RUNNING) }, |
248 | {"down", N_CLR, 0, IFF_UP}, | 248 | { "down", N_CLR, 0, IFF_UP }, |
249 | {NULL, 0, ARG_HOSTNAME, (IFF_UP | IFF_RUNNING)} | 249 | { NULL, 0, ARG_HOSTNAME, (IFF_UP | IFF_RUNNING) } |
250 | }; | 250 | }; |
251 | 251 | ||
252 | /* | 252 | /* |
@@ -405,7 +405,7 @@ int ifconfig_main(int argc, char **argv) | |||
405 | xioctl(sockfd6, SIOGIFINDEX, &ifr); | 405 | xioctl(sockfd6, SIOGIFINDEX, &ifr); |
406 | ifr6.ifr6_ifindex = ifr.ifr_ifindex; | 406 | ifr6.ifr6_ifindex = ifr.ifr_ifindex; |
407 | ifr6.ifr6_prefixlen = prefix_len; | 407 | ifr6.ifr6_prefixlen = prefix_len; |
408 | ioctl_or_perror_and_die(sockfd6, a1op->selector, &ifr6, "%s", a1op->name); | 408 | ioctl_or_perror_and_die(sockfd6, a1op->selector, &ifr6, "SIOC%s", a1op->name); |
409 | if (ENABLE_FEATURE_CLEAN_UP) | 409 | if (ENABLE_FEATURE_CLEAN_UP) |
410 | free(lsa); | 410 | free(lsa); |
411 | continue; | 411 | continue; |
@@ -457,7 +457,7 @@ int ifconfig_main(int argc, char **argv) | |||
457 | *((int *) p) = i; | 457 | *((int *) p) = i; |
458 | } | 458 | } |
459 | 459 | ||
460 | ioctl_or_perror_and_die(sockfd, a1op->selector, &ifr, "%s", a1op->name); | 460 | ioctl_or_perror_and_die(sockfd, a1op->selector, &ifr, "SIOC%s", a1op->name); |
461 | #ifdef QUESTIONABLE_ALIAS_CASE | 461 | #ifdef QUESTIONABLE_ALIAS_CASE |
462 | if (mask & A_COLON_CHK) { | 462 | if (mask & A_COLON_CHK) { |
463 | /* | 463 | /* |