File: jobcontrol.c

package info (click to toggle)
zmailer 2.99.55-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 19,516 kB
  • ctags: 9,694
  • sloc: ansic: 120,953; sh: 3,862; makefile: 3,166; perl: 2,695; python: 115; awk: 22
file content (52 lines) | stat: -rw-r--r-- 890 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 *	Copyright 1989 by Rayan S. Zachariassen, all rights reserved.
 *	This will be free software, but only when it is finished.
 */

/*
 * Job control control.
 */

#include "hostenv.h"
#include <stdio.h>
#include <sys/stat.h>
#include "listutils.h"
#include "io.h"
#include "shconfig.h"

#include "libsh.h"

int lastbgpid = 0;

/*
 * We're finished forking things, now report to the user.
 */

void
jc_report(pgrp)
	int pgrp;
{
	/*
	 * Note the number reported will be the id of the first process in
	 * a pipeline, not the last one like the standard sh will report.
	 */
	printf("%d\n", pgrp);
}


/*
 * A new process just started associated with the indicated process group.
 */

void
jc_newproc(pgrpp, pid, argc, argv)
	int *pgrpp, pid, argc;
	const char *argv[];
{
	if (*pgrpp == 0)
		*pgrpp = pid;
	lastbgpid = pid;
#ifdef	JOBCONTROL
	setpgrp(pid, *pgrpp);
#endif	/* JOBCONTROL */
}