xref: /original-bsd/usr.bin/f77/libU77/wait_.c (revision d6141097)
1 /*
2 char id_wait[] = "@(#)wait_.c	1.1";
3  *
4  * wait for a child to die
5  *
6  * calling sequence:
7  *	integer wait, status, chilid
8  *	chilid = wait(status)
9  * where:
10  *	chilid will be	- >0 if child process id
11  *			- <0 if (negative of) system error code
12  *	status will contain the exit status of the child
13  *		(see wait(2))
14  */
15 
16 extern int errno;
17 
18 long wait_(status)
19 long *status;
20 {
21 	int stat;
22 	int chid = wait(&stat);
23 	if (chid < 0)
24 		return((long)(-errno));
25 	*status = (long)stat;
26 	return((long)chid);
27 }
28