Handle some loose ends in the FSS read programs.
Update fss_status_code and status_code.
fss_basic_list_read_data_delete_simple(&data);
}
else {
- fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
fss_basic_read_data_delete_simple(&data);
}
else {
- fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
// This standard does not support multiple content groups.
if ((data->option & fss_basic_read_data_option_select) && data->select) {
if (main->parameters[fss_basic_read_parameter_total].result == f_console_result_found) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (data->depths.array[0].value_at >= data->objects.used) {
if (data->option & (fss_basic_read_data_option_columns | fss_basic_read_data_option_total)) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (data->option & fss_basic_read_data_option_line) {
if (data->line) {
if (data->option & fss_basic_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (data->line) break;
if (data->option & fss_basic_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_one(main);
+
+ funlockfile(main->output.stream);
}
else {
fss_basic_read_print_at(i, *delimits, except_none, main, data);
}
}
else if (data->option & fss_basic_read_data_option_columns) {
- fprintf(main->output.stream, "%llu%c", data->contents.array[i].used, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
else if (data->option & fss_basic_read_data_option_total) {
+ flockfile(main->output.stream);
+
if (data->contents.array[i].used) {
fss_basic_read_print_one(main);
}
else {
fss_basic_read_print_zero(main);
}
+
+ funlockfile(main->output.stream);
}
else {
fss_basic_read_print_at(i, *delimits, except_none, main, data);
} // for
if (data->option & fss_basic_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
f_status_t fss_basic_read_process_columns(fss_basic_read_main_t * const main, fss_basic_read_data_t *data, bool names[]) {
if (!(data->option & fss_basic_read_data_option_content)) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_zero(main);
+ funlockfile(main->output.stream);
+
return F_none;
}
}
} // for
- fprintf(main->output.stream, "%llu%c", max, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, max, f_string_eol_s[0]);
return F_none;
}
if (!data->contents.array[i].used) {
if (data->option & fss_basic_read_data_option_empty) {
if (line == data->line) {
+ flockfile(main->output.stream);
+
fss_basic_read_print_set_end(main);
+ funlockfile(main->output.stream);
+
break;
}
++total;
} // for
+ flockfile(main->output.stream);
+
if (data->option & fss_basic_read_data_option_line) {
if (data->line < total) {
fss_basic_read_print_one(main);
}
}
else {
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fl_print_format("%ul%c", main->output.stream, total, f_string_eol_s[0]);
}
+ funlockfile(main->output.stream);
+
return F_none;
}
#endif // _di_fss_basic_read_process_total_
// Skip past empty files.
if (!main->quantity.total) {
if (main->parameters[fss_embedded_list_read_parameter_total].result == f_console_result_found) {
- fprintf(main->output.stream, "0%c", f_string_eol_s[0]);
+ fll_print_format("0%c", main->output.stream, f_string_eol_s[0]);
}
f_file_stream_close(F_true, &file);
macro_f_fss_comments_t_delete_simple(comments);
}
else {
- fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
++total;
} // for
- fl_print_format("%lu%c", main->output.stream, total, f_string_eol_s[0]);
+ fll_print_format("%lu%c", main->output.stream, total, f_string_eol_s[0]);
return F_none;
}
fss_extended_list_read_data_delete_simple(&data);
}
else {
- fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
if (data->depths.array[0].value_at >= data->objects.used) {
if (data->option & (fss_extended_list_read_data_option_columns | fss_extended_list_read_data_option_total)) {
+ flockfile(main->output.stream);
+
fss_extended_list_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (status == F_success) return F_none;
}
else if (data->option & fss_extended_list_read_data_option_columns) {
- fprintf(main->output.stream, "%llu%c", data->contents.array[i].used, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
else if (data->option & fss_extended_list_read_data_option_total) {
if ((data->option & fss_extended_list_read_data_option_object) && !(data->option & fss_extended_list_read_data_option_content)) {
+ flockfile(main->output.stream);
+
if (data->contents.array[i].used) {
fss_extended_list_read_print_one(main);
}
else {
fss_extended_list_read_print_zero(main);
}
+
+ funlockfile(main->output.stream);
}
else {
f_array_length_t total = 0;
}
} // for
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, total, f_string_eol_s[0]);
}
}
else {
} // for
if (data->option & fss_extended_list_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_extended_list_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
f_status_t fss_extended_list_read_process_columns(fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, bool names[]) {
if (!(data->option & fss_extended_list_read_data_option_content)) {
+ flockfile(main->output.stream);
+
fss_extended_list_read_print_zero(main);
+ funlockfile(main->output.stream);
+
return F_none;
}
}
} // for
- fprintf(main->output.stream, "%llu%c", max, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, max, f_string_eol_s[0]);
return F_none;
}
f_status_t fss_extended_list_read_process_at_line(const f_array_length_t at, const f_array_lengths_t delimits_object, const f_array_lengths_t delimits_content, fss_extended_list_read_main_t * const main, fss_extended_list_read_data_t *data, f_array_length_t *line) {
if (data->option & fss_extended_list_read_data_option_object) {
+
if (*line == data->line) {
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_list_read_data_option_total) {
fss_extended_list_read_print_one(main);
}
fss_extended_list_read_print_at_object(main, data, at, delimits_object);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
if (*line == data->line) {
range.stop = i;
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_list_read_data_option_total) {
fss_extended_list_read_print_one(main);
}
f_print_except_in_dynamic_partial(data->buffer, range, delimits_content, data->comments, main->output.stream);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
++(*line);
if (*line == data->line) {
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_list_read_data_option_total) {
fss_extended_list_read_print_one(main);
}
range.stop = data->contents.array[at].array[0].stop;
f_print_except_in_dynamic_partial(data->buffer, range, delimits_content, data->comments, main->output.stream);
- fprintf(main->output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], main->output.stream);
}
+ funlockfile(main->output.stream);
+
return F_success;
}
}
}
} // for
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_list_read_data_option_line) {
if (data->line < total) {
fss_extended_list_read_print_one(main);
}
}
else {
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fl_print_format("%ul%c", main->output.stream, total, f_string_eol_s[0]);
}
+ funlockfile(main->output.stream);
+
return F_none;
}
#endif // _di_fss_extended_list_read_process_total_
fss_extended_read_data_delete_simple(&data);
}
else {
- fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
+ fll_print_format("%c%[%sYou failed to specify one or more files.%]%c", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context, f_string_eol_s[0]);
status = F_status_set_error(F_parameter);
}
if (data->option & fss_extended_read_data_option_select) {
if (data->option & fss_extended_read_data_option_object) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_one(main);
+ funlockfile(main->output.stream);
+
return F_success;
}
if (data->select < data->contents.array[at].used) {
if (data->contents.array[at].array[data->select].start <= data->contents.array[at].array[data->select].stop || (data->option & fss_extended_read_data_option_empty)) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_one(main);
+ funlockfile(main->output.stream);
+
return F_success;
}
}
}
else if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_empty)) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_one(main);
+ funlockfile(main->output.stream);
+
return F_success;
}
else if (data->contents.array[at].used) {
for (f_array_length_t j = 0; j < data->contents.array[at].used; ++j) {
if (data->contents.array[at].array[j].start <= data->contents.array[at].array[j].stop) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_one(main);
+ funlockfile(main->output.stream);
+
return F_success;
}
} // for
f_print_character(fss_extended_read_pipe_content_end, main->output.stream);
}
else {
- fprintf(main->output.stream, "%c", f_fss_eol);
f_print_character(f_fss_eol, main->output.stream);
}
}
if (data->depths.array[0].value_at >= data->objects.used) {
if (data->option & (fss_extended_read_data_option_columns | fss_extended_read_data_option_total)) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
if (data->option & fss_extended_read_data_option_line) {
if (data->line) {
if (data->option & fss_extended_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
}
}
else if (data->option & fss_extended_read_data_option_columns) {
- fprintf(main->output.stream, "%llu%c", data->contents.array[i].used, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, data->contents.array[i].used, f_string_eol_s[0]);
}
else if (data->option & fss_extended_read_data_option_total) {
if (fss_extended_read_print_at_total(i, main, data) == F_none) {
} // for
if (data->option & fss_extended_read_data_option_total) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_zero(main);
+
+ funlockfile(main->output.stream);
}
return F_none;
f_status_t fss_extended_read_process_columns(fss_extended_read_main_t * const main, fss_extended_read_data_t *data, bool names[]) {
if (!(data->option & fss_extended_read_data_option_content)) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_zero(main);
+ funlockfile(main->output.stream);
+
return F_none;
}
}
} // for
- fprintf(main->output.stream, "%llu%c", max, f_string_eol_s[0]);
+ fll_print_format("%ul%c", main->output.stream, max, f_string_eol_s[0]);
return F_none;
}
if (!data->contents.array[i].used) {
if (data->option & fss_extended_read_data_option_empty) {
if (line == data->line) {
+ flockfile(main->output.stream);
+
fss_extended_read_print_set_end(main);
+ funlockfile(main->output.stream);
+
break;
}
} // for
}
+ flockfile(main->output.stream);
+
if (data->option & fss_extended_read_data_option_line) {
if (data->line < total) {
fss_extended_read_print_one(main);
}
}
else {
- fprintf(main->output.stream, "%llu%c", total, f_string_eol_s[0]);
+ fl_print_format("%ul%c", main->output.stream, total, f_string_eol_s[0]);
}
- return F_none;
- }
-#endif // _di_fss_extended_read_process_total_
-
-
-
-#ifndef _di_fss_extended_read_process_total_content_
- f_status_t fss_extended_read_process_total_content(const f_array_length_t at, fss_extended_read_main_t * const main, fss_extended_read_data_t *data, f_array_length_t *total) {
-
- if (data->option & fss_extended_read_data_option_select) {
- if (data->option & fss_extended_read_data_option_object) {
- fss_extended_read_print_one(main);
-
- return F_success;
- }
-
- if (data->select < data->contents.array[at].used) {
- if (data->contents.array[at].array[data->select].start <= data->contents.array[at].array[data->select].stop || (data->option & fss_extended_read_data_option_empty)) {
- fss_extended_read_print_one(main);
-
- return F_success;
- }
- }
- }
- else if ((data->option & fss_extended_read_data_option_object) || (data->option & fss_extended_read_data_option_empty)) {
- fss_extended_read_print_one(main);
-
- return F_success;
- }
- else if (data->contents.array[at].used) {
- for (f_array_length_t j = 0; j < data->contents.array[at].used; ++j) {
-
- if (data->contents.array[at].array[j].start <= data->contents.array[at].array[j].stop) {
- fss_extended_read_print_one(main);
-
- return F_success;
- }
- } // for
- }
+ funlockfile(main->output.stream);
return F_none;
}
-#endif // _di_fss_extended_read_process_total_content_
+#endif // _di_fss_extended_read_process_total_
#ifdef __cplusplus
} // extern "C"
#ifndef _di_fss_status_code_print_help_
f_status_t fss_status_code_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, fss_status_code_name_long, fss_status_code_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, fss_status_code_short_is_fine, fss_status_code_long_is_fine, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is not an error, F_false otherwise.");
fll_program_print_help_option(output, context, fss_status_code_short_is_warning, fss_status_code_long_is_warning, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print F_true if the error code is a warning, F_false otherwise.");
fll_program_print_help_usage(output, context, fss_status_code_name, "status code(s)");
+ funlockfile(output.stream);
+
return F_none;
}
#endif // _di_fss_status_code_print_help_
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == fss_status_code_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == fss_status_code_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == fss_status_code_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == fss_status_code_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
if (main->parameters[fss_status_code_parameter_is_error].result == f_console_result_found) {
if (main->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
fss_status_code_main_delete(main);
return F_status_set_error(status);
}
else if (main->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_error);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_error, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
fss_status_code_main_delete(main);
return F_status_set_error(status);
}
}
else if (main->parameters[fss_status_code_parameter_is_warning].result == f_console_result_found && main->parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_warning);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, fss_status_code_long_is_fine);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_warning, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, fss_status_code_long_is_fine, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
fss_status_code_main_delete(main);
return F_status_set_error(status);
}
if (main->remaining.used == 0 && !main->process_pipe) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify an error code.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%[You failed to specify an error code.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
fss_status_code_main_delete(main);
return F_status_set_error(F_parameter);
// fll-1 includes
#include <fll/level_1/console.h>
#include <fll/level_1/conversion.h>
+#include <fll/level_1/print.h>
#include <fll/level_1/status.h>
#include <fll/level_1/string.h>
// fll-2 includes
#include <fll/level_2/error.h>
#include <fll/level_2/fss_status.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <fll/level_2/status.h>
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} fss_status_code_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_fss_status_code_main_t_
#ifndef _di_fss_status_code_process_check_
f_status_t fss_status_code_process_check(const fss_status_code_main_t main, const f_string_t value) {
+
f_number_unsigned_t number = 0;
f_status_t status = fss_status_code_convert_number(main, value, &number);
if (main.parameters[fss_status_code_parameter_is_error].result == f_console_result_found) {
if (F_status_is_error(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
else if (main.parameters[fss_status_code_parameter_is_warning].result == f_console_result_found) {
if (F_status_is_warning(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
else if (main.parameters[fss_status_code_parameter_is_fine].result == f_console_result_found) {
if (F_status_is_fine(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
return F_none;
#ifndef _di_fss_status_code_process_number_
f_status_t fss_status_code_process_number(const fss_status_code_main_t main, const f_string_t value) {
+
f_status_t status = F_none;
{
status = fl_conversion_string_to_number_unsigned(value, range, &number);
if (status == F_none) {
- f_color_print(main.output.stream, main.context.set.error, "invalid name%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid name%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return F_status_set_error(F_parameter);
}
if (status == F_data_not || F_status_set_fine(status) == F_parameter) {
- f_color_print(main.output.stream, main.context.set.error, "invalid main%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid main%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- f_color_print(main.output.stream, main.context.set.error, "unknown name%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown name%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]);
+ fll_print_format("%[failed to convert%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
}
if (status == F_data) {
- f_color_print(main.output.stream, main.context.set.warning, "unknown code%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown code%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return F_none;
}
- printf("%u\n", code);
+ fll_print_format("%ui%c", main.output.stream, code, f_string_eol_s[0]);
return F_none;
}
#ifndef _di_fss_status_code_process_normal_
f_status_t fss_status_code_process_normal(const fss_status_code_main_t main, const f_string_t value) {
+
f_number_unsigned_t number = 0;
f_status_t status = fss_status_code_convert_number(main, value, &number);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- f_color_print(main.output.stream, main.context.set.error, "unknown code%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown code%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]);
+ fll_print_format("%[failed to convert%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
}
- printf("%s\n", string);
+ fll_print_format("%S%c", main.output.stream, string, f_string_eol_s[0]);
return F_none;
}
#ifndef _di_fss_status_code_convert_number_
f_status_t fss_status_code_convert_number(const fss_status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) {
+
const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number);
if (*number > F_status_size_max_with_signal) {
- f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]);
+ fll_print_format("%[out of range%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_number_negative) {
- f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]);
+ fll_print_format("%[out of range%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "invalid number%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid number%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
fl_console
fl_conversion
fl_fss
+fl_print
fl_status
+fl_string
fll_error
fll_file
fll_fss
+fll_print
fll_program
fll_status
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_program -lfll_status -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_file -lfll_fss -lfll_print -lfll_program -lfll_status -lfl_console -lfl_conversion -lfl_directory -lfl_fss -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_directory -lf_environment -lf_file -lf_fss -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library fss_status_code.c private-common.c private-fss_status_code.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC
#ifndef _di_status_code_process_check_
f_status_t status_code_process_check(const status_code_main_t main, const f_string_t value) {
+
f_number_unsigned_t number = 0;
f_status_t status = status_code_convert_number(main, value, &number);
if (main.parameters[status_code_parameter_is_error].result == f_console_result_found) {
if (F_status_is_error(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
else if (main.parameters[status_code_parameter_is_warning].result == f_console_result_found) {
if (F_status_is_warning(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
else if (main.parameters[status_code_parameter_is_fine].result == f_console_result_found) {
if (F_status_is_fine(number)) {
- printf("%s\n", FL_status_string_true);
+ f_print_terminated(FL_status_string_true, main.output.stream);
}
else {
- printf("%s\n", FL_status_string_false);
+ f_print_terminated(FL_status_string_false, main.output.stream);
}
+
+ f_print_character(f_string_eol_s[0], main.output.stream);
}
return F_none;
#ifndef _di_status_code_process_number_
f_status_t status_code_process_number(const status_code_main_t main, const f_string_t value) {
+
f_status_t status = F_none;
{
status = fl_conversion_string_to_number_unsigned(value, range, &number);
if (status == F_none) {
- f_color_print(main.output.stream, main.context.set.error, "invalid name%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid name%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return F_status_set_error(F_parameter);
}
if (status == F_data_not || F_status_set_fine(status) == F_parameter) {
- f_color_print(main.output.stream, main.context.set.error, "invalid main%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid main%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- f_color_print(main.output.stream, main.context.set.error, "unknown name%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown name%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]);
+ fll_print_format("%[failed to convert%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
}
if (status == F_data) {
- f_color_print(main.output.stream, main.context.set.warning, "unknown code%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown code%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return F_none;
}
- printf("%u\n", code);
+ fll_print_format("%ui%c", main.output.stream, code, f_string_eol_s[0]);
return F_none;
}
#ifndef _di_status_code_process_normal_
f_status_t status_code_process_normal(const status_code_main_t main, const f_string_t value) {
+
f_number_unsigned_t number = 0;
f_status_t status = status_code_convert_number(main, value, &number);
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_data) {
- f_color_print(main.output.stream, main.context.set.error, "unknown code%c", f_string_eol_s[0]);
+ fll_print_format("%[unknown code%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "failed to convert%c", f_string_eol_s[0]);
+ fll_print_format("%[failed to convert%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
}
- printf("%s\n", string);
+ fll_print_format("%S%c", main.output.stream, string, f_string_eol_s[0]);
return F_none;
}
#ifndef _di_status_code_convert_number_
f_status_t status_code_convert_number(const status_code_main_t main, const f_string_t value, f_number_unsigned_t *number) {
+
const f_string_range_t range = macro_f_string_range_t_initialize(strlen(value));
f_status_t status = fl_conversion_string_to_number_unsigned(value, range, number);
if (*number > F_status_size_max_with_signal) {
- f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]);
+ fll_print_format("%[out of range%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
return status;
}
if (F_status_is_error(status)) {
if (F_status_set_fine(status) == F_number_negative) {
- f_color_print(main.output.stream, main.context.set.error, "out of range%c", f_string_eol_s[0]);
+ fll_print_format("%[out of range%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
else {
- f_color_print(main.output.stream, main.context.set.error, "invalid number%c", f_string_eol_s[0]);
+ fll_print_format("%[invalid number%]%c", main.output.stream, main.context.set.error, main.context.set.error, f_string_eol_s[0]);
}
return status;
#ifndef _di_status_code_print_help_
f_status_t status_code_print_help(const f_file_t output, const f_color_context_t context) {
+ flockfile(output.stream);
+
fll_program_print_help_header(output, context, status_code_name_long, status_code_version);
fll_program_print_help_option(output, context, f_console_standard_short_help_s, f_console_standard_long_help_s, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print this help message.");
fll_program_print_help_option(output, context, f_console_standard_short_debug_s, f_console_standard_long_debug_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Enable debugging, inceasing verbosity beyond normal output.");
fll_program_print_help_option(output, context, f_console_standard_short_version_s, f_console_standard_long_version_s, f_console_symbol_short_disable_s, f_console_symbol_long_disable_s, " Print only the version number.");
- fprintf(output.stream, "%c", f_string_eol_s[0]);
+ f_print_character(f_string_eol_s[0], output.stream);
fll_program_print_help_option(output, context, status_code_short_is_fine, status_code_long_is_fine, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, " Print F_true if the error code is not an error, F_false otherwise.");
fll_program_print_help_option(output, context, status_code_short_is_warning, status_code_long_is_warning, f_console_symbol_short_enable_s, f_console_symbol_long_enable_s, "Print F_true if the error code is a warning, F_false otherwise.");
fll_program_print_help_usage(output, context, status_code_name, "status code(s)");
+ funlockfile(output.stream);
+
return F_none;
}
#endif // _di_status_code_print_help_
if (main->context.set.error.before) {
main->error.context = main->context.set.error;
main->error.notable = main->context.set.notable;
+
+ main->warning.context = main->context.set.warning;
+ main->warning.notable = main->context.set.notable;
}
else {
- f_color_set_t *sets[] = { &main->error.context, &main->error.notable, 0 };
+ f_color_set_t *sets[] = { &main->error.context, &main->error.notable, &main->warning.context, &main->warning.notable, 0 };
fll_program_parameter_process_empty(&main->context, sets);
}
if (choice == status_code_parameter_verbosity_quiet) {
main->error.verbosity = f_console_verbosity_quiet;
+ main->warning.verbosity = f_console_verbosity_quiet;
}
else if (choice == status_code_parameter_verbosity_normal) {
main->error.verbosity = f_console_verbosity_normal;
+ main->warning.verbosity = f_console_verbosity_normal;
}
else if (choice == status_code_parameter_verbosity_verbose) {
main->error.verbosity = f_console_verbosity_verbose;
+ main->warning.verbosity = f_console_verbosity_verbose;
}
else if (choice == status_code_parameter_verbosity_debug) {
main->error.verbosity = f_console_verbosity_debug;
+ main->warning.verbosity = f_console_verbosity_debug;
}
}
if (main->parameters[status_code_parameter_is_error].result == f_console_result_found) {
if (main->parameters[status_code_parameter_is_warning].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
status_code_main_delete(main);
return F_status_set_error(status);
}
else if (main->parameters[status_code_parameter_is_fine].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_error);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_error, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
status_code_main_delete(main);
return F_status_set_error(status);
}
}
else if (main->parameters[status_code_parameter_is_warning].result == f_console_result_found && main->parameters[status_code_parameter_is_fine].result == f_console_result_found) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sThe parameter '", fll_error_print_error);
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_warning);
- f_color_print(main->error.to.stream, main->context.set.error, "' cannot be used with the parameter ");
- f_color_print(main->error.to.stream, main->context.set.notable, "%s%s", f_console_symbol_long_enable_s, status_code_long_is_fine);
- f_color_print(main->error.to.stream, main->context.set.error, ".%c", f_string_eol_s[0]);
+ flockfile(main->output.stream);
+
+ fl_print_format("%c%[%sThe parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_warning, main->error.notable);
+ fl_print_format("%[' cannot be used with the parameter '%]", main->error.to.stream, f_string_eol_s[0], main->error.context, main->error.prefix, main->error.context);
+ fl_print_format("%[%s%s%]", main->error.to.stream, main->error.notable, f_console_symbol_long_enable_s, status_code_long_is_fine, main->error.notable);
+ fl_print_format("%['.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
+
+ funlockfile(main->output.stream);
status_code_main_delete(main);
return F_status_set_error(status);
}
if (main->remaining.used == 0 && !main->process_pipe) {
- f_color_print(main->error.to.stream, main->context.set.error, "%sYou failed to specify a status code.%c", fll_error_print_error, f_string_eol_s[0]);
+ fll_print_format("%[You failed to specify a status code.%]%c", main->error.to.stream, main->error.context, main->error.context, f_string_eol_s[0]);
status_code_main_delete(main);
return F_status_set_error(F_parameter);
}
if (main->remaining.used > 0) {
+ flockfile(main->output.stream);
+
for (f_array_length_t i = 0; i < main->remaining.used; ++i) {
status2 = status_code_process_check(*main, arguments.argv[main->remaining.array[i]]);
status = status2;
}
} // for
+
+ funlockfile(main->output.stream);
}
}
else if (main->parameters[status_code_parameter_number].result == f_console_result_found) {
// fll-1 includes
#include <fll/level_1/console.h>
#include <fll/level_1/conversion.h>
+#include <fll/level_1/print.h>
#include <fll/level_1/status.h>
#include <fll/level_1/string.h>
// fll-2 includes
#include <fll/level_2/error.h>
+#include <fll/level_2/print.h>
#include <fll/level_2/program.h>
#include <fll/level_2/status.h>
f_file_t output;
fll_error_print_t error;
+ fll_error_print_t warning;
f_color_context_t context;
} status_code_main_t;
F_false, \
macro_f_file_t_initialize2(f_type_output, f_type_descriptor_output, f_file_flag_write_only), \
fll_error_print_t_initialize, \
+ macro_fll_error_print_t_initialize_warning(), \
f_color_context_t_initialize, \
}
#endif // _di_status_code_main_t_
f_print
fl_console
fl_conversion
+fl_print
fl_status
+fl_string
fll_error
+fll_print
fll_program
fll_status
build_indexer ar
build_language c
build_libraries -lc
-build_libraries-individual -lfll_error -lfll_program -lfll_status -lfl_console -lfl_conversion -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
+build_libraries-individual -lfll_error -lfll_print -lfll_program -lfll_status -lfl_console -lfl_conversion -lfl_print -lfl_status -lfl_string -lf_color -lf_console -lf_conversion -lf_file -lf_memory -lf_path -lf_pipe -lf_print -lf_string -lf_type_array -lf_utf
build_libraries-level -lfll_2 -lfll_1 -lfll_0
build_libraries-monolithic -lfll
build_sources_library status_code.c private-common.c private-status_code.c
defines_static
defines_shared
-flags_all -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
+flags_all -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-logical-op-parentheses -Wno-parentheses
flags_shared
flags_static
flags_library -fPIC