aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/suicide.c102
1 files changed, 39 insertions, 63 deletions
diff --git a/src/suicide.c b/src/suicide.c
index f8c1b4e..b5aa9da 100644
--- a/src/suicide.c
+++ b/src/suicide.c
@@ -63,26 +63,6 @@
63 63
64/////////////////// 64///////////////////
65// // 65// //
66// i18l Support //
67// //
68///////////////////
69
70#ifdef HAVE_GETTEXT
71# include <gettext.h>
72# include <libintl.h>
73# define _(String) gettext (String)
74# define gettext_noop(String) String
75# define N_(String) gettext_noop (String)
76#else
77# define _(String) (String)
78# define N_(String) String
79# define textdomain(Domain)
80# define bindtextdomain(Package, Directory)
81#endif
82
83
84///////////////////
85// //
86// Definitions // 66// Definitions //
87// // 67// //
88/////////////////// 68///////////////////
@@ -329,12 +309,6 @@ int main(int argc, char * argv[])
329 {NULL, 0, 0, 0 } 309 {NULL, 0, 0, 0 }
330 }; 310 };
331 311
332#ifdef HAVE_GETTEXT
333 setlocale (LC_ALL, "");
334 bindtextdomain (PACKAGE, LOCALEDIR);
335 textdomain (PACKAGE);
336#endif
337
338 p = getpid(); 312 p = getpid();
339 pp = getppid(); 313 pp = getppid();
340 verbose = 0; 314 verbose = 0;
@@ -347,43 +321,53 @@ int main(int argc, char * argv[])
347 { 321 {
348 case -1: /* no more arguments */ 322 case -1: /* no more arguments */
349 case 0: /* long options toggles */ 323 case 0: /* long options toggles */
350 break; 324 break;
325
351 case 'c': 326 case 'c':
352 attempt_catch = 1; 327 attempt_catch = 1;
353 break; 328 break;
329
354 case 'h': 330 case 'h':
355 suicide_usage(); 331 suicide_usage();
356 return(0); 332 return(0);
333
357 case 'i': 334 case 'i':
358 suicide_susv3_sigs_ignore(); 335 suicide_susv3_sigs_ignore();
359 return(0); 336 return(0);
337
360 case 'n': 338 case 'n':
361 val = (int)strtol(optarg, NULL, 0); 339 val = (int)strtol(optarg, NULL, 0);
362 if ((sig = suicide_find_data(&data, NULL, val)) == -1) 340 if ((sig = suicide_find_data(&data, NULL, val)) == -1)
363 return(1); 341 return(1);
364 break; 342 break;
343
365 case 's': 344 case 's':
366 if ((sig = suicide_find_data(&data, optarg, -1)) == -1) 345 if ((sig = suicide_find_data(&data, optarg, -1)) == -1)
367 return(1); 346 return(1);
368 break; 347 break;
348
369 case 'S': 349 case 'S':
370 suicide_susv3_sigs(); 350 suicide_susv3_sigs();
371 return(0); 351 return(0);
352
372 case 'V': 353 case 'V':
373 suicide_version(); 354 suicide_version();
374 return(0); 355 return(0);
356
375 case 'v': 357 case 'v':
376 verbose = 1; 358 verbose = 1;
377 break; 359 break;
360
378 case '?': 361 case '?':
379 fprintf(stderr, _("Try `%s --help' for more information.\n"), PROGRAM_NAME); 362 fprintf(stderr, "Try `%s --help' for more information.\n", PROGRAM_NAME);
380 return(1); 363 return(1);
364
381 default: 365 default:
382 fprintf(stderr, _("%s: unrecognized option `--%c'\n" 366 fprintf(stderr, ("%s: unrecognized option `--%c'\n"
383 "Try `%s --help' for more information.\n" 367 "Try `%s --help' for more information.\n"
384 ), PROGRAM_NAME, c, PROGRAM_NAME 368 ), PROGRAM_NAME, c, PROGRAM_NAME
385 ); 369 );
386 return(1); 370 return(1);
387 }; 371 };
388 }; 372 };
389 373
@@ -525,11 +509,7 @@ void suicide_susv3_sigs_ignore(void)
525/// displays usage 509/// displays usage
526void suicide_usage(void) 510void suicide_usage(void)
527{ 511{
528 // TRANSLATORS: The following strings provide usage for command. These 512 printf(("Usage: %s [OPTIONS]\n"
529 // strings are displayed if the program is passed `--help' on the command
530 // line. The two strings referenced are: PROGRAM_NAME, and
531 // PACKAGE_BUGREPORT
532 printf(_("Usage: %s [OPTIONS]\n"
533 " -c attempt to catch signals\n" 513 " -c attempt to catch signals\n"
534 " -i print C code to ignore signals\n" 514 " -i print C code to ignore signals\n"
535 " -h, --help print this help and exit\n" 515 " -h, --help print this help and exit\n"
@@ -557,11 +537,7 @@ void suicide_usage(void)
557/// displays version 537/// displays version
558void suicide_version(void) 538void suicide_version(void)
559{ 539{
560 // TRANSLATORS: The following strings provide version and copyright 540 printf(("%s (%s) %s\n"
561 // information if the program is passed --version on the command line.
562 // The three strings referenced are: PROGRAM_NAME, PACKAGE_NAME,
563 // PACKAGE_VERSION.
564 printf(_("%s (%s) %s\n"
565 "Written by David M. Syzdek.\n" 541 "Written by David M. Syzdek.\n"
566 "\n" 542 "\n"
567 "%s\n" 543 "%s\n"