search for: stputc

Displaying 19 results from an estimated 19 matches for "stputc".

Did you mean: ustputc
2019 Jan 25
0
[klibc:update-dash] [PARSER] Handle backslash newlines properly after dollar sign
...; + if (doprompt) + setprompt(2); + } + + return c; +} + /* @@ -1179,7 +1197,7 @@ parsesub: { char *p; static const char types[] = "}-+?="; - c = pgetc(); + c = pgetc_eatbnl(); if ( (checkkwd & CHKEOFMARK) || c <= PEOA || @@ -1188,7 +1206,7 @@ parsesub: { USTPUTC('$', out); pungetc(); } else if (c == '(') { /* $(command) or $((arith)) */ - if (pgetc() == '(') { + if (pgetc_eatbnl() == '(') { PARSEARITH(); } else { pungetc(); @@ -1200,25 +1218,25 @@ parsesub: { STADJUST(1, out); subtype = VSNORMAL; i...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Handle backslash newlines properly after dollar sign
...; + if (doprompt) + setprompt(2); + } + + return c; +} + /* @@ -1179,7 +1197,7 @@ parsesub: { char *p; static const char types[] = "}-+?="; - c = pgetc(); + c = pgetc_eatbnl(); if ( (checkkwd & CHKEOFMARK) || c <= PEOA || @@ -1188,7 +1206,7 @@ parsesub: { USTPUTC('$', out); pungetc(); } else if (c == '(') { /* $(command) or $((arith)) */ - if (pgetc() == '(') { + if (pgetc_eatbnl() == '(') { PARSEARITH(); } else { pungetc(); @@ -1200,25 +1218,25 @@ parsesub: { STADJUST(1, out); subtype = VSNORMAL; i...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
..., int subtype, int startloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED | EXP_QPAT) ? - EXP_QPAT : EXP_CASE) : 0)); + EXP_CASE : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -1646,7 +1635,6 @@ char * _rmescapes(char *str, int flag) { char *p, *q, *r; - unsigned inquotes; int notescaped; int globbing; @@ -1676,24 +1664,23 @@ _rmescapes(char *str, int flag) q = mempcpy...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
..., int subtype, int startloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED | EXP_QPAT) ? - EXP_QPAT : EXP_CASE) : 0)); + EXP_CASE : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc; @@ -1646,7 +1635,6 @@ char * _rmescapes(char *str, int flag) { char *p, *q, *r; - unsigned inquotes; int notescaped; int globbing; @@ -1676,24 +1664,23 @@ _rmescapes(char *str, int flag) q = mempcpy...
2019 Jan 25
0
[klibc:update-dash] parser: use pgetc_eatbnl() in more places
...(); if (syntax == BASESYNTAX) return readtoken(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; } #endif @@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; /* continue outer loop */ case CWORD: USTPUTC(c, out); @@ -933,8 +927,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(CTLESC, out...
2020 Mar 28
0
[klibc:update-dash] dash: parser: use pgetc_eatbnl() in more places
...(); if (syntax == BASESYNTAX) return readtoken(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; } #endif @@ -916,7 +910,7 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) goto endword; /* exit outer loop */ USTPUTC(c, out); nlprompt(); - c = pgetc(); + c = syntax == SQSYNTAX ? pgetc() : pgetc_eatbnl(); goto loop; /* continue outer loop */ case CWORD: USTPUTC(c, out); @@ -933,8 +927,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) USTPUTC(CTLESC, out...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
...break; str++; - ch <<= 3; - ch += k; + c <<= 3; + c += k; } while (--i); continue; } @@ -272,7 +315,9 @@ conv_escape_str(char *str) /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); ch = c; - } while (STPUTC(ch, cp), (char)ch); + } while (STPUTC(c, cp), (char)ch); + + *sp = cp; return ch; } @@ -462,8 +507,7 @@ echocmd(int argc, char **argv) do { int c; - nonl += conv_escape_str(*argv); - outstr(stackblock(), outs); + nonl += print_escape_str("%s", NULL, NULL, *argv); if (non...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
...break; str++; - ch <<= 3; - ch += k; + c <<= 3; + c += k; } while (--i); continue; } @@ -272,7 +315,9 @@ conv_escape_str(char *str) /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); ch = c; - } while (STPUTC(ch, cp), (char)ch); + } while (STPUTC(c, cp), (char)ch); + + *sp = cp; return ch; } @@ -462,8 +507,7 @@ echocmd(int argc, char **argv) do { int c; - nonl += conv_escape_str(*argv); - outstr(stackblock(), outs); + nonl += print_escape_str("%s", NULL, NULL, *argv); if (non...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Propagate EXP_QPAT in subevalvar
...la char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & EXP_QUOTED ? EXP_QPAT : EXP_CASE) : 0)); + (flag & (EXP_QUOTED | EXP_QPAT) ? + EXP_QPAT : EXP_CASE) : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc;
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Optimise handling of backslash octals in printf
...if (k > 7) - break; - str++; - c <<= 3; - c += k; - } while (--i); - continue; - } + if (c == '0' && isodigit(*str)) + str++; /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); - ch = c; } while (STPUTC(c, cp), (char)ch); *sp = cp; @@ -326,12 +313,11 @@ conv_escape(char *str, int *conv_ch) switch (ch) { default: - case 0: - value = '\\'; - goto out; + if (!isodigit(*str)) { + value = '\\'; + goto out; + } - case '0': case '1': case '2': c...
2019 Jan 25
0
[klibc:update-dash] [PARSER] Catch variable length expansions on non-existant specials
...Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 382ddf24..382658e7 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1229,8 +1229,7 @@ varname: STPUTC(c, out); c = pgetc_eatbnl(); } while (is_digit(c)); - } - else if (is_special(c)) { + } else { int cc = c; c = pgetc_eatbnl(); @@ -1251,10 +1250,14 @@ varname: } } + if (!is_special(cc)) { + if (subtype == VSLENGTH) + subtype = 0; + goto badsub; + } +...
2019 Jan 25
0
[klibc:update-dash] parser: Fix parsing of ${}
...by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 6a8a4a43..efa8060f 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1262,7 +1262,7 @@ varname: STPUTC(c, out); c = pgetc_eatbnl(); } while (is_digit(c)); - } else { + } else if (c != '}') { int cc = c; c = pgetc_eatbnl(); @@ -1290,7 +1290,8 @@ varname: } USTPUTC(cc, out); - } + } else + goto badsub; if (subtype == 0) { int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Propagate EXP_QPAT in subevalvar
...la char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & EXP_QUOTED ? EXP_QPAT : EXP_CASE) : 0)); + (flag & (EXP_QUOTED | EXP_QPAT) ? + EXP_QPAT : EXP_CASE) : 0)); STPUTC('\0', expdest); argbackq = saveargbackq; startp = stackblock() + startloc;
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Optimise handling of backslash octals in printf
...if (k > 7) - break; - str++; - c <<= 3; - c += k; - } while (--i); - continue; - } + if (c == '0' && isodigit(*str)) + str++; /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); - ch = c; } while (STPUTC(c, cp), (char)ch); *sp = cp; @@ -326,12 +313,11 @@ conv_escape(char *str, int *conv_ch) switch (ch) { default: - case 0: - value = '\\'; - goto out; + if (!isodigit(*str)) { + value = '\\'; + goto out; + } - case '0': case '1': case '2': c...
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Catch variable length expansions on non-existant specials
...Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 382ddf24..382658e7 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1229,8 +1229,7 @@ varname: STPUTC(c, out); c = pgetc_eatbnl(); } while (is_digit(c)); - } - else if (is_special(c)) { + } else { int cc = c; c = pgetc_eatbnl(); @@ -1251,10 +1250,14 @@ varname: } } + if (!is_special(cc)) { + if (subtype == VSLENGTH) + subtype = 0; + goto badsub; + } +...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix parsing of ${}
...by: Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 6a8a4a43..efa8060f 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1262,7 +1262,7 @@ varname: STPUTC(c, out); c = pgetc_eatbnl(); } while (is_digit(c)); - } else { + } else if (c != '}') { int cc = c; c = pgetc_eatbnl(); @@ -1290,7 +1290,8 @@ varname: } USTPUTC(cc, out); - } + } else + goto badsub; if (subtype == 0) { int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: parser: Only accept single-digit parameter expansion outside of braces
...Ben Hutchings <ben at decadent.org.uk> --- usr/dash/parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/parser.c b/usr/dash/parser.c index 4bda42e8..b318b085 100644 --- a/usr/dash/parser.c +++ b/usr/dash/parser.c @@ -1268,7 +1268,7 @@ varname: do { STPUTC(c, out); c = pgetc_eatbnl(); - } while (is_digit(c)); + } while (!subtype && is_digit(c)); } else if (c != '}') { int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
...atic size_t strtodest(const char *p, int flags); static void memtodest(const char *p, size_t len, int flags); @@ -192,13 +192,11 @@ expandarg(union node *arg, struct arglist *arglist, int flag) argbackq = arg->narg.backquote; STARTSTACKSTR(expdest); argstr(arg->narg.text, flag); - p = _STPUTC('\0', expdest); - expdest = p - 1; if (arglist == NULL) { /* here document expanded */ goto out; } - p = grabstackstr(p); + p = grabstackstr(expdest); exparg.lastp = &exparg.list; /* * TODO - EXP_REDIR @@ -232,8 +230,7 @@ out: * $@ like $* since no splitting will be p...
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
hello hpa, please pull for the dash update git pull git://brane.itp.tuwien.ac.at/~mattems/klibc.git maks with this changes: Alexey Gladkov (1): Check return code for getgroups and fwrite Herbert Xu (17): Remove unnecessary truncation in _STPUTC Always call conv_escape_str in echocmd Fix \c spillage across echo commands Release 0.5.3. Make eval with empty arguments return 0 Fixed inverted char class matching Fixed command -v segmentation fault Fix mkbuiltin sort order Fix typo in comment...