Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-Id: <4.2.2.20000612181028.00b48990@mailhost> X-Sender: paulson AT mailhost X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2 Date: Mon, 12 Jun 2000 18:19:50 -0700 To: cygwin AT sourceware DOT cygnus DOT com From: John Paulson Subject: Patch for path.cc & environ.cc Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed 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 * 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