-extern int kill_main (int argc, char **argv)
-{
- int sig = SIGTERM;
-
- argc--;
- argv++;
- /* Parse any options */
- if (argc < 1)
- usage(kill_usage);
-
- while (argc > 0 && **argv == '-') {
- while (*++(*argv)) {
- switch (**argv) {
- case 'l':
- {
- int col=0;
- const struct signal_name *s = signames;
-
- while (s->name != 0) {
- col+=fprintf(stderr, "%2d) %-8s", s->number, (s++)->name);
- if (col>60) {
- fprintf(stderr, "\n");
- col=0;
- }
- }
- fprintf(stderr, "\n\n");
- exit( TRUE);
- }
- break;
- case '-':
- usage(kill_usage);
- default:
- {
- if (isdigit( **argv)) {
- sig = atoi (*argv);
- if (sig < 0 || sig >= NSIG)
- goto end;
- else {
- argc--;
- argv++;
- goto do_it_now;
+ /* Parse any options */
+ if (argc < 2)
+ bb_show_usage();
+
+ if(argv[1][0] != '-'){
+ argv++;
+ argc--;
+ goto do_it_now;
+ }
+
+ /* The -l option, which prints out signal names. */
+ if(argv[1][1]=='l' && argv[1][2]=='\0'){
+ if(argc==2) {
+ /* Print the whole signal list */
+ int col = 0;
+ for(signo=1; signo < NSIG; signo++) {
+ name = u_signal_names(0, &signo, 1);
+ if(name==NULL) /* unnamed */
+ continue;
+ col += printf("%2d) %-16s", signo, name);
+ if (col > 60) {
+ printf("\n");
+ col = 0;
+ }