From b788060469aedf939f3edc2f8ff0b897f6ac25eb Mon Sep 17 00:00:00 2001 From: short <> Date: Fri, 3 Oct 2003 11:24:45 +0000 Subject: [PATCH] captive_options_parse(): Report human-readable parsing errors. captive_options_parse(): Failed options parsing is no longer fatal. --- src/libcaptive/client/options.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/libcaptive/client/options.c b/src/libcaptive/client/options.c index 52ce258..f3077ed 100644 --- a/src/libcaptive/client/options.c +++ b/src/libcaptive/client/options.c @@ -428,7 +428,7 @@ gboolean r=FALSE; errint=poptParseArgvString(captive_args,&captive_args_argc,&captive_args_argv); if (errint!=0) { - g_assert_not_reached(); /* argument parsing args_error */ + g_warning("argument parsing args error: %s",captive_args); goto args_err; } context=poptGetContext( @@ -437,22 +437,22 @@ gboolean r=FALSE; captive_popt_standalone, /* options */ POPT_CONTEXT_KEEP_FIRST); if (context==NULL) { - g_assert_not_reached(); /* argument recognization args_error */ + g_warning("argument recognization args error: %s",captive_args); goto args_err_argv; } errint=poptReadDefaultConfig(context, TRUE); /* useEnv */ if (errint!=0) { - g_assert_not_reached(); /* argument recognization args_error */ + g_warning("argument recognization args error: %s",captive_args); goto args_err_context; } errint=poptGetNextOpt(context); if (errint!=-1) { - g_assert_not_reached(); /* some non-callbacked argument reached */ + g_warning("some non-callbacked argument reached: %s",captive_args); goto args_err_context; } if (poptPeekArg(context)) { - g_assert_not_reached(); /* some non-"--"-prefixed argument reached */ + g_warning("some non-option argument reached: %s",captive_args); goto args_err_context; } r=TRUE; /* success */ @@ -462,9 +462,8 @@ args_err_argv: free(captive_args_argv); /* may be NULL here */ args_err: if (!r) { - puts("FIXME: HELP HERE"); captive_options=NULL; - g_return_val_if_reached(r); + return FALSE; } g_assert(captive_options!=NULL); -- 1.8.3.1