home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume14 / libpw / part01 / isuidused.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-15  |  332 b   |  27 lines

  1. /*
  2.  * isuidused(x) - if uid x is used, return 1 else 0
  3.  */
  4.  
  5. #include <stdio.h>
  6. #include <pwd.h>
  7.  
  8. struct passwd    *tmp;
  9.  
  10. isuidused(x)
  11. int    x;
  12. {
  13.     lockpwfile();
  14.     setpwent();
  15.  
  16.     while ((tmp = getpwent()) != NULL) {
  17.         if (tmp->pw_uid == x) {
  18.             unlockpwfile();
  19.             endpwent();
  20.             return(1);
  21.         }
  22.     }
  23.     unlockpwfile();
  24.     endpwent();
  25.     return(0);
  26. }
  27.