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