| 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 |
system_(s, n) register char *s; ftnlen n; |
| 10 |
#else |
| 11 |
#undef abs |
| 12 |
#undef min |
| 13 |
#undef max |
| 14 |
#include "stdlib.h" |
| 15 |
#ifdef __cplusplus |
| 16 |
extern "C" { |
| 17 |
#endif |
| 18 |
extern char *F77_aloc(ftnlen, char*); |
| 19 |
|
| 20 |
integer |
| 21 |
system_(register char *s, ftnlen n) |
| 22 |
#endif |
| 23 |
{ |
| 24 |
char buff0[256], *buff; |
| 25 |
register char *bp, *blast; |
| 26 |
integer rv; |
| 27 |
|
| 28 |
buff = bp = n < sizeof(buff0) |
| 29 |
? buff0 : F77_aloc(n+1, "system_"); |
| 30 |
blast = bp + n; |
| 31 |
|
| 32 |
while(bp < blast && *s) |
| 33 |
*bp++ = *s++; |
| 34 |
*bp = 0; |
| 35 |
rv = system(buff); |
| 36 |
if (buff != buff0) |
| 37 |
free(buff); |
| 38 |
return rv; |
| 39 |
} |
| 40 |
#ifdef __cplusplus |
| 41 |
} |
| 42 |
#endif |