summaryrefslogtreecommitdiff
path: root/ghc/runtime/io/setCurrentDirectory.lc
blob: 96fdf59fa9bb85d069834f0fc27b81c8fe36d7bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
%
% (c) The GRASP/AQUA Project, Glasgow University, 1995
%
\subsection[setCurrentDirectory.lc]{setCurrentDirectory Runtime Support}

\begin{code}

#include "rtsdefs.h"
#include "stgio.h"

StgInt
setCurrentDirectory(path)
StgByteArray path;
{
    while (chdir(path) != 0) {
	if (errno != EINTR) {
	    cvtErrno();
	    stdErrno();
	    return -1;
	}
    }
    return 0;
}

\end{code}