if(signo==SIGPIPE) _exit(0); /* "ps | head" will cause this */
/* fprintf() is not reentrant, but we _exit() anyway */
fprintf(stderr,
- _("\n\n"
- "Signal %d (%s) caught by %s (%s).\n"
- "Please send bug reports to <procps@freelists.org>\n"),
+ _("Signal %d (%s) caught by %s (%s).\n"),
signo,
signal_number_to_name(signo),
myname,
procps_version
);
- _exit(signo+128);
+ catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
}
/////////////////////////////////////////////////////////////////////////////////////
t_end->need = 0;
break;
default:
- fprintf(stderr, _("please report this bug\n"));
+ catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
// FALL THROUGH
case CF_PRINT_AS_NEEDED:
case CF_PRINT_EVERY_TIME:
open_psdb(namelist_file);
fprintf(stderr,"namelist_file=\"%s\"\n",namelist_file?namelist_file:"<no System.map file>");
}
+
+void __attribute__ ((__noreturn__))
+catastrophic_failure(const char *filename,
+ unsigned int linenum,
+ const char *message)
+{
+ error_at_line(0, 0, filename, linenum, message);
+ abort();
+}
return _("Embedded '-' among SysV options makes no sense.");
break;
case '\0':
- return _("Please report the \"SysV \\0 can't happen\" bug.");
+ catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
break;
default:
return _("Unsupported SysV option.");
return _("Embedded '-' among BSD options makes no sense.");
break;
case '\0':
- return _("Please report the \"BSD \\0 can't happen\" bug.");
+ catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
break;
default:
return _("Unsupported option (BSD syntax)");
trailer = (otype=='b') ? "END_BSD" : "END_SYS5" ;
fnode = do_one_spec("pid",NULL);
- if(!fnode)fprintf(stderr,_("Seriously crashing. Goodbye cruel world.\n"));
+ if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("Seriously crashing. Goodbye cruel world."));
endp = sfn->f_cooked; while(endp->next) endp = endp->next; /* find end */
endp->next = fnode;
fnode = do_one_spec(trailer,NULL);
- if(!fnode) { fprintf(stderr,_("Seriously crashing. Goodbye cruel world.\n")); exit(1); }
+ if(!fnode)catastrophic_failure(__FILE__, __LINE__, _("Seriously crashing. Goodbye cruel world."));
endp = fnode; while(endp->next) endp = endp->next; /* find end */
endp->next = sfn->f_cooked;
sfn->f_cooked = fnode;
already_parsed_sort = 1;
break;
default: /*** junk ***/
- return _("Bug: parse_O_option got weirdness!");
+ catastrophic_failure(__FILE__, __LINE__, _("please report this bug"));
}
return err; /* could be NULL */
}
if(err) return err;
}
- if(format_list) printf(_("Bug: must reset the list first!\n"));
+ if(format_list) catastrophic_failure(__FILE__, __LINE__, _("Bug: must reset the list first!"));
/* merge formatting info of sf_list into format_list here */
sf_walk = sf_list;
if(format_modifiers & FM_j){
fn = do_one_spec("pgid", NULL);
if(!fmt_add_after("PPID", fn)) if(!fmt_add_after("PID", fn))
- return _("Internal error, no PID or PPID for -j option.");
+ catastrophic_failure(__FILE__, __LINE__, _("Internal error, no PID or PPID for -j option."));
fn = do_one_spec("sid", NULL);
if(!fmt_add_after("PGID", fn)) return _("Lost my PGID!");
}
fmt_delete("NI");
fn = do_one_spec("class", NULL);
if(!fmt_add_after("PRI", fn))
- return _("Internal error, no PRI for -c option.");
+ catastrophic_failure(__FILE__, __LINE__, _("Internal error, no PRI for -c option."));
fmt_delete("PRI"); /* we want a different one */
fn = do_one_spec("pri", NULL);
if(!fmt_add_after("CLS", fn)) return _("Lost my CLS!");