Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 May 2022 09:36:07 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 46441] sh(1): Does not support PS1, PS2, PS4 parameter expansion
Message-ID:  <bug-46441-227-uDVfXva7Ve@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-46441-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-46441-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D46441

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 starte=
d */
  struct parser_temp *parser_temp;
} states[2];
static size_t current;

then referring to the fields in states[current] in place of the formerly fi=
le
scope identifiers, and also incrementing/decrementing current at the right
times.=20

But I'm not exactly sure when those are. Also, there's the problem of expde=
st
invalidation on multiple calls to expandarg.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-46441-227-uDVfXva7Ve>