[m-rev.] for review: add dir.current_directory

Peter Wang novalazy at gmail.com
Wed Sep 19 19:43:37 AEST 2007


On 2007-09-19, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
> 
>  On Wed, 19 Sep 2007, Peter Wang wrote:
> 
> > +:- pragma foreign_proc("C",
> > +    dir.current_directory(Res::out, IO0::di, IO::uo),
> > +    [may_call_mercury, promise_pure, tabled_for_io, terminates],
> > +"
> > +    size_t      size = 256;
> > +    char        *buf;
> > +    MR_String   str;
> > +
> > +    while (1) {
> > +        buf = MR_GC_NEW_ARRAY(char, size);
> > +        if (getcwd(buf, size)) {
> 
>  Is getcwd() available on all systems?

man page says: getcwd() conforms to POSIX.1-2001.  Cygwin surely has it,
mingw has it, and MSVC seems to have it too.

Peter

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list