xref: /original-bsd/usr.bin/f77/libU77/system_.c (revision 26e4b21d)
1 /*
2 char id_system[] = "@(#)system_.c	1.4";
3  *
4  * execute a unix command
5  *
6  * calling sequence:
7  *	iexit = system(command)
8  * where:
9  *	iexit will return the exit status of the command
10  *	command is a character string containing the command to be executed
11  */
12 
13 #include	"../libI77/fiodefs.h"
14 #include	"../libI77/f_errno.h"
15 
16 
17 long system_(s, n)
18 char *s;
19 long n;
20 {
21 	char buf[256];
22 	long i;
23 
24 	if (n >= sizeof buf)
25 		return(-(long)(errno=F_ERARG));
26 	for (i = 0; i < MXUNIT; i++)
27 		flush_(&i);
28 	g_char(s, n, buf);
29 	return((long)system(buf));
30 }
31