die.c 672 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include <unistd.h>
  2. #include "writeall.h"
  3. #include "die.h"
  4. void die_9(int e
  5. ,const char *s0
  6. ,const char *s1
  7. ,const char *s2
  8. ,const char *s3
  9. ,const char *s4
  10. ,const char *s5
  11. ,const char *s6
  12. ,const char *s7
  13. ,const char *s8
  14. )
  15. {
  16. const char *s[9];
  17. const char *x;
  18. char buf[1024];
  19. int buflen = 0;
  20. int i;
  21. s[0] = s0;
  22. s[1] = s1;
  23. s[2] = s2;
  24. s[3] = s3;
  25. s[4] = s4;
  26. s[5] = s5;
  27. s[6] = s6;
  28. s[7] = s7;
  29. s[8] = s8;
  30. for (i = 0;i < 9;++i) {
  31. x = s[i];
  32. if (!x) continue;
  33. while (*x) {
  34. if (buflen == sizeof buf) { writeall(2,buf,buflen); buflen = 0; }
  35. buf[buflen++] = *x++;
  36. }
  37. }
  38. writeall(2,buf,buflen);
  39. _exit(e);
  40. }