diff --git a/archival/dpkg.c b/archival/dpkg.c index bf070a001..8031956e9 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1115,7 +1115,7 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count if (package_edge->type == EDGE_PRE_DEPENDS || package_edge->type == EDGE_DEPENDS ) { - int result=1; + int result = 1; status_num = 0; /* If we are inside an alternative then check diff --git a/coreutils/cut.c b/coreutils/cut.c index 7009e74cf..55bdd9386 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c @@ -167,7 +167,7 @@ static void cut_file(FILE *file, const char *delim, const char *odelim, if (!cl_pos && !dcount && !shoe) { if (option_mask32 & CUT_OPT_SUPPRESS_FLGS) goto next_line; - } else if (dcountop_type == BINOP) unnest_msg_and_return(binop(), "1 && *dlist->data != TT.state) + if (TT.state > 1 && *dlist->data != TT.state) fdprintf(TT.state == 2 ? 2 : TT.fileout, - "%s\n", dlist->data+(TT.state>3 ? 1 : 0)); + "%s\n", dlist->data + (TT.state > 3 ? 1 : 0)); if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data); @@ -221,7 +221,7 @@ static int apply_one_hunk(void) // Match EOF if there aren't as many ending context lines as beginning for (plist = TT.current_hunk; plist; plist = plist->next) { - if (plist->data[0]==' ') matcheof++; + if (plist->data[0] == ' ') matcheof++; else matcheof = 0; if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data); } @@ -433,15 +433,15 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // Are we assembling a hunk? if (state >= 2) { - if (*patchline==' ' || *patchline=='+' || *patchline=='-') { + if (*patchline == ' ' || *patchline == '+' || *patchline == '-') { dlist_add(&TT.current_hunk, patchline); if (*patchline != '+') oldlen--; if (*patchline != '-') newlen--; // Context line? - if (*patchline==' ' && state==2) TT.context++; - else state=3; + if (*patchline == ' ' && state == 2) TT.context++; + else state = 3; // If we've consumed all expected hunk lines, apply the hunk. @@ -469,9 +469,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv) free(*name); // Trim date from end of filename (if any). We don't care. for (s = patchline+4; *s && *s!='\t'; s++) - if (*s=='\\' && s[1]) s++; + if (*s == '\\' && s[1]) s++; i = atoi(s); - if (i>1900 && i<=1970) + if (i > 1900 && i <= 1970) *name = xstrdup("/dev/null"); else { *s = 0; diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c index 69a508b2e..5478ece7d 100644 --- a/editors/patch_toybox.c +++ b/editors/patch_toybox.c @@ -79,7 +79,7 @@ void TOY_llist_free(void *list, void (*freeit)(void *data)) else free(pop); // End doubly linked list too. - if (list==pop) break; + if (list == pop) break; } } @@ -137,11 +137,11 @@ char *get_rawline(int fd, long *plen, char end) long len = 0; for (;;) { - if (1>read(fd, &c, 1)) break; + if (1 > read(fd, &c, 1)) break; if (!(len & 63)) buf=xrealloc(buf, len+65); - if ((buf[len++]=c) == end) break; + if ((buf[len++] = c) == end) break; } - if (buf) buf[len]=0; + if (buf) buf[len] = 0; if (plen) *plen = len; return buf; @@ -153,7 +153,7 @@ char *get_line(int fd) long len; char *buf = get_rawline(fd, &len, '\n'); - if (buf && buf[--len]=='\n') buf[len]=0; + if (buf && buf[--len] == '\n') buf[len] = 0; return buf; } @@ -165,10 +165,10 @@ void xsendfile(int in, int out) long len; char buf[4096]; - if (in<0) return; + if (in < 0) return; for (;;) { len = safe_read(in, buf, 4096); - if (len<1) break; + if (len < 1) break; xwrite(out, buf, len); } } @@ -179,7 +179,7 @@ void replace_tempfile(int fdin, int fdout, char **tempname) { char *temp = xstrdup(*tempname); - temp[strlen(temp)-6]=0; + temp[strlen(temp)-6] = 0; if (fdin != -1) { xsendfile(fdin, fdout); xclose(fdin); @@ -263,9 +263,9 @@ static void do_line(void *data) { struct double_list *dlist = (struct double_list *)data; - if (TT.state>1 && *dlist->data != TT.state) + if (TT.state > 1 && *dlist->data != TT.state) fdprintf(TT.state == 2 ? 2 : TT.fileout, - "%s\n", dlist->data+(TT.state>3 ? 1 : 0)); + "%s\n", dlist->data + (TT.state > 3 ? 1 : 0)); if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data); @@ -314,7 +314,7 @@ static int apply_one_hunk(void) // Match EOF if there aren't as many ending context lines as beginning for (plist = TT.current_hunk; plist; plist = plist->next) { - if (plist->data[0]==' ') matcheof++; + if (plist->data[0] == ' ') matcheof++; else matcheof = 0; if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data); } @@ -385,7 +385,7 @@ static int apply_one_hunk(void) // If we've reached the end of the buffer without confirming a // match, read more lines. - if (check==buf) { + if (check == buf) { buf = 0; break; } @@ -456,15 +456,15 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // Are we assembling a hunk? if (state >= 2) { - if (*patchline==' ' || *patchline=='+' || *patchline=='-') { + if (*patchline == ' ' || *patchline == '+' || *patchline == '-') { dlist_add(&TT.current_hunk, patchline); if (*patchline != '+') TT.oldlen--; if (*patchline != '-') TT.newlen--; // Context line? - if (*patchline==' ' && state==2) TT.context++; - else state=3; + if (*patchline == ' ' && state == 2) TT.context++; + else state = 3; // If we've consumed all expected hunk lines, apply the hunk. @@ -491,9 +491,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // Trim date from end of filename (if any). We don't care. for (s = patchline+4; *s && *s!='\t'; s++) - if (*s=='\\' && s[1]) s++; + if (*s == '\\' && s[1]) s++; i = atoi(s); - if (i>1900 && i<=1970) + if (i > 1900 && i <= 1970) *name = xstrdup("/dev/null"); else { *s = 0; @@ -537,7 +537,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // handle -p path truncation. for (i=0, s = name; *s;) { if ((option_mask32 & FLAG_PATHLEN) && TT.prefix == i) break; - if (*(s++)=='/') { + if (*(s++) == '/') { name = s; i++; } diff --git a/editors/vi.c b/editors/vi.c index 1f997e8e5..2645afe87 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -4327,7 +4327,7 @@ static void do_cmd(int c) c1 = get_one_char(); // ZQ means to exit without saving if (c1 == 'Q') { - editing=0; + editing = 0; optind = cmdline_filecnt; break; } diff --git a/examples/shutdown-1.0/script/hardshutdown.c b/examples/shutdown-1.0/script/hardshutdown.c index b4af26f0f..c90f55396 100644 --- a/examples/shutdown-1.0/script/hardshutdown.c +++ b/examples/shutdown-1.0/script/hardshutdown.c @@ -115,7 +115,7 @@ int main(int argc, char **argv) if (ptr) prog = ptr+1; - for (c=1; c < argc; c++) { + for (c = 1; c < argc; c++) { if (argv[c][0] >= '0' && argv[c][0] <= '9') { t.tv_sec = strtol(argv[c], NULL, 10); continue; @@ -124,7 +124,7 @@ int main(int argc, char **argv) usage(); return 1; } - for (i=1; argv[c][i]; i++) { + for (i = 1; argv[c][i]; i++) { switch (argv[c][i]) { case 'h': action = HALT; diff --git a/miscutils/bc.c b/miscutils/bc.c index 1300a63fb..c629c4763 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -3105,7 +3105,7 @@ static BC_STATUS zbc_lex_identifier(void) continue; match: // buf starts with keyword bc_lex_kws[i] - if (isalnum(buf[j]) || buf[j]=='_') + if (isalnum(buf[j]) || buf[j] == '_') continue; // "ifz" does not match "if" keyword, "if." does p->lex = BC_LEX_KEY_1st_keyword + i; if (!keyword_is_POSIX(i)) { diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index fb9ebcf60..297693f8c 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -976,7 +976,7 @@ static void action_compat(const struct devfsd_notify_struct *info, unsigned int rewind_ = info->devname[info->namelen - 1]; if (rewind_ != 'n') rewind_ = '\0'; - mode=0; + mode = 0; if (ptr[2] == 'l' /*108*/ || ptr[2] == 'm'/*109*/) mode = ptr[2] - 107; /* 1 or 2 */ if (ptr[2] == 'a') @@ -1595,11 +1595,11 @@ static char *write_old_sd_name(char *buffer, return buffer; } if ((major > 64) && (major < 72)) { - disc_index = ((major - 64) << 4) +(minor >> 4); + disc_index = ((major - 64) << 4) + (minor >> 4); if (disc_index < 26) sprintf(buffer, "sd%c%s", 'a' + disc_index, part); else - sprintf(buffer, "sd%c%c%s", 'a' +(disc_index / 26) - 1, 'a' + disc_index % 26, part); + sprintf(buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26, part); return buffer; } return NULL; diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index d8d8f6166..83e2f8d53 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -798,7 +798,7 @@ static void identify(uint16_t *val) if (!(val[GEN_CONFIG] & NOT_ATA)) { dev = ATA_DEV; printf("ATA device, with "); - } else if (val[GEN_CONFIG]==CFA_SUPPORT_VAL) { + } else if (val[GEN_CONFIG] == CFA_SUPPORT_VAL) { dev = ATA_DEV; like_std = 4; printf("CompactFlash ATA device, with "); @@ -819,13 +819,13 @@ static void identify(uint16_t *val) * specific, it should be safe to check it now, even though we don't * know yet what standard this device is using. */ - if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL) - || (val[CONFIG]==PWRD_NID_VAL) || (val[CONFIG]==PWRD_ID_VAL) + if ((val[CONFIG] == STBY_NID_VAL) || (val[CONFIG] == STBY_ID_VAL) + || (val[CONFIG] == PWRD_NID_VAL) || (val[CONFIG] == PWRD_ID_VAL) ) { like_std = 5; - if ((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==STBY_ID_VAL)) + if ((val[CONFIG] == STBY_NID_VAL) || (val[CONFIG] == STBY_ID_VAL)) puts("powers-up in standby; SET FEATURES subcmd spins-up."); - if (((val[CONFIG]==STBY_NID_VAL) || (val[CONFIG]==PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) + if (((val[CONFIG] == STBY_NID_VAL) || (val[CONFIG] == PWRD_NID_VAL)) && (val[GEN_CONFIG] & INCOMPLETE)) puts("\n\tWARNING: ID response incomplete.\n\tFollowing data may be incorrect.\n"); } @@ -853,7 +853,7 @@ static void identify(uint16_t *val) printf("\n\tSupported: "); jj = val[MAJOR] << 1; kk = like_std >4 ? like_std-4: 0; - for (ii = 14; (ii >0)&&(ii>kk); ii--) { + for (ii = 14; (ii > 0) && (ii > kk); ii--) { if (jj & 0x8000) { printf("%u ", ii); if (like_std < ii) { @@ -943,7 +943,7 @@ static void identify(uint16_t *val) for (ii = 1; ii < 15; ii++) { if (jj & 0x0001) printf("\t%s\n", nth_string(ata1_cfg_str, ii)); - jj >>=1; + jj >>= 1; } } if (dev == ATAPI_DEV) { @@ -952,7 +952,7 @@ static void identify(uint16_t *val) else if ((val[GEN_CONFIG] & DRQ_RESPONSE_TIME) == DRQ_INTR_VAL) strng = "<=10ms with INTRQ"; else if ((val[GEN_CONFIG] & DRQ_RESPONSE_TIME) == DRQ_50US_VAL) - strng ="50us"; + strng = "50us"; else strng = "unknown"; printf("\tDRQ response: %s\n\tPacket size: ", strng); /* Data Request (DRQ) */ @@ -1014,7 +1014,7 @@ static void identify(uint16_t *val) } if (!bbbig) - bbbig = (uint64_t)(ll>mm ? ll : mm); /* # 512 byte blocks */ + bbbig = (uint64_t)(ll > mm ? ll : mm); /* # 512 byte blocks */ printf("\tdevice size with M = 1024*1024: %11"PRIu64" MBytes\n", bbbig>>11); bbbig = (bbbig << 9) / 1000000; printf("\tdevice size with M = 1000*1000: %11"PRIu64" MBytes ", bbbig); @@ -1160,7 +1160,7 @@ static void identify(uint16_t *val) jj = ((val[ADV_PIO_MODES] & PIO_SUP) << 3) | 0x0007; for (ii = 0; ii <= PIO_MODE_MAX; ii++) { if (jj & 0x0001) printf("pio%d ", ii); - jj >>=1; + jj >>= 1; } bb_putchar('\n'); } else if (((min_std < 5) || (eqpt == CDROM)) && (val[PIO_MODE] & MODE)) { @@ -1199,7 +1199,7 @@ static void identify(uint16_t *val) } if (ii == 31) { if ((val[CMDS_SUPP_2] & VALID) != VALID_VAL) - ii +=16; + ii += 16; } } } @@ -1220,7 +1220,7 @@ static void identify(uint16_t *val) printf("\t%s\t%s\n", (!(jj & 0x0001)) ? "not" : "", nth_string(secu_str, ii)); - jj >>=1; + jj >>= 1; } if (val[SECU_STATUS] & SECU_ENABLED) { printf("\tSecurity level %s\n", diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c index d0bc2a6ef..37c303f90 100644 --- a/modutils/modutils-24.c +++ b/modutils/modutils-24.c @@ -981,7 +981,7 @@ arch_apply_relocation(struct obj_file *f, (loc[1] & 0xFFFF); /* Add reloc offset */ - temp1+=v; + temp1 += v; /* Store back into code */ loc[0] = (loc[0] & 0xFFFF0000) | temp1 >> 16; diff --git a/networking/tc.c b/networking/tc.c index 46ad23d8b..43187f7ee 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -214,7 +214,7 @@ static int prio_print_opt(struct rtattr *opt) return 0; parse_rtattr_nested_compat(tb, TCA_PRIO_MAX, opt, qopt, sizeof(*qopt)); printf("bands %u priomap ", qopt->bands); - for (i=0; i<=TC_PRIO_MAX; i++) + for (i = 0; i <= TC_PRIO_MAX; i++) printf(" %d", qopt->priomap[i]); if (tb[TCA_PRIO_MQ]) diff --git a/procps/nmeter.c b/procps/nmeter.c index 088d366bf..68e6f3325 100644 --- a/procps/nmeter.c +++ b/procps/nmeter.c @@ -515,7 +515,7 @@ static void FAST_FUNC collect_blk(blk_stat *s) return; } - for (i=0; i<2; i++) { + for (i = 0; i < 2; i++) { ullong old = s->old[i]; if (data[i] < old) old = data[i]; //sanitize s->old[i] = data[i]; @@ -597,7 +597,7 @@ static void FAST_FUNC collect_if(if_stat *s) return; } - for (i=0; i<4; i++) { + for (i = 0; i < 4; i++) { ullong old = s->old[i]; if (data[i] < old) old = data[i]; //sanitize s->old[i] = data[i];