1: /* $Header$ */
   2: 
   3: /*
   4:  * Author: Peter J. Nicklin
   5:  */
   6: 
   7: /*
   8:  * getpwdir() searchs from the beginning of the passwd file until a
   9:  * matching home directory is found. If found, a pointer is returned
  10:  * to a passwd struct, otherwise NULL.
  11:  */
  12: #include <pwd.h>
  13: #include "macro.h"
  14: #include "null.h"
  15: 
  16: struct passwd *
  17: getpwdir(dir)
  18:     char *dir;          /* directory to be matched */
  19: {
  20:     register struct passwd *pw; /* pointer to current passwd entry */
  21:     int endpwent();         /* close passwd file */
  22:     struct passwd *getpwent();  /* get next passwd entry */
  23: 
  24:     for (;;)
  25:         {
  26:         if ((pw = getpwent()) == NULL)
  27:             break;
  28:         if (EQUAL(dir, pw->pw_dir))
  29:             break;
  30:         }
  31:     endpwent();
  32:     return(pw);
  33: }

Defined functions

getpwdir defined in line 16; used 2 times
Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 595
Valid CSS Valid XHTML 1.0 Strict