]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/clients/xzwrite/gethomedir.c
Initial revision
[1ts-debian.git] / zephyr / clients / xzwrite / gethomedir.c
1 #include <stdio.h>
2 #include <pwd.h>
3 #include "xzwrite.h"
4
5 char *get_home_dir()
6 {
7      struct passwd    *pwuid;
8      static char      *h = NULL;
9
10      if (h) return h;
11      
12      if ((h = getenv("HOME")) != NULL) return h;
13      
14      pwuid = getpwuid(getuid());
15      return (pwuid->pw_dir);
16 }