]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: factor out list of suffix-to-number (e.g., KB->1000B) mappings
authorJim Meyering <meyering@redhat.com>
Wed, 26 Nov 2008 14:02:58 +0000 (15:02 +0100)
committerJim Meyering <meyering@redhat.com>
Wed, 26 Nov 2008 14:37:47 +0000 (15:37 +0100)
* coreutils.texi (multiplierSuffixes, multiplierSuffixesNoBlocks):
New macros.
(od invocation, head invocation, tail invocation, split invocation):
(truncate invocation): Use them.

doc/coreutils.texi

index d949973fbb2ec0ff678917fb150cd6d30ee8ef9f..16acd7e107a76a489cfb0ac2acfe39631ce7fc5c 100644 (file)
@@ -613,6 +613,44 @@ different functionality than that described here.  Invoke it via
 from the shell.
 
 @end macro
+
+@macro multiplierSuffixes{varName}
+@ignore
+Appending @samp{b} multiplies @var{\varName\} by 512,
+@samp{kB} by 1000, @samp{K} by 1024,
+@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
+@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end ignore
+@var{\varName\} is a number which may have one of the following
+multiplicative suffixes:
+@example
+@samp{b}  =>            512 ("blocks")
+@samp{KB} =>           1000 (KiloBytes)
+@samp{K}  =>           1024 (KibiBytes)
+@samp{MB} =>      1000*1000 (MegaBytes)
+@samp{M}  =>      1024*1024 (MebiBytes)
+@samp{GB} => 1000*1000*1000 (GibiBytes)
+@samp{G}  => 1024*1024*1024 (GigaBytes)
+@end example
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end macro
+
+@c FIXME: same as above, but no ``blocks'' line.
+@macro multiplierSuffixesNoBlocks{varName}
+@var{\varName\} is a number which may have one of the following
+multiplicative suffixes:
+@example
+@samp{KB} =>           1000 (KiloBytes)
+@samp{K}  =>           1024 (KibiBytes)
+@samp{MB} =>      1000*1000 (MegaBytes)
+@samp{M}  =>      1024*1024 (MebiBytes)
+@samp{GB} => 1000*1000*1000 (GibiBytes)
+@samp{G}  => 1024*1024*1024 (GigaBytes)
+@end example
+and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@end macro
+
 @cindex common options
 
 Certain options are available in all of these programs.  Rather than
@@ -1780,11 +1818,8 @@ The default is octal.
 Skip @var{bytes} input bytes before formatting and writing.  If
 @var{bytes} begins with @samp{0x} or @samp{0X}, it is interpreted in
 hexadecimal; otherwise, if it begins with @samp{0}, in octal; otherwise,
-in decimal.  Appending @samp{b} multiplies @var{bytes} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+in decimal.
+@multiplierSuffixes{bytes}
 
 @item -N @var{bytes}
 @itemx --read-bytes=@var{bytes}
@@ -2614,11 +2649,7 @@ The program accepts the following options.  Also see @ref{Common options}.
 Print the first @var{n} bytes, instead of initial lines.
 However, if @var{n} starts with a @samp{-},
 print all but the last @var{n} bytes of each file.
-Appending @samp{b} multiplies @var{n} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{n}
 
 @itemx -n @var{n}
 @itemx --lines=@var{n}
@@ -2703,11 +2734,7 @@ The program accepts the following options.  Also see @ref{Common options}.
 Output the last @var{n} bytes, instead of final lines.
 However, if @var{n} starts with a @samp{+}, start printing with the
 @var{n}th byte from the start of each file, instead of from the end.
-Appending @samp{b} multiplies @var{n} by 512,
-@samp{kB} by 1000, @samp{K} by 1024,
-@samp{MB} by 1000*1000, @samp{M} by 1024*1024,
-@samp{GB} by 1000*1000*1000, @samp{G} by 1024*1024*1024,
-and so on for @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{n}
 
 @item -f
 @itemx --follow[=@var{how}]
@@ -2920,16 +2947,7 @@ option syntax @option{-@var{lines}}.  New scripts should use @option{-l
 @opindex -b
 @opindex --bytes
 Put @var{size} bytes of @var{input} into each output file.
-@var{size} is a number which may be followed by one of these
-multiplicative suffixes:
-@example
-@samp{b}  =>       512 ("blocks")
-@samp{KB} =>      1000 (KiloBytes)
-@samp{K}  =>      1024 (KibiBytes)
-@samp{MB} => 1000*1000 (MegaBytes)
-@samp{M}  => 1024*1024 (MebiBytes)
-@end example
-and so on for @samp{G}, @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixes{size}
 
 @item -C @var{size}
 @itemx --line-bytes=@var{size}
@@ -10412,15 +10430,7 @@ Set the size of each @var{file} to the same size as @var{rfile}.
 @opindex -s
 @opindex --size
 Set the size of each @var{file} to this @var{size}.
-@var{size} is a number which may be followed by one of these
-multiplicative suffixes:
-@example
-@samp{KB} =>      1000 (KiloBytes)
-@samp{K}  =>      1024 (KibiBytes)
-@samp{MB} => 1000*1000 (MegaBytes)
-@samp{M}  => 1024*1024 (MebiBytes)
-@end example
-and so on for @samp{G}, @samp{T}, @samp{P}, @samp{E}, @samp{Z}, and @samp{Y}.
+@multiplierSuffixesNoBlocks{size}
 
 @var{size} may also be prefixed by one of the following to adjust
 the size of each @var{file} based on their current size: