strsignal.c 852 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* vi: set sw=4 ts=4: */
  2. /* Copyright (C) 2000 Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
  3. * This file is part of the uC-Linux and is distributed under the
  4. * GNU Library General Public License.
  5. */
  6. #include <string.h>
  7. #include <malloc.h>
  8. #include <signal.h>
  9. extern __const char *__const _sys_siglist[_NSIG];
  10. extern __const char *__const sys_siglist[_NSIG];
  11. /********************** Function strsignal ************************************/
  12. char *strsignal (int sig)
  13. {
  14. static char retbuf[80];
  15. if (sys_siglist) {
  16. if (sig < 0 || sig >= _NSIG)
  17. goto unknown;
  18. strcpy(retbuf, sys_siglist[sig]);
  19. return retbuf;
  20. }
  21. if (sig <= 0)
  22. goto unknown;
  23. unknown:
  24. strcpy(retbuf, "Unknown Signal: ");
  25. strcat(retbuf, (char *) itoa(sig));
  26. return retbuf;
  27. }
  28. /********************** THE END ********************************************/