Comment on kernel stuff
[oweals/busybox.git] / coreutils / du.c
index b6ebaca7a067c0dceabe19e8bb17c0e053e6a792..b8e296ddd20f3bea2a1f761c2ebc8a38baf1ea76 100644 (file)
@@ -3,7 +3,7 @@
  * Mini du implementation for busybox
  *
  *
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
  * Written by John Beppu <beppu@lineo.com>
  *
  * This program is free software; you can redistribute it and/or modify
 #include <dirent.h>
 #include <stdio.h>
 #include <errno.h>
-#include <sys/param.h>                 /* for PATH_MAX */
 
 typedef void (Display) (long, char *);
 
 static const char du_usage[] =
-       "du [OPTION]... [FILE]...\n\n"
-       "Summarize disk space used for each FILE and/or directory.\n"
+       "du [OPTION]... [FILE]...\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nSummarizes disk space used for each FILE and/or directory.\n"
        "Disk space is printed in units of 1024 bytes.\n\n"
        "Options:\n"
        "\t-l\tcount sizes many times if hard linked\n"
-       "\t-s\tdisplay only a total for each argument\n";
+       "\t-s\tdisplay only a total for each argument\n"
+#endif
+       ;
 
 static int du_depth = 0;
 static int count_hardlinks = 0;
@@ -97,7 +99,7 @@ static long du(char *filename)
                        filename[--len] = '\0';
 
                while ((entry = readdir(dir))) {
-                       char newfile[PATH_MAX + 1];
+                       char newfile[BUFSIZ + 1];
                        char *name = entry->d_name;
 
                        if ((strcmp(name, "..") == 0)
@@ -105,7 +107,7 @@ static long du(char *filename)
                                continue;
                        }
 
-                       if (len + strlen(name) + 1 > PATH_MAX) {
+                       if (len + strlen(name) + 1 > BUFSIZ) {
                                fprintf(stderr, name_too_long, "du");
                                du_depth--;
                                return 0;
@@ -179,10 +181,10 @@ int du_main(int argc, char **argv)
                }
        }
 
-       exit(0);
+       return(0);
 }
 
-/* $Id: du.c,v 1.16 2000/03/04 21:19:32 erik Exp $ */
+/* $Id: du.c,v 1.20 2000/06/19 17:25:39 andersen Exp $ */
 /*
 Local Variables:
 c-file-style: "linux"