2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / libf2c / libF77 / system_.c
blobdbbd0bea9ec2a5e746d62f9e9b63aca0e0ac2084
1 /* f77 interface to system routine */
3 #include "f2c.h"
5 #undef abs
6 #undef min
7 #undef max
8 #include <stdlib.h>
9 extern char *F77_aloc (ftnlen, char *);
11 integer
12 G77_system_0 (register char *s, ftnlen n)
14 char buff0[256], *buff;
15 register char *bp, *blast;
16 integer rv;
18 buff = bp = n < (ftnlen) sizeof (buff0) ? buff0 : F77_aloc (n + 1, "system_");
19 blast = bp + n;
21 while (bp < blast && *s)
22 *bp++ = *s++;
23 *bp = 0;
24 rv = system (buff);
25 if (buff != buff0)
26 free (buff);
27 return rv;