From 472214316abd997589249df604503270b6174f58 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Fri, 18 Sep 2020 23:24:27 -0500 Subject: [PATCH] Bugfix: iki_write needs to handle the error cases where -o/--object and -c/--content do not have parameters. The -o/--object and -c/--content parameters both require an additional parameter. If that additional parameter is missing, then error out. --- level_3/iki_write/c/iki_write.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/level_3/iki_write/c/iki_write.c b/level_3/iki_write/c/iki_write.c index f9ee15c..0dc541f 100644 --- a/level_3/iki_write/c/iki_write.c +++ b/level_3/iki_write/c/iki_write.c @@ -144,6 +144,26 @@ extern "C" { } } + if (F_status_is_fine(status) && data->parameters[iki_write_parameter_object].result == f_console_result_found) { + if (data->verbosity != iki_write_verbosity_quiet) { + fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '"); + fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, iki_write_long_object); + fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' was specified, but no value was given."); + } + + status = F_status_set_error(F_parameter); + } + + if (F_status_is_fine(status) && data->parameters[iki_write_parameter_content].result == f_console_result_found) { + if (data->verbosity != iki_write_verbosity_quiet) { + fl_color_print(f_type_error, data->context.error, data->context.reset, "ERROR: The parameter '"); + fl_color_print(f_type_error, data->context.notable, data->context.reset, "%s%s", f_console_symbol_long_enable, iki_write_long_content); + fl_color_print_line(f_type_error, data->context.error, data->context.reset, "' was specified, but no value was given."); + } + + status = F_status_set_error(F_parameter); + } + if (F_status_is_fine(status) && !data->process_pipe) { if (data->parameters[iki_write_parameter_object].result != f_console_result_additional && data->parameters[iki_write_parameter_content].result != f_console_result_additional) { if (data->verbosity != iki_write_verbosity_quiet) { -- 1.8.3.1