summaryrefslogtreecommitdiff
path: root/term-utils/script.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-16script: use all-io.h to make the code more robustKarel Zak1-9/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16script: fix inconsistent -q, use poll() rather then O_NONBLOCKKarel Zak1-25/+17
- don't suppress "Script done" message in typescript file by -q (note that -q has no effect to "Script started" message) - simplify the code by poll() Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-16script: don't wait for empty descriptors if child is deadKarel Zak1-4/+8
The current code waits for empty file master and slave descriptors, but it makes sense only if there is child process that cares (read) about data in the descriptors. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-03script: script input redirection / eof handlingKarel Zak1-19/+79
echo "ps uf" | script does not work because script assume that stdin is terminal and it does not forward EOF to the pty. This patch: * make non-tty use-case more robust (don't call tty ioclts to non-tty file descriptors. * send EOF (CTL('D') control char) to the master channel when detected eof by read() on stdin * wait for empty master and slave file descriptors to be sure that we don't miss date for typescript. This is also necessary to be sure that slave channel (shell) is completely initialized otherwise EOF is ignored. Reported-by: Phillip Susi <psusi@ubuntu.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-02script: check that stdin is a terminalKarel Zak1-0/+4
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-14script: restore errno in signal handlerKarel Zak1-0/+3
References: https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/gHSscCJkakd Signed-off-by: Karel Zak <kzak@redhat.com>
2013-11-14script: don't call TIOCGWINSZ in signal handlerKarel Zak1-3/+5
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-20script: use __noreturn__ for really last function [clang -Winvalid-noreturn]Karel Zak1-4/+4
Use 'noreturn' for done() only. Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-06textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg1-1/+1
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-01-09script: search shell from path, when necessarySami Kerola1-5/+11
Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-11-08script: do not try to close stderr twiceSami Kerola1-3/+5
The commit cdd2a8c360c70d16804ace7cc923a6c6bb7c9ca9 broke script(1) return value. $ script -e -c "echo"; echo $? 1 The reason, as Daniel it reported, was that the script will close stderr twice, once as timing file and atexit() in function close_stdout(). This commit fixes the problem. Reported-by: Daniel Narvaez <dwnarvaez@gmail.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-26script: add noreturn function attributesSami Kerola1-5/+5
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16translation: unify file open error messagesSami Kerola1-3/+3
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-21script: remove unused codeKarel Zak1-10/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-11build: fix redundant redeclaration warningsSami Kerola1-1/+0
env.c:24:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls] su.c:81:15: warning: redundant redeclaration of 'environ' [-Wredundant-decls] fstab.c:581:14: warning: redundant redeclaration of 'strsignal' [-Wredundant-decls] kill.h:1:13: note: previous declaration of 'get_pids' was here kill.c:152:13: warning: redundant redeclaration of 'get_pids' [-Wredundant-decls] kill.c:142:5: warning: redundant redeclaration of 'main' [-Wredundant-decls] getopt.c:89:5: warning: redundant redeclaration of 'main' [-Wredundant-decls] agetty.c:536:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls] agetty.c:537:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls] script.c:161:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls] wall.c:96:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls] libmount.h:362:26: note: previous declaration of 'mnt_update_get_fs' was here libmount.h:454:26: note: previous declaration of 'mnt_context_get_fs' was here mountP.h:383:26: warning: redundant redeclaration of 'mnt_context_get_fs' [-Wredundant-decls] mountP.h:398:26: warning: redundant redeclaration of 'mnt_update_get_fs' [-Wredundant-decls] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04term-utils: verify writing to streams was successfulSami Kerola1-4/+12
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-02script: error in usage() outputSami Kerola1-1/+1
Error originates to commit 3ff526391fb5c6b33418dc9cfec31c2ff9b4792e which is bit more than year, and part or releases v2.20 & v2.21. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-08script: play well with csh when invoked from within /etc/csh.loginKarel Zak1-0/+10
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797888 Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola1-8/+4
Fix to `warning: undefined preprocessor identifier' messages. [kzak@redhat.com: replace "#ifdef XXX #ifdef YYY" with "#if defined(XXX) && defined(YYY)"] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-12-02build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola1-3/+7
Fix to `warning: undefined preprocessor identifier' messages. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-12script: non-ANSI definition [smatch scan]Karel Zak1-7/+7
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07script: libintl.h included in nls.hKarel Zak1-3/+0
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07script: fix building with --disable-nlsNatanael Copa1-0/+2
We should only include the libintl.h when NLS is requested. This fixes issue when building util-linux with uClibc. Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2011-08-16script: cleanup usage()Karel Zak1-10/+9
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-15script: indicate that the file argument to --timing is optionalBenno Schulenberg1-4/+4
Also improve some other descriptions in the usage message. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2011-06-29script: remove magic constants and a type mismatch fixSami Kerola1-36/+38
The type mismatch; doinput: int -> ssize_t [kzak@redhat.com: - int -> pid_t, - remove "register" keyword] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-06-29script: include-what-you-use header checkSami Kerola1-2/+5
The tool proposed; script.c should add these lines: script.c should remove these lines: - #include <sys/file.h> // lines 53-53 - #include <sys/types.h> // lines 48-48 - #include "c.h" // lines 61-61 and the change nearly did what the tool told. We should keep on using c.h, not err.h. The config.h is not needed, it's added automaticly. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-29script: remove unnecessary void castingSami Kerola1-28/+28
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-06-29script: option --force addedSami Kerola1-7/+14
The --force will allow default output destination, e.g. typescript file, to be hard or symbolic link. [kzak@redhat.com: - remove "error:" prefix from errx()] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12script: optional timing output file argument addedSami Kerola1-7/+12
And update to manual page accordingly. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12script: don't include err.h directlyKarel Zak1-1/+1
2011-03-03move struct option to .rodataKarel Zak1-1/+1
It does not make sense to have writable large arrays of "struct option" on the stack. Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02build-sys: move script and scriptreplay to term-utils/Karel Zak1-0/+546
Signed-off-by: Karel Zak <kzak@redhat.com>