1
0
Fork 0
mirror of https://github.com/vbatts/bvi.git synced 2025-07-31 14:40:27 +00:00

cleanup mixed use of tabs and spaces

still isn't 100%, but is progress

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2025-03-02 11:42:21 -05:00
parent 92a88a4b4b
commit f62d2aa929
Signed by: vbatts
GPG key ID: E30EFAA812C6E5ED
14 changed files with 176 additions and 176 deletions

View file

@ -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

View file

@ -126,7 +126,7 @@ cleartoeol()
int
vgetc()
{
return ((char)bioskey(0));
return ((char)bioskey(0));
}

16
bmore.c
View file

@ -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;

18
bmore.h
View file

@ -43,7 +43,7 @@
#if defined(__MSDOS__) && !defined(DJGPP)
# include "patchlev.h"
# include "dosconf.h"
# include <alloc.h>
# include <alloc.h>
# include <conio.h>
# include <bios.h>
#else
@ -51,21 +51,21 @@
# include "config.h"
# include <unistd.h>
# if defined HAVE_NCURSESW_CURSES_H
# include <ncursesw/curses.h>
# include <ncursesw/term.h>
# include <ncursesw/curses.h>
# include <ncursesw/term.h>
# elif defined HAVE_NCURSESW_H
# include <ncursesw.h>
# include <ncursesw.h>
# elif defined HAVE_NCURSES_CURSES_H
# include <ncurses/curses.h>
# include <ncurses/curses.h>
# elif defined HAVE_NCURSES_H
# include <ncurses.h>
# include <ncurses.h>
# elif defined HAVE_CURSES_H
# include <curses.h>
# include <curses.h>
# 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 <term.h>
# include <term.h>
# endif
#endif

2
bvi.1
View file

@ -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

12
bvi.c
View file

@ -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 {

22
comm.c
View file

@ -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) {

View file

@ -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

36
dosio.c
View file

@ -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;

94
edit.c
View file

@ -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);

4
io.c
View file

@ -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)

View file

@ -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])
]
)
]
)
]
]
)
]
)

8
re.c
View file

@ -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);

8
set.c
View file

@ -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 */
}