-l isn't optional, and fallocate accepts the same suffixes as truncate.

(As do many other commands. We might prefer to just *not* document
this anyway and have to teach people that toybox [mostly] accepts
the same set of suffixes everywhere. dd is a place where the suffixes
differ, but the fix there might also be to make atollx support the
whole dd set.)

I did watch someone work out 3221225472 so they could supply it as an
argument to fallocate, though. A half-way solution might be to always
have terminology like "-l New length (accepts usual suffixes)", rather
than explicitly write them out? (We're already not documenting that
2K==2k, and if we do in future accept the full dd set everywhere,
that's two lines of help in a lot of commands.)

Bug: 31638516
---
 toys/other/fallocate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
From dfd88eb96adcf81c41a33c1bc08d102caa973dd2 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Fri, 30 Sep 2016 13:10:44 -0700
Subject: [PATCH] Clarify fallocate help text.

-l isn't optional, and fallocate accepts the same suffixes as truncate.

(As do many other commands. We might prefer to just *not* document
this anyway and have to teach people that toybox [mostly] accepts
the same set of suffixes everywhere. dd is a place where the suffixes
differ, but the fix there might also be to make atollx support the
whole dd set.)

I did watch someone work out 3221225472 so they could supply it as an
argument to fallocate, though. A half-way solution might be to always
have terminology like "-l New length (accepts usual suffixes)", rather
than explicitly write them out? (We're already not documenting that
2K==2k, and if we do in future accept the full dd set everywhere,
that's two lines of help in a lot of commands.)

Bug: 31638516
---
 toys/other/fallocate.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/toys/other/fallocate.c b/toys/other/fallocate.c
index 7a22634..55c06c5 100644
--- a/toys/other/fallocate.c
+++ b/toys/other/fallocate.c
@@ -11,9 +11,13 @@ config FALLOCATE
   depends on TOYBOX_FALLOCATE
   default y
   help
-    usage: fallocate [-l size] file
+    usage: fallocate -l LENGTH file
 
     Tell the filesystem to allocate space for a file.
+
+    -l	Length in bytes (with optional suffix)
+
+    SIZE suffix: k=1024, m=1024^2, g=1024^3, t=1024^4, p=1024^5, e=1024^6
 */
 
 #define FOR_fallocate
-- 
2.8.0.rc3.226.g39d4020

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to