summaryrefslogtreecommitdiffstats
path: root/bin/sh/jobs.c
Commit message (Collapse)AuthorAgeFilesLines
* When job control is disabled, never show the job id when reporting thetjr2002-12-141-1/+2
| | | | status of a background process that has terminated because of a signal.
* Use the %t format modifier to print differences betweenmux2002-10-011-1/+1
| | | | | | | | | | | pointers. This fixes two format warnings on 64 bits archs which are fatal now that WFORMAT=0 has been removed. It doesn't fully fix the sh(1) build on 64 bits platforms though, there is still some quad_t issues that need to be fixed. Tested on: i386, sparc64
* Correct a usage of fnctl that could not be right and results in anectar2002-09-111-1/+1
| | | | no-op. I assume it was meant that the close-on-exec flag be set here.
* Don't show the process ID of background jobs that have terminated,tjr2002-08-241-1/+1
| | | | for consistency with ksh.
* Avoid accessing the current job's process table in the child part oftjr2002-08-181-3/+5
| | | | | | forkshell() after it has been freed. This caused mysterious behaviour when anything but the first command in a pipeline tried to access the terminal when the `junk' malloc() option was enabled (which is the default).
* Show job control ID, command text, etc. when foreground processes aretjr2002-08-171-7/+2
| | | | | | suspended. This is a followup to rev. 1.51. MFC after: 1 week
* Set opterr to zero to avoid duplicate warnings from getopt(3) for unknowntjr2002-07-251-0/+1
| | | | options.
* Remove broken and incomplete support for old releases of System V,tjr2002-07-191-61/+0
| | | | don't support system that implement getcwd(3) with a pipe to /bin/pwd.
* Avoid using ints or shorts to store process id's, use pid_t instead.tjr2002-07-181-20/+21
| | | | | | The pgrp member of struct job was declared as a short and could not store every possible process group ID value, the rest of them were benign because pid_t happens to be an int.
* Make the message that is printed when the foreground process is terminatedtjr2002-07-181-2/+23
| | | | by a signal the same as pdksh/bash/sh before rev. 1.34.
* Don't assume the shell's controlling terminal is attached to file descriptortjr2002-07-111-8/+27
| | | | | | | | 2. Instead, open /dev/tty. This problem stopped commands in subshells from being executed correctly if standard error was redirected. PR: 36671 Obtained from: NetBSD (but simplified)
* Remove support for the "old" tty driver by unifdef -UOLD_TTY_DRIVER;tjr2002-07-111-40/+0
| | | | | many other parts of the shell are no longer compatible with this, and it makes jobs.c quite cluttered with #ifdef's.
* When growing the job table, don't relocate the jobmru pointer if it's NULL.tjr2002-07-111-1/+2
|
* Print out commands with NTOFD/NFROMFD redirections that close thetjr2002-07-091-1/+4
| | | | descriptors (">&-" or similar) correctly in the jobs(1) command.
* Consistently use FBSDIDobrien2002-06-301-2/+2
|
* Remove two unused variables.jmallett2002-06-201-2/+0
|
* Display job status correctly when a pipeline is suspended.tjr2002-06-041-6/+8
|
* Describe finished jobs as "Done", not "Exit" (SUSv3)tjr2002-06-041-1/+5
|
* Don't output `state' and `current' fields for processes that aren'ttjr2002-06-041-3/+5
| | | | leaders in -l option to jobs(1).
* Correct minor spacing problem in output of jobs -l for pipelines.tjr2002-06-041-1/+1
|
* Support the remaining job ID formats required by SUSv3:tjr2002-06-011-2/+21
| | | | | | %+ (current job, same as %%), %- (previous job), %?str (job with "str" in its command name).
* Add -s (output PID's only) and -l (show PID's) options to the jobs(1)tjr2002-05-311-13/+67
| | | | builtin. Modify the output format to match what SUSv3 requires.
* #if JOBS around a job control-related statement to allow compilation withtjr2002-05-311-0/+2
| | | | job control disabled.
* Break the code to display status info for one job out from showjobs() intotjr2002-05-311-63/+52
| | | | | showjob(), use it inside dowait() to display status info for consistency, and in a format closer to what the standard requires.
* Move job to front of most recently used job list when bg'd or fg'd.tjr2002-05-311-0/+1
|
* Instead of keeping just the jobid of the most recently bg'd or fg'd job,tjr2002-05-311-9/+84
| | | | | | keep a linked list of the jobs, most recently used first. This is required to support the idea of `previous job', and to allow the jobs fg and bg default to be correct according to POSIX.
* Make the fg and bg commands give the output required by SUSv3.tjr2002-05-191-0/+10
| | | | | fg outputs the name of the command, bg outputs the name of the command and the job id.
* Implement the -C (-o noclobber) option, which prevents existing regulartjr2002-05-191-0/+2
| | | | files from being overwritten by shell redirection.
* o __P has been reovedimp2002-02-021-61/+32
| | | | | | | | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. o Change int foo() { ... to int foo(void) { ...
* Fix child's SIGSTOP behaviour in scripts.cracauer2001-02-061-1/+2
| | | | | | | | | | | | | | | | | | When a child is receiving SIGSTOP, eval continues with the next command. While that is correct for the interactive case (Control-Z and you get the prompt back), it is wrong for a shellscript, which just continues with the next command, never again waiting for the stopped child. Noted when childs from cronjobs were stopped, just to make more processes (by wosch). The fix is not to return from a job wait when the wait returned for a stopped child while in non-interactive mode. This bahaviour seems to be what bash2 and ksh implement. I tested for correct behaviour for finnaly killing the child with and without forgrounding it first. When not foregrouding before killing, the shell continues with the script, which is what the other shells do as well. Reviewed by: Silence on -current
* Add `_PATH_DEVZERO'.obrien2000-12-091-6/+7
| | | | Use _PATH_* where where possible.
* Implement the <> redirection operator.brian2000-10-031-0/+2
|
* Fix warnings, some of them serious because sh violated namecracauer2000-04-201-1/+0
| | | | | | | | spaces reserved by the header files it includes. mkinit.c still produces C code with redundant declarations, although they are more harmless since they automatically derived from the right places.
* Include strerror(errno) in error messages after failed system calls.cracauer1999-11-291-3/+5
| | | | Fix a warning.
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Various spelling/formatting changes.kris1999-05-081-2/+2
| | | | Submitted by: Philippe Charnier <charnier@xp11.frmug.org>
* Next approach to make loops in interactive interruptable.cracauer1999-04-211-4/+7
| | | | PR: bin/9173
* If traps are set, they are now executed even when a signal-blockingcracauer1998-09-081-4/+7
| | | | | | | | | | | | foreground child is running. Formerly, traps were exceuted after the next child exit. The enables the user to put a breaking wrapper around a blocking application: (trap 'echo trap ; exit 1' 2; ./pestyblocker; echo -n) The "echo -n" after the child call is needed to prevent sh from optimizing the trap-executing shell away. I'm working on this.
* Improve bookkeeping of in_waitcmd and style fixes.cracauer1998-08-251-8/+13
| | | | Submitted by: Bruce Evans
* Do not exit on SIGINT in non-interactive shells, fixes PR 1206,cracauer1998-08-241-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | i.e. this makes emacs usable from system(3). Programs called from shellscripts are now required to exit with proper signal status. That means, they have to kill themself. Exiting with faked numerical exit code is not sufficient. Exit with proper signal status if script exits on signal. Make the wait builtin interruptable, both with and without traps set. Use volatile sig_atomic_t where (and only where) appropriate. (Almost) fix printing of newlines on SIGINT. Make traps setable from trap handlers. This is needed for shellscripts that catch SIGINT for cleanup work but intend to exit on it, hance have to kill themself from a trap handler. I.e. mkdep. While I'm at it, make it -Wall clean. -Wall is not enabled in Makefile, since vararg warnx() macro calls in usr.bin/printf/printf.c are not -Wall-able. PR: 1206 Obtained from: Basic SIGINT fix from Bruce Evans
* Add rcsid. Spelling.charnier1998-05-181-3/+5
|
* Back out my previous attempt to fix SIGINT/SIGTERM behaviourcracauer1998-02-061-16/+0
|
* Fix handling of SIGINT/SIGQUIT for foreground subprocesses. Mostcracauer1998-02-061-1/+17
| | | | | | | | | | | | | | | | urgent need is when you run sh around a program that intentionally uses SIGQUIT/SIGINT for asynchronous events, i.e. $EDITOR started from system(2), like many mailers do. This fixes PR bin/1206 and possibly bin/4241. The solution committed has been tested for a large number of possible cases (see recent discussion on cvs-committers). I completed a make world, made sure 'make world' is interruptable and used the changed /bin/sh as a login shell all day, including job control and using SIGQUIT-catching programs (to write this message :-). PR: bin/1206 Reviewed by: discussion on cvs-commiters
* Remove simultaneous include of <sys/param.h> and <sys/types.h>.eivind1997-12-101-2/+1
| | | | | Reorder includes to be alphabetical some places since I already was in here.
* Make all status values an integral type and usesteve1997-08-181-3/+4
| | | | pid_t when referring to process IDs.
* Make sh(1) less aware of the bit fields returned by wait bysteve1997-05-241-33/+42
| | | | | | | using the WIF* macros in sys/wait.h. PR: bin/3668 Submitted by: dholland@eecs.harvard.edu
* Use the __unused attribute where warranted.steve1997-05-191-6/+6
|
* Nuke register keyword usage and #if -> #ifdef.steve1997-04-281-9/+9
| | | | Obtained from: NetBSD
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
OpenPOWER on IntegriCloud