From: Herbert Xu <herbert@gondor.apana.org.au>
To: DASH Mailing List <dash@vger.kernel.org>
Subject: [PATCH] input: Call input_init on first use
Date: Sun, 24 Aug 2025 09:51:04 +0800 [thread overview]
Message-ID: <aKpwCDa3lp4DVT4o@gondor.apana.org.au> (raw)
When the shell is used to execute another utility, it makes no
sense to initialise stdin, which costs up to two system calls.
Since the input layer can already handle first-use initialisation
because of reset_init, simply make this always the case.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/src/input.c b/src/input.c
index 1aff3d4..c36d120 100644
--- a/src/input.c
+++ b/src/input.c
@@ -77,7 +77,7 @@ MKINIT struct parsefile *toppf = &basepf;
MKINIT struct stdin_state stdin_state;
struct parsefile *parsefile = &basepf; /* current input file */
int whichprompt; /* 1 == PS1, 2 == PS2 */
-int stdin_istty;
+int stdin_istty = -1;
MKINIT void input_init(void);
@@ -99,8 +99,6 @@ INCLUDE "syntax.h"
INIT {
basepf.nextc = basepf.buf = basebuf;
basepf.linno = 1;
-
- input_init();
}
RESET {
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
reply other threads:[~2025-08-24 1:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aKpwCDa3lp4DVT4o@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=dash@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox