"Fossies" - the Fresh Open Source Software Archive

Member "netbiff-0.9.18/home.c" (21 Sep 2003, 360 Bytes) of package /linux/privat/old/netbiff-0.9.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #include "home.h"
    2 #include "xlib.h"
    3 
    4 #include <stdlib.h>
    5 #include <pwd.h>
    6 #include <unistd.h>
    7 #include <sys/types.h>
    8 
    9 static const char *home;
   10 
   11 const char* find_home() {
   12   struct passwd *pwinfo;
   13   
   14   if(!home)
   15     home = getenv("HOME");
   16 
   17   if(!home) {
   18     pwinfo = getpwuid(getuid());
   19     if(pwinfo)
   20       home = xstrdup(pwinfo->pw_dir);
   21   }
   22 
   23   return home;
   24 }