aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/bitops.c
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2009-02-15 18:01:00 -0900
committerDavid M. Syzdek <david@syzdek.net>2009-02-15 18:01:00 -0900
commit9eed8d73a41f2c9062dfee979737d892b5ae6fbb (patch)
treea5f6c12cc7048c617e209add1967fb64740d9e64 /src/bitops.c
parent510cdcf47d510967ba63ff3ebe1d2887580aab02 (diff)
downloaddmstools-9eed8d73a41f2c9062dfee979737d892b5ae6fbb.tar.gz
dmstools-9eed8d73a41f2c9062dfee979737d892b5ae6fbb.tar.bz2
dmstools-9eed8d73a41f2c9062dfee979737d892b5ae6fbb.tar.xz
dmstools-9eed8d73a41f2c9062dfee979737d892b5ae6fbb.zip
Updating bitops to use gettext.
Diffstat (limited to 'src/bitops.c')
-rw-r--r--src/bitops.c98
1 files changed, 68 insertions, 30 deletions
diff --git a/src/bitops.c b/src/bitops.c
index 51232d2..174dfc4 100644
--- a/src/bitops.c
+++ b/src/bitops.c
@@ -58,6 +58,26 @@
58 58
59/////////////////// 59///////////////////
60// // 60// //
61// i18l Support //
62// //
63///////////////////
64
65#ifdef HAVE_GETTEXT
66# include <gettext.h>
67# include <libintl.h>
68# define _(String) gettext (String)
69# define gettext_noop(String) String
70# define N_(String) gettext_noop (String)
71#else
72# define _(String) (String)
73# define N_(String) String
74# define textdomain(Domain)
75# define bindtextdomain(Package, Directory)
76#endif
77
78
79///////////////////
80// //
61// Definitions // 81// Definitions //
62// // 82// //
63/////////////////// 83///////////////////
@@ -65,6 +85,18 @@
65#ifndef PROGRAM_NAME 85#ifndef PROGRAM_NAME
66#define PROGRAM_NAME "bitops" 86#define PROGRAM_NAME "bitops"
67#endif 87#endif
88#ifndef PACKAGE_BUGREPORT
89#define PACKAGE_BUGREPORT "david@syzdek.net"
90#endif
91#ifndef PACKAGE_COPYRIGHT
92#define PACKAGE_COPYRIGHT ""
93#endif
94#ifndef PACKAGE_NAME
95#define PACKAGE_NAME ""
96#endif
97#ifndef PACKAGE_VERSION
98#define PACKAGE_VERSION ""
99#endif
68 100
69#ifndef PARAMS 101#ifndef PARAMS
70#define PARAMS(protos) protos 102#define PARAMS(protos) protos
@@ -169,11 +201,13 @@ int main(int argc, char * argv[])
169 my_version(); 201 my_version();
170 return(0); 202 return(0);
171 case '?': 203 case '?':
172 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); 204 fprintf(stderr, _("Try `%s --help' for more information.\n"), PROGRAM_NAME);
173 return(1); 205 return(1);
174 default: 206 default:
175 fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c); 207 fprintf(stderr, _("%s: unrecognized option `--%c'\n"
176 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME); 208 "Try `%s --help' for more information.\n"
209 ), PROGRAM_NAME, c, PROGRAM_NAME
210 );
177 return(1); 211 return(1);
178 }; 212 };
179 }; 213 };
@@ -338,21 +372,25 @@ const char * my_spaces(char * dst)
338/// displays usage information 372/// displays usage information
339void my_usage() 373void my_usage()
340{ 374{
341 printf("Usage: %s [options] num1 num2\n", PROGRAM_NAME); 375 // TRANSLATORS: The following strings provide usage for command. These
342 printf(" -B display output in binary notation\n"); 376 // strings are displayed if the program is passed `--help' on the command
343 printf(" -D display output in decimal notation\n"); 377 // line. The two strings referenced are: PROGRAM_NAME, and
344 printf(" -H display output in hexadecimal notation\n"); 378 // PACKAGE_BUGREPORT
345 printf(" -O display output in octal notation\n"); 379 printf(_("Usage: %s [options] num1 num2\n"
346 printf("\n"); 380 " -B display output in binary notation\n"
347 printf("Input Notation:\n"); 381 " -D display output in decimal notation\n"
348 printf(" 00NNNNNNNN input number is in binary\n"); 382 " -H display output in hexadecimal notation\n"
349 printf(" NNNNNNNN input number is in decimal\n"); 383 " -O display output in octal notation\n"
350 printf(" 0xNNNNNNNN input number is in hexadecimal\n"); 384 "\n"
351 printf(" 0NNNNNNNN input number is in octal\n"); 385 "Input Notation:\n"
352 printf("\n"); 386 " 00NNNNNNNN input number is in binary\n"
353#ifdef PACKAGE_BUGREPORT 387 " NNNNNNNN input number is in decimal\n"
354 printf("Report bugs to <%s>.\n", PACKAGE_BUGREPORT); 388 " 0xNNNNNNNN input number is in hexadecimal\n"
355#endif 389 " 0NNNNNNNN input number is in octal\n"
390 "\n"
391 "Report bugs to <%s>.\n"
392 ), PROGRAM_NAME, PACKAGE_BUGREPORT
393 );
356 return; 394 return;
357} 395}
358 396
@@ -360,18 +398,18 @@ void my_usage()
360/// displays version information 398/// displays version information
361void my_version(void) 399void my_version(void)
362{ 400{
363#if defined(PACKAGE_NAME) && defined(PACKAGE_VERSION) 401 // TRANSLATORS: The following strings provide version and copyright
364 printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION); 402 // information if the program is passed --version on the command line.
365#else 403 // The three strings referenced are: PROGRAM_NAME, PACKAGE_NAME,
366 printf("%s\n", PROGRAM_NAME); 404 // PACKAGE_VERSION.
367#endif 405 printf(_("%s (%s) %s\n"
368 printf("Written by David M. Syzdek.\n"); 406 "Written by David M. Syzdek.\n"
369 printf("\n"); 407 "\n"
370#if defined(PACKAGE_COPYRIGHT) 408 "%s\n"
371 printf("%s\n", PACKAGE_COPYRIGHT); 409 "This is free software; see the source for copying conditions. There is NO\n"
372#endif 410 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
373 printf("This is free software; see the source for copying conditions. There is NO\n"); 411 ), PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_COPYRIGHT
374 printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); 412 );
375 return; 413 return;
376} 414}
377 415