error.h (1218B)
1 /* 2 wificurse - WiFi Jamming tool 3 Copyright (C) 2012 oblique 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 3 of the License, or 8 (at your option) any later version. 9 10 This program 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 General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef ERROR_H 20 #define ERROR_H 21 22 #include <errno.h> 23 24 25 #define GOTERR -1 26 #define ERRNODATA -2 27 28 void set_error(char *file, int line, int errnum, char *fmt, ...); 29 void print_error(); 30 void _err_msg(char *file, int line, int errnum, char *fmt, ...); 31 32 33 #define return_error(fmt, ...) \ 34 do { \ 35 set_error(__FILE__, __LINE__, errno, fmt, ##__VA_ARGS__); \ 36 return GOTERR; \ 37 } while(0) 38 39 #define err_msg(fmt, ...) \ 40 _err_msg(__FILE__, __LINE__, errno, fmt, ##__VA_ARGS__) 41 42 43 #endif