Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getgrgid(3) [ultrix man page]

getgrent(3)						     Library Functions Manual						       getgrent(3)

Name
       getgrent, getgrgid, getgrnam, setgrent, endgrent - get group entry

Syntax
       #include <grp.h>

       struct group *getgrent()

       struct group *getgrgid(gid)
       gid_t gid;

       struct group *getgrnam(name)
       char *name;

       void setgrent()

       void endgrent()

Description
       The  and subroutines each return pointers to an object with the following structure containing the broken-out fields of a line in the group
       database:

       struct  group { /* see getgrent(3) */
	       char    *gr_name;
	       char    *gr_passwd;
	       int     gr_gid;
	       char    **gr_mem;
       };

       struct group *getgrent(), *getgrgid(), *getgrnam();

       The members of this structure are:

       gr_name	  The name of the group.
       gr_passwd  The encrypted password of the group.
       gr_gid	  The numerical group-ID.
       gr_mem	  Null-terminated vector of pointers to the individual member names.

       A call to has the effect of rewinding the group file to allow repeated searches.  The may be called to close the group database	when  pro-
       cessing is complete.

       The  subroutine	simply reads the next line while and search until a matching gid or name is found (or until EOF is encountered).  The sub-
       routine keeps a pointer in the database, allowing successive calls to be used to search the entire file.

       A call to must be made before a loop using in order to perform initialization and an must be used after the loop.  Both and make  calls	to
       and

Restrictions
       All information is contained in a static area so it must be copied if it is to be saved.

       If YP is running, does not return the entries in any particular order.  See the Guide to the Yellow Pages Service for setup information.

       The  group database may also be distributed via the BIND/Hesiod naming service.	See the Guide to the BIND/Hesiod Service for more informa-
       tion.

Return Values
       A null pointer (0) is returned on EOF or error.

Files
See Also
       group(5), svc.conf(5)
       Guide to the BIND/Hesiod Service
       Guide to the Yellow Pages Service

																       getgrent(3)

Check Out this Related Man Page

GETGRENT(3)						     Linux Programmer's Manual						       GETGRENT(3)

NAME
getgrent, setgrent, endgrent - get group file entry SYNOPSIS
#include <grp.h> #include <sys/types.h> struct group *getgrent(void); void setgrent(void); void endgrent(void); DESCRIPTION
The getgrent() function returns a pointer to a structure containing the group information from /etc/group. The first time it is called it returns the first entry; thereafter, it returns successive entries. The setgrent() function rewinds the file pointer to the beginning of the /etc/group file. The endgrent() function closes the /etc/group file. The group structure is defined in <grp.h> as follows: struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ gid_t gr_gid; /* group id */ char **gr_mem; /* group members */ }; RETURN VALUE
The getgrent() function returns the group information structure, or NULL if there are no more entries or an error occurs. ERRORS
ENOMEM Insufficient memory to allocate group information structure. FILES
/etc/group group database file CONFORMING TO
SVID 3, BSD 4.3 SEE ALSO
fgetgrent(3), getgrnam(3), getgrgid(3) GNU
1993-04-04 GETGRENT(3)
Man Page

11 More Discussions You Might Find Interesting

1. Programming

directory as tree

hi i have modified a program to display directory entries recursively in a tree like form i need an output with the following guidelines: the prog displays the contents of the directory the directory contents are sorted before printing so that directories come before regular files if an entry... (2 Replies)
Discussion started by: anything2
2 Replies

2. Programming

errors....

hi i have written a program to display files in a directory but it doesnt compile on the sun/solaris system.... im using gcc(inbuilt compiler) im generally used to working on a windows environment so maybe im overlookiing something ive added comments to help readability of the program i also... (2 Replies)
Discussion started by: anything2
2 Replies

3. Solaris

Apache config issue

I want to build a little website on a Sun Blade 100 running Solaris 10. I just went out to apache.org and downloaded Unix Source: httpd-2.2.8.tar.gz After unpacking the tarball, I CD'd into the subdirectory and ran the configure utility. Of course, it crapped out. I see that it is... (17 Replies)
Discussion started by: BrewDudeBob
17 Replies

4. UNIX for Advanced & Expert Users

retrieving all group names with a given group number

hi, which Unix/C function can i use to retrieve all group names with a particular group id? The following C code prints out the group id number of a particular group name: ------------------------------------------------------------------------ #include <stdio.h> #include <grp.h> int... (3 Replies)
Discussion started by: Andrewkl
3 Replies

5. Shell Programming and Scripting

perl program

I wish to write a Perl program that will provide a listing of files in a directory. The files must be listed in sorted order by the file name. • By default, the program displays only file names. • By default, the program lists the files in the current directory. • The program must provide the... (2 Replies)
Discussion started by: livewire06
2 Replies

6. Shell Programming and Scripting

perl program

could i get any help with how to link this program together. i dont know what to put where the X's are print `flush`; thank(); #print thank header use Getopt::Std; # use declaration with the options function getopts("ld:") or usage() and exit; ... (3 Replies)
Discussion started by: livewire06
3 Replies

7. Programming

scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe? (4 Replies)
Discussion started by: dawwin
4 Replies

8. UNIX for Dummies Questions & Answers

shell script for long listing of groupnames

Hello, When listing the file systems (using ls -ltr) , if the group names are longer the group name is getting truncated. Can someone help with the script which would display the truncated group name? I appreciate if someone could help in this regard. (3 Replies)
Discussion started by: mike12
3 Replies

9. Shell Programming and Scripting

Need Help in ls command

Hi ...every one i am new to linux. i m trying to write program for ls command .i got everything but i dont know how to print system blocks in a directory . can u help me out... (4 Replies)
Discussion started by: mahesh55
4 Replies

10. Shell Programming and Scripting

Get Permissions and save to data

Hi all; I have the following code which gives me kind of what I need: #!/usr/bin/perl use Fcntl ':mode'; # if ($ARGV ne "") { $filename = $ARGV; } else { print "Please specify a file!\n"; exit; } # if... (2 Replies)
Discussion started by: gvolpini
2 Replies

11. AIX

Compiling problem - AIX 7.2

Hi We meet errors while running configuration scripts to prepare compiling source code on AIX 7.2. This error does not happen on AIX5.3 and AIX6.1 With the “/usr/bin/sh” from AIX7.2, sometimes , the script runs sucessfully, sometimes not. It’s unstable, and I don’t know why. When... (10 Replies)
Discussion started by: bobochacha29
10 Replies