strsignal.c 636 B

123456789101112131415161718192021222324252627
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <signal.h>
  5. #include "test_helpers.h"
  6. int main(void) {
  7. puts("# strsignal #");
  8. const char *x = strsignal(SIGHUP);
  9. if (strcmp(x, "Hangup")) {
  10. printf("Incorrect strsignal (1), found: .%s.\n", x);
  11. exit(EXIT_FAILURE);
  12. }
  13. x = strsignal(0);
  14. if (strcmp(x, "Unknown signal")) {
  15. printf("Incorrect strsignal (2), found: .%s.\n", x);
  16. exit(EXIT_FAILURE);
  17. }
  18. x = strsignal(100);
  19. if (strcmp(x, "Unknown signal")) {
  20. printf("Incorrect strsignal (3), found: .%s.\n", x);
  21. exit(EXIT_FAILURE);
  22. }
  23. }