Last change
on this file since 5 was
5,
checked in by anonymous, 18 years ago
|
=hoffentlich gehts jetzt
|
File size:
833 bytes
|
Rev | Line | |
---|
[5] | 1 | #include <stdlib.h> |
---|
| 2 | #include <stdio.h> |
---|
| 3 | #include <string.h> |
---|
| 4 | |
---|
| 5 | #include "nvparse_errors.h" |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | nvparse_errors::nvparse_errors() |
---|
| 10 | { |
---|
| 11 | num_errors = 0; |
---|
| 12 | reset(); |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | nvparse_errors::~nvparse_errors() |
---|
| 16 | { |
---|
| 17 | reset(); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | void nvparse_errors::reset() |
---|
| 22 | { |
---|
| 23 | for(int i=0; i < num_errors; i++) |
---|
| 24 | free(elist[i]);//FIXME detail_nmap something is writing 0x2 to elist[1] blah! |
---|
| 25 | for(int j=0; j <= NVPARSE_MAX_ERRORS; j++) |
---|
| 26 | elist[j] = 0; |
---|
| 27 | num_errors = 0; |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | void nvparse_errors::set(const char * e) |
---|
| 31 | { |
---|
| 32 | if(num_errors < NVPARSE_MAX_ERRORS) |
---|
| 33 | elist[num_errors++] = strdup(e); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | void nvparse_errors::set(const char * e, int line_number) |
---|
| 37 | { |
---|
| 38 | char buff[256]; |
---|
| 39 | sprintf(buff, "error on line %d: %s", line_number, e); |
---|
| 40 | if(num_errors < NVPARSE_MAX_ERRORS) |
---|
| 41 | elist[num_errors++] = strdup(buff); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | char * const * const nvparse_errors::get_errors() |
---|
| 45 | { |
---|
| 46 | return elist; |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.