www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D.gnu - getcwd from file.d under AIX

↑ ↓ ← John Gibbons <JohnAGibbons bigpond.com> writes:
First let me thank David Friedman for the AIX port of gdc.

I have encountered a minor problem in the phobos library on AIX. AIX 
doesn't allow the size  parameter to be 0 for getcwd, it returns an 
EINVAL error.

Currently file.d contains the line
	
	p = unix.getcwd(null, 0);

For my own needs I have just hacked this to replace 0 by 1024,  but it 
probably should be a loop (pardon my limited D)

   for (bsz = 1024; (p = unix.getcwd(0, bsz)) == null; bsz += 1024) {
     if (getErrno() != ERANGE)
       break;
   }
Jun 28 2005
↑ ↓ → Brad Beveridge <brad somewhere.net> writes:
John Gibbons wrote:
 First let me thank David Friedman for the AIX port of gdc.
 
 I have encountered a minor problem in the phobos library on AIX. AIX 
 doesn't allow the size  parameter to be 0 for getcwd, it returns an 
 EINVAL error.
 
 Currently file.d contains the line
     
     p = unix.getcwd(null, 0);
 
 For my own needs I have just hacked this to replace 0 by 1024,  but it 
 probably should be a loop (pardon my limited D)
 
   for (bsz = 1024; (p = unix.getcwd(0, bsz)) == null; bsz += 1024) {
     if (getErrno() != ERANGE)
       break;
   }

current path is > 1024. for (....) { if (...) break; free(p); } Brad
Jun 28 2005