change strncasecmp() == 0 to STRCASEEQLEN()
[libguestfs.git] / fish / fish.c
index 9a89f55..3f534de 100644 (file)
@@ -215,9 +215,9 @@ main (int argc, char *argv[])
 
     switch (c) {
     case 0:                    /* options which are long only */
-      if (strcmp (long_options[option_index].name, "listen") == 0)
+      if (STREQ (long_options[option_index].name, "listen"))
         remote_control_listen = 1;
-      else if (strcmp (long_options[option_index].name, "remote") == 0) {
+      else if (STREQ (long_options[option_index].name, "remote")) {
         if (optarg) {
           if (sscanf (optarg, "%d", &remote_control) != 1) {
             fprintf (stderr, _("%s: --listen=PID: PID was not a number: %s\n"),
@@ -233,7 +233,7 @@ main (int argc, char *argv[])
             exit (1);
           }
         }
-      } else if (strcmp (long_options[option_index].name, "selinux") == 0) {
+      } else if (STREQ (long_options[option_index].name, "selinux")) {
         guestfs_set_selinux (g, 1);
       } else {
         fprintf (stderr, _("%s: unknown long option: %s (%d)\n"),
@@ -755,14 +755,14 @@ cmdline (char *argv[], int optind, int argc)
   if (optind >= argc) return;
 
   cmd = argv[optind++];
-  if (strcmp (cmd, ":") == 0) {
+  if (STREQ (cmd, ":")) {
     fprintf (stderr, _("%s: empty command on command line\n"), program_name);
     exit (1);
   }
   params = &argv[optind];
 
   /* Search for end of command list or ":" ... */
-  while (optind < argc && strcmp (argv[optind], ":") != 0)
+  while (optind < argc && STRNEQ (argv[optind], ":"))
     optind++;
 
   if (optind == argc) {
@@ -1107,11 +1107,11 @@ int
 is_true (const char *str)
 {
   return
-    strcasecmp (str, "0") != 0 &&
-    strcasecmp (str, "f") != 0 &&
-    strcasecmp (str, "false") != 0 &&
-    strcasecmp (str, "n") != 0 &&
-    strcasecmp (str, "no") != 0;
+    STRCASENEQ (str, "0") &&
+    STRCASENEQ (str, "f") &&
+    STRCASENEQ (str, "false") &&
+    STRCASENEQ (str, "n") &&
+    STRCASENEQ (str, "no");
 }
 
 /* Free strings from a non-NULL terminated char** */
@@ -1340,7 +1340,7 @@ resolve_win_path (const char *path)
   char *ret;
   size_t i;
 
-  if (strncasecmp (path, "win:", 4) != 0) {
+  if (STRCASENEQLEN (path, "win:", 4)) {
     ret = strdup (path);
     if (ret == NULL)
       perror ("strdup");
@@ -1350,7 +1350,7 @@ resolve_win_path (const char *path)
   path += 4;
 
   /* Drop drive letter, if it's "C:". */
-  if (strncasecmp (path, "c:", 2) == 0)
+  if (STRCASEEQLEN (path, "c:", 2))
     path += 2;
 
   if (!*path) {