mirror of
https://github.com/sheumann/hush.git
synced 2025-01-18 07:31:34 +00:00
Patch from Edward Betts <edward@debian.org> to add -x switch to du.c
This commit is contained in:
parent
fcffa2cc1a
commit
265d229427
@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1999,2000,2001 by Lineo, inc. and John Beppu
|
* Copyright (C) 1999,2000,2001 by Lineo, inc. and John Beppu
|
||||||
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
|
* Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
|
||||||
|
* Copyright (C) 2002 Edward Betts <edward@debian.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -40,6 +41,8 @@ typedef void (Display) (long, char *);
|
|||||||
|
|
||||||
static int du_depth = 0;
|
static int du_depth = 0;
|
||||||
static int count_hardlinks = 0;
|
static int count_hardlinks = 0;
|
||||||
|
static int one_file_system = 0;
|
||||||
|
static dev_t dir_dev = 0;
|
||||||
|
|
||||||
static Display *print;
|
static Display *print;
|
||||||
|
|
||||||
@ -69,6 +72,10 @@ static long du(char *filename)
|
|||||||
perror_msg("%s", filename);
|
perror_msg("%s", filename);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (du_depth == 0)
|
||||||
|
dir_dev = statbuf.st_dev;
|
||||||
|
else if (one_file_system && dir_dev != statbuf.st_dev)
|
||||||
|
return 0;
|
||||||
|
|
||||||
du_depth++;
|
du_depth++;
|
||||||
sum = (statbuf.st_blocks >> 1);
|
sum = (statbuf.st_blocks >> 1);
|
||||||
@ -133,7 +140,7 @@ int du_main(int argc, char **argv)
|
|||||||
print = print_normal;
|
print = print_normal;
|
||||||
|
|
||||||
/* parse argv[] */
|
/* parse argv[] */
|
||||||
while ((c = getopt(argc, argv, "sl"
|
while ((c = getopt(argc, argv, "slx"
|
||||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||||
"hm"
|
"hm"
|
||||||
#endif
|
#endif
|
||||||
@ -145,6 +152,9 @@ int du_main(int argc, char **argv)
|
|||||||
case 'l':
|
case 'l':
|
||||||
count_hardlinks = 1;
|
count_hardlinks = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'x':
|
||||||
|
one_file_system = 1;
|
||||||
|
break;
|
||||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||||
case 'h': disp_hr = 0; break;
|
case 'h': disp_hr = 0; break;
|
||||||
case 'm': disp_hr = MEGABYTE; break;
|
case 'm': disp_hr = MEGABYTE; break;
|
||||||
@ -174,7 +184,7 @@ int du_main(int argc, char **argv)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.52 2001/12/17 15:26:25 kraai Exp $ */
|
/* $Id: du.c,v 1.53 2002/04/06 23:16:44 andersen Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
@ -343,7 +343,7 @@
|
|||||||
"$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
|
"$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
|
||||||
|
|
||||||
#define du_trivial_usage \
|
#define du_trivial_usage \
|
||||||
"[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
|
"[-lsx" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
|
||||||
#define du_full_usage \
|
#define du_full_usage \
|
||||||
"Summarizes disk space used for each FILE and/or directory.\n" \
|
"Summarizes disk space used for each FILE and/or directory.\n" \
|
||||||
"Disk space is printed in units of 1024 bytes.\n\n" \
|
"Disk space is printed in units of 1024 bytes.\n\n" \
|
||||||
@ -353,6 +353,7 @@
|
|||||||
USAGE_HUMAN_READABLE( \
|
USAGE_HUMAN_READABLE( \
|
||||||
"\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
|
"\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
|
||||||
"\t-m\tprint sizes in megabytes\n" \
|
"\t-m\tprint sizes in megabytes\n" \
|
||||||
|
"\t-x\tskip directories on different filesystems\n" \
|
||||||
"\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
|
"\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
|
||||||
"\n\t-k\tprint sizes in kilobytes(compatibility)")
|
"\n\t-k\tprint sizes in kilobytes(compatibility)")
|
||||||
#define du_example_usage \
|
#define du_example_usage \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user