freebsd-dev/contrib/libf2c/libF77/system_.c

29 lines
504 B
C
Raw Normal View History

1999-09-18 10:51:31 +00:00
/* f77 interface to system routine */
#include "f2c.h"
#undef abs
#undef min
#undef max
#include <stdlib.h>
2003-07-11 03:42:19 +00:00
extern char *F77_aloc (ftnlen, char *);
1999-09-18 10:51:31 +00:00
2003-07-11 03:42:19 +00:00
integer
1999-09-18 10:51:31 +00:00
G77_system_0 (register char *s, ftnlen n)
{
2003-07-11 03:42:19 +00:00
char buff0[256], *buff;
register char *bp, *blast;
integer rv;
1999-09-18 10:51:31 +00:00
2003-07-11 03:42:19 +00:00
buff = bp = n < (ftnlen) sizeof (buff0) ? buff0 : F77_aloc (n + 1, "system_");
blast = bp + n;
1999-09-18 10:51:31 +00:00
2003-07-11 03:42:19 +00:00
while (bp < blast && *s)
*bp++ = *s++;
*bp = 0;
rv = system (buff);
if (buff != buff0)
free (buff);
return rv;
}