On 08/24/2012 11:14 AM, Pádraig Brady wrote: > On 08/23/2012 10:31 AM, Ondrej Oprala wrote: >> On 08/23/2012 11:16 AM, Pádraig Brady wrote: >>> On 08/23/2012 10:06 AM, Ondrej Oprala wrote: >>>> echo -E "$ex_output" > exp >>> That's using the shell's version which may not be portable. >>> To select the built echo binary use: env echo ... >>> Or even better, use: printf > >> Corrected :) > > Cool. > I've adjusted docs/tests/filename_unescape() > in the attached diff, which I'll push in a little while. > > Note the filename_unescape() adjustment is to > ensure that '\0' is not written outside the > passed in buffer limits. This eases ongoing maintenance, > but is currently inconsequential as in the BSD case > we will write '\0' to the same place just after, > while in the standard case with the file name at > the end of the line, '\0' will already be present.
On final validation before commit I noticed this issue: $ md5sum --tag --check /dev/null md5sum: the --binary and --text options are meaningless when verifying checksums The following diff adjusts things to have a less confusing error: $ md5sum --tag --check /dev/null md5sum: the --tag option is meaningless when verifying checksums pushing now... Pádraig. diff --git a/src/md5sum.c b/src/md5sum.c index ea76c52..3f35eb8 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -693,7 +693,6 @@ main (int argc, char **argv) bool ok = true; int binary = -1; bool prefix_tag = false; - bool text = false; /* Setting values of global variables. */ initialize_main (&argc, &argv); @@ -723,7 +722,6 @@ main (int argc, char **argv) quiet = false; break; case 't': - text = true; binary = 0; break; case 'w': @@ -752,6 +750,24 @@ main (int argc, char **argv) min_digest_line_length = MIN_DIGEST_LINE_LENGTH; digest_hex_bytes = DIGEST_HEX_BYTES; + if (prefix_tag && !binary) + { + /* This could be supported in a backwards compatible way + by prefixing the output line with a space in text mode. + However that's invasive enough that it was agreed to + not support this mode with --tag, as --text use cases + are adequately supported by the default output format. */ + error (0, 0, _("--tag does not support --text mode")); + usage (EXIT_FAILURE); + } + + if (prefix_tag && do_check) + { + error (0, 0, _("the --tag option is meaningless when " + "verifying checksums")); + usage (EXIT_FAILURE); + } + if (0 <= binary && do_check) { error (0, 0, _("the --binary and --text options are meaningless when " @@ -787,17 +803,6 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (text && prefix_tag) - { - /* This could be supported in a backwards compatible way - by prefixing the output line with a space in text mode. - However that's invasive enough that it was agreed to - not support this mode with --tag, as --text use cases - are adequately supported by the default output format. */ - error (0, 0, _("--tag does not support --text mode")); - usage (EXIT_FAILURE); - } - if (!O_BINARY && binary < 0) binary = 0;