a space, a flag indicating binary or text input mode, and the file name.
Binary mode is indicated with @samp{*}, text mode with @samp{ } (space).
Binary mode is the default on systems where it's significant,
-otherwise text mode is the default.
+otherwise text mode is the default. The @command{cksum} command always
+uses binary mode and a @samp{ } (space) flag.
Without @option{--zero}, if @var{file} contains a backslash or newline,
the line is started with a backslash, and each problematic character in
the file name is escaped with a backslash, making the output
@opindex -b
@opindex --binary
@cindex binary input files
+Note this option is not supported by the @command{cksum} command,
+as it operates in binary mode exclusively.
Treat each input file as binary, by reading it in binary mode and
outputting a @samp{*} flag. This is the inverse of @option{--text}.
On systems like GNU that do not distinguish between binary
@opindex -t
@opindex --text
@cindex text input files
+Note this option is not supported by the @command{cksum} command.
Treat each input file as text, by reading it in text mode and
outputting a @samp{ } flag. This is the inverse of @option{--binary}.
This option is the default on systems like GNU that do not
#if HASH_ALGO_BLAKE2 || HASH_ALGO_CKSUM
{ "length", required_argument, NULL, 'l'},
#endif
+
#if !HASH_ALGO_SUM
- { "binary", no_argument, NULL, 'b' },
{ "check", no_argument, NULL, 'c' },
{ "ignore-missing", no_argument, NULL, IGNORE_MISSING_OPTION},
{ "quiet", no_argument, NULL, QUIET_OPTION },
{ "status", no_argument, NULL, STATUS_OPTION },
- { "text", no_argument, NULL, 't' },
{ "warn", no_argument, NULL, 'w' },
{ "strict", no_argument, NULL, STRICT_OPTION },
+ { "zero", no_argument, NULL, 'z' },
+
# if HASH_ALGO_CKSUM
+ { "algorithm", required_argument, NULL, 'a'},
+ { "debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
{ "untagged", no_argument, NULL, UNTAG_OPTION },
# else
+ { "binary", no_argument, NULL, 'b' },
+ { "text", no_argument, NULL, 't' },
{ "tag", no_argument, NULL, TAG_OPTION },
# endif
- { "zero", no_argument, NULL, 'z' },
-#endif
-#if HASH_ALGO_CKSUM
- {"algorithm", required_argument, NULL, 'a'},
- {"debug", no_argument, NULL, DEBUG_PROGRAM_OPTION},
-#endif
-#if HASH_ALGO_SUM
+
+#else
{"sysv", no_argument, NULL, 's'},
#endif
+
{ GETOPT_HELP_OPTION_DECL },
{ GETOPT_VERSION_OPTION_DECL },
{ NULL, 0, NULL, 0 }
"), stdout);
#endif
#if !HASH_ALGO_SUM
+# if !HASH_ALGO_CKSUM
if (O_BINARY)
fputs (_("\
-b, --binary read in binary mode (default unless reading tty stdin)\n\
fputs (_("\
-b, --binary read in binary mode\n\
"), stdout);
-
+# endif
fputs (_("\
-c, --check read checksums from the FILEs and check them\n\
"), stdout);
--tag create a BSD-style checksum\n\
"), stdout);
# endif
+# if !HASH_ALGO_CKSUM
if (O_BINARY)
fputs (_("\
-t, --text read in text mode (default if reading tty stdin)\n\
fputs (_("\
-t, --text read in text mode (default)\n\
"), stdout);
+# endif
fputs (_("\
-z, --zero end each output line with NUL, not newline,\n\
and disable file name escaping\n\
{
putchar (' ');
+# if HASH_ALGO_CKSUM
+ /* Simplify output as always in binary mode. */
+ putchar (' ');
+# else
putchar (binary_file ? '*' : ' ');
+# endif
print_filename (file, needs_escape);
}
bool do_check = false;
int opt;
bool ok = true;
- int binary = -1;
#if HASH_ALGO_CKSUM
+ int binary = 1;
bool prefix_tag = true;
#else
+ int binary = -1;
bool prefix_tag = false;
#endif
break;
#endif
#if !HASH_ALGO_SUM
- case 'b':
- binary = 1;
- break;
case 'c':
do_check = true;
break;
warn = false;
quiet = false;
break;
+# if !HASH_ALGO_CKSUM
+ case 'b':
+ binary = 1;
+ break;
case 't':
binary = 0;
break;
+# endif
case 'w':
status_only = false;
warn = true;
}
#endif
+#if !HASH_ALGO_CKSUM
if (0 <= binary && do_check)
{
error (0, 0, _("the --binary and --text options are meaningless when "
"verifying checksums"));
usage (EXIT_FAILURE);
}
+#endif
if (ignore_missing && !do_check)
{