xref: /original-bsd/usr.bin/f77/libU77/wait_.c (revision cf2124ff)
1 /*-
2  * Copyright (c) 1980 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)wait_.c	5.2 (Berkeley) 04/12/91";
10 #endif /* not lint */
11 
12 /*
13  * wait for a child to die
14  *
15  * calling sequence:
16  *	integer wait, status, chilid
17  *	chilid = wait(status)
18  * where:
19  *	chilid will be	- >0 if child process id
20  *			- <0 if (negative of) system error code
21  *	status will contain the exit status of the child
22  *		(see wait(2))
23  */
24 
25 extern int errno;
26 
27 long wait_(status)
28 long *status;
29 {
30 	int stat;
31 	int chid = wait(&stat);
32 	if (chid < 0)
33 		return((long)(-errno));
34 	*status = (long)stat;
35 	return((long)chid);
36 }
37