]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
treewide: add ul_ to parse_switch() function name
authorKarel Zak <kzak@redhat.com>
Tue, 13 May 2025 09:26:49 +0000 (11:26 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 13 May 2025 09:26:49 +0000 (11:26 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/strutils.h
lib/strutils.c
sys-utils/eject.c
sys-utils/irqtop.c
sys-utils/losetup.c
sys-utils/tunelp.c
term-utils/setterm.c

index aab45fe4c51c84f55ff26b3a8209d4b9bd7436c3..a81fdea89eb5a26576d15596e32b85aec1e51fb7 100644 (file)
@@ -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, ...);
+extern int ul_parse_switch(const char *arg, ...);
 
 #ifndef HAVE_MEMPCPY
 extern void *mempcpy(void *restrict dest, const void *restrict src, size_t n);
index a0f0dc2243cd9ea7b31b4f527941a7fff8e64955..af538207a8f867a5f7113bf59459267c35769c6c 100644 (file)
@@ -247,9 +247,9 @@ int isxdigit_strend(const char *str, const char **end)
 }
 
 /*
- *  For example: parse_switch(argv[i], "on", "off",  "yes", "no",  NULL);
+ *  For example: ul_parse_switch(argv[i], "on", "off",  "yes", "no",  NULL);
  */
-int parse_switch(const char *arg, ...)
+int ul_parse_switch(const char *arg, ...)
 {
        const char *a, *b;
        va_list ap;
@@ -1407,7 +1407,7 @@ int main(int argc, char *argv[])
                return test_strutils_sizes(argc - 1, argv + 1);
 
        } else if (argc == 3 && strcmp(argv[1], "--parse-switch") == 0) {
-               printf("'%s'-->%d\n", argv[2], parse_switch(argv[2],
+               printf("'%s'-->%d\n", argv[2], ul_parse_switch(argv[2],
                                                "on", "off",
                                                "enable", "disable",
                                                "yes", "no",
index d01cde719182f09fef924ee026770f9c8d9ab922..dad88978d1e4e6a3ae06bd8a668879c896d4bdb2 100644 (file)
@@ -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, "on", "off",  "1", "0",  NULL);
+                       ctl->a_arg = ul_parse_switch(optarg, "on", "off",  "1", "0",  NULL);
                        break;
                case 'c':
                        ctl->c_option = 1;
@@ -228,7 +228,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, "on", "off",  "1", "0",  NULL);
+                       ctl->i_arg = ul_parse_switch(optarg, "on", "off",  "1", "0",  NULL);
                        break;
                case 'm':
                        ctl->m_option = 1;
index ccd20dbc9f65bbf621798e53e30a3977374cca14..d0b331119130f927d7e7920ef9daf7df4988cb1d 100644 (file)
@@ -365,7 +365,7 @@ static void parse_args(     struct irqtop_ctl *ctl,
                        if (!strcmp(optarg, "auto"))
                                ctl->cpustat_mode = IRQTOP_CPUSTAT_AUTO;
                        else
-                               ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE - parse_switch(optarg,
+                               ctl->cpustat_mode = IRQTOP_CPUSTAT_DISABLE - ul_parse_switch(optarg,
                                                        "always", "never", "enable", "disable",
                                                        "on", "off", "yes", "no", "1", "0", NULL);
                        break;
index 2840586a84bea50647dd57a2e022d276a2cb5c59..1a66173865ca8b0f81e4b2071d3a177fd306f2c3 100644 (file)
@@ -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, "on", "off", NULL);
+                               use_dio = ul_parse_switch(optarg, "on", "off", NULL);
                        if (use_dio)
                                lo_flags |= LO_FLAGS_DIRECT_IO;
                        break;
index 51442d59576bbcd36a83ccb228652d8aafb9b034..2201f81ce36f15ccf56e1a191cba33bc8ae362d4 100644 (file)
@@ -189,24 +189,24 @@ int main(int argc, char **argv)
                        break;
                case 'a':
                        cmds->op = LPABORT;
-                       cmds->val = parse_switch(optarg, "on", "off", NULL);
+                       cmds->val = ul_parse_switch(optarg, "on", "off", NULL);
                        cmds->next = xmalloc(sizeof(struct command));
                        cmds = cmds->next;
                        cmds->next = NULL;
                        break;
                case 'q':
-                       show_irq = parse_switch(optarg, "on", "off", NULL);
+                       show_irq = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case 'o':
                        cmds->op = LPABORTOPEN;
-                       cmds->val = parse_switch(optarg, "on", "off", NULL);
+                       cmds->val = ul_parse_switch(optarg, "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, "on", "off", NULL);
+                       cmds->val = ul_parse_switch(optarg, "on", "off", NULL);
                        cmds->next = xmalloc(sizeof(struct command));
                        cmds = cmds->next;
                        cmds->next = NULL;
index 886ff78fc628f0fe4bacf5a68e876e13c1ea541f..a9df5cb602a3983298dbacb9e536a4a15d811b18 100644 (file)
@@ -559,19 +559,19 @@ 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,"on", "off", NULL);
+                       ctl->opt_cu_on = ul_parse_switch(optarg,"on", "off", NULL);
                        break;
                case OPT_REPEAT:
                        ctl->opt_repeat = set_opt_flag(ctl->opt_repeat);
-                       ctl->opt_rep_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_rep_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_APPCURSORKEYS:
                        ctl->opt_appcursorkeys = set_opt_flag(ctl->opt_appcursorkeys);
-                       ctl->opt_appck_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_appck_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_LINEWRAP:
                        ctl->opt_linewrap = set_opt_flag(ctl->opt_linewrap);
-                       ctl->opt_li_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_li_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_DEFAULT:
                        ctl->opt_default = set_opt_flag(ctl->opt_default);
@@ -594,27 +594,27 @@ 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, "on", "off", NULL);
+                       ctl->opt_invsc_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_BOLD:
                        ctl->opt_bold = set_opt_flag(ctl->opt_bold);
-                       ctl->opt_bo_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_bo_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_HALF_BRIGHT:
                        ctl->opt_halfbright = set_opt_flag(ctl->opt_halfbright);
-                       ctl->opt_hb_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_hb_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_BLINK:
                        ctl->opt_blink = set_opt_flag(ctl->opt_blink);
-                       ctl->opt_bl_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_bl_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_REVERSE:
                        ctl->opt_reverse = set_opt_flag(ctl->opt_reverse);
-                       ctl->opt_re_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_re_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_UNDERLINE:
                        ctl->opt_underline = set_opt_flag(ctl->opt_underline);
-                       ctl->opt_un_on = parse_switch(optarg, "on", "off", NULL);
+                       ctl->opt_un_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_STORE:
                        ctl->opt_store = set_opt_flag(ctl->opt_store);
@@ -622,7 +622,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, "all", "rest", NULL);
+                               ctl->opt_cl_all = ul_parse_switch(optarg, "all", "rest", NULL);
                        else
                                ctl->opt_cl_all = 1;
                        break;
@@ -656,7 +656,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, "on", "off", NULL);
+                       ctl->opt_msg_on = ul_parse_switch(optarg, "on", "off", NULL);
                        break;
                case OPT_MSGLEVEL:
                        ctl->opt_msglevel = set_opt_flag(ctl->opt_msglevel);