summaryrefslogtreecommitdiff
path: root/ex/ex_append.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2026-01-14 14:57:09 +0100
committerBaptiste Daroussin <bapt@FreeBSD.org>2026-01-14 14:57:09 +0100
commit3110ba77506bf66eef114d123fd8d091d443316a (patch)
tree3e2e55d54796084a0bb75d6df87696c00a4afca9 /ex/ex_append.c
parentae7f9696aefd6ce7b024af37c4d2c32f6783d106 (diff)
Vendor import nvi 2.2.2vendor/nvi/2.2.2vendor/nvi
Diffstat (limited to 'ex/ex_append.c')
-rw-r--r--ex/ex_append.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/ex/ex_append.c b/ex/ex_append.c
index 5b9a1697e974..f7c8ac65183b 100644
--- a/ex/ex_append.c
+++ b/ex/ex_append.c
@@ -149,17 +149,15 @@ ex_aci(SCR *sp, EXCMD *cmdp, enum which cmd)
for (p = cmdp->save_cmd,
len = cmdp->save_cmdlen; len > 0; p = t) {
for (t = p; len > 0 && t[0] != '\n'; ++t, --len);
- if (t != p || len == 0) {
- if (F_ISSET(sp, SC_EX_GLOBAL) &&
- t - p == 1 && p[0] == '.') {
- ++t;
- if (len > 0)
- --len;
- break;
- }
- if (db_append(sp, 1, lno++, p, t - p))
- return (1);
+ if (F_ISSET(sp, SC_EX_GLOBAL) &&
+ t - p == 1 && p[0] == '.') {
+ ++t;
+ if (len > 0)
+ --len;
+ break;
}
+ if (db_append(sp, 1, lno++, p, t - p))
+ return (1);
if (len != 0) {
++t;
if (--len == 0 &&
@@ -181,6 +179,9 @@ ex_aci(SCR *sp, EXCMD *cmdp, enum which cmd)
if (len != 0)
cmdp->save_cmd = t;
cmdp->save_cmdlen = len;
+ } else if (cmdp->trailing) {
+ if (db_append(sp, 1, lno++, NULL, 0))
+ return 1;
}
if (F_ISSET(sp, SC_EX_GLOBAL)) {