- t = (p == (char *)IGNORE_SIG) ? (char *)NULL : single_quote (p);
- printf ("trap -- %s %s\n", t ? t : "''", signal_name (i));
- if (t)
- free (t);
+ t = (p == (char *)IGNORE_SIG) ? (char *)NULL : sh_single_quote (p);
+ sn = signal_name (i);
+ /* Make sure that signals whose names are unknown (for whatever reason)
+ are printed as signal numbers. */
+ if (STREQN (sn, "SIGJUNK", 7) || STREQN (sn, "unknown", 7))
+ printf ("trap -- %s %d\n", t ? t : "''", i);
+ else if (posixly_correct)
+ {
+ if (STREQN (sn, "SIG", 3))
+ printf ("trap -- %s %s\n", t ? t : "''", sn+3);
+ else
+ printf ("trap -- %s %s\n", t ? t : "''", sn);
+ }
+ else
+ printf ("trap -- %s %s\n", t ? t : "''", sn);
+
+ FREE (t);