error.h 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * File: error.h
  3. * Author: Arthur Brandao
  4. *
  5. * Created on 8 novembre 2018
  6. */
  7. #ifndef ERROR_H
  8. #define ERROR_H
  9. #include <stdio.h>
  10. #include <errno.h>
  11. /* --- Macro --- */
  12. #define serror(str) fprintf(stderr, str" : %s\n", serrlib[serrno])
  13. #define strserror(index) serrlib[index]
  14. #define adderror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str"\n", __LINE__)
  15. #define addperror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str" : %s\n", __LINE__, strerror(errno))
  16. #define addserror(str) fprintf(stderr, "Erreur dans le fichier "__FILE__" ligne %d, "str" : %s\n", __LINE__, strserror(serrno))
  17. /* --- Constantes Generales --- */
  18. #define ERR -1
  19. /* --- Constantes Erreurs --- */
  20. #define SEBADEND 1
  21. #define SEBADET 2
  22. #define SEOPENF 3
  23. #define SEREDIRTYPE 4
  24. #define SEBADREDIR 5
  25. #define SEBADCMD 6
  26. #define SEWC 7
  27. #define SEADDWC 8
  28. /* --- Extern --- */
  29. extern int errno;
  30. extern int serrno; //Shell Errno
  31. extern char* serrlib[];
  32. #endif /* ERROR_H */