Commit | Line | Data |
---|---|---|
a9bc1243 | 1 | /* |
4c94c20c | 2 | char id_chdir[] = "@(#)chdir_.c 1.3"; |
a9bc1243 DW |
3 | * |
4 | * change default directory | |
5 | * | |
6 | * calling sequence: | |
7 | * integer chdir | |
8 | * ierror = chdir(dirname) | |
9 | * where: | |
10 | * ierror will receive a returned status (0 == OK) | |
11 | * dirname is the directory name | |
12 | */ | |
13 | ||
14 | #include "../libI77/f_errno.h" | |
4c94c20c DW |
15 | #include <sys/param.h> |
16 | #ifndef MAXPATHLEN | |
17 | #define MAXPATHLEN 128 | |
18 | #endif | |
a9bc1243 DW |
19 | |
20 | long chdir_(dname, dnamlen) | |
21 | char *dname; | |
22 | long dnamlen; | |
23 | { | |
4c94c20c | 24 | char buf[MAXPATHLEN]; |
a9bc1243 | 25 | |
e5366c12 | 26 | if (dnamlen >= sizeof buf) |
a9bc1243 | 27 | return((long)(errno=F_ERARG)); |
e5366c12 | 28 | g_char(dname, dnamlen, buf); |
a9bc1243 DW |
29 | if (chdir(buf) != 0) |
30 | return((long)errno); | |
31 | return(0L); | |
32 | } |