BSD 4_4 release
[unix-history] / usr / src / old / awk / run.c
index 533b634..a21c25c 100644 (file)
@@ -1,7 +1,17 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
+ */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)run.c      4.6 %G%";
-#endif
+static char sccsid[] = "@(#)run.c      4.10 (Berkeley) 5/26/93";
+#endif /* not lint */
 
 
+#include "sys/param.h"
 #include "awk.def"
 #include "math.h"
 #include "awk.h"
 #include "awk.def"
 #include "math.h"
 #include "awk.h"
@@ -9,7 +19,7 @@ static char sccsid[] = "@(#)run.c      4.6 %G%";
 #include "fcntl.h"
 #define RECSIZE BUFSIZ
 
 #include "fcntl.h"
 #define RECSIZE BUFSIZ
 
-#define FILENUM        10
+#define FILENUM        NOFILE
 struct
 {
        FILE *fp;
 struct
 {
        FILE *fp;
@@ -373,7 +383,7 @@ char *format(s,a) char *s; node *a;
                        break;
                }
                if (flag == 0) {
                        break;
                }
                if (flag == 0) {
-                       sprintf(p, "%s", fmt);
+                       (void)sprintf(p, "%s", fmt);
                        p += strlen(p);
                        continue;
                }
                        p += strlen(p);
                        continue;
                }
@@ -383,10 +393,10 @@ char *format(s,a) char *s; node *a;
                a = a->nnext;
                if (flag != 4)  /* watch out for converting to numbers! */
                        xf = getfval(x.optr);
                a = a->nnext;
                if (flag != 4)  /* watch out for converting to numbers! */
                        xf = getfval(x.optr);
-               if (flag==1) sprintf(p, fmt, xf);
-               else if (flag==2) sprintf(p, fmt, (long)xf);
-               else if (flag==3) sprintf(p, fmt, (int)xf);
-               else if (flag==4) sprintf(p, fmt, x.optr->sval==NULL ? "" : getsval(x.optr));
+               if (flag==1) (void)sprintf(p, fmt, xf);
+               else if (flag==2) (void)sprintf(p, fmt, (long)xf);
+               else if (flag==3) (void)sprintf(p, fmt, (int)xf);
+               else if (flag==4) (void)sprintf(p, fmt, x.optr->sval==NULL ? "" : getsval(x.optr));
                tempfree(x);
                p += strlen(p);
                s++;
                tempfree(x);
                p += strlen(p);
                s++;
@@ -640,8 +650,8 @@ obj split(a,nnn) node **a;
                        while (*s!=' ' && *s!='\t' && *s!='\n' && *s!='\0');
                        temp = *s;
                        *s = '\0';
                        while (*s!=' ' && *s!='\t' && *s!='\n' && *s!='\0');
                        temp = *s;
                        *s = '\0';
-                       sprintf(num, "%d", n);
-                       if (isnumber(t))
+                       (void)sprintf(num, "%d", n);
+                       if (isanumber(t))
                                setsymtab(num, tostring(t), atof(t), STR|NUM, ap->sval);
                        else
                                setsymtab(num, tostring(t), 0.0, STR, ap->sval);
                                setsymtab(num, tostring(t), atof(t), STR|NUM, ap->sval);
                        else
                                setsymtab(num, tostring(t), 0.0, STR, ap->sval);
@@ -657,8 +667,8 @@ obj split(a,nnn) node **a;
                                s++;
                        temp = *s;
                        *s = '\0';
                                s++;
                        temp = *s;
                        *s = '\0';
-                       sprintf(num, "%d", n);
-                       if (isnumber(t))
+                       (void)sprintf(num, "%d", n);
+                       if (isanumber(t))
                                setsymtab(num, tostring(t), atof(t), STR|NUM, ap->sval);
                        else
                                setsymtab(num, tostring(t), 0.0, STR, ap->sval);
                                setsymtab(num, tostring(t), atof(t), STR|NUM, ap->sval);
                        else
                                setsymtab(num, tostring(t), 0.0, STR, ap->sval);