2 Copyright © 2008, The AROS Development Team. All rights reserved.
6 #include "__arosc_privdata.h"
8 #include <exec/types.h>
10 #include <proto/dos.h>
11 #include <aros/symbolsets.h>
15 #include <aros/debug.h>
17 /*****************************************************************************
28 Change the current working directory to the directory given as an open
32 fd - File descriptor of the directory to change to.
35 If the current directory was changed successfully, zero is returned.
36 Otherwise, -1 is returned and errno set apropriately.
39 At program exit, the current working directory will be changed back
40 to the one that was current when the program first started. If you
41 do not desire this behaviour, use dos.library/CurrentDir() instead.
51 ******************************************************************************/
57 if ( __get_default_file(fd
, (long*) &handle
) != 0 )
63 newlock
= DupLockFromFH(handle
);
67 errno
= IoErr2errno( IoErr() );
70 oldlock
= CurrentDir( newlock
);
72 if( __startup_cd_changed
)
78 __startup_cd_changed
= TRUE
;
79 __startup_cd_lock
= oldlock
;