From f62d2aa9295df0fcb195922c409dd88c5d7f7145 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Sun, 2 Mar 2025 11:42:21 -0500 Subject: [PATCH] cleanup mixed use of tabs and spaces still isn't 100%, but is progress Signed-off-by: Vincent Batts --- CHANGES | 6 ++-- bm_dos.c | 2 +- bmore.c | 16 ++++----- bmore.h | 18 +++++----- bvi.1 | 2 +- bvi.c | 12 +++---- comm.c | 22 ++++++------ configure.ac | 40 +++++++++++----------- dosio.c | 36 ++++++++++---------- edit.c | 94 ++++++++++++++++++++++++++-------------------------- io.c | 4 +-- macro.m4 | 84 +++++++++++++++++++++++----------------------- re.c | 8 ++--- set.c | 8 ++--- 14 files changed, 176 insertions(+), 176 deletions(-) diff --git a/CHANGES b/CHANGES index f8dd92b..f5aff5a 100644 --- a/CHANGES +++ b/CHANGES @@ -128,9 +128,9 @@ New in release 1.3.0 * Reading of Block Special Files * New Command line options: +cmd - -b begin \ - -e end > for partial file read - -s size / + -b begin \ + -e end > for partial file read + -s size / * :e# bug fixed * Debian bug #68436 (Buffer overflow in io.c) fixed diff --git a/bm_dos.c b/bm_dos.c index 3e24af4..2853e13 100644 --- a/bm_dos.c +++ b/bm_dos.c @@ -126,7 +126,7 @@ cleartoeol() int vgetc() { - return ((char)bioskey(0)); + return ((char)bioskey(0)); } diff --git a/bmore.c b/bmore.c index 3268be5..5d2c2e4 100644 --- a/bmore.c +++ b/bmore.c @@ -493,7 +493,7 @@ main(argc, argv) break; } while ((ch1 = getc(help_file)) != EOF) - putchar(ch1); + putchar(ch1); fclose(help_file); to_print = 0; break; @@ -649,10 +649,10 @@ putline(buf, num) if (!ascii_flag) { for (print_pos = 0; print_pos < num; print_pos++) { ch = buf[print_pos]; - PRINTF("%02X ", ch); + PRINTF("%02X ", ch); } for (; print_pos < out_len; print_pos++) { - PRINTF(" "); + PRINTF(" "); } PRINTF(" "); } @@ -662,18 +662,18 @@ putline(buf, num) ++bytepos; ch = buf[print_pos]; if ((ch > 31) && (ch < 127)) { - PRINTF("%c", ch); + PRINTF("%c", ch); } else { if (r_flag) { if ((ch & 128) && ((ch > 159) && (ch < 255))) { if (!no_tty) highlight(); - PRINTF("%c", ch & 127); + PRINTF("%c", ch & 127); if (!no_tty) normal(); } else { - PRINTF("."); + PRINTF("."); } } else { - PRINTF("."); + PRINTF("."); } } } @@ -869,7 +869,7 @@ bmregexec(scan) pushback(1, --act); l--; } - } else { /* ".*" */ + } else { /* ".*" */ do { if ((test = nextchar()) == -1) return -5; *act++ = test; diff --git a/bmore.h b/bmore.h index 11ad118..8b38c2a 100644 --- a/bmore.h +++ b/bmore.h @@ -43,7 +43,7 @@ #if defined(__MSDOS__) && !defined(DJGPP) # include "patchlev.h" # include "dosconf.h" -# include +# include # include # include #else @@ -51,21 +51,21 @@ # include "config.h" # include # if defined HAVE_NCURSESW_CURSES_H -# include -# include +# include +# include # elif defined HAVE_NCURSESW_H -# include +# include # elif defined HAVE_NCURSES_CURSES_H -# include +# include # elif defined HAVE_NCURSES_H -# include +# include # elif defined HAVE_CURSES_H -# include +# include # else -# error "SysV or X/Open-compatible Curses header file required" +# error "SysV or X/Open-compatible Curses header file required" # endif # if HAVE_TERM_H -# include +# include # endif #endif diff --git a/bvi.1 b/bvi.1 index 0dadc0d..5a21f01 100644 --- a/bvi.1 +++ b/bvi.1 @@ -554,7 +554,7 @@ the file. If you use ASCII mode you can use the special characters rx replace current bte with char \*(L'x\*(R' R enter replace mode; for all subsequent input, the current byte is overwritten with the next - input character; leave replace mode with ESC. + input character; leave replace mode with ESC. .PP \fBMiscellaneous Operations:\fR TAB toggle between ASCII and HEX section diff --git a/bvi.c b/bvi.c index b96b914..7ec679b 100644 --- a/bvi.c +++ b/bvi.c @@ -756,13 +756,13 @@ calc_size(arg) switch (*poi) { case 'k': case 'K': val *= 1024; - break; + break; case 'm': case 'M': val *= 1048576; - break; + break; case 'g': - case 'G': val *= 1024*1024*1024LL; - break; + case 'G': val *= 1024*1024*1024LL; + break; case '\0': break; default: usage(); } @@ -1051,9 +1051,9 @@ range(ch) } end_addr = markbuf[mark - 'a']; if (end_addr == NULL) { - beep(); + beep(); return 0; - } + } if (end_addr < current) { return(end_addr - current); } else { diff --git a/comm.c b/comm.c index 6ec16b0..70a4be0 100644 --- a/comm.c +++ b/comm.c @@ -290,18 +290,18 @@ docmdline(cmdline) emsg(ambigous); return; } if (c_argc == 1) { - /* change '%' to Filename */ - while ((p = strchr(c_argv[0], '%')) != NULL && *(p-1) != '\\') { - if (name == NULL) { - emsg("No filename@to substitute for %"); - return; - } - *p = '\0'; - strcpy (oldbuf, c_argv[0]); - strcat (oldbuf, name); - strcat (oldbuf, p + 1); + /* change '%' to Filename */ + while ((p = strchr(c_argv[0], '%')) != NULL && *(p-1) != '\\') { + if (name == NULL) { + emsg("No filename@to substitute for %"); + return; + } + *p = '\0'; + strcpy (oldbuf, c_argv[0]); + strcat (oldbuf, name); + strcat (oldbuf, p + 1); c_argv[0] = oldbuf; - } + } } if (name == NULL && c_argc != 0) name = strdup(c_argv[0]); if (force) { diff --git a/configure.ac b/configure.ac index be763c7..1a57146 100644 --- a/configure.ac +++ b/configure.ac @@ -12,13 +12,13 @@ dnl On SunOS4 systems you have to use the /usr/5bin/cc compiler dnl to get the SYSV curses library: case "$host_os" in sunos4*) - AC_MSG_RESULT("using /usr/5bin/cc") - CC="/usr/5bin/cc" - ac_objext="o" - ;; + AC_MSG_RESULT("using /usr/5bin/cc") + CC="/usr/5bin/cc" + ac_objext="o" + ;; *) - AC_PROG_CC - ;; + AC_PROG_CC + ;; esac @@ -26,11 +26,11 @@ dnl Some curses specials dnl Solaris needs for tputs 'putc(char)' instead of 'putc(int)' case "$host_os" in solaris*) - CPPFLAGS="${CPPFLAGS} -D_MSE_INT_H" - AC_DEFINE(NEED_PUTC_CHAR) - ;; + CPPFLAGS="${CPPFLAGS} -D_MSE_INT_H" + AC_DEFINE(NEED_PUTC_CHAR) + ;; hpux9*) DEFS=${DEFS-"-DMINICURSES"} - ;; + ;; esac @@ -65,21 +65,21 @@ AC_ARG_WITH(ncurses, AC_CHECK_HEADER([ncurses.h],[ AC_SEARCH_LIBS([initscr], [ncurses], [ AC_DEFINE(HAVE_NCURSES_H) - AC_SEARCH_LIBS([tputs], [tinfo])],[ + AC_SEARCH_LIBS([tputs], [tinfo])],[ AC_SEARCH_LIBS([initscr], [curses],[ AC_DEFINE(HAVE_CURSES_H) AC_SEARCH_LIBS([tputs], [tinfo])],[ - AC_MSG_ERROR([bvi requires a curses library])])]) - ],[ + AC_MSG_ERROR([bvi requires a curses library])])]) + ],[ AC_CHECK_HEADER([curses.h],[ - AC_SEARCH_LIBS([initscr], [curses], [ - AC_DEFINE(HAVE_CURSES_H)],[ - AC_MSG_ERROR([bvi requires a curses library])])],[ + AC_SEARCH_LIBS([initscr], [curses], [ + AC_DEFINE(HAVE_CURSES_H)],[ + AC_MSG_ERROR([bvi requires a curses library])])],[ AC_CHECK_HEADER([ncursesw/curses.h], [ - AC_SEARCH_LIBS([initscr], [ncursesw], [ - AC_DEFINE(HAVE_NCURSESW_CURSES_H)],[ - AC_MSG_ERROR([bvi requires a curses library])])],[ - AC_MSG_ERROR([bvi requires a curses library])])])]) + AC_SEARCH_LIBS([initscr], [ncursesw], [ + AC_DEFINE(HAVE_NCURSESW_CURSES_H)],[ + AC_MSG_ERROR([bvi requires a curses library])])],[ + AC_MSG_ERROR([bvi requires a curses library])])])]) dnl Checks for typedefs, structures, and compiler characteristics. dnl AC_TYPE_SIZE_T diff --git a/dosio.c b/dosio.c index 078212d..fa42150 100644 --- a/dosio.c +++ b/dosio.c @@ -144,11 +144,11 @@ save(char *fname, PTR start, PTR end, int flags) } if (stat(fname, &buf) == -1) { newstr = "[New file] "; - } else { - if (S_ISDIR(buf.st_mode)) { - sprintf(string, "\"%s\" Is a directory", fname); - msg(string); - return 0; + } else { + if (S_ISDIR(buf.st_mode)) { + sprintf(string, "\"%s\" Is a directory", fname); + msg(string); + return 0; } newstr = ""; } @@ -228,7 +228,7 @@ load(char *fname) } else if (filemode == REGULAR) { memsize = buf.st_size + 100; } else { - memsize = 1000; + memsize = 1000; } if (farcoreleft() < memsize) { @@ -255,18 +255,18 @@ load(char *fname) filesize += (off_t)n; } while (filesize < buf.st_size); if ((filesize == 0) { - sprintf(string, "\"%s\" No such range: %lu-%lu", fname, - (unsigned long)block_begin, (unsigned long)(block_end)); - } else { - sprintf(string, "\"%s\" range %lu-%lu", fname, - (unsigned long)block_begin, - (unsigned long)(block_begin + filesize - 1)); - } - filemode = PARTIAL; - block_read = filesize; - msg(string); - P(P_OF) = block_begin; - params[P_OF].flags |= P_CHANGED; + sprintf(string, "\"%s\" No such range: %lu-%lu", fname, + (unsigned long)block_begin, (unsigned long)(block_end)); + } else { + sprintf(string, "\"%s\" range %lu-%lu", fname, + (unsigned long)block_begin, + (unsigned long)(block_begin + filesize - 1)); + } + filemode = PARTIAL; + block_read = filesize; + msg(string); + P(P_OF) = block_begin; + params[P_OF].flags |= P_CHANGED; } } else if (filemode == REGULAR) { chunk = buf.st_size > 0xfffe ? 0xfffe : buf.st_size; diff --git a/edit.c b/edit.c index 51184f0..03d7999 100644 --- a/edit.c +++ b/edit.c @@ -298,7 +298,7 @@ do_ft(ch, flag) switch (ch) { /* case 1: beep(); - return NULL; no previous command + return NULL; no previous command case -1: if (chp == 'f' || chp == 't') dir = BACKWARD; else dir = FORWARD; break; @@ -544,44 +544,44 @@ printline(mempos, scpos) mv_pos = AnzAdd; *linbuf = '\0'; if (hl_spat) { - f_start = (mempos - Anzahl) < mem ? mem : (mempos - Anzahl); - f_end = mempos + (2 * Anzahl); - hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); + f_start = (mempos - Anzahl) < mem ? mem : (mempos - Anzahl); + f_end = mempos + (2 * Anzahl); + hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); } for (print_pos = 0; print_pos < Anzahl; print_pos++) { if (hl_spat) { - while (hl_start != NULL) { - if (hl_start < mempos) { - if (hl_end < mempos) { - f_start = hl_start + 1; - hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); - } else { - attrset(A_STANDOUT); /* start out highlighted */ - break; - } - } else if (hl_start >= mempos) { - break; - } - } - if (hl_start != NULL) { - if ((hl_start - mempos) == print_pos) { - mvaddstr(scpos, mv_pos, linbuf); - mv_pos = AnzAdd + (3 * print_pos); - *linbuf = '\0'; - attrset(A_STANDOUT); - } - if ((hl_end - mempos) == print_pos) { - mvaddstr(scpos, mv_pos, linbuf); - *linbuf = '\0'; - mv_pos = AnzAdd + (3 * print_pos); - f_start = hl_end; - hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); - if (f_start != hl_start) { - attrset(A_NORMAL); - } - } - } + while (hl_start != NULL) { + if (hl_start < mempos) { + if (hl_end < mempos) { + f_start = hl_start + 1; + hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); + } else { + attrset(A_STANDOUT); /* start out highlighted */ + break; + } + } else if (hl_start >= mempos) { + break; + } + } + if (hl_start != NULL) { + if ((hl_start - mempos) == print_pos) { + mvaddstr(scpos, mv_pos, linbuf); + mv_pos = AnzAdd + (3 * print_pos); + *linbuf = '\0'; + attrset(A_STANDOUT); + } + if ((hl_end - mempos) == print_pos) { + mvaddstr(scpos, mv_pos, linbuf); + *linbuf = '\0'; + mv_pos = AnzAdd + (3 * print_pos); + f_start = hl_end; + hl_start = fsearch_end(f_start, f_end, search_pat, &hl_end); + if (f_start != hl_start) { + attrset(A_NORMAL); + } + } + } } if (mempos + print_pos >= maxpos) { sprintf(tmpbuf, " "); @@ -609,10 +609,10 @@ printline(mempos, scpos) addstr(string); attrset(A_NORMAL); } else { - addstr("."); + addstr("."); } } else { - addstr("."); + addstr("."); } } } else { @@ -945,15 +945,15 @@ do_ins_chg(start, arg, mode) if (base == 1) { /* ASCII */ while (*poi != '\0') { if (*poi == '\\') { - switch (*(++poi)) { - case 'n': val = '\n'; break; - case 'r': val = '\r'; break; - case 't': val = '\t'; break; - case '0': val = '\0'; break; - case '\\': val = '\\'; break; - default : val = '\\'; poi--; - } - poi++; + switch (*(++poi)) { + case 'n': val = '\n'; break; + case 'r': val = '\r'; break; + case 't': val = '\t'; break; + case '0': val = '\0'; break; + case '\\': val = '\\'; break; + default : val = '\\'; poi--; + } + poi++; } else { val = *poi++; } @@ -993,7 +993,7 @@ do_ins_chg(start, arg, mode) case U_APPEND: if ((undo_count = alloc_buf(count, &undo_buf)) == 0L) { repaint(); - goto mfree; + goto mfree; } do_append((off_t)count, tempbuf); memcpy(undo_buf, tempbuf, count); diff --git a/io.c b/io.c index aef8c4b..80dd516 100644 --- a/io.c +++ b/io.c @@ -235,7 +235,7 @@ load(fname) params[P_RO].flags |= P_CHANGED; } } else { - sysemsg(fname); + sysemsg(fname); filemode = ERROR; } } @@ -432,7 +432,7 @@ strdup(s) char *s; { char *p; - size_t n; + size_t n; n = strlen(s) + 1; if ((p = (char *)malloc(n)) != NULL) diff --git a/macro.m4 b/macro.m4 index c28ed01..c8c0698 100644 --- a/macro.m4 +++ b/macro.m4 @@ -1,59 +1,59 @@ AC_CHECK_HEADER ( - [ncurses.h], - [ + [ncurses.h], + [ AC_SEARCH_LIBS ([initscr], [ncurses], - [ - AC_DEFINE(HAVE_NCURSES_H) - AC_SEARCH_LIBS([tputs], [tinfo]) - ],[ - AC_SEARCH_LIBS - ( - [initscr], [curses], + [ + AC_DEFINE(HAVE_NCURSES_H) + AC_SEARCH_LIBS([tputs], [tinfo]) + ],[ + AC_SEARCH_LIBS + ( + [initscr], [curses], [ - AC_DEFINE(HAVE_CURSES_H) - AC_SEARCH_LIBS([tputs], [tinfo]) + AC_DEFINE(HAVE_CURSES_H) + AC_SEARCH_LIBS([tputs], [tinfo]) ],[ - AC_MSG_ERROR([bvi requires a curses library]) + AC_MSG_ERROR([bvi requires a curses library]) ] ) - ] + ] ) - ],[ + ],[ AC_CHECK_HEADER ( - [curses.h], - [ - AC_SEARCH_LIBS + [curses.h], + [ + AC_SEARCH_LIBS + ( + [initscr], [curses], + [ + AC_DEFINE(HAVE_CURSES_H) + ],[ + AC_MSG_ERROR([bvi requires a curses library]) + ] + ) + ],[ + # statt: AC_MSG_ERROR([bvi requires a curses library]) + AC_CHECK_HEADER ( - [initscr], [curses], + [ncursesw/curses.h], [ - AC_DEFINE(HAVE_CURSES_H) + AC_SEARCH_LIBS + ( + [initscr], [curses], + [ + AC_DEFINE(HAVE_NCURSESW_CURSES_H) + ],[ + AC_MSG_ERROR([bvi requires a curses library]) + ] + ) ],[ - AC_MSG_ERROR([bvi requires a curses library]) + AC_MSG_ERROR([bvi requires a curses library]) ] ) - ],[ -# statt: AC_MSG_ERROR([bvi requires a curses library]) - AC_CHECK_HEADER - ( - [ncursesw/curses.h], - [ - AC_SEARCH_LIBS - ( - [initscr], [curses], - [ - AC_DEFINE(HAVE_NCURSESW_CURSES_H) - ],[ - AC_MSG_ERROR([bvi requires a curses library]) - ] - ) - ],[ - AC_MSG_ERROR([bvi requires a curses library]) - ] - ) - ] - ) - ] + ] + ) + ] ) diff --git a/re.c b/re.c index cefd99d..54cda9b 100644 --- a/re.c +++ b/re.c @@ -332,9 +332,9 @@ AGAIN: emsg(notfound); } else { if (P(P_TE)) - sprintf(string, "No match to %s", direct == FORWARD ? "BOTTOM" : "TOP"); + sprintf(string, "No match to %s", direct == FORWARD ? "BOTTOM" : "TOP"); else - sprintf(string, "Address search hit %s without matching pattern", + sprintf(string, "Address search hit %s without matching pattern", direct == FORWARD ? "BOTTOM" : "TOP"); emsg(string); } @@ -455,9 +455,9 @@ searching(ch, line, startpos, endpos, flag) emsg(notfound); } else { if (P(P_TE)) { - sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP"); + sprintf(string, "No match to %s", sdir == FORWARD ? "BOTTOM" : "TOP"); } else { - sprintf(string, "Address search hit %s without matching pattern", + sprintf(string, "Address search hit %s without matching pattern", sdir == FORWARD ? "BOTTOM" : "TOP"); } emsg(string); diff --git a/set.c b/set.c index 19fee34..0333c3a 100644 --- a/set.c +++ b/set.c @@ -139,10 +139,10 @@ doset(arg) } else { Anzahl = P(P_CM) = ((COLS - AnzAdd - 1) / 4); } - maxx = Anzahl * 4 + AnzAdd + 1; - Anzahl3 = Anzahl * 3; - status = Anzahl3 + Anzahl - 17; - screen = Anzahl * (maxy - 1); + maxx = Anzahl * 4 + AnzAdd + 1; + Anzahl3 = Anzahl * 3; + status = Anzahl3 + Anzahl - 17; + screen = Anzahl * (maxy - 1); did_window++; stuffin("H"); /* set cursor at HOME */ }