* lib/objc.exp: Add -lposix4 on Solaris 2.8.
[official-gcc.git] / libf2c / libF77 / system_.c
blobed024a14ded5ca7a234b46bbaad732d81721086a
1 /* f77 interface to system routine */
3 #include "f2c.h"
5 #ifdef KR_headers
6 extern char *F77_aloc();
8 integer
9 G77_system_0 (s, n) register char *s; ftnlen n;
10 #else
11 #undef abs
12 #undef min
13 #undef max
14 #include <stdlib.h>
15 extern char *F77_aloc(ftnlen, char*);
17 integer
18 G77_system_0 (register char *s, ftnlen n)
19 #endif
21 char buff0[256], *buff;
22 register char *bp, *blast;
23 integer rv;
25 buff = bp = n < sizeof(buff0)
26 ? buff0 : F77_aloc(n+1, "system_");
27 blast = bp + n;
29 while(bp < blast && *s)
30 *bp++ = *s++;
31 *bp = 0;
32 rv = system(buff);
33 if (buff != buff0)
34 free(buff);
35 return rv;