X-Git-Url: http://git.efficios.com/?p=argpar.git;a=blobdiff_plain;f=argpar%2Fargpar.h;h=07ec8c47071f8f0f850e7d41020faa8d66361688;hp=3340d90f593031756a6e8d80f5a704ddff6f89a1;hb=10aefab2119c89f4afa4f46a619eae20d6be7512;hpb=0a024790c9bd035f94db7919cafc0ffd051452f3 diff --git a/argpar/argpar.h b/argpar/argpar.h index 3340d90..07ec8c4 100644 --- a/argpar/argpar.h +++ b/argpar/argpar.h @@ -338,6 +338,17 @@ void argpar_item_destroy(const struct argpar_item *item); @{ */ +enum argpar_error_type { + /// Unknown option error + ARGPAR_ERROR_TYPE_UNKNOWN_OPT, + + /// Missing option argument error + ARGPAR_ERROR_TYPE_MISSING_OPT_ARG, + + /// Unexpected option argument error + ARGPAR_ERROR_TYPE_UNEXPECTED_OPT_ARG, +}; + /*! @struct argpar_error @@ -346,6 +357,10 @@ void argpar_item_destroy(const struct argpar_item *item); */ struct argpar_error; +ARGPAR_HIDDEN +enum argpar_error_type argpar_error_type( + const struct argpar_error *error); + /*! @brief Returns the index of the original argument (in \p argv, as passed to @@ -603,14 +618,8 @@ enum argpar_iter_next_status { /// End of iteration (no more original arguments to parse) ARGPAR_ITER_NEXT_STATUS_END, - /// Unknown option error - ARGPAR_ITER_NEXT_STATUS_ERROR_UNKNOWN_OPT = -1, - - /// Missing option argument error - ARGPAR_ITER_NEXT_STATUS_ERROR_MISSING_OPT_ARG = -2, - - /// Unexpected option argument error - ARGPAR_ITER_NEXT_STATUS_ERROR_UNEXPECTED_OPT_ARG = -3, + /// Argument error + ARGPAR_ITER_NEXT_STATUS_ERROR = -1, /// Memory error ARGPAR_ITER_NEXT_STATUS_ERROR_MEMORY = -12,