Encode error type in argpar_error
[argpar.git] / argpar / argpar.h
index 3340d90f593031756a6e8d80f5a704ddff6f89a1..07ec8c47071f8f0f850e7d41020faa8d66361688 100644 (file)
@@ -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,
This page took 0.023705 seconds and 4 git commands to generate.