lower-cased some error strings, and added str_errname() to return the
string of an error enum.
Showing
1 changed file
with
30 additions
and
8 deletions
... | @@ -769,22 +769,44 @@ static char *action_to_string(action_t action) | ... | @@ -769,22 +769,44 @@ static char *action_to_string(action_t action) |
769 | return "Error!"; | 769 | return "Error!"; |
770 | } | 770 | } |
771 | 771 | ||
772 | static char *sieve_errstr(int code) | 772 | const char *sieve_errstr(int code) |
773 | { | 773 | { |
774 | switch (code) | 774 | switch (code) |
775 | { | 775 | { |
776 | case SIEVE_FAIL: return "Generic Error"; | 776 | case SIEVE_FAIL: return "generic error"; |
777 | case SIEVE_NOT_FINALIZED: return "Sieve not finalized"; | 777 | case SIEVE_NOT_FINALIZED: return "sieve not finalized"; |
778 | case SIEVE_PARSE_ERROR: return "Parse error"; | 778 | case SIEVE_PARSE_ERROR: return "parse error"; |
779 | case SIEVE_RUN_ERROR: return "Run error"; | 779 | case SIEVE_RUN_ERROR: return "run error"; |
780 | case SIEVE_INTERNAL_ERROR: return "Internal Error"; | 780 | case SIEVE_INTERNAL_ERROR: return "internal error"; |
781 | case SIEVE_NOMEM: return "No memory"; | 781 | case SIEVE_NOMEM: return "no memory error"; |
782 | default: return "Unknown error"; | 782 | default: return "unknown error"; |
783 | } | 783 | } |
784 | 784 | ||
785 | return "Error!"; | 785 | return "Error!"; |
786 | } | 786 | } |
787 | 787 | ||
788 | const char * sieve_errname (int e) | ||
789 | { | ||
790 | switch (e) | ||
791 | { | ||
792 | case SIEVE_FAIL: | ||
793 | return "FAIL"; | ||
794 | case SIEVE_NOT_FINALIZED: | ||
795 | return "NOT_FINALIZED"; | ||
796 | case SIEVE_PARSE_ERROR: | ||
797 | return "PARSE_ERROR"; | ||
798 | case SIEVE_RUN_ERROR: | ||
799 | return "RUN_ERROR"; | ||
800 | case SIEVE_INTERNAL_ERROR: | ||
801 | return "INTERNAL_ERROR"; | ||
802 | case SIEVE_NOMEM: | ||
803 | return "NOMEM"; | ||
804 | case SIEVE_DONE: | ||
805 | return "DONE"; | ||
806 | } | ||
807 | return "UNKNOWN"; | ||
808 | } | ||
809 | |||
788 | #define HASHSIZE 16 | 810 | #define HASHSIZE 16 |
789 | 811 | ||
790 | static int makehash(unsigned char hash[HASHSIZE], char *s1, char *s2) | 812 | static int makehash(unsigned char hash[HASHSIZE], char *s1, char *s2) | ... | ... |
-
Please register or sign in to post a comment