]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
contrib/, lib/: Use strcaseprefix() instead of its pattern
authorAlejandro Colomar <alx@kernel.org>
Sat, 8 Feb 2025 10:02:37 +0000 (11:02 +0100)
committerSerge Hallyn <serge@hallyn.com>
Tue, 3 Jun 2025 01:08:57 +0000 (20:08 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
contrib/adduser.c
lib/yesno.c

index bca3883e2e57462fc93ad04736c41fdea20ef53d..9e162155f155a565dd42835d68213ccac9d7d228 100644 (file)
 #include <syslog.h>
 
 #include "string/strcmp/streq.h"
-#include "string/strcmp/strprefix.h"
+#include "string/strcmp/strcaseprefix.h"
 
 
 #define IMMEDIATE_CHANGE       /* Expire newly created password, must be changed
@@ -389,7 +389,7 @@ main (void)
       fflush (stdout);
       safeget (foo, sizeof (foo));
 
-      done = bad = correct = (strprefix(foo, "y") || strprefix(foo, "Y"));
+      done = bad = correct = strcaseprefix(foo, "y");
 
       if (bad != 1)
        printf ("\nUser [%s] not added\n", usrname);
index 27f156bca32c26a5371e8e10920d5d5009e9a18a..b37e41a9f7b7c3c4a67121ac78acf75cfa7d3a1f 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdlib.h>
 
 #include "prototypes.h"
-#include "string/strcmp/strprefix.h"
+#include "string/strcmp/strcaseprefix.h"
 
 
 /*
@@ -78,9 +78,9 @@ yes_or_no(bool read_only)
 static int
 rpmatch(const char *response)
 {
-       if (strprefix(response, "y") || strprefix(response, "Y"))
+       if (strcaseprefix(response, "y"))
                return 1;
-       if (strprefix(response, "n") || strprefix(response, "N"))
+       if (strcaseprefix(response, "n"))
                return 0;
 
        return -1;