__assert.c 630 B

12345678910111213141516171819202122232425262728293031
  1. /* Copyright (C) 1996 Robert de Bath <rdebath@cix.compulink.co.uk>
  2. * This file is part of the Linux-8086 C library and is distributed
  3. * under the GNU Library General Public License.
  4. */
  5. #include <unistd.h>
  6. #include <string.h>
  7. #include <stdlib.h>
  8. extern char *itoa(int);
  9. static void errput(str)
  10. const char *str;
  11. {
  12. write(2, str, strlen(str));
  13. }
  14. void __assert(assertion, filename, linenumber)
  15. const char *assertion;
  16. const char *filename;
  17. int linenumber;
  18. {
  19. errput("Failed assertion '");
  20. errput(assertion);
  21. errput("' in file ");
  22. errput(filename);
  23. errput(" at line ");
  24. errput(itoa(linenumber));
  25. errput(".\n");
  26. abort();
  27. }