From: Paul Eggert Date: Sat, 5 Jul 2003 08:24:55 +0000 (+0000) Subject: Convert to UTF-8. X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=8912f582ac95ba39f4435046642e643921f9dd9f;p=chaz%2Ftar Convert to UTF-8. Don't include . (DEFAULT_PATTERN): Renamed from DEFAULT. (ZEROS_PATTERN): Renamed from ZEROS. (main): Use gettext to translate (C), not print_copyright. --- diff --git a/tests/genfile.c b/tests/genfile.c index 3697069..783609c 100644 --- a/tests/genfile.c +++ b/tests/genfile.c @@ -1,6 +1,9 @@ /* Generate a file containing some preset patterns. - Copyright © 1995, 1996, 1997 Free Software Foundation, Inc. - François Pinard , 1995. + + Copyright (C) 1995, 1996, 1997, 2001, 2003 Free Software + Foundation, Inc. + + François Pinard , 1995. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,6 +22,7 @@ #include "system.h" +#include #include #ifndef EXIT_SUCCESS @@ -30,8 +34,8 @@ enum pattern { - DEFAULT, - ZEROS + DEFAULT_PATTERN, + ZEROS_PATTERN }; /* The name this program was run with. */ @@ -47,12 +51,9 @@ static int show_version = 0; static int file_length = 0; /* Pattern to generate. */ -static enum pattern pattern = DEFAULT; - -/*-----------------------------------------------. -| Explain how to use the program, then get out. | -`-----------------------------------------------*/ +static enum pattern pattern = DEFAULT_PATTERN; +/* Explain how to use the program, then get out. */ void usage (int status) { @@ -78,10 +79,8 @@ for the equivalent short option also.\n\ exit (status); } -/*----------------------------------------------------------------------. -| Main program. Decode ARGC arguments passed through the ARGV array of | -| strings, then launch execution. | -`----------------------------------------------------------------------*/ +/* Main program. Decode ARGC arguments passed through the ARGV array + of strings, then launch execution. */ /* Long options equivalences. */ static const struct option long_options[] = @@ -93,13 +92,8 @@ static const struct option long_options[] = {0, 0, 0, 0}, }; - -const char *pattern_strings[] = -{ - "default", /* 0 */ - "zeros", /* 1 */ - NULL -}; +static char const * const pattern_args[] = { "default", "zeros", 0 }; +static enum pattern const pattern_types[] = {DEFAULT_PATTERN, ZEROS_PATTERN}; int main (int argc, char *const *argv) @@ -127,25 +121,8 @@ main (int argc, char *const *argv) break; case 'p': - switch (argmatch (optarg, pattern_strings)) - { - - case -2: - error (0, 0, _("Ambiguous pattern `%s'"), optarg); - usage (EXIT_FAILURE); - - case -1: - error (0, 0, _("Unknown pattern `%s'"), optarg); - usage (EXIT_FAILURE); - - case 0: - pattern = DEFAULT; - break; - - case 1: - pattern = ZEROS; - break; - } + pattern = XARGMATCH ("--pattern", optarg, + pattern_args, pattern_types); break; } @@ -154,18 +131,17 @@ main (int argc, char *const *argv) if (show_version) { printf ("genfile (GNU %s) %s\n", PACKAGE, VERSION); - fputs (_("\ -\n\ -Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.\n"), - stdout); - fputs (_("\ -This is free software; see the source for copying conditions. There is NO\n\ -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"), - stdout); - fputs (_("\ -\n\ -Written by François Pinard .\n"), - stdout); + printf (_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2003); + puts (_("\ +This program comes with NO WARRANTY, to the extent permitted by law.\n\ +You may redistribute it under the terms of the GNU General Public License;\n\ +see the file named COPYING for details.")); + + /* Note to translator: Please translate "F. Pinard" to "François + Pinard" if "ç" (c-with-cedilla) is available in the + translation's character set and encoding. */ + puts (_("Written by F. Pinard.")); + exit (EXIT_SUCCESS); } @@ -179,12 +155,12 @@ Written by Fran switch (pattern) { - case DEFAULT: + case DEFAULT_PATTERN: for (counter = 0; counter < file_length; counter++) putchar (counter & 255); break; - case ZEROS: + case ZEROS_PATTERN: for (counter = 0; counter < file_length; counter++) putchar (0); break;