Run through indent
This commit is contained in:
parent
1ed9dd9d06
commit
14dad7028b
@ -37,19 +37,18 @@
|
|||||||
static unsigned long disp_hr = KILOBYTE;
|
static unsigned long disp_hr = KILOBYTE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 int one_file_system = 0;
|
||||||
static dev_t dir_dev = 0;
|
static dev_t dir_dev;
|
||||||
|
|
||||||
static Display *print;
|
static void (*print) (long, char *);
|
||||||
|
|
||||||
static void print_normal(long size, char *filename)
|
static void print_normal(long size, char *filename)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||||
printf("%s\t%s\n", make_human_readable_str(size<<10, 1, disp_hr), filename);
|
printf("%s\t%s\n", make_human_readable_str(size << 10, 1, disp_hr),
|
||||||
|
filename);
|
||||||
#else
|
#else
|
||||||
printf("%ld\t%s\n", size, filename);
|
printf("%ld\t%s\n", size, filename);
|
||||||
#endif
|
#endif
|
||||||
@ -114,15 +113,13 @@ static long du(char *filename)
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
print(sum, filename);
|
print(sum, filename);
|
||||||
}
|
} else if (statbuf.st_nlink > 1 && !count_hardlinks) {
|
||||||
else if (statbuf.st_nlink > 1 && !count_hardlinks) {
|
|
||||||
/* Add files with hard links only once */
|
/* Add files with hard links only once */
|
||||||
if (is_in_ino_dev_hashtable(&statbuf, NULL)) {
|
if (is_in_ino_dev_hashtable(&statbuf, NULL)) {
|
||||||
sum = 0L;
|
sum = 0L;
|
||||||
if (du_depth == 1)
|
if (du_depth == 1)
|
||||||
print(sum, filename);
|
print(sum, filename);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
add_to_ino_dev_hashtable(&statbuf, NULL);
|
add_to_ino_dev_hashtable(&statbuf, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,27 +139,32 @@ int du_main(int argc, char **argv)
|
|||||||
/* parse argv[] */
|
/* parse argv[] */
|
||||||
while ((c = getopt(argc, argv, "slx"
|
while ((c = getopt(argc, argv, "slx"
|
||||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||||
"hm"
|
"hm"
|
||||||
#endif
|
#endif
|
||||||
"k")) != EOF) {
|
"k")) != EOF) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 's':
|
case 's':
|
||||||
print = print_summary;
|
print = print_summary;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
count_hardlinks = 1;
|
count_hardlinks = 1;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
one_file_system = 1;
|
one_file_system = 1;
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
#ifdef CONFIG_FEATURE_HUMAN_READABLE
|
||||||
case 'h': disp_hr = 0; break;
|
case 'h':
|
||||||
case 'm': disp_hr = MEGABYTE; break;
|
disp_hr = 0;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
|
disp_hr = MEGABYTE;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 'k': break;
|
case 'k':
|
||||||
default:
|
break;
|
||||||
show_usage();
|
default:
|
||||||
}
|
show_usage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* go through remaining args (if any) */
|
/* go through remaining args (if any) */
|
||||||
@ -172,9 +174,9 @@ int du_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
long sum;
|
long sum;
|
||||||
|
|
||||||
for (i=optind; i < argc; i++) {
|
for (i = optind; i < argc; i++) {
|
||||||
sum = du(argv[i]);
|
sum = du(argv[i]);
|
||||||
if(is_directory(argv[i], FALSE, NULL)==FALSE) {
|
if (is_directory(argv[i], FALSE, NULL) == FALSE) {
|
||||||
print_normal(sum, argv[i]);
|
print_normal(sum, argv[i]);
|
||||||
}
|
}
|
||||||
reset_ino_dev_hashtable();
|
reset_ino_dev_hashtable();
|
||||||
@ -184,7 +186,7 @@ int du_main(int argc, char **argv)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* $Id: du.c,v 1.53 2002/04/06 23:16:44 andersen Exp $ */
|
/* $Id: du.c,v 1.54 2002/08/23 03:25:22 bug1 Exp $ */
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
c-file-style: "linux"
|
c-file-style: "linux"
|
||||||
|
Loading…
Reference in New Issue
Block a user