aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/script
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r238896, r238897, r241331 (usr.bin/script/ only), r241972, r242138,David E. O'Brien2013-07-302-33/+267
| | | | | | | | | | | | | | r248388, 253814 + Add "-f" to also output filemon(4) information. + Add d, p and r switches for recording script sessions with timing data and playing sessions back with or without time delays. + Remove contractions. Approved by: releng (glebius) Notes: svn path=/stable/9/; revision=253815
* MFC r226403:Mikolaj Golub2011-10-211-3/+6
| | | | | | | | | | | | | | | | | | | | In r225809 the intention was to send VEOF only once if STDIN was not a terminal. Unfortunately the fix was incorrect and for flushtime > 0 it keept sending VEOF. Sent VEOF generates ^D\b\b echoed by the terminal, which was reported in bin/161526. Note, we still send VEOF at least once. Otherwise commands like below would hang forever: echo 1 |script /tmp/script.out cat PR: bin/161526 Reported by: Adrian Wontroba <aw1@stade.co.uk>, Stefan Bethke <stb@lassitu.de> Tested by: Stefan Bethke <stb@lassitu.de> Approved by: re (kib) Notes: svn path=/stable/9/; revision=226591
* MFC r225857:Glen Barber2011-10-101-14/+19
| | | | | | | | | | - Fix a few grammar and mdoc nits in script.1 PR: 161088 Approved by: re (kib) Notes: svn path=/stable/9/; revision=226187
* MFC r225809:Mikolaj Golub2011-10-042-12/+29
| | | | | | | | | | | | | | | | | | | | When script(1) reads EOF from input it starts spinning on zero-byte reads eating 100% CPU. Fix this by skipping select on STDIN after reading EOF -- permanently if STDIN is not terminal and for one second if it is. Also after reading EOF from STDIN we have to pass it to the program being scripted. The previous approach was to write zero bytes into the pseudo-terminal. This does not work because zero-byte write does not have any effect on read. Fix this by sending VEOF instead. Submitted by: Ronald Klop <ronald-freebsd8@klop.yi.org> Discussed with: kib, Chris Torek <chris.torek@gmail.com> Approved by: re (kib) Notes: svn path=/stable/9/; revision=225962
* Remove the advertising clause from UCB copyrighted files in usr.bin. ThisJoel Dahl2010-12-112-8/+0
| | | | | | | | | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change Also add $FreeBSD$ to a few files to keep svn happy. Discussed with: imp, rwatson Notes: svn path=/head/; revision=216370
* Fix the grammar after I added a second environmental variable.David E. O'Brien2010-09-191-1/+1
| | | | | | | Submitted by: wxs Notes: svn path=/head/; revision=212832
* + Add the SCRIPT environmental variable to the sub-shell. Its value isDavid E. O'Brien2010-09-162-0/+20
| | | | | | | | | | | the name of the typescript file. + Add the 'command' argument (if supplied on the command line) to the typescript file. This creates a more complete typescript when invoked this way - more equal to invoking script without supplying the 'command' argument. Notes: svn path=/head/; revision=212770
* Mark functions and variables as static.Ed Schouten2010-08-161-15/+14
| | | | | | | | | All these functions and variables are local to this compilation unit, so there is no reason why we shouldn't mark them static. This slightly reduces the binary size. Notes: svn path=/head/; revision=211394
* Remove WNOHANG flag from wait3().Ed Schouten2010-04-301-15/+9
| | | | | | | | | | | | | | | | | Because script(1) now reliably terminates when the TTY is closed, it may be the case that the call to wait3() occurs just before the child process exits. This causes error codes to be ignored. Just change script(1) to use waitpid() instead of wait3(). This makes it more portable and prevents the need for a loop, since waitpid() only returns a specified process. PR: bin/146189 Tested by: amdmi3@, older version MFC after: 2 weeks Notes: svn path=/head/; revision=207453
* Improve the change made in the previous commit.Ed Schouten2010-03-111-2/+1
| | | | | | | | doshell() never returns, so there is no need to see whether we are the parent process. Notes: svn path=/head/; revision=205009
* Make script(1) a little less broken.Ed Schouten2010-03-111-0/+2
| | | | | | | | | | | | Close the file descriptor to the TTY. There is no reason why the parent process should keep track of the descriptor. This ensures that the application inside properly drains the TTY during exit(2). Reported by: alfred MFC after: 2 weeks Notes: svn path=/head/; revision=205008
* Remove a warning by adding extra parentheses.Ed Schouten2010-01-021-1/+1
| | | | | | | | GCC generates warnings when using "if (foo = bar)". In this case its use is valid. Notes: svn path=/head/; revision=201384
* Deal with double whitespace.Ruslan Ermilov2004-07-031-1/+1
| | | | Notes: svn path=/head/; revision=131507
* Mechanically kill hard sentence breaks.Ruslan Ermilov2004-07-021-4/+8
| | | | Notes: svn path=/head/; revision=131491
* Bumped document date.Ruslan Ermilov2004-05-191-2/+2
| | | | | | | Fixed markup nit. Notes: svn path=/head/; revision=129433
* Attempt #2 to fix script(1) if the standard input is closed: If weColin Percival2004-02-151-1/+3
| | | | | | | | | | | | | | | | | | | read EOF from STDIN_FILENO, write zero bytes into the pseudo-terminal; this is interpreted as an EOF by the program being scripted. I've tested this with two non-interactive scripts: # echo 5 | script foo sh -c 'read x; sleep $x; echo bar' # echo bar | xargs script foo echo and one interactive program: # script foo more /etc/passwd and everything seems to work properly... PR: bin/56166, bin/57414, ports/57415, ports/60534 Approved by: rwatson (mentor) MFC after: 2 weeks Notes: svn path=/head/; revision=125848
* Back out part of 1.21, since it breaks `script interactive-program`. ThisColin Percival2004-01-271-2/+1
| | | | | | | | | | | | re-breaks non-interactive portupgrade (or at least old versions of portupgrade); I'll see if I can put together a solution which avoids breaking anything later. Approved by: rwatson (mentor) Noticed by: Stefan Farfeleder, Joshua Goodall Notes: svn path=/head/; revision=125101
* Fix SYNOPSIS of manual page, clustering no-arg options correctly.Sheldon Hearn2004-01-222-4/+2
| | | | | | | Sync usage with manpage. Notes: svn path=/head/; revision=124846
* Two fixes for script(1):Colin Percival2004-01-221-11/+22
| | | | | | | | | | | | | | | | 1. Don't do tty stuff to stdin if stdin isn't a tty. 2. When running in non-interactive mode, don't select(2) on the standard input. This un-breaks non-interactive portupgrade. PR: bin/59036 [1] PR: bin/56166, bin/57414, ports/57415, ports/60534 [2] MFC after: 7 days Approved by: rwatson (mentor) Notes: svn path=/head/; revision=124845
* Introduce arguments the standard way. In .Ar command ..., ... is not anPhilippe Charnier2003-09-071-4/+4
| | | | | | | argument, command is. Notes: svn path=/head/; revision=119851
* ANSIify function definitions.David Malone2002-09-041-10/+6
| | | | | | | | | | | | Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5 Notes: svn path=/head/; revision=102944
* Use POSIX macros for wait(2)-style status information instead of theMike Barcroft2002-06-031-3/+3
| | | | | | | | deprecated 4.2/4.3BSD wait union. Fix some nearby pid_t/int confusion. Notes: svn path=/head/; revision=97788
* Use `The .Nm utility'Philippe Charnier2002-04-201-6/+9
| | | | Notes: svn path=/head/; revision=95124
* remove __PWarner Losh2002-03-221-6/+6
| | | | Notes: svn path=/head/; revision=92922
* Minor style stuff, use __FBSDID(), remove to-be-default WARNS=2.Mark Murray2001-12-122-9/+8
| | | | Notes: svn path=/head/; revision=87768
* Style improvements recommended by Bruce as a follow up to someDavid Malone2001-12-101-1/+1
| | | | | | | | | | | of the recent WARNS commits. The idea is: 1) FreeBSD id tags should follow vendor tags. 2) Vendor tags should not be compiled (though copyrights probably should). 3) There should be no blank line between including cdefs and __FBSDIF. Notes: svn path=/head/; revision=87628
* Warns cleanups. Add FreeBSD ID.David Malone2001-12-032-2/+4
| | | | Notes: svn path=/head/; revision=87296
* Use STD{ERR,IN,OUT}_FILENO instead of their numeric values. TheSheldon Hearn2001-07-261-1/+1
| | | | | | | | | | definitions are more readable, and it's possible that they're more portable to pathalogical platforms. Submitted by: David Hill <david@phobia.ms> Notes: svn path=/head/; revision=80381
* Remove whitespace at EOL.Dima Dorfman2001-07-151-3/+3
| | | | Notes: svn path=/head/; revision=79755
* mdoc(7) police: removed HISTORY info from the .Os call.Ruslan Ermilov2001-07-101-1/+1
| | | | Notes: svn path=/head/; revision=79535
* Fix the type of the NULL arg to execl()Brian Somers2001-07-091-1/+1
| | | | | | | Idea from: Theo de Raadt <deraadt@openbsd.org> Notes: svn path=/head/; revision=79452
* Nuke unused variables.Dima Dorfman2001-06-241-1/+0
| | | | Notes: svn path=/head/; revision=78737
* mdoc(7) police: use the new features of the Nm macro.Ruslan Ermilov2000-11-201-1/+1
| | | | Notes: svn path=/head/; revision=68963
* Don't call warn() with no format string.Kris Kennaway2000-07-101-2/+2
| | | | Notes: svn path=/head/; revision=62897
* Make a run-on sentence into two proper sentences, and clarify the meaningBrian Feldman2000-03-061-3/+2
| | | | | | | a bit. Notes: svn path=/head/; revision=57786
* Remove more single-space hard sentence breaks.Sheldon Hearn2000-03-021-1/+2
| | | | Notes: svn path=/head/; revision=57695
* Remove single-space hard sentence breaks. These degrade the qualitySheldon Hearn2000-03-011-1/+2
| | | | | | | | of the typeset output, tend to make diffs harder to read and provide bad examples for new-comers to mdoc. Notes: svn path=/head/; revision=57670
* Fix grammar error. (missing verb)Bill Fumerola1999-12-131-1/+1
| | | | Notes: svn path=/head/; revision=54579
* Adjust man page: if command is specified, file name is mandatoryGuido van Rooij1999-11-241-2/+1
| | | | Notes: svn path=/head/; revision=53670
* $Id$ -> $FreeBSD$Peter Wemm1999-08-282-2/+2
| | | | Notes: svn path=/head/; revision=50477
* Pass as argv[0] the name of the shell executed instead of "sh".Sheldon Hearn1999-08-111-2/+2
| | | | | | | | | PR: 2851 Reported by: era@iki.fi Obtained from: NetBSD Notes: svn path=/head/; revision=49646
* Mention default time between output flushes in manual page.Joseph Koshy1998-09-291-2/+3
| | | | | | | | PR: docs/8009 Submitted by: Stefan Eggers <seggers@semyam.dinoco.de> Notes: svn path=/head/; revision=39741
* Fix the following bugs:Dag-Erling Smørgrav1998-09-191-19/+27
| | | | | | | | | | | | | | | | | | | | - if a command was specified and script(1) failed to execute it, it would print the name of your shell in the error message instead of that of the command that failed. - since finish() was installed as a SIGCHLD handler, it would often run before the main loop had had time to process the last few bytes of output. This resulted in very strange truncated error messages. - script(1) would almost always return with an exit status of 0, even if the command returned a non-zero exit status. This broke my 'build world, install it and rebuild the kernel' scripts because 'make installworld' would run even if 'make buildworld' had failed. Notes: svn path=/head/; revision=39481
* Fix a bunch of spelling errors.Steve Price1998-06-041-2/+2
| | | | | | | | PR: 6856 Submitted by: Josh Gilliam <josh@quick.net> Notes: svn path=/head/; revision=36649
* Rewrite script as a select loop rather than as a twin reader/write process.Peter Wemm1998-03-082-75/+96
| | | | | | | | This allows simple logging of keys sent to a session (turned on with -k). Also allow specifying the script file flush interval. Notes: svn path=/head/; revision=34295
* Fix typo while copying patch from the 2.2 system that it came fromPeter Wemm1997-12-301-3/+3
| | | | | | | Use execvp rather than execv so that full paths are not needed. Notes: svn path=/head/; revision=32108
* script(1) has annoyed me with it's inflexable command argument parsingPeter Wemm1997-12-292-14/+43
| | | | | | | | since I first saw it. I finally needed to pass arguments through to the spawned command badly enough (and urgently) that I threw this together. Notes: svn path=/head/; revision=32083
* Add usage(). Use err(3) instead of local redefinition.Philippe Charnier1997-08-082-42/+24
| | | | Notes: svn path=/head/; revision=27980
* compare return value from getopt against -1 rather than EOF, per the finalWarner Losh1997-03-291-1/+1
| | | | | | | posix standard on the topic. Notes: svn path=/head/; revision=24360
* Don't use __dead or __pure in user code. They were obfuscationsBruce Evans1996-09-141-7/+7
| | | | | | | | | for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2 or __pure2 where it wasn't already done, except in math.h where use of __pure was mostly wrong. Notes: svn path=/head/; revision=18286