Use off_t in humansize() as it is more descriptive and applicable
This commit is contained in:
parent
42326f7684
commit
2deb40290e
@ -6,7 +6,7 @@
|
|||||||
#include "../util.h"
|
#include "../util.h"
|
||||||
|
|
||||||
char *
|
char *
|
||||||
humansize(uintmax_t n)
|
humansize(off_t n)
|
||||||
{
|
{
|
||||||
static char buf[16];
|
static char buf[16];
|
||||||
const char postfixes[] = "BKMGTPE";
|
const char postfixes[] = "BKMGTPE";
|
||||||
@ -17,7 +17,7 @@ humansize(uintmax_t n)
|
|||||||
size /= 1024;
|
size /= 1024;
|
||||||
|
|
||||||
if (!i)
|
if (!i)
|
||||||
snprintf(buf, sizeof(buf), "%ju", n);
|
snprintf(buf, sizeof(buf), "%ju", (uintmax_t)n);
|
||||||
else
|
else
|
||||||
snprintf(buf, sizeof(buf), "%.1f%c", size, postfixes[i]);
|
snprintf(buf, sizeof(buf), "%.1f%c", size, postfixes[i]);
|
||||||
|
|
||||||
|
3
util.h
3
util.h
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
@ -67,7 +66,7 @@ int eregcomp(regex_t *, const char *, int);
|
|||||||
void enmasse(int, char **, int (*)(const char *, const char *, int));
|
void enmasse(int, char **, int (*)(const char *, const char *, int));
|
||||||
void fnck(const char *, const char *, int (*)(const char *, const char *, int), int);
|
void fnck(const char *, const char *, int (*)(const char *, const char *, int), int);
|
||||||
mode_t getumask(void);
|
mode_t getumask(void);
|
||||||
char *humansize(uintmax_t);
|
char *humansize(off_t);
|
||||||
mode_t parsemode(const char *, mode_t, mode_t);
|
mode_t parsemode(const char *, mode_t, mode_t);
|
||||||
void putword(FILE *, const char *);
|
void putword(FILE *, const char *);
|
||||||
#undef strtonum
|
#undef strtonum
|
||||||
|
Loading…
Reference in New Issue
Block a user