Displaying 8 results from an estimated 8 matches for "parsenextc".
2019 Jan 25
0
[klibc:update-dash] input: Move all input state into parsefile
...*/
- struct strpush *strpush; /* for pushing strings at this level */
- struct strpush basestrpush; /* so pushing one is fast */
-};
-
-
-int plinno = 1; /* input line number */
-int parsenleft; /* copy of parsefile->nleft */
-MKINIT int parselleft; /* copy of parsefile->lleft */
-char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
MKINIT char basebuf[IBUFSIZ]; /* buffer for top level input file */
struct parsefile *parsefile = &basepf; /* current input file */
@@ -114,10 +83,12 @@ INCLUDE "error.h"
INIT {
base...
2020 Mar 28
0
[klibc:update-dash] dash: input: Move all input state into parsefile
...*/
- struct strpush *strpush; /* for pushing strings at this level */
- struct strpush basestrpush; /* so pushing one is fast */
-};
-
-
-int plinno = 1; /* input line number */
-int parsenleft; /* copy of parsefile->nleft */
-MKINIT int parselleft; /* copy of parsefile->lleft */
-char *parsenextc; /* copy of parsefile->nextc */
MKINIT struct parsefile basepf; /* top level input file */
MKINIT char basebuf[IBUFSIZ]; /* buffer for top level input file */
struct parsefile *parsefile = &basepf; /* current input file */
@@ -114,10 +83,12 @@ INCLUDE "error.h"
INIT {
base...
2019 Jan 25
0
[klibc:update-dash] input: Remove HETIO
...input */
- new->c_lflag &= ~ECHO;
- tcsetattr(0, TCSANOW, new);
-}
-
-void input_home(int *cursor) /* Command line input routines */
-{
- while (*cursor > 0) {
- out1c('\b');
- --*cursor;
- }
- flushout(out1);
-}
-
-
-void input_delete(int cursor)
-{
- int j = 0;
-
- memmove(parsenextc + cursor, parsenextc + cursor + 1,
- BUFSIZ - cursor - 1);
- for (j = cursor; j < (BUFSIZ - 1); j++) {
- if (!*(parsenextc + j))
- break;
- else
- out1c(*(parsenextc + j));
- }
-
- out1str(" \b");
-
- while (j-- > cursor)
- out1c('\b');
- flushout(out1);
-}
-
-
-void...
2020 Mar 28
0
[klibc:update-dash] dash: input: Remove HETIO
...input */
- new->c_lflag &= ~ECHO;
- tcsetattr(0, TCSANOW, new);
-}
-
-void input_home(int *cursor) /* Command line input routines */
-{
- while (*cursor > 0) {
- out1c('\b');
- --*cursor;
- }
- flushout(out1);
-}
-
-
-void input_delete(int cursor)
-{
- int j = 0;
-
- memmove(parsenextc + cursor, parsenextc + cursor + 1,
- BUFSIZ - cursor - 1);
- for (j = cursor; j < (BUFSIZ - 1); j++) {
- if (!*(parsenextc + j))
- break;
- else
- out1c(*(parsenextc + j));
- }
-
- out1str(" \b");
-
- while (j-- > cursor)
- out1c('\b');
- flushout(out1);
-}
-
-
-void...
2019 Jan 25
0
[klibc:update-dash] input: Make preadbuffer static
...input up to the next newline, deleting nul characters.
*/
-int
-preadbuffer(void)
+static int preadbuffer(void)
{
char *q;
int more;
diff --git a/usr/dash/input.h b/usr/dash/input.h
index 775291b8..90ff6c33 100644
--- a/usr/dash/input.h
+++ b/usr/dash/input.h
@@ -52,7 +52,6 @@ extern char *parsenextc; /* next character in input buffer */
int pgetc(void);
int pgetc2(void);
-int preadbuffer(void);
void pungetc(void);
void pushstring(char *, void *);
void popstring(void);
2020 Mar 28
0
[klibc:update-dash] dash: input: Make preadbuffer static
...input up to the next newline, deleting nul characters.
*/
-int
-preadbuffer(void)
+static int preadbuffer(void)
{
char *q;
int more;
diff --git a/usr/dash/input.h b/usr/dash/input.h
index 775291b8..90ff6c33 100644
--- a/usr/dash/input.h
+++ b/usr/dash/input.h
@@ -52,7 +52,6 @@ extern char *parsenextc; /* next character in input buffer */
int pgetc(void);
int pgetc2(void);
-int preadbuffer(void);
void pungetc(void);
void pushstring(char *, void *);
void popstring(void);
2019 Jan 25
0
[klibc:update-dash] input: Allow two consecutive calls to pungetc
...53,6 +364,8 @@ popstring(void)
}
parsefile->nextc = sp->prevstring;
parsefile->nleft = sp->prevnleft;
+ parsefile->unget = sp->unget;
+ memcpy(parsefile->lastc, sp->lastc, sizeof(sp->lastc));
/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
parsefile->strpush = sp->prev;
if (sp != &(parsefile->basestrpush))
@@ -439,6 +452,7 @@ pushfile(void)
pf->fd = -1;
pf->strpush = NULL;
pf->basestrpush.prev = NULL;
+ pf->unget = 0;
parsefile = pf;
}
diff --git a/usr/dash/input.h b/usr/dash/input.h
index...
2020 Mar 28
0
[klibc:update-dash] dash: input: Allow two consecutive calls to pungetc
...53,6 +364,8 @@ popstring(void)
}
parsefile->nextc = sp->prevstring;
parsefile->nleft = sp->prevnleft;
+ parsefile->unget = sp->unget;
+ memcpy(parsefile->lastc, sp->lastc, sizeof(sp->lastc));
/*dprintf("*** calling popstring: restoring to '%s'\n", parsenextc);*/
parsefile->strpush = sp->prev;
if (sp != &(parsefile->basestrpush))
@@ -439,6 +452,7 @@ pushfile(void)
pf->fd = -1;
pf->strpush = NULL;
pf->basestrpush.prev = NULL;
+ pf->unget = 0;
parsefile = pf;
}
diff --git a/usr/dash/input.h b/usr/dash/input.h
index...