Re: [PATCH] Add get_current_dir_name(3)

2012-01-02 Thread Christopher Faylor
On Mon, Jan 02, 2012 at 05:56:26AM -0700, Eric Blake wrote: >On 01/01/2012 12:13 AM, Yaakov (Cygwin/X) wrote: >>> > You have to check st_dev here too don't you? >> Of course. Revised patch for winsup/cygwin attached. >> > >> +extern "C" char * >> +get_current_dir_name (void) >> +{ >> + char *pwd

Re: [PATCH] Add get_current_dir_name(3)

2012-01-02 Thread Eric Blake
On 01/01/2012 12:13 AM, Yaakov (Cygwin/X) wrote: >> > You have to check st_dev here too don't you? > Of course. Revised patch for winsup/cygwin attached. > > +extern "C" char * > +get_current_dir_name (void) > +{ > + char *pwd = getenv ("PWD"); > + char *cwd = getcwd (NULL, 0); > + > + if (pw

Re: [PATCH] Add get_current_dir_name(3)

2012-01-01 Thread Christopher Faylor
On Sun, Jan 01, 2012 at 01:13:25AM -0600, Yaakov (Cygwin/X) wrote: >On Sun, 2012-01-01 at 01:46 -0500, Christopher Faylor wrote: >> On Sat, Dec 31, 2011 at 08:45:07PM -0600, Yaakov (Cygwin/X) wrote: >> >+extern "C" char * >> >+get_current_dir_name (void) >> >+{ >> >+ char *pwd = getenv ("PWD"); >>

Re: [PATCH] Add get_current_dir_name(3)

2011-12-31 Thread Yaakov (Cygwin/X)
On Sun, 2012-01-01 at 01:46 -0500, Christopher Faylor wrote: > On Sat, Dec 31, 2011 at 08:45:07PM -0600, Yaakov (Cygwin/X) wrote: > >+extern "C" char * > >+get_current_dir_name (void) > >+{ > >+ char *pwd = getenv ("PWD"); > >+ char *cwd = getcwd (NULL, 0); > >+ > >+ if (pwd) > >+{ > >+

Re: [PATCH] Add get_current_dir_name(3)

2011-12-31 Thread Christopher Faylor
On Sat, Dec 31, 2011 at 08:45:07PM -0600, Yaakov (Cygwin/X) wrote: >This patchset adds get_current_dir_name(3), a GNU extension: >[snip] >diff -u -p -r1.644 path.cc >--- path.cc24 Dec 2011 13:11:34 - 1.644 >+++ path.cc27 Dec 2011 11:28:06 - >@@ -2855,6 +2855,27 @@ getwd (char *

[PATCH] Add get_current_dir_name(3)

2011-12-31 Thread Yaakov (Cygwin/X)
This patchset adds get_current_dir_name(3), a GNU extension: http://www.gnu.org/software/libc/manual/html_node/Working-Directory.html http://www.kernel.org/doc/man-pages/online/pages/man3/getcwd.3.html The test code will show the difference between get_current_dir_name() and getcwd(NULL, 0) when