[Bug 46441] sh(1): Does not support PS1, PS2, PS4 parameter expansion
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 29 May 2022 09:36:07 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=46441 Piotr Pawel Stefaniak <pstef@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pstef@freebsd.org --- Comment #13 from Piotr Pawel Stefaniak <pstef@freebsd.org> --- (In reply to Nathaniel Barragan from comment #11) I tried the naive approach to make the parser re-entrant by doing something like this static struct state { struct heredoc *heredoclist; /* list of here documents to read */ int doprompt; /* if set, prompt the user */ int needprompt; /* true if interactive and at start of line */ int lasttoken; /* last token read */ int tokpushback; /* last token pushed back */ char *wordtext; /* text of last word returned by readtoken */ int checkkwd; struct nodelist *backquotelist; union node *redirnode; struct heredoc *heredoc; int quoteflag; /* set if (part of) last token was quoted */ int startlinno; /* line # where last token started */ int funclinno; /* line # where the current function started */ struct parser_temp *parser_temp; } states[2]; static size_t current; then referring to the fields in states[current] in place of the formerly file scope identifiers, and also incrementing/decrementing current at the right times. But I'm not exactly sure when those are. Also, there's the problem of expdest invalidation on multiple calls to expandarg. -- You are receiving this mail because: You are on the CC list for the bug.