changed to use MAXPATHLEN. DLW
[unix-history] / usr / src / usr.bin / f77 / libU77 / system_.c
index 9ca1539..f965960 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
-char id_system[] = "@(#)system_.c      1.1";
+char id_system[] = "@(#)system_.c      1.4";
  *
  * execute a unix command
  *
  *
  * execute a unix command
  *
@@ -10,9 +10,21 @@ char id_system[] = "@(#)system_.c    1.1";
  *     command is a character string containing the command to be executed
  */
 
  *     command is a character string containing the command to be executed
  */
 
+#include       "../libI77/fiodefs.h"
+#include       "../libI77/f_errno.h"
+
 long system_(s, n)
 char *s;
 long n;
 {
 long system_(s, n)
 char *s;
 long n;
 {
-       return((long)system(s));
+       char buf[256];
+       long i;
+
+       if (n >= sizeof buf)
+               return(-(long)(errno=F_ERARG));
+       for (i = 0; i < MXUNIT; i++)
+               flush_(&i);
+       g_char(s, n, buf);
+       return((long)system(buf));
 }
 }