summaryrefslogtreecommitdiff
path: root/usr.bin/vi/ex/ex_argv.c
diff options
context:
space:
mode:
authormichaels <michaels@cvs.openbsd.org>1996-10-16 01:19:02 +0000
committermichaels <michaels@cvs.openbsd.org>1996-10-16 01:19:02 +0000
commitbbac58ea85fcdd5f15449819005e17cd93c3e14a (patch)
tree46cac5bf539a167855f9d647a2047e9d9fe89608 /usr.bin/vi/ex/ex_argv.c
parentbdd4fa6809d3bd31f8890df0ca821dcfd660042f (diff)
nvi 1.78:
+ Fix bugs when both the leftright scrolling and number edit options were on. + Fix bug where splitting in the middle of the screen could repaint incorrectly. + Fix first-nul in input bug, where random garbage was inserted. + Correct search and mark-as-motion-command bug, it's a line mode action if the search starts at or before the first non<blank>. + Fix bug autoindent bug, where ^D could shift too far in the line. + Fix core dump where ! command called from the .exrc file. + Add the -S command-line option, which initializes vi to have the secure edit option preset.
Diffstat (limited to 'usr.bin/vi/ex/ex_argv.c')
-rw-r--r--usr.bin/vi/ex/ex_argv.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/vi/ex/ex_argv.c b/usr.bin/vi/ex/ex_argv.c
index 1930bf145d0..cc5a201bea2 100644
--- a/usr.bin/vi/ex/ex_argv.c
+++ b/usr.bin/vi/ex/ex_argv.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)ex_argv.c 10.25 (Berkeley) 8/13/96";
+static const char sccsid[] = "@(#)ex_argv.c 10.26 (Berkeley) 9/20/96";
#endif /* not lint */
#include <sys/types.h>
@@ -325,7 +325,7 @@ argv_fexp(sp, excp, cmd, cmdlen, p, lenp, bpp, blenp, is_bang)
{
EX_PRIVATE *exp;
char *bp, *t;
- size_t blen, len, tlen;
+ size_t blen, len, off, tlen;
/* Replace file name characters. */
for (bp = *bpp, blen = *blenp, len = *lenp; cmdlen > 0; --cmdlen, ++cmd)
@@ -340,7 +340,9 @@ argv_fexp(sp, excp, cmd, cmdlen, p, lenp, bpp, blenp, is_bang)
return (1);
}
len += tlen = strlen(exp->lastbcomm);
+ off = p - bp;
ADD_SPACE_RET(sp, bp, blen, len);
+ p = bp + off;
memcpy(p, exp->lastbcomm, tlen);
p += tlen;
F_SET(excp, E_MODIFY);
@@ -353,7 +355,9 @@ argv_fexp(sp, excp, cmd, cmdlen, p, lenp, bpp, blenp, is_bang)
}
tlen = strlen(t);
len += tlen;
+ off = p - bp;
ADD_SPACE_RET(sp, bp, blen, len);
+ p = bp + off;
memcpy(p, t, tlen);
p += tlen;
F_SET(excp, E_MODIFY);
@@ -365,7 +369,9 @@ argv_fexp(sp, excp, cmd, cmdlen, p, lenp, bpp, blenp, is_bang)
return (1);
}
len += tlen = strlen(t);
+ off = p - bp;
ADD_SPACE_RET(sp, bp, blen, len);
+ p = bp + off;
memcpy(p, t, tlen);
p += tlen;
F_SET(excp, E_MODIFY);
@@ -385,13 +391,17 @@ argv_fexp(sp, excp, cmd, cmdlen, p, lenp, bpp, blenp, is_bang)
/* FALLTHROUGH */
default:
ins_ch: ++len;
+ off = p - bp;
ADD_SPACE_RET(sp, bp, blen, len);
+ p = bp + off;
*p++ = *cmd;
}
/* Nul termination. */
++len;
+ off = p - bp;
ADD_SPACE_RET(sp, bp, blen, len);
+ p = bp + off;
*p = '\0';
/* Return the new string length, buffer, buffer length. */