From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23768 invoked by alias); 22 Apr 2002 20:40:08 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 23760 invoked from network); 22 Apr 2002 20:40:06 -0000 Received: from unknown (HELO mail3.home.nl) (213.51.129.227) by sources.redhat.com with SMTP; 22 Apr 2002 20:40:06 -0000 Received: from moolenaar.net ([212.120.77.84]) by mail3.home.nl (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20020422203818.LZND17620.mail3.home.nl@moolenaar.net>; Mon, 22 Apr 2002 22:38:18 +0200 Received: from masaka.moolenaar.net (localhost.moolenaar.net [127.0.0.1]) by moolenaar.net (8.11.6/8.11.1) with ESMTP id g3MKdvR03179; Mon, 22 Apr 2002 22:39:57 +0200 (CEST) (envelope-from Bram@moolenaar.net) Message-Id: <200204222039.g3MKdvR03179@moolenaar.net> To: Chris Metcalf cc: Corinna Vinschen , cygwin@cygwin.com, vim-dev@vim.org Subject: Re: small inter-operability patch for vim 6.1.2 for Cygwin In-Reply-To: From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Mon, 22 Apr 2002 13:48:00 -0000 X-SW-Source: 2002-04/txt/msg01235.txt.bz2 Chris Metcalf wrote: > On Mon, 22 Apr 2002, Bram Moolenaar wrote: > > > cygwin_conv_to_posix_path(const char *win_path, char *posix_path); > > > > That sounds like something we can use. But lacking the manual page it's > > a bit difficult to know exactly how to call it. Also, can this function > > be used when the path is already a "posix" path? Or do we need a test > > whether this function needs to be called (a backslash being present). > > (POSIX paths are passed through unchanged; I've attached the man page.) > > Corinna is right; this is cleaner than doing slash-modification by hand. > It also gives you the nice property that if you have used "mount" to map > DOS paths to Unix paths, you get the proper Unix path from the mountpoint, > not just a slash-converted path. > > Corinna expressed some concern about hacking up vim rather than using > existing tools to convert paths when needed. I think the reason that > modifying vim feels correct to me is that vim is something that is likely > to be called, standalone, from a variety of different contexts -- Cygwin > and non-Cygwin tools that have "edit" escapes of some kind -- and it > should Just Work in all of them. > > Additionally, it seems right to me that vim should be able to handle any > kind of path that is valid at the OS level. Most of the other Cygwin > tools do handle both Unix and DOS paths, though by and large simply > because they treat the paths as opaque character strings; vim is just a > more sophisticated filename consumer and therefore needs more care to > support the full range of path types. > > > Actually, it would help a lot if someone with Cygwin installed can look > > into this and test a few things. > > I'd be happy to be the guinea pig, certainly. I've attached yet > another possible patch. Thanks for making this patch. It looks OK to me, but it should be tested by a few people before I include this. I'll include the patch again in case some people didn't get it. > --- vim-6.1-2/src/main.c Sun Mar 24 06:05:17 2002 > +++ vim-6.1-2-build/src/main.c Mon Apr 22 15:32:30 2002 > @@ -22,6 +22,10 @@ > # include > #endif > > +#ifdef __CYGWIN__ > +# include > +#endif > + > #if defined(UNIX) || defined(VMS) > static int file_owned __ARGS((char *fname)); > #endif > @@ -971,6 +975,21 @@ > p = r; > } > } > #endif > +#ifdef __CYGWIN__ > + /* > + * If vim is invoked by non-Cygwin tools, convert away any > + * DOS paths, so things like .swp files are created correctly. > + * Look for evidence of non-Cygwin paths before we bother. > + */ > + if (strpbrk(p, "\\:") != NULL) { > + char posix_path[PATH_MAX]; > + cygwin_conv_to_posix_path(p, posix_path); > + vim_free(p); > + p = vim_strsave(posix_path); > + if (p == NULL) > + mch_exit(2); > + } > +#endif > alist_add(&global_alist, p, > #if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE) -- FIRST HEAD: All right! All right! We'll kill him first and then have tea and biscuits. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org /// -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/