summaryrefslogtreecommitdiffstats
path: root/Src/input.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-06-27 05:33:04 +0000
commit346825df86466cf151be61b9429ef2c1734e66ea (patch)
treebd3e1ccd947b47f974c62b4113c5276416de2c9f /Src/input.c
parentzsh-3.1.5-pws-22 (diff)
downloadzsh-346825df86466cf151be61b9429ef2c1734e66ea.tar
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.gz
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.bz2
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.lz
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.xz
zsh-346825df86466cf151be61b9429ef2c1734e66ea.tar.zst
zsh-346825df86466cf151be61b9429ef2c1734e66ea.zip
zsh-3.1.5-pws-24zsh-3.1.5-pws-24
Diffstat (limited to 'Src/input.c')
-rw-r--r--Src/input.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/Src/input.c b/Src/input.c
index b4a6fe22d..d05c75c0b 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -186,6 +186,8 @@ ingetc(void)
inbufct--;
if (itok(lastc = STOUC(*inbufptr++)))
continue;
+ if (((inbufflags & INP_LINENO) || !strin) && lastc == '\n')
+ lineno++;
return lastc;
}
@@ -279,23 +281,20 @@ inputline(void)
zputs(ingetcline, stderr);
fflush(stderr);
}
- if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n') {
- /* We've now read a complete line. */
- lineno++;
- if (interact && isset(SUNKEYBOARDHACK) && isset(SHINSTDIN) &&
- SHTTY != -1 && *ingetcline && ingetcline[1] &&
- ingetcline[strlen(ingetcline) - 2] == '`') {
- /* Junk an unmatched "`" at the end of the line. */
- int ct;
- char *ptr;
+ if (*ingetcline && ingetcline[strlen(ingetcline) - 1] == '\n' &&
+ interact && isset(SUNKEYBOARDHACK) && isset(SHINSTDIN) &&
+ SHTTY != -1 && *ingetcline && ingetcline[1] &&
+ ingetcline[strlen(ingetcline) - 2] == '`') {
+ /* Junk an unmatched "`" at the end of the line. */
+ int ct;
+ char *ptr;
- for (ct = 0, ptr = ingetcline; *ptr; ptr++)
- if (*ptr == '`')
- ct++;
- if (ct & 1) {
- ptr[-2] = '\n';
- ptr[-1] = '\0';
- }
+ for (ct = 0, ptr = ingetcline; *ptr; ptr++)
+ if (*ptr == '`')
+ ct++;
+ if (ct & 1) {
+ ptr[-2] = '\n';
+ ptr[-1] = '\0';
}
}
isfirstch = 1;
@@ -359,6 +358,8 @@ inungetc(int c)
inbufptr--;
inbufct++;
inbufleft++;
+ if (((inbufflags & INP_LINENO) || !strin) && c == '\n')
+ lineno--;
}
#ifdef DEBUG
else if (!(inbufflags & INP_CONT)) {