home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
TELECOM
/
stg_v4.lzh
/
groups.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-11
|
679b
|
44 lines
#include "stgnet.h"
#include "grp.h"
struct group *grp;
main(argc,argv)
char **argv;
{
char *user;
openerr(*argv,0,LOG_STGNET);
dash(argv)
{
case '?':
writeln(2,"groups {user} - list groups user belongs to\n",80);
STGVER;
exit(0);
case 'l':
while (grp=getgrent())
{
writeln(2,stringf(b,"%s\n",grp->gr_name),80);
}
exit(0);
default:
writeln(2,stringf(b,"groups: invalid option: %s\n",--*argv),80);
exit(1);
}
if (*argv)
user=*argv;
else
user=getlogin();
if (!user)
exit(214);
while (grp=getgrent())
{
if (isgrpmem(grp->gr_name,user))
writeln(2,stringf(b,"%s\n",grp->gr_name),80);
}
}