Commit | Line | Data |
---|---|---|
39feba54 | 1 | /* |
f1a9026b | 2 | char id_system[] = "@(#)system_.c 1.4"; |
39feba54 DW |
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 | ||
1ab95451 | 13 | #include "../libI77/fiodefs.h" |
a05d0553 | 14 | #include "../libI77/f_errno.h" |
1ab95451 DW |
15 | |
16 | ||
39feba54 DW |
17 | long system_(s, n) |
18 | char *s; | |
19 | long n; | |
20 | { | |
a05d0553 | 21 | char buf[256]; |
f1a9026b | 22 | long i; |
1ab95451 | 23 | |
a05d0553 DW |
24 | if (n >= sizeof buf) |
25 | return(-(long)(errno=F_ERARG)); | |
f1a9026b DW |
26 | for (i = 0; i < MXUNIT; i++) |
27 | flush_(&i); | |
a05d0553 DW |
28 | g_char(s, n, buf); |
29 | return((long)system(buf)); | |
39feba54 | 30 | } |