OSDN Git Service

* cygpath.cc (do_options): Allow outputflag combined with other
authorcorinna <corinna>
Tue, 29 May 2007 07:54:45 +0000 (07:54 +0000)
committercorinna <corinna>
Tue, 29 May 2007 07:54:45 +0000 (07:54 +0000)
basic flags.  Only check options_from_file_flag if reading options
from command line.
(main): Check for NULL argz vector.  Don't free argz vector prematurely.
Don't force flag combination in !options_from_file_flag case.

winsup/utils/ChangeLog
winsup/utils/cygpath.cc

index 6306a88..f92c0d7 100644 (file)
@@ -1,3 +1,11 @@
+2007-05-29  Corinna Vinschen  <corinna@vinschen.de>
+
+       * cygpath.cc (do_options): Allow outputflag combined with other
+       basic flags.  Only check options_from_file_flag if reading options
+       from command line.
+       (main): Check for NULL argz vector.  Don't free argz vector prematurely.
+       Don't force flag combination in !options_from_file_flag case.
+
 2007-05-23  Corinna Vinschen  <corinna@vinschen.de>
 
        * cygpath.cc: Include argz.h.
index e49efff..1f4588d 100644 (file)
@@ -894,12 +894,12 @@ do_options (int argc, char **argv, int from_file)
     }
 
   /* If none of the "important" flags are set, -u is default. */
-  if (!unix_flag && !windows_flag && !options_from_file_flag && !output_flag
-      && !mode_flag)
+  if (!unix_flag && !windows_flag && !mode_flag
+      && (!from_file ? !options_from_file_flag : 1))
     unix_flag = 1;
 
   /* Only one of ... */
-  if (unix_flag + windows_flag + output_flag + mode_flag > 1
+  if (unix_flag + windows_flag + mode_flag > 1
       + (!from_file ? options_from_file_flag : 0))
     usage (stderr, 1);
 
@@ -994,6 +994,8 @@ main (int argc, char **argv)
              perror ("cygpath");
              exit (1);
            }
+         if (!az)
+           continue;
          ac = argz_count (az, azl) + 1;
          av = (char **) malloc ((ac + 1) * sizeof (char *));
          if (!av)
@@ -1003,16 +1005,12 @@ main (int argc, char **argv)
            }
          av[0] = prog_name;
          argz_extract (az, azl, av + 1);
-         free (az);
          if (options_from_file_flag)
            o = do_options (ac, av, 1);
          else
-           {
-             optind = 1;
-             unix_flag = 1;
-             output_flag = mode_flag = windows_flag = 0;
-           }
+           optind = 1;
          action (ac, av, o);
+         free (az);
          free (av);
        }
     }