summaryrefslogtreecommitdiffstats
path: root/term-utils/script.c
Commit message (Collapse)AuthorAgeFilesLines
...
* docs: fix "behaviour" vs. "behavior"Karel Zak2014-06-061-1/+1
| | | | | | | | Sometimes we use "behaviour" and "behavior" in the same text, let's use "behavior" only everywhere. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1011068 Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix spurious exit from input read loop on EINTR.Csaba Kos2014-06-021-1/+2
|
* script: fix a rare deadlock after child terminationCsaba Kos2014-06-021-8/+45
|
* script: time from end of read() call partially fixes #58Wolfgang Richter2014-03-201-2/+3
|
* script: clean up files usageKarel Zak2014-02-211-28/+40
| | | | | | | | | | | | | | | * don't initialize timingfd (to stderr) when -t not specified * care about timingfd dooutput() rather in main() * make timingdf gloval like fscript FILE * close all in done() * close irrelevant things in subshell and input processes Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* script: Also flush writes to timing file.Jesper Dahl Nyerup2014-02-211-1/+4
| | | | | | | | | If both -f and -t are given, flush the timing fd on each write, similar to the behavior on the script fd. This allows playback of still-running sessions, and reduces the risk of ending up with empty timing files when script(1) exits abnormally. Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
* script: use all-io.h to make the code more robustKarel Zak2014-01-161-9/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix inconsistent -q, use poll() rather then O_NONBLOCKKarel Zak2014-01-161-25/+17Star
| | | | | | | | | - 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>
* script: don't wait for empty descriptors if child is deadKarel Zak2014-01-161-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>
* script: script input redirection / eof handlingKarel Zak2013-12-031-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>
* script: check that stdin is a terminalKarel Zak2013-12-021-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: restore errno in signal handlerKarel Zak2013-11-141-0/+3
| | | | | References: https://plus.google.com/+LennartPoetteringTheOneAndOnly/posts/gHSscCJkakd Signed-off-by: Karel Zak <kzak@redhat.com>
* script: don't call TIOCGWINSZ in signal handlerKarel Zak2013-11-141-3/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: use __noreturn__ for really last function [clang -Winvalid-noreturn]Karel Zak2013-03-201-4/+4
| | | | | | Use 'noreturn' for done() only. Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* script: search shell from path, when necessarySami Kerola2013-01-091-5/+11
| | | | | Addresses: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518532 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: do not try to close stderr twiceSami Kerola2012-11-081-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>
* script: add noreturn function attributesSami Kerola2012-07-261-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify file open error messagesSami Kerola2012-07-161-3/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: remove unused codeKarel Zak2012-06-211-10/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build: fix redundant redeclaration warningsSami Kerola2012-06-111-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* term-utils: verify writing to streams was successfulSami Kerola2012-04-041-4/+12
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: error in usage() outputSami Kerola2012-04-021-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>
* script: play well with csh when invoked from within /etc/csh.loginKarel Zak2012-03-081-0/+10
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797888 Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola2011-12-021-8/+4Star
| | | | | | | | | | 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>
* build-sys: check HAVE_ definitions with #ifdef [smatch scan]Sami Kerola2011-12-021-3/+7
| | | | | | Fix to `warning: undefined preprocessor identifier' messages. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: non-ANSI definition [smatch scan]Karel Zak2011-09-121-7/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: libintl.h included in nls.hKarel Zak2011-09-071-3/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix building with --disable-nlsNatanael Copa2011-09-071-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>
* script: cleanup usage()Karel Zak2011-08-161-10/+9Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: indicate that the file argument to --timing is optionalBenno Schulenberg2011-08-151-4/+4
| | | | | | Also improve some other descriptions in the usage message. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* script: remove magic constants and a type mismatch fixSami Kerola2011-06-291-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>
* script: include-what-you-use header checkSami Kerola2011-06-291-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>
* script: remove unnecessary void castingSami Kerola2011-06-291-28/+28
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: option --force addedSami Kerola2011-06-291-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>
* script: optional timing output file argument addedSami Kerola2011-04-121-7/+12
| | | | | | And update to manual page accordingly. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* script: don't include err.h directlyKarel Zak2011-04-121-1/+1
|
* move struct option to .rodataKarel Zak2011-03-031-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>
* build-sys: move script and scriptreplay to term-utils/Karel Zak2011-03-021-0/+546
Signed-off-by: Karel Zak <kzak@redhat.com>