From ce56eacafeb0a8585e62dd404b2f68d33c4d5f18 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Sat, 2 May 2026 14:30:27 +0100 Subject: [PATCH] cmd: update string api usage --- cmd/arglist.c | 6 +++--- cmd/command.c | 16 ++++++++-------- cmd/report.c | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cmd/arglist.c b/cmd/arglist.c index d396e68..bcd7aac 100644 --- a/cmd/arglist.c +++ b/cmd/arglist.c @@ -322,8 +322,8 @@ static fx_status parse_short_opt(struct argv_parser *parser) parser->cmd, NULL, parser->arglist); fx_err("unrecognised argument '" F_YELLOW "-%c" F_RESET "'\n\n", - flag, fx_string_ptr(usage)); - fx_i("usage: %s", fx_string_ptr(usage)); + flag, fx_string_get_cstr(usage)); + fx_i("usage: %s", fx_string_get_cstr(usage)); fx_i("for more information, use '" F_YELLOW "--help" F_RESET "'\n"); fx_string_unref(usage); @@ -452,7 +452,7 @@ static fx_status parse_long_opt(struct argv_parser *parser) fx_err("unrecognised argument '" F_YELLOW "--%s" F_RESET "'\n\nusage: %s\n\nfor more information, use '" F_YELLOW "--help" F_RESET "'\n", - opt_name, fx_string_ptr(usage)); + opt_name, fx_string_get_cstr(usage)); fx_string_unref(usage); return FX_ERR_NO_ENTRY; diff --git a/cmd/command.c b/cmd/command.c index b080266..626de2d 100644 --- a/cmd/command.c +++ b/cmd/command.c @@ -631,7 +631,7 @@ static void print_options_list(struct fx_command *cmd) } fx_tty_puts(OUTPUT_STREAM, 0, " "); - fx_tty_puts(OUTPUT_STREAM, 0, fx_string_ptr(opt_str)); + fx_tty_puts(OUTPUT_STREAM, 0, fx_string_get_cstr(opt_str)); if (new_paragraph) { format.p_flags = 0; @@ -650,7 +650,7 @@ static void print_options_list(struct fx_command *cmd) len++; } - fx_print_paragraph(fx_string_ptr(desc_str), OUTPUT_STREAM, &format); + fx_print_paragraph(fx_string_get_cstr(desc_str), OUTPUT_STREAM, &format); if (new_paragraph) { fx_tty_putc(OUTPUT_STREAM, 0, '\n'); @@ -704,7 +704,7 @@ static void print_args_list(struct fx_command *cmd) z__fx_get_arg_usage_string(arg, true, str); fx_tty_puts(OUTPUT_STREAM, 0, " "); - fx_tty_puts(OUTPUT_STREAM, 0, fx_string_ptr(str)); + fx_tty_puts(OUTPUT_STREAM, 0, fx_string_get_cstr(str)); unsigned int len = fx_string_get_size( str, FX_STRLEN_IGNORE_ESC | FX_STRLEN_IGNORE_MOD) @@ -717,7 +717,7 @@ static void print_args_list(struct fx_command *cmd) fx_string_clear(str); z__fx_get_arg_description(arg, str); - fx_print_paragraph(fx_string_ptr(str), OUTPUT_STREAM, &format); + fx_print_paragraph(fx_string_get_cstr(str), OUTPUT_STREAM, &format); entry = fx_queue_next(entry); } @@ -764,7 +764,7 @@ static void print_commands_list(struct fx_command *cmd) get_command_string(sub, str); fx_tty_puts(OUTPUT_STREAM, 0, " "); - fx_tty_puts(OUTPUT_STREAM, 0, fx_string_ptr(str)); + fx_tty_puts(OUTPUT_STREAM, 0, fx_string_get_cstr(str)); unsigned int len = fx_string_get_size( str, FX_STRLEN_IGNORE_ESC | FX_STRLEN_IGNORE_MOD) @@ -777,7 +777,7 @@ static void print_commands_list(struct fx_command *cmd) fx_string_clear(str); get_command_description(sub, str); - fx_print_paragraph(fx_string_ptr(str), OUTPUT_STREAM, &format); + fx_print_paragraph(fx_string_get_cstr(str), OUTPUT_STREAM, &format); entry = fx_queue_next(entry); } @@ -941,7 +941,7 @@ static void print_usage(struct fx_command *cmd, struct fx_arglist *args) if (fx_queue_empty(&cmd->c_usage)) { fx_string *usage = z__fx_command_default_usage_string(cmd, NULL, args); - fx_print_paragraph(fx_string_ptr(usage), OUTPUT_STREAM, &format); + fx_print_paragraph(fx_string_get_cstr(usage), OUTPUT_STREAM, &format); fx_string_unref(usage); return; } @@ -954,7 +954,7 @@ static void print_usage(struct fx_command *cmd, struct fx_arglist *args) fx_string_clear(str); get_usage_string(cmd, args, usage, str); - fx_print_paragraph(fx_string_ptr(str), OUTPUT_STREAM, &format); + fx_print_paragraph(fx_string_get_cstr(str), OUTPUT_STREAM, &format); entry = fx_queue_next(entry); } diff --git a/cmd/report.c b/cmd/report.c index 3c7bbfe..15cd182 100644 --- a/cmd/report.c +++ b/cmd/report.c @@ -45,7 +45,7 @@ enum fx_status fx_arglist_report_missing_option( fx_err("required option `" F_YELLOW "%s" F_RESET "` was not specified.", fx_stringstream_ptr(opt_name)); - fx_i("usage: %s", fx_string_ptr(opt_string)); + fx_i("usage: %s", fx_string_get_cstr(opt_string)); fx_i("for more information, use `" F_YELLOW "--help" F_RESET "`"); fx_string_unref(opt_string); @@ -61,7 +61,7 @@ enum fx_status fx_arglist_report_unexpected_arg( args->list_command, NULL, args); fx_err("unexpected argument '" F_YELLOW "%s" F_RESET "' found.", value); - fx_i("usage: %s", fx_string_ptr(usage)); + fx_i("usage: %s", fx_string_get_cstr(usage)); fx_i("for more information, use '" F_YELLOW "--help" F_RESET "'"); return FX_SUCCESS; @@ -95,16 +95,16 @@ enum fx_status fx_arglist_report_invalid_arg_value( fx_err("invalid value '" F_YELLOW "%s" F_RESET "' for '" F_YELLOW "%s" F_RESET "'.", - value, fx_string_ptr(opt_string)); + value, fx_string_get_cstr(opt_string)); if (opt) { fx_i("'" F_YELLOW "%s" F_RESET "' accepts the following values for '" F_YELLOW "%s" F_RESET "':", - fx_string_ptr(opt_string), arg->arg_name); + fx_string_get_cstr(opt_string), arg->arg_name); } else { fx_i("'" F_YELLOW "%s" F_RESET "' accepts the following values:", - fx_string_ptr(opt_string)); + fx_string_get_cstr(opt_string)); } for (int i = 0; arg->arg_allowed_values[i]; i++) { @@ -114,7 +114,7 @@ enum fx_status fx_arglist_report_invalid_arg_value( } fx_printf("\n"); - fx_i("usage: %s", fx_string_ptr(usage)); + fx_i("usage: %s", fx_string_get_cstr(usage)); fx_i("for more information, use '" F_YELLOW "--help" F_RESET); fx_string_unref(usage); @@ -183,9 +183,9 @@ enum fx_status fx_arglist_report_missing_args( fx_err("argument `" F_YELLOW "%s" F_RESET "` requires " F_GREEN_BOLD "%s" F_RESET " `" F_YELLOW "%s" F_RESET "` value%s, but %s.", - fx_string_ptr(opt_string), required_arg_count, arg->arg_name, + fx_string_get_cstr(opt_string), required_arg_count, arg->arg_name, (arg->arg_nr_values == 1) ? "" : "s", supplied_arg_str); - fx_i("usage: %s", fx_string_ptr(usage)); + fx_i("usage: %s", fx_string_get_cstr(usage)); fx_i("for more information, use '" F_YELLOW "--help" F_RESET "'"); fx_string_unref(usage);