From 4a4ffd9379ad247f0a303aa58d297c93dce0adcd Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 9 Sep 2024 21:34:52 +0200 Subject: win32: convert command line to UTF-8 (refs #5) * Should prevent data loss due to system locale conversions when parsing command line arguments. * Should also fix passing Unicode arguments to munged macros and therefore opening files via ~/.teco_ini. * The entire option parsing is based on GStrv (null-terminated string lists) now, also on UNIX. --- src/string-utils.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/string-utils.h') diff --git a/src/string-utils.h b/src/string-utils.h index efc6fc5..bb9ed37 100644 --- a/src/string-utils.h +++ b/src/string-utils.h @@ -35,6 +35,16 @@ teco_ascii_toupper(gchar chr) return chr >= 'a' && chr <= 'z' ? chr & ~0x20 : chr; } +static inline gchar * +teco_strv_remove(gchar **strv, guint i) +{ + gchar *ret = strv[i]; + do + strv[i] = strv[i+1]; + while (strv[++i]); + return ret; +} + /** * An 8-bit clean null-terminated string. * -- cgit v1.2.3