From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: [PATCH 2/3] script: Initialize isterm and shell earlier in main()
Date: Tue, 10 Feb 2015 22:31:10 +0100 [thread overview]
Message-ID: <54DA789E.201@suse.cz> (raw)
isterm and shell initialized early in main() will be needed by --interactive.
---
term-utils/script.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/term-utils/script.c b/term-utils/script.c
index 14a44e1..ed8e83d 100644
--- a/term-utils/script.c
+++ b/term-utils/script.c
@@ -236,6 +236,12 @@ main(int argc, char **argv) {
argc -= optind;
argv += optind;
+ shell = getenv("SHELL");
+ if (shell == NULL)
+ shell = _PATH_BSHELL;
+
+ isterm = isatty(STDIN_FILENO);
+
if (argc > 0)
fname = argv[0];
else {
@@ -248,10 +254,6 @@ main(int argc, char **argv) {
fail();
}
- shell = getenv("SHELL");
- if (shell == NULL)
- shell = _PATH_BSHELL;
-
getmaster();
if (!qflg)
printf(_("Script started, file is %s\n"), fname);
@@ -635,8 +637,6 @@ getmaster(void) {
#if defined(HAVE_LIBUTIL) && defined(HAVE_PTY_H)
int rc;
- isterm = isatty(STDIN_FILENO);
-
if (isterm) {
if (tcgetattr(STDIN_FILENO, &tt) != 0)
err(EXIT_FAILURE, _("failed to get terminal attributes"));
--
2.2.2
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
reply other threads:[~2015-02-10 21:31 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=54DA789E.201@suse.cz \
--to=sbrabec@suse.cz \
--cc=util-linux@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.