home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / SMAILSRC.ZIP / PASSWD.ZIP / PW_OPEN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-03  |  742 b   |  32 lines

  1. /*
  2.  *      pw_open.c: Open a password file
  3.  *
  4.  *      Stephen C. Trier
  5.  *      March 26, 1990
  6.  *
  7.  *      This program is in the public domain
  8.  *
  9.  *      pw_openfile should usually be regarded as an internal function for
  10.  *      the use of the passwd library only.  However, if your software has
  11.  *      its own way of specifying the location of the password file, you may
  12.  *      wish to use pw_openfile to pass that location to the library.
  13.  *
  14.  */
  15.  
  16. #include <stdio.h>
  17. #include <stdlib.h>
  18. #include <pwd.h>
  19.  
  20. extern FILE *_pw_file;
  21.  
  22. int pw_openfile(char *name)
  23. {
  24.     if (name == NULL)
  25.     name = getenv("PASSWD");
  26.     if (name == NULL)
  27.     name = "\\etc\\passwd";
  28.     return (_pw_file = fopen(name, "r")) != NULL;
  29. }
  30.  
  31.  
  32.