diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-05-29 11:54:45 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-05-29 11:54:45 +0400 |
commit | df1841c3106c0b5e475fcb22714f0f14d4120d67 (patch) | |
tree | 85568386e90a540695cc41f9ee2f84b960638d9f /winsup/utils/cygpath.cc | |
parent | 76a2ee78b6840b23c54cf9239027014e06ae3818 (diff) |
* 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.
Diffstat (limited to 'winsup/utils/cygpath.cc')
-rw-r--r-- | winsup/utils/cygpath.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc index e49efff22..1f4588da9 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -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); } } |