aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/numconvert.c107
1 files changed, 36 insertions, 71 deletions
diff --git a/src/numconvert.c b/src/numconvert.c
index cbee979..e40e22c 100644
--- a/src/numconvert.c
+++ b/src/numconvert.c
@@ -70,26 +70,6 @@
70 70
71/////////////////// 71///////////////////
72// // 72// //
73// i18l Support //
74// //
75///////////////////
76
77#ifdef HAVE_GETTEXT
78# include <gettext.h>
79# include <libintl.h>
80# define _(String) gettext (String)
81# define gettext_noop(String) String
82# define N_(String) gettext_noop (String)
83#else
84# define _(String) (String)
85# define N_(String) String
86# define textdomain(Domain)
87# define bindtextdomain(Package, Directory)
88#endif
89
90
91///////////////////
92// //
93// Definitions // 73// Definitions //
94// // 74// //
95/////////////////// 75///////////////////
@@ -233,13 +213,11 @@ int main(int argc, char * argv[])
233 my_version(); 213 my_version();
234 return(0); 214 return(0);
235 case '?': 215 case '?':
236 fprintf(stderr, _("Try `%s --help' for more information.\n"), PROGRAM_NAME); 216 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
237 return(1); 217 return(1);
238 default: 218 default:
239 fprintf(stderr, _("%s: unrecognized option `--%c'\n" 219 fprintf(stderr, "%s: unrecognized option `--%c'\n", PROGRAM_NAME, c);
240 "Try `%s --help' for more information.\n" 220 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
241 ), PROGRAM_NAME, c, PROGRAM_NAME
242 );
243 return(1); 221 return(1);
244 }; 222 };
245 }; 223 };
@@ -249,9 +227,8 @@ int main(int argc, char * argv[])
249 227
250 if ((argc - optind) < 1) 228 if ((argc - optind) < 1)
251 { 229 {
252 fprintf(stderr, _("%s: missing required argument\n" 230 fprintf(stderr, "%s: missing required argument\n", PROGRAM_NAME);
253 "Try `%s --help' for more information.\n"), 231 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
254 PROGRAM_NAME, PROGRAM_NAME);
255 return(1); 232 return(1);
256 }; 233 };
257 234
@@ -321,37 +298,31 @@ int main(int argc, char * argv[])
321/// displays usage information 298/// displays usage information
322void my_usage() 299void my_usage()
323{ 300{
324 // TRANSLATORS: The following strings provide usage for command. These 301 printf("Usage: %s num1 num2 ... numX\n", PROGRAM_NAME);
325 // strings are displayed if the program is passed `--help' on the command 302 printf(" -A enable ASCII output\n");
326 // line. The two strings referenced are: PROGRAM_NAME, and 303 printf(" -a assume binary notation for input\n");
327 // PACKAGE_BUGREPORT 304 printf(" -B enable binary output\n");
328 printf(_("Usage: %s num1 num2 ... numX\n" 305 printf(" -b assume binary notation for input\n");
329 " -A enable ASCII output\n" 306 printf(" -D enable decimal output\n");
330 " -a assume binary notation for input\n" 307 printf(" -d assume decimal notation for input\n");
331 " -B enable binary output\n" 308 printf(" -h, --help print this help and exit\n");
332 " -b assume binary notation for input\n" 309 printf(" -l print minimum number of bytes in hex and binary\n");
333 " -D enable decimal output\n" 310 printf(" -O enable octal output\n");
334 " -d assume decimal notation for input\n" 311 printf(" -o assume octal notation for input\n");
335 " -h, --help print this help and exit\n" 312 printf(" -R display binary in little endian byte order\n");
336 " -l print minimum number of bytes in hex and binary\n" 313 printf(" -r display binary in little endian bit nad byte order\n");
337 " -O enable octal output\n" 314 printf(" -s display binary value in 8 bit blocks\n");
338 " -o assume octal notation for input\n" 315 printf(" -X enable hexadecimal output\n");
339 " -R display binary in little endian byte order\n" 316 printf(" -x assume hexadecimal notation for input\n");
340 " -r display binary in little endian bit nad byte order\n" 317 printf(" -V, --version print version number and exit\n");
341 " -s display binary value in 8 bit blocks\n" 318 printf("\n");
342 " -X enable hexadecimal output\n" 319 printf("Input Notation:\n");
343 " -x assume hexadecimal notation for input\n" 320 printf(" NNNNNNNN input number is in decimal\n");
344 " -V, --version print version number and exit\n" 321 printf(" 0xNNNNNNNN input number is in hexadecimal\n");
345 "\n" 322 printf(" 0NNNNNNNN input number is in octal\n");
346 "Input Notation:\n" 323 printf(" 00NNNNNNNN input number is in binary\n");
347 " NNNNNNNN input number is in decimal\n" 324 printf("\n");
348 " 0xNNNNNNNN input number is in hexadecimal\n" 325 printf("Report bugs to <%s>.\n", PACKAGE_BUGREPORT);
349 " 0NNNNNNNN input number is in octal\n"
350 " 00NNNNNNNN input number is in binary\n"
351 "\n"
352 "Report bugs to <%s>.\n"
353 ), PROGRAM_NAME, PACKAGE_BUGREPORT
354 );
355 return; 326 return;
356} 327}
357 328
@@ -359,18 +330,12 @@ void my_usage()
359/// displays version information 330/// displays version information
360void my_version(void) 331void my_version(void)
361{ 332{
362 // TRANSLATORS: The following strings provide version and copyright 333 printf("%s (%s) %s\n", PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION);
363 // information if the program is passed --version on the command line. 334 printf("Written by David M. Syzdek.\n");
364 // The three strings referenced are: PROGRAM_NAME, PACKAGE_NAME, 335 printf("\n");
365 // PACKAGE_VERSION. 336 printf("%s\n", PACKAGE_COPYRIGHT);
366 printf(_("%s (%s) %s\n" 337 printf("This is free software; see the source for copying conditions. There is NO\n");
367 "Written by David M. Syzdek.\n" 338 printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
368 "\n"
369 "%s\n"
370 "This is free software; see the source for copying conditions. There is NO\n"
371 "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
372 ), PROGRAM_NAME, PACKAGE_NAME, PACKAGE_VERSION, PACKAGE_COPYRIGHT
373 );
374 return; 339 return;
375} 340}
376 341