libposix_customization.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * This file is part of Jehanne.
  3. *
  4. * Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
  5. *
  6. * This is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, version 3 of the License.
  9. *
  10. * Jehanne is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Affero General Public License
  16. * along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include <u.h>
  19. #include <libc.h>
  20. #include <posix.h>
  21. static char*
  22. qa_exit_translator(int status)
  23. {
  24. if(status == 0){
  25. if(jehanne_getpid() == jehanne_getmainpid()){
  26. jehanne_print("PASS\n");
  27. return "PASS";
  28. }
  29. return nil;
  30. }
  31. jehanne_print("FAIL: " __POSIX_EXIT_PREFIX "%d\n", status);
  32. return "FAIL";
  33. }
  34. void
  35. __application_newlib_init(void)
  36. {
  37. libposix_translate_exit_status(qa_exit_translator);
  38. }