You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

err_errno.h 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**************************************
  2. * AUTHOR: Federico Tomassini *
  3. * Copyright (C) Federico Tomassini *
  4. * Contact effetom@gmail.com *
  5. ***********************************************
  6. ***** ******
  7. *************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. * This program is distributed in the hope that it will be useful, *
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  17. * GNU General Public License for more details. *
  18. * *
  19. ************************************************************************/
  20. #ifndef ERR_ERRNO_H
  21. #define ERR_ERRNO_H
  22. #include <errno.h>
  23. #include <string.h>
  24. #include <stdlib.h>
  25. #define ERR_UFOERR -1
  26. #define ERR_DNSMLO -2
  27. #define ERR_DNSMSL -3
  28. #define ERR_DNSMDP -4
  29. #define ERR_DNSMDD -5
  30. #define ERR_DNSTRP -6
  31. #define ERR_DNSPLB -7
  32. #define ERR_DNSPTP -8
  33. #define ERR_DNSMDA -9
  34. #define ERR_DNSPDS -10
  35. #define ERR_ANDMAP -11
  36. #define ERR_ANDPLB -12
  37. #define ERR_ANDMAD -13
  38. #define ERR_ANDNCQ -14
  39. #define ERR_RSLERC -15
  40. #define ERR_RSLAIE -16
  41. #define ERR_RSLNNS -17
  42. #define ERR_RSLFDQ -18
  43. #define ERR_RSLRSL -19
  44. #define ERR_RSLAQD -20
  45. #define ERR_MRKINI -21
  46. #define ERR_NETFIL -22
  47. #define ERR_NETRUL -23
  48. #define ERR_NETCOM -24
  49. #define ERR_NETCHA -25
  50. #define ERR_NETDEL -26
  51. #define ERR_NETSTO -27
  52. #define ERR_NETRST -28
  53. #define ERR_SNDMRF -29
  54. #define ERR_SNDRCS -30
  55. #define ERR_ZLIBCP -31
  56. #define ERR_ZLIBUP -32
  57. #define ERR_ZLIBNU -33
  58. #define ERR_TOTAL_ERRS (-(ERR_ZLIBNU))
  59. #define ERR_OVERFLOW "Error number does not exist."
  60. /* END OF DEFS */
  61. /*
  62. * Core
  63. */
  64. const char *err_func, *err_file;
  65. #define ERR_NERR (ERR_TOTAL_ERRS)
  66. #define err_seterrno(n) errno=(n);err_func=__func__; \
  67. err_file=__FILE__
  68. #define err_ret(n,ret) {err_seterrno(n);return ret;}
  69. #define err_intret(n) {err_seterrno(n);return -1;}
  70. #define err_voidret(n) {err_seterrno(n);return NULL;}
  71. #define err_strerror(e) \
  72. ((e)>=0)? \
  73. strerror(e): \
  74. __err_strerror(e)
  75. #define ERR_FORMAT "In %s(): %s() returns -> %s"
  76. #define err_str ERR_FORMAT,__func__, \
  77. err_func,__err_strerror(errno)
  78. const char *__err_strerror(int n);
  79. #endif /* ERR_ERRNO_H */