12401Sdlw /* 2*2535Sdlw char id_system[] = "@(#)system_.c 1.4"; 32401Sdlw * 42401Sdlw * execute a unix command 52401Sdlw * 62401Sdlw * calling sequence: 72401Sdlw * iexit = system(command) 82401Sdlw * where: 92401Sdlw * iexit will return the exit status of the command 102401Sdlw * command is a character string containing the command to be executed 112401Sdlw */ 122401Sdlw 132440Sdlw #include "../libI77/fiodefs.h" 142478Sdlw #include "../libI77/f_errno.h" 152440Sdlw 162440Sdlw 172401Sdlw long system_(s, n) 182401Sdlw char *s; 192401Sdlw long n; 202401Sdlw { 212478Sdlw char buf[256]; 22*2535Sdlw long i; 232440Sdlw 242478Sdlw if (n >= sizeof buf) 252478Sdlw return(-(long)(errno=F_ERARG)); 26*2535Sdlw for (i = 0; i < MXUNIT; i++) 27*2535Sdlw flush_(&i); 282478Sdlw g_char(s, n, buf); 292478Sdlw return((long)system(buf)); 302401Sdlw } 31