summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/awk.c4
-rw-r--r--editors/sed.c2
-rw-r--r--editors/vi.c4
-rw-r--r--findutils/grep.c2
-rw-r--r--networking/httpd.c26
-rw-r--r--networking/libiproute/ip_parse_common_args.c4
-rw-r--r--networking/telnet.c6
-rw-r--r--networking/traceroute.c16
-rw-r--r--shell/cmdedit.c163
-rw-r--r--util-linux/fdformat.c54
-rw-r--r--util-linux/fdisk.c4
-rw-r--r--util-linux/mdev.c2
12 files changed, 143 insertions, 144 deletions
diff --git a/editors/awk.c b/editors/awk.c
index bebc780..b46f25c 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -1764,7 +1764,7 @@ static char *awk_printf(node *n)
is_numeric(arg) ? (char)getvar_i(arg) : *getvar_s(arg));
} else if (c == 's') {
- s1 = getvar_s(arg);
+ s1 = getvar_s(arg);
qrealloc(&b, incr+i+strlen(s1), &bsize);
i += sprintf(b+i, s, s1);
@@ -2434,7 +2434,7 @@ re_cont:
R.d--;
goto r_op_change;
case '!':
- L.d = istrue(X.v) ? 0 : 1;
+ L.d = istrue(X.v) ? 0 : 1;
break;
case '-':
L.d = -R.d;
diff --git a/editors/sed.c b/editors/sed.c
index 54d08ee..94dc820 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -153,7 +153,7 @@ void sed_free_and_close_stuff(void)
if(bbg.hold_space) free(bbg.hold_space);
- while(bbg.current_input_file<bbg.input_file_count)
+ while(bbg.current_input_file<bbg.input_file_count)
fclose(bbg.input_file_list[bbg.current_input_file++]);
}
#endif
diff --git a/editors/vi.c b/editors/vi.c
index 8ff118f..fa30cf2 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -3501,8 +3501,8 @@ key_cmd_mode:
if (file_modified) {
#ifdef CONFIG_FEATURE_VI_READONLY
if (vi_readonly || readonly) {
- psbs("\"%s\" File is read only", cfn);
- break;
+ psbs("\"%s\" File is read only", cfn);
+ break;
}
#endif /* CONFIG_FEATURE_VI_READONLY */
cnt = file_write(cfn, text, end - 1);
diff --git a/findutils/grep.c b/findutils/grep.c
index e02fc8d..5659a7d 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -233,7 +233,7 @@ static int grep_file(FILE *file)
if (PRINT_MATCH_COUNTS) {
if (print_filename > 0)
printf("%s:", cur_file);
- printf("%d\n", nmatches);
+ printf("%d\n", nmatches);
}
/* 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 7388bb6..e533594 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)
i = 0;
while (*p) {
- if (*p < '0' || *p > '9') {
- if (*p == '.') {
- i = scan_ip(&ipm, mask, 0);
- return i != 32;
- }
- return -1;
+ if (*p < '0' || *p > '9') {
+ if (*p == '.') {
+ i = scan_ip(&ipm, mask, 0);
+ return i != 32;
}
- i *= 10;
- i += *p - '0';
- p++;
+ return -1;
+ }
+ i *= 10;
+ i += *p - '0';
+ p++;
}
}
if (i > 32 || i < 0)
- return -1;
+ return -1;
msk = 0x80000000;
*mask = 0;
while (i > 0) {
@@ -553,7 +553,7 @@ static void parse_conf(const char *path, int flag)
} else if ((cf[1] == '.') && (cf[2] == '/' || cf[2] == 0)) {
++cf;
if (p > p0) {
- while (*--p != '/'); /* omit previous dir */
+ while (*--p != '/') /* omit previous dir */;
}
continue;
}
@@ -1571,8 +1571,8 @@ BAD_REQUEST:
/* protect out root */
goto BAD_REQUEST;
}
- while (*--purl != '/'); /* omit previous dir */
- continue;
+ while (*--purl != '/') /* omit previous dir */;
+ continue;
}
}
}
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c
index e7084fb..fee6e5e 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)
if (matches(opt, "-family") == 0) {
argc--;
argv++;
- if (! argv[1])
- bb_show_usage();
+ if (!argv[1])
+ bb_show_usage();
if (strcmp(argv[1], "inet") == 0)
preferred_family = AF_INET;
else if (strcmp(argv[1], "inet6") == 0)
diff --git a/networking/telnet.c b/networking/telnet.c
index 344fc32..fd0f84d 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -205,12 +205,12 @@ static void handlenetoutput(int len)
}
outbuf[j++] = *p;
if (*p == 0xff)
- outbuf[j++] = 0xff;
+ outbuf[j++] = 0xff;
else if (*p == 0x0d)
- outbuf[j++] = 0x00;
+ outbuf[j++] = 0x00;
}
if (j > 0 )
- write(G.netfd, outbuf, j);
+ write(G.netfd, outbuf, j);
}
diff --git a/networking/traceroute.c b/networking/traceroute.c
index 80ce5c3..e7e1311 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -641,7 +641,7 @@ send_probe(int seq, int ttl, struct timeval *tp)
outicmp->icmp_cksum = 0xffff;
} else
#endif
- if (doipcksum) {
+ if (doipcksum) {
/* Checksum (we must save and restore ip header) */
tip = *outip;
ui = (struct udpiphdr *)outip;
@@ -788,7 +788,7 @@ packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
return (type == ICMP_TIMXCEED ? -1 : code + 1);
} else
#endif
- {
+ {
up = (struct udphdr *)((unsigned char *)hip + hlen);
/* XXX 8 is a magic number */
if (hlen + 12 <= cc &&
@@ -996,11 +996,11 @@ traceroute_main(int argc, char *argv[])
if(nprobes_str)
nprobes = str2val(nprobes_str, "nprobes", 1, -1);
if(source) {
- /*
- * set the ip source address of the outbound
- * probe (e.g., on a multi-homed host).
- */
- if (getuid()) bb_error_msg_and_die("-s %s: Permission denied", source);
+ /*
+ * set the ip source address of the outbound
+ * probe (e.g., on a multi-homed host).
+ */
+ if (getuid()) bb_error_msg_and_die("-s %s: permission denied", source);
}
if(waittime_str)
waittime = str2val(waittime_str, "wait time", 2, 24 * 60 * 60);
@@ -1015,7 +1015,7 @@ traceroute_main(int argc, char *argv[])
for(l_sr = sourse_route_list; l_sr; ) {
if (lsrr >= NGATEWAYS)
- bb_error_msg_and_die("No more than %d gateways", NGATEWAYS);
+ bb_error_msg_and_die("no more than %d gateways", NGATEWAYS);
getaddr(gwlist + lsrr, l_sr->data);
++lsrr;
l_sr = l_sr->link;
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index fb1946e..9a57f75 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -271,7 +271,6 @@ static void input_backward(int num)
if (num < 4)
while (num-- > 0)
putchar('\b');
-
else
printf("\033[%dD", num);
} else {
@@ -370,7 +369,7 @@ static void parse_prompt(const char *prmt_ptr)
pbuf = buf2;
*pbuf = '~';
strcpy(pbuf+1, pwd_buf+l);
- }
+ }
break;
#endif
case 'W':
@@ -712,7 +711,7 @@ static char *add_quote_for_spec_chars(char *found, int add)
s[l++] = *found++;
}
if(add)
- s[l++] = (char)add;
+ s[l++] = (char)add;
s[l] = 0;
return s;
}
@@ -995,7 +994,7 @@ static void showfiles(void)
for (row = 0; row < nrows; row++) {
l = strlen(matches[row]);
if(add_char_to_match[row])
- l++;
+ l++;
if (column_width < l)
column_width = l;
}
@@ -1021,8 +1020,8 @@ static void showfiles(void)
printf("%s%s", matches[n], str_add_chr);
l = strlen(matches[n]);
while(l < acol) {
- putchar(' ');
- l++;
+ putchar(' ');
+ l++;
}
}
str_add_chr[0] = add_char_to_match[n];
@@ -1081,30 +1080,32 @@ static void input_tab(int *lastWasTab)
int i, j, n, srt;
/* bubble */
n = num_matches;
- for(i=0; i<(n-1); i++)
- for(j=i+1; j<n; j++)
- if(matches[i]!=NULL && matches[j]!=NULL) {
- srt = strcmp(matches[i], matches[j]);
- if(srt == 0) {
- free(matches[j]);
- matches[j]=0;
- } else if(srt > 0) {
- tmp1 = matches[i];
- matches[i] = matches[j];
- matches[j] = tmp1;
- srt = add_char_to_match[i];
- add_char_to_match[i] = add_char_to_match[j];
- add_char_to_match[j] = srt;
- }
+ for(i=0; i<(n-1); i++) {
+ for(j=i+1; j<n; j++) {
+ if(matches[i]!=NULL && matches[j]!=NULL) {
+ srt = strcmp(matches[i], matches[j]);
+ if(srt == 0) {
+ free(matches[j]);
+ matches[j]=0;
+ } else if(srt > 0) {
+ tmp1 = matches[i];
+ matches[i] = matches[j];
+ matches[j] = tmp1;
+ srt = add_char_to_match[i];
+ add_char_to_match[i] = add_char_to_match[j];
+ add_char_to_match[j] = srt;
+ }
+ }
}
+ }
j = n;
n = 0;
for(i=0; i<j; i++)
- if(matches[i]) {
- matches[n]=matches[i];
- add_char_to_match[n]=add_char_to_match[i];
- n++;
- }
+ if(matches[i]) {
+ matches[n]=matches[i];
+ add_char_to_match[n]=add_char_to_match[i];
+ n++;
+ }
num_matches = n;
}
/* Did we find exactly one match? */
@@ -1623,61 +1624,61 @@ prepare_to_die:
/* fall through */
case 'd'|vbit:
{
- int nc, sc;
- sc = cursor;
- prevc = ic;
- if (safe_read(0, &c, 1) < 1)
- goto prepare_to_die;
- if (c == (prevc & 0xff)) {
- /* "cc", "dd" */
- input_backward(cursor);
- goto clear_to_eol;
- break;
- }
- switch(c) {
- case 'w':
- case 'W':
- case 'e':
- case 'E':
- switch (c) {
- case 'w': /* "dw", "cw" */
- vi_word_motion(command, vi_cmdmode);
- break;
- case 'W': /* 'dW', 'cW' */
- vi_Word_motion(command, vi_cmdmode);
- break;
- case 'e': /* 'de', 'ce' */
- vi_end_motion(command);
- input_forward();
- break;
- case 'E': /* 'dE', 'cE' */
- vi_End_motion(command);
- input_forward();
- break;
- }
- nc = cursor;
- input_backward(cursor - sc);
- while (nc-- > cursor)
- input_delete(1);
- break;
- case 'b': /* "db", "cb" */
- case 'B': /* implemented as B */
- if (c == 'b')
- vi_back_motion(command);
- else
- vi_Back_motion(command);
- while (sc-- > cursor)
- input_delete(1);
- break;
- case ' ': /* "d ", "c " */
- input_delete(1);
- break;
- case '$': /* "d$", "c$" */
- clear_to_eol:
- while (cursor < len)
- input_delete(1);
- break;
- }
+ int nc, sc;
+ sc = cursor;
+ prevc = ic;
+ if (safe_read(0, &c, 1) < 1)
+ goto prepare_to_die;
+ if (c == (prevc & 0xff)) {
+ /* "cc", "dd" */
+ input_backward(cursor);
+ goto clear_to_eol;
+ break;
+ }
+ switch(c) {
+ case 'w':
+ case 'W':
+ case 'e':
+ case 'E':
+ switch (c) {
+ case 'w': /* "dw", "cw" */
+ vi_word_motion(command, vi_cmdmode);
+ break;
+ case 'W': /* 'dW', 'cW' */
+ vi_Word_motion(command, vi_cmdmode);
+ break;
+ case 'e': /* 'de', 'ce' */
+ vi_end_motion(command);
+ input_forward();
+ break;
+ case 'E': /* 'dE', 'cE' */
+ vi_End_motion(command);
+ input_forward();
+ break;
+ }
+ nc = cursor;
+ input_backward(cursor - sc);
+ while (nc-- > cursor)
+ input_delete(1);
+ break;
+ case 'b': /* "db", "cb" */
+ case 'B': /* implemented as B */
+ if (c == 'b')
+ vi_back_motion(command);
+ else
+ vi_Back_motion(command);
+ while (sc-- > cursor)
+ input_delete(1);
+ break;
+ case ' ': /* "d ", "c " */
+ input_delete(1);
+ break;
+ case '$': /* "d$", "c$" */
+ clear_to_eol:
+ while (cursor < len)
+ input_delete(1);
+ break;
+ }
}
break;
case 'p'|vbit:
diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c
index efbdcc8..1441b92 100644
--- a/util-linux/fdformat.c
+++ b/util-linux/fdformat.c
@@ -47,7 +47,7 @@ struct format_descr {
static void xioctl(int fd, int request, void *argp, const char *string)
{
- if (ioctl (fd, request, argp) < 0) {
+ if (ioctl(fd, request, argp) < 0) {
bb_perror_msg_and_die(string);
}
}
@@ -67,17 +67,16 @@ int fdformat_main(int argc,char **argv)
argv += optind;
/* R_OK is needed for verifying */
- if (stat(*argv,&st) < 0 || access(*argv,W_OK | R_OK ) < 0) {
- bb_perror_msg_and_die("%s",*argv);
+ if (stat(*argv, &st) < 0 || access(*argv, W_OK | R_OK ) < 0) {
+ bb_perror_msg_and_die("%s", *argv);
}
if (!S_ISBLK(st.st_mode)) {
- bb_error_msg_and_die("%s: not a block device",*argv);
+ bb_error_msg_and_die("%s: not a block device", *argv);
/* do not test major - perhaps this was an USB floppy */
}
-
/* O_RDWR for formatting and verifying */
- fd = xopen(*argv,O_RDWR );
+ fd = xopen(*argv, O_RDWR);
xioctl(fd, FDGETPRM, &param, "FDGETPRM");/*original message was: "Could not determine current format type" */
@@ -86,44 +85,45 @@ int fdformat_main(int argc,char **argv)
param.track, param.sect, param.size >> 1);
/* FORMAT */
- printf("Formatting ... ");
- xioctl(fd, FDFMTBEG,NULL,"FDFMTBEG");
+ printf("Formatting... ");
+ xioctl(fd, FDFMTBEG, NULL, "FDFMTBEG");
/* n == track */
- for (n = 0; n < param.track; n++)
- {
- descr.head = 0;
- descr.track = n;
- xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
- printf("%3d\b\b\b", n);
- if (param.head == 2) {
- descr.head = 1;
- xioctl(fd, FDFMTTRK,&descr,"FDFMTTRK");
- }
+ for (n = 0; n < param.track; n++) {
+ descr.head = 0;
+ descr.track = n;
+ xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK");
+ printf("%3d\b\b\b", n);
+ if (param.head == 2) {
+ descr.head = 1;
+ xioctl(fd, FDFMTTRK, &descr, "FDFMTTRK");
+ }
}
- xioctl(fd,FDFMTEND,NULL,"FDFMTEND");
+ xioctl(fd, FDFMTEND, NULL, "FDFMTEND");
printf("done\n");
/* VERIFY */
- if(verify) {
+ if (verify) {
/* n == cyl_size */
n = param.sect*param.head*512;
data = xmalloc(n);
- printf("Verifying ... ");
+ printf("Verifying... ");
for (cyl = 0; cyl < param.track; cyl++) {
printf("%3d\b\b\b", cyl);
- if((read_bytes = safe_read(fd,data,n))!= n ) {
- if(read_bytes < 0) {
+ read_bytes = safe_read(fd, data, n);
+ if (read_bytes != n) {
+ if (read_bytes < 0) {
bb_perror_msg(bb_msg_read_error);
}
- bb_error_msg_and_die("Problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes);
+ bb_error_msg_and_die("problem reading cylinder %d, expected %d, read %d", cyl, n, read_bytes);
+ // FIXME: maybe better seek & continue??
}
/* Check backwards so we don't need a counter */
- while(--read_bytes>=0) {
- if( data[read_bytes] != FD_FILL_BYTE) {
- printf("bad data in cyl %d\nContinuing ... ",cyl);
+ while (--read_bytes >= 0) {
+ if (data[read_bytes] != FD_FILL_BYTE) {
+ printf("bad data in cyl %d\nContinuing... ",cyl);
}
}
}
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 55f7166..85acaa4 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -4506,8 +4506,7 @@ change_sysid(void)
label_sun != current_label_type && !get_nr_sects(p))
{
printf(_("Partition %d does not exist yet!\n"), i + 1);
- }else{
- while (1) {
+ } else while (1) {
sys = read_hex (get_sys_types());
if (!sys && label_sgi != current_label_type &&
@@ -4573,7 +4572,6 @@ change_sysid(void)
dos_changed = 1;
break;
}
- }
}
}
#endif /* CONFIG_FEATURE_FDISK_WRITABLE */
diff --git a/util-linux/mdev.c b/util-linux/mdev.c
index b292e14..f433936 100644
--- a/util-linux/mdev.c
+++ b/util-linux/mdev.c
@@ -250,7 +250,7 @@ int mdev_main(int argc, char *argv[])
} else {
action = getenv("ACTION");
env_path = getenv("DEVPATH");
- if (!action || !env_path)
+ if (!action || !env_path)
bb_show_usage();
sprintf(temp, "/sys%s", env_path);