summaryrefslogtreecommitdiff
path: root/bin/ksh/jobs.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2004-12-20 11:34:27 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2004-12-20 11:34:27 +0000
commite445c3ad8a040ce5aa9ffd47e72de71f7cd3dd16 (patch)
treef321abeceffdba61fb97e64b666e8793cf6e1d4e /bin/ksh/jobs.c
parentc6e78b160bb0e446bb146be6b8b66890b48e5b31 (diff)
Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@
Diffstat (limited to 'bin/ksh/jobs.c')
-rw-r--r--bin/ksh/jobs.c108
1 files changed, 41 insertions, 67 deletions
diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index f897945e46a..52cf287bde8 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: jobs.c,v 1.27 2004/12/19 04:14:20 deraadt Exp $ */
+/* $OpenBSD: jobs.c,v 1.28 2004/12/20 11:34:26 otto Exp $ */
/*
* Process and job control
@@ -124,23 +124,22 @@ static pid_t our_pgrp;
static int const tt_sigs[] = { SIGTSTP, SIGTTIN, SIGTTOU };
#endif /* JOBS */
-static void j_set_async(Job *j);
-static void j_startjob(Job *j);
-static int j_waitj(Job *j, int flags, const char *where);
-static void j_sigchld(int sig);
-static void j_print(Job *j, int how, struct shf *shf);
-static Job *j_lookup(const char *cp, int *ecodep);
+static void j_set_async(Job *);
+static void j_startjob(Job *);
+static int j_waitj(Job *, int, const char *);
+static void j_sigchld(int);
+static void j_print(Job *, int, struct shf *);
+static Job *j_lookup(const char *, int *);
static Job *new_job(void);
static Proc *new_proc(void);
-static void check_job(Job *j);
-static void put_job(Job *j, int where);
-static void remove_job(Job *j, const char *where);
-static int kill_job(Job *j, int sig);
+static void check_job(Job *);
+static void put_job(Job *, int);
+static void remove_job(Job *, const char *);
+static int kill_job(Job *, int);
/* initialize job control */
void
-j_init(mflagset)
- int mflagset;
+j_init(int mflagset)
{
child_max = CHILD_MAX; /* so syscon() isn't always being called */
@@ -187,7 +186,7 @@ j_init(mflagset)
/* job cleanup before shell exit */
void
-j_exit()
+j_exit(void)
{
/* kill stopped, and possibly running, jobs */
Job *j;
@@ -242,7 +241,7 @@ j_exit()
#ifdef JOBS
/* turn job control on or off according to Flag(FMONITOR) */
void
-j_change()
+j_change(void)
{
int i;
@@ -323,10 +322,8 @@ j_change()
/* execute tree in child subprocess */
int
-exchild(t, flags, close_fd)
- struct op *t;
- int flags;
- int close_fd; /* used if XPCLOSE or XCCLOSE */
+exchild(struct op *t, int flags,
+ int close_fd) /* used if XPCLOSE or XCCLOSE */
{
static Proc *last_proc; /* for pipelines */
@@ -511,7 +508,7 @@ exchild(t, flags, close_fd)
/* start the last job: only used for `command` jobs */
void
-startlast()
+startlast(void)
{
sigset_t omask;
@@ -527,7 +524,7 @@ startlast()
/* wait for last job: only used for `command` jobs */
int
-waitlast()
+waitlast(void)
{
int rv;
Job *j;
@@ -554,9 +551,7 @@ waitlast()
/* wait for child, interruptable. */
int
-waitfor(cp, sigp)
- const char *cp;
- int *sigp;
+waitfor(const char *cp, int *sigp)
{
int rv;
Job *j;
@@ -607,9 +602,7 @@ waitfor(cp, sigp)
/* kill (built-in) a job */
int
-j_kill(cp, sig)
- const char *cp;
- int sig;
+j_kill(const char *cp, int sig)
{
Job *j;
Proc *p;
@@ -649,9 +642,7 @@ j_kill(cp, sig)
#ifdef JOBS
/* fg and bg built-ins: called only if Flag(FMONITOR) set */
int
-j_resume(cp, bg)
- const char *cp;
- int bg;
+j_resume(const char *cp, int bg)
{
Job *j;
Proc *p;
@@ -754,7 +745,7 @@ j_resume(cp, bg)
/* are there any running or stopped jobs ? */
int
-j_stopped_running()
+j_stopped_running(void)
{
Job *j;
int which = 0;
@@ -797,10 +788,9 @@ j_njobs(void)
/* list jobs for jobs built-in */
int
-j_jobs(cp, slp, nflag)
- const char *cp;
- int slp; /* 0: short, 1: long, 2: pgrp */
- int nflag;
+j_jobs(const char *cp, int slp,
+ int nflag) /* 0: short, 1: long, 2: pgrp */
+
{
Job *j, *tmp;
int how;
@@ -847,7 +837,7 @@ j_jobs(cp, slp, nflag)
/* list jobs for top-level notification */
void
-j_notify()
+j_notify(void)
{
Job *j, *tmp;
sigset_t omask;
@@ -875,7 +865,7 @@ j_notify()
/* Return pid of last process in last asynchronous job */
pid_t
-j_async()
+j_async(void)
{
sigset_t omask;
@@ -894,8 +884,7 @@ j_async()
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-j_set_async(j)
- Job *j;
+j_set_async(Job *j)
{
Job *jl, *oldest;
@@ -930,8 +919,7 @@ j_set_async(j)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-j_startjob(j)
- Job *j;
+j_startjob(Job *j)
{
Proc *p;
@@ -953,10 +941,9 @@ j_startjob(j)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static int
-j_waitj(j, flags, where)
- Job *j;
- int flags; /* see JW_* */
- const char *where;
+j_waitj(Job *j,
+ int flags, /* see JW_* */
+ const char *where)
{
int rv;
@@ -1086,8 +1073,7 @@ j_waitj(j, flags, where)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-j_sigchld(sig)
- int sig;
+j_sigchld(int sig)
{
int errno_ = errno;
Job *j;
@@ -1161,8 +1147,7 @@ found:
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-check_job(j)
- Job *j;
+check_job(Job *j)
{
int jstate;
Proc *p;
@@ -1268,10 +1253,7 @@ check_job(j)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-j_print(j, how, shf)
- Job *j;
- int how;
- struct shf *shf;
+j_print(Job *j, int how, struct shf *shf)
{
Proc *p;
int state;
@@ -1379,9 +1361,7 @@ j_print(j, how, shf)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static Job *
-j_lookup(cp, ecodep)
- const char *cp;
- int *ecodep;
+j_lookup(const char *cp, int *ecodep)
{
Job *j, *last_match;
Proc *p;
@@ -1474,7 +1454,7 @@ static Proc *free_procs;
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static Job *
-new_job()
+new_job(void)
{
int i;
Job *newj, *j;
@@ -1502,7 +1482,7 @@ new_job()
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static Proc *
-new_proc()
+new_proc(void)
{
Proc *p;
@@ -1521,9 +1501,7 @@ new_proc()
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-remove_job(j, where)
- Job *j;
- const char *where;
+remove_job(Job *j, const char *where)
{
Proc *p, *tmp;
Job **prev, *curr;
@@ -1563,9 +1541,7 @@ remove_job(j, where)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static void
-put_job(j, where)
- Job *j;
- int where;
+put_job(Job *j, int where)
{
Job **prev, *curr;
@@ -1600,9 +1576,7 @@ put_job(j, where)
* If jobs are compiled in then this routine expects sigchld to be blocked.
*/
static int
-kill_job(j, sig)
- Job *j;
- int sig;
+kill_job(Job *j, int sig)
{
Proc *p;
int rval = 0;