diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 19:56:34 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-03 19:56:34 +0000 |
commit | 9275814a9e6a3af390c932238c0b1130de8d0edd (patch) | |
tree | beabb5991332e0e2af56b4cb885a8fd6fc7daae2 | |
parent | cf94446af7a75385955e0c4de2d5898b219f5719 (diff) | |
download | busybox-w32-9275814a9e6a3af390c932238c0b1130de8d0edd.tar.gz busybox-w32-9275814a9e6a3af390c932238c0b1130de8d0edd.tar.bz2 busybox-w32-9275814a9e6a3af390c932238c0b1130de8d0edd.zip |
lots of silly indent fixes
-rw-r--r-- | editors/awk.c | 4 | ||||
-rw-r--r-- | editors/sed.c | 2 | ||||
-rw-r--r-- | editors/vi.c | 4 | ||||
-rw-r--r-- | findutils/grep.c | 2 | ||||
-rw-r--r-- | networking/httpd.c | 26 | ||||
-rw-r--r-- | networking/libiproute/ip_parse_common_args.c | 4 | ||||
-rw-r--r-- | networking/telnet.c | 6 | ||||
-rw-r--r-- | networking/traceroute.c | 16 | ||||
-rw-r--r-- | shell/cmdedit.c | 163 | ||||
-rw-r--r-- | util-linux/fdformat.c | 54 | ||||
-rw-r--r-- | util-linux/fdisk.c | 4 | ||||
-rw-r--r-- | util-linux/mdev.c | 2 |
12 files changed, 143 insertions, 144 deletions
diff --git a/editors/awk.c b/editors/awk.c index bebc78092..b46f25c0a 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -1764,7 +1764,7 @@ static char *awk_printf(node *n) | |||
1764 | is_numeric(arg) ? (char)getvar_i(arg) : *getvar_s(arg)); | 1764 | is_numeric(arg) ? (char)getvar_i(arg) : *getvar_s(arg)); |
1765 | 1765 | ||
1766 | } else if (c == 's') { | 1766 | } else if (c == 's') { |
1767 | s1 = getvar_s(arg); | 1767 | s1 = getvar_s(arg); |
1768 | qrealloc(&b, incr+i+strlen(s1), &bsize); | 1768 | qrealloc(&b, incr+i+strlen(s1), &bsize); |
1769 | i += sprintf(b+i, s, s1); | 1769 | i += sprintf(b+i, s, s1); |
1770 | 1770 | ||
@@ -2434,7 +2434,7 @@ re_cont: | |||
2434 | R.d--; | 2434 | R.d--; |
2435 | goto r_op_change; | 2435 | goto r_op_change; |
2436 | case '!': | 2436 | case '!': |
2437 | L.d = istrue(X.v) ? 0 : 1; | 2437 | L.d = istrue(X.v) ? 0 : 1; |
2438 | break; | 2438 | break; |
2439 | case '-': | 2439 | case '-': |
2440 | L.d = -R.d; | 2440 | L.d = -R.d; |
diff --git a/editors/sed.c b/editors/sed.c index 54d08ee02..94dc820be 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -153,7 +153,7 @@ void sed_free_and_close_stuff(void) | |||
153 | 153 | ||
154 | if(bbg.hold_space) free(bbg.hold_space); | 154 | if(bbg.hold_space) free(bbg.hold_space); |
155 | 155 | ||
156 | while(bbg.current_input_file<bbg.input_file_count) | 156 | while(bbg.current_input_file<bbg.input_file_count) |
157 | fclose(bbg.input_file_list[bbg.current_input_file++]); | 157 | fclose(bbg.input_file_list[bbg.current_input_file++]); |
158 | } | 158 | } |
159 | #endif | 159 | #endif |
diff --git a/editors/vi.c b/editors/vi.c index 8ff118ffb..fa30cf29c 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -3501,8 +3501,8 @@ key_cmd_mode: | |||
3501 | if (file_modified) { | 3501 | if (file_modified) { |
3502 | #ifdef CONFIG_FEATURE_VI_READONLY | 3502 | #ifdef CONFIG_FEATURE_VI_READONLY |
3503 | if (vi_readonly || readonly) { | 3503 | if (vi_readonly || readonly) { |
3504 | psbs("\"%s\" File is read only", cfn); | 3504 | psbs("\"%s\" File is read only", cfn); |
3505 | break; | 3505 | break; |
3506 | } | 3506 | } |
3507 | #endif /* CONFIG_FEATURE_VI_READONLY */ | 3507 | #endif /* CONFIG_FEATURE_VI_READONLY */ |
3508 | cnt = file_write(cfn, text, end - 1); | 3508 | cnt = file_write(cfn, text, end - 1); |
diff --git a/findutils/grep.c b/findutils/grep.c index e02fc8d10..5659a7d2b 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -233,7 +233,7 @@ static int grep_file(FILE *file) | |||
233 | if (PRINT_MATCH_COUNTS) { | 233 | if (PRINT_MATCH_COUNTS) { |
234 | if (print_filename > 0) | 234 | if (print_filename > 0) |
235 | printf("%s:", cur_file); | 235 | printf("%s:", cur_file); |
236 | printf("%d\n", nmatches); | 236 | printf("%d\n", nmatches); |
237 | } | 237 | } |
238 | 238 | ||
239 | /* grep -l: print just the filename, but only if we grepped the line in the file */ | 239 | /* grep -l: print just the filename, but only if we grepped the line in the file */ |
diff --git a/networking/httpd.c b/networking/httpd.c index 7388bb67e..e533594f2 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -325,20 +325,20 @@ static int scan_ip_mask(const char *ipm, unsigned int *ip, unsigned int *mask) | |||
325 | 325 | ||
326 | i = 0; | 326 | i = 0; |
327 | while (*p) { | 327 | while (*p) { |
328 | if (*p < '0' || *p > '9') { | 328 | if (*p < '0' || *p > '9') { |
329 | if (*p == '.') { | 329 | if (*p == '.') { |
330 | i = scan_ip(&ipm, mask, 0); | 330 | i = scan_ip(&ipm, mask, 0); |
331 | return i != 32; | 331 | return i != 32; |
332 | } | ||
333 | return -1; | ||
334 | } | 332 | } |
335 | i *= 10; | 333 | return -1; |
336 | i += *p - '0'; | 334 | } |
337 | p++; | 335 | i *= 10; |
336 | i += *p - '0'; | ||
337 | p++; | ||
338 | } | 338 | } |
339 | } | 339 | } |
340 | if (i > 32 || i < 0) | 340 | if (i > 32 || i < 0) |
341 | return -1; | 341 | return -1; |
342 | msk = 0x80000000; | 342 | msk = 0x80000000; |
343 | *mask = 0; | 343 | *mask = 0; |
344 | while (i > 0) { | 344 | while (i > 0) { |
@@ -553,7 +553,7 @@ static void parse_conf(const char *path, int flag) | |||
553 | } else if ((cf[1] == '.') && (cf[2] == '/' || cf[2] == 0)) { | 553 | } else if ((cf[1] == '.') && (cf[2] == '/' || cf[2] == 0)) { |
554 | ++cf; | 554 | ++cf; |
555 | if (p > p0) { | 555 | if (p > p0) { |
556 | while (*--p != '/'); /* omit previous dir */ | 556 | while (*--p != '/') /* omit previous dir */; |
557 | } | 557 | } |
558 | continue; | 558 | continue; |
559 | } | 559 | } |
@@ -1571,8 +1571,8 @@ BAD_REQUEST: | |||
1571 | /* protect out root */ | 1571 | /* protect out root */ |
1572 | goto BAD_REQUEST; | 1572 | goto BAD_REQUEST; |
1573 | } | 1573 | } |
1574 | while (*--purl != '/'); /* omit previous dir */ | 1574 | while (*--purl != '/') /* omit previous dir */; |
1575 | continue; | 1575 | continue; |
1576 | } | 1576 | } |
1577 | } | 1577 | } |
1578 | } | 1578 | } |
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index e7084fbc6..fee6e5e95 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c | |||
@@ -48,8 +48,8 @@ void ip_parse_common_args(int *argcp, char ***argvp) | |||
48 | if (matches(opt, "-family") == 0) { | 48 | if (matches(opt, "-family") == 0) { |
49 | argc--; | 49 | argc--; |
50 | argv++; | 50 | argv++; |
51 | if (! argv[1]) | 51 | if (!argv[1]) |
52 | bb_show_usage(); | 52 | bb_show_usage(); |
53 | if (strcmp(argv[1], "inet") == 0) | 53 | if (strcmp(argv[1], "inet") == 0) |
54 | preferred_family = AF_INET; | 54 | preferred_family = AF_INET; |
55 | else if (strcmp(argv[1], "inet6") == 0) | 55 | else if (strcmp(argv[1], "inet6") == 0) |
diff --git a/networking/telnet.c b/networking/telnet.c index 344fc3270..fd0f84d50 100644 --- a/networking/telnet.c +++ b/networking/telnet.c | |||
@@ -205,12 +205,12 @@ static void handlenetoutput(int len) | |||
205 | } | 205 | } |
206 | outbuf[j++] = *p; | 206 | outbuf[j++] = *p; |
207 | if (*p == 0xff) | 207 | if (*p == 0xff) |
208 | outbuf[j++] = 0xff; | 208 | outbuf[j++] = 0xff; |
209 | else if (*p == 0x0d) | 209 | else if (*p == 0x0d) |
210 | outbuf[j++] = 0x00; | 210 | outbuf[j++] = 0x00; |
211 | } | 211 | } |
212 | if (j > 0 ) | 212 | if (j > 0 ) |
213 | write(G.netfd, outbuf, j); | 213 | write(G.netfd, outbuf, j); |
214 | } | 214 | } |
215 | 215 | ||
216 | 216 | ||
diff --git a/networking/traceroute.c b/networking/traceroute.c index 80ce5c3ee..e7e131149 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c | |||
@@ -641,7 +641,7 @@ send_probe(int seq, int ttl, struct timeval *tp) | |||
641 | outicmp->icmp_cksum = 0xffff; | 641 | outicmp->icmp_cksum = 0xffff; |
642 | } else | 642 | } else |
643 | #endif | 643 | #endif |
644 | if (doipcksum) { | 644 | if (doipcksum) { |
645 | /* Checksum (we must save and restore ip header) */ | 645 | /* Checksum (we must save and restore ip header) */ |
646 | tip = *outip; | 646 | tip = *outip; |
647 | ui = (struct udpiphdr *)outip; | 647 | ui = (struct udpiphdr *)outip; |
@@ -788,7 +788,7 @@ packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq) | |||
788 | return (type == ICMP_TIMXCEED ? -1 : code + 1); | 788 | return (type == ICMP_TIMXCEED ? -1 : code + 1); |
789 | } else | 789 | } else |
790 | #endif | 790 | #endif |
791 | { | 791 | { |
792 | up = (struct udphdr *)((unsigned char *)hip + hlen); | 792 | up = (struct udphdr *)((unsigned char *)hip + hlen); |
793 | /* XXX 8 is a magic number */ | 793 | /* XXX 8 is a magic number */ |
794 | if (hlen + 12 <= cc && | 794 | if (hlen + 12 <= cc && |
@@ -996,11 +996,11 @@ traceroute_main(int argc, char *argv[]) | |||
996 | if(nprobes_str) | 996 | if(nprobes_str) |
997 | nprobes = str2val(nprobes_str, "nprobes", 1, -1); | 997 | nprobes = str2val(nprobes_str, "nprobes", 1, -1); |
998 | if(source) { | 998 | if(source) { |
999 | /* | 999 | /* |
1000 | * set the ip source address of the outbound | 1000 | * set the ip source address of the outbound |
1001 | * probe (e.g., on a multi-homed host). | 1001 | * probe (e.g., on a multi-homed host). |
1002 | */ | 1002 | */ |
1003 | if (getuid()) bb_error_msg_and_die("-s %s: Permission denied", source); | 1003 | if (getuid()) bb_error_msg_and_die("-s %s: permission denied", source); |
1004 | } | 1004 | } |
1005 | if(waittime_str) | 1005 | if(waittime_str) |
1006 | waittime = str2val(waittime_str, "wait time", 2, 24 * 60 * 60); | 1006 | waittime = str2val(waittime_str, "wait time", 2, 24 * 60 * 60); |
@@ -1015,7 +1015,7 @@ traceroute_main(int argc, char *argv[]) | |||
1015 | 1015 | ||
1016 | for(l_sr = sourse_route_list; l_sr; ) { | 1016 | for(l_sr = sourse_route_list; l_sr; ) { |
1017 | if (lsrr >= NGATEWAYS) | 1017 | if (lsrr >= NGATEWAYS) |
1018 | bb_error_msg_and_die("No more than %d gateways", NGATEWAYS); | 1018 | bb_error_msg_and_die("no more than %d gateways", NGATEWAYS); |
1019 | getaddr(gwlist + lsrr, l_sr->data); | 1019 | getaddr(gwlist + lsrr, l_sr->data); |
1020 | ++lsrr; | 1020 | ++lsrr; |
1021 | l_sr = l_sr->link; | 1021 | l_sr = l_sr->link; |
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index fb1946e83..9a57f750e 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -271,7 +271,6 @@ static void input_backward(int num) | |||
271 | if (num < 4) | 271 | if (num < 4) |
272 | while (num-- > 0) | 272 | while (num-- > 0) |
273 | putchar('\b'); | 273 | putchar('\b'); |
274 | |||
275 | else | 274 | else |
276 | printf("\033[%dD", num); | 275 | printf("\033[%dD", num); |
277 | } else { | 276 | } else { |
@@ -370,7 +369,7 @@ static void parse_prompt(const char *prmt_ptr) | |||
370 | pbuf = buf2; | 369 | pbuf = buf2; |
371 | *pbuf = '~'; | 370 | *pbuf = '~'; |
372 | strcpy(pbuf+1, pwd_buf+l); | 371 | strcpy(pbuf+1, pwd_buf+l); |
373 | } | 372 | } |
374 | break; | 373 | break; |
375 | #endif | 374 | #endif |
376 | case 'W': | 375 | case 'W': |
@@ -712,7 +711,7 @@ static char *add_quote_for_spec_chars(char *found, int add) | |||
712 | s[l++] = *found++; | 711 | s[l++] = *found++; |
713 | } | 712 | } |
714 | if(add) | 713 | if(add) |
715 | s[l++] = (char)add; | 714 | s[l++] = (char)add; |
716 | s[l] = 0; | 715 | s[l] = 0; |
717 | return s; | 716 | return s; |
718 | } | 717 | } |
@@ -995,7 +994,7 @@ static void showfiles(void) | |||
995 | for (row = 0; row < nrows; row++) { | 994 | for (row = 0; row < nrows; row++) { |
996 | l = strlen(matches[row]); | 995 | l = strlen(matches[row]); |
997 | if(add_char_to_match[row]) | 996 | if(add_char_to_match[row]) |
998 | l++; | 997 | l++; |
999 | if (column_width < l) | 998 | if (column_width < l) |
1000 | column_width = l; | 999 | column_width = l; |
1001 | } | 1000 | } |
@@ -1021,8 +1020,8 @@ static void showfiles(void) | |||
1021 | printf("%s%s", matches[n], str_add_chr); | 1020 | printf("%s%s", matches[n], str_add_chr); |
1022 | l = strlen(matches[n]); | 1021 | l = strlen(matches[n]); |
1023 | while(l < acol) { | 1022 | while(l < acol) { |
1024 | putchar(' '); | 1023 | putchar(' '); |
1025 | l++; | 1024 | l++; |
1026 | } | 1025 | } |
1027 | } | 1026 | } |
1028 | str_add_chr[0] = add_char_to_match[n]; | 1027 | str_add_chr[0] = add_char_to_match[n]; |
@@ -1081,30 +1080,32 @@ static void input_tab(int *lastWasTab) | |||
1081 | int i, j, n, srt; | 1080 | int i, j, n, srt; |
1082 | /* bubble */ | 1081 | /* bubble */ |
1083 | n = num_matches; | 1082 | n = num_matches; |
1084 | for(i=0; i<(n-1); i++) | 1083 | for(i=0; i<(n-1); i++) { |
1085 | for(j=i+1; j<n; j++) | 1084 | for(j=i+1; j<n; j++) { |
1086 | if(matches[i]!=NULL && matches[j]!=NULL) { | 1085 | if(matches[i]!=NULL && matches[j]!=NULL) { |
1087 | srt = strcmp(matches[i], matches[j]); | 1086 | srt = strcmp(matches[i], matches[j]); |
1088 | if(srt == 0) { | 1087 | if(srt == 0) { |
1089 | free(matches[j]); | 1088 | free(matches[j]); |
1090 | matches[j]=0; | 1089 | matches[j]=0; |
1091 | } else if(srt > 0) { | 1090 | } else if(srt > 0) { |
1092 | tmp1 = matches[i]; | 1091 | tmp1 = matches[i]; |
1093 | matches[i] = matches[j]; | 1092 | matches[i] = matches[j]; |
1094 | matches[j] = tmp1; | 1093 | matches[j] = tmp1; |
1095 | srt = add_char_to_match[i]; | 1094 | srt = add_char_to_match[i]; |
1096 | add_char_to_match[i] = add_char_to_match[j]; | 1095 | add_char_to_match[i] = add_char_to_match[j]; |
1097 | add_char_to_match[j] = srt; | 1096 | add_char_to_match[j] = srt; |
1098 | } | 1097 | } |
1098 | } | ||
1099 | } | 1099 | } |
1100 | } | ||
1100 | j = n; | 1101 | j = n; |
1101 | n = 0; | 1102 | n = 0; |
1102 | for(i=0; i<j; i++) | 1103 | for(i=0; i<j; i++) |
1103 | if(matches[i]) { | 1104 | if(matches[i]) { |
1104 | matches[n]=matches[i]; | 1105 | matches[n]=matches[i]; |
1105 | add_char_to_match[n]=add_char_to_match[i]; | 1106 | add_char_to_match[n]=add_char_to_match[i]; |
1106 | n++; | 1107 | n++; |
1107 | } | 1108 | } |
1108 | num_matches = n; | 1109 | num_matches = n; |
1109 | } | 1110 | } |
1110 | /* Did we find exactly one match? */ | 1111 | /* Did we find exactly one match? */ |
@@ -1623,61 +1624,61 @@ prepare_to_die: | |||
1623 | /* fall through */ | 1624 | /* fall through */ |
1624 | case 'd'|vbit: | 1625 | case 'd'|vbit: |
1625 | { | 1626 | { |
1626 | int nc, sc; | 1627 | int nc, sc; |
1627 | sc = cursor; | 1628 | sc = cursor; |
1628 | prevc = ic; | 1629 | prevc = ic; |
1629 | if (safe_read(0, &c, 1) < 1) | 1630 | if (safe_read(0, &c, 1) < 1) |
1630 | goto prepare_to_die; | 1631 | goto prepare_to_die; |
1631 | if (c == (prevc & 0xff)) { | 1632 | if (c == (prevc & 0xff)) { |
1632 | /* "cc", "dd" */ | 1633 | /* "cc", "dd" */ |
1633 | input_backward(cursor); | 1634 | input_backward(cursor); |
1634 | goto clear_to_eol; | 1635 | goto clear_to_eol; |
1635 | break; | 1636 | break; |
1636 | } | 1637 | } |
1637 | switch(c) { | 1638 | switch(c) { |
1638 | case 'w': | 1639 | case 'w': |
1639 | case 'W': | 1640 | case 'W': |
1640 | case 'e': | 1641 | case 'e': |
1641 | case 'E': | 1642 | case 'E': |
1642 | switch (c) { | 1643 | switch (c) { |
1643 | case 'w': /* "dw", "cw" */ | 1644 | case 'w': /* "dw", "cw" */ |
1644 | vi_word_motion(command, vi_cmdmode); | 1645 | vi_word_motion(command, vi_cmdmode); |
1645 | break; | 1646 | break; |
1646 | case 'W': /* 'dW', 'cW' */ | 1647 | case 'W': /* 'dW', 'cW' */ |
1647 | vi_Word_motion(command, vi_cmdmode); | 1648 | vi_Word_motion(command, vi_cmdmode); |
1648 | break; | 1649 | break; |
1649 | case 'e': /* 'de', 'ce' */ | 1650 | case 'e': /* 'de', 'ce' */ |
1650 | vi_end_motion(command); | 1651 | vi_end_motion(command); |
1651 | input_forward(); | 1652 | input_forward(); |
1652 | break; | 1653 | break; |
1653 | case 'E': /* 'dE', 'cE' */ | 1654 | case 'E': /* 'dE', 'cE' */ |
1654 | vi_End_motion(command); | 1655 | vi_End_motion(command); |
1655 | input_forward(); | 1656 | input_forward(); |
1656 | break; | 1657 | break; |
1657 | } | 1658 | } |
1658 | nc = cursor; | 1659 | nc = cursor; |
1659 | input_backward(cursor - sc); | 1660 | input_backward(cursor - sc); |
1660 | while (nc-- > cursor) | 1661 | while (nc-- > cursor) |
1661 | input_delete(1); | 1662 | input_delete(1); |
1662 | break; | 1663 | break; |
1663 | case 'b': /* "db", "cb" */ | 1664 | case 'b': /* "db", "cb" */ |
1664 | case 'B': /* implemented as B */ | 1665 | case 'B': /* implemented as B */ |
1665 | if (c == 'b') | 1666 | if (c == 'b') |
1666 | vi_back_motion(command); | 1667 | vi_back_motion(command); |
1667 | else | 1668 | else |
1668 | vi_Back_motion(command); | 1669 | vi_Back_motion(command); |
1669 | while (sc-- > cursor) | 1670 | while (sc-- > cursor) |
1670 | input_delete(1); | 1671 | input_delete(1); |
1671 | break; | 1672 | break; |
1672 | case ' ': /* "d ", "c " */ | 1673 | case ' ': /* "d ", "c " */ |
1673 | input_delete(1); | 1674 | input_delete(1); |
1674 | break; | 1675 | break; |
1675 | case '$': /* "d$", "c$" */ | 1676 | case '$': /* "d$", "c$" */ |
1676 | clear_to_eol: | 1677 | clear_to_eol: |
1677 | while (cursor < len) | 1678 | while (cursor < len) |
1678 | input_delete(1); | 1679 | input_delete(1); |
1679 | break; | 1680 | break; |
1680 | } | 1681 | } |
1681 | } | 1682 | } |
1682 | break; | 1683 | break; |
1683 | case 'p'|vbit: | 1684 | case 'p'|vbit: |
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index efbdcc8fe..1441b9228 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c | |||
@@ -47,7 +47,7 @@ struct format_descr { | |||
47 | 47 | ||
48 | static void xioctl(int fd, int request, void *argp, const char *string) | 48 | static void xioctl(int fd, int request, void *argp, const char *string) |
49 | { | 49 | { |
50 | if (ioctl (fd, request, argp) < 0) { | 50 | if (ioctl(fd, request, argp) < 0) { |
51 | bb_perror_msg_and_die(string); | 51 | bb_perror_msg_and_die(string); |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -67,17 +67,16 @@ int fdformat_main(int argc,char **argv) | |||
67 | argv += optind; | 67 | argv += optind; |
68 | 68 | ||
69 | /* R_OK is needed for verifying */ | 69 | /* R_OK is needed for verifying */ |
70 | if (stat(*argv,&st) < 0 || access(*argv,W_OK | R_OK ) < 0) { | 70 | if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) { |
71 | bb_perror_msg_and_die("%s",*argv); | 71 | bb_perror_msg_and_die("%s", *argv); |
72 | } | 72 | } |
73 | if (!S_ISBLK(st.st_mode)) { | 73 | if (!S_ISBLK(st.st_mode)) { |
74 | bb_error_msg_and_die("%s: not a block device",*argv); | 74 | bb_error_msg_and_die("%s: not a block device", *argv); |
75 | /* do not test major - perhaps this was an USB floppy */ | 75 | /* do not test major - perhaps this was an USB floppy */ |
76 | } | 76 | } |
77 | 77 | ||
78 | |||
79 | /* O_RDWR for formatting and verifying */ | 78 | /* O_RDWR for formatting and verifying */ |
80 | fd = xopen(*argv,O_RDWR ); | 79 | fd = xopen(*argv, O_RDWR); |
81 | 80 | ||
82 | xioctl(fd, FDGETPRM, ¶m, "FDGETPRM");/*original message was: "Could not determine current format type" */ | 81 | xioctl(fd, FDGETPRM, ¶m, "FDGETPRM");/*original message was: "Could not determine current format type" */ |
83 | 82 | ||
@@ -86,44 +85,45 @@ int fdformat_main(int argc,char **argv) | |||
86 | param.track, param.sect, param.size >> 1); | 85 | param.track, param.sect, param.size >> 1); |
87 | 86 | ||
88 | /* FORMAT */ | 87 | /* FORMAT */ |
89 | printf("Formatting ... "); | 88 | printf("Formatting... "); |
90 | xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG"); | 89 | xioctl(fd, FDFMTBEG, NULL, "FDFMTBEG"); |
91 | 90 | ||
92 | /* n == track */ | 91 | /* n == track */ |
93 | for (n = 0; n < param.track; n++) | 92 | for (n = 0; n < param.track; n++) { |
94 | { | 93 | descr.head = 0; |
95 | descr.head = 0; | 94 | descr.track = n; |
96 | descr.track = n; | 95 | xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK"); |
97 | xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); | 96 | printf("%3d\b\b\b", n); |
98 | printf("%3d\b\b\b", n); | 97 | if (param.head == 2) { |
99 | if (param.head == 2) { | 98 | descr.head = 1; |
100 | descr.head = 1; | 99 | xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK"); |
101 | xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK"); | 100 | } |
102 | } | ||
103 | } | 101 | } |
104 | 102 | ||
105 | xioctl(fd,FDFMTEND,NULL,"FDFMTEND"); | 103 | xioctl(fd, FDFMTEND, NULL, "FDFMTEND"); |
106 | printf("done\n"); | 104 | printf("done\n"); |
107 | 105 | ||
108 | /* VERIFY */ | 106 | /* VERIFY */ |
109 | if(verify) { | 107 | if (verify) { |
110 | /* n == cyl_size */ | 108 | /* n == cyl_size */ |
111 | n = param.sect*param.head*512; | 109 | n = param.sect*param.head*512; |
112 | 110 | ||
113 | data = xmalloc(n); | 111 | data = xmalloc(n); |
114 | printf("Verifying ... "); | 112 | printf("Verifying... "); |
115 | for (cyl = 0; cyl < param.track; cyl++) { | 113 | for (cyl = 0; cyl < param.track; cyl++) { |
116 | printf("%3d\b\b\b", cyl); | 114 | printf("%3d\b\b\b", cyl); |
117 | if((read_bytes = safe_read(fd,data,n))!= n ) { | 115 | read_bytes = safe_read(fd, data, n); |
118 | if(read_bytes < 0) { | 116 | if (read_bytes != n) { |
117 | if (read_bytes < 0) { | ||
119 | bb_perror_msg(bb_msg_read_error); | 118 | bb_perror_msg(bb_msg_read_error); |
120 | } | 119 | } |
121 | bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); | 120 | bb_error_msg_and_die("problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes); |
121 | // FIXME: maybe better seek & continue?? | ||
122 | } | 122 | } |
123 | /* Check backwards so we don't need a counter */ | 123 | /* Check backwards so we don't need a counter */ |
124 | while(--read_bytes>=0) { | 124 | while (--read_bytes >= 0) { |
125 | if( data[read_bytes] != FD_FILL_BYTE) { | 125 | if (data[read_bytes] != FD_FILL_BYTE) { |
126 | printf("bad data in cyl %d\nContinuing ... ",cyl); | 126 | printf("bad data in cyl %d\nContinuing... ",cyl); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | } | 129 | } |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 55f716657..85acaa4aa 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -4506,8 +4506,7 @@ change_sysid(void) | |||
4506 | label_sun != current_label_type && !get_nr_sects(p)) | 4506 | label_sun != current_label_type && !get_nr_sects(p)) |
4507 | { | 4507 | { |
4508 | printf(_("Partition %d does not exist yet!\n"), i + 1); | 4508 | printf(_("Partition %d does not exist yet!\n"), i + 1); |
4509 | }else{ | 4509 | } else while (1) { |
4510 | while (1) { | ||
4511 | sys = read_hex (get_sys_types()); | 4510 | sys = read_hex (get_sys_types()); |
4512 | 4511 | ||
4513 | if (!sys && label_sgi != current_label_type && | 4512 | if (!sys && label_sgi != current_label_type && |
@@ -4573,7 +4572,6 @@ change_sysid(void) | |||
4573 | dos_changed = 1; | 4572 | dos_changed = 1; |
4574 | break; | 4573 | break; |
4575 | } | 4574 | } |
4576 | } | ||
4577 | } | 4575 | } |
4578 | } | 4576 | } |
4579 | #endif /* CONFIG_FEATURE_FDISK_WRITABLE */ | 4577 | #endif /* CONFIG_FEATURE_FDISK_WRITABLE */ |
diff --git a/util-linux/mdev.c b/util-linux/mdev.c index b292e14b7..f43393692 100644 --- a/util-linux/mdev.c +++ b/util-linux/mdev.c | |||
@@ -250,7 +250,7 @@ int mdev_main(int argc, char *argv[]) | |||
250 | } else { | 250 | } else { |
251 | action = getenv("ACTION"); | 251 | action = getenv("ACTION"); |
252 | env_path = getenv("DEVPATH"); | 252 | env_path = getenv("DEVPATH"); |
253 | if (!action || !env_path) | 253 | if (!action || !env_path) |
254 | bb_show_usage(); | 254 | bb_show_usage(); |
255 | 255 | ||
256 | sprintf(temp, "/sys%s", env_path); | 256 | sprintf(temp, "/sys%s", env_path); |