(linenum→info "unix/slp.c:2238")

hello/2.3/src/hello.c

    1: /* hello.c -- print a greeting message and exit.
    2: 
    3:    Copyright (C) 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
    4:    2005, 2006, 2007 Free Software Foundation, Inc.
    5: 
    6:    This program is free software; you can redistribute it and/or modify
    7:    it under the terms of the GNU General Public License as published by
    8:    the Free Software Foundation; either version 3, or (at your option)
    9:    any later version.
   10: 
   11:    This program is distributed in the hope that it will be useful,
   12:    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13:    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14:    GNU General Public License for more details.
   15: 
   16:    You should have received a copy of the GNU General Public License
   17:    along with this program; if not, write to the Free Software Foundation,
Permalink to this note guest: hello/2.3/src/hello.c:16-17 on Sun Jan 06 19:36:47 +0900 2008

ゲストアカウントで書き込みテスト。

18: Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 19: 20: #include <config.h> 21: #include "system.h" 22: 23: /* String containing name the program is called with. */ 24: const char *program_name; 25: 26: static const struct option longopts[] = 27: { 28: { "greeting", required_argument, NULL, 'g' }, 29: { "help", no_argument, NULL, 'h' }, 30: { "next-generation", no_argument, NULL, 'n' },
Permalink to this note test: hello/2.3/src/hello.c:30-30 on Sun Jan 06 10:32:20 +0900 2008

next-generation なんてオプションあったんだ。

31: { "traditional", no_argument, NULL, 't' }, 32: { "version", no_argument, NULL, 'v' }, 33: { NULL, 0, NULL, 0 } 34: }; 35: 36: static void print_help (void); 37: static void print_version (void); 38: 39: int 40: main (int argc, char *argv[]) 41: { 42: int optc; 43: int t = 0, n = 0, lose = 0; 44: const char *greeting = NULL; 45: 46: program_name = argv[0]; 47: 48: /* Set locale via LC_ALL. */ 49: setlocale (LC_ALL, ""); 50: 51: #if ENABLE_NLS 52: /* Set the text message domain. */ 53: bindtextdomain (PACKAGE, LOCALEDIR); 54: textdomain (PACKAGE); 55: #endif 56: 57: /* Even exiting has subtleties. The /dev/full device on GNU/Linux 58: can be used for testing whether writes are checked properly. For 59: instance, hello >/dev/full should exit unsuccessfully. On exit, 60: if any writes failed, change the exit status. This is 61: implemented in the Gnulib module "closeout". */ 62: atexit (close_stdout); 63: 64: while ((optc = getopt_long (argc, argv, "g:hntv", longopts, NULL)) != -1) 65: switch (optc) 66: { 67: /* One goal here is having --help and --version exit immediately, 68: per GNU coding standards. */ 69: case 'v': 70: print_version (); 71: exit (EXIT_SUCCESS); 72: break; 73: case 'g': 74: greeting = optarg; 75: break; 76: case 'h': 77: print_help (); 78: exit (EXIT_SUCCESS); 79: break; 80: case 'n': 81: n = 1; 82: break; 83: case 't': 84: t = 1; 85: break; 86: default: 87: lose = 1; 88: break; 89: } 90: 91: if (lose || optind < argc) 92: { 93: /* Print error message and exit. */ 94: if (optind < argc) 95: fprintf (stderr, _("%s: extra operand: %s\n"), 96: program_name, argv[optind]); 97: fprintf (stderr, _("Try `%s --help' for more information.\n"), 98: program_name); 99: exit (EXIT_FAILURE); 100: } 101: 102: /* Print greeting message and exit. */ 103: if (t) 104: printf (_("hello, world\n")); 105: 106: else if (n) 107: /* TRANSLATORS: Use box drawing characters or other fancy stuff 108: if your encoding (e.g., UTF-8) allows it. If done so add the 109: following note, please: 110: 111: [Note: For best viewing results use a UTF-8 locale, please.] 112: */ 113: printf (_("\ 114: +---------------+\n\ 115: | Hello, world! |\n\ 116: +---------------+\n\ 117: "));
Permalink to this note guest: hello/2.3/src/hello.c:113-117 on Mon Jan 07 12:53:58 +0900 2008

メッセージ表示部分

118: 119: else 120: { 121: if (!greeting) 122: greeting = _("Hello, world!"); 123: puts (greeting); 124: } 125: 126: exit (EXIT_SUCCESS); 127: } 128: 129: 130: ^L 131: /* Print help info. This long message is split into 132: several pieces to help translators be able to align different 133: blocks and identify the various pieces. */ 134: 135: static void 136: print_help (void) 137: { 138: /* TRANSLATORS: --help output 1 (synopsis) 139: no-wrap */ 140: printf (_("\ 141: Usage: %s [OPTION]...\n"), program_name); 142: 143: /* TRANSLATORS: --help output 2 (brief description) 144: no-wrap */ 145: fputs (_("\ 146: Print a friendly, customizable greeting.\n"), stdout); 147: 148: puts (""); 149: /* TRANSLATORS: --help output 3: options 1/2 150: no-wrap */ 151: fputs (_("\ 152: -h, --help display this help and exit\n\ 153: -v, --version display version information and exit\n"), stdout); 154: 155: puts (""); 156: /* TRANSLATORS: --help output 4: options 2/2 157: no-wrap */ 158: fputs (_("\ 159: -t, --traditional use traditional greeting format\n\ 160: -n, --next-generation use next-generation greeting format\n\ 161: -g, --greeting=TEXT use TEXT as the greeting message\n"), stdout); 162: 163: printf ("\n"); 164: /* TRANSLATORS: --help output 5 (end) 165: TRANSLATORS: the placeholder indicates the bug-reporting address 166: for this application. Please add _another line_ with the 167: address for translation bugs. 168: no-wrap */ 169: printf (_("\ 170: Report bugs to <%s>.\n"), PACKAGE_BUGREPORT); 171: } 172: 173: 174: ^L 175: /* Print version and copyright information. */ 176: 177: static void 178: print_version (void) 179: { 180: printf ("hello (GNU %s) %s\n", PACKAGE, VERSION); 181: /* xgettext: no-wrap */ 182: puts (""); 183: 184: /* It is important to separate the year from the rest of the message, 185: as done here, to avoid having to retranslate the message when a new 186: year comes around. */ 187: printf (_("\ 188: Copyright (C) %s Free Software Foundation, Inc.\n\ 189: License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ 190: This is free software: you are free to change and redistribute it.\n\ 191: There is NO WARRANTY, to the extent permitted by law.\n"), 192: "2007"); 193: }
Syntax (Markdown)