diff options
author | Leah Neukirchen <leah@vuxu.org> | 2017-07-04 15:23:44 +0200 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-07-04 15:23:44 +0200 |
commit | b58c34180e438c06ee2ba5b0a3324c48e1d7f7f5 (patch) | |
tree | 6e5483d7a6a3ef436b21e7758cacc93b88d2776b /xdu.c | |
parent | 873aa90e0411fe7a5c0cfd0cd6e89a890dc890f2 (diff) | |
download | xdu-b58c34180e438c06ee2ba5b0a3324c48e1d7f7f5.tar.gz xdu-b58c34180e438c06ee2ba5b0a3324c48e1d7f7f5.tar.xz xdu-b58c34180e438c06ee2ba5b0a3324c48e1d7f7f5.zip |
use off_t and intmax_t for file sizes
Diffstat (limited to 'xdu.c')
-rw-r--r-- | xdu.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/xdu.c b/xdu.c index fb44488..aa9a5c4 100644 --- a/xdu.c +++ b/xdu.c @@ -76,7 +76,7 @@ struct rect { */ struct node { char *name; - long size; /* from here down in the tree */ + off_t size; /* from here down in the tree */ long num; /* entry number - for resorting */ struct rect rect; /* last drawn screen rectangle */ struct node *peer; /* siblings */ @@ -228,7 +228,7 @@ parse_file(char *filename) { char buf[4096]; char name[4096]; - int size; + intmax_t size; FILE *fp; if (strcmp(filename, "-") == 0) { @@ -240,9 +240,9 @@ parse_file(char *filename) } } while (fgets(buf,sizeof(buf),fp) != NULL) { - sscanf(buf, "%d %s\n", &size, name); - /*printf("%d %s\n", size, name);*/ - parse_entry(name,size); + sscanf(buf, "%jd %4095[^\n]\n", &size, name); + printf("%jd %s\n", size, name); + parse_entry(name,(off_t)size); } fclose(fp); } @@ -426,7 +426,7 @@ dumptree(struct node *np, int level) for (i = 0; i < level; i++) printf(" "); - printf("%s %d\n", np->name, np->size); + printf("%s %jd\n", np->name, (intmax_t)np->size); for (subnp = np->child; subnp != NULL; subnp = subnp->peer) { dumptree(subnp,level+1); } @@ -508,7 +508,7 @@ drawchildren( struct rect rect /* rectangle to draw all children in */ ) { - int totalsize; + off_t totalsize; int totalheight; struct node *np; double fractsize; @@ -722,7 +722,7 @@ nodeinfo(void) /* display each child of this node */ for (np = topp->child; np != NULL; np = np->peer) { - printf("%-8d %s\n", np->size, np->name); + printf("%-8ld %s\n", np->size, np->name); } } |