Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/du If no files are specified on the command line, pu...



details:   https://anonhg.NetBSD.org/src/rev/bd1259f4f579
branches:  trunk
changeset: 546961:bd1259f4f579
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sat May 10 02:09:39 2003 +0000

description:
If no files are specified on the command line, put { ".", NULL } in
it's own little array instead of writing over argv.  Fixes problems
where du shows up in ps as ". fts_open `%s'" (and shorter or longer
combinations of that depending in what argc was).

diffstat:

 usr.bin/du/du.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (46 lines):

diff -r 6c78440d63b4 -r bd1259f4f579 usr.bin/du/du.c
--- a/usr.bin/du/du.c   Sat May 10 01:51:56 2003 +0000
+++ b/usr.bin/du/du.c   Sat May 10 02:09:39 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: du.c,v 1.20 2003/04/18 13:16:50 grant Exp $    */
+/*     $NetBSD: du.c,v 1.21 2003/05/10 02:09:39 simonb Exp $   */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)du.c       8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: du.c,v 1.20 2003/04/18 13:16:50 grant Exp $");
+__RCSID("$NetBSD: du.c,v 1.21 2003/05/10 02:09:39 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -79,11 +79,10 @@
        FTS *fts;
        FTSENT *p;
        int64_t totalblocks;
-       int ftsoptions, listdirs, listfiles;
-       int Hflag, Lflag, Pflag, aflag, ch, cflag, gkmflag, notused, rval, sflag;
-       char **save;
+       int ftsoptions, listdirs, listfiles, notused;
+       int Hflag, Lflag, Pflag, aflag, ch, cflag, gkmflag, rval, sflag;
+       char *noargv[2];
 
-       save = argv;
        Hflag = Lflag = Pflag = aflag = cflag = gkmflag = sflag = 0;
        totalblocks = 0;
        ftsoptions = FTS_PHYSICAL;
@@ -168,9 +167,9 @@
        }
 
        if (!*argv) {
-               argv = save;
-               argv[0] = ".";
-               argv[1] = NULL;
+               noargv[0] = ".";
+               noargv[1] = NULL;
+               argv = noargv;
        }
 
        if (!gkmflag)



Home | Main Index | Thread Index | Old Index