summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bfs.h4
-rw-r--r--eval.c6
-rw-r--r--parse.c8
3 files changed, 15 insertions, 3 deletions
diff --git a/bfs.h b/bfs.h
index e391428..3a470f3 100644
--- a/bfs.h
+++ b/bfs.h
@@ -172,6 +172,10 @@ enum size_unit {
SIZE_MB,
/** Gibibytes. */
SIZE_GB,
+ /** Tebibytes. */
+ SIZE_TB,
+ /** Pebibytes. */
+ SIZE_PB,
};
/**
diff --git a/eval.c b/eval.c
index 2497455..b260ad9 100644
--- a/eval.c
+++ b/eval.c
@@ -808,8 +808,10 @@ bool eval_size(const struct expr *expr, struct eval_state *state) {
[SIZE_BYTES] = 1,
[SIZE_WORDS] = 2,
[SIZE_KB] = 1024,
- [SIZE_MB] = 1024*1024,
- [SIZE_GB] = 1024*1024*1024,
+ [SIZE_MB] = 1024LL*1024,
+ [SIZE_GB] = 1024LL*1024*1024,
+ [SIZE_TB] = 1024LL*1024*1024*1024,
+ [SIZE_PB] = 1024LL*1024*1024*1024*1024,
};
off_t scale = scales[expr->size_unit];
diff --git a/parse.c b/parse.c
index 64ed11b..c1cfd3a 100644
--- a/parse.c
+++ b/parse.c
@@ -1645,6 +1645,12 @@ static struct expr *parse_size(struct parser_state *state, int arg1, int arg2) {
case 'G':
expr->size_unit = SIZE_GB;
break;
+ case 'T':
+ expr->size_unit = SIZE_TB;
+ break;
+ case 'P':
+ expr->size_unit = SIZE_PB;
+ break;
default:
goto bad_unit;
@@ -1654,7 +1660,7 @@ static struct expr *parse_size(struct parser_state *state, int arg1, int arg2) {
bad_unit:
pretty_error(state->cmdline->stderr_colors,
- "error: %s %s: Expected a size unit of 'b', 'c', 'w', 'k', 'M', or 'G'; found %s.\n",
+ "error: %s %s: Expected a size unit (one of bcwkMGTP); found %s.\n",
expr->argv[0], expr->argv[1], unit);
fail:
free_expr(expr);