Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!rutgers!mcnc!decvax.dec.com!zinn!lemuria!darryl From: darryl@lemuria.MV.COM (Darryl Wagoner) Newsgroups: comp.unix.i386 Subject: groups(1): Display all your groups for ISC 2.2 Message-ID: <1990Aug19.135513.11212@lemuria.MV.COM> Date: 19 Aug 90 13:55:13 GMT Organization: Shecora Associates, Inc. Lines: 70 This is a quick and dirty program to display the posix groups that you are a member of. Enjoy #!/bin/sh # shar: Shell Archiver (v1.22) # # Run the following text with /bin/sh to create: # Makefile # groups.c # sed 's/^X//' << 'SHAR_EOF' > Makefile && XCC = cc XCFLAGS = -O X Xgroups: groups.o X $(CC) -s -o groups groups.o -lcposix X X SHAR_EOF chmod 0664 Makefile || echo "restore of Makefile fails" sed 's/^X//' << 'SHAR_EOF' > groups.c && X/****************************************************************/ X/* */ X#ifndef lint Xstatic char *sccsid = "@(#)groups.c 1.3 8/19/90\n@(#)Copyright 1990 Shecora Associates, Inc\n"; X#endif X/* */ X/* This program may be used for any purpose the user see */ X/* fit, except he/she may not remove the copyright */ X/****************************************************************/ X X#define _POSIX_SOURCE X X#include X#include X#include X X Xmain() { X X gid_t groups[20]; X struct group *gname; X int ngrp; X int i; X X ngrp = getgroups(19,groups); X X if (ngrp <= 0 ) { X perror("getgroups"); X exit(1); X } X X for(i=0;igr_name); X } X printf("\n"); X exit(0); X} SHAR_EOF chmod 0444 groups.c || echo "restore of groups.c fails" exit 0 -- Darryl Wagoner darryl@lemuria.MV.COM or uunet!virgin!lemuria!darryl 12 Oak Hill Road Brookline, NH 03033 Office: 603.672.0736 Home: 603.673.0578