home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / stg_v4.lzh / isgrpmem.c < prev    next >
C/C++ Source or Header  |  1994-11-11  |  533b  |  42 lines

  1. #include "grp.h"
  2.  
  3. isgrpmem(pcGroup,pcUser)
  4. char *pcGroup;
  5. char *pcUser;
  6. {
  7.     struct group *gr;
  8.     char **ppcList;
  9.  
  10.     if (!pcUser)
  11.         exit(214);
  12.  
  13.     gr=getgrnam(pcGroup);
  14.     if (!gr)
  15.         return(0);
  16.  
  17.     ppcList=gr->gr_mem;
  18.     if (!ppcList || !*ppcList)
  19.         return(0);
  20.  
  21.     if (**ppcList=='*')
  22.     {
  23.         ppcList++;
  24.         while (*ppcList)
  25.         {
  26.             if (!stricmp(*ppcList,pcUser))
  27.                 return(0);
  28.             ppcList++;
  29.         }
  30.         return(1);
  31.     }
  32.  
  33.     while (*ppcList)
  34.     {
  35.         if (!stricmp(*ppcList,pcUser))
  36.             return(1);
  37.         ppcList++;
  38.     }
  39.     return(0);
  40. }
  41.  
  42.