diff --git a/src/encode/lzh.c b/src/encode/lzh.c index 1518d7f3b87789956459a33bb6edfacc11ac2e9d..3ac760ad1a5d33eb88717ae5825700cac0485820 100644 --- a/src/encode/lzh.c +++ b/src/encode/lzh.c @@ -637,7 +637,8 @@ uint32_t lzh_encode(const uint8_t *inbuf, uint32_t inlen, uint8_t *outbuf, size_ lzh_delete_node(&lzh, s); s = (s + 1) & (LZH_STRBUF_SZ - 1); r = (r + 1) & (LZH_STRBUF_SZ - 1); - if (--len) lzh_insert_node(&lzh, r); + if (--len) + lzh_insert_node(&lzh, r); } } while (len > 0); if (!lzh_encode_end(&lzh, outbuf, &outlen)) diff --git a/src/encode/uucode.c b/src/encode/uucode.c index 218bef03673413571e10341145e08ab34afa78de..87a642abf193f10ff0498522dc110fdfd35d9098 100644 --- a/src/encode/uucode.c +++ b/src/encode/uucode.c @@ -50,7 +50,8 @@ int uudecode(char *target, size_t tlen, const char *source, size_t slen) /* Remove space bias */ for (i = 0; i < sizeof(cell) && rd < slen; i++) { cell[i] = source[rd++]; - if (cell[i] >= ' ') cell[i] -= ' '; + if (cell[i] >= ' ') + cell[i] -= ' '; } /* Convert block of 4 6-bit chars into 3 8-bit chars */ target[wr] = (cell[0] & 0x3f) << 2; /* lower 6 (s1) to upper 6 (d1) */ diff --git a/src/sbbs3/ans2asc.c b/src/sbbs3/ans2asc.c index 4914ee0af03d5c429fcec3ead1791791459ce90b..c6a33cb2de3f4d6ed396b9491550d0811d8b87b2 100644 --- a/src/sbbs3/ans2asc.c +++ b/src/sbbs3/ans2asc.c @@ -168,9 +168,12 @@ int main(int argc, char **argv) case '=': case '?': ch = fgetc(in); /* First digit */ - if (IS_DIGIT(ch)) ch = fgetc(in); /* l or h ? */ - if (IS_DIGIT(ch)) ch = fgetc(in); - if (IS_DIGIT(ch)) fgetc(in); + if (IS_DIGIT(ch)) + ch = fgetc(in); /* l or h ? */ + if (IS_DIGIT(ch)) + ch = fgetc(in); + if (IS_DIGIT(ch)) + fgetc(in); break; case 'f': case 'H': diff --git a/src/sbbs3/answer.cpp b/src/sbbs3/answer.cpp index 3b785e1cd681b24b92842365a8973a724e1a7a09..fe05e0957d1e2208d42ea75183dbe366940072c9 100644 --- a/src/sbbs3/answer.cpp +++ b/src/sbbs3/answer.cpp @@ -633,8 +633,10 @@ bool sbbs_t::answer() , cursor_pos_report, x, y); if (cursor_pos_report == 1) { /* Sanity check the coordinates in the response: */ - if (x >= TERM_COLS_MIN && x <= TERM_COLS_MAX) cols = x; - if (y >= TERM_ROWS_MIN && y <= TERM_ROWS_MAX) rows = y; + if (x >= TERM_COLS_MIN && x <= TERM_COLS_MAX) + cols = x; + if (y >= TERM_ROWS_MIN && y <= TERM_ROWS_MAX) + rows = y; } else { // second report if (x < 3) { // ZWNBSP didn't move cursor (more than one column) autoterm |= UTF8; diff --git a/src/sbbs3/ars.c b/src/sbbs3/ars.c index 214854e2cdccd31e301b8d10e349bc2fa5df8c86..9f1a995d163580a4b065c21997986bc4e3685beb 100644 --- a/src/sbbs3/ars.c +++ b/src/sbbs3/ars.c @@ -588,7 +588,8 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) case AR_LIB: case AR_DIR: case AR_SUB: - if (n > 0) n--; /* convert to 0 base */ + if (n > 0) + n--; /* convert to 0 base */ ar[j++] = n & 0xff; ar[j++] = (n >> 8) & 0xff; break; @@ -674,7 +675,8 @@ uchar* arstr(ushort* count, const char* str, scfg_t* cfg, uchar* ar_buf) ar[j++] = 4; else if (toupper(str[i]) == 'F') /* Friday */ ar[j++] = 5; - else ar[j++] = 6; /* Saturday */ + else + ar[j++] = 6; /* Saturday */ while (IS_ALPHA(str[i + 1])) i++; break; default: /* Badly formed ARS, digit expected */ diff --git a/src/sbbs3/atcodes.cpp b/src/sbbs3/atcodes.cpp index d1ef55592804c1431975bfa02d196c0ed53e4a13..7acb323526a38ed634dd12b466e8b7e4ded4b5ed 100644 --- a/src/sbbs3/atcodes.cpp +++ b/src/sbbs3/atcodes.cpp @@ -381,7 +381,8 @@ const char* sbbs_t::atcode(const char* sp, char* str, size_t maxlen, int* pmode, fallback = ch; outchar(codepoint, fallback); } - else return NULL; // Invalid @-code + else + return NULL; // Invalid @-code } return nulstr; } @@ -963,7 +964,8 @@ const char* sbbs_t::atcode(const char* sp, char* str, size_t maxlen, int* pmode, if (strncmp(sp, "FILL:", 5) == 0) { SAFECOPY(tmp, sp + 5); int margin = centered ? column : 1; - if (margin < 1) margin = 1; + if (margin < 1) + margin = 1; c_unescape_str(tmp); while (*tmp && online && column < cols - margin) bputs(tmp, P_TRUNCATE); @@ -1052,7 +1054,8 @@ const char* sbbs_t::atcode(const char* sp, char* str, size_t maxlen, int* pmode, if (!strcmp(sp, "FIRST")) { safe_snprintf(str, maxlen, "%s", useron.alias); tp = strchr(str, ' '); - if (tp) *tp = 0; + if (tp) + *tp = 0; return str; } @@ -1832,22 +1835,27 @@ const char* sbbs_t::atcode(const char* sp, char* str, size_t maxlen, int* pmode, if (!strcmp(sp, "LAST")) { tp = strrchr(useron.alias, ' '); - if (tp) tp++; - else tp = useron.alias; + if (tp) + tp++; + else + tp = useron.alias; return tp; } if (!strcmp(sp, "REAL") || !strcmp(sp, "FIRSTREAL")) { safe_snprintf(str, maxlen, "%s", useron.name); tp = strchr(str, ' '); - if (tp) *tp = 0; + if (tp) + *tp = 0; return str; } if (!strcmp(sp, "LASTREAL")) { tp = strrchr(useron.name, ' '); - if (tp) tp++; - else tp = useron.name; + if (tp) + tp++; + else + tp = useron.name; return tp; } diff --git a/src/sbbs3/baja.c b/src/sbbs3/baja.c index ef015c88ffa25636ae877a3fdeb5ea0e2337f19d..813b48faedbd3995f4b8b18ebf4084304abd72b1 100644 --- a/src/sbbs3/baja.c +++ b/src/sbbs3/baja.c @@ -349,7 +349,8 @@ void writecrc(char *src, char *in) /* Automatically terminate variable name Oct-09-2000 rswindell */ sprintf(name, "%.80s", in); p = strchr(name, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (!stricmp(name, "STR") || !name[0]) l = 0; @@ -418,7 +419,8 @@ void expdefs(char *line) if (*p == '"') { /* Skip quoted text */ sp = strchr(p + 1, '"'); - if (sp) *sp = 0; + if (sp) + *sp = 0; strcat(str, p); if (!sp) break; @@ -520,7 +522,8 @@ void compile(char *src) if (!stricmp(p, "!INCLUDE")) { savline = line; sp = strchr(arg, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; sprintf(path, "%s%s", include_dir, arg); fexistcase(path); compile(path); @@ -566,10 +569,12 @@ void compile(char *src) } if (!stricmp(p, "!GLOBAL")) { /* declare global variables */ - if (!(*arg)) break; + if (!(*arg)) + break; for (p = arg; *p && *p != '#';) { sp = strchr(p, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; newvar(src, p); if (!sp) break; @@ -580,7 +585,8 @@ void compile(char *src) } if (!stricmp(p, "PATCH")) { - if (!(*arg)) break; + if (!(*arg)) + break; p = arg; while (*p) { SKIPCTRLSP(p); @@ -602,7 +608,8 @@ void compile(char *src) } if (!stricmp(p, "COMPARE_ARS")) { - if (!(*arg)) break; + if (!(*arg)) + break; strupr(arg); ar = arstr(&i, arg, NULL, NULL); if (ar != NULL) { @@ -808,7 +815,8 @@ void compile(char *src) continue; } if (!stricmp(p, "GOTO")) { /* goto */ - if (!(*arg)) break; + if (!(*arg)) + break; sp = strchr(arg, ' '); if (sp) *sp = 0; @@ -849,7 +857,8 @@ void compile(char *src) continue; } if (!stricmp(p, "CALL")) { /* call */ - if (!(*arg)) break; + if (!(*arg)) + break; sp = strchr(arg, ' '); if (sp) *sp = 0; @@ -900,7 +909,8 @@ void compile(char *src) continue; } if (!stricmp(p, "CMDKEY")) { - if (!(*arg)) break; + if (!(*arg)) + break; if (!stricmp(arg, "DIGIT")) ch = CS_DIGIT; else if (!stricmp(arg, "EDIGIT")) @@ -919,12 +929,14 @@ void compile(char *src) continue; } if (!stricmp(p, "CMDCHAR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_CMDKEY, *arg); continue; } if (!stricmp(p, "SETLOGIC") || !stricmp(p, "SET_LOGIC")) { - if (!(*arg)) break; + if (!(*arg)) + break; if (!stricmp(arg, "TRUE") || !stricmp(arg, "EQUAL")) ch = LOGIC_TRUE; else if (!stricmp(arg, "GREATER")) @@ -938,10 +950,12 @@ void compile(char *src) } if (!stricmp(p, "DEFINE_STR_VAR") || !stricmp(p, "STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; for (p = arg; *p && *p != '#';) { sp = strchr(p, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; fputc(CS_VAR_INSTRUCTION, out); fputc(DEFINE_STR_VAR, out); newvar(src, p); @@ -954,10 +968,12 @@ void compile(char *src) continue; } if (!stricmp(p, "DEFINE_INT_VAR") || !stricmp(p, "INT")) { - if (!(*arg)) break; + if (!(*arg)) + break; for (p = arg; *p && *p != '#';) { sp = strchr(p, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; fputc(CS_VAR_INSTRUCTION, out); fputc(DEFINE_INT_VAR, out); newvar(src, p); @@ -970,10 +986,12 @@ void compile(char *src) continue; } if (!stricmp(p, "DEFINE_GLOBAL_STR_VAR") || !stricmp(p, "GLOBAL_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; for (p = arg; *p && *p != '#';) { sp = strchr(p, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; fputc(CS_VAR_INSTRUCTION, out); fputc(DEFINE_GLOBAL_STR_VAR, out); newvar(src, p); @@ -986,10 +1004,12 @@ void compile(char *src) continue; } if (!stricmp(p, "DEFINE_GLOBAL_INT_VAR") || !stricmp(p, "GLOBAL_INT")) { - if (!(*arg)) break; + if (!(*arg)) + break; for (p = arg; *p && *p != '#';) { sp = strchr(p, ' '); - if (sp) *sp = 0; + if (sp) + *sp = 0; fputc(CS_VAR_INSTRUCTION, out); fputc(DEFINE_GLOBAL_INT_VAR, out); newvar(src, p); @@ -1003,7 +1023,8 @@ void compile(char *src) } if (!stricmp(p, "LOGIN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_STR_FUNCTION, out); fputc(CS_LOGIN, out); writecstr(arg); @@ -1011,7 +1032,8 @@ void compile(char *src) } if (!stricmp(p, "LOAD_TEXT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_STR_FUNCTION, out); fputc(CS_LOAD_TEXT, out); writestr(arg); @@ -1020,7 +1042,8 @@ void compile(char *src) if (!stricmp(p, "SET_STR_VAR") || (!stricmp(p, "SET") && strchr(arg, '"'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SET_STR_VAR, out); p = strchr(arg, ' '); @@ -1056,7 +1079,8 @@ void compile(char *src) continue; } if (!stricmp(p, "STRSTR") || !stricmp(p, "COMPARE_SUBSTR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(STRSTR_VARS, out); p = strchr(arg, ' '); @@ -1068,13 +1092,15 @@ void compile(char *src) continue; } if (!stricmp(p, "COPY_CHAR") || !stricmp(p, "COPY_KEY")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_VAR_INSTRUCTION, COPY_CHAR); writecrc(src, arg); continue; } if (!stricmp(p, "COPY_FIRST_CHAR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COPY_FIRST_CHAR, out); writecrc(src, arg); @@ -1082,7 +1108,8 @@ void compile(char *src) continue; } if (!stricmp(p, "COMPARE_FIRST_CHAR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COMPARE_FIRST_CHAR, out); writecrc(src, arg); @@ -1090,7 +1117,8 @@ void compile(char *src) continue; } if (!stricmp(p, "CAT_STR_VARS") || !stricmp(p, "STRCAT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(CAT_STR_VARS, out); p = strchr(arg, ' '); @@ -1102,7 +1130,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FORMAT") || !stricmp(p, "SPRINTF")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(FORMAT_STR_VAR, out); p = strchr(arg, ' '); @@ -1140,7 +1169,8 @@ void compile(char *src) } if (!stricmp(p, "STRFTIME") || !stricmp(p, "FTIME_STR")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(FORMAT_TIME_STR, out); p = strchr(arg, ' '); @@ -1163,7 +1193,8 @@ void compile(char *src) } if (!stricmp(p, "TIME_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(TIME_STR, out); p = strchr(arg, ' '); @@ -1176,7 +1207,8 @@ void compile(char *src) } if (!stricmp(p, "DATE_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(DATE_STR, out); p = strchr(arg, ' '); @@ -1189,7 +1221,8 @@ void compile(char *src) } if (!stricmp(p, "SECOND_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SECOND_STR, out); p = strchr(arg, ' '); @@ -1204,7 +1237,8 @@ void compile(char *src) if (!stricmp(p, "SET_INT_VAR") || (!stricmp(p, "SET") && *arg2 != '"')) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SET_INT_VAR, out); p = strchr(arg, ' '); @@ -1219,7 +1253,8 @@ void compile(char *src) if (!stricmp(p, "COMPARE_STR_VAR") || (!stricmp(p, "COMPARE") && *arg2 == '"')) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COMPARE_STR_VAR, out); p = strchr(arg, ' '); @@ -1288,7 +1323,8 @@ void compile(char *src) if (!stricmp(p, "COMPARE_INT_VAR") || (!stricmp(p, "COMPARE") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COMPARE_INT_VAR, out); @@ -1303,7 +1339,8 @@ void compile(char *src) } if (!stricmp(p, "COMPARE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COMPARE_VARS, out); p = strchr(arg, ' '); @@ -1315,7 +1352,8 @@ void compile(char *src) continue; } if (!stricmp(p, "COPY")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(COPY_VAR, out); p = strchr(arg, ' '); @@ -1327,7 +1365,8 @@ void compile(char *src) continue; } if (!stricmp(p, "SWAP")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SWAP_VARS, out); p = strchr(arg, ' '); @@ -1340,7 +1379,8 @@ void compile(char *src) } if (!stricmp(p, "TIME")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(TIME_INT_VAR, out); writecrc(src, arg); @@ -1348,7 +1388,8 @@ void compile(char *src) } if (!stricmp(p, "DATE_INT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(DATE_STR_TO_INT, out); p = strchr(arg, ' '); @@ -1361,7 +1402,8 @@ void compile(char *src) } if (!stricmp(p, "CRC16")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(CRC16_TO_INT, out); p = strchr(arg, ' '); @@ -1374,7 +1416,8 @@ void compile(char *src) } if (!stricmp(p, "CRC32")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(CRC32_TO_INT, out); p = strchr(arg, ' '); @@ -1387,7 +1430,8 @@ void compile(char *src) } if (!stricmp(p, "CHKSUM")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(CHKSUM_TO_INT, out); p = strchr(arg, ' '); @@ -1402,7 +1446,8 @@ void compile(char *src) if (!stricmp(p, "ADD_INT_VAR") || (!stricmp(p, "ADD") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(ADD_INT_VAR, out); p = strchr(arg, ' '); @@ -1417,7 +1462,8 @@ void compile(char *src) continue; } if (!stricmp(p, "ADD_INT_VARS") || !stricmp(p, "ADD")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(ADD_INT_VARS, out); p = strchr(arg, ' '); @@ -1432,7 +1478,8 @@ void compile(char *src) if (!stricmp(p, "SUB_INT_VAR") || (!stricmp(p, "SUB") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SUB_INT_VAR, out); p = strchr(arg, ' '); @@ -1447,7 +1494,8 @@ void compile(char *src) continue; } if (!stricmp(p, "SUB_INT_VARS") || !stricmp(p, "SUB")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(SUB_INT_VARS, out); p = strchr(arg, ' '); @@ -1462,7 +1510,8 @@ void compile(char *src) if (!stricmp(p, "MUL_INT_VAR") || (!stricmp(p, "MUL") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(MUL_INT_VAR, out); p = strchr(arg, ' '); @@ -1477,7 +1526,8 @@ void compile(char *src) continue; } if (!stricmp(p, "MUL_INT_VARS") || !stricmp(p, "MUL")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(MUL_INT_VARS, out); p = strchr(arg, ' '); @@ -1492,7 +1542,8 @@ void compile(char *src) if (!stricmp(p, "DIV_INT_VAR") || (!stricmp(p, "DIV") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(DIV_INT_VAR, out); p = strchr(arg, ' '); @@ -1507,7 +1558,8 @@ void compile(char *src) continue; } if (!stricmp(p, "DIV_INT_VARS") || !stricmp(p, "DIV")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(DIV_INT_VARS, out); p = strchr(arg, ' '); @@ -1522,7 +1574,8 @@ void compile(char *src) if (!stricmp(p, "MOD_INT_VAR") || (!stricmp(p, "MOD") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(MOD_INT_VAR, out); p = strchr(arg, ' '); @@ -1537,7 +1590,8 @@ void compile(char *src) continue; } if (!stricmp(p, "MOD_INT_VARS") || !stricmp(p, "MOD")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(MOD_INT_VARS, out); p = strchr(arg, ' '); @@ -1552,7 +1606,8 @@ void compile(char *src) if (!stricmp(p, "AND_INT_VAR") || (!stricmp(p, "AND") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(AND_INT_VAR, out); p = strchr(arg, ' '); @@ -1565,7 +1620,8 @@ void compile(char *src) continue; } if (!stricmp(p, "AND_INT_VARS") || !stricmp(p, "AND")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(AND_INT_VARS, out); p = strchr(arg, ' '); @@ -1599,7 +1655,8 @@ void compile(char *src) if (!stricmp(p, "OR_INT_VAR") || (!stricmp(p, "OR") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(OR_INT_VAR, out); p = strchr(arg, ' '); @@ -1612,7 +1669,8 @@ void compile(char *src) continue; } if (!stricmp(p, "OR_INT_VARS") || !stricmp(p, "OR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(OR_INT_VARS, out); p = strchr(arg, ' '); @@ -1627,7 +1685,8 @@ void compile(char *src) if (!stricmp(p, "NOT_INT_VAR") || (!stricmp(p, "NOT") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(NOT_INT_VAR, out); p = strchr(arg, ' '); @@ -1640,7 +1699,8 @@ void compile(char *src) continue; } if (!stricmp(p, "NOT_INT_VARS") || !stricmp(p, "NOT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(NOT_INT_VARS, out); p = strchr(arg, ' '); @@ -1655,7 +1715,8 @@ void compile(char *src) if (!stricmp(p, "XOR_INT_VAR") || (!stricmp(p, "XOR") && (IS_DIGIT(*arg2) || atol(arg2) || *arg2 == '\'' || *arg2 == '.'))) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(XOR_INT_VAR, out); p = strchr(arg, ' '); @@ -1668,7 +1729,8 @@ void compile(char *src) continue; } if (!stricmp(p, "XOR_INT_VARS") || !stricmp(p, "XOR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(XOR_INT_VARS, out); p = strchr(arg, ' '); @@ -1681,7 +1743,8 @@ void compile(char *src) } if (!stricmp(p, "RANDOM_INT_VAR") || !stricmp(p, "RANDOM")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg2)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -1703,7 +1766,8 @@ void compile(char *src) } if (!stricmp(p, "SWITCH")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_SWITCH, out); writecrc(src, arg); continue; @@ -1713,7 +1777,8 @@ void compile(char *src) continue; } if (!stricmp(p, "CASE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_CASE, out); l = val(src, arg); fwrite(&l, 4, 1, out); @@ -1730,7 +1795,8 @@ void compile(char *src) if (!stricmp(p, "PRINT") && !strchr(arg, '"') && !strchr(arg, '\\') && !strchr(arg, ' ')) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); fputc(PRINT_VAR, out); writecrc(src, arg); @@ -1738,7 +1804,8 @@ void compile(char *src) } if (!stricmp(p, "PRINTF") || !stricmp(p, "LPRINTF") || !stricmp(p, "PRINTF_LOCAL")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_VAR_INSTRUCTION, out); if (!stricmp(p, "PRINTF")) fputc(VAR_PRINTF, out); @@ -1771,7 +1838,8 @@ void compile(char *src) } if (!stricmp(p, "FOPEN")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; if ((l = isvar(arg2)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -1806,21 +1874,24 @@ void compile(char *src) continue; } if (!stricmp(p, "FCLOSE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_CLOSE, out); writecrc(src, arg); continue; } if (!stricmp(p, "FFLUSH")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_FLUSH, out); writecrc(src, arg); continue; } if (!stricmp(p, "FREAD")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (!(*arg3) || IS_DIGIT(*arg3) || atoi(arg3)) @@ -1847,7 +1918,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FWRITE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (!(*arg3) || IS_DIGIT(*arg3) || atoi(arg3)) fputc(FIO_WRITE, out); @@ -1875,7 +1947,8 @@ void compile(char *src) if (!stricmp(p, "FGET_LENGTH") || !stricmp(p, "FGETLENGTH") || !stricmp(p, "GETFLENGTH")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_GET_LENGTH, out); p = strchr(arg, ' '); @@ -1887,7 +1960,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FREAD_LINE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_READ_LINE, out); p = strchr(arg, ' '); @@ -1899,14 +1973,16 @@ void compile(char *src) continue; } if (!stricmp(p, "FEOF")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_EOF, out); writecrc(src, arg); continue; } if (!stricmp(p, "FGET_POS")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_GET_POS, out); p = strchr(arg, ' '); @@ -1918,7 +1994,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FSET_POS") || !stricmp(p, "FSEEK")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (IS_DIGIT(*arg2) || atol(arg2)) fputc(FIO_SEEK, out); @@ -1952,7 +2029,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FLOCK")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (IS_DIGIT(*arg2) || atol(arg2)) fputc(FIO_LOCK, out); @@ -1974,7 +2052,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FUNLOCK")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (IS_DIGIT(*arg2) || atol(arg2)) fputc(FIO_UNLOCK, out); @@ -1996,7 +2075,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FSET_LENGTH")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); if (IS_DIGIT(*arg2) || atol(arg2)) fputc(FIO_SET_LENGTH, out); @@ -2016,7 +2096,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FPRINTF")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_PRINTF, out); p = strchr(arg, ' '); @@ -2053,7 +2134,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FSET_ETX")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -2070,7 +2152,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FGET_TIME")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_GET_TIME, out); p = strchr(arg, ' '); @@ -2082,7 +2165,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FSET_TIME")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(FIO_SET_TIME, out); p = strchr(arg, ' '); @@ -2094,14 +2178,16 @@ void compile(char *src) continue; } if (!stricmp(p, "REMOVE_FILE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(REMOVE_FILE, out); writecrc(src, arg); /* Str var */ continue; } if (!stricmp(p, "RENAME_FILE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(RENAME_FILE, out); p = strchr(arg, ' '); @@ -2113,7 +2199,8 @@ void compile(char *src) continue; } if (!stricmp(p, "COPY_FILE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(COPY_FILE, out); p = strchr(arg, ' '); @@ -2125,7 +2212,8 @@ void compile(char *src) continue; } if (!stricmp(p, "MOVE_FILE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(MOVE_FILE, out); p = strchr(arg, ' '); @@ -2137,7 +2225,8 @@ void compile(char *src) continue; } if (!stricmp(p, "GET_FILE_ATTRIB")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(GET_FILE_ATTRIB, out); p = strchr(arg, ' '); @@ -2149,7 +2238,8 @@ void compile(char *src) continue; } if (!stricmp(p, "SET_FILE_ATTRIB")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(SET_FILE_ATTRIB, out); p = strchr(arg, ' '); @@ -2161,21 +2251,24 @@ void compile(char *src) continue; } if (!stricmp(p, "RMDIR") || !stricmp(p, "REMOVE_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(REMOVE_DIR, out); writecrc(src, arg); /* Str var */ continue; } if (!stricmp(p, "MKDIR") || !stricmp(p, "MAKE_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(MAKE_DIR, out); writecrc(src, arg); /* Str var */ continue; } if (!stricmp(p, "CHDIR") || !stricmp(p, "CHANGE_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; printf("!WARNING: CHANGE_DIR deprecated in Synchronet v3+\n"); printf(linestr, src, line, save); fputc(CS_FIO_FUNCTION, out); @@ -2184,7 +2277,8 @@ void compile(char *src) continue; } if (!stricmp(p, "OPEN_DIR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(OPEN_DIR, out); p = strchr(arg, ' '); @@ -2196,7 +2290,8 @@ void compile(char *src) continue; } if (!stricmp(p, "READ_DIR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fputc(CS_FIO_FUNCTION, out); fputc(READ_DIR, out); p = strchr(arg, ' '); @@ -2208,14 +2303,16 @@ void compile(char *src) continue; } if (!stricmp(p, "REWIND_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(REWIND_DIR, out); writecrc(src, arg); /* int var */ continue; } if (!stricmp(p, "CLOSE_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fputc(CS_FIO_FUNCTION, out); fputc(CLOSE_DIR, out); writecrc(src, arg); /* int var */ @@ -2225,25 +2322,29 @@ void compile(char *src) /* NET_FUNCTIONS */ if (!stricmp(p, "SOCKET_OPEN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_OPEN); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "SOCKET_CLOSE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_CLOSE); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "SOCKET_CHECK")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_CHECK); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "SOCKET_CONNECT")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; /* TCP port */ if ((l = isvar(arg3)) != 0) { @@ -2263,13 +2364,15 @@ void compile(char *src) continue; } if (!stricmp(p, "SOCKET_ACCEPT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_ACCEPT); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "SOCKET_NREAD")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_NREAD); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* int var (nbytes) */ @@ -2278,7 +2381,8 @@ void compile(char *src) if (!stricmp(p, "SOCKET_READ") || !stricmp(p, "SOCKET_READLINE") || !stricmp(p, "SOCKET_PEEK")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; /* length */ if (!(*arg3)) @@ -2306,7 +2410,8 @@ void compile(char *src) continue; } if (!stricmp(p, "SOCKET_WRITE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_SOCKET_WRITE); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (buffer) */ @@ -2315,7 +2420,8 @@ void compile(char *src) /* FTP functions */ if (!stricmp(p, "FTP_LOGIN")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_LOGIN); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* int var (user) */ @@ -2323,33 +2429,38 @@ void compile(char *src) continue; } if (!stricmp(p, "FTP_LOGOUT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_LOGOUT); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "FTP_PWD")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_PWD); writecrc(src, arg); /* int var (socket) */ continue; } if (!stricmp(p, "FTP_CWD")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_CWD); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (path) */ continue; } if (!stricmp(p, "FTP_DIR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_DIR); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (path) */ continue; } if (!stricmp(p, "FTP_GET")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_GET); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (src path) */ @@ -2357,7 +2468,8 @@ void compile(char *src) continue; } if (!stricmp(p, "FTP_PUT")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_PUT); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (src path) */ @@ -2365,14 +2477,16 @@ void compile(char *src) continue; } if (!stricmp(p, "FTP_DELETE")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_DELETE); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (path) */ continue; } if (!stricmp(p, "FTP_RENAME")) { - if (!(*arg) || !(*arg2) || !(*arg3)) break; + if (!(*arg) || !(*arg2) || !(*arg3)) + break; fprintf(out, "%c%c", CS_NET_FUNCTION, CS_FTP_RENAME); writecrc(src, arg); /* int var (socket) */ writecrc(src, arg2); /* str var (org name) */ @@ -2381,7 +2495,8 @@ void compile(char *src) } if (!stricmp(p, "NODE_ACTION")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -2396,7 +2511,8 @@ void compile(char *src) continue; } if (!stricmp(p, "NODE_STATUS")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -2458,19 +2574,22 @@ void compile(char *src) } if (!stricmp(p, "LOG")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_LOG); writecstr(arg); continue; } if (!stricmp(p, "MNEMONICS")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_MNEMONICS); writecstr(arg); continue; } if (!stricmp(p, "PRINT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_PRINT); if (strstr(arg, "%s") != NULL) { printf("!WARNING: PRINT \"%%s\" is a security hole if STR contains unvalidated input\n"); @@ -2480,19 +2599,22 @@ void compile(char *src) continue; } if (!stricmp(p, "PRINT_LOCAL")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_PRINT_LOCAL); writecstr(arg); continue; } if (!stricmp(p, "PRINT_REMOTE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_PRINT_REMOTE); writecstr(arg); continue; } if (!stricmp(p, "PRINTFILE")) { - if (!(*arg)) break; + if (!(*arg)) + break; if (*arg == '"') { /* NEED TO SUPPORT MODE HERE */ fprintf(out, "%c", CS_PRINTFILE); writestr(arg); @@ -2510,7 +2632,8 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, PRINTFILE_VAR_MODE); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); fwrite(&i, 2, 1, out); } @@ -2531,7 +2654,8 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, PRINTTAIL_VAR_MODE); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); i = val(src, arg2); fwrite(&i, 2, 1, out); @@ -2544,20 +2668,23 @@ void compile(char *src) continue; } if (!stricmp(p, "PRINTFILE_LOCAL")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_PRINTFILE_LOCAL); writestr(arg); continue; } if (!stricmp(p, "PRINTFILE_REMOTE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_PRINTFILE_REMOTE); writestr(arg); continue; } if (!stricmp(p, "TELNET_GATE")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg2)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -2578,32 +2705,37 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, TELNET_GATE_VAR); fwrite(&l, 4, 1, out); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); } continue; } if (!stricmp(p, "EXEC")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_EXEC); writestr(arg); continue; } if (!stricmp(p, "EXEC_INT")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_EXEC_INT); writestr(arg); continue; } if (!stricmp(p, "EXEC_BIN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_EXEC_BIN); writestr(arg); continue; } if (!stricmp(p, "EXEC_XTRN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_EXEC_XTRN); writestr(arg); continue; @@ -2627,37 +2759,43 @@ void compile(char *src) } if (!stricmp(p, "YES_NO")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_YES_NO); writecstr(arg); continue; } if (!stricmp(p, "NO_YES")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_NO_YES); writecstr(arg); continue; } if (!stricmp(p, "MENU")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_MENU); writestr(arg); continue; } if (!stricmp(p, "SET_MENU_DIR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_SET_MENU_DIR); writestr(arg); continue; } if (!stricmp(p, "SET_MENU_FILE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_SET_MENU_FILE); writestr(arg); continue; } if (!stricmp(p, "SEND_FILE_VIA")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; if (*arg2 == '"') { fprintf(out, "%c%c%c", CS_VAR_INSTRUCTION, SEND_FILE_VIA, *arg); writestr(arg2); @@ -2669,7 +2807,8 @@ void compile(char *src) continue; } if (!stricmp(p, "RECEIVE_FILE_VIA")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; if (*arg2 == '"') { fprintf(out, "%c%c%c", CS_VAR_INSTRUCTION, RECEIVE_FILE_VIA, *arg); writestr(arg2); @@ -2681,7 +2820,8 @@ void compile(char *src) continue; } if (!stricmp(p, "CHKFILE")) { - if (!(*arg)) break; + if (!(*arg)) + break; if (*arg == '"') { fprintf(out, "%c", CS_CHKFILE); writestr(arg); @@ -2697,7 +2837,8 @@ void compile(char *src) break; fprintf(out, "%c%c", CS_VAR_INSTRUCTION, FLENGTH_TO_INT); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); writecrc(src, arg2); continue; @@ -2707,7 +2848,8 @@ void compile(char *src) break; fprintf(out, "%c%c", CS_VAR_INSTRUCTION, FTIME_TO_INT); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); writecrc(src, arg2); continue; @@ -2717,55 +2859,64 @@ void compile(char *src) break; fprintf(out, "%c%c", CS_VAR_INSTRUCTION, CHARVAL_TO_INT); p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; writecrc(src, arg); writecrc(src, arg2); continue; } if (!stricmp(p, "SETSTR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_SETSTR); writecstr(arg); continue; } if (!stricmp(p, "COMPARE_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_COMPARE_STR); writecstr(arg); continue; } if (!stricmp(p, "GET_TEMPLATE")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_GET_TEMPLATE); writestr(arg); continue; } if (!stricmp(p, "READ_SIF")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_READ_SIF); writestr(arg); continue; } if (!stricmp(p, "CREATE_SIF")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_CREATE_SIF); writestr(arg); continue; } if (!stricmp(p, "TRASHCAN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_TRASHCAN); writestr(arg); continue; } if (!stricmp(p, "CMDSTR")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_CMDSTR); writecstr(arg); continue; } if (!stricmp(p, "CMDKEYS")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_CMDKEYS); for (p = arg; *p && *p != '#'; p++) { ch = *p; @@ -2790,14 +2941,16 @@ void compile(char *src) continue; } if (!stricmp(p, "COMPARE_WORD")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c", CS_COMPARE_WORD); writecstr(arg); continue; } if (!stricmp(p, "GETSTR")) { p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if ((!(*arg) || IS_DIGIT(*arg) || !stricmp(arg, "STR")) && !(*arg3)) fprintf(out, "%c%c", CS_GETSTR, atoi(arg) ? atoi(arg) : *arg2 ? atoi(arg2) : 128); @@ -2818,7 +2971,8 @@ void compile(char *src) , *arg3 ? GETSTR_MODE : GETSTR_VAR); writecrc(src, arg); - if (!i) i = 128; + if (!i) + i = 128; fwrite(&i, 1, 1, out); if (*arg3) { l = val(src, arg3); @@ -2828,9 +2982,11 @@ void compile(char *src) continue; } if (!stricmp(p, "GETNUM")) { - if (!(*arg)) break; + if (!(*arg)) + break; p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (IS_DIGIT(*arg)) { i = val(src, arg); fprintf(out, "%c", CS_GETNUM); @@ -2854,7 +3010,8 @@ void compile(char *src) continue; } if (!stricmp(p, "MSWAIT")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -2871,7 +3028,8 @@ void compile(char *src) } if (!stricmp(p, "GETLINE")) { p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (!(*arg) || IS_DIGIT(*arg)) fprintf(out, "%c%c", CS_GETLINE, *arg ? atoi(arg) :128); else { @@ -2887,14 +3045,16 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, GETLINE_VAR); writecrc(src, arg); - if (!i) i = 128; + if (!i) + i = 128; fwrite(&i, 1, 1, out); } continue; } if (!stricmp(p, "GETSTRUPR")) { p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (!(*arg) || IS_DIGIT(*arg)) fprintf(out, "%c%c", CS_GETSTRUPR, *arg ? atoi(arg) :128); else { @@ -2910,14 +3070,16 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, GETSTRUPR_VAR); writecrc(src, arg); - if (!i) i = 128; + if (!i) + i = 128; fwrite(&i, 1, 1, out); } continue; } if (!stricmp(p, "GETNAME")) { p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (!(*arg) || IS_DIGIT(*arg)) fprintf(out, "%c%c", CS_GETNAME, *arg ? atoi(arg) :25); else { @@ -2933,15 +3095,18 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, GETNAME_VAR); writecrc(src, arg); - if (!i) i = 128; + if (!i) + i = 128; fwrite(&i, 1, 1, out); } continue; } if (!stricmp(p, "SHIFT_STR")) { - if (!(*arg)) break; + if (!(*arg)) + break; p = strchr(arg, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (IS_DIGIT(*arg)) fprintf(out, "%c%c", CS_SHIFT_STR, atoi(arg)); else { @@ -2957,13 +3122,15 @@ void compile(char *src) fprintf(out, "%c%c", CS_VAR_INSTRUCTION, SHIFT_STR_VAR); writecrc(src, arg); - if (!i) i = 128; + if (!i) + i = 128; fwrite(&i, 1, 1, out); } continue; } if (!stricmp(p, "SHIFT_TO_FIRST_CHAR") || !stricmp(p, "SHIFT_TO_LAST_CHAR")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; if ((l = isvar(arg2)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -3001,7 +3168,8 @@ void compile(char *src) continue; } if (!stricmp(p, "STRLEN")) { - if (!(*arg)) break; + if (!(*arg)) + break; fprintf(out, "%c%c", CS_VAR_INSTRUCTION, STRLEN_INT_VAR); p = strchr(arg, ' '); if (!p) @@ -3012,7 +3180,8 @@ void compile(char *src) continue; } if (!stricmp(p, "REPLACE_TEXT")) { - if (!(*arg) || !(*arg2)) break; + if (!(*arg) || !(*arg2)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); fwrite(&l, 4, 1, out); /* variable */ @@ -3029,7 +3198,8 @@ void compile(char *src) continue; } if (!stricmp(p, "REVERT_TEXT")) { - if (!(*arg)) break; + if (!(*arg)) + break; if (!stricmp(arg, "ALL")) i = 0xffff; else { @@ -3050,7 +3220,8 @@ void compile(char *src) } if (!stricmp(p, "TOGGLE_USER_MISC") || !stricmp(p, "COMPARE_USER_MISC")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3072,7 +3243,8 @@ void compile(char *src) if (!stricmp(p, "TOGGLE_USER_CHAT") || !stricmp(p, "COMPARE_USER_CHAT")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3094,7 +3266,8 @@ void compile(char *src) if (!stricmp(p, "TOGGLE_USER_QWK") || !stricmp(p, "COMPARE_USER_QWK")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3116,7 +3289,8 @@ void compile(char *src) if (!stricmp(p, "TOGGLE_NODE_MISC") || !stricmp(p, "COMPARE_NODE_MISC")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3137,7 +3311,8 @@ void compile(char *src) } if (!stricmp(p, "TOGGLE_USER_FLAG")) { - if (!(*arg)) break; + if (!(*arg)) + break; p = arg; fprintf(out, "%c%c", CS_TOGGLE_USER_FLAG, toupper(*p++)); SKIPCTRLSP(p); @@ -3146,7 +3321,8 @@ void compile(char *src) } if (!stricmp(p, "SET_USER_LEVEL")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3163,7 +3339,8 @@ void compile(char *src) } if (!stricmp(p, "SET_USER_STRING")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3181,7 +3358,8 @@ void compile(char *src) if (!stricmp(p, "ADJUST_USER_CREDITS")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); @@ -3199,7 +3377,8 @@ void compile(char *src) } if (!stricmp(p, "ADJUST_USER_MINUTES")) { - if (!(*arg)) break; + if (!(*arg)) + break; if ((l = isvar(arg)) != 0) { fputc(CS_USE_INT_VAR, out); diff --git a/src/sbbs3/chat.cpp b/src/sbbs3/chat.cpp index c8184ebe9ae70374b942b8bdda7f0f691d57f188..a316700d4faf80bd2ebb270cf7f7979b88ec9237 100644 --- a/src/sbbs3/chat.cpp +++ b/src/sbbs3/chat.cpp @@ -1024,7 +1024,8 @@ void sbbs_t::privchat(bool forced, int node_num) ch = 0; } (void)lseek(in, -1L, SEEK_CUR); - if (!ch) break; /* char from other node */ + if (!ch) + break; /* char from other node */ if (ch < ' ') lprintf(LOG_DEBUG, "read control character %u (%s) from %s", ch, c_escape_char(ch), inpath); else @@ -1797,7 +1798,8 @@ bool sbbs_t::guruexp(char **ptrptr, char *line) (*ptrptr)++; (*ptrptr)++; cp = strchr(str, ']'); - if (cp) *cp = 0; + if (cp) + *cp = 0; ar = arstr(NULL, str, &cfg, NULL); c = chk_ar(ar, &useron, &client); free(ar); diff --git a/src/sbbs3/chk_ar.cpp b/src/sbbs3/chk_ar.cpp index 180103de9041c267b3d79f0f520c8970aa37089d..3e83868a2e95ae8a7fee6b93e9e30551c7184a80 100644 --- a/src/sbbs3/chk_ar.cpp +++ b/src/sbbs3/chk_ar.cpp @@ -111,7 +111,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_ANSI: if (!term_supports(ANSI)) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = ANSI; @@ -120,7 +121,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_PETSCII: if ((term_supports() & CHARSET_FLAGS) != CHARSET_PETSCII) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = PETSCII; @@ -129,7 +131,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_ASCII: if ((term_supports() & CHARSET_FLAGS) != CHARSET_ASCII) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = NO_EXASCII; @@ -138,7 +141,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_UTF8: if ((term_supports() & CHARSET_FLAGS) != CHARSET_UTF8) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = UTF8; @@ -147,7 +151,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_CP437: if ((term_supports() & CHARSET_FLAGS) != CHARSET_CP437) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = 0; @@ -156,7 +161,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_RIP: if (!term_supports(RIP)) result = _not; - else result = !_not; + else + result = !_not; if (!result) { noaccess_str = text[NoAccessTerminal]; noaccess_val = RIP; @@ -210,47 +216,56 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) case AR_ACTIVE: if (user->misc & (DELETED | INACTIVE)) result = _not; - else result = !_not; + else + result = !_not; break; case AR_INACTIVE: if (!(user->misc & INACTIVE)) result = _not; - else result = !_not; + else + result = !_not; break; case AR_DELETED: if (!(user->misc & DELETED)) result = _not; - else result = !_not; + else + result = !_not; break; case AR_EXPERT: if (!(user->misc & EXPERT)) result = _not; - else result = !_not; + else + result = !_not; break; case AR_SYSOP: if (user->level < SYSOP_LEVEL && !(sys_status & SS_TMPSYSOP)) result = _not; - else result = !_not; + else + result = !_not; break; case AR_GUEST: if (!(user->rest & FLAG('G'))) result = _not; - else result = !_not; + else + result = !_not; break; case AR_QNODE: if (!(user->rest & FLAG('Q'))) result = _not; - else result = !_not; + else + result = !_not; break; case AR_QUIET: if (thisnode.status != NODE_QUIET) result = _not; - else result = !_not; + else + result = !_not; break; case AR_LOCAL: if (online != ON_LOCAL) result = _not; - else result = !_not; + else + result = !_not; break; case AR_DAY: now = time(NULL); @@ -478,7 +493,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) break; case AR_UDR: /* up/download byte ratio (by percentage) */ l = user->dlb; - if (!l) l = 1; + if (!l) + l = 1; if (user->dlb > user->ulb && (!user->ulb || (100 / ((float)l / user->ulb)) < n)) result = _not; @@ -491,7 +507,8 @@ bool sbbs_t::ar_exp(const uchar **ptrptr, user_t* user, client_t* client) break; case AR_UDFR: /* up/download file ratio (in percentage) */ i = user->dls; - if (!i) i = 1; + if (!i) + i = 1; if (user->dls > user->uls && (!user->uls || (100 / ((float)i / user->uls)) < n)) result = _not; @@ -734,7 +751,8 @@ void sbbs_t::getusrsubs() if (!chk_ar(cfg.grp[i]->ar, &useron, &client)) continue; for (k = 0, l = 0; l < cfg.total_subs; l++) { - if (cfg.sub[l]->grp != i) continue; + if (cfg.sub[l]->grp != i) + continue; if (!chk_ar(cfg.sub[l]->ar, &useron, &client)) continue; usrsub[j][k++] = l; @@ -767,7 +785,8 @@ void sbbs_t::getusrdirs() if (!chk_ar(cfg.lib[i]->ar, &useron, &client)) continue; for (k = 0, l = 0; l < cfg.total_dirs; l++) { - if (cfg.dir[l]->lib != i) continue; + if (cfg.dir[l]->lib != i) + continue; if (!chk_ar(cfg.dir[l]->ar, &useron, &client)) continue; usrdir[j][k++] = l; diff --git a/src/sbbs3/chksmb.c b/src/sbbs3/chksmb.c index 808ed81698c0ab310ac3f3266a2236d495a8847c..7bf554bce2d0d296d8803c98a01eb3a2fe312846 100644 --- a/src/sbbs3/chksmb.c +++ b/src/sbbs3/chksmb.c @@ -246,7 +246,8 @@ int main(int argc, char **argv) ZERO_VAR(smb); SAFECOPY(smb.file, argv[x]); p = getfext(smb.file); - if (p != NULL && stricmp(p, ".shd") == 0) *p = 0; + if (p != NULL && stricmp(p, ".shd") == 0) + *p = 0; SAFEPRINTF(str, "%s.shd", smb.file); if (!fexist(str)) { diff --git a/src/sbbs3/con_out.cpp b/src/sbbs3/con_out.cpp index 698f80bc27396785b64017fa0287e34de6128fb1..eda850dfd58735ff572b3578b1b69face90ef4a9 100644 --- a/src/sbbs3/con_out.cpp +++ b/src/sbbs3/con_out.cpp @@ -314,7 +314,8 @@ int sbbs_t::petscii_to_ansibbs(unsigned char ch) case PETSCII_FLASH_ON: return attr(curatr | BLINK); case PETSCII_FLASH_OFF: return attr(curatr & ~BLINK); default: - if (ch & 0x80) return bprintf("#%3d", ch); + if (ch & 0x80) + return bprintf("#%3d", ch); return outchar(ch); case PETSCII_UPPERLOWER: case PETSCII_UPPERGRFX: @@ -1471,7 +1472,8 @@ int sbbs_t::backfill(const char* instr, float pct, int full_attr, int empty_attr atr = full_attr; else atr = empty_attr; - if (curatr != atr) attr(atr); + if (curatr != atr) + attr(atr); outchar(str[i]); } attr(save_atr); @@ -1489,8 +1491,9 @@ void sbbs_t::progress(const char* text, int count, int total, int interval) double now = xp_timer(); if (count > 0 && count < total && (now - last_progress) * 1000 < interval) return; - if (text == NULL) text = ""; - float pct = total ? ((float)count / total) * 100.0F : 100.0F; + if (text == NULL) + text = ""; + float pct = total ? ((float)count / total) * 100.0F : 100.0F; SAFEPRINTF2(str, "[ %-8s %4.1f%% ]", text, pct); cond_newline(); cursor_left(backfill(str, pct, cfg.color[clr_progress_full], cfg.color[clr_progress_empty])); diff --git a/src/sbbs3/data.cpp b/src/sbbs3/data.cpp index 619477b37a249719ce388fecb3c27a957a91634e..4fe3115bd0c5ff8f64c46e007b8ce4abf7bf6a50 100644 --- a/src/sbbs3/data.cpp +++ b/src/sbbs3/data.cpp @@ -58,11 +58,13 @@ uint sbbs_t::finduser(const char* name, bool silent_failure) while (pass < 3) { fseek(stream, 0L, SEEK_SET); /* seek to beginning for each pass */ for (l = 0; l < length; l += LEN_ALIAS + 2) { - if (!online) break; + if (!online) + break; if (fread(buf, LEN_ALIAS + 2, 1, stream) != 1) break; for (c = 0; c < LEN_ALIAS; c++) - if (buf[c] == ETX) break; + if (buf[c] == ETX) + break; buf[c] = 0; if (!c) /* deleted user */ continue; diff --git a/src/sbbs3/download.cpp b/src/sbbs3/download.cpp index d019dad82a105aee0777ef373785d91cab0b4478..d8a437d31a8bf2dbb1a61b426b55503874af0aa9 100644 --- a/src/sbbs3/download.cpp +++ b/src/sbbs3/download.cpp @@ -185,7 +185,8 @@ int sbbs_t::protocol(prot_t* prot, enum XFER_TYPE type } CRLF; - if (autohang) sys_status |= SS_PAUSEOFF; /* Pause off after download */ + if (autohang) + sys_status |= SS_PAUSEOFF; /* Pause off after download */ if (elapsed != nullptr) { *elapsed = end - start; if (*elapsed < 0) @@ -208,7 +209,8 @@ void sbbs_t::autohangup() sync(); sys_status &= ~SS_PAUSEOFF; /* turn pause back on */ rioctl(IOFI); - if (!autohang) return; + if (!autohang) + return; lncntr = 0; bputs(text[Disconnecting]); attr(GREEN); @@ -366,7 +368,8 @@ void sbbs_t::seqwait(uint devnum) break; getnodedat(cfg.node_num, &thisnode, true); /* open and lock this record */ for (i = 1; i <= cfg.sys_nodes; i++) { - if (i == cfg.node_num) continue; + if (i == cfg.node_num) + continue; if (getnodedat(i, &node, true)) { if ((node.status == NODE_INUSE || node.status == NODE_QUIET) && node.action == NODE_RFSD && node.aux == devnum) { diff --git a/src/sbbs3/exec.cpp b/src/sbbs3/exec.cpp index 60638d28f950aafc43f70bc562089cde8ae90529..d04e93e31599175b59ce25864eac244ce10ac511 100644 --- a/src/sbbs3/exec.cpp +++ b/src/sbbs3/exec.cpp @@ -28,7 +28,8 @@ char ** sbbs_t::getstrvar(csi_t *bin, uint32_t name) { int i; - if (sysvar_pi >= MAX_SYSVARS) sysvar_pi = 0; + if (sysvar_pi >= MAX_SYSVARS) + sysvar_pi = 0; switch (name) { case 0: return (char **)&(bin->str); @@ -113,7 +114,8 @@ int32_t * sbbs_t::getintvar(csi_t *bin, uint32_t name) { int i; - if (sysvar_li >= MAX_SYSVARS) sysvar_li = 0; + if (sysvar_li >= MAX_SYSVARS) + sysvar_li = 0; switch (name) { case 0: sysvar_l[sysvar_li] = strtol((char*)bin->str, 0, 0); diff --git a/src/sbbs3/execfile.cpp b/src/sbbs3/execfile.cpp index 5403f911cf8e3377f73bacd177ec67327be2c62d..9b642701f372def07b88878e1cb53983d2d14329 100644 --- a/src/sbbs3/execfile.cpp +++ b/src/sbbs3/execfile.cpp @@ -34,7 +34,8 @@ int sbbs_t::exec_file(csi_t *csi) case CS_FILE_SELECT_AREA: csi->logic = LOGIC_FALSE; - if (!usrlibs) return 0; + if (!usrlibs) + return 0; while (online) { j = 0; if (usrlibs > 1) { @@ -43,9 +44,12 @@ int sbbs_t::exec_file(csi_t *csi) for (i = 0; i < usrlibs && !msgabort(); i++) { if (i == curlib) outchar('*'); - else outchar(' '); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + else + outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bprintf(text[CfgLibLstFmt] , i + 1, cfg.lib[usrlib[i]]->lname); @@ -67,13 +71,17 @@ int sbbs_t::exec_file(csi_t *csi) CLS; bprintf(text[DirLstHdr], cfg.lib[usrlib[j]]->lname); for (i = 0; i < usrdirs[j] && !msgabort(); i++) { - if (i == curdir[j]) outchar('*'); - else outchar(' '); + if (i == curdir[j]) + outchar('*'); + else + outchar(' '); snprintf(str, sizeof str, text[DirLstFmt], i + 1 , cfg.dir[usrdir[j][i]]->lname, nulstr , getfiles(&cfg, usrdir[j][i])); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bputs(str); } @@ -189,7 +197,8 @@ int sbbs_t::exec_file(csi_t *csi) return 0; case CS_FILE_SHOW_LIBRARIES: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (menu("libs", P_NOERROR)) { return 0; } @@ -197,8 +206,10 @@ int sbbs_t::exec_file(csi_t *csi) for (i = 0; i < usrlibs && !msgabort(); i++) { if (i == curlib) outchar('*'); - else outchar(' '); - if (i < 9) outchar(' '); + else + outchar(' '); + if (i < 9) + outchar(' '); add_hotspot(i + 1); bprintf(text[LibLstFmt], i + 1 , cfg.lib[usrlib[i]]->lname, nulstr, usrdirs[i]); @@ -206,7 +217,8 @@ int sbbs_t::exec_file(csi_t *csi) return 0; case CS_FILE_SHOW_DIRECTORIES: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; snprintf(str, sizeof str, "dirs%u", usrlib[curlib] + 1); if (menu(str, P_NOERROR)) { return 0; @@ -214,13 +226,17 @@ int sbbs_t::exec_file(csi_t *csi) CRLF; bprintf(text[DirLstHdr], cfg.lib[usrlib[curlib]]->lname); for (i = 0; i < usrdirs[curlib] && !msgabort(); i++) { - if (i == curdir[curlib]) outchar('*'); - else outchar(' '); + if (i == curdir[curlib]) + outchar('*'); + else + outchar(' '); snprintf(str, sizeof str, text[DirLstFmt], i + 1 , cfg.dir[usrdir[curlib][i]]->lname, nulstr , getfiles(&cfg, usrdir[curlib][i])); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bputs(str); } @@ -234,19 +250,23 @@ int sbbs_t::exec_file(csi_t *csi) case CS_FILE_LIBRARY_DOWN: if (!curlib) curlib = usrlibs - 1; - else curlib--; + else + curlib--; return 0; case CS_FILE_DIRECTORY_UP: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; curdir[curlib]++; if (curdir[curlib] >= usrdirs[curlib]) curdir[curlib] = 0; return 0; case CS_FILE_DIRECTORY_DOWN: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (!curdir[curlib]) curdir[curlib] = usrdirs[curlib] - 1; - else curdir[curlib]--; + else + curdir[curlib]--; return 0; case CS_FILE_SET_AREA: csi->logic = LOGIC_TRUE; @@ -298,7 +318,8 @@ int sbbs_t::exec_file(csi_t *csi) csi->logic = upload(cfg.sysop_dir) ? LOGIC_TRUE:LOGIC_FALSE; return 0; case CS_FILE_DOWNLOAD: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (useron.rest & FLAG('D')) { bputs(text[R_Download]); return 0; @@ -321,7 +342,8 @@ int sbbs_t::exec_file(csi_t *csi) bputs(text[SearchingAllLibs]); for (i = 0; i < usrlibs; i++) { progress(text[Scanning], i, usrlibs); - if (i == curlib) continue; + if (i == curlib) + continue; for (j = 0; j < usrdirs[i]; j++) { if (msgabort()) { bputs(text[Aborted]); @@ -385,7 +407,8 @@ int sbbs_t::exec_file(csi_t *csi) return 0; case CS_FILE_VIEW: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; csi->logic = LOGIC_TRUE; if (listfiles(usrdir[curlib][curdir[curlib]], csi->str, 0, FL_VIEW) || strcmp(csi->str, ALLFILES) == 0) @@ -397,7 +420,8 @@ int sbbs_t::exec_file(csi_t *csi) return 0; } progress(text[Scanning], i, usrdirs[curlib]); - if (i == curdir[curlib]) continue; + if (i == curdir[curlib]) + continue; if (listfiles(usrdir[curlib][i], csi->str, 0, FL_VIEW)) break; } @@ -407,7 +431,8 @@ int sbbs_t::exec_file(csi_t *csi) bputs(text[SearchingAllLibs]); for (i = 0; i < usrlibs; i++) { progress(text[Scanning], i, usrlibs); - if (i == curlib) continue; + if (i == curlib) + continue; for (j = 0; j < usrdirs[i]; j++) { if (msgabort()) { bputs(text[Aborted]); @@ -422,7 +447,8 @@ int sbbs_t::exec_file(csi_t *csi) bputs(text[FileNotFound]); return 0; case CS_FILE_LIST: /* List files in current dir */ - if (!usrlibs) return 0; + if (!usrlibs) + return 0; csi->logic = LOGIC_FALSE; if (!getfiles(&cfg, usrdir[curlib][curdir[curlib]])) { bputs(text[EmptyDir]); @@ -435,7 +461,8 @@ int sbbs_t::exec_file(csi_t *csi) csi->logic = !s; return 0; case CS_FILE_LIST_EXTENDED: /* Extended Information on files */ - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (!listfileinfo(usrdir[curlib][curdir[curlib]], csi->str, FI_INFO) && strcmp(csi->str, ALLFILES) != 0) { bputs(text[SearchingAllDirs]); @@ -454,7 +481,8 @@ int sbbs_t::exec_file(csi_t *csi) bputs(text[SearchingAllLibs]); for (i = 0; i < usrlibs; i++) { progress(text[Scanning], i, usrlibs); - if (i == curlib) continue; + if (i == curlib) + continue; for (j = 0; j < usrdirs[i]; j++) { if (msgabort()) { bputs(text[Aborted]); @@ -496,7 +524,8 @@ int sbbs_t::exec_file(csi_t *csi) scanalldirs(FL_ULTIME); return 0; case CS_FILE_REMOVE: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (useron.rest & FLAG('R')) { bputs(text[R_RemoveFiles]); return 0; @@ -524,7 +553,8 @@ int sbbs_t::exec_file(csi_t *csi) bputs(text[SearchingAllLibs]); for (i = 0; i < usrlibs; i++) { progress(text[Scanning], i, usrlibs); - if (i == curlib || i == cfg.user_dir) continue; + if (i == curlib || i == cfg.user_dir) + continue; for (j = 0; j < usrdirs[i]; j++) { if (msgabort()) { bputs(text[Aborted]); diff --git a/src/sbbs3/execfunc.cpp b/src/sbbs3/execfunc.cpp index ee5a8df69854ca239232e4a5e844f1f1ee5b934c..32352332a652d132b8986ef9472fc59afa001dd9 100644 --- a/src/sbbs3/execfunc.cpp +++ b/src/sbbs3/execfunc.cpp @@ -63,11 +63,13 @@ int sbbs_t::exec_function(csi_t *csi) sys_info(); return 0; case CS_INFO_SUBBOARD: /* Sub-board information */ - if (!usrgrps) return 0; + if (!usrgrps) + return 0; subinfo(usrsub[curgrp][cursub[curgrp]]); return 0; case CS_INFO_DIRECTORY: /* Sub-board information */ - if (!usrlibs) return 0; + if (!usrlibs) + return 0; dirinfo(usrdir[curlib][curdir[curlib]]); return 0; case CS_INFO_VERSION: /* Version */ @@ -331,14 +333,16 @@ int sbbs_t::exec_function(csi_t *csi) case CS_FILE_UPLOAD_BULK: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (!stricmp(csi->str, "ALL")) { /* all libraries */ for (i = 0; i < usrlibs; i++) for (j = 0; j < usrdirs[i]; j++) { if (cfg.lib[i]->offline_dir == usrdir[i][j]) continue; - if (bulkupload(usrdir[i][j])) return 0; + if (bulkupload(usrdir[i][j])) + return 0; } return 0; } @@ -347,7 +351,8 @@ int sbbs_t::exec_function(csi_t *csi) if (cfg.lib[usrlib[curlib]]->offline_dir == usrdir[curlib][i]) continue; - if (bulkupload(usrdir[curlib][i])) return 0; + if (bulkupload(usrdir[curlib][i])) + return 0; } return 0; } @@ -358,7 +363,8 @@ int sbbs_t::exec_function(csi_t *csi) case CS_FILE_FIND_OPEN: case CS_FILE_FIND_OFFLINE: case CS_FILE_FIND_OLD_UPLOADS: - if (!usrlibs) return 0; + if (!usrlibs) + return 0; if (!getfilespec(str)) return 0; k = 0; @@ -393,7 +399,8 @@ int sbbs_t::exec_function(csi_t *csi) continue; if ((s = listfileinfo(usrdir[i][j], str, (char)l)) == -1) return 0; - else k += s; + else + k += s; } } else if (!stricmp(csi->str, "LIB")) { @@ -402,7 +409,8 @@ int sbbs_t::exec_function(csi_t *csi) continue; if ((s = listfileinfo(usrdir[curlib][i], str, (char)l)) == -1) return 0; - else k += s; + else + k += s; } } else { diff --git a/src/sbbs3/execmisc.cpp b/src/sbbs3/execmisc.cpp index 366fc4fc19851030e66e6f5758cfc5fab9ab5b41..00547c2404bacec3586fd83cbdcee441bce647c4 100644 --- a/src/sbbs3/execmisc.cpp +++ b/src/sbbs3/execmisc.cpp @@ -1073,14 +1073,22 @@ int sbbs_t::exec_misc(csi_t* csi, const char *path) if (lp) { /* Access flags are not cross-platform, so convert */ i = 0; - if (w & 0x001) i |= O_RDONLY; - if (w & 0x002) i |= O_WRONLY; - if (w & 0x004) i |= O_RDWR; - if (w & 0x040) i |= O_DENYNONE; - if (w & 0x100) i |= O_CREAT; - if (w & 0x200) i |= O_TRUNC; - if (w & 0x400) i |= O_EXCL; - if (w & 0x800) i |= O_APPEND; + if (w & 0x001) + i |= O_RDONLY; + if (w & 0x002) + i |= O_WRONLY; + if (w & 0x004) + i |= O_RDWR; + if (w & 0x040) + i |= O_DENYNONE; + if (w & 0x100) + i |= O_CREAT; + if (w & 0x200) + i |= O_TRUNC; + if (w & 0x400) + i |= O_EXCL; + if (w & 0x800) + i |= O_APPEND; fp = fnopen((int *)&j, str, i); if (fp != NULL) { for (i = 0; i < csi->files; i++) @@ -1150,13 +1158,15 @@ int sbbs_t::exec_misc(csi_t* csi, const char *path) buf[j] = 0; if (csi->etx) { p = strchr(buf, csi->etx); - if (p) *p = 0; + if (p) + *p = 0; } *pp = copystrvar(csi, *pp, buf); } else { *lp2 = 0; - if (i > 4 || i < 1) i = 4; + if (i > 4 || i < 1) + i = 4; if (fread(lp2, 1, i, csi->file[*lp1]) == (size_t)i) csi->logic = LOGIC_TRUE; } @@ -1183,7 +1193,8 @@ int sbbs_t::exec_misc(csi_t* csi, const char *path) buf[i] = 0; if (csi->etx) { p = strchr(buf, csi->etx); - if (p) *p = 0; + if (p) + *p = 0; } if (pp) *pp = copystrvar(csi, *pp, buf); @@ -1216,8 +1227,10 @@ int sbbs_t::exec_misc(csi_t* csi, const char *path) return 0; if (pp) { j = strlen(*pp); - if (i < 1) i = j; - if (j > i) j = i; + if (i < 1) + i = j; + if (j > i) + j = i; if (fwrite(*pp, 1, j, csi->file[*lp1]) != (size_t)j) csi->logic = LOGIC_FALSE; else { @@ -1228,7 +1241,8 @@ int sbbs_t::exec_misc(csi_t* csi, const char *path) csi->logic = LOGIC_TRUE; } } else { - if (i < 1 || i > 4) i = 4; + if (i < 1 || i > 4) + i = 4; if (fwrite(lp2, 1, i, csi->file[*lp1]) == (size_t)i) csi->logic = LOGIC_TRUE; } diff --git a/src/sbbs3/execmsg.cpp b/src/sbbs3/execmsg.cpp index f0d436527fd0c52420702eafa86cb5ef56dc5992..a0b836c578945c1a3f54fd1711cb767236b4639f 100644 --- a/src/sbbs3/execmsg.cpp +++ b/src/sbbs3/execmsg.cpp @@ -31,7 +31,8 @@ int sbbs_t::exec_msg(csi_t *csi) case CS_MSG_SELECT_AREA: csi->logic = LOGIC_FALSE; - if (!usrgrps) return 0; + if (!usrgrps) + return 0; while (online) { j = 0; if (usrgrps > 1) { @@ -40,9 +41,12 @@ int sbbs_t::exec_msg(csi_t *csi) for (i = 0; i < usrgrps && !msgabort(); i++) { if (i == curgrp) outchar('*'); - else outchar(' '); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + else + outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bprintf(text[CfgGrpLstFmt] , i + 1, cfg.grp[usrgrp[i]]->lname); @@ -64,13 +68,17 @@ int sbbs_t::exec_msg(csi_t *csi) CLS; bprintf(text[SubLstHdr], cfg.grp[usrgrp[j]]->lname); for (i = 0; i < usrsubs[j] && !msgabort(); i++) { - if (i == cursub[j]) outchar('*'); - else outchar(' '); + if (i == cursub[j]) + outchar('*'); + else + outchar(' '); snprintf(str, sizeof str, text[SubLstFmt], i + 1 , cfg.sub[usrsub[j][i]]->lname, nulstr , getposts(&cfg, usrsub[j][i])); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bputs(str); } @@ -197,7 +205,8 @@ int sbbs_t::exec_msg(csi_t *csi) return 0; case CS_MSG_SHOW_GROUPS: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; if (menu("grps", P_NOERROR)) { return 0; } @@ -205,8 +214,10 @@ int sbbs_t::exec_msg(csi_t *csi) for (i = 0; i < usrgrps && !msgabort(); i++) { if (i == curgrp) outchar('*'); - else outchar(' '); - if (i < 9) outchar(' '); + else + outchar(' '); + if (i < 9) + outchar(' '); add_hotspot(i + 1); bprintf(text[GrpLstFmt], i + 1 , cfg.grp[usrgrp[i]]->lname, nulstr, usrsubs[i]); @@ -214,7 +225,8 @@ int sbbs_t::exec_msg(csi_t *csi) return 0; case CS_MSG_SHOW_SUBBOARDS: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; snprintf(str, sizeof str, "subs%u", usrgrp[curgrp] + 1); if (menu(str, P_NOERROR)) { return 0; @@ -222,13 +234,17 @@ int sbbs_t::exec_msg(csi_t *csi) CRLF; bprintf(text[SubLstHdr], cfg.grp[usrgrp[curgrp]]->lname); for (i = 0; i < usrsubs[curgrp] && !msgabort(); i++) { - if (i == cursub[curgrp]) outchar('*'); - else outchar(' '); + if (i == cursub[curgrp]) + outchar('*'); + else + outchar(' '); snprintf(str, sizeof str, text[SubLstFmt], i + 1 , cfg.sub[usrsub[curgrp][i]]->lname, nulstr , getposts(&cfg, usrsub[curgrp][i])); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); add_hotspot(i + 1); bputs(str); } @@ -242,19 +258,23 @@ int sbbs_t::exec_msg(csi_t *csi) case CS_MSG_GROUP_DOWN: if (!curgrp) curgrp = usrgrps - 1; - else curgrp--; + else + curgrp--; return 0; case CS_MSG_SUBBOARD_UP: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; cursub[curgrp]++; if (cursub[curgrp] >= usrsubs[curgrp]) cursub[curgrp] = 0; return 0; case CS_MSG_SUBBOARD_DOWN: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; if (!cursub[curgrp]) cursub[curgrp] = usrsubs[curgrp] - 1; - else cursub[curgrp]--; + else + cursub[curgrp]--; return 0; case CS_MSG_SET_AREA: csi->logic = LOGIC_TRUE; @@ -268,11 +288,13 @@ int sbbs_t::exec_msg(csi_t *csi) csi->logic = LOGIC_FALSE; return 0; case CS_MSG_READ: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; csi->logic = scanposts(usrsub[curgrp][cursub[curgrp]], 0, nulstr); return 0; case CS_MSG_POST: - if (!usrgrps) return 0; + if (!usrgrps) + return 0; csi->logic = !postmsg(usrsub[curgrp][cursub[curgrp]], 0, 0); return 0; case CS_MSG_QWK: diff --git a/src/sbbs3/execnet.cpp b/src/sbbs3/execnet.cpp index b167d4eb8a5b2bbba5b94cc590f76e77c459ff28..24091ac63c889678b8f39bad32d90ee76ad01f35 100644 --- a/src/sbbs3/execnet.cpp +++ b/src/sbbs3/execnet.cpp @@ -184,7 +184,8 @@ int sbbs_t::exec_net(csi_t* csi) buf[rcv_count] = 0; if (csi->etx) { p = strchr(buf, csi->etx); - if (p) *p = 0; + if (p) + *p = 0; } *pp = copystrvar(csi, *pp, buf); } else @@ -242,7 +243,8 @@ int sbbs_t::exec_net(csi_t* csi) if (csi->etx) { p = strchr(buf, csi->etx); - if (p) *p = 0; + if (p) + *p = 0; } *pp = copystrvar(csi, *pp, buf); csi->logic = LOGIC_TRUE; diff --git a/src/sbbs3/filelist.c b/src/sbbs3/filelist.c index d7650d6b1dc6eec3fbc292153e785ceff0514803..1b21074e4e33042842e281131d16dfe1f2e7eba0 100644 --- a/src/sbbs3/filelist.c +++ b/src/sbbs3/filelist.c @@ -350,7 +350,8 @@ int main(int argc, char **argv) fprintf(out, "%s\n", fname); } if (!smb.status.total_files) { - if (misc & AUTO) fclose(out); + if (misc & AUTO) + fclose(out); continue; } int longest_filename = 12; @@ -446,7 +447,8 @@ int main(int argc, char **argv) smb_close(&smb); if (dir_files) fprintf(out, "\n"); /* blank line at end of dir */ - if (misc & AUTO) fclose(out); + if (misc & AUTO) + fclose(out); freefiles(file_list, file_count); } diff --git a/src/sbbs3/fixsmb.c b/src/sbbs3/fixsmb.c index 7093690e20a08e21e8dd7d035d10de6190178c1d..653aaa13652f2f34a88e569edcb4e6b68a3f74b7 100644 --- a/src/sbbs3/fixsmb.c +++ b/src/sbbs3/fixsmb.c @@ -286,8 +286,10 @@ int fixsmb(char* sub) /* Allocate header blocks */ /**************************/ fseek(smb.sha_fp, (l - smb.status.header_offset) / SHD_BLOCK_LEN, SEEK_SET); - if (msg.hdr.attr & MSG_DELETE) c = 0; /* mark as free */ - else c = 1; /* or allocated */ + if (msg.hdr.attr & MSG_DELETE) + c = 0; /* mark as free */ + else + c = 1; /* or allocated */ for (i = 0; i < (int)(size / SHD_BLOCK_LEN); i++) fputc(c, smb.sha_fp); diff --git a/src/sbbs3/ftpsrvr.c b/src/sbbs3/ftpsrvr.c index aded7f51c9a08dac98471d483d0b8100d4f5971d..218187f4244f471c5079a4bd9aedd0c305a659ff 100644 --- a/src/sbbs3/ftpsrvr.c +++ b/src/sbbs3/ftpsrvr.c @@ -1539,7 +1539,8 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl tp = p; /* terminator */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; if (stricmp(p, alias)) /* Not a match */ continue; @@ -1549,7 +1550,8 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl tp = p; /* terminator */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; if (filename == NULL /* CWD? */ && (*lastchar(p) != '/' || (*fname != 0 && strcmp(fname, alias)))) { fclose(fp); @@ -1563,7 +1565,8 @@ static BOOL ftpalias(char* fullalias, char* filename, user_t* user, client_t* cl continue; } p = strrchr(p, '/'); - if (p != NULL) p++; + if (p != NULL) + p++; if (p != NULL && filename != NULL) { if (*p) sprintf(filename, "%s%s", scfg.dir[dir]->path, p); @@ -1725,8 +1728,10 @@ char* root_dir(char* path) if (!strncmp(root, "\\\\", 2)) { /* network path */ p = strchr(root + 2, '\\'); - if (p) p = strchr(p + 1, '\\'); - if (p) *(p + 1) = 0; /* truncate at \\computer\sharename\ */ + if (p) + p = strchr(p + 1, '\\'); + if (p) + *(p + 1) = 0; /* truncate at \\computer\sharename\ */ } else if (!strncmp(root + 1, ":/", 2) || !strncmp(root + 1, ":\\", 2)) root[3] = 0; @@ -3744,14 +3749,16 @@ static void ctrl_thread(void* arg) tp = p; /* terminator pointer */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; np = tp + 1; /* filename pointer */ SKIP_WHITESPACE(np); tp = np; /* terminator pointer */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; dp = tp + 1; /* description pointer */ SKIP_WHITESPACE(dp); @@ -4065,14 +4072,16 @@ static void ctrl_thread(void* arg) tp = p; /* terminator pointer */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; np = tp + 1; /* filename pointer */ SKIP_WHITESPACE(np); tp = np; /* terminator pointer */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; dp = tp + 1; /* description pointer */ SKIP_WHITESPACE(dp); @@ -4439,7 +4448,8 @@ static void ctrl_thread(void* arg) tp = p; /* terminator pointer */ FIND_WHITESPACE(tp); - if (*tp) *tp = 0; + if (*tp) + *tp = 0; np = tp + 1; /* filename pointer */ SKIP_WHITESPACE(np); @@ -4888,9 +4898,11 @@ static void ctrl_thread(void* arg) else if (!strcmp(p, ".")) success = TRUE; if (!success && (curlib < 0 || *p == '/')) { /* Root dir */ - if (*p == '/') p++; + if (*p == '/') + p++; tp = strchr(p, '/'); - if (tp) *tp = 0; + if (tp) + *tp = 0; for (i = 0; i < scfg.total_libs; i++) { if (!chk_ar(&scfg, scfg.lib[i]->ar, &user, &client)) continue; @@ -4906,7 +4918,8 @@ static void ctrl_thread(void* arg) if (tp) p = tp + 1; tp = lastchar(p); - if (tp && *tp == '/') *tp = 0; + if (tp && *tp == '/') + *tp = 0; for (i = 0; i < scfg.total_dirs; i++) { if (scfg.dir[i]->lib != curlib) continue; @@ -5167,11 +5180,16 @@ void ftp_server(void* arg) protected_uint32_init(&active_clients, 0); /* Setup intelligent defaults */ - if (startup->port == 0) startup->port = IPPORT_FTP; - if (startup->qwk_timeout == 0) startup->qwk_timeout = FTP_DEFAULT_QWK_TIMEOUT; /* seconds */ - if (startup->max_inactivity == 0) startup->max_inactivity = FTP_DEFAULT_MAX_INACTIVITY; /* seconds */ - if (startup->sem_chk_freq == 0) startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; /* seconds */ - if (startup->index_file_name[0] == 0) SAFECOPY(startup->index_file_name, "00index"); + if (startup->port == 0) + startup->port = IPPORT_FTP; + if (startup->qwk_timeout == 0) + startup->qwk_timeout = FTP_DEFAULT_QWK_TIMEOUT; /* seconds */ + if (startup->max_inactivity == 0) + startup->max_inactivity = FTP_DEFAULT_MAX_INACTIVITY; /* seconds */ + if (startup->sem_chk_freq == 0) + startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; /* seconds */ + if (startup->index_file_name[0] == 0) + SAFECOPY(startup->index_file_name, "00index"); (void)protected_uint32_adjust(&thread_count, 1); thread_up(FALSE /* setuid */); diff --git a/src/sbbs3/getkey.cpp b/src/sbbs3/getkey.cpp index cbf200bee77d962578d1de5a72ad9af008a77274..ce7c855394c70a60f8d00a43775d284c19d67df8 100644 --- a/src/sbbs3/getkey.cpp +++ b/src/sbbs3/getkey.cpp @@ -107,7 +107,8 @@ char sbbs_t::getkey(int mode) return toupper(ch); return ch; } - if (sys_status & SS_USERON && !(sys_status & SS_LCHAT)) gettimeleft(); + if (sys_status & SS_USERON && !(sys_status & SS_LCHAT)) + gettimeleft(); else if (online && now - answertime > SEC_LOGON && !(sys_status & SS_LCHAT)) { console &= ~(CON_R_ECHOX | CON_L_ECHOX); console |= (CON_R_ECHO | CON_L_ECHO); diff --git a/src/sbbs3/getmail.c b/src/sbbs3/getmail.c index d6ebe8b56e4d0dc3c3550161a1cc8546d8357c8e..d901820fc009aef3b972955feec1a5c6293d8899 100644 --- a/src/sbbs3/getmail.c +++ b/src/sbbs3/getmail.c @@ -88,10 +88,13 @@ bool delfattach(scfg_t* cfg, smbmsg_t* msg) tp = files; while (1) { p = strchr(tp, ' '); - if (p) *p = 0; + if (p) + *p = 0; sp = strrchr(tp, '/'); /* sp is slash pointer */ - if (!sp) sp = strrchr(tp, '\\'); - if (sp) tp = sp + 1; + if (!sp) + sp = strrchr(tp, '\\'); + if (sp) + tp = sp + 1; if (strcspn(tp, ILLEGAL_FILENAME_CHARS) == strlen(tp)) { SAFEPRINTF2(path, "%s/%s", dir, tp); if (fexist(path) && remove(path) != 0) diff --git a/src/sbbs3/getmsg.cpp b/src/sbbs3/getmsg.cpp index 271d2712bc931ec39cb5ed03cdfd7d3662891202..b2fe8c56ea09a1db1380be1e0d7aaf4df5ba764c 100644 --- a/src/sbbs3/getmsg.cpp +++ b/src/sbbs3/getmsg.cpp @@ -288,7 +288,8 @@ bool sbbs_t::show_msg(smb_t* smb, smbmsg_t* msg, int p_mode, post_t* post) float pct = post->total_votes ? ((float)post->votes[answers] / post->total_votes) * 100.0F : 0.0F; char str[128]; int width = longest_answer; - if (width < cols / 3) width = cols / 3; + if (width < cols / 3) + width = cols / 3; else if (width > cols - 20) width = cols - 20; bprintf(text[PollAnswerNumber], answers + 1); @@ -405,7 +406,8 @@ void sbbs_t::download_msg_attachments(smb_t* smb, smbmsg_t* msg, bool del, bool tp = subj; while (online) { p = strchr(tp, ' '); - if (p) *p = 0; + if (p) + *p = 0; tp = getfname(tp); if (strcspn(tp, ILLEGAL_FILENAME_CHARS) == strlen(tp)) { SAFEPRINTF3(fpath, "%sfile/%04u.in/%s" /* path is path/fname */ diff --git a/src/sbbs3/getnode.cpp b/src/sbbs3/getnode.cpp index 841569fecd3a51f4eca960ed168f64d421c0561d..0f8680b1c594de14b36106ec3ef3545816396a74 100644 --- a/src/sbbs3/getnode.cpp +++ b/src/sbbs3/getnode.cpp @@ -502,7 +502,8 @@ void sbbs_t::printnodedat(uint number, node_t* node) else { if ((node->aux / 60) == 0) /* 12 midnite */ hour = 12; - else hour = node->aux / 60; + else + hour = node->aux / 60; strcpy(mer, "am"); } bprintf(" ETA %02d:%02d %s" diff --git a/src/sbbs3/getstr.cpp b/src/sbbs3/getstr.cpp index 05918d04d27832d4816fe16970e2e343153d8291..c5503399f2988822750d3eedae77eb31523c696d 100644 --- a/src/sbbs3/getstr.cpp +++ b/src/sbbs3/getstr.cpp @@ -60,7 +60,8 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, int mode, const str_list_t hi SAFECOPY(str1, wordwrap); wordwrap[0] = 0; } - else str1[0] = 0; + else + str1[0] = 0; if (mode & K_EDIT) SAFECAT(str1, strout); else @@ -323,7 +324,8 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, int mode, const str_list_t hi case CTRL_L: /* Ctrl-L Center line (used to be Ctrl-V) */ str1[l] = 0; l = bstrlen(str1); - if (!l) break; + if (!l) + break; for (x = 0; x < (maxlen - l) / 2; x++) str2[x] = ' '; str2[x] = 0; @@ -624,7 +626,8 @@ size_t sbbs_t::getstr(char *strout, size_t maxlen, int mode, const str_list_t hi } else l = 0; - if (mode & K_LINE && !(mode & K_NOECHO)) attr(LIGHTGRAY); + if (mode & K_LINE && !(mode & K_NOECHO)) + attr(LIGHTGRAY); if (!(mode & (K_NOCRLF | K_NOECHO))) { if (!(mode & K_MSG && sys_status & SS_ABORT)) { CRLF; diff --git a/src/sbbs3/inkey.cpp b/src/sbbs3/inkey.cpp index 8642a5bff511783195ed4a8161ed22286c46963f..8fea4699f56ca4f977b423a313579e38ec34552c 100644 --- a/src/sbbs3/inkey.cpp +++ b/src/sbbs3/inkey.cpp @@ -565,8 +565,10 @@ char sbbs_t::handle_ctrlkey(char ch, int mode) lprintf(LOG_DEBUG, "received ANSI cursor position report: %ux%u" , x, y); /* Sanity check the coordinates in the response: */ - if (useron.cols == TERM_COLS_AUTO && x >= TERM_COLS_MIN && x <= TERM_COLS_MAX) cols = x; - if (useron.rows == TERM_ROWS_AUTO && y >= TERM_ROWS_MIN && y <= TERM_ROWS_MAX) rows = y; + if (useron.cols == TERM_COLS_AUTO && x >= TERM_COLS_MIN && x <= TERM_COLS_MAX) + cols = x; + if (useron.rows == TERM_ROWS_AUTO && y >= TERM_ROWS_MIN && y <= TERM_ROWS_MAX) + rows = y; if (useron.cols == TERM_COLS_AUTO || useron.rows == TERM_ROWS_AUTO) update_nodeterm(); } @@ -589,18 +591,28 @@ void sbbs_t::set_mouse(int flags) int term = term_supports(); if ((term & ANSI) && ((term & MOUSE) || flags == MOUSE_MODE_OFF)) { int mode = mouse_mode & ~flags; - if (mode & MOUSE_MODE_X10) ansi_mouse(ANSI_MOUSE_X10, false); - if (mode & MOUSE_MODE_NORM) ansi_mouse(ANSI_MOUSE_NORM, false); - if (mode & MOUSE_MODE_BTN) ansi_mouse(ANSI_MOUSE_BTN, false); - if (mode & MOUSE_MODE_ANY) ansi_mouse(ANSI_MOUSE_ANY, false); - if (mode & MOUSE_MODE_EXT) ansi_mouse(ANSI_MOUSE_EXT, false); + if (mode & MOUSE_MODE_X10) + ansi_mouse(ANSI_MOUSE_X10, false); + if (mode & MOUSE_MODE_NORM) + ansi_mouse(ANSI_MOUSE_NORM, false); + if (mode & MOUSE_MODE_BTN) + ansi_mouse(ANSI_MOUSE_BTN, false); + if (mode & MOUSE_MODE_ANY) + ansi_mouse(ANSI_MOUSE_ANY, false); + if (mode & MOUSE_MODE_EXT) + ansi_mouse(ANSI_MOUSE_EXT, false); mode = flags & ~mouse_mode; - if (mode & MOUSE_MODE_X10) ansi_mouse(ANSI_MOUSE_X10, true); - if (mode & MOUSE_MODE_NORM) ansi_mouse(ANSI_MOUSE_NORM, true); - if (mode & MOUSE_MODE_BTN) ansi_mouse(ANSI_MOUSE_BTN, true); - if (mode & MOUSE_MODE_ANY) ansi_mouse(ANSI_MOUSE_ANY, true); - if (mode & MOUSE_MODE_EXT) ansi_mouse(ANSI_MOUSE_EXT, true); + if (mode & MOUSE_MODE_X10) + ansi_mouse(ANSI_MOUSE_X10, true); + if (mode & MOUSE_MODE_NORM) + ansi_mouse(ANSI_MOUSE_NORM, true); + if (mode & MOUSE_MODE_BTN) + ansi_mouse(ANSI_MOUSE_BTN, true); + if (mode & MOUSE_MODE_ANY) + ansi_mouse(ANSI_MOUSE_ANY, true); + if (mode & MOUSE_MODE_EXT) + ansi_mouse(ANSI_MOUSE_EXT, true); if (mouse_mode != flags) { #if 0 diff --git a/src/sbbs3/js_console.cpp b/src/sbbs3/js_console.cpp index ad46ca51699287af6d37002ce19c37a5e50da198..4b588c2acde2c16143014abdebd58254e89a0264 100644 --- a/src/sbbs3/js_console.cpp +++ b/src/sbbs3/js_console.cpp @@ -799,7 +799,8 @@ js_getstr(JSContext *cx, uintN argc, jsval *arglist) } } - if (!maxlen) maxlen = 128; + if (!maxlen) + maxlen = 128; if ((p = (char *)calloc(1, maxlen + 1)) == NULL) return JS_FALSE; diff --git a/src/sbbs3/js_file.c b/src/sbbs3/js_file.c index cfe98e029cba29009cd329a8af57bb1c5bf29f0f..08117ecf380fa9eb4fc4cda0c900be357f7d2c15 100644 --- a/src/sbbs3/js_file.c +++ b/src/sbbs3/js_file.c @@ -481,7 +481,8 @@ js_read(JSContext *cx, uintN argc, jsval *arglist) if (p->etx) { cp = strchr(buf, p->etx); - if (cp) *cp = 0; + if (cp) + *cp = 0; len = strlen(buf); } @@ -559,7 +560,8 @@ js_readln(JSContext *cx, uintN argc, jsval *arglist) buf[len] = 0; if (p->etx) { cp = strchr(buf, p->etx); - if (cp) *cp = 0; + if (cp) + *cp = 0; } if (p->rot13) rot13(buf); diff --git a/src/sbbs3/js_msg_area.c b/src/sbbs3/js_msg_area.c index 11efee6c89188cb513ead5ca4ff1cc453a453b3a..cbc540ebd4b9d7319b9499cf10b0c3354e6f8435 100644 --- a/src/sbbs3/js_msg_area.c +++ b/src/sbbs3/js_msg_area.c @@ -302,13 +302,16 @@ static JSBool js_sub_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp) *vp = JSVAL_FALSE; break; case SUB_PROP_SCAN_PTR: - if (scan != NULL) *vp = UINT_TO_JSVAL(scan->ptr); + if (scan != NULL) + *vp = UINT_TO_JSVAL(scan->ptr); break; case SUB_PROP_SCAN_CFG: - if (scan != NULL) *vp = UINT_TO_JSVAL(scan->cfg); + if (scan != NULL) + *vp = UINT_TO_JSVAL(scan->cfg); break; case SUB_PROP_LAST_READ: - if (scan != NULL) *vp = UINT_TO_JSVAL(scan->last); + if (scan != NULL) + *vp = UINT_TO_JSVAL(scan->last); break; case SUB_PROP_POSTS: *vp = UINT_TO_JSVAL(getposts(p->cfg, p->subnum)); diff --git a/src/sbbs3/js_msgbase.c b/src/sbbs3/js_msgbase.c index 10c879420e29e216a1530520528852081d29d131..a4d5d4d435d684bb461acb2c745440398de6b693 100644 --- a/src/sbbs3/js_msgbase.c +++ b/src/sbbs3/js_msgbase.c @@ -1375,12 +1375,14 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) /* If we have already enumerated, we're done here... */ if ((p = (privatemsg_t*)JS_GetPrivate(cx, obj)) == NULL || p->enumerated) { - if (name) free(name); + if (name) + free(name); return JS_TRUE; } if ((p->msg).hdr.number == 0) { /* No valid message number/id/offset specified */ - if (name) free(name); + if (name) + free(name); return JS_TRUE; } @@ -1463,7 +1465,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) LAZY_BOOLEAN("is_utf8", smb_msg_is_utf8(&p->msg), JSPROP_ENUMERATE | JSPROP_READONLY); if (name == NULL || strcmp(name, "reply_id") == 0) { - if (name) free(name); + if (name) + free(name); /* Reply-ID (References) */ if ((p->msg).reply_id != NULL) val = (p->msg).reply_id; @@ -1494,7 +1497,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) /* Message-ID */ if (name == NULL || strcmp(name, "id") == 0) { - if (name) free(name); + if (name) + free(name); if (p->expand_fields || (p->msg).id != NULL) { get_msgid(scfg, p->p->smb.subnum, &(p->msg), msg_id, sizeof(msg_id)); val = msg_id; @@ -1527,7 +1531,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) LAZY_STRING_TRUNCSP_NULL("ftn_bbsid", p->msg.ftn_bbsid, JSPROP_ENUMERATE); if (name == NULL || strcmp(name, "field_list") == 0) { - if (name) free(name); + if (name) + free(name); /* Create hdr.field_list[] with repeating header fields (including type and data) */ if ((array = JS_NewArrayObject(cx, 0, NULL)) != NULL) { JS_DefineProperty(cx, obj, "field_list", OBJECT_TO_JSVAL(array) @@ -1578,7 +1583,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) } if (name == NULL || strcmp(name, "can_read") == 0) { - if (name) free(name); + if (name) + free(name); v = BOOLEAN_TO_JSVAL(JS_FALSE); do { @@ -1654,7 +1660,8 @@ static JSBool js_get_msg_header_resolve(JSContext *cx, JSObject *obj, jsid id) if (name) return JS_TRUE; } - if (name) free(name); + if (name) + free(name); /* DO NOT RETURN JS_FALSE on unknown names */ /* Doing so will prevent toString() among others from working. */ diff --git a/src/sbbs3/js_server.c b/src/sbbs3/js_server.c index a7f833e692519ed728ff3c30f2ba35c94591f100..0d6d9e5fa8a7037d7098edea96b0583a2488cef0 100644 --- a/src/sbbs3/js_server.c +++ b/src/sbbs3/js_server.c @@ -183,7 +183,8 @@ static JSBool js_server_resolve(JSContext *cx, JSObject *obj, jsid id) /* interface_ip_address property */ if (name == NULL || strcmp(name, "interface_ip_addr_list") == 0) { - if (name) free(name); + if (name) + free(name); if ((props = (js_server_props_t*)JS_GetPrivate(cx, obj)) == NULL) return JS_FALSE; @@ -208,7 +209,8 @@ static JSBool js_server_resolve(JSContext *cx, JSObject *obj, jsid id) JS_SetElement(cx, newobj, i, &val); } JS_DeepFreezeObject(cx, newobj); - if (name) return JS_TRUE; + if (name) + return JS_TRUE; } ret = js_SyncResolve(cx, obj, name, js_server_properties, NULL, NULL, 0); diff --git a/src/sbbs3/js_system.c b/src/sbbs3/js_system.c index b5b683145f2b3a47b4aa206f2b2ea505e98097fd..42b478d2975898c5c4fd66be70c7c2651c46f5b3 100644 --- a/src/sbbs3/js_system.c +++ b/src/sbbs3/js_system.c @@ -2617,13 +2617,16 @@ static JSBool js_system_resolve(JSContext *cx, JSObject *obj, jsid id) #if defined(_DEBUG) strcat(str, " Debug"); #endif - if (name) free(name); + if (name) + free(name); if ((js_str = JS_NewStringCopyZ(cx, str)) != NULL) { val = STRING_TO_JSVAL(js_str); JS_SetProperty(cx, obj, "full_version", &val); - if (name) return JS_TRUE; + if (name) + return JS_TRUE; } - else if (name) return JS_TRUE; + else if (name) + return JS_TRUE; } LAZY_STRING("version_notice", VERSION_NOTICE); @@ -2650,7 +2653,8 @@ static JSBool js_system_resolve(JSContext *cx, JSObject *obj, jsid id) #ifndef JSDOOR /* fido_addr_list property */ if (name == NULL || strcmp(name, "fido_addr_list") == 0) { - if (name) free(name); + if (name) + free(name); js_system_private_t* sys; if ((sys = (js_system_private_t*)js_GetClassPrivate(cx, obj, &js_system_class)) == NULL) @@ -2670,11 +2674,13 @@ static JSBool js_system_resolve(JSContext *cx, JSObject *obj, jsid id) val = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, smb_faddrtoa(&sys->cfg->faddr[i], str))); JS_SetElement(cx, newobj, i, &val); } - if (name) return JS_TRUE; + if (name) + return JS_TRUE; } if (name == NULL || strcmp(name, "stats") == 0) { - if (name) free(name); + if (name) + free(name); js_system_private_t* sys; if ((sys = (js_system_private_t*)js_GetClassPrivate(cx, obj, &js_system_class)) == NULL) @@ -2691,12 +2697,14 @@ static JSBool js_system_resolve(JSContext *cx, JSObject *obj, jsid id) js_DescribeSyncObject(cx, newobj, "System statistics", 310); js_CreateArrayOfStrings(cx, newobj, "_property_desc_list", sysstat_prop_desc, JSPROP_READONLY); #endif - if (name) return JS_TRUE; + if (name) + return JS_TRUE; } /* node_list property */ if (name == NULL || strcmp(name, "node_list") == 0) { - if (name) free(name); + if (name) + free(name); js_system_private_t* sys; if ((sys = (js_system_private_t*)js_GetClassPrivate(cx, obj, &js_system_class)) == NULL) @@ -2735,12 +2743,14 @@ static JSBool js_system_resolve(JSContext *cx, JSObject *obj, jsid id) if (!JS_SetElement(cx, newobj, i, &val)) return JS_FALSE; } - if (name) return JS_TRUE; + if (name) + return JS_TRUE; } #endif ret = js_SyncResolve(cx, obj, name, js_system_properties, js_system_functions, NULL, 0); - if (name) free(name); + if (name) + free(name); return ret; } diff --git a/src/sbbs3/js_uifc.c b/src/sbbs3/js_uifc.c index a8f9ccfe93aa0acd60e42db8f2e9030bb2ddcef8..cd14ff3ddcd52d4c8273b92a8ff7a2bedd3188b5 100644 --- a/src/sbbs3/js_uifc.c +++ b/src/sbbs3/js_uifc.c @@ -340,11 +340,16 @@ static JSBool js_list_ctx_constructor(JSContext *cx, uintN argc, jsval *arglist) return JS_FALSE; } p->bar = INT_MAX; - if (argc > 0 && JSVAL_IS_NUMBER(argv[0])) p->cur = JSVAL_TO_INT(argv[0]); - if (argc > 1 && JSVAL_IS_NUMBER(argv[1])) p->bar = JSVAL_TO_INT(argv[1]); - if (argc > 2 && JSVAL_IS_NUMBER(argv[2])) p->left = JSVAL_TO_INT(argv[2]); - if (argc > 3 && JSVAL_IS_NUMBER(argv[3])) p->top = JSVAL_TO_INT(argv[3]); - if (argc > 4 && JSVAL_IS_NUMBER(argv[4])) p->width = JSVAL_TO_INT(argv[4]); + if (argc > 0 && JSVAL_IS_NUMBER(argv[0])) + p->cur = JSVAL_TO_INT(argv[0]); + if (argc > 1 && JSVAL_IS_NUMBER(argv[1])) + p->bar = JSVAL_TO_INT(argv[1]); + if (argc > 2 && JSVAL_IS_NUMBER(argv[2])) + p->left = JSVAL_TO_INT(argv[2]); + if (argc > 3 && JSVAL_IS_NUMBER(argv[3])) + p->top = JSVAL_TO_INT(argv[3]); + if (argc > 4 && JSVAL_IS_NUMBER(argv[4])) + p->width = JSVAL_TO_INT(argv[4]); js_SyncResolve(cx, obj, NULL, js_uifc_list_class_properties, NULL, NULL, 0); #ifdef BUILD_JSDOCS js_DescribeSyncObject(cx, obj, "Class used to retain UIFC list menu context", 317); @@ -366,12 +371,18 @@ static JSBool js_showbuf_ctx_constructor(JSContext *cx, uintN argc, jsval *argli } p->height = INT_MAX; p->width = INT_MAX; - if (argc > 0 && JSVAL_IS_NUMBER(argv[0])) p->cur = JSVAL_TO_INT(argv[0]); - if (argc > 1 && JSVAL_IS_NUMBER(argv[1])) p->bar = JSVAL_TO_INT(argv[1]); - if (argc > 2 && JSVAL_IS_NUMBER(argv[2])) p->left = JSVAL_TO_INT(argv[2]); - if (argc > 3 && JSVAL_IS_NUMBER(argv[3])) p->top = JSVAL_TO_INT(argv[3]); - if (argc > 4 && JSVAL_IS_NUMBER(argv[4])) p->width = JSVAL_TO_INT(argv[4]); - if (argc > 5 && JSVAL_IS_NUMBER(argv[5])) p->height = JSVAL_TO_INT(argv[5]); + if (argc > 0 && JSVAL_IS_NUMBER(argv[0])) + p->cur = JSVAL_TO_INT(argv[0]); + if (argc > 1 && JSVAL_IS_NUMBER(argv[1])) + p->bar = JSVAL_TO_INT(argv[1]); + if (argc > 2 && JSVAL_IS_NUMBER(argv[2])) + p->left = JSVAL_TO_INT(argv[2]); + if (argc > 3 && JSVAL_IS_NUMBER(argv[3])) + p->top = JSVAL_TO_INT(argv[3]); + if (argc > 4 && JSVAL_IS_NUMBER(argv[4])) + p->width = JSVAL_TO_INT(argv[4]); + if (argc > 5 && JSVAL_IS_NUMBER(argv[5])) + p->height = JSVAL_TO_INT(argv[5]); if (!JS_SetPrivate(cx, obj, p)) { JS_ReportError(cx, "JS_SetPrivate failed"); return JS_FALSE; diff --git a/src/sbbs3/listfile.cpp b/src/sbbs3/listfile.cpp index f6fd43b0b6aea5360b9ea1e5013168d5463f67d0..d770b2b7c7bad7db7ef6b10ad9da00c3cee56211 100644 --- a/src/sbbs3/listfile.cpp +++ b/src/sbbs3/listfile.cpp @@ -193,7 +193,8 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons d = strlen(cfg.lib[usrlib[i]]->lname) > strlen(cfg.dir[dirnum]->lname) ? strlen(cfg.lib[usrlib[i]]->lname) + 17 : strlen(cfg.dir[dirnum]->lname) + 17; - if (i > 8 || j > 8) d++; + if (i > 8 || j > 8) + d++; attr(cfg.color[clr_filelsthdrbox]); bputs("\xc9\xcd"); /* use to start with \r\n */ for (c = 0; c < d; c++) @@ -331,7 +332,8 @@ int sbbs_t::listfiles(const int dirnum, const char *filespec, FILE* tofile, cons flagprompt = 1; } m = next; - if (mode & FL_FIND) continue; + if (mode & FL_FIND) + continue; if (filespec[0] && !strchr(filespec, '*') && !strchr(filespec, '?') && m) break; } @@ -543,8 +545,10 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total if (str[c] == '*' || strchr(str + c, '.')) { /* filename or spec given */ // f.dir=dirnum; p = strchr(str + c, ' '); - if (!p) p = strchr(str + c, ','); - if (p) *p = 0; + if (!p) + p = strchr(str + c, ','); + if (p) + *p = 0; for (i = 0; i < total; i++) { if (batdn_total() >= cfg.max_batdn) { bprintf(text[BatchDlQueueIsFull], str + c); @@ -595,8 +599,10 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total if (str[c] == '*' || strchr(str + c, '.')) { /* filename or spec given */ // f.dir=dirnum; p = strchr(str + c, ' '); - if (!p) p = strchr(str + c, ','); - if (p) *p = 0; + if (!p) + p = strchr(str + c, ','); + if (p) + *p = 0; for (i = 0; i < total; i++) { if (filematch(bf[i]->name, str + c)) { if (!viewfile(bf[i], ch == 'E')) @@ -674,7 +680,8 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total return 2; if (!md) md = usrdirs[ml] - 1; - else md--; + else + md--; CRLF; } lncntr = 0; @@ -682,8 +689,10 @@ int sbbs_t::batchflagprompt(smb_t* smb, file_t** bf, uint* row, const int total if (str[c] == '*' || strchr(str + c, '.')) { /* filename or spec given */ // f.dir=dirnum; p = strchr(str + c, ' '); - if (!p) p = strchr(str + c, ','); - if (p) *p = 0; + if (!p) + p = strchr(str + c, ','); + if (p) + *p = 0; for (i = 0; i < total; i++) { if (!(bf[i]->hdr.attr & MSG_DELETE) && filematch(bf[i]->name, str + c)) { if (ch == 'R') { @@ -786,7 +795,8 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) f = &file_list[m]; if (mode == FI_REMOVE && dir_op(dirnum)) action = NODE_SYSP; - else action = NODE_LFIL; + else + action = NODE_LFIL; if (msgabort()) { found = -1; break; @@ -946,7 +956,8 @@ int sbbs_t::listfileinfo(const int dirnum, const char *filespec, const int mode) continue; if (!j) j = usrdirs[i] - 1; - else j--; + else + j--; CRLF; movefile(&smb, f, usrdir[i][j]); break; diff --git a/src/sbbs3/logfile.cpp b/src/sbbs3/logfile.cpp index 2b223be82a9ff6fae2529af522cefb6447fabfd8..0a240b45f33dc48fe82d55f1125dee6a6aa20993 100644 --- a/src/sbbs3/logfile.cpp +++ b/src/sbbs3/logfile.cpp @@ -176,7 +176,8 @@ void sbbs_t::logentry(const char *code, const char *entry) /****************************************************************************/ void sbbs_t::log(const char *str) { - if (logfile_fp == NULL || online == ON_LOCAL) return; + if (logfile_fp == NULL || online == ON_LOCAL) + return; if (logcol >= 78 || (logcol > 1 && (78 - logcol) < strlen(str))) { fputs(log_line_ending, logfile_fp); logcol = 1; @@ -209,7 +210,8 @@ void sbbs_t::logline(int level, const char *code, const char *str) { if (strchr(str, '\n') == NULL) // Keep the console log pretty lputs(level, str); - if (logfile_fp == NULL || (online == ON_LOCAL && strcmp(code, "!!"))) return; + if (logfile_fp == NULL || (online == ON_LOCAL && strcmp(code, "!!"))) + return; if (logcol != 1) fputs(log_line_ending, logfile_fp); fprintf(logfile_fp, "%-2.2s %s%s", code, str, log_line_ending); @@ -238,7 +240,8 @@ void sbbs_t::llprintf(int level, const char* code, const char *fmt, ...) void sbbs_t::logch(char ch, bool comma) { - if (logfile_fp == NULL || (online == ON_LOCAL)) return; + if (logfile_fp == NULL || (online == ON_LOCAL)) + return; if ((uchar)ch < ' ') /* Don't log control chars */ return; if (logcol == 1) { diff --git a/src/sbbs3/logout.cpp b/src/sbbs3/logout.cpp index 1e8ea5c7bae237d9242052ca86f28c022bc29940..c5ebc3f7bcf35c633edfb2116c7f07e1ac15c664 100644 --- a/src/sbbs3/logout.cpp +++ b/src/sbbs3/logout.cpp @@ -101,8 +101,10 @@ void sbbs_t::logout(bool logged_in) if (i > cfg.level_timepercall[useron.level]) /* i=amount of time without min */ i = cfg.level_timepercall[useron.level]; j = (int)(now - starttime) / 60; /* j=billable time online in min */ - if (i < 0) i = 0; - if (j < 0) j = 0; + if (i < 0) + i = 0; + if (j < 0) + j = 0; if (useron.min && j > i) { j -= i; /* j=time to deduct from min */ diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index e37bbd5d99197c23e86158d095a1bc726a80d22f..628eb030ecfc387a323588250aa850ce94923426 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -1995,7 +1995,8 @@ static void parse_mail_address(const char* p tp = strchr(p, '>'); } else /* name, then address in brackets */ tp = strchr(p, '<'); - if (tp) *tp = 0; + if (tp) + *tp = 0; sprintf(name, "%.*s", (int)name_len, p); truncsp(name); strip_char(name, name, '\\'); @@ -4054,7 +4055,8 @@ static bool smtp_client_thread(smtp_t* smtp) } if (state == SMTP_STATE_DATA_BODY) { p = buf; - if (*p == '.') p++; /* Transparency (RFC821 4.5.2) */ + if (*p == '.') + p++; /* Transparency (RFC821 4.5.2) */ if (strlen(p) > RFC822_MAX_LINE_LEN) { lprintf(LOG_NOTICE, "%04d %s %s !%s sent an ILLEGALLY-LONG body line (%d chars > %d): '%s'" , socket, client.protocol, client_id, reverse_path, (int)strlen(p), RFC822_MAX_LINE_LEN, p); @@ -4850,7 +4852,8 @@ static bool smtp_client_thread(smtp_t* smtp) /* convert "user.name" to "user name" */ SAFECOPY(rcpt_name, p); for (tp = rcpt_name; *tp; tp++) - if (*tp == '.') *tp = ' '; + if (*tp == '.') + *tp = ' '; if (!stricmp(p, scfg.sys_op) || !stricmp(rcpt_name, scfg.sys_op)) usernum = 1; /* RX by "sysop.alias" */ @@ -6125,17 +6128,28 @@ void mail_server(void* arg) protected_uint32_init(&active_clients, 0); /* Setup intelligent defaults */ - if (startup->relay_port == 0) startup->relay_port = IPPORT_SMTP; - if (startup->submission_port == 0) startup->submission_port = IPPORT_SUBMISSION; - if (startup->submissions_port == 0) startup->submissions_port = IPPORT_SUBMISSIONS; - if (startup->smtp_port == 0) startup->smtp_port = IPPORT_SMTP; - if (startup->pop3_port == 0) startup->pop3_port = IPPORT_POP3; - if (startup->pop3s_port == 0) startup->pop3s_port = IPPORT_POP3S; - if (startup->rescan_frequency == 0) startup->rescan_frequency = MAIL_DEFAULT_RESCAN_FREQUENCY; - if (startup->max_delivery_attempts == 0) startup->max_delivery_attempts = MAIL_DEFAULT_MAX_DELIVERY_ATTEMPTS; - if (startup->max_inactivity == 0) startup->max_inactivity = MAIL_DEFAULT_MAX_INACTIVITY; /* seconds */ - if (startup->sem_chk_freq == 0) startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; - if (startup->js.max_bytes == 0) startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; + if (startup->relay_port == 0) + startup->relay_port = IPPORT_SMTP; + if (startup->submission_port == 0) + startup->submission_port = IPPORT_SUBMISSION; + if (startup->submissions_port == 0) + startup->submissions_port = IPPORT_SUBMISSIONS; + if (startup->smtp_port == 0) + startup->smtp_port = IPPORT_SMTP; + if (startup->pop3_port == 0) + startup->pop3_port = IPPORT_POP3; + if (startup->pop3s_port == 0) + startup->pop3s_port = IPPORT_POP3S; + if (startup->rescan_frequency == 0) + startup->rescan_frequency = MAIL_DEFAULT_RESCAN_FREQUENCY; + if (startup->max_delivery_attempts == 0) + startup->max_delivery_attempts = MAIL_DEFAULT_MAX_DELIVERY_ATTEMPTS; + if (startup->max_inactivity == 0) + startup->max_inactivity = MAIL_DEFAULT_MAX_INACTIVITY; /* seconds */ + if (startup->sem_chk_freq == 0) + startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; + if (startup->js.max_bytes == 0) + startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; (void)protected_uint32_adjust(&thread_count, 1); thread_up(FALSE /* setuid */); diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp index 105de56a28dae1a4f3e2b4f10a24a57678f70a66..d6b78bbab6c7045b1e88b3a9f55f6b33c08436dc 100644 --- a/src/sbbs3/main.cpp +++ b/src/sbbs3/main.cpp @@ -1373,7 +1373,8 @@ JSContext* sbbs_t::js_init(JSRuntime** runtime, JSObject** glob, const char* des { JSContext* js_cx; - if (startup->js.max_bytes == 0) startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; + if (startup->js.max_bytes == 0) + startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; lprintf(LOG_DEBUG, "JavaScript: Creating %s runtime: %u bytes" , desc, startup->js.max_bytes); @@ -3722,7 +3723,8 @@ bool sbbs_t::init() for (j = k = 0; j < cfg.total_subs; j++) if (cfg.sub[j]->grp == i) k++; /* k = number of subs per grp[i] */ - if (k > l) l = k; /* l = the largest number of subs per grp */ + if (k > l) + l = k; /* l = the largest number of subs per grp */ } if (l) for (i = 0; i < cfg.total_grps; i++) @@ -3760,7 +3762,8 @@ bool sbbs_t::init() for (j = k = 0; j < cfg.total_dirs; j++) if (cfg.dir[j]->lib == i) k++; - if (k > l) l = k; /* l = largest number of dirs in a lib */ + if (k > l) + l = k; /* l = largest number of dirs in a lib */ } if (l) { l++; /* for temp dir */ @@ -3947,8 +3950,10 @@ int sbbs_t::nopen(char *str, int access) share = SH_DENYNO; access &= ~O_DENYNONE; } - else if (access == O_RDONLY) share = SH_DENYWR; - else share = SH_DENYRW; + else if (access == O_RDONLY) + share = SH_DENYWR; + else + share = SH_DENYRW; if (!(access & O_TEXT)) access |= O_BINARY; while (((file = sopen(str, access, share, DEFFILEMODE)) == -1) @@ -4976,14 +4981,20 @@ void bbs_thread(void* arg) do { /* Setup intelligent defaults */ - if (startup->telnet_port == 0) startup->telnet_port = IPPORT_TELNET; - if (startup->rlogin_port == 0) startup->rlogin_port = 513; + if (startup->telnet_port == 0) + startup->telnet_port = IPPORT_TELNET; + if (startup->rlogin_port == 0) + startup->rlogin_port = 513; #ifdef USE_CRYPTLIB - if (startup->ssh_port == 0) startup->ssh_port = 22; + if (startup->ssh_port == 0) + startup->ssh_port = 22; #endif - if (startup->outbuf_drain_timeout == 0) startup->outbuf_drain_timeout = 10; - if (startup->sem_chk_freq == 0) startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; - if (startup->temp_dir[0]) backslash(startup->temp_dir); + if (startup->outbuf_drain_timeout == 0) + startup->outbuf_drain_timeout = 10; + if (startup->sem_chk_freq == 0) + startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; + if (startup->temp_dir[0]) + backslash(startup->temp_dir); protected_uint32_init(&node_threads_running, 0); protected_uint32_init(&ssh_sessions, 0); diff --git a/src/sbbs3/msg_id.c b/src/sbbs3/msg_id.c index 2b236e5ee467516393c1f921a605a5fb8b866d30..677756ff2ce0dda0659c31cd32d04cdb1884ed89 100644 --- a/src/sbbs3/msg_id.c +++ b/src/sbbs3/msg_id.c @@ -42,7 +42,8 @@ uint32_t get_new_msg_number(smb_t* smb) if (smb_getstatus(smb) != SMB_SUCCESS) return 0; - if (!locked) smb_unlocksmbhdr(smb); + if (!locked) + smb_unlocksmbhdr(smb); return smb->status.last_msg + 1; } diff --git a/src/sbbs3/msgdate.c b/src/sbbs3/msgdate.c index ead475100ce922629291e3d0daffdc917f41bd72..6277527d4e9b82dbf2142993c0f033185bfce12a 100644 --- a/src/sbbs3/msgdate.c +++ b/src/sbbs3/msgdate.c @@ -117,18 +117,21 @@ when_t rfc822date(char* date) tm.tm_hour = atoi(p); while (*p && IS_DIGIT(*p)) p++; /* MINUTE */ - if (*p) p++; + if (*p) + p++; tm.tm_min = atoi(p); while (*p && IS_DIGIT(*p)) p++; /* SECONDS */ - if (*p) p++; + if (*p) + p++; tm.tm_sec = atoi(p); while (*p && IS_DIGIT(*p)) p++; /* TIME ZONE */ while (*p && *p <= ' ') p++; if (*p) { if (IS_DIGIT(*p) || *p == '-' || *p == '+') { /* [+|-]HHMM format */ - if (*p == '+') p++; + if (*p == '+') + p++; sprintf(str, "%.*s", *p == '-'? 3:2, p); zone = atoi(str) * 60; p += (*p == '-') ? 3:2; diff --git a/src/sbbs3/msgtoqwk.cpp b/src/sbbs3/msgtoqwk.cpp index c92f6bdb2d374f611d8ba27fafcbe58f82c5d174..da3dd35b7a332f4291931af51cb7e09cdd067022 100644 --- a/src/sbbs3/msgtoqwk.cpp +++ b/src/sbbs3/msgtoqwk.cpp @@ -505,8 +505,10 @@ int sbbs_t::msgtoqwk(smbmsg_t* msg, FILE *qwk_fp, int mode, smb_t* smb SAFEPRINTF(str, "\1n---%c", qwk_newline); /* so add one */ else SAFECOPY(str, "\1n"); - if (cfg.sub[subnum]->misc & SUB_ASCII) ch = '*'; - else ch = CP437_BLACK_SQUARE; + if (cfg.sub[subnum]->misc & SUB_ASCII) + ch = '*'; + else + ch = CP437_BLACK_SQUARE; safe_snprintf(tmp, sizeof(tmp), " %c \1g%.10s\1n %c %.127s%c" , ch, VERSION_NOTICE, ch, cfg.sub[subnum]->tagline, qwk_newline); char* tail = tmp; diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp index c4ccf1bbce380a760ef4ec8bf1ab948eac9d5cb0..d904f68189fceddb0b7c8183591d0987bdd32f42 100644 --- a/src/sbbs3/netmail.cpp +++ b/src/sbbs3/netmail.cpp @@ -186,10 +186,14 @@ bool sbbs_t::netmail(const char *into, const char *title, int mode, smb_t* resmb smb_faddrtoa(&cfg.faddr[i], str); bprintf(text[NetMailing], to, smb_faddrtoa(&dest_addr, tmp), from, str); - if (cfg.netmail_misc & NMAIL_CRASH) msg.hdr.netattr |= NETMSG_CRASH; - if (cfg.netmail_misc & NMAIL_HOLD) msg.hdr.netattr |= NETMSG_HOLD; - if (cfg.netmail_misc & NMAIL_KILL) msg.hdr.netattr |= NETMSG_KILLSENT; - if (mode & WM_FILE) msg.hdr.auxattr |= (MSG_FILEATTACH | MSG_KILLFILE); + if (cfg.netmail_misc & NMAIL_CRASH) + msg.hdr.netattr |= NETMSG_CRASH; + if (cfg.netmail_misc & NMAIL_HOLD) + msg.hdr.netattr |= NETMSG_HOLD; + if (cfg.netmail_misc & NMAIL_KILL) + msg.hdr.netattr |= NETMSG_KILLSENT; + if (mode & WM_FILE) + msg.hdr.auxattr |= (MSG_FILEATTACH | MSG_KILLFILE); if (remsg != NULL && resmb != NULL && !(mode & WM_QUOTE)) { if (quotemsg(resmb, remsg, /* include tails: */ true)) @@ -440,7 +444,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) SAFECOPY(name, to); p = strchr(name, '@'); - if (p) *p = 0; + if (p) + *p = 0; truncsp(name); @@ -493,7 +498,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) if (!strncmp(qwkbuf + l, "@VIA:", 5)) { snprintf(str, sizeof str, "%.128s", qwkbuf + l + 5); cp = strchr(str, QWK_NEWLINE); - if (cp) *cp = 0; + if (cp) + *cp = 0; l += strlen(str) + 1; cp = str; while (*cp && *cp <= ' ') cp++; @@ -524,7 +530,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) if (!strncmp(qwkbuf + l, "@TZ:", 4)) { snprintf(str, sizeof str, "%.128s", qwkbuf + l); cp = strchr(str, QWK_NEWLINE); - if (cp) *cp = 0; + if (cp) + *cp = 0; l += strlen(str) + 1; cp = str + 4; while (*cp && *cp <= ' ') cp++; @@ -534,7 +541,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) msg.hdr.when_written.zone = sys_timezone(&cfg); memset(&tm, 0, sizeof(tm)); tm.tm_mon = ((qwkbuf[8] & 0xf) * 10) + (qwkbuf[9] & 0xf); - if (tm.tm_mon) tm.tm_mon--; /* 0 based */ + if (tm.tm_mon) + tm.tm_mon--; /* 0 based */ tm.tm_mday = ((qwkbuf[11] & 0xf) * 10) + (qwkbuf[12] & 0xf); tm.tm_year = ((qwkbuf[14] & 0xf) * 10) + (qwkbuf[15] & 0xf); if (tm.tm_year < Y2K_2DIGIT_WINDOW) @@ -805,7 +813,8 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) smb_faddrtoa(&cfg.faddr[i], str); bprintf(text[NetMailing], hdr.to, smb_faddrtoa(&fidoaddr, tmp), hdr.from, str); tm.tm_mon = ((qwkbuf[8] & 0xf) * 10) + (qwkbuf[9] & 0xf); - if (tm.tm_mon) tm.tm_mon--; + if (tm.tm_mon) + tm.tm_mon--; tm.tm_mday = ((qwkbuf[11] & 0xf) * 10) + (qwkbuf[12] & 0xf); tm.tm_year = ((qwkbuf[14] & 0xf) * 10) + (qwkbuf[15] & 0xf) + 1900; tm.tm_hour = ((qwkbuf[16] & 0xf) * 10) + (qwkbuf[17] & 0xf); @@ -816,9 +825,12 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) , tm.tm_hour, tm.tm_min, tm.tm_sec); hdr.attr = (FIDO_LOCAL | FIDO_PRIVATE); - if (cfg.netmail_misc & NMAIL_CRASH) hdr.attr |= FIDO_CRASH; - if (cfg.netmail_misc & NMAIL_HOLD) hdr.attr |= FIDO_HOLD; - if (cfg.netmail_misc & NMAIL_KILL) hdr.attr |= FIDO_KILLSENT; + if (cfg.netmail_misc & NMAIL_CRASH) + hdr.attr |= FIDO_CRASH; + if (cfg.netmail_misc & NMAIL_HOLD) + hdr.attr |= FIDO_HOLD; + if (cfg.netmail_misc & NMAIL_KILL) + hdr.attr |= FIDO_KILLSENT; snprintf(str, sizeof str, "%.25s", block + 71); /* Title */ truncsp(str); @@ -826,28 +838,32 @@ void sbbs_t::qwktonetmail(FILE *rep, char *block, char *into, uchar fromhub) if ((SYSOP || useron.exempt & FLAG('F')) && !strnicmp(p, "CR:", 3)) { /* Crash over-ride by sysop */ p += 3; /* skip CR: */ - if (*p == ' ') p++; /* skip extra space if it exists */ + if (*p == ' ') + p++; /* skip extra space if it exists */ hdr.attr |= FIDO_CRASH; } if ((SYSOP || useron.exempt & FLAG('F')) && !strnicmp(p, "FR:", 3)) { /* File request */ p += 3; /* skip FR: */ - if (*p == ' ') p++; + if (*p == ' ') + p++; hdr.attr |= FIDO_FREQ; } if ((SYSOP || useron.exempt & FLAG('F')) && !strnicmp(p, "RR:", 3)) { /* Return receipt request */ p += 3; /* skip RR: */ - if (*p == ' ') p++; + if (*p == ' ') + p++; hdr.attr |= FIDO_RRREQ; } if ((SYSOP || useron.exempt & FLAG('F')) && !strnicmp(p, "FA:", 3)) { /* File attachment */ p += 3; /* skip FA: */ - if (*p == ' ') p++; + if (*p == ' ') + p++; hdr.attr |= FIDO_FILE; } diff --git a/src/sbbs3/newuser.cpp b/src/sbbs3/newuser.cpp index dab9db1df028696be309ee0b2df636388a72a01e..5f41e294ac449d3dcc93c5f88e6041011b4143a9 100644 --- a/src/sbbs3/newuser.cpp +++ b/src/sbbs3/newuser.cpp @@ -180,7 +180,8 @@ bool sbbs_t::newuser() } break; } - if (!online) return false; + if (!online) + return false; if ((cfg.uq & UQ_ALIASES) && (cfg.uq & UQ_REALNAME)) { while (online && text[EnterYourRealName][0]) { bputs(text[EnterYourRealName]); @@ -208,7 +209,8 @@ bool sbbs_t::newuser() SAFECOPY(useron.name, useron.alias); else if (!(cfg.uq & UQ_DUPREAL) && finduserstr(useron.number, USER_NAME, useron.name) > 0) useron.rest |= FLAG('O'); // Can't post or send netmail using real name (it's a duplicate) - if (!online) return false; + if (!online) + return false; if (!useron.handle[0]) SAFECOPY(useron.handle, useron.alias); while ((cfg.uq & UQ_HANDLE) && online && text[EnterYourHandle][0]) { @@ -225,14 +227,16 @@ bool sbbs_t::newuser() if (text[ContinueQ][0] && !yesno(text[ContinueQ])) return false; } - if (!online) return false; + if (!online) + return false; if (cfg.uq & UQ_ADDRESS) while (online && text[EnterYourAddress][0]) { /* Get address and zip code */ bputs(text[EnterYourAddress]); if (getstr(useron.address, LEN_ADDRESS, kmode)) break; } - if (!online) return false; + if (!online) + return false; while ((cfg.uq & UQ_LOCATION) && online && text[EnterYourCityState][0]) { bputs(text[EnterYourCityState]); if (getstr(useron.location, LEN_LOCATION, kmode) < 1) @@ -250,7 +254,8 @@ bool sbbs_t::newuser() , K_UPPER | (cfg.uq & UQ_NOEXASC) | K_EDIT | K_AUTODEL | K_TRIM)) break; } - if (!online) return false; + if (!online) + return false; if ((cfg.uq & UQ_PHONE) && text[EnterYourPhoneNumber][0]) { if (text[CallingFromNorthAmericaQ][0]) usa = yesno(text[CallingFromNorthAmericaQ]); @@ -272,7 +277,8 @@ bool sbbs_t::newuser() break; } } - if (!online) return false; + if (!online) + return false; while ((cfg.uq & UQ_SEX) && text[EnterYourGender][0] && cfg.new_genders[0] != '\0' && online) { bputs(text[EnterYourGender]); long gender = getkeys(cfg.new_genders, 0); @@ -292,7 +298,8 @@ bool sbbs_t::newuser() break; } } - if (!online) return false; + if (!online) + return false; while (!(cfg.uq & UQ_NONETMAIL) && online && text[EnterNetMailAddress][0]) { bputs(text[EnterNetMailAddress]); if (getstr(useron.netmail, LEN_NETMAIL, K_EDIT | K_AUTODEL | K_LINE | K_TRIM) < 1 @@ -309,10 +316,12 @@ bool sbbs_t::newuser() if (text[UserInfoCorrectQ][0] == 0 || yesno(text[UserInfoCorrectQ])) break; } - if (!online) return false; + if (!online) + return false; SAFEPRINTF(str, "New user: %s", useron.alias); logline("N", str); - if (!online) return false; + if (!online) + return false; menu("../sbbs", P_NOABORT | P_NOERROR); menu("../system", P_NOABORT | P_NOERROR); menu("../newuser", P_NOABORT | P_NOERROR); @@ -379,7 +388,8 @@ bool sbbs_t::newuser() str[0] = 0; getstr(str, LEN_PASS * 2, K_UPPER); console &= ~(CON_R_ECHOX | CON_L_ECHOX); - if (!strcmp(str, useron.pass)) break; + if (!strcmp(str, useron.pass)) + break; if (cfg.sys_misc & SM_ECHO_PW) SAFEPRINTF2(tmp, "FAILED Password verification: '%s' instead of '%s'" , str @@ -396,7 +406,8 @@ bool sbbs_t::newuser() } } - if (!online) return false; + if (!online) + return false; if (cfg.new_magic[0] && text[MagicWordPrompt][0]) { bputs(text[MagicWordPrompt]); str[0] = 0; @@ -407,7 +418,8 @@ bool sbbs_t::newuser() logline("N!", tmp); hangup(); } - if (!online) return false; + if (!online) + return false; } bputs(text[CheckingSlots]); diff --git a/src/sbbs3/node.c b/src/sbbs3/node.c index 1480b3f52109dd3cc8927ec5ba74836d15cfede8..71067b1de80237950d4353555536391d5878a459 100644 --- a/src/sbbs3/node.c +++ b/src/sbbs3/node.c @@ -406,7 +406,8 @@ void printnodedat(int number, node_t node) else { if ((node.aux / 60) == 0) /* 12 midnite */ hour = 12; - else hour = node.aux / 60; + else + hour = node.aux / 60; SAFECOPY(mer, "am"); } printf(" ETA %02d:%02d %s" @@ -608,7 +609,8 @@ int main(int argc, char **argv) mode = MODE_EXTAUX; value = strtoul(argv[i] + 7, NULL, 0); } - else usage(); + else + usage(); } if (mode < 0) usage(); diff --git a/src/sbbs3/pack_qwk.cpp b/src/sbbs3/pack_qwk.cpp index e3604726e51584e09c3344df968a8b356ff134b2..e9ae69717423cc44a1a6ec59e181e4cb44852ee9 100644 --- a/src/sbbs3/pack_qwk.cpp +++ b/src/sbbs3/pack_qwk.cpp @@ -105,7 +105,8 @@ bool sbbs_t::pack_qwk(char *packet, uint *msgcnt, bool prepack) mode = QM_EXPCTLA; else if (useron.qwk & QWK_RETCTLA) mode = QM_RETCTLA; - else mode = 0; + else + mode = 0; if (useron.qwk & QWK_TZ) mode |= QM_TZ; if (useron.qwk & QWK_VIA) diff --git a/src/sbbs3/pack_rep.cpp b/src/sbbs3/pack_rep.cpp index 7216a6d5c31e3d1712512a6e79337e749131468d..d54fa76a3bf508732f9a16739d40fd6d15daa05a 100644 --- a/src/sbbs3/pack_rep.cpp +++ b/src/sbbs3/pack_rep.cpp @@ -157,7 +157,8 @@ bool sbbs_t::pack_rep(uint hubnum) mode = QM_TO_QNET | QM_REP; mode |= (cfg.qhub[hubnum]->misc & (QHUB_EXT | QHUB_CTRL_A | QHUB_UTF8)); /* For an unclear reason, kludge lines (including @VIA and @TZ) were not included in NetMail previously */ - if (!(cfg.qhub[hubnum]->misc & QHUB_NOHEADERS)) mode |= (QM_VIA | QM_TZ | QM_MSGID | QM_REPLYTO); + if (!(cfg.qhub[hubnum]->misc & QHUB_NOHEADERS)) + mode |= (QM_VIA | QM_TZ | QM_MSGID | QM_REPLYTO); if (msgtoqwk(&msg, rep, mode, &smb, /* confnum: */ 0, hdrs) > 0) packedmail++; smb_unlockmsghdr(&smb, &msg); @@ -230,7 +231,8 @@ bool sbbs_t::pack_rep(uint hubnum) mode = cfg.qhub[hubnum]->mode[i] | QM_TO_QNET | QM_REP; mode |= (cfg.qhub[hubnum]->misc & (QHUB_EXT | QHUB_CTRL_A | QHUB_UTF8)); - if (!(cfg.qhub[hubnum]->misc & QHUB_NOHEADERS)) mode |= (QM_VIA | QM_TZ | QM_MSGID | QM_REPLYTO); + if (!(cfg.qhub[hubnum]->misc & QHUB_NOHEADERS)) + mode |= (QM_VIA | QM_TZ | QM_MSGID | QM_REPLYTO); if (msg.from_net.type != NET_QWK) mode |= QM_TAGLINE; diff --git a/src/sbbs3/prntfile.cpp b/src/sbbs3/prntfile.cpp index bb5e99b8db5d7b25fb65d27f9587459b82c9c593..93d339a4ff48dd08e31a34fd09f09cacaddfd274 100644 --- a/src/sbbs3/prntfile.cpp +++ b/src/sbbs3/prntfile.cpp @@ -72,7 +72,8 @@ bool sbbs_t::printfile(const char* fname, int mode, int org_cols, JSObject* obj) lprintf(LOG_NOTICE, "!Error %d (%s) opening: %s" , errno, strerror(errno), fpath); bputs(text[FileNotFound]); - if (SYSOP) bputs(fpath); + if (SYSOP) + bputs(fpath); CRLF; } return false; @@ -193,7 +194,8 @@ bool sbbs_t::printtail(const char* fname, int lines, int mode, int org_cols, JSO lprintf(LOG_NOTICE, "!Error %d (%s) opening: %s" , errno, strerror(errno), fpath); bputs(text[FileNotFound]); - if (SYSOP) bputs(fpath); + if (SYSOP) + bputs(fpath); CRLF; } return false; @@ -226,7 +228,8 @@ bool sbbs_t::printtail(const char* fname, int lines, int mode, int org_cols, JSO else { buf[l] = 0; p = (buf + l) - 1; - if (*p == LF) p--; + if (*p == LF) + p--; while (*p && p > buf) { if (*p == LF) cur++; diff --git a/src/sbbs3/qwk.cpp b/src/sbbs3/qwk.cpp index 2151ceed1d8dfb6fbebd80c95b729235cf5a48f2..2d99072226df84aba4f13a3cc1bb1e14db0fd12c 100644 --- a/src/sbbs3/qwk.cpp +++ b/src/sbbs3/qwk.cpp @@ -56,7 +56,8 @@ bool route_circ(char *via, char *id) SKIP_WHITESPACE(p); while (*p) { sp = strchr(p, '/'); - if (sp) *sp = 0; + if (sp) + *sp = 0; if (!stricmp(p, id)) return true; if (!sp) @@ -75,8 +76,10 @@ extern "C" int qwk_route(scfg_t* cfg, const char *inaddr, char *fulladdr, size_t fulladdr[0] = 0; SAFECOPY(str, inaddr); p = strrchr(str, '/'); - if (p) p++; - else p = str; + if (p) + p++; + else + p = str; SAFECOPY(node, p); /* node = destination node */ truncsp(node); @@ -99,7 +102,8 @@ extern "C" int qwk_route(scfg_t* cfg, const char *inaddr, char *fulladdr, size_t SAFECOPY(node, inaddr); /* node = next hop */ p = strchr(node, '/'); - if (p) *p = 0; + if (p) + *p = 0; truncsp(node); if (strchr(inaddr, '/')) { /* Multiple hops */ @@ -122,7 +126,8 @@ extern "C" int qwk_route(scfg_t* cfg, const char *inaddr, char *fulladdr, size_t } p = strchr(node, ' '); - if (p) *p = 0; + if (p) + *p = 0; if (strlen(node) > LEN_QWKID) return 0; @@ -150,7 +155,8 @@ extern "C" int qwk_route(scfg_t* cfg, const char *inaddr, char *fulladdr, size_t SAFECOPY(node, fulladdr); p = strchr(node, '/'); - if (p) *p = 0; + if (p) + *p = 0; truncsp(node); for (i = 0; i < cfg->total_qhubs; i++) /* Check if first hop is our hub */ @@ -206,11 +212,13 @@ void sbbs_t::update_qwkroute(char *via) truncsp(str); t = dstrtounix(MMDDYY, str); p = strchr(str, ':'); - if (!p) continue; + if (!p) + continue; *p = 0; snprintf(node, sizeof node, "%.8s", str + 9); tp = strchr(node, ' '); /* change "node bbs:" to "node:" */ - if (tp) *tp = 0; + if (tp) + *tp = 0; for (i = 0; i < total_qwknodes; i++) if (!stricmp(qwknode[i].id, node)) break; @@ -241,9 +249,11 @@ void sbbs_t::update_qwkroute(char *via) p++; snprintf(node, sizeof node, "%.8s", p); tp = strchr(node, '/'); - if (tp) *tp = 0; + if (tp) + *tp = 0; tp = strchr(node, ' '); /* no spaces allowed */ - if (tp) *tp = 0; + if (tp) + *tp = 0; truncsp(node); for (i = 0; i < total_qwknodes; i++) if (!stricmp(qwknode[i].id, node)) @@ -1152,7 +1162,8 @@ bool sbbs_t::qwk_vote(str_list_t ini, const char* section, smb_net_type_t net_ty errormsg(WHERE, ERR_WRITE, smb.file, result, smb.last_error); } } - else result = SMB_SUCCESS; + else + result = SMB_SUCCESS; smb_close(&smb); smb_freemsgmem(&msg); diff --git a/src/sbbs3/qwknodes.c b/src/sbbs3/qwknodes.c index e56b712f089abc43bf619140216f89aab7bb62fe..6d67f4aec60cfc9876e2c73b01fa6960cba1f1a6 100644 --- a/src/sbbs3/qwknodes.c +++ b/src/sbbs3/qwknodes.c @@ -121,8 +121,10 @@ void gettag(smbmsg_t* msg, char *tag) truncsp(buf); stripctrla(buf); p = strrchr(buf, LF); - if (!p) p = buf; - else p++; + if (!p) + p = buf; + else + p++; if (!strnicmp(p, " � Synchronet � ", 16)) p += 16; if (!strnicmp(p, " * Synchronet * ", 16)) diff --git a/src/sbbs3/qwktomsg.cpp b/src/sbbs3/qwktomsg.cpp index 2c5298f5e642186e1e3dfa4a70e4a47950f58a07..6fc3ef04973c864e8208b74546ce03a4bf91ac59 100644 --- a/src/sbbs3/qwktomsg.cpp +++ b/src/sbbs3/qwktomsg.cpp @@ -374,8 +374,10 @@ bool sbbs_t::qwk_import_msg(FILE *qwk_fp, char *hdrblk, uint blocks if (qwkbuf[k] != CTRL_A && lastch != CTRL_A) col++; if (lastch == CTRL_A && !valid_ctrl_a_attr(qwkbuf[k])) { - if (taillen) taillen--; - else bodylen--; + if (taillen) + taillen--; + else + bodylen--; lastch = 0; continue; } diff --git a/src/sbbs3/readmail.cpp b/src/sbbs3/readmail.cpp index f72f9cbf8e7d1cc73c28ce3cba7730626a799e20..dadd798aaed058e6d310c60ab3b31064a8dbcf53 100644 --- a/src/sbbs3/readmail.cpp +++ b/src/sbbs3/readmail.cpp @@ -23,16 +23,26 @@ static char mail_listing_flag(smbmsg_t* msg) { - if (msg->hdr.attr & MSG_DELETE) return '-'; - if (msg->hdr.attr & MSG_SPAM) return 'S'; - if (msg->hdr.attr & MSG_REPLIED) return 'R'; - if (msg->hdr.attr & MSG_READ) return ' '; - if (msg->hdr.attr & MSG_PERMANENT) return 'p'; - if (msg->hdr.attr & MSG_LOCKED) return 'L'; - if (msg->hdr.attr & MSG_KILLREAD) return 'K'; - if (msg->hdr.attr & MSG_NOREPLY) return '#'; - if (msg->from_net.type || msg->to_net.type) return 'N'; - if (msg->hdr.attr & MSG_ANONYMOUS) return 'A'; + if (msg->hdr.attr & MSG_DELETE) + return '-'; + if (msg->hdr.attr & MSG_SPAM) + return 'S'; + if (msg->hdr.attr & MSG_REPLIED) + return 'R'; + if (msg->hdr.attr & MSG_READ) + return ' '; + if (msg->hdr.attr & MSG_PERMANENT) + return 'p'; + if (msg->hdr.attr & MSG_LOCKED) + return 'L'; + if (msg->hdr.attr & MSG_KILLREAD) + return 'K'; + if (msg->hdr.attr & MSG_NOREPLY) + return '#'; + if (msg->from_net.type || msg->to_net.type) + return 'N'; + if (msg->hdr.attr & MSG_ANONYMOUS) + return 'A'; return '*'; } @@ -288,7 +298,8 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) } } } - else domsg = 1; + else + domsg = 1; sync(); if (which == MAIL_SENT) @@ -398,8 +409,10 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) } if (msg.hdr.attr & MSG_DELETE || noyes(str2)) { - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; break; } /* Case 'D': must follow! */ @@ -424,8 +437,10 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) } smb_unlocksmbhdr(&smb); } - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; break; case 'K': /* Kill All Mail */ { @@ -452,8 +467,10 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) if (!forwardmsg(&smb, &msg, str)) break; domsg = 1; - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; if (msg.hdr.attr & (MSG_PERMANENT | MSG_DELETE)) break; SAFEPRINTF(str2, text[DeleteMailQ], msghdr_field(&msg, msg.from)); @@ -647,14 +664,17 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) // fall-through case 0: case '+': - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; break; case TERM_KEY_LEFT: newline(); // fall-through case '-': - if (smb.curmsg > 0) smb.curmsg--; + if (smb.curmsg > 0) + smb.curmsg--; break; case 'S': domsg = 0; @@ -679,7 +699,8 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) case 'T': domsg = 0; u = smb.curmsg; - if (u) u++; + if (u) + u++; v = u + 10; if (v > smb.msgs) v = smb.msgs; @@ -790,7 +811,8 @@ int sbbs_t::readmail(uint usernumber, int which, int lm_mode) domsg = false; } else { purgeuser(msg.idx.from); - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; } break; case '/': diff --git a/src/sbbs3/readmsgs.cpp b/src/sbbs3/readmsgs.cpp index f5703fbf05d8b2adeff2aa3cab8040dd7191f0a3..d2215d20f72b3c785f0ce245ccaf67ff21a2e926 100644 --- a/src/sbbs3/readmsgs.cpp +++ b/src/sbbs3/readmsgs.cpp @@ -36,20 +36,33 @@ bool sbbs_t::can_view_deleted_msgs(int subnum) uchar sbbs_t::msg_listing_flag(int subnum, smbmsg_t* msg, post_t* post) { - if (msg->hdr.attr & MSG_DELETE) return '-'; + if (msg->hdr.attr & MSG_DELETE) + return '-'; if ((stricmp(msg->to, useron.alias) == 0 || stricmp(msg->to, useron.name) == 0) - && !(msg->hdr.attr & MSG_READ)) return '!'; - if (msg->hdr.attr & MSG_PERMANENT) return 'p'; - if (msg->hdr.attr & MSG_LOCKED) return 'L'; - if (msg->hdr.attr & MSG_KILLREAD) return 'K'; - if (msg->hdr.attr & MSG_NOREPLY) return '#'; - if (msg->hdr.number > subscan[subnum].ptr) return '*'; - if (msg->hdr.attr & MSG_PRIVATE) return 'P'; - if (msg->hdr.attr & MSG_POLL) return '?'; - if (post->upvotes > post->downvotes) return 251; - if (post->upvotes || post->downvotes) return 'v'; - if (msg->hdr.attr & MSG_REPLIED) return 'R'; - if (sub_op(subnum) && msg->hdr.attr & MSG_ANONYMOUS) return 'A'; + && !(msg->hdr.attr & MSG_READ)) + return '!'; + if (msg->hdr.attr & MSG_PERMANENT) + return 'p'; + if (msg->hdr.attr & MSG_LOCKED) + return 'L'; + if (msg->hdr.attr & MSG_KILLREAD) + return 'K'; + if (msg->hdr.attr & MSG_NOREPLY) + return '#'; + if (msg->hdr.number > subscan[subnum].ptr) + return '*'; + if (msg->hdr.attr & MSG_PRIVATE) + return 'P'; + if (msg->hdr.attr & MSG_POLL) + return '?'; + if (post->upvotes > post->downvotes) + return 251; + if (post->upvotes || post->downvotes) + return 'v'; + if (msg->hdr.attr & MSG_REPLIED) + return 'R'; + if (sub_op(subnum) && msg->hdr.attr & MSG_ANONYMOUS) + return 'A'; return ' '; } @@ -757,10 +770,13 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) } } } - else domsg = 1; + else + domsg = 1; if (mode & SCAN_CONT) { - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; continue; } sync(); @@ -840,8 +856,10 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) return 0; case 'C': /* Continuous */ mode |= SCAN_CONT; - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; break; case 'D': /* Delete message on sub-board */ if (!(msg.hdr.attr & MSG_DELETE) && msg.hdr.type == SMB_MSG_TYPE_POLL @@ -1183,7 +1201,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) } break; } - if (smb.curmsg > 0) smb.curmsg--; + if (smb.curmsg > 0) + smb.curmsg--; do_find = false; break; case 'O': /* Operator commands */ @@ -1398,7 +1417,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) case ')': /* Thread forward */ case TERM_KEY_DOWN: /* down-arrow */ l = msg.hdr.thread_next; - if (!l) l = msg.hdr.thread_first; + if (!l) + l = msg.hdr.thread_first; if (!l) { domsg = 0; outchar('\a'); @@ -1428,7 +1448,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) break; } l = msg.hdr.thread_first; - if (!l) l = msg.hdr.thread_next; + if (!l) + l = msg.hdr.thread_next; if (!l) { domsg = 0; outchar('\a'); @@ -1447,7 +1468,8 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) break; case TERM_KEY_LEFT: /* left arrow */ if (!thread_mode) { - if (smb.curmsg > 0) smb.curmsg--; + if (smb.curmsg > 0) + smb.curmsg--; newline(); break; } @@ -1592,8 +1614,10 @@ int sbbs_t::scanposts(int subnum, int mode, const char *find) done = 1; break; } - if (smb.curmsg < smb.msgs - 1) smb.curmsg++; - else done = 1; + if (smb.curmsg < smb.msgs - 1) + smb.curmsg++; + else + done = 1; break; case '?': menu("msgscan"); diff --git a/src/sbbs3/sbbs_ini.c b/src/sbbs3/sbbs_ini.c index 5aa944b789555e58c7016cae2c14c3c2b5db1879..8d3f219c8f167038f51e8d4521cac8c217dd01ca 100644 --- a/src/sbbs3/sbbs_ini.c +++ b/src/sbbs3/sbbs_ini.c @@ -113,7 +113,8 @@ static bool iniSetStringWithGlobalDefault(str_list_t* lp, const char* section, c static void sbbs_fix_js_settings(js_startup_t* js) { /* Some sanity checking here */ - if (js->max_bytes == 0) js->max_bytes = JAVASCRIPT_MAX_BYTES; + if (js->max_bytes == 0) + js->max_bytes = JAVASCRIPT_MAX_BYTES; } void sbbs_get_js_settings( @@ -390,19 +391,29 @@ void sbbs_read_ini( get_ini_globals(list, global); if (global->ctrl_dir[0]) { - if (bbs != NULL) SAFECOPY(bbs->ctrl_dir, global->ctrl_dir); - if (ftp != NULL) SAFECOPY(ftp->ctrl_dir, global->ctrl_dir); - if (web != NULL) SAFECOPY(web->ctrl_dir, global->ctrl_dir); - if (mail != NULL) SAFECOPY(mail->ctrl_dir, global->ctrl_dir); - if (services != NULL) SAFECOPY(services->ctrl_dir, global->ctrl_dir); + if (bbs != NULL) + SAFECOPY(bbs->ctrl_dir, global->ctrl_dir); + if (ftp != NULL) + SAFECOPY(ftp->ctrl_dir, global->ctrl_dir); + if (web != NULL) + SAFECOPY(web->ctrl_dir, global->ctrl_dir); + if (mail != NULL) + SAFECOPY(mail->ctrl_dir, global->ctrl_dir); + if (services != NULL) + SAFECOPY(services->ctrl_dir, global->ctrl_dir); } if (ini_fname != NULL && ini_fname[0]) { - if (bbs != NULL) SAFECOPY(bbs->ini_fname, ini_fname); - if (ftp != NULL) SAFECOPY(ftp->ini_fname, ini_fname); - if (web != NULL) SAFECOPY(web->ini_fname, ini_fname); - if (mail != NULL) SAFECOPY(mail->ini_fname, ini_fname); - if (services != NULL) SAFECOPY(services->ini_fname, ini_fname); + if (bbs != NULL) + SAFECOPY(bbs->ini_fname, ini_fname); + if (ftp != NULL) + SAFECOPY(ftp->ini_fname, ini_fname); + if (web != NULL) + SAFECOPY(web->ini_fname, ini_fname); + if (mail != NULL) + SAFECOPY(mail->ini_fname, ini_fname); + if (services != NULL) + SAFECOPY(services->ini_fname, ini_fname); } global_interfaces = strListCombine(global->interfaces, NULL, 16384, ","); diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c index b7d454bed1ac7c5b70d7d1677f0e46982e0aea93..a6567c84c1f9b36cd74a48365bc7b2c851bad1dc 100644 --- a/src/sbbs3/sbbsecho.c +++ b/src/sbbs3/sbbsecho.c @@ -322,9 +322,11 @@ echostat_msg_t parse_echostat_msg(str_list_t ini, const char* section, const cha snprintf(key, sizeof key, "%s.localtime", prefix), msg.localtime = iniGetDateTime(ini, section, key, 0); snprintf(key, sizeof key, "%s.length", prefix), msg.length = (size_t)iniGetBytes(ini, section, key, 1, 0); snprintf(key, sizeof key, "%s.origaddr", prefix), iniGetString(ini, section, key, NULL, str); - if (str[0]) msg.origaddr = atofaddr(str); + if (str[0]) + msg.origaddr = atofaddr(str); snprintf(key, sizeof key, "%s.pkt_orig", prefix), iniGetString(ini, section, key, NULL, str); - if (str[0]) msg.pkt_orig = atofaddr(str); + if (str[0]) + msg.pkt_orig = atofaddr(str); return msg; } @@ -479,16 +481,24 @@ void fwrite_echostat_msg(FILE* fp, const echostat_msg_t* msg, const char* prefix echostat_msg_t zero = {{0}}; if (memcmp(msg, &zero, sizeof(*msg)) == 0) return; - if (msg->to[0]) fprintf(fp, "%s.to = %s\n", prefix, msg->to); - if (msg->from[0]) fprintf(fp, "%s.from = %s\n", prefix, msg->from); - if (msg->subj[0]) fprintf(fp, "%s.subj = %s\n", prefix, msg->subj); - if (msg->msg_id[0]) fprintf(fp, "%s.msg_id = %s\n", prefix, msg->msg_id); - if (msg->reply_id[0]) fprintf(fp, "%s.reply_id = %s\n", prefix, msg->reply_id); - if (msg->pid[0]) fprintf(fp, "%s.pid = %s\n", prefix, msg->pid); - if (msg->tid[0]) fprintf(fp, "%s.tid = %s\n", prefix, msg->tid); + if (msg->to[0]) + fprintf(fp, "%s.to = %s\n", prefix, msg->to); + if (msg->from[0]) + fprintf(fp, "%s.from = %s\n", prefix, msg->from); + if (msg->subj[0]) + fprintf(fp, "%s.subj = %s\n", prefix, msg->subj); + if (msg->msg_id[0]) + fprintf(fp, "%s.msg_id = %s\n", prefix, msg->msg_id); + if (msg->reply_id[0]) + fprintf(fp, "%s.reply_id = %s\n", prefix, msg->reply_id); + if (msg->pid[0]) + fprintf(fp, "%s.pid = %s\n", prefix, msg->pid); + if (msg->tid[0]) + fprintf(fp, "%s.tid = %s\n", prefix, msg->tid); fprintf(fp, "%s.length = %lu\n", prefix, (ulong)msg->length); fprintf(fp, "%s.msg_time = %s\n", prefix, iniTimeStr(msg->msg_time)); - if (msg->msg_tz[0]) fprintf(fp, "%s.msg_tz = %s\n", prefix, msg->msg_tz); + if (msg->msg_tz[0]) + fprintf(fp, "%s.msg_tz = %s\n", prefix, msg->msg_tz); fprintf(fp, "%s.localtime = %s\n", prefix, iniTimeStr(msg->localtime)); if (msg->origaddr.zone) fprintf(fp, "%s.origaddr = %s\n", prefix, faddrtoa(&msg->origaddr)); @@ -925,8 +935,10 @@ bool parse_pkthdr(const fpkthdr_t* hdr, fidoaddr_t* orig_addr, fidoaddr_t* dest_ type = PKT_TYPE_2_EXT; orig.point = hdr->type2plus.origpoint; dest.point = hdr->type2plus.destpoint; - if (orig.zone == 0) orig.zone = hdr->type2plus.origzone; - if (dest.zone == 0) dest.zone = hdr->type2plus.destzone; + if (orig.zone == 0) + orig.zone = hdr->type2plus.origzone; + if (dest.zone == 0) + dest.zone = hdr->type2plus.destzone; if (hdr->type2plus.auxnet != 0) { /* strictly speaking, auxnet may be 0 and a valid 2+ packet */ type = PKT_TYPE_2_PLUS; if (orig.point != 0 && orig.net == 0xffff) /* see FSC-0048 for details */ @@ -1065,7 +1077,8 @@ int create_netmail(const char *to, const smbmsg_t* msg, const char *subject, con if (to == NULL || *to == 0) to = "Sysop"; - if (!startmsg) startmsg = 1; + if (!startmsg) + startmsg = 1; if ((nodecfg = findnodecfg(&cfg, dest, /* exact: */ false)) != NULL) { if (nodecfg->status == MAIL_STATUS_NORMAL && !nodecfg->direct) nodecfg = findnodecfg(&cfg, dest, /* skip exact match: */ 2); @@ -1458,7 +1471,8 @@ void netmail_arealist(enum arealist_type type, fidoaddr_t addr, const char* to) for (u = 0; u < cfg.listcfgs; u++) { match = 0; for (k = 0; cfg.listcfg[u].keys[k]; k++) { - if (match) break; + if (match) + break; for (x = 0; nodecfg->keys[x]; x++) { if (!stricmp(cfg.listcfg[u].keys[k] , nodecfg->keys[x])) { @@ -1506,7 +1520,8 @@ void netmail_arealist(enum arealist_type type, fidoaddr_t addr, const char* to) int longest = 0; for (u = 0; area_list[u] != NULL; u++) { int len = strlen(area_list[u]); - if (len > longest) longest = len; + if (len > longest) + longest = len; } for (u = 0; area_list[u] != NULL; u++) fprintf(fp, "%-*s %s\r\n", longest, area_list[u], area_desc(area_list[u])); @@ -1529,7 +1544,8 @@ int check_elists(const char *areatag, nodecfg_t* nodecfg) for (u = 0; u < cfg.listcfgs; u++) { quit = 0; for (k = 0; cfg.listcfg[u].keys[k]; k++) { - if (quit) break; + if (quit) + break; for (x = 0; nodecfg->keys[x] ; x++) if (!stricmp(cfg.listcfg[u].keys[k] , nodecfg->keys[x])) { @@ -1809,7 +1825,8 @@ void add_areas_from_echolists(FILE* afileout, FILE* nmfile for (j = 0; j < cfg.listcfgs; j++) { match = 0; for (k = 0; cfg.listcfg[j].keys[k] ; k++) { - if (match) break; + if (match) + break; for (x = 0; nodecfg->keys[x] ; x++) { if (!stricmp(cfg.listcfg[j].keys[k] , nodecfg->keys[x])) { @@ -2417,7 +2434,8 @@ char* process_areamgr(fidoaddr_t addr, char* inbuf, const char* subj, const char while (*(p + l) && *(p + l) != '\r') l++; continue; } - if (!(*(p + l))) break; + if (!(*(p + l))) + break; if (*(p + l) == '+' || *(p + l) == '-' || *(p + l) == '%') { action = *(p + l); l++; @@ -3000,7 +3018,8 @@ long getlastmsg(uint subnum, uint32_t *ptr, /* unused: */ time_t *t) int i; smb_t smbfile; - if (ptr) (*ptr) = 0; + if (ptr) + (*ptr) = 0; ZERO_VAR(smbfile); if (!subnum_is_valid(&scfg, subnum)) { lprintf(LOG_ERR, "ERROR line %d getlastmsg %d", __LINE__, subnum); @@ -3015,12 +3034,14 @@ long getlastmsg(uint subnum, uint32_t *ptr, /* unused: */ time_t *t) } if (!filelength(fileno(smbfile.shd_fp))) { /* Empty base */ - if (ptr) (*ptr) = 0; + if (ptr) + (*ptr) = 0; smb_close(&smbfile); return 0; } smb_close(&smbfile); - if (ptr) (*ptr) = smbfile.status.last_msg; + if (ptr) + (*ptr) = smbfile.status.last_msg; return smbfile.status.total_msgs; } @@ -3131,7 +3152,8 @@ void cleanup(void) int longest = 0; for (int i = 0; bad_areas[i] != NULL; i++) { int len = strlen(bad_areas[i]); - if (len > longest) longest = len; + if (len > longest) + longest = len; } strListSortAlpha(bad_areas); for (int i = 0; bad_areas[i] != NULL; i++) { @@ -4080,7 +4102,8 @@ void gen_psb(addrlist_t *seenbys, addrlist_t *paths, const char *inbuf, uint16_t FREE_AND_NULL(seenbys->addr); addr.zone = addr.net = addr.node = addr.point = seenbys->addrs = 0; p = strstr(fbuf, "\rSEEN-BY:"); - if (!p) p = strstr(fbuf, "\nSEEN-BY:"); + if (!p) + p = strstr(fbuf, "\nSEEN-BY:"); if (p) { while (1) { snprintf(str, sizeof str, "%-.100s", p + 10); @@ -5739,7 +5762,8 @@ void pack_netmail(void) if (hdr.attr & FIDO_FILE) { // Parse Kill-File-Sent (KFS) from FLAGS from control paragraph (kludge line) within msg body const char* flags = strstr(fmsgbuf, "\1FLAGS "); - if (flags != NULL && flags != fmsgbuf && *(flags - 1) != '\r' && *(flags - 1) != '\n') flags = NULL; + if (flags != NULL && flags != fmsgbuf && *(flags - 1) != '\r' && *(flags - 1) != '\n') + flags = NULL; const char* kfs = NULL; if (flags != NULL) { flags += 7; diff --git a/src/sbbs3/scandirs.cpp b/src/sbbs3/scandirs.cpp index ca5a0dce6df25b7c9934d6874c1aaad73a4d8622..0e69e8f902aa177d116a76a96735cce5b003b220 100644 --- a/src/sbbs3/scandirs.cpp +++ b/src/sbbs3/scandirs.cpp @@ -41,7 +41,8 @@ void sbbs_t::scandirs(int mode) return; } - if (!usrlibs) return; + if (!usrlibs) + return; mnemonics(text[DirLibOrAll]); SAFEPRINTF2(keys, "%s%c\r", text[DirLibKeys], all_key()); ch = (char)getkeys(keys, 0); @@ -91,7 +92,8 @@ void sbbs_t::scandirs(int mode) continue; else if ((s = listfiles(usrdir[curlib][i], str, 0, mode)) == -1) return; - else k += s; + else + k += s; } progress(text[Done], i, usrdirs[curlib]); bputs(text[Scanned]); @@ -124,7 +126,8 @@ void sbbs_t::scanalldirs(int mode) return; } - if (!usrlibs) return; + if (!usrlibs) + return; k = 0; if (mode & FL_ULTIME) { /* New file scan */ bprintf(text[NScanHdr], timestr(ns_time)); @@ -160,7 +163,8 @@ void sbbs_t::scanalldirs(int mode) bputs(text[Scanned]); return; } - else k += s; + else + k += s; } if (j < usrdirs[i]) /* aborted */ break; diff --git a/src/sbbs3/scansubs.cpp b/src/sbbs3/scansubs.cpp index 3102feeab0e5be8fac373c24c228efbd632b152f..3746876070de67359c11e01465b251a00b81a1c9 100644 --- a/src/sbbs3/scansubs.cpp +++ b/src/sbbs3/scansubs.cpp @@ -97,8 +97,10 @@ void sbbs_t::scansubs(int mode) i = scanposts(usrsub[curgrp][cursub[curgrp]], mode, str); subs_scanned++; bputs(text[MessageScan]); - if (i) bputs(text[MessageScanAborted]); - else bprintf(text[MessageScanComplete], subs_scanned); + if (i) + bputs(text[MessageScanAborted]); + else + bprintf(text[MessageScanComplete], subs_scanned); return; } if (ch == text[SubGroupKeys][1] /* 'G' */) { @@ -123,8 +125,10 @@ void sbbs_t::scansubs(int mode) cleartoeol(); } bputs(text[MessageScan]); - if (i == usrsubs[curgrp]) bprintf(text[MessageScanComplete], subs_scanned); - else bputs(text[MessageScanAborted]); + if (i == usrsubs[curgrp]) + bprintf(text[MessageScanComplete], subs_scanned); + else + bputs(text[MessageScanAborted]); return; } @@ -254,8 +258,10 @@ void sbbs_t::new_scan_ptr_cfg() bputs(text[CfgGrpLstHdr]); for (i = 0; i < usrgrps && !msgabort(); i++) { checkline(); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); bprintf(text[CfgGrpLstFmt], i + 1, cfg.grp[usrgrp[i]]->lname); } sync(); @@ -315,8 +321,10 @@ void sbbs_t::new_scan_ptr_cfg() bprintf(text[CfgSubLstHdr], cfg.grp[usrgrp[i]]->lname); for (j = 0; j < usrsubs[i] && !msgabort(); j++) { checkline(); - if (j < 9) outchar(' '); - if (j < 99) outchar(' '); + if (j < 9) + outchar(' '); + if (j < 99) + outchar(' '); t = getmsgtime(usrsub[i][j], subscan[usrsub[i][j]].ptr); if (t > l) l = (uint32_t)t; @@ -413,8 +421,10 @@ void sbbs_t::new_scan_cfg(uint misc) bputs(text[CfgGrpLstHdr]); for (i = 0; i < usrgrps && !msgabort(); i++) { checkline(); - if (i < 9) outchar(' '); - if (i < 99) outchar(' '); + if (i < 9) + outchar(' '); + if (i < 99) + outchar(' '); bprintf(text[CfgGrpLstFmt], i + 1, cfg.grp[usrgrp[i]]->lname); } sync(); @@ -432,8 +442,10 @@ void sbbs_t::new_scan_cfg(uint misc) bprintf(text[CfgSubLstHdr], cfg.grp[usrgrp[i]]->lname); for (j = 0; j < usrsubs[i] && !msgabort(); j++) { checkline(); - if (j < 9) outchar(' '); - if (j < 99) outchar(' '); + if (j < 9) + outchar(' '); + if (j < 99) + outchar(' '); bprintf(text[CfgSubLstFmt], j + 1 , cfg.sub[usrsub[i][j]]->lname , subscan[usrsub[i][j]].cfg & misc ? @@ -460,7 +472,8 @@ void sbbs_t::new_scan_cfg(uint misc) misc |= SUB_CFG_YSCAN; for (j = 0; j < usrsubs[i] && online; j++) { checkline(); - if (t) subscan[usrsub[i][j]].cfg &= ~misc; + if (t) + subscan[usrsub[i][j]].cfg &= ~misc; else { if (misc & SUB_CFG_NSCAN) subscan[usrsub[i][j]].cfg &= ~SUB_CFG_YSCAN; diff --git a/src/sbbs3/scfg/scfgmsg.c b/src/sbbs3/scfg/scfgmsg.c index cf1da2933b74a5c6158ea36ce195774690b51984..087f5cbb474ef86b27aed22af4e5f6230291f56f 100644 --- a/src/sbbs3/scfg/scfgmsg.c +++ b/src/sbbs3/scfg/scfgmsg.c @@ -172,73 +172,94 @@ long import_msg_areas(enum import_list_type type, FILE* stream, int grpnum } else { if (feof(stream)) break; - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); if (!str[0]) continue; if (type == IMPORT_LIST_TYPE_SUBS_TXT) { sprintf(tmpsub.lname, "%.*s", LEN_SLNAME, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.sname, "%.*s", LEN_SSNAME, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.qwkname, "%.*s", 10, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); SAFECOPY(tmp_code, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.data_dir, "%.*s", LEN_DIR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.read_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.post_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.op_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.misc = ahtoul(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.tagline, "%.*s", 80, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.origline, "%.*s", 50, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.post_sem, "%.*s", LEN_DIR, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); SAFECOPY(tmpsub.newsgroup, str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.faddr = atofaddr(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.maxmsgs = atol(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.maxcrcs = atol(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.maxage = atoi(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); tmpsub.ptridx = atoi(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); sprintf(tmpsub.mod_arstr, "%.*s", LEN_ARSTR, str); while (!feof(stream) && strcmp(str, "***END-OF-SUB***")) { - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; truncsp(str); } } @@ -247,7 +268,8 @@ long import_msg_areas(enum import_list_type type, FILE* stream, int grpnum break; read_qwk_confs++; qwk_confnum = atoi(str); - if (!fgets(str, 128, stream)) break; + if (!fgets(str, 128, stream)) + break; if (qwk_confnum < min_confnum || qwk_confnum > max_confnum) continue; truncsp(str); @@ -616,7 +638,8 @@ void msgs_cfg() if (cfg.sub[j]->grp == grpnum) { /* delete subs of this group */ remove_sub(&cfg, j, /* cut: */ false); } - else j++; + else + j++; } for (j = 0; j < cfg.total_subs; j++) /* move sub group numbers down */ if (cfg.sub[j]->grp > grpnum) @@ -891,8 +914,10 @@ void msgs_cfg() , "File Exists", opt); if (j == -1) break; - if (j == 0) j = O_WRONLY | O_TRUNC; - else j = O_WRONLY | O_APPEND; + if (j == 0) + j = O_WRONLY | O_TRUNC; + else + j = O_WRONLY | O_APPEND; } else j = O_WRONLY | O_CREAT; diff --git a/src/sbbs3/scfg/scfgnet.c b/src/sbbs3/scfg/scfgnet.c index ec1b1a600471cdca2da9db797a23da523725f5f4..124686e0776b8daa55e164062fb860b33888e2ac 100644 --- a/src/sbbs3/scfg/scfgnet.c +++ b/src/sbbs3/scfg/scfgnet.c @@ -1396,7 +1396,8 @@ void qhub_edit(int num) case __COUNTER__: i = cfg.qhub[num]->misc & QHUB_CTRL_A; i++; - if (i == QHUB_CTRL_A) i = 0; + if (i == QHUB_CTRL_A) + i = 0; cfg.qhub[num]->misc &= ~QHUB_CTRL_A; cfg.qhub[num]->misc |= i; uifc.changes = 1; @@ -1666,9 +1667,11 @@ char *daystr(char days) days &= 0x7f; - if (days == 0) return "None"; + if (days == 0) + return "None"; - if (days == 0x7f) return "All"; + if (days == 0x7f) + return "All"; str[0] = 0; for (i = 0; i < 7; i++) { diff --git a/src/sbbs3/scfg/scfgxfr2.c b/src/sbbs3/scfg/scfgxfr2.c index 4a8f252ea4abd9108a00dc369013e1bcadc14ccd..4afce63562494dc4b1f19171a0830d084b2a2ecc 100644 --- a/src/sbbs3/scfg/scfgxfr2.c +++ b/src/sbbs3/scfg/scfgxfr2.c @@ -470,7 +470,8 @@ void xfer_cfg() k++; } } - else j++; + else + j++; } for (j = 0; j < cfg.total_dirs; j++) { if (cfg.dir[j]->lib > libnum) @@ -758,8 +759,10 @@ void xfer_cfg() , "File Exists", opt); if (j == -1) break; - if (j == 0) j = O_WRONLY | O_TRUNC; - else j = O_WRONLY | O_APPEND; + if (j == 0) + j = O_WRONLY | O_TRUNC; + else + j = O_WRONLY | O_APPEND; } else j = O_WRONLY | O_CREAT; @@ -888,7 +891,8 @@ void xfer_cfg() char duplicate_code[LEN_CODE + 1] = ""; uint duplicate_codes = 0; // consecutive duplicate codes while (!feof(stream) && cfg.total_dirs < MAX_DIRS) { - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); if (!str[0]) continue; @@ -965,65 +969,84 @@ void xfer_cfg() } else { sprintf(tmpdir.lname, "%.*s", LEN_SLNAME, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.sname, "%.*s", LEN_SSNAME, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); SAFECOPY(tmp_code, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.data_dir, "%.*s", LEN_DIR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.ul_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.dl_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.op_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.path, "%.*s", LEN_DIR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.upload_sem, "%.*s", LEN_DIR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.maxfiles = atoi(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.exts, "%.*s", 40, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.misc = ahtoul(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.seqdev = atoi(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.sort = atoi(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); sprintf(tmpdir.ex_arstr, "%.*s", LEN_ARSTR, str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.maxage = atoi(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.up_pct = atoi(str); - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); tmpdir.dn_pct = atoi(str); ported++; while (!feof(stream) && strcmp(str, "***END-OF-DIR***")) { - if (!fgets(str, sizeof(str), stream)) break; + if (!fgets(str, sizeof(str), stream)) + break; truncsp(str); } } diff --git a/src/sbbs3/scfg/scfgxtrn.c b/src/sbbs3/scfg/scfgxtrn.c index f31cf2ea062c0ff160934505d3e535144b464f3e..5ccf8e91553bc52441d7be20b0c7a3793753dc7e 100644 --- a/src/sbbs3/scfg/scfgxtrn.c +++ b/src/sbbs3/scfg/scfgxtrn.c @@ -2273,7 +2273,8 @@ void xtrnsec_cfg() k++; } } - else j++; + else + j++; } for (j = 0; j < cfg.total_xtrns; j++) /* move xtrn group numbers down */ if (cfg.xtrn[j]->sec > xtrnsec_num) diff --git a/src/sbbs3/scfglib2.c b/src/sbbs3/scfglib2.c index 0b43e2a28fa5bcb778c1ee5e0e98fd9f1eff7a4b..b7da8629aab44a900feae049fb03c957ceec3759 100644 --- a/src/sbbs3/scfglib2.c +++ b/src/sbbs3/scfglib2.c @@ -765,7 +765,8 @@ char *u32toaf(uint32_t l, char *str) while (c < 26) { if (l & (1 << c)) str[c] = 'A' + c; - else str[c] = ' '; + else + str[c] = ' '; c++; } str[c] = 0; diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index 1c814cb9aa8eb0e50659fd728663a2861fdc752c..ac2601dd813b69431314629da210f28e371d6926 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -1977,8 +1977,10 @@ void services_thread(void* arg) do { /* Setup intelligent defaults */ - if (startup->sem_chk_freq == 0) startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; - if (startup->js.max_bytes == 0) startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; + if (startup->sem_chk_freq == 0) + startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; + if (startup->js.max_bytes == 0) + startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; thread_up(false /* setuid */); diff --git a/src/sbbs3/sexyz.c b/src/sbbs3/sexyz.c index 50daf14a3ec11561b653c3f97293cf5e9c5a24a3..dcc09e5e73e5e5c86495b65e0c8f569dbd9c1b9c 100644 --- a/src/sbbs3/sexyz.c +++ b/src/sbbs3/sexyz.c @@ -804,7 +804,8 @@ void xmodem_progress(void* unused, unsigned block_num, int64_t offset, int64_t f cps = 1; /* cps so far */ l = (long)(fsize / cps); /* total transfer est time */ l -= t; /* now, it's est time left */ - if (l < 0) l = 0; + if (l < 0) + l = 0; if (mode & SEND) { total_blocks = num_blocks(block_num, offset, fsize, xm.block_size); fprintf(statfp, "\rBlock (%lu%s): %u/%" PRId64 " Byte: %" PRId64 " " @@ -875,7 +876,8 @@ void zmodem_progress(void* cbdata, int64_t current_pos) cps = 1; /* cps so far */ l = (long)(zm.current_file_size / cps); /* total transfer est time */ l -= t; /* now, it's est time left */ - if (l < 0) l = 0; + if (l < 0) + l = 0; fprintf(statfp, "\rKByte: %" PRId64 "/%" PRId64 " %u/CRC-%u " "Time: %lu:%02lu/%lu:%02lu %u cps %lu%% " , current_pos / 1024 @@ -1059,7 +1061,8 @@ static int send_files(char** fname, uint fnames) } if (xm.total_files > 1) { t = time(NULL) - startall; - if (!t) t = 1; + if (!t) + t = 1; lprintf(LOG_INFO, "Overall - Time %02lu:%02lu KBytes: %" PRId64 " CPS: %lu" , t / 60, t % 60, total_bytes / 1024, total_bytes / t); } @@ -1340,7 +1343,8 @@ static int receive_files(char** fname_list, int fnames) fclose(fp); t = time(NULL) - startfile; - if (!t) t = 1; + if (!t) + t = 1; if (zm.file_skipped) lprintf(LOG_WARNING, "File Skipped"); else if (success) diff --git a/src/sbbs3/smbutil.c b/src/sbbs3/smbutil.c index ffeb6b48dbb1058f156e34dea90c58ac63cb86e5..70e5c33bebea413fdccd8d476e823a55b0c08afd 100644 --- a/src/sbbs3/smbutil.c +++ b/src/sbbs3/smbutil.c @@ -1167,9 +1167,12 @@ void packmsgs(ulong packable) smb_close_ha(&smb); smb_close_da(&smb); } - if (tmp_sdt != NULL) fclose(tmp_sdt); - if (tmp_shd != NULL) fclose(tmp_shd); - if (tmp_sid != NULL) fclose(tmp_sid); + if (tmp_sdt != NULL) + fclose(tmp_sdt); + if (tmp_shd != NULL) + fclose(tmp_shd); + if (tmp_sid != NULL) + fclose(tmp_sid); fprintf(errfp, "\n%s!Error opening temp files\n", beep); return; } @@ -1671,7 +1674,8 @@ short str2tzone(const char* str) short zone; if (IS_DIGIT(*str) || *str == '-' || *str == '+') { /* [+|-]HHMM format */ - if (*str == '+') str++; + if (*str == '+') + str++; sprintf(tmp, "%.*s", *str == '-'? 3:2, str); zone = atoi(tmp) * 60; str += (*str == '-') ? 3:2; diff --git a/src/sbbs3/str.cpp b/src/sbbs3/str.cpp index 315af26dac596b597c3b0999dc90a927d111cbc1..2e210ec55208f39c0a80155645beb54bd9961964 100644 --- a/src/sbbs3/str.cpp +++ b/src/sbbs3/str.cpp @@ -298,7 +298,8 @@ void sbbs_t::sif(char *fname, char *answers, int len) buf[m] = 0; break; } - if (l >= length) break; + if (l >= length) + break; if (online == ON_REMOTE) { rioctl(IOCM | ABORT); rioctl(IOCS | ABORT); @@ -468,7 +469,8 @@ void sbbs_t::sof(char *fname, char *answers, int len) buf[m] = 0; break; } - if (l >= length) break; + if (l >= length) + break; if (online == ON_REMOTE) { rioctl(IOCM | ABORT); rioctl(IOCS | ABORT); @@ -1076,7 +1078,8 @@ void sbbs_t::user_info() void sbbs_t::xfer_policy() { - if (!usrlibs) return; + if (!usrlibs) + return; if (!menu("tpolicy", P_NOERROR)) { bprintf(text[TransferPolicyHdr], cfg.sys_name); bprintf(text[TpUpload] @@ -1140,7 +1143,8 @@ void sbbs_t::node_stats(uint node_num) bputs(text[InvalidNode]); return; } - if (!node_num) node_num = cfg.node_num; + if (!node_num) + node_num = cfg.node_num; bprintf(text[NodeStatsHdr], node_num); getstats(&cfg, node_num, &stats); bprintf(text[StatsTotalLogons], ultoac(stats.logons, tmp)); @@ -1303,11 +1307,13 @@ void sbbs_t::time_bank(void) if (cfg.sys_misc & SM_TIMEBANK) { /* Allow users to deposit free time */ s = (cfg.level_timeperday[useron.level] - useron.ttoday) + useron.textra; - if (s < 0) s = 0; + if (s < 0) + s = 0; if (s > cfg.level_timepercall[useron.level]) s = cfg.level_timepercall[useron.level]; s -= (int)(now - starttime) / 60; - if (s < 0) s = 0; + if (s < 0) + s = 0; bprintf(text[FreeMinLeft], s); bprintf(text[UserMinutes], ultoac(useron.min, tmp)); if (cfg.max_minutes && useron.min >= cfg.max_minutes) { @@ -1394,8 +1400,10 @@ void sbbs_t::change_user(void) putnodedat(cfg.node_num, &thisnode); } getmsgptrs(); - if (REALSYSOP) sys_status &= ~SS_TMPSYSOP; - else sys_status |= SS_TMPSYSOP; + if (REALSYSOP) + sys_status &= ~SS_TMPSYSOP; + else + sys_status |= SS_TMPSYSOP; snprintf(str, sizeof str, "Changed into %s #%u", useron.alias, useron.number); logline("S+", str); } diff --git a/src/sbbs3/str_util.c b/src/sbbs3/str_util.c index 9b10a159bf123639c2ff2c38eb554da26375d2a8..acf7a65708a59e09f5df6060575ce88a7aa2d8fb 100644 --- a/src/sbbs3/str_util.c +++ b/src/sbbs3/str_util.c @@ -53,7 +53,8 @@ char* remove_ctrl_a(const char *str, char *dest) dest[j++] = '\n'; } } - else dest[j++] = str[i]; + else + dest[j++] = str[i]; } dest[j] = 0; return dest; @@ -378,7 +379,8 @@ int strsame(const char *str1, const char *str2) int i, j = 0; for (i = 0; str1[i]; i++) - if (str1[i] == str2[i]) j++; + if (str1[i] == str2[i]) + j++; return j; } diff --git a/src/sbbs3/unbaja.c b/src/sbbs3/unbaja.c index 680f4ccab41d0449ab4af27e810a58a591794f6a..dc9538d77e2d492bc1b5cd33f278231999240f90 100644 --- a/src/sbbs3/unbaja.c +++ b/src/sbbs3/unbaja.c @@ -325,8 +325,10 @@ BRUTE_DONE: /* comparison function for var_table */ static int vt_compare(const void *key, const void *table) { - if (*(uint32_t *)key == (*(struct var_table_t *)table).crc) return 0; - if (*(uint32_t *)key < (*(struct var_table_t *)table).crc) return -1; + if (*(uint32_t *)key == (*(struct var_table_t *)table).crc) + return 0; + if (*(uint32_t *)key < (*(struct var_table_t *)table).crc) + return -1; return 1; } diff --git a/src/sbbs3/upgrade_to_v319.c b/src/sbbs3/upgrade_to_v319.c index 4c58fdc9baa144158eace291467c967f5c3543ba..c2ffaa418a4573ef85a2852a84a40b3f7fa3e57b 100644 --- a/src/sbbs3/upgrade_to_v319.c +++ b/src/sbbs3/upgrade_to_v319.c @@ -175,10 +175,13 @@ char* padfname(const char *filename, char *str) int c, d; for (c = 0; c < 8; c++) - if (filename[c] == '.' || !filename[c]) break; - else str[c] = filename[c]; + if (filename[c] == '.' || !filename[c]) + break; + else + str[c] = filename[c]; d = c; - if (filename[c] == '.') c++; + if (filename[c] == '.') + c++; while (d < 8) str[d++] = ' '; if (filename[c] > ' ') /* Change "FILE" to "FILE " */ @@ -186,8 +189,10 @@ char* padfname(const char *filename, char *str) else str[d++] = ' '; while (d < 12) - if (!filename[c]) break; - else str[d++] = filename[c++]; + if (!filename[c]) + break; + else + str[d++] = filename[c++]; while (d < 12) str[d++] = ' '; str[d] = 0; @@ -202,7 +207,8 @@ char* unpadfname(const char *filename, char *str) int c, d; for (c = 0, d = 0; filename[c]; c++) - if (filename[c] != ' ') str[d++] = filename[c]; + if (filename[c] != ' ') + str[d++] = filename[c]; str[d] = 0; return str; } @@ -531,7 +537,8 @@ int update_uldate(scfg_t* cfg, oldfile_t* f) for (l = 0; l < length; l += F_IXBSIZE) { my_read(file, str, F_IXBSIZE); /* Look for the filename in the IXB file */ str[11] = 0; - if (!stricmp(fname, str)) break; + if (!stricmp(fname, str)) + break; } if (l >= length) { close(file); diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp index a7053d1907d1779a516848174b97b87324c26bd9..9e0b1d36b08039544f79fc3ba1f61f46ad6cb006 100644 --- a/src/sbbs3/upload.cpp +++ b/src/sbbs3/upload.cpp @@ -290,7 +290,8 @@ bool sbbs_t::upload(int dirnum, const char* fname) else SAFEPRINTF3(str, text[UploadToCurDirQ], fname, cfg.lib[cfg.dir[dirnum]->lib]->sname , cfg.dir[dirnum]->sname); - if (!yesno(str)) return false; + if (!yesno(str)) + return false; action = NODE_ULNG; SAFECOPY(f.file_idx.name, fname); getfilepath(&cfg, &f, path); @@ -317,7 +318,8 @@ bool sbbs_t::upload(int dirnum, const char* fname) bputs(text[TheseFileExtsOnly]); bputs(cfg.dir[dirnum]->exts); CRLF; - if (!dir_op(dirnum)) return false; + if (!dir_op(dirnum)) + return false; } bputs(text[SearchingForDupes]); bool found = findfile(&cfg, dirnum, fname, NULL); diff --git a/src/sbbs3/userdat.c b/src/sbbs3/userdat.c index dce17da990ca8d0d28657e5d9be16cf08bf9078b..f2a42b3c18aee115b736eb1b0b9b46c91471f0a5 100644 --- a/src/sbbs3/userdat.c +++ b/src/sbbs3/userdat.c @@ -107,7 +107,8 @@ uint matchuser(scfg_t* cfg, const char *name, bool sysop_alias) if (fread(dat, sizeof(dat), 1, stream) != 1) break; for (c = 0; c < LEN_ALIAS; c++) - if (dat[c] == ETX) break; + if (dat[c] == ETX) + break; dat[c] = 0; if (c < 1) // Deleted user continue; @@ -837,7 +838,8 @@ char* username(scfg_t* cfg, int usernumber, char *name) memset(name, ETX, LEN_ALIAS); close(file); for (c = 0; c < LEN_ALIAS; c++) - if (name[c] == ETX) break; + if (name[c] == ETX) + break; name[c] = 0; if (!c) strcpy(name, "DELETED USER"); @@ -1612,7 +1614,8 @@ char* nodestatus(scfg_t* cfg, node_t* node, char* buf, size_t buflen, int num) } else { if ((node->aux / 60) == 0) /* 12 midnite */ hour = 12; - else hour = node->aux / 60; + else + hour = node->aux / 60; mer = "am"; } sprintf(str + strlen(str), " ETA %02d:%02d %s" @@ -2025,32 +2028,38 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client) case AR_ANSI: if (user == NULL || !(user->misc & ANSI)) result = not; - else result = !not; + else + result = !not; break; case AR_PETSCII: if (user == NULL || (user->misc & CHARSET_FLAGS) != CHARSET_PETSCII) result = not; - else result = !not; + else + result = !not; break; case AR_ASCII: if (user == NULL || (user->misc & CHARSET_FLAGS) != CHARSET_ASCII) result = not; - else result = !not; + else + result = !not; break; case AR_UTF8: if (user == NULL || (user->misc & CHARSET_FLAGS) != CHARSET_UTF8) result = not; - else result = !not; + else + result = !not; break; case AR_CP437: if (user == NULL || (user->misc & CHARSET_FLAGS) != CHARSET_CP437) result = not; - else result = !not; + else + result = !not; break; case AR_RIP: if (user == NULL || !(user->misc & RIP)) result = not; - else result = !not; + else + result = !not; break; case AR_WIP: result = not; @@ -2093,37 +2102,44 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client) case AR_ACTIVE: if (user == NULL || user->misc & (DELETED | INACTIVE)) result = not; - else result = !not; + else + result = !not; break; case AR_INACTIVE: if (user == NULL || !(user->misc & INACTIVE)) result = not; - else result = !not; + else + result = !not; break; case AR_DELETED: if (user == NULL || !(user->misc & DELETED)) result = not; - else result = !not; + else + result = !not; break; case AR_EXPERT: if (user == NULL || !(user->misc & EXPERT)) result = not; - else result = !not; + else + result = !not; break; case AR_SYSOP: if (!user_is_sysop(user)) result = not; - else result = !not; + else + result = !not; break; case AR_GUEST: if (user == NULL || !(user->rest & FLAG('G'))) result = not; - else result = !not; + else + result = !not; break; case AR_QNODE: if (user == NULL || !(user->rest & FLAG('Q'))) result = not; - else result = !not; + else + result = !not; break; case AR_QUIET: result = not; @@ -2309,7 +2325,8 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client) result = not; else { l = user->dlb; - if (!l) l = 1; + if (!l) + l = 1; if (user->dlb > user->ulb && (!user->ulb || 100 / ((float)l / user->ulb) < n)) result = not; @@ -2322,7 +2339,8 @@ static bool ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user, client_t* client) result = not; else { i = user->dls; - if (!i) i = 1; + if (!i) + i = 1; if (user->dls > user->uls && (!user->uls || 100 / ((float)i / user->uls) < n)) result = not; @@ -3031,22 +3049,28 @@ void resetdailyuserdat(scfg_t* cfg, user_t* user, bool write) /* logons today */ user->ltoday = 0; - if (write) putuserstr(cfg, user->number, USER_LTODAY, "0"); + if (write) + putuserstr(cfg, user->number, USER_LTODAY, "0"); /* e-mails today */ user->etoday = 0; - if (write) putuserstr(cfg, user->number, USER_ETODAY, "0"); + if (write) + putuserstr(cfg, user->number, USER_ETODAY, "0"); /* posts today */ user->ptoday = 0; - if (write) putuserstr(cfg, user->number, USER_PTODAY, "0"); + if (write) + putuserstr(cfg, user->number, USER_PTODAY, "0"); /* free credits per day */ user->freecdt = cfg->level_freecdtperday[user->level]; - if (write) putuserdec64(cfg, user->number, USER_FREECDT, user->freecdt); + if (write) + putuserdec64(cfg, user->number, USER_FREECDT, user->freecdt); /* time used today */ user->ttoday = 0; - if (write) putuserstr(cfg, user->number, USER_TTODAY, "0"); + if (write) + putuserstr(cfg, user->number, USER_TTODAY, "0"); /* extra time today */ user->textra = 0; - if (write) putuserstr(cfg, user->number, USER_TEXTRA, "0"); + if (write) + putuserstr(cfg, user->number, USER_TEXTRA, "0"); } /****************************************************************************/ @@ -3256,7 +3280,8 @@ int newuserdat(scfg_t* cfg, user_t* user) if (fread(str, LEN_ALIAS + 2, 1, stream) != 1) memset(str, ETX, LEN_ALIAS); for (c = 0; c < LEN_ALIAS; c++) - if (str[c] == ETX) break; + if (str[c] == ETX) + break; str[c] = 0; if (!c) { /* should be a deleted user */ user_t deluser; @@ -3714,7 +3739,8 @@ time_t gettimeleft(scfg_t* cfg, user_t* user, time_t starttime) else { tleft = (((long)cfg->level_timeperday[user->level] - user->ttoday) + user->textra) * 60L; - if (tleft < 0) tleft = 0; + if (tleft < 0) + tleft = 0; if (tleft > cfg->level_timepercall[user->level] * 60) tleft = cfg->level_timepercall[user->level] * 60; tleft += user->min * 60L; @@ -4363,7 +4389,8 @@ enum parsed_vpath parse_vpath(scfg_t* cfg, const char* vpath, int* lib, int* dir return PARSED_VPATH_ROOT; tp = strchr(p, '/'); - if (tp) *tp = 0; + if (tp) + *tp = 0; for (*lib = 0; *lib < cfg->total_libs; (*lib)++) { if (stricmp(cfg->lib[*lib]->vdir, p) == 0) break; diff --git a/src/sbbs3/useredit.cpp b/src/sbbs3/useredit.cpp index e237ed44765f3db363a959b11c84ab0482b85313..b756dd174516ba1b0332e73b465f0cffdff47d3b 100644 --- a/src/sbbs3/useredit.cpp +++ b/src/sbbs3/useredit.cpp @@ -247,7 +247,8 @@ void sbbs_t::useredit(int usernumber) break; if (sys_status & SS_ABORT) break; - if (c == CR) break; + if (c == CR) + break; if (c == '?') { menu("exempt"); continue; @@ -279,7 +280,8 @@ void sbbs_t::useredit(int usernumber) break; if (sys_status & SS_ABORT) break; - if (c == CR) break; + if (c == CR) + break; if (c == '?') { SAFEPRINTF(str, "flags%d", i); menu(str); @@ -316,11 +318,13 @@ void sbbs_t::useredit(int usernumber) i = atoi(str); if (i > lastuser(&cfg)) break; - if (i) user.number = i; + if (i) + user.number = i; } else { i = finduser(str); - if (i) user.number = i; + if (i) + user.number = i; } } break; @@ -530,7 +534,8 @@ void sbbs_t::useredit(int usernumber) break; if (sys_status & SS_ABORT) break; - if (c == CR) break; + if (c == CR) + break; if (c == '?') { menu("restrict"); continue; @@ -636,13 +641,15 @@ void sbbs_t::useredit(int usernumber) case ']': if (user.number == lastuser(&cfg)) user.number = 1; - else user.number++; + else + user.number++; break; case TERM_KEY_LEFT: case '[': if (user.number == 1) user.number = lastuser(&cfg); - else user.number--; + else + user.number--; break; case TERM_KEY_HOME: user.number = 1; diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c index 22edb4776bacbb01b19497dd0f8419d4556a89df..6155b18ed812bf880050278b5a0811bd1d7be60d 100644 --- a/src/sbbs3/websrvr.c +++ b/src/sbbs3/websrvr.c @@ -7295,17 +7295,28 @@ void web_server(void* arg) protected_uint32_init(&active_clients, 0); /* Setup intelligent defaults */ - if (startup->port == 0) startup->port = IPPORT_HTTP; - if (startup->root_dir[0] == 0) SAFECOPY(startup->root_dir, WEB_DEFAULT_ROOT_DIR); - if (startup->error_dir[0] == 0) SAFECOPY(startup->error_dir, WEB_DEFAULT_ERROR_DIR); - if (startup->default_auth_list[0] == 0) SAFECOPY(startup->default_auth_list, WEB_DEFAULT_AUTH_LIST); - if (startup->cgi_dir[0] == 0) SAFECOPY(startup->cgi_dir, WEB_DEFAULT_CGI_DIR); - if (startup->default_cgi_content[0] == 0) SAFECOPY(startup->default_cgi_content, WEB_DEFAULT_CGI_CONTENT); - if (startup->max_inactivity == 0) startup->max_inactivity = WEB_DEFAULT_MAX_INACTIVITY; /* seconds */ - if (startup->max_cgi_inactivity == 0) startup->max_cgi_inactivity = WEB_DEFAULT_MAX_CGI_INACTIVITY; /* seconds */ - if (startup->sem_chk_freq == 0) startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; /* seconds */ - if (startup->js.max_bytes == 0) startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; - if (startup->ssjs_ext[0] == 0) SAFECOPY(startup->ssjs_ext, ".ssjs"); + if (startup->port == 0) + startup->port = IPPORT_HTTP; + if (startup->root_dir[0] == 0) + SAFECOPY(startup->root_dir, WEB_DEFAULT_ROOT_DIR); + if (startup->error_dir[0] == 0) + SAFECOPY(startup->error_dir, WEB_DEFAULT_ERROR_DIR); + if (startup->default_auth_list[0] == 0) + SAFECOPY(startup->default_auth_list, WEB_DEFAULT_AUTH_LIST); + if (startup->cgi_dir[0] == 0) + SAFECOPY(startup->cgi_dir, WEB_DEFAULT_CGI_DIR); + if (startup->default_cgi_content[0] == 0) + SAFECOPY(startup->default_cgi_content, WEB_DEFAULT_CGI_CONTENT); + if (startup->max_inactivity == 0) + startup->max_inactivity = WEB_DEFAULT_MAX_INACTIVITY; /* seconds */ + if (startup->max_cgi_inactivity == 0) + startup->max_cgi_inactivity = WEB_DEFAULT_MAX_CGI_INACTIVITY; /* seconds */ + if (startup->sem_chk_freq == 0) + startup->sem_chk_freq = DEFAULT_SEM_CHK_FREQ; /* seconds */ + if (startup->js.max_bytes == 0) + startup->js.max_bytes = JAVASCRIPT_MAX_BYTES; + if (startup->ssjs_ext[0] == 0) + SAFECOPY(startup->ssjs_ext, ".ssjs"); (void)protected_uint32_adjust(&thread_count, 1); thread_up(false /* setuid */); @@ -7322,7 +7333,8 @@ void web_server(void* arg) prep_dir(root_dir, cgi_dir, sizeof(cgi_dir)); /* Trim off trailing slash/backslash */ - if (IS_PATH_DELIM(*(p = lastchar(root_dir)))) *p = 0; + if (IS_PATH_DELIM(*(p = lastchar(root_dir)))) + *p = 0; memset(&scfg, 0, sizeof(scfg)); diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp index 9fa185c55d542fcfe4c22e9ee2ca16cbfe9a82a8..1742299d9e46a1e5974731ab883ccbe1c2b7bc25 100644 --- a/src/sbbs3/writemsg.cpp +++ b/src/sbbs3/writemsg.cpp @@ -89,7 +89,8 @@ bool sbbs_t::quotemsg(smb_t* smb, smbmsg_t* msg, bool tails) bool result = false; ulong mode = GETMSGTXT_PLAIN; - if (tails) mode |= GETMSGTXT_TAILS; + if (tails) + mode |= GETMSGTXT_TAILS; if ((buf = smb_getmsgtxt(smb, msg, mode)) != NULL) { strip_invalid_attr(buf); truncsp(buf); @@ -1401,10 +1402,13 @@ bool sbbs_t::copyfattach(uint to, uint from, const char* subj) tp = str; while (1) { p = strchr(tp, ' '); - if (p) *p = 0; + if (p) + *p = 0; sp = strrchr(tp, '/'); /* sp is slash pointer */ - if (!sp) sp = strrchr(tp, '\\'); - if (sp) tp = sp + 1; + if (!sp) + sp = strrchr(tp, '\\'); + if (sp) + tp = sp + 1; if (strcspn(tp, ILLEGAL_FILENAME_CHARS) == strlen(tp)) { SAFEPRINTF2(dest, "%s/%s", dir, tp); SAFEPRINTF3(src, "%sfile/%04u.in/%s", cfg.data_dir, from, tp); diff --git a/src/sbbs3/xtrn.cpp b/src/sbbs3/xtrn.cpp index f4c64c18cad69e99bb1be7ed373a5b7fce699dbc..90aa9dd035d0584ff6b885cf98d9a53ea7e78294 100644 --- a/src/sbbs3/xtrn.cpp +++ b/src/sbbs3/xtrn.cpp @@ -1306,25 +1306,29 @@ int sbbs_t::external(const char* cmdline, int mode, const char* startup_dir) REPLACE_CHARS(ctrldir_dos, '/', '\\', p); p = lastchar(ctrldir_dos); - if (*p == '\\') *p = 0; + if (*p == '\\') + *p = 0; SAFECOPY(datadir_dos, cfg.data_dir); REPLACE_CHARS(datadir_dos, '/', '\\', p); p = lastchar(datadir_dos); - if (*p == '\\') *p = 0; + if (*p == '\\') + *p = 0; SAFECOPY(execdir_dos, cfg.exec_dir); REPLACE_CHARS(execdir_dos, '/', '\\', p); p = lastchar(execdir_dos); - if (*p == '\\') *p = 0; + if (*p == '\\') + *p = 0; SAFECOPY(nodedir_dos, cfg.node_dir); REPLACE_CHARS(nodedir_dos, '/', '\\', p); p = lastchar(nodedir_dos); - if (*p == '\\') *p = 0; + if (*p == '\\') + *p = 0; /* must have sbbs.ini bbs useDOSemu=1 (or empty), cannot be =0 */ if (!startup->usedosemu) { @@ -1370,13 +1374,17 @@ int sbbs_t::external(const char* cmdline, int mode, const char* startup_dir) errormsg(WHERE, ERR_READ, str, 0); return -1; } - else SAFECOPY(dosemuconf, str); /* using system conf */ + else + SAFECOPY(dosemuconf, str); /* using system conf */ } - else SAFECOPY(dosemuconf, str); /* using system conf */ + else + SAFECOPY(dosemuconf, str); /* using system conf */ } - else SAFECOPY(dosemuconf, str); /* using global conf */ + else + SAFECOPY(dosemuconf, str); /* using global conf */ } - else SAFECOPY(dosemuconf, str); /* using door-specific conf */ + else + SAFECOPY(dosemuconf, str); /* using door-specific conf */ /* Create the external bat here to be placed in the node dir. */ SAFEPRINTF2(str, "%s%s", cfg.node_dir, external_bat_fn); diff --git a/src/sbbs3/xtrn_sec.cpp b/src/sbbs3/xtrn_sec.cpp index bfcab11a1a732bcace0b102a7c4c6014184c2052..dfd53c45d928df7bbc14c30c4115911e22fbf357 100644 --- a/src/sbbs3/xtrn_sec.cpp +++ b/src/sbbs3/xtrn_sec.cpp @@ -75,7 +75,8 @@ time_t juliantounix(uint j) int leap, counter; struct tm tm; - if (!j) return 0L; + if (!j) + return 0L; tm.tm_year = ((100L * j) / 36525L) - 1900; temp = (long)date.da_year * 36525L; @@ -86,7 +87,8 @@ time_t juliantounix(uint j) j++; leap = 1; } - else leap = 0; + else + leap = 0; for (date.da_mon = counter = 0; counter < 12; counter++) if (days[leap][counter] < j) @@ -564,11 +566,16 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, uint tle exitinfo.UserInfo.LastTime = tmp; SAFEPRINTF3(tmp, "%02u/%02u/%02u", TM_MONTH(tm.tm_mon), tm.tm_mday, TM_YEAR(tm.tm_year)); exitinfo.UserInfo.LastDate = tmp; - if (useron.misc & DELETED) exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_DELETED; - if (useron.misc & CLRSCRN) exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_CLRSCRN; - if (useron.misc & UPAUSE) exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_MORE; - if (term & ANSI) exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_ANSI; - if (useron.sex == 'F') exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_FEMALE; + if (useron.misc & DELETED) + exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_DELETED; + if (useron.misc & CLRSCRN) + exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_CLRSCRN; + if (useron.misc & UPAUSE) + exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_MORE; + if (term & ANSI) + exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_ANSI; + if (useron.sex == 'F') + exitinfo.UserInfo.Attrib |= QBBS::USER_ATTRIB_FEMALE; exitinfo.UserInfo.Flags = useron.flags1; exitinfo.UserInfo.TimesPosted = useron.posts; exitinfo.UserInfo.SecLvl = useron.level; @@ -611,7 +618,8 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, uint tle return; } - if (online == ON_LOCAL) i = 5; + if (online == ON_LOCAL) + i = 5; else switch (dte_rate) { case 300: @@ -736,7 +744,8 @@ void sbbs_t::xtrndat(const char *name, const char *dropdir, uchar type, uint tle sys.UserRecNo = useron.number; SAFECOPY(tmp, name); p = strchr(tmp, ' '); - if (p) *p = 0; + if (p) + *p = 0; sys.FirstName = tmp; sys.Password = useron.pass; if (localtime_r(&logontime, &tm) != NULL) diff --git a/src/sbbs3/zmodem.c b/src/sbbs3/zmodem.c index 9dfb80e34cc498b672ad242a186b231d0d661ed4..2794cf98e8052a82a7e780c9ebea131b2b24536e 100644 --- a/src/sbbs3/zmodem.c +++ b/src/sbbs3/zmodem.c @@ -2022,7 +2022,8 @@ int zmodem_recv_files(zmodem_t* zm, const char* download_dir, uint64_t* bytes_re while (zmodem_recv_init(zm) == ZFILE) { bytes = zm->current_file_size; kbytes = bytes / 1024; - if (kbytes < 1) kbytes = 0; + if (kbytes < 1) + kbytes = 0; lprintf(zm, LOG_INFO, "Downloading %s (%" PRId64 " KBytes) via ZMODEM", zm->current_file_name, kbytes); do { /* try */ diff --git a/src/smblib/smballoc.c b/src/smblib/smballoc.c index 89f47349e40a85a29a2948a10bc190a01b6e64dd..974b9dfa8d4dbf8178cdcd7ab2e84407c60d60f7 100644 --- a/src/smblib/smballoc.c +++ b/src/smblib/smballoc.c @@ -49,8 +49,10 @@ off_t smb_allocdat(smb_t* smb, off_t length, uint16_t refs) if (smb_fread(smb, &i, sizeof(i), smb->sda_fp) != sizeof(i)) break; offset += SDT_BLOCK_LEN; - if (!i) j++; - else j = 0; + if (!i) + j++; + else + j = 0; if (j == blocks) { offset -= (blocks * SDT_BLOCK_LEN); break; @@ -398,8 +400,10 @@ off_t smb_allochdr(smb_t* smb, uint length) if (smb_fread(smb, &c, sizeof(c), smb->sha_fp) != sizeof(c)) break; offset += SHD_BLOCK_LEN; - if (!c) i++; - else i = 0; + if (!c) + i++; + else + i = 0; if (i == blocks) { offset -= (blocks * SHD_BLOCK_LEN); break; diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c index 0e3527cfde56527e7cb86b881c46878faf8312a6..c7e322663320b71840890b513109b59ddf154159 100644 --- a/src/smblib/smblib.c +++ b/src/smblib/smblib.c @@ -1090,9 +1090,12 @@ int smb_getmsghdr(smb_t* smb, smbmsg_t* msg) } /* These convenience pointers must point to something */ - if (msg->from == NULL) msg->from = nulstr; - if (msg->to == NULL) msg->to = nulstr; - if (msg->subj == NULL) msg->subj = nulstr; + if (msg->from == NULL) + msg->from = nulstr; + if (msg->to == NULL) + msg->to = nulstr; + if (msg->subj == NULL) + msg->subj = nulstr; /* If no reverse path specified, use sender's address */ if (msg->reverse_path == NULL && msg->from_net.type == NET_INTERNET) diff --git a/src/uifc/filepick.c b/src/uifc/filepick.c index aab375832bb6c4d239d30b93d8139107cba271b1..1f5f19409b655116d550980a76ed57cc479dcf70 100644 --- a/src/uifc/filepick.c +++ b/src/uifc/filepick.c @@ -132,9 +132,9 @@ char *insensitive_mask(char *mask) *(out++) = *in; } *out = 0; - return(nmask); + return nmask; #else - return(mask); + return mask; #endif } @@ -146,7 +146,7 @@ char **get_file_opt_list(char **fns, int files, int dirsonly, int root) opts = (char **)malloc((files + 2) * sizeof(char *)); if (opts == NULL) - return(NULL); + return NULL; memset(opts, 0, (files + 2) * sizeof(char *)); if (dirsonly) { if (!root) @@ -163,7 +163,7 @@ char **get_file_opt_list(char **fns, int files, int dirsonly, int root) } } opts[j] = ""; - return(opts); + return opts; } void display_current_path(uifcapi_t *api, char *path) @@ -247,7 +247,7 @@ int mousetofield(uifcapi_t* api, int currfield, int opts, int height, int width, ungetmouse(&mevnt); } } - return(newfield); + return newfield; } int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char *msk, int opts) @@ -299,11 +299,11 @@ int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char /* No struct passed */ if (fp == NULL) - return(-1); + return -1; /* Illegal options */ if ((opts & UIFC_FP_MULTI) == UIFC_FP_MULTI && (opts & (UIFC_FP_ALLOWENTRY | UIFC_FP_OVERPROMPT | UIFC_FP_CREATPROMPT))) - return(-1); + return -1; if (opts & UIFC_FP_DIRSEL) currfield = lastfield = DIR_LIST; @@ -709,7 +709,7 @@ cleanup: /* Cleans up allocated variables returns from function */ FREE_AND_NULL(tmplastpath); free_opt_list(&file_list); free_opt_list(&dir_list); - return(retval); + return retval; } int filepick_free(struct file_pick *fp) @@ -720,5 +720,5 @@ int filepick_free(struct file_pick *fp) FREE_AND_NULL(fp->selected[i]); } FREE_AND_NULL(fp->selected); - return(0); + return 0; } diff --git a/src/uifc/uifc32.c b/src/uifc/uifc32.c index dbfc53d5f4b481e340368618f586a6b162407c4a..b17af7616979f960c8064aaa247024cd0d936955 100644 --- a/src/uifc/uifc32.c +++ b/src/uifc/uifc32.c @@ -180,10 +180,10 @@ int kbwait(void) { int timeout = 0; while (timeout++ < 50) { if (kbhit()) - return(TRUE); + return TRUE; mswait(1); } - return(FALSE); + return FALSE; } static int @@ -203,7 +203,7 @@ int inkey(void) if (c == CIO_KEY_LITERAL_E0) c = 0xe0; } - return(c); + return c; } int uifcini32(uifcapi_t* uifcapi) @@ -212,7 +212,7 @@ int uifcini32(uifcapi_t* uifcapi) struct text_info txtinfo; if (uifcapi == NULL || uifcapi->size != sizeof(uifcapi_t)) - return(-1); + return -1; api = uifcapi; if (api->chars == NULL) @@ -288,7 +288,7 @@ int uifcini32(uifcapi_t* uifcapi) uifcbail(); printf("\r\nUIFC: Screen length (%u) must be %d lines or greater\r\n" , api->scrn_len, MIN_LINES); - return(-2); + return -2; } api->scrn_len--; /* account for status line */ @@ -296,7 +296,7 @@ int uifcini32(uifcapi_t* uifcapi) uifcbail(); printf("\r\nUIFC: Screen width (%u) must be at least 40 characters\r\n" , txtinfo.screenwidth); - return(-3); + return -3; } api->scrn_width = txtinfo.screenwidth; @@ -328,17 +328,17 @@ int uifcini32(uifcapi_t* uifcapi) if ((blk_scrn = (struct vmem_cell *)malloc(blk_scrn_len * sizeof(*blk_scrn))) == NULL) { cprintf("UIFC line %d: error allocating %u bytes." , __LINE__, blk_scrn_len * sizeof(*blk_scrn)); - return(-1); + return -1; } if ((tmp_buffer = (struct vmem_cell *)malloc(blk_scrn_len * sizeof(*blk_scrn))) == NULL) { cprintf("UIFC line %d: error allocating %u bytes." , __LINE__, blk_scrn_len * sizeof(*blk_scrn)); - return(-1); + return -1; } if ((tmp_buffer2 = (struct vmem_cell *)malloc(blk_scrn_len * sizeof(*blk_scrn))) == NULL) { cprintf("UIFC line %d: error allocating %u bytes." , __LINE__, blk_scrn_len * sizeof(*blk_scrn)); - return(-1); + return -1; } for (i = 0; i < blk_scrn_len; i++) { blk_scrn[i].legacy_attr = api->cclr | (api->bclr << 4); @@ -369,7 +369,7 @@ int uifcini32(uifcapi_t* uifcapi) api->initialized = TRUE; - return(0); + return 0; } static BOOL restore(void) @@ -509,30 +509,30 @@ static int uifc_getmouse(struct mouse_event *mevent) if (api->mode & UIFC_MOUSE) { getmouse(mevent); if (mevent->event == CIOLIB_BUTTON_3_CLICK) - return(ESC); + return ESC; if (mevent->event == CIOLIB_BUTTON_1_DRAG_START) { docopy(); - return(0); + return 0; } if (mevent->starty == api->buttony) { if (mevent->startx >= api->exitstart && mevent->startx <= api->exitend && mevent->event == CIOLIB_BUTTON_1_CLICK) { - return(ESC); + return ESC; } if (mevent->startx >= api->helpstart && mevent->startx <= api->helpend && mevent->event == CIOLIB_BUTTON_1_CLICK) { - return(CIO_KEY_F(1)); + return CIO_KEY_F(1); } } if (mevent->event == CIOLIB_BUTTON_4_PRESS) - return(CIO_KEY_UP); + return CIO_KEY_UP; if (mevent->event == CIOLIB_BUTTON_5_PRESS) - return(CIO_KEY_DOWN); - return(0); + return CIO_KEY_DOWN; + return 0; } - return(-1); + return -1; } void uifcbail(void) @@ -563,12 +563,12 @@ int uscrn(const char *str) gotoxy(3, 1); cputs(str); if (!vmem_puttext(1, 2, api->scrn_width, api->scrn_len, blk_scrn)) - return(-1); + return -1; gotoxy(1, api->scrn_len + 1); clreol(); reset_dynamic(); setname(str); - return(0); + return 0; } /****************************************************************************/ @@ -674,7 +674,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar uchar hclr, lclr, bclr, cclr, lbclr; BOOL shadow = api->scrn_width >= 80; - if (cur == NULL) cur = &tmpcur; + if (cur == NULL) + cur = &tmpcur; hclr = api->hclr; lclr = api->lclr; bclr = api->bclr; @@ -713,7 +714,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar while (option != NULL && opts < MAX_OPTS) { if (option[opts] == NULL || (!(mode & WIN_BLANKOPTS) && option[opts][0] == 0)) break; - else opts++; + else + opts++; } if (mode & WIN_XTR && opts < MAX_OPTS) opts++; @@ -845,7 +847,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar free(title); if (!(api->mode & UIFC_NHM)) uifc_mouse_enable(); - return(-1); + return -1; } win_t* s = &sav[api->savnum]; s->left = s_left + left; @@ -870,7 +872,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar free(title); if (!(api->mode & UIFC_NHM)) uifc_mouse_enable(); - return(-1); + return -1; } win_t* s = &sav[api->savnum]; s->left = s_left + left; @@ -1124,7 +1126,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar uifc_mouse_enable(); if (mode & WIN_IMM) { - return(-2); + return -2; } if (mode & WIN_ORG) { @@ -1181,7 +1183,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar , __LINE__, (width + 3) * (height + 2) * sizeof(*win)); if (!(api->mode & UIFC_NHM)) uifc_mouse_enable(); - return(-1); + return -1; } inactive_win(win, s_left + left, s_top + top, s_left + left + width - 1, s_top + top + height - 1, y, hbrdrsize, cclr, lclr, hclr, top); free(win); @@ -1196,8 +1198,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar uifc_mouse_enable(); } if (mode & WIN_XTR && (*cur) == opts - 1) - return(MSK_INS | *cur); - return(*cur); + return MSK_INS | *cur; + return *cur; } /* Clicked Scroll Up */ else if (mevnt.startx == s_left + left + lbrdrwidth @@ -1610,22 +1612,22 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar else if (mode & WIN_SAV) { restore(); } - return((*cur) | MSK_EDIT); + return (*cur) | MSK_EDIT; } break; case CIO_KEY_F(5): /* F5 - Copy */ case CIO_KEY_CTRL_IC: /* Ctrl-Insert */ if (mode & WIN_COPY && !(mode & WIN_XTR && (*cur) == opts - 1)) - return((*cur) | MSK_COPY); + return (*cur) | MSK_COPY; break; case CIO_KEY_SHIFT_DC: /* Shift-Del: Cut */ if (mode & WIN_CUT && !(mode & WIN_XTR && (*cur) == opts - 1)) - return((*cur) | MSK_CUT); + return (*cur) | MSK_CUT; break; case CIO_KEY_SHIFT_IC: /* Shift-Insert: Paste */ case CIO_KEY_F(6): /* F6 - Paste */ if (mode & WIN_PASTE && (mode & WIN_PASTEXTR || !(mode & WIN_XTR && (*cur) == opts - 1))) - return((*cur) | MSK_PASTE); + return (*cur) | MSK_PASTE; break; case CIO_KEY_IC: /* insert */ if (mode & WIN_INS) { @@ -1637,9 +1639,9 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar restore(); } if (!opts) { - return(MSK_INS); + return MSK_INS; } - return((*cur) | MSK_INS); + return (*cur) | MSK_INS; } break; case CIO_KEY_DC: /* delete */ @@ -1653,12 +1655,12 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar else if (mode & WIN_SAV) { restore(); } - return((*cur) | MSK_DEL); + return (*cur) | MSK_DEL; } break; default: if (mode & WIN_EXTKEYS) - return(-2 - gotkey); + return -2 - gotkey; break; } } @@ -1686,8 +1688,10 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar && strlen(option[j]) > (size_t)b && ((!a && s && !strnicmp(option[j] + b, search, s + 1)) || ((a || !s) && toupper(option[j][b]) == toupper(gotkey)))) { - if (a) s = 0; - else s++; + if (a) + s = 0; + else + s++; if (y + (j - (*cur)) + 2 > height + top) { (*cur) = j; gotoxy(s_left + left + lbrdrwidth, s_top + top + tbrdrwidth); @@ -1776,8 +1780,8 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar restore(); } if (mode & WIN_XTR && (*cur) == opts - 1) - return(MSK_INS | *cur); - return(*cur); + return MSK_INS | *cur; + return *cur; case 3: case ESC: if (mode & WIN_SAV) @@ -1793,7 +1797,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar else if (mode & WIN_SAV) { restore(); } - return(-1); + return -1; case CTRL_F: /* find */ case CTRL_G: if (/*!(api->mode&UIFC_NOCTRL)*/ 1) { // No no, *this* control key is fine! @@ -1876,7 +1880,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar break; default: if (mode & WIN_EXTKEYS) - return(-2 - gotkey); + return -2 - gotkey; } } /* Update the status bar to reflect the Put/Paste option applicability */ @@ -1899,7 +1903,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar else save_menu_bar = -1; save_menu_opts = opts; - return(-2 - gotkey); + return -2 - gotkey; } } } @@ -2073,7 +2077,7 @@ int uinput(uifc_winmode_t mode, int left, int top, const char *inprompt, char *s vmem_puttext(1, api->scrn_len + 1, api->scrn_width, api->scrn_len + 1, save_bottomline); } free(prompt); - return(i); + return i; } /****************************************************************************/ @@ -2194,7 +2198,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int cprintf("UIFC line %d: error allocating %u bytes\r\n" , __LINE__, (max + 1)); _setcursortype(cursor); - return(-1); + return -1; } gotoxy(left, top); set_cursor_type(api); @@ -2237,7 +2241,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int if (lastkey) *lastkey = CIO_KEY_MOUSE; ungetmouse(&mevnt); - return(j); + return j; } if (mevnt.startx >= left && mevnt.startx <= left + width @@ -2295,7 +2299,8 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int ch = 0; while (ch != CR) { - if (i > j) j = i; + if (i > j) + j = i; str[j] = 0; getstrupd(left, top, width, str, i, &soffset, mode); if (f || pb != NULL || (ch = inkey()) != 0) @@ -2457,7 +2462,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int free(pastebuf); pastebuf = NULL; } - return(-1); + return -1; } case CR: break; @@ -2549,7 +2554,7 @@ int ugetstr(int left, int top, int width, char *outstr, int max, long mode, int _setcursortype(cursor); if (pastebuf != NULL) free(pastebuf); - return(j); + return j; } /****************************************************************************/ @@ -2568,7 +2573,7 @@ static int uprintf(int x, int y, unsigned attr, char *fmat, ...) for (i = 0; str[i]; i++) set_vmem(&buf[i], str[i], attr, 0); vmem_puttext(x, y, x + (i - 1), y, buf); - return(i); + return i; } @@ -2730,7 +2735,7 @@ char *utimestr(time_t *intime) } safe_snprintf(str, sizeof(str), "%s %s %02d %4d %02d:%02d %s", wday, mon, gm->tm_mday, 1900 + gm->tm_year , hour, gm->tm_min, mer); - return(str); + return str; } /****************************************************************************/ diff --git a/src/uifc/uifctest.c b/src/uifc/uifctest.c index 054ac7a16cec7041de70723f650e3a511c4405d3..7e2c260acb48b413c58386098a230f98f731a43f 100644 --- a/src/uifc/uifctest.c +++ b/src/uifc/uifctest.c @@ -135,7 +135,7 @@ int main(int argc, char** argv) { sprintf(title, "Synchronet Test Suite"); if (uifc.scrn(title)) { printf(" USCRN (len=%d) failed!\n", uifc.scrn_len + 1); - return(1); + return 1; } strcpy(mopt[0], "Long Title"); @@ -155,7 +155,7 @@ int main(int argc, char** argv) { if (j == -1) { uifc.bail(); - return(0); + return 0; } if (j == 0) { diff --git a/src/uifc/uifcx.c b/src/uifc/uifcx.c index cc42d50c20c05cd207df34d6bdb255bd38643b68..93a0a15c0b86bab33b1d12d8c83e9299b4e15af1 100644 --- a/src/uifc/uifcx.c +++ b/src/uifc/uifcx.c @@ -64,7 +64,7 @@ static int uprintf(int x, int y, unsigned attr, char *fmat, ...) vsprintf(str, fmat, argptr); va_end(argptr); i = printf("%s", str); - return(i); + return i; } static void showbuf(uifc_winmode_t mode, int left, int top, int width, int height @@ -83,7 +83,7 @@ int uifcinix(uifcapi_t* uifcapi) static char* yesNoOpts[] = {"Yes", "No", NULL}; if (uifcapi == NULL || uifcapi->size != sizeof(uifcapi_t)) - return(-1); + return -1; api = uifcapi; @@ -112,7 +112,7 @@ int uifcinix(uifcapi_t* uifcapi) api->scrn_width = 132; api->initialized = TRUE; - return(0); + return 0; } /****************************************************************************/ @@ -129,7 +129,7 @@ void uifcbail(void) /****************************************************************************/ int uscrn(const char *str) { - return(0); + return 0; } static int getstr(char* str, int maxlen) @@ -153,7 +153,8 @@ static int getstr(char* str, int maxlen) if (ch == '\r' || ch == '\n') /* enter */ break; if (ch == '\b' || ch == DEL) { /* backspace */ - if (len) len--; + if (len) + len--; continue; } if (len < maxlen) @@ -161,7 +162,7 @@ static int getstr(char* str, int maxlen) } str[len] = 0; /* we need The Terminator */ - return(len); + return len; } /****************************************************************************/ @@ -178,7 +179,7 @@ static int which(char* prompt, int max) getstr(str, sizeof(str) - 1); i = atoi(str); if (i > 0 && i <= max) - return(i - 1); + return i - 1; } } @@ -255,7 +256,7 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar i = atoi(str); if (i > 0 && i <= opts) { *cur = --i; - return(*cur); + return *cur; } i = atoi(str + 1); switch (toupper(*str)) { @@ -263,17 +264,17 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar case ESC: case 'Q': printf("Quit\n"); - return(-1); + return -1; case 'Y': if (!yesno) break; printf("Yes\n"); - return(0); + return 0; case 'N': if (!yesno) break; printf("No\n"); - return(1); + return 1; case 'H': case '?': printf("Help\n"); @@ -283,50 +284,50 @@ int ulist(uifc_winmode_t mode, int left, int top, int width, int *cur, int *bar if (!(mode & WIN_INS)) break; if (!opts) - return(MSK_INS); + return MSK_INS; if (i > 0 && i <= opts + 1) - return((i - 1) | MSK_INS); - return(which("Add before", opts + 1) | MSK_INS); + return (i - 1) | MSK_INS; + return which("Add before", opts + 1) | MSK_INS; case 'D': /* Delete */ if (!(mode & WIN_DEL)) break; if (!opts) break; if (i > 0 && i <= opts) - return((i - 1) | MSK_DEL); + return (i - 1) | MSK_DEL; if (opts == 1) - return(MSK_DEL); - return(which("Delete", opts) | MSK_DEL); + return MSK_DEL; + return which("Delete", opts) | MSK_DEL; case 'C': /* Copy */ if (!(mode & WIN_COPY)) break; if (!opts) break; if (i > 0 && i <= opts) - return((i - 1) | MSK_COPY); + return (i - 1) | MSK_COPY; if (opts == 1) - return(MSK_COPY); - return(which("Copy", opts) | MSK_COPY); + return MSK_COPY; + return which("Copy", opts) | MSK_COPY; case 'X': /* Cut */ if (!(mode & WIN_CUT)) break; if (!opts) break; if (i > 0 && i <= opts) - return((i - 1) | MSK_CUT); + return (i - 1) | MSK_CUT; if (opts == 1) - return(MSK_CUT); - return(which("Cut", opts) | MSK_CUT); + return MSK_CUT; + return which("Cut", opts) | MSK_CUT; case 'P': /* Paste */ if (!(mode & WIN_PASTE)) break; if (!opts) break; if (i > 0 && i <= opts + 1) - return((i - 1) | MSK_PASTE); + return (i - 1) | MSK_PASTE; if (opts == 1) - return(MSK_PASTE); - return(which("Insert pasted item before", opts + 1) | MSK_PASTE); + return MSK_PASTE; + return which("Insert pasted item before", opts + 1) | MSK_PASTE; } } } @@ -353,7 +354,7 @@ int uinput(uifc_winmode_t mode, int left, int top, const char *prompt, char *out if (kmode & K_UPPER) /* convert to uppercase? */ strupr(str); strcpy(outstr, str); - return(strlen(outstr)); + return strlen(outstr); } /****************************************************************************/ diff --git a/src/uncrustify.cfg b/src/uncrustify.cfg index 9d729e13c6c986fb84bd7b590a184cd1d4f28daf..7a2785797d2cf22e77f7d2fee007ec2ffb57eff5 100644 --- a/src/uncrustify.cfg +++ b/src/uncrustify.cfg @@ -2304,7 +2304,7 @@ nl_create_list_one_liner = false # true/false # Whether to split one-line simple unbraced if statements into two lines by # adding a newline, as in 'if(b) <here> i++;'. -nl_split_if_one_liner = false # true/false +nl_split_if_one_liner = true # true/false # Whether to split one-line simple unbraced for statements into two lines by # adding a newline, as in 'for (...) <here> stmt;'. diff --git a/src/xpdev/dat_file.c b/src/xpdev/dat_file.c index 74da2c776760e9a1312f24cd94a7c0405f71d476..54a7a8be394f0854f8618a4d9c34ab6b2c48299f 100644 --- a/src/xpdev/dat_file.c +++ b/src/xpdev/dat_file.c @@ -86,8 +86,10 @@ char* csvLineCreator(const str_list_t columns) if ((p = realloc(str, len)) == NULL) break; str = p; - if (i) strcat(str, ","); - else *str = 0; + if (i) + strcat(str, ","); + else + *str = 0; if ((val = csvEncode(columns[i])) == NULL) break; strcat(str, val); @@ -143,8 +145,10 @@ char* tabLineCreator(const str_list_t columns) if ((p = realloc(str, len)) == NULL) break; str = p; - if (i) strcat(str, "\t"); - else *str = 0; + if (i) + strcat(str, "\t"); + else + *str = 0; strcat(str, columns[i]); } diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c index facc8206fa4e270b1e25c81a4cfd52afb50dc726..30f6a3f70ad71f29825b2616594427c506e71221 100644 --- a/src/xpdev/genwrap.c +++ b/src/xpdev/genwrap.c @@ -279,7 +279,8 @@ char* c_escape_str(const char* src, char* dst, size_t maxlen, bool ctrl_only) d += strlen(d); } else if ((uchar) * s < ' ' || (uchar) * s >= '\x7f') { d += safe_snprintf(d, maxlen - (d - dst), "\\x%02X", (uchar) * s); - } else *d++ = *s; + } else + *d++ = *s; } *d = 0; diff --git a/src/xpdev/xpdatetime.c b/src/xpdev/xpdatetime.c index 8084ff476744a841fef6484df016b2fb5bea2c24..fb4dc56c3e3487e7c027045501329983d1d4ce32 100644 --- a/src/xpdev/xpdatetime.c +++ b/src/xpdev/xpdatetime.c @@ -362,7 +362,8 @@ char* xpDateTime_to_isoDateTimeStr(xpDateTime_t dt char date_str[16]; char time_str[16]; - if (datetime_sep == NULL) datetime_sep = "T"; + if (datetime_sep == NULL) + datetime_sep = "T"; snprintf(str, maxlen, "%s%s%s%s" , xpDate_to_isoDateStr(dt.date, date_sep, date_str, sizeof(date_str))