--- find/find.c | 26 ++++++++++++++++------- find/fstype.c | 8 +++++- find/ftsfind.c | 7 ++++- find/parser.c | 21 ++++++++++-------- find/pred.c | 15 ++++++++++-- find/tree.c | 2 +- lib/regextype.c | 2 +- locate/locate.c | 61 ++++++++++++++++++++++++++++++------------------------ xargs/xargs.c | 36 ++++++++++++++++++++----------- 9 files changed, 112 insertions(+), 66 deletions(-)
diff --git a/find/find.c b/find/find.c index acee35e..7022d05 100644 --- a/find/find.c +++ b/find/find.c @@ -64,6 +64,7 @@ # define _(Text) Text #define textdomain(Domain) #define bindtextdomain(Package, Directory) +#define ngettext(singular,plural,n) ((1==n) ? singular : plural) #endif #ifdef gettext_noop # define N_(String) gettext_noop (String) @@ -487,7 +488,8 @@ wd_sanity_check(const char *thing_to_stat, { fstype = filesystem_type(newinfo, current_dir); error (1, 0, - _("%s%s changed during execution of %s (old device number %ld, new device number %ld, file system type is %s) [ref %ld]"), + _("%1$s%2$s changed during execution of %3$s " + "(old device number %4$ld, new device number %5$ld, file system type is %6$s) [ref %7$ld]"), safely_quote_err_filename(0, specific_what), parent ? "/.." : "", safely_quote_err_filename(1, progname), @@ -524,7 +526,8 @@ wd_sanity_check(const char *thing_to_stat, error ((isfatal == FATAL_IF_SANITY_CHECK_FAILS) ? 1 : 0, 0, /* no relevant errno value */ - _("%s%s changed during execution of %s (old inode number %ld, new inode number %ld, file system type is %s) [ref %ld]"), + _("%1$s%2$s changed during execution of %3$s " + "(old inode number %4$ld, new inode number %5$ld, file system type is %5$s) [ref %7$ld]"), safely_quote_err_filename(0, specific_what), parent ? "/.." : "", safely_quote_err_filename(1, progname), @@ -1121,12 +1124,14 @@ issue_loop_warning(const char *name, const char *pathname, int level) * to /a/b/c. */ error(0, 0, - _("Filesystem loop detected; %s has the same device number and inode as a directory which is %d %s."), + ngettext( + "Filesystem loop detected; %1$s has the same device number and inode as " + "a directory which is %2$d level higher in the file system hierarchy", + "Filesystem loop detected; %1$s has the same device number and inode as " + "a directory which is %2$d levels higher in the file system hierarchy", + (long)distance), safely_quote_err_filename(0, pathname), - distance, - (distance == 1 ? - _("level higher in the file system hierarchy") : - _("levels higher in the file system hierarchy"))); + distance); } } @@ -1415,7 +1420,12 @@ process_dir (char *pathname, char *name, int pathlen, const struct stat *statp, * doesn't really handle hard links with Unix semantics. * In the latter case, -noleaf should be used routinely. */ - error(0, 0, _("WARNING: Hard link count is wrong for %s (saw only st_nlink=%d but we already saw %d subdirectories): this may be a bug in your file system driver. Automatically turning on find's -noleaf option. Earlier results may have failed to include directories that should have been searched."), + error(0, 0, _("WARNING: Hard link count is wrong for %1$s " + "(saw only st_nlink=%2$d but we already saw %3$d subdirectories): " + "this may be a bug in your file system driver. " + "Automatically turning on find's -noleaf option. " + "Earlier results may have failed to include directories " + "that should have been searched."), safely_quote_err_filename(0, pathname), statp->st_nlink, dircount); diff --git a/find/fstype.c b/find/fstype.c index 75b3371..ed2946a 100644 --- a/find/fstype.c +++ b/find/fstype.c @@ -246,8 +246,12 @@ file_system_type_uncached (const struct stat *statp, const char *path) /* Don't cache unknown values. */ fstype_known = (type != NULL); - - return type ? type : xstrdup(_("unknown")); + if (type) + return type; + else + return xstrdup(_("unknown" + /* TRANSLATORS: this is essentially an abbreviation + for "unknown file system type" */)); } diff --git a/find/ftsfind.c b/find/ftsfind.c index 7f882a6..361cace 100644 --- a/find/ftsfind.c +++ b/find/ftsfind.c @@ -296,7 +296,7 @@ issue_loop_warning(FTSENT * ent) */ error(0, 0, _("File system loop detected; " - "%s is part of the same file system loop as %s."), + "%1$s is part of the same file system loop as %2$s."), safely_quote_err_filename(0, ent->fts_path), partial_quotearg_n(1, ent->fts_cycle->fts_path, @@ -607,7 +607,10 @@ find(char *arg) p = fts_open(arglist, ftsoptions, NULL); if (NULL == p) { - error (0, errno, _("cannot search %s"), + error (0, errno, _("cannot search %s" + /* TRANSLATORS: the argument is either + a file or a directory. */ + ), safely_quote_err_filename(0, arg)); } else diff --git a/find/parser.c b/find/parser.c index 7eaefc1..a4d79eb 100644 --- a/find/parser.c +++ b/find/parser.c @@ -527,9 +527,9 @@ found_parser(const char *original_arg, const struct parser_table *entry) { /* option which follows a non-option */ error (0, 0, - _("warning: you have specified the %s " - "option after a non-option argument %s, " - "but options are not positional (%s affects " + _("warning: you have specified the %1$s " + "option after a non-option argument %2$s, " + "but options are not positional (%3$s affects " "tests specified before it as well as those " "specified after it). Please specify options " "before other arguments.\n"), @@ -1063,9 +1063,9 @@ parse_group (const struct parser_table* entry, char **argv, int *arg_ptr) else { /* XXX: no test in test suite for this */ - error(1, 0, _("%s is not the name of an existing group and" + error(1, 0, _("%1$s is not the name of an existing group and" " it does not look like a numeric group ID " - "because it has the unexpected suffix %s"), + "because it has the unexpected suffix %2$s"), quotearg_n_style(0, options.err_quoting_style, groupname), quotearg_n_style(1, options.err_quoting_style, groupname+gid_len)); return false; @@ -1346,7 +1346,7 @@ insert_depthspec(const struct parser_table* entry, char **argv, int *arg_ptr, return parse_noop(entry, argv, arg_ptr); } } - error(1, 0, _("Expected a positive decimal integer argument to %s, but got %s"), + error(1, 0, _("Expected a positive decimal integer argument to %1$s, but got %2$s"), predicate, quotearg_n_style(0, options.err_quoting_style, depthstr)); return false; @@ -1846,7 +1846,10 @@ parse_perm (const struct parser_table* entry, char **argv, int *arg_ptr) { change = mode_compile (perm_expr + mode_start); if (NULL == change) - error (1, 0, _("invalid mode %s"), + error (1, 0, _("invalid mode %s" + /* TRANSLATORS: the argument is a + * file permission string like 'u=rw,go=' + */), quotearg_n_style(0, options.err_quoting_style, perm_expr)); } perm_val[0] = mode_adjust (0, false, 0, change, NULL); @@ -2979,9 +2982,9 @@ check_path_safety(const char *action, char **argv) else if ('/' != s[0]) { /* Relative paths are also dangerous in $PATH. */ - error(1, 0, _("The relative path %s is included in the PATH " + error(1, 0, _("The relative path %1$s is included in the PATH " "environment variable, which is insecure in " - "combination with the %s action of find. " + "combination with the %2$s action of find. " "Please remove that entry from $PATH"), safely_quote_err_filename(0, s), action); diff --git a/find/pred.c b/find/pred.c index bc26b58..1c00093 100644 --- a/find/pred.c +++ b/find/pred.c @@ -408,7 +408,12 @@ pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred } } } - error (0, errno, _("cannot delete %s"), + error (0, errno, _("cannot delete %s" + /* TRANSLATORS: the argument is either a + * file or a directory, but we do not know which. + * Mail [EMAIL PROTECTED] if you cannot correctly + * translate the string without knowing. + */), safely_quote_err_filename(0, pathname)); /* Previously I had believed that having the -delete action * return false provided the user with control over whether an @@ -1411,7 +1416,11 @@ is_ok(const char *program, const char *arg) This standard does not have requirements for locales other than POSIX */ /* XXX: printing UNTRUSTED data here. */ - fprintf (stderr, _("< %s ... %s > ? "), program, arg); + fprintf (stderr, _("< %s ... %s > ? " + /* TRANSLATORS: we would like, if possible, the final non-blank + * character of this string to be '?', but it is not + * wholly essential. */ + ), program, arg); fflush (stderr); return yesno(); } @@ -1969,7 +1978,7 @@ launch (const struct buildcmd_control *ctl, if (WIFSIGNALED (wait_status)) { - error (0, 0, _("%s terminated by signal %d"), + error (0, 0, _("%1$s terminated by signal %2$d"), quotearg_n_style(0, options.err_quoting_style, buildstate->cmd_argv[0]), WTERMSIG (wait_status)); diff --git a/find/tree.c b/find/tree.c index 7420c60..38c198b 100644 --- a/find/tree.c +++ b/find/tree.c @@ -1259,7 +1259,7 @@ build_expression_tree(int argc, char *argv[], int end_of_leading_options) } else { - error (1, 0, _("invalid argument `%s' to `%s'"), + error (1, 0, _("invalid argument `%1$s' to `%2$s'"), argv[i], predicate_name); } } diff --git a/lib/regextype.c b/lib/regextype.c index e060244..d43ae54 100644 --- a/lib/regextype.c +++ b/lib/regextype.c @@ -103,7 +103,7 @@ get_regex_type(const char *s) p += sprintf(p, "%s", quote(regex_map[i].name)); } - error(1, 0, _("Unknown regular expression type %s; valid types are %s."), + error(1, 0, _("Unknown regular expression type %1$s; valid types are %2$s."), quote(s), buf); /*NOTREACHED*/ diff --git a/locate/locate.c b/locate/locate.c index a55d807..78810ab 100644 --- a/locate/locate.c +++ b/locate/locate.c @@ -103,6 +103,7 @@ # define _(Text) Text #define textdomain(Domain) #define bindtextdomain(Package, Directory) +#define ngettext(singular,plural,n) ((1==n) ? singular : plural) #endif #ifdef gettext_noop # define N_(String) gettext_noop (String) @@ -889,30 +890,34 @@ visit_count(struct process_data *procdata, void *context) static void print_stats(int argc, size_t database_file_size) { - char hbuf[LONGEST_HUMAN_READABLE + 1]; + char hbuf1[LONGEST_HUMAN_READABLE + 1]; + char hbuf2[LONGEST_HUMAN_READABLE + 1]; + char hbuf3[LONGEST_HUMAN_READABLE + 1]; + char hbuf4[LONGEST_HUMAN_READABLE + 1]; - printf(_("Locate database size: %s bytes\n"), + printf(ngettext("Locate database size: %s byte\n", + "Locate database size: %s bytes\n", + database_file_size), human_readable ((uintmax_t) database_file_size, - hbuf, human_ceiling, 1, 1)); + hbuf1, human_ceiling, 1, 1)); printf( (results_were_filtered ? - _("Matching Filenames: %s ") : - _("All Filenames: %s ")), - human_readable (statistics.total_filename_count, - hbuf, human_ceiling, 1, 1)); - printf(_("with a cumulative length of %s bytes"), - human_readable (statistics.total_filename_length, - hbuf, human_ceiling, 1, 1)); - - printf(_("\n\tof which %s contain whitespace, "), - human_readable (statistics.whitespace_count, - hbuf, human_ceiling, 1, 1)); - printf(_("\n\t%s contain newline characters, "), - human_readable (statistics.newline_count, - hbuf, human_ceiling, 1, 1)); - printf(_("\n\tand %s contain characters with the high bit set.\n"), - human_readable (statistics.highbit_filename_count, - hbuf, human_ceiling, 1, 1)); + _("Matching Filenames: %s\n") : + _("All Filenames: %s\n")), + human_readable (statistics.total_filename_count, + hbuf1, human_ceiling, 1, 1)); + /* XXX: We would ideally use ngettext() here, but I don't know + * how to use it to handle more than one possibly-plural thing/ + */ + printf(_("File names have a cumulative length of %1$s bytes.\n" + "Of those file names,\n" + "\n\t%2$s contain whitespace, " + "\n\t%3$s contain newline characters, " + "\n\tand %4$s contain characters with the high bit set.\n"), + human_readable (statistics.total_filename_length, hbuf1, human_ceiling, 1, 1), + human_readable (statistics.whitespace_count, hbuf2, human_ceiling, 1, 1), + human_readable (statistics.newline_count, hbuf3, human_ceiling, 1, 1), + human_readable (statistics.highbit_filename_count, hbuf4, human_ceiling, 1, 1)); if (!argc) { @@ -993,8 +998,8 @@ looking_at_slocate_locatedb (const char *filename, * We don't know how to handle those. */ error(0, 0, - _("locate database %s looks like an slocate " - "database but it seems to have security level %c, " + _("locate database %1$s looks like an slocate " + "database but it seems to have security level %2$c, " "which GNU findutils does not currently support"), quotearg_n_style(0, locale_quoting_style, filename), data[1]); @@ -1124,7 +1129,7 @@ search_one_database (int argc, * so do nothing further */ error(0, 0, - _("%s is an slocate database of unsupported security level %d; skipping it."), + _("%1$s is an slocate database of unsupported security level %2$d; skipping it."), quotearg_n_style(0, locale_quoting_style, procdata.dbfile), slocate_seclevel); return 0; @@ -1342,7 +1347,7 @@ search_one_database (int argc, if (stats) { - printf(_("Database %s is in the %s format.\n"), + printf(_("Database %1$s is in the %2$s format.\n"), procdata.dbfile, format_name); } @@ -1859,10 +1864,12 @@ dolocate (int argc, char **argv, int secure_db_fd) /* For example: warning: database `fred' is more than 8 days old (actual age is 10 days)*/ error (0, 0, - _("warning: database %s is more than %d %s old (actual age is %.1f %s)"), + _("warning: database %1$s is more than %2$d %3$s old (actual age is %4$.1f %5$s)"), quotearg_n_style(0, locale_quoting_style, e), - warn_number_units, _(warn_name_units), - (age/(double)SECONDS_PER_UNIT), _(warn_name_units)); + warn_number_units, + _(warn_name_units), + (age/(double)SECONDS_PER_UNIT), + _(warn_name_units)); } } } diff --git a/xargs/xargs.c b/xargs/xargs.c index 1394fa3..3757cd5 100644 --- a/xargs/xargs.c +++ b/xargs/xargs.c @@ -318,13 +318,15 @@ get_char_oct_or_hex_escape(const char *s) if (16 == base) { error(1, 0, - _("Invalid escape sequence %s in input delimiter specification; character values must not exceed %lx."), + _("Invalid escape sequence %1$s in input delimiter specification; " + "character values must not exceed %2$lx."), s, (unsigned long)UCHAR_MAX); } else { error(1, 0, - _("Invalid escape sequence %s in input delimiter specification; character values must not exceed %lo."), + _("Invalid escape sequence %1$s in input delimiter specification; " + "character values must not exceed %2$lo."), s, (unsigned long)UCHAR_MAX); } } @@ -333,7 +335,8 @@ get_char_oct_or_hex_escape(const char *s) if (0 != *endp) { error(1, 0, - _("Invalid escape sequence %s in input delimiter specification; trailing characters %s not recognised."), + _("Invalid escape sequence %1$s in input delimiter specification; " + "the trailing characters %2$s were not recognised."), s, endp); } @@ -378,7 +381,9 @@ get_input_delimiter(const char *s) else { error(1, 0, - _("Invalid input delimiter specification %s: the delimiter must be either a single character or an escape sequence starting with \\."), + _("Invalid input delimiter specification %s: " + "the delimiter must be either a single character " + "or an escape sequence starting with \\."), s); /*NOTREACHED*/ return 0; @@ -580,8 +585,8 @@ main (int argc, char **argv) if (arg_size > bc_ctl.posix_arg_size_max) { error (0, 0, - _("warning: value %ld for -s option is too large, " - "using %ld instead"), + _("warning: value %1$ld for -s option is too large, " + "using %2$ld instead"), arg_size, bc_ctl.posix_arg_size_max); arg_size = bc_ctl.posix_arg_size_max; } @@ -838,8 +843,11 @@ read_line (void) if (state == QUOTE) { exec_if_possible (); - error (1, 0, _("unmatched %s quote; by default quotes are special to xargs unless you use the -0 option"), - quotc == '"' ? _("double") : _("single")); + if (quotc == '"') + error (1, 0, _("unmatched double quote; by default quotes are special to xargs unless you use the -0 option")); + else + error (1, 0, _("unmatched single quote; by default quotes are special to xargs unless you use the -0 option")); + } if (first && EOF_STR (linebuf)) return -1; @@ -931,8 +939,10 @@ read_line (void) if (c == '\n') { exec_if_possible (); - error (1, 0, _("unmatched %s quote; by default quotes are special to xargs unless you use the -0 option"), - quotc == '"' ? _("double") : _("single")); + if (quotc == '"') + error (1, 0, _("unmatched double quote; by default quotes are special to xargs unless you use the -0 option")); + else + error (1, 0, _("unmatched single quote; by default quotes are special to xargs unless you use the -0 option")); } if (c == quotc) { @@ -1264,14 +1274,14 @@ parse_num (char *str, int option, long int min, long int max, int fatal) val = strtol (str, &eptr, 10); if (eptr == str || *eptr) { - fprintf (stderr, _("%s: invalid number for -%c option\n"), + fprintf (stderr, _("%1$s: invalid number for -%2$c option\n"), program_name, option); usage (stderr); exit(1); } else if (val < min) { - fprintf (stderr, _("%s: value for -%c option should be >= %ld\n"), + fprintf (stderr, _("%1$s: value for -%2$c option should be >= %3%ld\n"), program_name, option, min); if (fatal) { @@ -1285,7 +1295,7 @@ parse_num (char *str, int option, long int min, long int max, int fatal) } else if (max >= 0 && val > max) { - fprintf (stderr, _("%s: value for -%c option should be < %ld\n"), + fprintf (stderr, _("%1$s: value for -%2$c option should be < %3$ld\n"), program_name, option, max); if (fatal) { -- 1.5.3.7 _______________________________________________ Findutils-patches mailing list Findutils-patches@gnu.org http://lists.gnu.org/mailman/listinfo/findutils-patches