fatal.c 536 B

1234567891011121314151617181920212223242526272829
  1. /* public domain */
  2. #include "includes.h"
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5. #include <stdarg.h>
  6. #include <unistd.h>
  7. #include "log.h"
  8. void sshfatal(const char *file, const char *func, int line, int showfunc,
  9. LogLevel level, const char *fmt, ...);
  10. void
  11. sshfatal(const char *file, const char *func, int line, int showfunc,
  12. LogLevel level, const char *fmt, ...)
  13. {
  14. va_list ap;
  15. if (showfunc)
  16. fprintf(stderr, "%s: ", func);
  17. va_start(ap, fmt);
  18. vfprintf(stderr, fmt, ap);
  19. va_end(ap);
  20. fputc('\n', stderr);
  21. _exit(1);
  22. }