xref: /csrg-svn/usr.bin/f77/libU77/wait_.c (revision 23054)
12542Sdlw /*
2*23054Skre  * Copyright (c) 1980 Regents of the University of California.
3*23054Skre  * All rights reserved.  The Berkeley software License Agreement
4*23054Skre  * specifies the terms and conditions for redistribution.
52542Sdlw  *
6*23054Skre  *	@(#)wait_.c	5.1	06/07/85
7*23054Skre  */
8*23054Skre 
9*23054Skre /*
102542Sdlw  * wait for a child to die
112542Sdlw  *
122542Sdlw  * calling sequence:
132542Sdlw  *	integer wait, status, chilid
142542Sdlw  *	chilid = wait(status)
152542Sdlw  * where:
162542Sdlw  *	chilid will be	- >0 if child process id
172542Sdlw  *			- <0 if (negative of) system error code
182542Sdlw  *	status will contain the exit status of the child
192542Sdlw  *		(see wait(2))
202542Sdlw  */
212542Sdlw 
222542Sdlw extern int errno;
232542Sdlw 
242542Sdlw long wait_(status)
252542Sdlw long *status;
262542Sdlw {
272542Sdlw 	int stat;
282542Sdlw 	int chid = wait(&stat);
292542Sdlw 	if (chid < 0)
302542Sdlw 		return((long)(-errno));
312542Sdlw 	*status = (long)stat;
322542Sdlw 	return((long)chid);
332542Sdlw }
34