/[mcrypt]/shash/src/extra.c
ViewVC logotype

Contents of /shash/src/extra.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Oct 4 22:45:21 2000 UTC (23 years, 5 months ago) by nmav
Branch point for: shash, MAIN
File MIME type: text/plain
Initial revision

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