From 36b9a1b6ac2730e78c14552fd55795fe10862a3d Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 7 Jan 2012 18:30:14 +0100 Subject: [PATCH] maint: adjust quoting: emit '...', not `...' in diagnostics * src/csplit.c (parse_repeat_count, extract_regexp): As above. * src/date.c (main): Likewise. * src/ls.c (decode_switches): Likewise. * src/od.c (decode_one_format, main): Likewise. * src/pathchk.c (no_leading_hyphen): Likewise. * src/pr.c (main, getoptarg): Likewise. * src/rm.c (diagnose_leading_hyphen): Likewise. * src/sort.c (key_warnings, incompatible_options, main): Likewise. * src/stat.c (print_esc_char): Print '\x', not `\x' in diagnostic. * src/test.c (main): Likewise. * src/touch.c (main): Likewise. * src/tr.c (build_spec_list, validate, append_range): Likewise. * tests/misc/mktemp: This is an unusual case, since the affected string contains only the ` of an `...' string. So we change the long ` to a lone '. * tests/pr/pr-tests: Manual quote adapting fix-up. * tests/ln/hard-to-sym: Likewise. * tests/split/suffix-length: Likewise. * tests/mv/part-fail: Likewise. * tests/misc/chcon: Likewise. * tests/misc/stat-printf: Likewise. --- src/csplit.c | 6 +++--- src/date.c | 4 ++-- src/ls.c | 2 +- src/od.c | 4 ++-- src/pathchk.c | 2 +- src/pr.c | 14 +++++++------- src/rm.c | 2 +- src/sort.c | 22 +++++++++++----------- src/stat.c | 2 +- src/test.c | 2 +- src/touch.c | 4 ++-- src/tr.c | 8 ++++---- tests/ln/hard-to-sym | 6 +++--- tests/misc/chcon | 2 +- tests/misc/mktemp | 2 +- tests/misc/stat-printf | 2 +- tests/mv/part-fail | 2 +- tests/pr/pr-tests | 2 +- tests/split/suffix-length | 2 +- 19 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/csplit.c b/src/csplit.c index 607092a..6488b84 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1070,7 +1070,7 @@ parse_repeat_count (int argnum, struct control *p, char *str) end = str + strlen (str) - 1; if (*end != '}') - error (EXIT_FAILURE, 0, _("%s: `}' is required in repeat count"), str); + error (EXIT_FAILURE, 0, _("%s: '}' is required in repeat count"), str); *end = '\0'; if (str+1 == end-1 && *(str+1) == '*') @@ -1080,7 +1080,7 @@ parse_repeat_count (int argnum, struct control *p, char *str) if (xstrtoumax (str + 1, NULL, 10, &val, "") != LONGINT_OK) { error (EXIT_FAILURE, 0, - _("%s}: integer required between `{' and `}'"), + _("%s}: integer required between '{' and '}'"), global_argv[argnum]); } p->repeat = val; @@ -1107,7 +1107,7 @@ extract_regexp (int argnum, bool ignore, char const *str) closing_delim = strrchr (str + 1, delim); if (closing_delim == NULL) error (EXIT_FAILURE, 0, - _("%s: closing delimiter `%c' missing"), str, delim); + _("%s: closing delimiter '%c' missing"), str, delim); len = closing_delim - str - 1; p = new_control_record (); diff --git a/src/date.c b/src/date.c index 216d5db..5fe8085 100644 --- a/src/date.c +++ b/src/date.c @@ -451,9 +451,9 @@ main (int argc, char **argv) else if (set_date || option_specified_date) { error (0, 0, - _("the argument %s lacks a leading `+';\n" + _("the argument %s lacks a leading '+';\n" "when using an option to specify date(s), any non-option\n" - "argument must be a format string beginning with `+'"), + "argument must be a format string beginning with '+'"), quote (argv[optind])); usage (EXIT_FAILURE); } diff --git a/src/ls.c b/src/ls.c index b12f877..362c58d 100644 --- a/src/ls.c +++ b/src/ls.c @@ -2059,7 +2059,7 @@ decode_switches (int argc, char **argv) char const *const *p = time_style_args; while (*p) fprintf (stderr, " - [posix-]%s\n", *p++); - fputs (_(" - +FORMAT (e.g., +%H:%M) for a `date'-style" + fputs (_(" - +FORMAT (e.g., +%H:%M) for a 'date'-style" " format\n"), stderr); usage (LS_FAILURE); } diff --git a/src/od.c b/src/od.c index 171e6c8..46a6abe 100644 --- a/src/od.c +++ b/src/od.c @@ -816,7 +816,7 @@ this system doesn't provide a %lu-byte floating point type"), break; default: - error (0, 0, _("invalid character `%c' in type string %s"), + error (0, 0, _("invalid character '%c' in type string %s"), *s, quote (s_orig)); return false; } @@ -1598,7 +1598,7 @@ main (int argc, char **argv) break; default: error (EXIT_FAILURE, 0, - _("invalid output address radix `%c'; \ + _("invalid output address radix '%c'; \ it must be one character from [doxn]"), optarg[0]); break; diff --git a/src/pathchk.c b/src/pathchk.c index b337a3b..56490a6 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -167,7 +167,7 @@ no_leading_hyphen (char const *file) for (p = file; (p = strchr (p, '-')); p++) if (p == file || p[-1] == '/') { - error (0, 0, _("leading `-' in a component of file name %s"), + error (0, 0, _("leading '-' in a component of file name %s"), quote (file)); return false; } diff --git a/src/pr.c b/src/pr.c index 3e473fc..867ee83 100644 --- a/src/pr.c +++ b/src/pr.c @@ -909,7 +909,7 @@ main (int argc, char **argv) { /* dominates old opt +... */ if (! optarg) error (EXIT_FAILURE, 0, - _("`--pages=FIRST_PAGE[:LAST_PAGE]' missing argument")); + _("'--pages=FIRST_PAGE[:LAST_PAGE]' missing argument")); else if (! first_last_page (oi, 0, optarg)) error (EXIT_FAILURE, 0, _("invalid page range %s"), quote (optarg)); @@ -976,7 +976,7 @@ main (int argc, char **argv) || tmp_long <= 0 || tmp_long > INT_MAX) { error (EXIT_FAILURE, 0, - _("`-l PAGE_LENGTH' invalid number of lines: %s"), + _("'-l PAGE_LENGTH' invalid number of lines: %s"), quote (optarg)); } lines_per_page = tmp_long; @@ -1000,7 +1000,7 @@ main (int argc, char **argv) || tmp_long > INT_MAX) { error (EXIT_FAILURE, 0, - _("`-N NUMBER' invalid starting line number: %s"), + _("'-N NUMBER' invalid starting line number: %s"), quote (optarg)); } start_line_num = tmp_long; @@ -1012,7 +1012,7 @@ main (int argc, char **argv) if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK || tmp_long < 0 || tmp_long > INT_MAX) error (EXIT_FAILURE, 0, - _("`-o MARGIN' invalid line offset: %s"), quote (optarg)); + _("'-o MARGIN' invalid line offset: %s"), quote (optarg)); chars_per_margin = tmp_long; break; } @@ -1053,7 +1053,7 @@ main (int argc, char **argv) if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK || tmp_long <= 0 || tmp_long > INT_MAX) error (EXIT_FAILURE, 0, - _("`-w PAGE_WIDTH' invalid number of characters: %s"), + _("'-w PAGE_WIDTH' invalid number of characters: %s"), quote (optarg)); if (!truncate_lines) chars_per_line = tmp_long; @@ -1067,7 +1067,7 @@ main (int argc, char **argv) if (xstrtol (optarg, NULL, 10, &tmp_long, "") != LONGINT_OK || tmp_long <= 0 || tmp_long > INT_MAX) error (EXIT_FAILURE, 0, - _("`-W PAGE_WIDTH' invalid number of characters: %s"), + _("'-W PAGE_WIDTH' invalid number of characters: %s"), quote (optarg)); chars_per_line = tmp_long; break; @@ -1197,7 +1197,7 @@ getoptarg (char *arg, char switch_char, char *character, int *number) || tmp_long <= 0 || tmp_long > INT_MAX) { error (0, 0, - _("`-%c' extra characters or invalid number in the argument: %s"), + _("'-%c' extra characters or invalid number in the argument: %s"), switch_char, quote (arg)); usage (EXIT_FAILURE); } diff --git a/src/rm.c b/src/rm.c index a5edfcf..e9d5a59 100644 --- a/src/rm.c +++ b/src/rm.c @@ -115,7 +115,7 @@ diagnose_leading_hyphen (int argc, char **argv) if (arg[0] == '-' && arg[1] && lstat (arg, &st) == 0) { fprintf (stderr, - _("Try `%s ./%s' to remove the file %s.\n"), + _("Try '%s ./%s' to remove the file %s.\n"), argv[0], quotearg_n_style (1, shell_quoting_style, arg), quote (arg)); diff --git a/src/sort.c b/src/sort.c index dd7d563..33f4ffe 100644 --- a/src/sort.c +++ b/src/sort.c @@ -2373,7 +2373,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) umaxtostr (eword + 1 + (key->echar == SIZE_MAX), tmp)); } - error (0, 0, _("obsolescent key `%s' used; consider `%s' instead"), + error (0, 0, _("obsolescent key '%s' used; consider '%s' instead"), obuf, nbuf); } @@ -2391,7 +2391,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) || (!key->skipsblanks && key->schar) || (!key->skipeblanks && key->echar))) error (0, 0, _("leading blanks are significant in key %lu; " - "consider also specifying `b'"), keynum); + "consider also specifying 'b'"), keynum); /* Warn about numeric comparisons spanning fields, as field delimiters could be interpreted as part @@ -2435,13 +2435,13 @@ key_warnings (struct keyfield const *gkey, bool gkey_only) char opts[sizeof short_options]; key_to_opts (&ugkey, opts); error (0, 0, - ngettext ("option `-%s' is ignored", - "options `-%s' are ignored", + ngettext ("option '-%s' is ignored", + "options '-%s' are ignored", select_plural (strlen (opts))), opts); ugkey.reverse = ugkey_reverse; } if (ugkey.reverse && !(stable || unique) && keylist) - error (0, 0, _("option `-r' only applies to last-resort comparison")); + error (0, 0, _("option '-r' only applies to last-resort comparison")); } /* Compare two lines A and B trying every key in sequence until there @@ -3936,7 +3936,7 @@ static void incompatible_options (char const *) ATTRIBUTE_NORETURN; static void incompatible_options (char const *opts) { - error (SORT_FAILURE, 0, _("options `-%s' are incompatible"), opts); + error (SORT_FAILURE, 0, _("options '-%s' are incompatible"), opts); abort (); } @@ -4244,10 +4244,10 @@ main (int argc, char **argv) { char const *optarg1 = argv[optind++]; s = parse_field_count (optarg1 + 1, &key->eword, - N_("invalid number after `-'")); + N_("invalid number after '-'")); if (*s == '.') s = parse_field_count (s + 1, &key->echar, - N_("invalid number after `.'")); + N_("invalid number after '.'")); if (!key->echar && key->eword) { /* obsolescent syntax +A.x -B.y is equivalent to: @@ -4333,7 +4333,7 @@ main (int argc, char **argv) if (*s == '.') { s = parse_field_count (s + 1, &key->schar, - N_("invalid number after `.'")); + N_("invalid number after '.'")); if (! key->schar--) { /* Provoke with `sort -k1.0' */ @@ -4352,7 +4352,7 @@ main (int argc, char **argv) { /* Get POS2. */ s = parse_field_count (s + 1, &key->eword, - N_("invalid number after `,'")); + N_("invalid number after ','")); if (! key->eword--) { /* Provoke with `sort -k1,0' */ @@ -4361,7 +4361,7 @@ main (int argc, char **argv) if (*s == '.') { s = parse_field_count (s + 1, &key->echar, - N_("invalid number after `.'")); + N_("invalid number after '.'")); } s = set_ordering (s, key, bl_end); } diff --git a/src/stat.c b/src/stat.c index 0d40d99..a2a5029 100644 --- a/src/stat.c +++ b/src/stat.c @@ -1041,7 +1041,7 @@ print_esc_char (char c) case '\\': break; default: - error (0, 0, _("warning: unrecognized escape `\\%c'"), c); + error (0, 0, _("warning: unrecognized escape '\\%c'"), c); break; } putchar (c); diff --git a/src/test.c b/src/test.c index 5bf712a..66df2fa 100644 --- a/src/test.c +++ b/src/test.c @@ -855,7 +855,7 @@ main (int margc, char **margv) } } if (margc < 2 || !STREQ (margv[margc - 1], "]")) - test_syntax_error (_("missing `]'"), NULL); + test_syntax_error (_("missing ']'"), NULL); --margc; } diff --git a/src/touch.c b/src/touch.c index 70d7567..0879e43 100644 --- a/src/touch.c +++ b/src/touch.c @@ -411,8 +411,8 @@ main (int argc, char **argv) would fail. However, skip the warning if it ever fails. */ if (tm) error (0, 0, - _("warning: `touch %s' is obsolete; use " - "`touch -t %04ld%02d%02d%02d%02d.%02d'"), + _("warning: 'touch %s' is obsolete; use " + "'touch -t %04ld%02d%02d%02d%02d.%02d'"), argv[optind], tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); diff --git a/src/tr.c b/src/tr.c index 5dc065c..7efb0e3 100644 --- a/src/tr.c +++ b/src/tr.c @@ -670,7 +670,7 @@ append_range (struct Spec_list *list, unsigned char first, unsigned char last) char *tmp2 = make_printable_char (last); error (0, 0, - _("range-endpoints of `%s-%s' are in reverse collating sequence order"), + _("range-endpoints of '%s-%s' are in reverse collating sequence order"), tmp1, tmp2); free (tmp1); free (tmp2); @@ -907,10 +907,10 @@ build_spec_list (const struct E_string *es, struct Spec_list *result) if (opnd_str_len == 0) { if (p[i + 1] == ':') - error (0, 0, _("missing character class name `[::]'")); + error (0, 0, _("missing character class name '[::]'")); else error (0, 0, - _("missing equivalence class character `[==]'")); + _("missing equivalence class character '[==]'")); return false; } @@ -1503,7 +1503,7 @@ when translating")); { error (EXIT_FAILURE, 0, _("when translating, the only character classes that may \ -appear in\nstring2 are `upper' and `lower'")); +appear in\nstring2 are 'upper' and 'lower'")); } validate_case_classes (s1, s2); diff --git a/tests/ln/hard-to-sym b/tests/ln/hard-to-sym index 3ea4570..044b10c 100755 --- a/tests/ln/hard-to-sym +++ b/tests/ln/hard-to-sym @@ -53,7 +53,7 @@ esac ln -s /no-such-dir || framework_failure_ ln -L no-such-dir hard-to-dangle 2>err && fail=1 case `cat err` in - *' accessing 'no-such-dir'\':*) ;; + *" accessing 'no-such-dir'":*) ;; *) fail=1 ;; esac ln -P no-such-dir hard-to-dangle || fail=1 @@ -64,12 +64,12 @@ mkdir d || framework_failure_ ln -s d link-to-dir || framework_failure_ ln -L link-to-dir hard-to-dir-link 2>err && fail=1 case `cat err` in - *': 'link-to-dir'\'': hard link not allowed for directory'*) ;; + *": 'link-to-dir': hard link not allowed for directory"*) ;; *) fail=1 ;; esac ln -P link-to-dir/ hard-to-dir-link 2>err && fail=1 case `cat err` in - *': 'link-to-dir/'\'': hard link not allowed for directory'*) ;; + *": 'link-to-dir/': hard link not allowed for directory"*) ;; *) fail=1 ;; esac ln -P link-to-dir hard-to-dir-link || fail=1 diff --git a/tests/misc/chcon b/tests/misc/chcon index caa4831..6b44580 100755 --- a/tests/misc/chcon +++ b/tests/misc/chcon @@ -71,7 +71,7 @@ EOF compare exp out || fail=1 chcon --verbose -u$u1 f > out || fail=1 -echo 'changing security context of 'f'\' > exp +echo "changing security context of 'f'" > exp compare exp out || fail=1 Exit $fail diff --git a/tests/misc/mktemp b/tests/misc/mktemp index c6291fb..49dfde4 100755 --- a/tests/misc/mktemp +++ b/tests/misc/mktemp @@ -190,7 +190,7 @@ my @Tests = ['pipe-bad-tmpdir', {ENV => "TMPDIR=$bad_dir"}, {ERR_SUBST => "s,($bad_dir/)[^']+': .*,\$1...,"}, - {ERR => "$prog: failed to create file via template `$bad_dir/...\n"}, + {ERR => "$prog: failed to create file via template '$bad_dir/...\n"}, {EXIT => 1}], ['pipe-bad-tmpdir-u', '-u', {OUT => "$bad_dir/tmp.ZZZZZZZZZZ\n"}, {ENV => "TMPDIR=$bad_dir"}, diff --git a/tests/misc/stat-printf b/tests/misc/stat-printf index b576d25..929b255 100755 --- a/tests/misc/stat-printf +++ b/tests/misc/stat-printf @@ -40,7 +40,7 @@ my @Tests = ['hex-1', q!--printf='\x34\xf' .!, {OUT=>"\x34\xf"}], ['hex-2', q!--printf='.\x18p\xfq' .!, {OUT=>".\x18p\x0fq"}], ['hex-3', q!--printf='\x' .!, {OUT=>'x'}, - {ERR=>"$prog: warning: unrecognized escape `\\x'\n"}], + {ERR=>"$prog: warning: unrecognized escape '\\x'\n"}], # With --format, there *is* a trailing newline. ['f-nl', "--format=%n .", {OUT=>".\n"}], diff --git a/tests/mv/part-fail b/tests/mv/part-fail index f5d2bb3..3a3e37f 100755 --- a/tests/mv/part-fail +++ b/tests/mv/part-fail @@ -31,7 +31,7 @@ chmod u-w "$other_partition_tmpdir" || framework_failure_ mv -f k "$other_partition_tmpdir" 2> out && fail=1 printf \ -'mv: inter-device move failed: '%s'\'' to '%s'\'';'\ +"mv: inter-device move failed: '%s' to '%s';"\ ' unable to remove target: Permission denied\n' \ k "$other_partition_tmpdir/k" >exp diff --git a/tests/pr/pr-tests b/tests/pr/pr-tests index 2a333dc..2e1a80c 100755 --- a/tests/pr/pr-tests +++ b/tests/pr/pr-tests @@ -387,7 +387,7 @@ my @tv = ( ['col-0', '-0', '', '', 1, "$prog: invalid number of columns: '0'\n"], ['col-inval', '-'.'9'x100, '', '', 1, - "$prog: invalid number of columns: `". ('9'x100) ."'\n"], + "$prog: invalid number of columns: '". ('9'x100) ."'\n"], # Before coreutils-5.3.1, --pages=1:-1 would be treated like # --pages=1:18446744073709551615. diff --git a/tests/split/suffix-length b/tests/split/suffix-length index 7779ef2..bc65e9f 100755 --- a/tests/split/suffix-length +++ b/tests/split/suffix-length @@ -31,7 +31,7 @@ done files="${files}xba" for f in $files; do - printf 'creating file `%s'\''\n' $f + printf "creating file '%s'"'\n' $f done > exp || framework_failure_ echo split: output file suffixes exhausted \ -- 2.7.4