Index: winsup/utils/cygpath.cc =================================================================== RCS file: /cvs/src/src/winsup/utils/cygpath.cc,v retrieving revision 1.25 diff -u -p -r1.25 cygpath.cc --- winsup/utils/cygpath.cc 31 Oct 2002 02:40:26 -0000 1.25 +++ winsup/utils/cygpath.cc 12 Feb 2003 01:00:16 -0000 @@ -29,6 +29,7 @@ static int path_flag, unix_flag, windows static int shortname_flag, longname_flag; static int ignore_flag, allusers_flag, output_flag; static int mixed_flag; +static int ensure_flag; static const char *format_type_arg; static struct option long_options[] = { @@ -53,10 +54,11 @@ static struct option long_options[] = { {(char *) "smprograms", no_argument, NULL, 'P'}, {(char *) "sysdir", no_argument, NULL, 'S'}, {(char *) "windir", no_argument, NULL, 'W'}, + {(char *) "ensure", no_argument, NULL, 'e'}, {0, no_argument, 0, 0} }; -static char options[] = "ac:df:hilmopst:uvwADHPSW"; +static char options[] = "ac:df:hilmopst:uvwADHPSWe"; static void usage (FILE * stream, int status) @@ -76,6 +78,7 @@ Path conversion options:\n\ -l, --long-name print Windows long form of NAME (with -w, -m only)\n\ -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\ -s, --short-name print DOS (short) form of NAME (with -w, -m only)\n\ + -e, --ensure ensure the path is in the right format (with -p only)\n\ System information:\n\ -A, --allusers use `All Users' instead of current user for -D, -P\n\ -D, --desktop output `Desktop' directory and exit\n\ @@ -411,6 +414,27 @@ doit (char *filename) int retval; int (*conv_func) (const char *, char *); + if (ensure_flag && path_flag) + { + if (cygwin_posix_path_list_p (filename) ? unix_flag : windows_flag) + { + if (windows_flag) + { + buf = filename; + if (shortname_flag) + buf = get_short_paths (buf); + if (longname_flag) + buf = get_long_paths (buf); + if (mixed_flag) + buf = get_mixed_name (buf); + filename = buf; + } + /* The path is already in the right format. */ + puts (filename); + exit (0); + } + } + if (!path_flag) { len = strlen (filename); @@ -518,6 +542,7 @@ main (int argc, char **argv) else prog_name++; + ensure_flag = 0; path_flag = 0; unix_flag = 1; windows_flag = 0; @@ -561,6 +586,10 @@ main (int argc, char **argv) path_flag = 1; break; + case 'e': + ensure_flag = 1; + break; + case 'u': if (windows_flag || mixed_flag) usage (stderr, 1); @@ -665,6 +694,9 @@ main (int argc, char **argv) if (shortname_flag && !windows_flag) usage (stderr, 1); + if (ensure_flag && !path_flag) + usage (stderr, 1); + if (!unix_flag && !windows_flag && !mixed_flag && !options_from_file_flag) usage (stderr, 1); @@ -741,6 +773,9 @@ main (int argc, char **argv) break; case 'p': path_flag = 1; + break; + case 'e': + ensure_flag = 1; break; case 'D': case 'H':