Parent Directory | Revision Log
Initial revision
1 | nmav | 1.1 | #include <defines.h> |
2 | |||
3 | #ifdef HAVE_STAT | ||
4 | |||
5 | int check_file(char *filename) | ||
6 | { | ||
7 | struct stat ostat; | ||
8 | |||
9 | if (stat(filename, &ostat) == 0) { | ||
10 | return 1; /* exists */ | ||
11 | } else { | ||
12 | return 0; /* no */ | ||
13 | } | ||
14 | |||
15 | |||
16 | } | ||
17 | |||
18 | |||
19 | #endif | ||
20 | |||
21 | #ifdef HAVE_GETPWUID | ||
22 | char *get_cfile(int uid, char *cfile) | ||
23 | { | ||
24 | |||
25 | char *home; | ||
26 | struct passwd *pwd; | ||
27 | |||
28 | pwd = getpwuid(uid); | ||
29 | home = malloc(strlen(pwd->pw_dir) + strlen(cfile) + 2); | ||
30 | if (pwd != NULL) { | ||
31 | strcpy(home, pwd->pw_dir); | ||
32 | } | ||
33 | strcat(home, "/"); | ||
34 | strcat(home, cfile); | ||
35 | |||
36 | return home; | ||
37 | |||
38 | } | ||
39 | #endif |
webmaster@linux.gr | ViewVC Help |
Powered by ViewVC 1.1.26 |