The first a bug in pax and should be commited to FBSD, too.
[dragonfly.git] / contrib / libf2c / libF77 / system_.c
1 /* f77 interface to system routine */
2
3 #include "f2c.h"
4
5 #ifdef KR_headers
6 extern char *F77_aloc();
7
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*);
16
17  integer
18 G77_system_0 (register char *s, ftnlen n)
19 #endif
20 {
21         char buff0[256], *buff;
22         register char *bp, *blast;
23         integer rv;
24
25         buff = bp = n < sizeof(buff0)
26                         ? buff0 : F77_aloc(n+1, "system_");
27         blast = bp + n;
28
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;
36         }