Commit Graph

34 Commits

Author SHA1 Message Date
hgutch 836e5e938d Reset SIGCHLD handler to SIG_DFL.
If run with "-c", both child and parent script processes will handle
SIGCHLD resulting in a possible duplicate "Script done" line in the
output.  This fixes bin/54514.
2023-05-09 15:43:39 +00:00
christos 32f083259b 1. restore the previous finish() logic to make:
script -e -c /usr/bin/true
	script -e -c /usr/bin/false
   exit with the proper exit code.
2. handle system return value correctly (nabijaczleweli)
3. factor out the conversion of wait status -> shell return code.
2022-02-13 19:40:14 +00:00
rillig 6800db9a1f script: declare dooutput as __dead
This fixes the Clang build, which failed with:

usr.bin/script/script.c:255:1: error:
    function 'dooutput' could be declared with attribute 'noreturn'
    [-Werror,-Wmissing-noreturn]
2022-02-12 23:03:52 +00:00
christos c3c5452ebd PR/56254: RVP: Don't call non-async-signal-safe functions from signal handlers.
Establish a non-restart signal handler to avoid blocking in long I/Os.
2022-02-11 21:15:25 +00:00
christos 05daad6266 dooutput can return if finish() does not find a chile process. 2022-01-20 19:49:51 +00:00
christos eaea20be3f If -e is specified exit with the exit status of the child process in
a shell-like format (nabijaczleweli)
2022-01-16 19:04:00 +00:00
christos ac669aab65 Unlike done() childwait() returns, found by clang. 2020-08-31 15:32:15 +00:00
christos 573be1b963 PR/55605: Soumendra Ganguly: Wait for child to finish when stdin is not a tty 2020-08-28 17:10:15 +00:00
christos 22a44214b9 PR/55551 Soumendra Ganguly: Simplify tcgetattr error handling. 2020-08-08 16:01:35 +00:00
christos 503a97f998 PR/55548: Soumendra Ganguly: Since isatty(3) is implemented using
tcgetattr(3), call it directly to avoid calling it twice. This
makes error handling more precise. Also don't call err(3) when
tcsetattr(3) fails.
2020-08-07 13:36:28 +00:00
christos b131383ebe remove trailing whitespace 2020-08-03 03:34:43 +00:00
christos 4f5bb74d62 PR/55531: Soumendra Ganguly:
- add more error handling
- handle -p when not a terminal
- call termreset() before printing script done, so that it is printed correctly

Also:
- use ssize_t/size_t instead of int
- use EXIT_SUCCESS/EXIT_FAILURE
- check result of fork() against -1
2020-08-02 16:23:33 +00:00
christos d1dee1a3bd PR/55529: Soumendra Ganguly: configure the terminal in raw mode during
playback so that output postprocessing is not done and playback of programs
using curses does not appear corrupted.
2020-08-01 17:31:06 +00:00
joerg 4d72fc9046 static + __dead 2011-09-06 18:29:35 +00:00
yamt 6f8a344413 err -> errx where appropriate 2011-06-08 13:51:13 +00:00
christos 949a1d1b55 use system to parse args 2009-10-17 22:36:23 +00:00
christos ab107e386c add more features found in other unices 2009-10-17 19:05:54 +00:00
lukem 6c108bbd74 Fix WARNS=4 issues (-Wcast-qual -Wshadow) 2009-04-13 07:15:32 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
christos c3b08dc40f PR/36955: Ighighi: Use fseeko instead of fseek. 2007-09-09 12:20:27 +00:00
christos 3f074821a5 Apparently seeking forward on a FIFO does not work (why?). Read instead.
Patch from Jukka Salmi.
2007-08-20 03:44:17 +00:00
christos c40c743211 deal with non-regular files. 2007-08-19 10:31:13 +00:00
liamjfoy 4511d3297e Fix PR: 26363: script core dumps on incorrect input files.
This patch virtually re-writes the playback code and contains
improvements (mainly the dependency upon BUFSIZ being the same
size as it was wrote at).

OK: christos, joerg
2006-06-14 16:05:38 +00:00
rpaulo a0713f21de ANSIfy. de-P. 2006-03-29 15:40:49 +00:00
wiz f4128b317e Add -d to usage; use getprogname(3). From Kouichirou Hiratsuka in PR 26227. 2004-07-13 12:07:51 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
atatat 8f6bada139 Add an alternate "typescript mode" that contains timestamps and other
data interleaved between chunks of actual output (and input), and
teach script how to read the new format so that sessions can be played
back at "proper" time.
2002-06-21 18:46:31 +00:00
christos 861d7d0674 don't use union wait; an int is good enough. 1998-12-19 21:53:56 +00:00
kleink 0a87884eba Need <time.h> for time() and ctime() prototypes. 1998-04-02 11:00:10 +00:00
lukem 78093e2b86 WARNSify, fix .Nm usage, deprecate register, getopt returns -1 not EOF 1997-10-19 22:57:47 +00:00
mikel e60e80fff9 pass $SHELL or /bin/sh as argv[0] to subshell, instead of "sh"; fixes
PR bin/3276.
1997-03-03 04:02:21 +00:00
jtc ae2384963b Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
1994-12-21 08:55:39 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00