From aa192df7ccfa6dc1f3aa718e488bad477150b6f5 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Tue, 13 May 2025 11:26:49 +0200
Subject: [PATCH 3/4] treewide: add ul_ to parse_switch() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
---
 include/strutils.h   |  2 +-
 lib/strutils.c       |  4 ++--
 sys-utils/eject.c    |  4 ++--
 sys-utils/losetup.c  |  2 +-
 sys-utils/tunelp.c   |  8 ++++----
 term-utils/setterm.c | 24 ++++++++++++------------
 6 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/strutils.h b/include/strutils.h
index 7aaca5696..54f0e14da 100644
--- a/include/strutils.h
+++ b/include/strutils.h
@@ -68,7 +68,7 @@ extern int isxdigit_strend(const char *str, const char **end);
 #define isxdigit_string(_s)	isxdigit_strend(_s, NULL)
 
 
-extern int parse_switch(const char *arg, const char *errmesg, ...);
+extern int ul_parse_switch(const char *arg, const char *errmesg, ...);
 
 #ifndef HAVE_MEMPCPY
 extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);
diff --git a/lib/strutils.c b/lib/strutils.c
index 56a53fdbb..330489c41 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -247,9 +247,9 @@ int isxdigit_strend(const char *str, const char **end)
 }
 
 /*
- *  parse_switch(argv[i], "on", "off",  "yes", "no",  NULL);
+ *  ul_parse_switch(argv[i], "on", "off",  "yes", "no",  NULL);
  */
-int parse_switch(const char *arg, const char *errmesg, ...)
+int ul_parse_switch(const char *arg, const char *errmesg, ...)
 {
 	const char *a, *b;
 	va_list ap;
diff --git a/sys-utils/eject.c b/sys-utils/eject.c
index 310d6c3df..545642475 100644
--- a/sys-utils/eject.c
+++ b/sys-utils/eject.c
@@ -207,7 +207,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
 		switch (c) {
 		case 'a':
 			ctl->a_option = 1;
-			ctl->a_arg = parse_switch(optarg, _("argument error"),
+			ctl->a_arg = ul_parse_switch(optarg, _("argument error"),
 						"on", "off",  "1", "0",  NULL);
 			break;
 		case 'c':
@@ -229,7 +229,7 @@ static void parse_args(struct eject_control *ctl, int argc, char **argv)
 			break;
 		case 'i':
 			ctl->i_option = 1;
-			ctl->i_arg = parse_switch(optarg, _("argument error"),
+			ctl->i_arg = ul_parse_switch(optarg, _("argument error"),
 						"on", "off",  "1", "0",  NULL);
 			break;
 		case 'm':
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index eafab72f3..1f09df601 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -818,7 +818,7 @@ int main(int argc, char **argv)
 		case OPT_DIO:
 			use_dio = set_dio = 1;
 			if (optarg)
-				use_dio = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+				use_dio = ul_parse_switch(optarg, _("argument error"), "on", "off", NULL);
 			if (use_dio)
 				lo_flags |= LO_FLAGS_DIRECT_IO;
 			break;
diff --git a/sys-utils/tunelp.c b/sys-utils/tunelp.c
index 95a21b39e..9293ad581 100644
--- a/sys-utils/tunelp.c
+++ b/sys-utils/tunelp.c
@@ -189,24 +189,24 @@ int main(int argc, char **argv)
 			break;
 		case 'a':
 			cmds->op = LPABORT;
-			cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+			cmds->val = ul_parse_switch(optarg, _("argument error"), "on", "off", NULL);
 			cmds->next = xmalloc(sizeof(struct command));
 			cmds = cmds->next;
 			cmds->next = NULL;
 			break;
 		case 'q':
-			show_irq = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+			show_irq = ul_parse_switch(optarg, _("argument error"), "on", "off", NULL);
 			break;
 		case 'o':
 			cmds->op = LPABORTOPEN;
-			cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+			cmds->val = ul_parse_switch(optarg, _("argument error"), "on", "off", NULL);
 			cmds->next = xmalloc(sizeof(struct command));
 			cmds = cmds->next;
 			cmds->next = NULL;
 			break;
 		case 'C':
 			cmds->op = LPCAREFUL;
-			cmds->val = parse_switch(optarg, _("argument error"), "on", "off", NULL);
+			cmds->val = ul_parse_switch(optarg, _("argument error"), "on", "off", NULL);
 			cmds->next = xmalloc(sizeof(struct command));
 			cmds = cmds->next;
 			cmds->next = NULL;
diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index 801095c87..1941d0ca7 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -559,22 +559,22 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
 			break;
 		case OPT_CURSOR:
 			ctl->opt_cursor = set_opt_flag(ctl->opt_cursor);
-			ctl->opt_cu_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_cu_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_REPEAT:
 			ctl->opt_repeat = set_opt_flag(ctl->opt_repeat);
-			ctl->opt_rep_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_rep_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_APPCURSORKEYS:
 			ctl->opt_appcursorkeys = set_opt_flag(ctl->opt_appcursorkeys);
-			ctl->opt_appck_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_appck_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_LINEWRAP:
 			ctl->opt_linewrap = set_opt_flag(ctl->opt_linewrap);
-			ctl->opt_li_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_li_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_DEFAULT:
@@ -598,32 +598,32 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
 			break;
 		case OPT_INVERSESCREEN:
 			ctl->opt_inversescreen = set_opt_flag(ctl->opt_inversescreen);
-			ctl->opt_invsc_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_invsc_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_BOLD:
 			ctl->opt_bold = set_opt_flag(ctl->opt_bold);
-			ctl->opt_bo_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_bo_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_HALF_BRIGHT:
 			ctl->opt_halfbright = set_opt_flag(ctl->opt_halfbright);
-			ctl->opt_hb_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_hb_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_BLINK:
 			ctl->opt_blink = set_opt_flag(ctl->opt_blink);
-			ctl->opt_bl_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_bl_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_REVERSE:
 			ctl->opt_reverse = set_opt_flag(ctl->opt_reverse);
-			ctl->opt_re_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_re_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_UNDERLINE:
 			ctl->opt_underline = set_opt_flag(ctl->opt_underline);
-			ctl->opt_un_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_un_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_STORE:
@@ -632,7 +632,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
 		case OPT_CLEAR:
 			ctl->opt_clear = set_opt_flag(ctl->opt_clear);
 			if (optarg)
-				ctl->opt_cl_all = parse_switch(optarg, _("argument error"),
+				ctl->opt_cl_all = ul_parse_switch(optarg, _("argument error"),
 						"all", "rest", NULL);
 			else
 				ctl->opt_cl_all = 1;
@@ -667,7 +667,7 @@ static void parse_option(struct setterm_control *ctl, int ac, char **av)
 			break;
 		case OPT_MSG:
 			ctl->opt_msg = set_opt_flag(ctl->opt_msg);
-			ctl->opt_msg_on = parse_switch(optarg, _("argument error"),
+			ctl->opt_msg_on = ul_parse_switch(optarg, _("argument error"),
 						"on", "off", NULL);
 			break;
 		case OPT_MSGLEVEL:
-- 
2.48.1

