xref: /original-bsd/usr.bin/f77/libU77/fork_.c (revision 5b10f61c)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.  The Berkeley software License Agreement
4  * specifies the terms and conditions for redistribution.
5  *
6  *	@(#)fork_.c	5.1	06/07/85
7  */
8 
9 /*
10  * fork a copy of this process
11  *
12  * calling sequence:
13  *	integer fork
14  *	ierror = fork()
15  * where:
16  *	ierror will be	- child pid if parent and successful
17  *			- 0 if child
18  *			- -errno if unsuccessful
19  */
20 
21 #include	"../libI77/fiodefs.h"
22 
23 extern int errno;
24 
25 long fork_()
26 {
27 	long i;
28 
29 	for (i = 0; i < MXUNIT; i++)
30 		flush_(&i);
31 	i = (long)fork();
32 	if (i < 0)
33 		return((long)(-errno));
34 	return(i);
35 }
36