comparison src/dir.c @ 0:6ee11bf9e3ea

Initial revision
author jcid
date Sun, 07 Oct 2007 00:36:34 +0200
parents
children d9e7b35430de
comparison
equal deleted inserted replaced
-1:000000000000 0:6ee11bf9e3ea
1 /*
2 * File: dir.c
3 *
4 * Copyright 2006 Jorge Arellano Cid <jcid@dillo.org>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 */
11
12 #include <unistd.h>
13
14 #include "../dlib/dlib.h"
15
16
17 /*
18 * Local data
19 */
20 /* Dillo works from an unmounted directory (/tmp). */
21 static char *OldWorkingDirectory = NULL;
22
23 /*
24 * Change current working directory to "/tmp".
25 */
26 void a_Dir_init(void)
27 {
28 dFree(OldWorkingDirectory);
29 OldWorkingDirectory = dGetcwd();
30 chdir("/tmp");
31 }
32
33 /*
34 * Return the initial current working directory in a string.
35 */
36 char *a_Dir_get_owd(void)
37 {
38 return OldWorkingDirectory;
39 }
40
41 /*
42 * Free memory
43 */
44 void a_Dir_free(void)
45 {
46 dFree(OldWorkingDirectory);
47 }
48