From 874d317334fae1ddce316f9b6f4d0ce4e434bf52 Mon Sep 17 00:00:00 2001 From: Thomas Ulmer Date: Tue, 23 Jun 2026 21:34:41 -0700 Subject: heirloom vi fixes from arch AUR --- ex_cmdsub.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'ex_cmdsub.c') diff --git a/ex_cmdsub.c b/ex_cmdsub.c index 6271626..7f200a8 100644 --- a/ex_cmdsub.c +++ b/ex_cmdsub.c @@ -166,10 +166,10 @@ pargs(void) if (ac != 0) putchar(' ' | QUOTE); if (ac + argc == argc0 - 1) - printf("["); + ex_printf("["); lprintf("%s", as); if (ac + argc == argc0 - 1) - printf("]"); + ex_printf("]"); as = av ? *++av : strend(as) + 1; } noonl(); @@ -299,7 +299,7 @@ join(int c) } } } - while (*cp++ = *cp1++) + while ((*cp++ = *cp1++)) if (cp > &genbuf[LBSIZE-2]) grow( "Line overflow|Result line of join would be too long", @@ -435,6 +435,7 @@ put(int unused) { register int cnt; + (void)unused; if (!FIXUNDO) error(catgets(catd, 1, 44, "Cannot put inside global/macro")); cnt = unddol - dol; @@ -473,7 +474,7 @@ pragged(int kill) getline(*unddol); if (kill) *pkill[1] = 0; - strcat(linebuf, gp); + lcat(linebuf, gp, LBSIZE); putmark(unddol); getline(dol[1]); if (kill) @@ -601,7 +602,8 @@ badtag: * Loop once for each file in tags "path". */ safecp(tagfbuf, svalue(TAGS), sizeof tagfbuf, "Tag too long"); - fne = tagfbuf - 1; + fne = tagfbuf; + fne--; #ifdef FASTTAG ft_iofbuf = smalloc(MAXBSIZE); #endif @@ -657,7 +659,7 @@ badtag: if(tgets(linebuf, LBSIZE, ft_iof)==0) goto goleft; #ifdef TDEBUG - printf("tag: %o %o %o %s\n", bot, mid, top, linebuf); + ex_printf("tag: %o %o %o %s\n", bot, mid, top, linebuf); #endif #endif while (*cp && *lp == *cp) @@ -690,11 +692,12 @@ goleft: /* name of file */ while (*cp && is_white(*cp)) cp++; - if (!*cp) + if (!*cp) { badtags: free(ft_iofbuf); serror(catgets(catd, 1, 48, "%s: Bad tags file entry"), lasttag); + } lp = filebuf; while (*cp && *cp != ' ' && *cp != '\t') { if (lp < &filebuf[sizeof filebuf - 2]) @@ -733,8 +736,8 @@ badtags: } } oglobp = globp; - strcpy(cmdbuf2, "e! "); - strcat(cmdbuf2, filebuf); + lcpy(cmdbuf2, "e! ", sizeof cmdbuf2); + lcat(cmdbuf2, filebuf, sizeof cmdbuf2); globp = cmdbuf2; d = peekc; ungetchar(0); commands(1, 1); @@ -804,7 +807,7 @@ badtags: void yank(int unused) { - + (void)unused; if (!FIXUNDO) error(catgets(catd, 1, 52, "Can't yank inside global/macro")); save12(); @@ -1286,7 +1289,7 @@ mapcmd(int un, int ab) fnkey = fkey(lhs[1] - '0'); funkey[0] = 'f'; funkey[1] = lhs[1]; funkey[2] = 0; if (fnkey) - strcpy(lhs, fnkey); + lcpy(lhs, fnkey, sizeof lhs); dname = funkey; } else { dname = lhs; @@ -1350,7 +1353,7 @@ addmac1(register char *src,register char *dest,register char *dname, * linefeed, and escape, he can screw himself. This is * so weird I don't bother to check for it. */ - if (isalpha(src[0]&0377) && src[1] || any(src[0],":")) + if ((isalpha(src[0]&0377) && src[1]) || any(src[0],":")) error(catgets(catd, 1, 64, "Too dangerous to map that")); } -- cgit v1.2.3