fix xfree() so it can be re-written as a macro
[unix-history] / usr / src / bin / csh / misc.c
index 55430b6..e8398f9 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)misc.c     5.13 (Berkeley) %G%";
+static char sccsid[] = "@(#)misc.c     5.15 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -74,14 +74,15 @@ blkend(up)
 
 
 void
 
 
 void
-blkpr(av)
+blkpr(fp, av)
+    FILE *fp;
     register Char **av;
 {
 
     for (; *av; av++) {
     register Char **av;
 {
 
     for (; *av; av++) {
-       xprintf("%s", short2str(*av));
+       (void) fprintf(fp, "%s", short2str(*av));
        if (av[1])
        if (av[1])
-           xprintf(" ");
+           (void) fprintf(fp, " ");
     }
 }
 
     }
 }
 
@@ -220,7 +221,7 @@ closem()
     register int f;
 
     for (f = 0; f < NOFILE; f++)
     register int f;
 
     for (f = 0; f < NOFILE; f++)
-       if (f != SHIN && f != SHOUT && f != SHDIAG && f != OLDSTD &&
+       if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD &&
            f != FSHTTY)
            (void) close(f);
 }
            f != FSHTTY)
            (void) close(f);
 }
@@ -228,10 +229,10 @@ closem()
 void
 donefds()
 {
 void
 donefds()
 {
-
     (void) close(0);
     (void) close(1);
     (void) close(2);
     (void) close(0);
     (void) close(1);
     (void) close(2);
+
     didfds = 0;
 }
 
     didfds = 0;
 }
 
@@ -302,10 +303,10 @@ lshift(v, c)
     register Char **v;
     register int c;
 {
     register Char **v;
     register int c;
 {
-    register Char **u = v;
+    register Char **u;
 
 
-    while (*u && --c >= 0)
-       xfree((ptr_t) * u++);
+    for (u = v; *u && --c >= 0; u++)
+       xfree((ptr_t) *u);
     (void) blkcpy(v, u);
 }
 
     (void) blkcpy(v, u);
 }