From 92c50e7f527080fa7a1a7745d235f436ff7411fd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 7 Aug 1995 14:57:29 +0000 Subject: Annotate localizable strings with _(...). From Franc,ois. --- src/cat.c | 24 +++++++-------- src/cksum.c | 10 +++---- src/comm.c | 12 ++++---- src/csplit.c | 68 +++++++++++++++++++++---------------------- src/cut.c | 36 +++++++++++------------ src/expand.c | 18 ++++++------ src/fmt.c | 55 ++++++++++++++++++----------------- src/fold.c | 16 +++++----- src/head.c | 22 +++++++------- src/join.c | 26 ++++++++--------- src/md5sum.c | 5 +--- src/nl.c | 12 ++++---- src/od.c | 58 ++++++++++++++++++------------------ src/paste.c | 14 ++++----- src/pr.c | 36 +++++++++++------------ src/sort.c | 40 ++++++++++++------------- src/split.c | 28 +++++++++--------- src/sum.c | 10 +++---- src/tac.c | 28 +++++++++--------- src/tail.c | 32 ++++++++++---------- src/tr.c | 92 +++++++++++++++++++++++++++++----------------------------- src/unexpand.c | 18 ++++++------ src/uniq.c | 14 ++++----- src/wc.c | 12 ++++---- 24 files changed, 343 insertions(+), 343 deletions(-) diff --git a/src/cat.c b/src/cat.c index 0e4ce04b0..b81f3c673 100644 --- a/src/cat.c +++ b/src/cat.c @@ -84,15 +84,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION] [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Concatenate FILE(s), or standard input, to standard output.\n\ \n\ -b, --number-nonblank number nonblank output lines\n\ @@ -109,7 +109,7 @@ Concatenate FILE(s), or standard input, to standard output.\n\ --version output version information and exit\n\ \n\ With no FILE, or when FILE is -, read standard input.\n\ -"); +")); } exit (status); } @@ -267,7 +267,7 @@ main (argc, argv) /* Get device, i-node number, and optimal blocksize of output. */ if (fstat (output_desc, &stat_buf) < 0) - error (1, errno, "standard output"); + error (1, errno, _("standard output")); outsize = ST_BLKSIZE (stat_buf); /* Input file can be output file for non-regular files. @@ -334,7 +334,7 @@ main (argc, argv) if (check_redirection && stat_buf.st_dev == out_dev && stat_buf.st_ino == out_ino) { - error (0, 0, "%s: input file is output file", infile); + error (0, 0, _("%s: input file is output file"), infile); exit_stat = 1; goto contin; } @@ -393,7 +393,7 @@ main (argc, argv) if (have_read_stdin && close (0) < 0) error (1, errno, "-"); if (close (1) < 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_stat); } @@ -435,7 +435,7 @@ simple_cat (buf, bufsize) /* Write this block out. */ if (full_write (output_desc, buf, n_read) < 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); } } @@ -519,7 +519,7 @@ cat (inbuf, insize, outbuf, outsize, quote, do { if (full_write (output_desc, wp, outsize) < 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); wp += outsize; } while (bpout - wp >= outsize); @@ -560,7 +560,7 @@ cat (inbuf, insize, outbuf, outsize, quote, use_fionread = 0; else { - error (0, errno, "cannot do ioctl on `%s'", infile); + error (0, errno, _("cannot do ioctl on `%s'"), infile); exit_stat = 1; newlines2 = newlines; return; @@ -572,7 +572,7 @@ cat (inbuf, insize, outbuf, outsize, quote, int n_write = bpout - outbuf; if (full_write (output_desc, outbuf, n_write) < 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); bpout = outbuf; } diff --git a/src/cksum.c b/src/cksum.c index dfc0c8d48..4e46ddae1 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -265,20 +265,20 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print CRC checksum and byte counts of each FILE.\n\ \n\ --help display this help and exit\n\ --version output version information and exit\n\ -"); +")); } exit (status); } diff --git a/src/comm.c b/src/comm.c index d46d729ac..3238e3b71 100644 --- a/src/comm.c +++ b/src/comm.c @@ -62,15 +62,15 @@ static void usage (int status) { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... LEFT_FILE RIGHT_FILE\n\ -", +"), program_name); - printf ("\ + printf (_("\ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\ \n\ -1 suppress lines unique to left file\n\ @@ -78,7 +78,7 @@ Compare sorted files LEFT_FILE and RIGHT_FILE line by line.\n\ -3 suppress lines unique to both files\n\ --help display this help and exit\n\ --version output version information and exit\n\ -"); +")); } exit (status); } @@ -206,7 +206,7 @@ compare_files (char **infiles) } if (ferror (stdout) || fclose (stdout) == EOF) { - error (0, errno, "write error"); + error (0, errno, _("write error")); ret = 1; } return ret; diff --git a/src/csplit.c b/src/csplit.c index 6c1b6d2cd..e80917d17 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -237,7 +237,7 @@ xmalloc (n) p = malloc (n); if (p == NULL) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); } return p; @@ -263,7 +263,7 @@ xrealloc (p, n) p = realloc (p, n); if (p == NULL) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); } return p; @@ -306,7 +306,7 @@ read_input (dest, max_n_bytes) if (bytes_read < 0) { - error (0, errno, "read error"); + error (0, errno, _("read error")); cleanup (); } @@ -610,7 +610,7 @@ static unsigned int get_first_line_in_buffer () { if (head == NULL && !load_buffer ()) - error (1, errno, "input disappeared"); + error (1, errno, _("input disappeared")); return head->first_available; } @@ -737,7 +737,7 @@ write_to_file (last_line, ignore, argnum) if (first_line > last_line) { - error (0, 0, "%s: line number out of range", global_argv[argnum]); + error (0, 0, _("%s: line number out of range"), global_argv[argnum]); cleanup (); } @@ -748,7 +748,7 @@ write_to_file (last_line, ignore, argnum) line = remove_line (); if (line == NULL) { - error (0, 0, "%s: line number out of range", global_argv[argnum]); + error (0, 0, _("%s: line number out of range"), global_argv[argnum]); cleanup (); } if (!ignore) @@ -775,10 +775,10 @@ handle_line_error (p, repetition) struct control *p; int repetition; { - fprintf (stderr, "%s: `%d': line number out of range", + fprintf (stderr, _("%s: `%d': line number out of range"), program_name, p->lines_required); if (repetition) - fprintf (stderr, " on repetition %d\n", repetition); + fprintf (stderr, _(" on repetition %d\n"), repetition); else fprintf (stderr, "\n"); @@ -830,11 +830,11 @@ regexp_error (p, repetition, ignore) int repetition; boolean ignore; { - fprintf (stderr, "%s: `%s': match not found", + fprintf (stderr, _("%s: `%s': match not found"), program_name, global_argv[p->argnum]); if (repetition) - fprintf (stderr, " on repetition %d\n", repetition); + fprintf (stderr, _(" on repetition %d\n"), repetition); else fprintf (stderr, "\n"); @@ -893,7 +893,7 @@ process_regexp (p, repetition) 0, line_len, (struct re_registers *) 0); if (ret == -2) { - error (0, 0, "error in regular expression search"); + error (0, 0, _("error in regular expression search")); cleanup (); } if (ret == -1) @@ -933,7 +933,7 @@ process_regexp (p, repetition) 0, line_len, (struct re_registers *) 0); if (ret == -2) { - error (0, 0, "error in regular expression search"); + error (0, 0, _("error in regular expression search")); cleanup (); } if (ret >= 0) @@ -1036,7 +1036,7 @@ close_output_file () { if (fclose (output_stream) == EOF) { - error (0, errno, "write error for `%s'", output_filename); + error (0, errno, _("write error for `%s'"), output_filename); cleanup (); } if (bytes_written == 0 && elide_empty_files) @@ -1146,10 +1146,10 @@ check_for_offset (p, str, num) char *num; { if (*num != '-' && *num != '+') - error (1, 0, "%s: `+' or `-' expected after delimeter", str); + error (1, 0, _("%s: `+' or `-' expected after delimeter"), str); if (!string_to_number (&p->offset, num + 1)) - error (1, 0, "%s: integer expected after `%c'", str, *num); + error (1, 0, _("%s: integer expected after `%c'"), str, *num); if (*num == '-') p->offset = -p->offset; @@ -1170,14 +1170,14 @@ parse_repeat_count (argnum, p, str) end = str + strlen (str) - 1; if (*end != '}') - error (1, 0, "%s: `}' is required in repeat count", str); + error (1, 0, _("%s: `}' is required in repeat count"), str); *end = '\0'; if (str+1 == end-1 && *(str+1) == '*') p->repeat_forever = 1; else if (!string_to_number (&p->repeat, str + 1)) - error (1, 0, "%s}: integer required between `{' and `}'", + error (1, 0, _("%s}: integer required between `{' and `}'"), global_argv[argnum]); *end = '}'; @@ -1203,7 +1203,7 @@ extract_regexp (argnum, ignore, str) closing_delim = strrchr (str + 1, delim); if (closing_delim == NULL) - error (1, 0, "%s: closing delimeter `%c' missing", str, delim); + error (1, 0, _("%s: closing delimeter `%c' missing"), str, delim); len = closing_delim - str - 1; p = new_control_record (); @@ -1219,7 +1219,7 @@ extract_regexp (argnum, ignore, str) err = re_compile_pattern (p->regexpr, len, &p->re_compiled); if (err) { - error (0, 0, "%s: invalid regular expression: %s", str, err); + error (0, 0, _("%s: invalid regular expression: %s"), str, err); cleanup (); } @@ -1252,7 +1252,7 @@ parse_patterns (argc, start, argv) p = new_control_record (); p->argnum = i; if (!string_to_number (&p->lines_required, argv[i])) - error (1, 0, "%s: invalid pattern", argv[i]); + error (1, 0, _("%s: invalid pattern"), argv[i]); } if (i + 1 < argc && *argv[i + 1] == '{') @@ -1375,14 +1375,14 @@ get_format_conv_type (format_ptr) break; case 0: - error (1, 0, "missing conversion specifier in suffix"); + error (1, 0, _("missing conversion specifier in suffix")); break; default: if (ISPRINT (ch)) - error (1, 0, "invalid conversion specifier in suffix: %c", ch); + error (1, 0, _("invalid conversion specifier in suffix: %c"), ch); else - error (1, 0, "invalid conversion specifier in suffix: \\%.3o", ch); + error (1, 0, _("invalid conversion specifier in suffix: \\%.3o"), ch); } } @@ -1414,9 +1414,9 @@ max_out (format) } if (percents == 0) - error (1, 0, "missing %% conversion specification in suffix"); + error (1, 0, _("missing %% conversion specification in suffix")); else if (percents > 1) - error (1, 0, "too many %% conversion specifications in suffix"); + error (1, 0, _("too many %% conversion specifications in suffix")); return out_count; } @@ -1425,7 +1425,7 @@ static void interrupt_handler (signum) int signum; { - error (0, 0, "interrupted"); + error (0, 0, _("interrupted")); cleanup (); } @@ -1499,7 +1499,7 @@ main (argc, argv) case 'n': if (!string_to_number (&digits, optarg)) - error (1, 0, "%s: invalid number", optarg); + error (1, 0, _("%s: invalid number"), optarg); break; case 's': @@ -1526,7 +1526,7 @@ main (argc, argv) if (argc - optind < 2) { - error (0, 0, "too few arguments"); + error (0, 0, _("too few arguments")); usage (1); } @@ -1543,7 +1543,7 @@ main (argc, argv) if (close (input_desc) < 0) { - error (0, errno, "read error"); + error (0, errno, _("read error")); cleanup (); } @@ -1555,15 +1555,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... FILE PATTERN...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Output pieces of FILE separated by PATTERN(s) to files `xx01', `xx02', ...,\n\ and output byte counts of each piece to standard output.\n\ \n\ @@ -1585,7 +1585,7 @@ Read standard input if FILE is -. Each PATTERN may be:\n\ {*} repeat the previous pattern as many times as possible\n\ \n\ A line OFFSET is a required `+' or `-' followed by a positive integer.\n\ -"); +")); } exit (status); } diff --git a/src/cut.c b/src/cut.c index cd103d3ed..473db2ae0 100644 --- a/src/cut.c +++ b/src/cut.c @@ -192,15 +192,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print selected parts of lines from each FILE to standard output.\n\ \n\ -b, --bytes=LIST output only these bytes\n\ @@ -221,7 +221,7 @@ range, or many ranges separated by commas. Each range is one of:\n\ -M from first to M'th (included) byte, character or field\n\ \n\ With no FILE, or when FILE is -, read standard input.\n\ -"); +")); } exit (status); } @@ -365,7 +365,7 @@ set_fields (fieldstr) { /* Starting a range. */ if (dash_found) - FATAL_ERROR ("invalid byte or field list"); + FATAL_ERROR (_("invalid byte or field list")); dash_found++; fieldstr++; @@ -396,7 +396,7 @@ set_fields (fieldstr) { /* `m-n' or `-n' (1-n). */ if (value < initial) - FATAL_ERROR ("invalid byte or field list"); + FATAL_ERROR (_("invalid byte or field list")); /* Is there already a range going to end of line? */ if (eol_range_start != 0) @@ -456,7 +456,7 @@ set_fields (fieldstr) fieldstr++; } else - FATAL_ERROR ("invalid byte or field list"); + FATAL_ERROR (_("invalid byte or field list")); } max_range_endpoint = 0; @@ -711,26 +711,26 @@ main (argc, argv) case 'c': /* Build the byte list. */ if (operating_mode != undefined_mode) - FATAL_ERROR ("only one type of list may be specified"); + FATAL_ERROR (_("only one type of list may be specified")); operating_mode = byte_mode; if (set_fields (optarg) == 0) - FATAL_ERROR ("missing list of positions"); + FATAL_ERROR (_("missing list of positions")); break; case 'f': /* Build the field list. */ if (operating_mode != undefined_mode) - FATAL_ERROR ("only one type of list may be specified"); + FATAL_ERROR (_("only one type of list may be specified")); operating_mode = field_mode; if (set_fields (optarg) == 0) - FATAL_ERROR ("missing list of fields"); + FATAL_ERROR (_("missing list of fields")); break; case 'd': /* New delimiter. */ /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */ if (optarg[0] != '\0' && optarg[1] != '\0') - FATAL_ERROR ("the delimiter must be a single character"); + FATAL_ERROR (_("the delimiter must be a single character")); delim = optarg[0]; break; @@ -756,14 +756,14 @@ main (argc, argv) usage (0); if (operating_mode == undefined_mode) - FATAL_ERROR ("you must specify a list of bytes, characters, or fields"); + FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); if (delim != '\0' && operating_mode != field_mode) - FATAL_ERROR ("a delimiter may be specified only when operating on fields"); + FATAL_ERROR (_("a delimiter may be specified only when operating on fields")); if (suppress_non_delimited && operating_mode != field_mode) - FATAL_ERROR ("suppressing non-delimited lines makes sense\n\ -\tonly when operating on fields"); + FATAL_ERROR (_("suppressing non-delimited lines makes sense\n\ +\tonly when operating on fields")); if (delim == '\0') delim = '\t'; @@ -780,7 +780,7 @@ main (argc, argv) exit_status = 1; } if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } diff --git a/src/expand.c b/src/expand.c index eba1be78c..e0d4d1f27 100644 --- a/src/expand.c +++ b/src/expand.c @@ -185,7 +185,7 @@ main (argc, argv) if (have_read_stdin && fclose (stdin) == EOF) error (1, errno, "-"); if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -213,7 +213,7 @@ parse_tabstops (stops) tabval = tabval * 10 + *stops - '0'; } else - error (1, 0, "tab size contains an invalid character"); + error (1, 0, _("tab size contains an invalid character")); } add_tabstop (tabval); @@ -248,9 +248,9 @@ validate_tabstops (tabs, entries) for (i = 0; i < entries; i++) { if (tabs[i] == 0) - error (1, 0, "tab size cannot be 0"); + error (1, 0, _("tab size cannot be 0")); if (tabs[i] <= prev_tab) - error (1, 0, "tab sizes must be ascending"); + error (1, 0, _("tab sizes must be ascending")); prev_tab = tabs[i]; } } @@ -389,15 +389,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Convert tabs in each FILE to spaces, writing to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -408,7 +408,7 @@ With no FILE, or when FILE is -, read standard input.\n\ --version output version information and exit\n\ \n\ Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\ -"); +")); } exit (status); } diff --git a/src/fmt.c b/src/fmt.c index 7545081b2..f51444020 100644 --- a/src/fmt.c +++ b/src/fmt.c @@ -142,30 +142,32 @@ struct Word /* Forward declarations. */ -/* My AC_PROTOTYPES would be better than __STDC__. FIXME :-). */ -#if __STDC__ -#define _(x) x -#else -#define _(x) () +/* My fp_PROTOTYPES would be better than __STDC__. FIXME :-). */ +#ifndef __P +# if __STDC__ +# define __P(Args) Args +# else +# define __P(Args) () +# endif #endif -static void set_prefix _ ((char *p)); -static void fmt _ ((FILE *f)); -static bool get_paragraph _ ((FILE *f)); -static int get_line _ ((FILE *f, int c)); -static int get_prefix _ ((FILE *f)); -static int get_space _ ((FILE *f, int c)); -static int copy_rest _ ((FILE *f, int c)); -static bool same_para _ ((int c)); -static void flush_paragraph _ ((void)); -static void fmt_paragraph _ ((void)); -static void check_punctuation _ ((WORD *w)); -static COST base_cost _ ((WORD *this)); -static COST line_cost _ ((WORD *next, int len)); -static void put_paragraph _ ((WORD *finish)); -static void put_line _ ((WORD *w, int indent)); -static void put_word _ ((WORD *w)); -static void put_space _ ((int space)); +static void set_prefix __P ((char *p)); +static void fmt __P ((FILE *f)); +static bool get_paragraph __P ((FILE *f)); +static int get_line __P ((FILE *f, int c)); +static int get_prefix __P ((FILE *f)); +static int get_space __P ((FILE *f, int c)); +static int copy_rest __P ((FILE *f, int c)); +static bool same_para __P ((int c)); +static void flush_paragraph __P ((void)); +static void fmt_paragraph __P ((void)); +static void check_punctuation __P ((WORD *w)); +static COST base_cost __P ((WORD *this)); +static COST line_cost __P ((WORD *next, int len)); +static void put_paragraph __P ((WORD *finish)); +static void put_line __P ((WORD *w, int indent)); +static void put_word __P ((WORD *w)); +static void put_space __P ((int space)); /* The name this program was run with. */ const char *program_name; @@ -273,11 +275,12 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", program_name); + fprintf (stderr, _("Try `%s --help' for more information.\n"), + program_name); else { - printf ("Usage: %s [-DIGITS] [OPTION]... [FILE]...\n", program_name); - fputs ("\ + printf (_("Usage: %s [-DIGITS] [OPTION]... [FILE]...\n"), program_name); + fputs (_("\ Reformat each paragraph in the FILE(s), writing to standard output.\n\ If no FILE or if FILE is `-', read standard input.\n\ \n\ @@ -291,7 +294,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\ --help display this help and exit\n\ --version output version information and exit\n\ \n\ -In -wNUMBER, the letter `w' may be omitted.\n", +In -wNUMBER, the letter `w' may be omitted.\n"), stdout); } exit (status); diff --git a/src/fold.c b/src/fold.c index 2dade75e2..7fcbcf973 100644 --- a/src/fold.c +++ b/src/fold.c @@ -68,22 +68,22 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Wrap input lines in each FILE (standard input by default), writing to\n\ standard output.\n\ \n\ -b, --bytes count bytes rather than columns\n\ -s, --spaces break at word boundaries\n\ -w, --width=WIDTH use WIDTH columns instead of 80\n\ -"); +")); } exit (status); } @@ -135,7 +135,7 @@ main (argc, argv) case 'w': /* Line width. */ width = atoi (optarg); if (width < 1) - error (1, 0, "%s: invalid line width", optarg); + error (1, 0, _("%s: invalid line width"), optarg); break; default: @@ -161,7 +161,7 @@ main (argc, argv) if (have_read_stdin && fclose (stdin) == EOF) error (1, errno, "-"); if (fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (errs); } @@ -282,7 +282,7 @@ fold_file (filename, width) if (ferror (stdout)) { - error (0, errno, "write error"); + error (0, errno, _("write error")); return 1; } diff --git a/src/head.c b/src/head.c index 4670ab16e..0c1baf3c4 100644 --- a/src/head.c +++ b/src/head.c @@ -142,7 +142,7 @@ main (argc, argv) break; default: - error (0, 0, "unrecognized option `-%c'", *argv[1]); + error (0, 0, _("unrecognized option `-%c'"), *argv[1]); usage (1); } ++argv[1]; @@ -170,7 +170,7 @@ main (argc, argv) getnum: number = atou (optarg); if (number == -1) - error (1, 0, "invalid number `%s'", optarg); + error (1, 0, _("invalid number `%s'"), optarg); break; case 'q': @@ -214,7 +214,7 @@ main (argc, argv) if (have_read_stdin && close (0) < 0) error (1, errno, "-"); if (fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -229,7 +229,7 @@ head_file (filename, number) if (!strcmp (filename, "-")) { have_read_stdin = 1; - filename = "standard input"; + filename = _("standard input"); if (print_headers) write_header (filename); return head (filename, 0, number); @@ -296,7 +296,7 @@ head_bytes (filename, fd, bytes_to_write) if (bytes_read > bytes_to_write) bytes_read = bytes_to_write; if (fwrite (buffer, 1, bytes_read, stdout) == 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); bytes_to_write -= bytes_read; } return 0; @@ -327,7 +327,7 @@ head_lines (filename, fd, lines_to_write) if (buffer[bytes_to_write++] == '\n' && --lines_to_write == 0) break; if (fwrite (buffer, 1, bytes_to_write, stdout) == 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); } return 0; } @@ -377,15 +377,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print first 10 lines of each FILE to standard output.\n\ With more than one FILE, precede each with a header giving the file name.\n\ With no FILE, or when FILE is -, read standard input.\n\ @@ -400,7 +400,7 @@ With no FILE, or when FILE is -, read standard input.\n\ SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\ If -VALUE is used as first OPTION, read -c VALUE when one of\n\ multipliers bkm follows concatenated, else read -n VALUE.\n\ -"); +")); } exit (status); } diff --git a/src/join.c b/src/join.c index c0d098b5f..58ece5791 100644 --- a/src/join.c +++ b/src/join.c @@ -641,7 +641,7 @@ main (argc, argv) else if (val == 2) print_unpairables_2 = 1; else - error (2, 0, "invalid file number for `-a'"); + error (2, 0, _("invalid file number for `-a'")); break; case 'e': @@ -651,27 +651,27 @@ main (argc, argv) case '1': val = atoi (optarg); if (val <= 0) - error (2, 0, "invalid field number for `-1'"); + error (2, 0, _("invalid field number for `-1'")); join_field_1 = val - 1; break; case '2': val = atoi (optarg); if (val <= 0) - error (2, 0, "invalid field number for `-2'"); + error (2, 0, _("invalid field number for `-2'")); join_field_2 = val - 1; break; case 'j': val = atoi (optarg); if (val <= 0) - error (2, 0, "invalid field number for `-j'"); + error (2, 0, _("invalid field number for `-j'")); join_field_1 = join_field_2 = val - 1; break; case 'o': if (add_field_list (optarg) == 0) - error (2, 0, "invalid field list for `-o'"); + error (2, 0, _("invalid field list for `-o'")); break; case 't': @@ -685,7 +685,7 @@ main (argc, argv) else if (val == 2) print_unpairables_2 = 1; else - error (2, 0, "invalid file number for `-v'"); + error (2, 0, _("invalid file number for `-v'")); print_pairables = 0; break; @@ -722,13 +722,13 @@ main (argc, argv) if (!fp2) error (1, errno, "%s", names[1]); if (fp1 == fp2) - error (1, errno, "both files cannot be standard input"); + error (1, errno, _("both files cannot be standard input")); join (fp1, fp2); if ((fp1 == stdin || fp2 == stdin) && fclose (stdin) == EOF) error (1, errno, "-"); if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (0); } @@ -738,15 +738,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... FILE1 FILE2\n\ -", +"), program_name); - printf ("\ + printf (_("\ For each pair of input lines with identical join fields, write a line to\n\ standard output. The default join field is the first, delimited\n\ by whitespace. When FILE1 or FILE2 (not both) is -, read standard input.\n\ @@ -767,7 +767,7 @@ Any FIELD is a field number counted from 1. FORMAT is one or more\n\ comma or blank separated specifications, each being `SIDE.FIELD'.\n\ Default FORMAT outputs the join field, the remaining fields from\n\ FILE1, the remaining fields from FILE2, all separated by CHAR.\n\ -"); +")); } exit (status); } diff --git a/src/md5sum.c b/src/md5sum.c index 743681db0..c3e7ab56b 100644 --- a/src/md5sum.c +++ b/src/md5sum.c @@ -59,9 +59,6 @@ # define TOLOWER(c) (ISUPPER (c) ? tolower (c) : (c)) #endif -/* Hook for i18n. */ -#define _(str) str - /* Nonzero if any of the files read were the standard input. */ static int have_read_stdin; @@ -247,7 +244,7 @@ md5_check (checkfile_name, binary) if (strcmp (checkfile_name, "-") == 0) { have_read_stdin = 1; - checkfile_name = "standard input"; + checkfile_name = _("standard input"); checkfile_stream = stdin; } else diff --git a/src/nl.c b/src/nl.c index 7caea7e99..d2a489d87 100644 --- a/src/nl.c +++ b/src/nl.c @@ -316,7 +316,7 @@ main (argc, argv) exit_status = 1; } if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -558,15 +558,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Write each FILE to standard output, with line numbers added.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -599,7 +599,7 @@ FORMAT is one of:\n\ rn right justified, no leading zeros\n\ rz right justified, leading zeros\n\ \n\ -"); +")); } exit (status); } diff --git a/src/od.c b/src/od.c index ee40f6cea..25ec50ee6 100644 --- a/src/od.c +++ b/src/od.c @@ -302,16 +302,16 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ or: %s --traditional [FILE] [[+]OFFSET [[+]LABEL]]\n\ -", +"), program_name, program_name); - printf ("\ + printf (_("\ Write an unambiguous representation, octal bytes by default, of FILE\n\ to standard output. With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -337,8 +337,8 @@ Pre-POSIX format specifications may be intermixed, they accumulate:\n\ -l same as -t d4, select decimal longs\n\ -o same as -t o2, select octal shorts\n\ -x same as -t x2, select hexadecimal shorts\n\ -"); - printf ("\ +")); + printf (_("\ \n\ For older syntax (second call format), OFFSET means -j OFFSET. LABEL\n\ is the pseudo-address at first byte printed, incremented when dump is\n\ @@ -365,7 +365,7 @@ BYTES is hexadecimal with 0x or 0X prefix, it is multiplied by 512\n\ with b suffix, by 1024 with k and by 1048576 with m. -s without a\n\ number implies 3. -w without a number implies 32. By default, od\n\ uses -A o -t d2 -w 16.\n\ -"); +")); } exit (status); } @@ -961,7 +961,7 @@ skip (n_skip) if (STREQ (*file_list, "-")) { - input_filename = "standard input"; + input_filename = _("standard input"); in_stream = stdin; have_read_stdin = 1; } @@ -1044,7 +1044,7 @@ skip (n_skip) } if (n_skip != 0) - error (2, 0, "cannot skip past end of combined input"); + error (2, 0, _("cannot skip past end of combined input")); return err; } @@ -1161,7 +1161,7 @@ check_and_close () if (ferror (stdout)) { - error (0, errno, "standard output"); + error (0, errno, _("standard output")); err = 1; } @@ -1210,7 +1210,7 @@ read_char (c) if (STREQ (*file_list, "-")) { - input_filename = "standard input"; + input_filename = _("standard input"); in_stream = stdin; have_read_stdin = 1; } @@ -1285,7 +1285,7 @@ read_block (n, block, n_bytes_in_buffer) if (STREQ (*file_list, "-")) { - input_filename = "standard input"; + input_filename = _("standard input"); in_stream = stdin; have_read_stdin = 1; } @@ -1353,7 +1353,7 @@ parse_old_offset (s) s_err = xstrtoul (s, NULL, radix, &tmp, "Bb"); if (s_err != LONGINT_OK) { - STRTOL_FAIL_WARN (s, "old-style offset", s_err); + STRTOL_FAIL_WARN (s, _("old-style offset"), s_err); return -1; } offset = tmp; @@ -1669,7 +1669,7 @@ main (argc, argv) break; default: error (2, 0, - "invalid output address radix `%c'; it must be one character from [doxn]", + _("invalid output address radix `%c'; it must be one character from [doxn]"), optarg[0]); break; } @@ -1679,7 +1679,7 @@ main (argc, argv) s_err = xstrtoul (optarg, NULL, 0, &tmp, "bkm"); n_bytes_to_skip = tmp; if (s_err != LONGINT_OK) - STRTOL_FATAL_ERROR (optarg, "skip argument", s_err); + STRTOL_FATAL_ERROR (optarg, _("skip argument"), s_err); break; case 'N': @@ -1690,11 +1690,11 @@ main (argc, argv) s_err = xstrtoul (optarg, NULL, 0, &tmp, "bkm"); max_bytes_to_format = tmp; if (s_err != LONGINT_OK) - STRTOL_FATAL_ERROR (optarg, "limit argument", s_err); + STRTOL_FATAL_ERROR (optarg, _("limit argument"), s_err); if (tmp > OFF_T_MAX) - error (2, 0, "specified number of bytes `%s' is larger than \ -the maximum\nrepresentable value of type off_t", optarg); + error (2, 0, _("specified number of bytes `%s' is larger than \ +the maximum\nrepresentable value of type off_t"), optarg); break; case 's': @@ -1704,14 +1704,14 @@ the maximum\nrepresentable value of type off_t", optarg); { s_err = xstrtoul (optarg, NULL, 0, &string_min, "bkm"); if (s_err != LONGINT_OK) - STRTOL_FATAL_ERROR (optarg, "minimum string length", s_err); + STRTOL_FATAL_ERROR (optarg, _("minimum string length"), s_err); } ++flag_dump_strings; break; case 't': if (decode_format_string (optarg)) - error (2, 0, "invalid type string `%s'", optarg); + error (2, 0, _("invalid type string `%s'"), optarg); break; case 'v': @@ -1759,7 +1759,7 @@ the maximum\nrepresentable value of type off_t", optarg); { s_err = xstrtoul (optarg, NULL, 10, &desired_width, NULL); if (s_err != LONGINT_OK) - STRTOL_FATAL_ERROR (optarg, "width specification", s_err); + STRTOL_FATAL_ERROR (optarg, _("width specification"), s_err); } break; @@ -1779,7 +1779,7 @@ the maximum\nrepresentable value of type off_t", optarg); usage (0); if (flag_dump_strings && n_specs > 0) - error (2, 0, "no type may be specified when dumping strings"); + error (2, 0, _("no type may be specified when dumping strings")); n_files = argc - optind; @@ -1824,7 +1824,7 @@ the maximum\nrepresentable value of type off_t", optarg); else { error (0, 0, - "invalid second operand in compatibility mode `%s'", + _("invalid second operand in compatibility mode `%s'"), argv[optind + 1]); usage (1); } @@ -1845,14 +1845,14 @@ the maximum\nrepresentable value of type off_t", optarg); else { error (0, 0, - "in compatibility mode the last 2 arguments must be offsets"); + _("in compatibility mode the last 2 arguments must be offsets")); usage (1); } } else { error (0, 0, - "in compatibility mode there may be no more than 3 arguments"); + _("in compatibility mode there may be no more than 3 arguments")); usage (1); } @@ -1916,7 +1916,7 @@ the maximum\nrepresentable value of type off_t", optarg); bytes_per_block = desired_width; else { - error (0, 0, "warning: invalid width %lu; using %d instead", + error (0, 0, _("warning: invalid width %lu; using %d instead"), desired_width, l_c_m); bytes_per_block = l_c_m; } @@ -1932,7 +1932,7 @@ the maximum\nrepresentable value of type off_t", optarg); #ifdef DEBUG for (i = 0; i < n_specs; i++) { - printf ("%d: fmt=\"%s\" width=%d\n", + printf (_("%d: fmt=\"%s\" width=%d\n"), i, spec[i].fmt_string, width_bytes[spec[i].size]); } #endif @@ -1942,10 +1942,10 @@ the maximum\nrepresentable value of type off_t", optarg); cleanup:; if (have_read_stdin && fclose (stdin) == EOF) - error (2, errno, "standard input"); + error (2, errno, _("standard input")); if (fclose (stdout) == EOF) - error (2, errno, "write error"); + error (2, errno, _("write error")); exit (err); } diff --git a/src/paste.c b/src/paste.c index cc7442caf..f37a0c6aa 100644 --- a/src/paste.c +++ b/src/paste.c @@ -157,7 +157,7 @@ main (argc, argv) if (have_read_stdin && fclose (stdin) == EOF) error (1, errno, "-"); if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -288,7 +288,7 @@ paste_parallel (nfiles, fnamptr) fileptr[files_open] = ENDLIST; if (opened_stdin && have_read_stdin) - error (1, 0, "standard input is closed"); + error (1, 0, _("standard input is closed")); /* Read a line from each file and output it to stdout separated by a delimiter, until we go through the loop without successfully @@ -482,15 +482,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Write lines consisting of the sequentially corresponding lines from\n\ each FILE, separated by TABs, to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ @@ -500,7 +500,7 @@ With no FILE, or when FILE is -, read standard input.\n\ --help display this help and exit\n\ --version output version information and exit\n\ \n\ -"); +")); } exit (status); } diff --git a/src/pr.c b/src/pr.c index 15f2f2363..080e98b32 100644 --- a/src/pr.c +++ b/src/pr.c @@ -489,7 +489,7 @@ main (argc, argv) ++s; if (!ISDIGIT (*s)) { - error (0, 0, "`+' requires a numeric argument"); + error (0, 0, _("`+' requires a numeric argument")); usage (2); } /* FIXME: use strtol */ @@ -592,8 +592,8 @@ main (argc, argv) column_separator = *s; if (*++s) { - fprintf (stderr, "\ -%s: extra characters in the argument to the `-s' option: `%s'\n", + fprintf (stderr, _("\ +%s: extra characters in the argument to the `-s' option: `%s'\n"), program_name, s); usage (2); } @@ -625,11 +625,11 @@ main (argc, argv) if (parallel_files && explicit_columns) error (1, 0, - "Cannot specify number of columns when printing in parallel."); + _("Cannot specify number of columns when printing in parallel.")); if (parallel_files && print_across_flag) error (1, 0, - "Cannot specify both printing across and printing in parallel."); + _("Cannot specify both printing across and printing in parallel.")); for ( ; optind < argc; optind++) { @@ -656,9 +656,9 @@ main (argc, argv) cleanup (); if (have_read_stdin && fclose (stdin) == EOF) - error (1, errno, "standard input"); + error (1, errno, _("standard input")); if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); if (failed_opens > 0) exit(1); exit (0); @@ -683,8 +683,8 @@ getoptarg (arg, switch_char, character, number) *number = atoi (arg); else { - fprintf (stderr, "\ -%s: extra characters in the argument to the `-%c' option: `%s'\n", + fprintf (stderr, _("\ +%s: extra characters in the argument to the `-%c' option: `%s'\n"), program_name, switch_char, arg); usage (2); } @@ -748,7 +748,7 @@ init_parameters (number_of_files) (columns - 1) * chars_per_gutter) / columns; if (chars_per_column < 1) - error (1, 0, "page width too narrow"); + error (1, 0, _("page width too narrow")); if (numbered_lines) { @@ -816,7 +816,7 @@ init_fps (number_of_files, av) } else { - p->name = "standard input"; + p->name = _("standard input"); p->fp = stdin; have_read_stdin = TRUE; p->status = OPEN; @@ -929,7 +929,7 @@ open_file (name, p) { if (!strcmp (name, "-")) { - p->name = "standard input"; + p->name = _("standard input"); p->fp = stdin; have_read_stdin = 1; } @@ -1107,7 +1107,7 @@ init_header (filename, desc) free (header); header = (char *) xmalloc (chars_per_header * sizeof (char)); - sprintf (header, "%s %s %s Page", &t[4], &t[20], middle); + sprintf (header, _("%s %s %s Page"), &t[4], &t[20], middle); } /* Set things up for printing a page @@ -1871,15 +1871,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Paginate or columnate FILE(s) for printing.\n\ \n\ +PAGE begin printing with page PAGE\n\ @@ -1906,7 +1906,7 @@ Paginate or columnate FILE(s) for printing.\n\ \n\ -t implied by -l N when N < 10. Without -s, columns are separated by\n\ spaces. With no FILE, or when FILE is -, read standard input.\n\ -"); +")); } exit (status); } diff --git a/src/sort.c b/src/sort.c index 897f5a6f3..d46a18c8e 100644 --- a/src/sort.c +++ b/src/sort.c @@ -214,7 +214,7 @@ xmalloc (n) p = malloc (n); if (p == 0) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); exit (2); } @@ -241,7 +241,7 @@ xrealloc (p, n) p = realloc (p, n); if (p == 0) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); exit (2); } @@ -279,7 +279,7 @@ xfclose (fp) { if (fflush (fp) != 0) { - error (0, errno, "flushing file"); + error (0, errno, _("flushing file")); cleanup (); exit (2); } @@ -288,7 +288,7 @@ xfclose (fp) { if (fclose (fp) != 0) { - error (0, errno, "error closing file"); + error (0, errno, _("error closing file")); cleanup (); exit (2); } @@ -303,7 +303,7 @@ xfwrite (buf, size, nelem, fp) { if (fwrite (buf, size, nelem, fp) != nelem) { - error (0, errno, "write error"); + error (0, errno, _("write error")); cleanup (); exit (2); } @@ -414,7 +414,7 @@ fillbuf (buf, fp) cc = fread (buf->buf + buf->used, 1, buf->alloc - buf->used, fp); if (ferror (fp)) { - error (0, errno, "read error"); + error (0, errno, _("read error")); cleanup (); exit (2); } @@ -1246,7 +1246,7 @@ check (files, nfiles) fp = xfopen (files[i], "r"); if (!checkfp (fp)) { - fprintf (stderr, "%s: disorder on %s\n", program_name, files[i]); + fprintf (stderr, _("%s: disorder on %s\n"), program_name, files[i]); ++disorders; } } @@ -1387,7 +1387,7 @@ static void badfieldspec (s) char *s; { - error (2, 0, "invalid field specification `%s'", s); + error (2, 0, _("invalid field specification `%s'"), s); } /* Handle interrupts and hangups. */ @@ -1598,7 +1598,7 @@ main (argc, argv) else { if (i == argc - 1) - error (2, 0, "option `-k' requires an argument"); + error (2, 0, _("option `-k' requires an argument")); else s = argv[++i]; } @@ -1676,7 +1676,7 @@ main (argc, argv) else { if (i == argc - 1) - error (2, 0, "option `-o' requires an argument"); + error (2, 0, _("option `-o' requires an argument")); else outfile = argv[++i]; } @@ -1693,7 +1693,7 @@ main (argc, argv) goto outer; } else - error (2, 0, "option `-t' requires an argument"); + error (2, 0, _("option `-t' requires an argument")); break; case 'T': if (s[1]) @@ -1703,7 +1703,7 @@ main (argc, argv) if (i < argc - 1) temp_file_prefix = argv[++i]; else - error (2, 0, "option `-T' requires an argument"); + error (2, 0, _("option `-T' requires an argument")); } goto outer; /* break; */ @@ -1715,7 +1715,7 @@ main (argc, argv) Solaris 2. */ goto outer; default: - fprintf (stderr, "%s: unrecognized option `-%c'\n", + fprintf (stderr, _("%s: unrecognized option `-%c'\n"), argv[0], *s); usage (2); } @@ -1834,12 +1834,12 @@ main (argc, argv) Solaris, Ultrix, and Irix. This premature fflush makes the output reappear. --karl@cs.umb.edu */ if (fflush (ofp) < 0) - error (1, errno, "%s: write error", outfile); + error (1, errno, _("%s: write error"), outfile); if (have_read_stdin && fclose (stdin) == EOF) error (1, errno, outfile); if (ferror (stdout) || fclose (stdout) == EOF) - error (1, errno, "%s: write error", outfile); + error (1, errno, _("%s: write error"), outfile); exit (0); } @@ -1849,15 +1849,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Write sorted concatenation of all FILE(s) to standard output.\n\ \n\ +POS1 [-POS2] start a key at POS1, end it before POS2\n\ @@ -1885,7 +1885,7 @@ position in the field, both counted from zero. OPTS is made up of one\n\ or more of Mbdfinr, this effectively disable global -Mbdfinr settings\n\ for that key. If no key given, use the entire line as key. With no\n\ FILE, or when FILE is -, read standard input.\n\ -" +") , DEFAULT_TMPDIR); } exit (status); diff --git a/src/split.c b/src/split.c index f2a028d2e..4464aa2e6 100644 --- a/src/split.c +++ b/src/split.c @@ -90,15 +90,15 @@ usage (status, reason) fprintf (stderr, "%s: %s\n", program_name, reason); if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION] [INPUT [PREFIX]]\n\ -", +"), program_name); - printf ("\ + printf (_("\ Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default\n\ PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input.\n\ \n\ @@ -110,7 +110,7 @@ PREFIX is `x'. With no INPUT, or when INPUT is -, read standard input.\n\ --version output version information and exit\n\ \n\ SIZE may have a multiplier suffix: b for 512, k for 1K, m for 1 Meg.\n\ -"); +")); } exit (status); } @@ -156,27 +156,27 @@ main (argc, argv) case 'b': if (split_type != type_undef) - usage (2, "cannot split in more than one way"); + usage (2, _("cannot split in more than one way")); split_type = type_bytes; if (convint (optarg, &accum) == -1) - usage (2, "invalid number of bytes"); + usage (2, _("invalid number of bytes")); break; case 'l': if (split_type != type_undef) - usage (2, "cannot split in more than one way"); + usage (2, _("cannot split in more than one way")); split_type = type_lines; if (!isdigits (optarg)) - usage (2, "invalid number of lines"); + usage (2, _("invalid number of lines")); accum = atoi (optarg); break; case 'C': if (split_type != type_undef) - usage (2, "cannot split in more than one way"); + usage (2, _("cannot split in more than one way")); split_type = type_byteslines; if (convint (optarg, &accum) == -1) - usage (2, "invalid number of bytes"); + usage (2, _("invalid number of bytes")); break; case '0': @@ -190,7 +190,7 @@ main (argc, argv) case '8': case '9': if (split_type != type_undef && split_type != type_digits) - usage (2, "cannot split in more than one way"); + usage (2, _("cannot split in more than one way")); if (digits_optind != 0 && digits_optind != this_optind) accum = 0; /* More than one number given; ignore other. */ digits_optind = this_optind; @@ -220,7 +220,7 @@ main (argc, argv) } if (accum < 1) - usage (2, "invalid number"); + usage (2, _("invalid number")); num = accum; /* Get out the filename arguments. */ @@ -232,7 +232,7 @@ main (argc, argv) outbase = argv[optind++]; if (optind < argc) - usage (2, "too many arguments"); + usage (2, _("too many arguments")); /* Open the input file. */ if (!strcmp (infile, "-")) diff --git a/src/sum.c b/src/sum.c index 06467ba61..a4f448775 100644 --- a/src/sum.c +++ b/src/sum.c @@ -61,15 +61,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print checksum and block counts for each FILE.\n\ \n\ -r defeat -s, use BSD sum algorithm, use 1K blocks\n\ @@ -78,7 +78,7 @@ Print checksum and block counts for each FILE.\n\ --version output version information and exit\n\ \n\ With no FILE, or when FILE is -, read standard input.\n\ -"); +")); } exit (status); } diff --git a/src/tac.c b/src/tac.c index 6d4591723..49af8b251 100644 --- a/src/tac.c +++ b/src/tac.c @@ -131,15 +131,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Write each FILE to standard output, last line first.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -148,7 +148,7 @@ With no FILE, or when FILE is -, read standard input.\n\ -s, --separator=STRING use STRING as the separator instead of newline\n\ --help display this help and exit\n\ --version output version information and exit\n\ -"); +")); } exit (status); } @@ -184,7 +184,7 @@ main (argc, argv) case 's': separator = optarg; if (*separator == 0) - error (1, 0, "separator cannot be empty"); + error (1, 0, _("separator cannot be empty")); break; default: usage (1); @@ -252,7 +252,7 @@ main (argc, argv) if (have_read_stdin && close (0) < 0) error (1, errno, "-"); if (close (1) < 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (errors); } @@ -280,11 +280,11 @@ tac_stdin () error, either. */ if (fstat (0, &stats)) { - error (0, errno, "standard input"); + error (0, errno, _("standard input")); return 1; } if (S_ISREG (stats.st_mode)) - return tac (0, "standard input"); + return tac (0, _("standard input")); #ifdef _POSIX_VERSION newact.sa_handler = cleanup; @@ -392,7 +392,7 @@ save_stdin () } if (bytes_read == -1) { - error (0, errno, "read error"); + error (0, errno, _("read error")); cleanup (); } } @@ -492,7 +492,7 @@ tac (fd, file) match_start = buffer - 1; else if (ret == -2) { - error (0, 0, "error in regular expression search"); + error (0, 0, _("error in regular expression search")); cleanup (); } else @@ -640,7 +640,7 @@ xwrite (desc, buffer, size) { if (full_write (desc, buffer, size) < 0) { - error (0, errno, "write error"); + error (0, errno, _("write error")); cleanup (); } } @@ -656,7 +656,7 @@ xmalloc (n) p = malloc (n); if (p == 0) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); } return p; @@ -672,7 +672,7 @@ xrealloc (p, n) p = realloc (p, n); if (p == 0) { - error (0, 0, "virtual memory exhausted"); + error (0, 0, _("virtual memory exhausted")); cleanup (); } return p; diff --git a/src/tail.c b/src/tail.c index 9046938a2..be41195ac 100644 --- a/src/tail.c +++ b/src/tail.c @@ -64,7 +64,7 @@ assert ((fd) == 1); \ assert ((n_bytes) >= 0); \ if (n_bytes > 0 && fwrite ((buffer), 1, (n_bytes), stdout) == 0) \ - error (1, errno, "write error"); \ + error (1, errno, _("write error")); \ } \ while (0) @@ -183,7 +183,7 @@ main (argc, argv) n_units = tmp_long; if (s_err == LONGINT_OVERFLOW) { - STRTOL_FATAL_ERROR (argv[1], "argument", s_err); + STRTOL_FATAL_ERROR (argv[1], _("argument"), s_err); } /* Parse any appended option letters. */ while (*p) @@ -212,7 +212,7 @@ main (argc, argv) break; default: - error (0, 0, "unrecognized option `-%c'", *p); + error (0, 0, _("unrecognized option `-%c'"), *p); usage (1); } ++p; @@ -253,8 +253,8 @@ main (argc, argv) if (s_err != LONGINT_OK) { STRTOL_FATAL_ERROR (optarg, (c == 'n' - ? "number of lines" - : "number of bytes"), s_err); + ? _("number of lines") + : _("number of bytes")), s_err); } break; @@ -322,7 +322,7 @@ main (argc, argv) if (have_read_stdin && close (0) < 0) error (1, errno, "-"); if (fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -343,7 +343,7 @@ tail_file (filename, n_units, filenum) if (!strcmp (filename, "-")) { have_read_stdin = 1; - filename = "standard input"; + filename = _("standard input"); if (print_headers) write_header (filename, NULL); errors = tail (filename, 0, n_units); @@ -351,13 +351,13 @@ tail_file (filename, n_units, filenum) { if (fstat (0, &stats) < 0) { - error (0, errno, "standard input"); + error (0, errno, _("standard input")); errors = 1; } else if (!S_ISREG (stats.st_mode)) { error (0, 0, - "standard input: cannot follow end of non-regular file"); + _("standard input: cannot follow end of non-regular file")); errors = 1; } if (errors) @@ -394,7 +394,7 @@ tail_file (filename, n_units, filenum) } else if (!S_ISREG (stats.st_mode)) { - error (0, 0, "%s: cannot follow end of non-regular file", + error (0, 0, _("%s: cannot follow end of non-regular file"), filename); errors = 1; } @@ -1000,7 +1000,7 @@ tail_forever (names, nfiles) if (stats.st_size < file_sizes[i]) { - write_header (names[i], "file truncated"); + write_header (names[i], _("file truncated")); last = i; lseek (file_descs[i], stats.st_size, SEEK_SET); file_sizes[i] = stats.st_size; @@ -1027,15 +1027,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print last 10 lines of each FILE to standard output.\n\ With more than one FILE, precede each with a header giving the file name.\n\ With no FILE, or when FILE is -, read standard input.\n\ @@ -1055,7 +1055,7 @@ b for 512, k for 1024, m for 1048576 (1 Meg). A first OPTION of -VALUE\n\ or +VALUE is treated like -n VALUE or -n +VALUE unless VALUE has one of\n\ the [bkm] suffix multipliers, in which case it is treated like -c VALUE\n\ or -c +VALUE.\n\ -"); +")); } exit (status); } diff --git a/src/tr.c b/src/tr.c index 29d566067..21751ffc3 100644 --- a/src/tr.c +++ b/src/tr.c @@ -322,15 +322,15 @@ static void usage (int status) { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... SET1 [SET2]\n\ -", +"), program_name); - printf ("\ + printf (_("\ Translate, squeeze, and/or delete characters from standard input,\n\ writing to standard output.\n\ \n\ @@ -340,8 +340,8 @@ writing to standard output.\n\ -t, --truncate-set1 first truncate SET1 to length of SET2\n\ --help display this help and exit\n\ --version output version information and exit\n\ -"); - printf ("\ +")); + printf (_("\ \n\ SETs are specified as strings of characters. Most represent themselves.\n\ Interpreted sequences are:\n\ @@ -372,8 +372,8 @@ Interpreted sequences are:\n\ [:upper:] all upper case letters\n\ [:xdigit:] all hexadecimal digits\n\ [=CHAR=] all characters which are equivalent to CHAR\n\ -"); - printf ("\ +")); + printf (_("\ \n\ Translation occurs if -d is not given and both SET1 and SET2 appear.\n\ -t may be used only when translating. SET2 is extended to length of\n\ @@ -383,7 +383,7 @@ expand in ascending order; used in SET2 while translating, they may\n\ only be used in pairs to specify case conversion. -s uses SET1 if not\n\ translating nor deleting; else squeezing uses SET2 and occurs after\n\ translation or deletion.\n\ -"); +")); } exit (status); } @@ -529,8 +529,8 @@ unquote (unsigned char *s, size_t *len) isn't clear on this, but one person has said that in his interpretation, POSIX says tr can't even give a warning. */ - error (0, 0, "warning: the ambiguous octal escape \ -\\%c%c%c is being\n\tinterpreted as the 2-byte sequence \\0%c%c, `%c'", + error (0, 0, _("warning: the ambiguous octal escape \ +\\%c%c%c is being\n\tinterpreted as the 2-byte sequence \\0%c%c, `%c'"), s[i], s[i + 1], s[i + 2], s[i], s[i + 1], s[i + 2]); } @@ -538,11 +538,11 @@ unquote (unsigned char *s, size_t *len) } break; case '\0': - error (0, 0, "invalid backslash escape at end of string"); + error (0, 0, _("invalid backslash escape at end of string")); return 1; default: - error (0, 0, "invalid backslash escape `\\%c'", s[i + 1]); + error (0, 0, _("invalid backslash escape `\\%c'"), s[i + 1]); return 1; } ++i; @@ -689,7 +689,7 @@ append_range (struct Spec_list *list, unsigned int first, unsigned int 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); @@ -722,7 +722,7 @@ append_char_class (struct Spec_list *list, const unsigned char *char_class_str, { char *tmp = make_printable_str (char_class_str, len); - error (0, 0, "invalid character class `%s'", tmp); + error (0, 0, _("invalid character class `%s'"), tmp); free (tmp); return 1; } @@ -771,7 +771,7 @@ append_equiv_class (struct Spec_list *list, const unsigned char *equiv_class_str { char *tmp = make_printable_str (equiv_class_str, len); - error (0, 0, "%s: equivalence class operand must be a single character", + error (0, 0, _("%s: equivalence class operand must be a single character"), tmp); free (tmp); return 1; @@ -909,7 +909,7 @@ find_bracketed_repeat (const unsigned char *p, size_t start_idx, size_t p_len, u if (non_neg_strtol (digit_str, digit_str_len, repeat_count)) { char *tmp = make_printable_str (digit_str, digit_str_len); - error (0, 0, "invalid repeat count `%s' in [c*n] construct", + error (0, 0, _("invalid repeat count `%s' in [c*n] construct"), tmp); free (tmp); return -2; @@ -1408,7 +1408,7 @@ validate (struct Spec_list *s1, struct Spec_list *s2) get_s1_spec_stats (s1); if (s1->n_indefinite_repeats > 0) { - error (1, 0, "the [c*] repeat construct may not appear in string1"); + error (1, 0, _("the [c*] repeat construct may not appear in string1")); } /* FIXME: it isn't clear from the POSIX spec that this is invalid, @@ -1417,8 +1417,8 @@ validate (struct Spec_list *s1, struct Spec_list *s2) if (complement && s1->has_upper_or_lower) { error (1, 0, - "character classes may not be used when translating \ -and complementing"); + _("character classes may not be used when translating \ +and complementing")); } if (s2) @@ -1427,13 +1427,13 @@ and complementing"); if (s2->has_restricted_char_class) { error (1, 0, - "when translating, the only character classes that may \ -appear in\n\tstring2 are `upper' and `lower'"); + _("when translating, the only character classes that may \ +appear in\n\tstring2 are `upper' and `lower'")); } if (s2->n_indefinite_repeats > 1) { - error (1, 0, "only one [c*] repeat construct may appear in string2"); + error (1, 0, _("only one [c*] repeat construct may appear in string2")); } if (translating) @@ -1441,8 +1441,8 @@ appear in\n\tstring2 are `upper' and `lower'"); if (s2->has_equiv_class) { error (1, 0, - "[=c=] expressions may not appear in string2 \ -when translating"); + _("[=c=] expressions may not appear in string2 \ +when translating")); } if (s1->length > s2->length) @@ -1454,23 +1454,23 @@ when translating"); if (s2->length == 0) error (1, 0, - "when not truncating set1, string2 must be non-empty"); + _("when not truncating set1, string2 must be non-empty")); string2_extend (s1, s2); } } if (complement && s2->has_upper_or_lower) error (1, 0, - "character classes may not be used when translating \ -and complementing"); + _("character classes may not be used when translating \ +and complementing")); } else /* Not translating. */ { if (s2->n_indefinite_repeats > 0) error (1, 0, - "the [c*] construct may appear in string2 only \ -when translating"); + _("the [c*] construct may appear in string2 only \ +when translating")); } } } @@ -1502,7 +1502,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader) nr = (*reader) (buf, size, NULL); if (nr < 0) - error (1, errno, "read error"); + error (1, errno, _("read error")); if (nr == 0) break; i = 0; @@ -1553,7 +1553,7 @@ squeeze_filter (unsigned char *buf, long int size, PFI reader) } if (out_len > 0 && fwrite ((char *) &buf[begin], 1, out_len, stdout) == 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); } if (char_to_squeeze != NOT_A_CHAR) @@ -1599,7 +1599,7 @@ read_and_delete (unsigned char *buf, long int size, PFI not_used) int nr = safe_read (0, (char *) buf, size); if (nr < 0) - error (1, errno, "read error"); + error (1, errno, _("read error")); if (nr == 0) { hit_eof = 1; @@ -1643,7 +1643,7 @@ read_and_xlate (unsigned char *buf, long int size, PFI not_used) chars_read = safe_read (0, (char *) buf, size); if (chars_read < 0) - error (1, errno, "read error"); + error (1, errno, _("read error")); if (chars_read == 0) { hit_eof = 1; @@ -1738,16 +1738,16 @@ main (int argc, char **argv) of `cat' use `tr a a'. */ if (non_option_args > 2) { - error (0, 0, "too many arguments"); + error (0, 0, _("too many arguments")); usage (2); } if (!delete && !squeeze_repeats && non_option_args != 2) - error (1, 0, "two strings must be given when translating"); + error (1, 0, _("two strings must be given when translating")); if (delete && squeeze_repeats && non_option_args != 2) - error (1, 0, "two strings must be given when both \ -deleting and squeezing repeats"); + error (1, 0, _("two strings must be given when both \ +deleting and squeezing repeats")); /* If --delete is given without --squeeze-repeats, then only one string argument may be specified. But POSIX @@ -1760,12 +1760,12 @@ deleting and squeezing repeats"); --non_option_args; else error (1, 0, - "only one string may be given when deleting \ -without squeezing repeats"); + _("only one string may be given when deleting \ +without squeezing repeats")); } if (squeeze_repeats && non_option_args == 0) - error (1, 0, "at least one string must be given when squeezing repeats"); + error (1, 0, _("at least one string must be given when squeezing repeats")); spec_init (s1); if (parse_str ((unsigned char *) argv[optind], s1)) @@ -1796,7 +1796,7 @@ without squeezing repeats"); { nr = read_and_delete (io_buf, IO_BUF_SIZE, NULL); if (nr > 0 && fwrite ((char *) io_buf, 1, nr, stdout) == 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); } while (nr > 0); } @@ -1851,7 +1851,7 @@ without squeezing repeats"); c2 = get_next (s2, &class_s2); if (!class_ok[(int) class_s1][(int) class_s2]) error (1, 0, - "misaligned or mismatched upper and/or lower classes"); + _("misaligned or mismatched upper and/or lower classes")); /* The following should have been checked by validate... */ if (c2 == -1) break; @@ -1873,17 +1873,17 @@ without squeezing repeats"); chars_read = read_and_xlate (io_buf, IO_BUF_SIZE, NULL); if (chars_read > 0 && fwrite ((char *) io_buf, 1, chars_read, stdout) == 0) - error (1, errno, "write error"); + error (1, errno, _("write error")); } while (chars_read > 0); } } if (fclose (stdout) == EOF) - error (2, errno, "write error"); + error (2, errno, _("write error")); if (close (0) != 0) - error (2, errno, "standard input"); + error (2, errno, _("standard input")); exit (0); } diff --git a/src/unexpand.c b/src/unexpand.c index 0597a4d5e..4fd93788f 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -188,7 +188,7 @@ main (argc, argv) if (have_read_stdin && fclose (stdin) == EOF) error (1, errno, "-"); if (fclose (stdout) == EOF) - error (1, errno, "write error"); + error (1, errno, _("write error")); exit (exit_status); } @@ -215,7 +215,7 @@ parse_tabstops (stops) tabval = tabval * 10 + *stops - '0'; } else - error (1, 0, "tab size contains an invalid character"); + error (1, 0, _("tab size contains an invalid character")); } add_tabstop (tabval); @@ -249,9 +249,9 @@ validate_tabstops (tabs, entries) for (i = 0; i < entries; i++) { if (tabs[i] == 0) - error (1, 0, "tab size cannot be 0"); + error (1, 0, _("tab size cannot be 0")); if (tabs[i] <= prev_tab) - error (1, 0, "tab sizes must be ascending"); + error (1, 0, _("tab sizes must be ascending")); prev_tab = tabs[i]; } } @@ -444,15 +444,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Convert spaces in each FILE to tabs, writing to standard output.\n\ With no FILE, or when FILE is -, read standard input.\n\ \n\ @@ -463,7 +463,7 @@ With no FILE, or when FILE is -, read standard input.\n\ --version output version information and exit\n\ \n\ Instead of -t NUMBER or -t LIST, -NUMBER or -LIST may be used.\n\ -"); +")); } exit (status); } diff --git a/src/uniq.c b/src/uniq.c index 8f86e978f..7c4aa1c0d 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -252,10 +252,10 @@ check_file (infile, outfile) closefiles: if (ferror (istream) || fclose (istream) == EOF) - error (1, errno, "error reading %s", infile); + error (1, errno, _("error reading %s"), infile); if (ferror (ostream) || fclose (ostream) == EOF) - error (1, errno, "error writing %s", outfile); + error (1, errno, _("error writing %s"), outfile); free (lb1.buffer); free (lb2.buffer); @@ -341,15 +341,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [INPUT [OUTPUT]]\n\ -", +"), program_name); - printf ("\ + printf (_("\ Discard all but one of successive identical lines from INPUT (or\n\ standard input), writing to OUTPUT (or standard output).\n\ \n\ @@ -366,7 +366,7 @@ standard input), writing to OUTPUT (or standard output).\n\ \n\ A field is a run of whitespace, than non-whitespace characters.\n\ Fields are skipped before chars. \n\ -"); +")); } exit (status); } diff --git a/src/wc.c b/src/wc.c index 9346a2dbd..2a604cfb2 100644 --- a/src/wc.c +++ b/src/wc.c @@ -73,15 +73,15 @@ usage (status) int status; { if (status != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", + fprintf (stderr, _("Try `%s --help' for more information.\n"), program_name); else { - printf ("\ + printf (_("\ Usage: %s [OPTION]... [FILE]...\n\ -", +"), program_name); - printf ("\ + printf (_("\ Print line, word, and byte counts for each FILE, and a total line if\n\ more than one FILE is specified. With no FILE, or when FILE is -,\n\ read standard input.\n\ @@ -90,7 +90,7 @@ read standard input.\n\ -c, --bytes, --chars print the byte counts\n\ --help display this help and exit\n\ --version output version information and exit\n\ -"); +")); } exit (status); } @@ -155,7 +155,7 @@ main (argc, argv) wc_file (argv[optind]); if (nfiles > 1) - write_counts (total_lines, total_words, total_chars, "total"); + write_counts (total_lines, total_words, total_chars, _("total")); } if (have_read_stdin && close (0)) -- cgit v1.2.3-54-g00ecf