Mail Archives: cygwin/2000/06/12/21:20:53
This is another attempt. It differs from my previous attempt in that
I've added a flag for the CYGWIN environment variable: liberal_path.
By default, it is off, giving the normal behavior of the current tree.
If set, the behavior described below is enabled: the equivalencing of
'\' with '/' as a posix path separator.
I _can't_ be the only user of cygwin running into the problem of
mixed directory separators in pathnames. And in the position that
remedying the source of mixed slashes is way more difficult than
modifying cygwin.
Problem:
At work we develop using cygwin. Some source is inhouse,
other comes from outside. Most source has "/" as the path
delimiter. However, some outside source has "\" in various
places (such as #include). Cygwin prior to 1.1 (b20 and 99r1)
handled this properly. Cygwin 1.1 and later don't; the "\"
forces interpretation as an MS-DOS path and the "/" aren't
properly translated. We don't want to edit files to convert
"\" to "/"; that is not acceptable.
Solution:
This change will treat a path as an MS-DOS path if one of two
conditions are true:
The path has a ":" character in it, or
The path has a "\" character and no "/" character and the
CYGWIN environment variable contains "liberal_path".
The previous test was if either ":" or "\" was present.
ChangeLog entry
2000-06-12 <munch AT powertv DOT com>
* path.cc (mount_info::conv_to_win32_path): if both '\' and '/' in
path then treat as posix path, not win, if "liberal_path" is true.
* environ.cc (parse_options): added "liberal_path" option to CYGWIN
variable.
Patch
cvs diff path.cc (in directory G:\cygnus\src\winsup\cygwin\)
Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.28
diff -r1.28 path.cc
84a85,86
> BOOL liberal_path = 0;
>
877a880
> BOOL parse_as_win32_path;
915,916c918,923
< circuit most of the rest of this function. */
< if (strpbrk (src_path, ":\\") != NULL)
---
> circuit most of the rest of this function. If liberal path is
> true, then allow \ as a path separator. */
> if (!(parse_as_win32_path = strchr (src_path, ':') != NULL))
> if ((parse_as_win32_path = strchr (src_path, '\\') != NULL) &&
liberal_path)
> parse_as_win32_path = strchr (src_path, '/') == NULL;
> if (parse_as_win32_path)
cvs diff environ.cc (in directory G:\cygnus\src\winsup\cygwin\)
Index: environ.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/environ.cc,v
retrieving revision 1.8
diff -r1.8 environ.cc
17a18
> extern BOOL liberal_path;
326a328
> {"liberal_path", {&liberal_path}, justset, NULL, {{FALSE}, {TRUE}}},
----------------------------
John Paulson
PowerTV, Inc.
Tel: 408/777-4769
Fax: 408/777-0176
mailto:paulson AT powertv DOT com
http://www.powertv.com/
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
- Raw text -