xref: /original-bsd/usr.bin/f77/libU77/fork_.c (revision c35f7ea3)
1 /*
2 char id_fork[] = "@(#)fork_.c	1.1";
3  *
4  * fork a copy of this process
5  *
6  * calling sequence:
7  *	integer fork
8  *	ierror = fork()
9  * where:
10  *	ierror will be	- child pid if parent and successful
11  *			- 0 if child
12  *			- -errno if unsuccessful
13  */
14 
15 #include	"../libI77/fiodefs.h"
16 
17 extern int errno;
18 
19 long fork_()
20 {
21 	long i;
22 
23 	for (i = 0; i < MXUNIT; i++)
24 		flush_(&i);
25 	i = (long)fork();
26 	if (i < 0)
27 		return((long)(-errno));
28 	return(i);
29 }
30