xref: /csrg-svn/usr.bin/f77/libU77/wait_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
42542Sdlw  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623054Skre  */
723054Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)wait_.c	5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223054Skre /*
132542Sdlw  * wait for a child to die
142542Sdlw  *
152542Sdlw  * calling sequence:
162542Sdlw  *	integer wait, status, chilid
172542Sdlw  *	chilid = wait(status)
182542Sdlw  * where:
192542Sdlw  *	chilid will be	- >0 if child process id
202542Sdlw  *			- <0 if (negative of) system error code
212542Sdlw  *	status will contain the exit status of the child
222542Sdlw  *		(see wait(2))
232542Sdlw  */
242542Sdlw 
252542Sdlw extern int errno;
262542Sdlw 
wait_(status)272542Sdlw long wait_(status)
282542Sdlw long *status;
292542Sdlw {
302542Sdlw 	int stat;
312542Sdlw 	int chid = wait(&stat);
322542Sdlw 	if (chid < 0)
332542Sdlw 		return((long)(-errno));
342542Sdlw 	*status = (long)stat;
352542Sdlw 	return((long)chid);
362542Sdlw }
37