From eece9692d707ccb20356ec06955f8308c4e59ca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 17 Dec 2023 14:18:48 +0100 Subject: New upstream version 4.19 --- src/tc-realpath.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/tc-realpath.c') diff --git a/src/tc-realpath.c b/src/tc-realpath.c index 23609ca..b71c127 100644 --- a/src/tc-realpath.c +++ b/src/tc-realpath.c @@ -8,6 +8,7 @@ #include #include #include +#include "internal.h" static unsigned int rp_flags; static unsigned int rp_absolute; @@ -24,9 +25,9 @@ static const struct HXoption rp_option_table[] = { HXOPT_TABLEEND, }; -static bool rp_get_options(int *argc, const char ***argv) +static bool rp_get_options(char **oargv, int *argc, char ***argv) { - if (HX_getopt(rp_option_table, argc, argv, HXOPT_USAGEONERR) != + if (HX_getopt5(rp_option_table, oargv, argc, argv, HXOPT_USAGEONERR) != HXOPT_ERR_SUCCESS) return false; rp_flags = HX_REALPATH_DEFAULT; @@ -47,18 +48,19 @@ static void t_1(void) HXmc_free(tmp); } -int main(int argc, const char **argv) +int main(int argc, char **oargv) { + char **argv = nullptr; hxmc_t *res; int ret; - if (!rp_get_options(&argc, &argv)) + if (!rp_get_options(oargv, &argc, &argv)) return EXIT_FAILURE; t_1(); res = NULL; - while (--argc > 0) { - ret = HX_realpath(&res, *++argv, rp_flags); + for (int i = 1; i < argc; ++i) { + ret = HX_realpath(&res, argv[argc], rp_flags); if (ret < 0) { perror("HX_realpath"); printf("\n"); @@ -66,5 +68,6 @@ int main(int argc, const char **argv) printf("%s\n", res); } } + HX_zvecfree(argv); return EXIT_SUCCESS; } -- cgit v1.2.3