#include <string.h>
#include <errno.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
-#include "messages.c"
#ifdef BB_FEATURE_HUMAN_READABLE
static void print_summary(long size, char *filename)
{
if (du_depth == 1) {
- printf("summary\n");
print_normal(size, filename);
}
}
{
struct stat statbuf;
long sum;
- int len;
if ((lstat(filename, &statbuf)) != 0) {
perror_msg("%s", filename);
if (S_ISDIR(statbuf.st_mode)) {
DIR *dir;
struct dirent *entry;
+ char *newfile;
dir = opendir(filename);
if (!dir) {
return 0;
}
- len = strlen(filename);
- if (filename[len - 1] == '/')
- filename[--len] = '\0';
+ newfile = last_char_is(filename, '/');
+ if (newfile)
+ *newfile = '\0';
while ((entry = readdir(dir))) {
- char *newfile;
char *name = entry->d_name;
if ((strcmp(name, "..") == 0)
return status;
}
-/* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */
+/* $Id: du.c,v 1.47 2001/05/07 22:49:43 andersen Exp $ */
/*
Local Variables:
c-file-style: "linux"