Next | Prev | Up | Top | Contents | Index

sautil--for Network Maps

The sautil library is a Tcl interface to system administration utilities for dealing with network information maps, for example YP maps for password, group, hosts, networks, protocols, and services. To use the sautil library, first initialize it with dlopen:

% ypmatch joeuser passwd 
joeuser::508:10:Joseph User,,,,,,,<eng>:/home/joeuser:/usr/bin/tcsh
% sgitcl 
sgitcl> dlopen libsautil.so init SAUtil_Init 
sgitcl> getpwnam pwent joeuser 
pw_name pw_passwd pw_uid pw_gid pw_comment pw_gecos pw_dir pw_shell
sgitcl> set pwent(pw_shell) 
/usr/bin/tcsh
In the example above, getpwnam returns the array element identifiers for the password entry array pwent. The set command shows that these array elements have been filled in according to the YP password map entry for joeuser.

System administration utilities for dealing with network information maps have the same names as standard C library routines for dealing with /etc files for password, group, hosts, networks, protocols, and services. These utilities are self-documenting--they print the proper usage if issued without arguments. Table 3-1 shows the utilities available:

sautil Library for Network Information
YP MapUtilities Available
groupgetgrnam, getgrgid, getgrent, setgrent, endgrent
hostshostname, hostid, sysid, gethostbyname, gethostbyaddr
gethostent, sethostent, endhostent
networksgetnetbyname, getnetbyaddr, getnetent, setnetent, endnetent
passwdpwcrypt, setpwent, getpwent, endpwent, getpwnam, getpwuid
protocolsgetprotobyname, getprotobynumber, getprotoent, setprotoent, endprotoent
servicesgetservbyname, getservbyport, getservent, setservent, endservent

For more information about each of the sautils utilities above, use the Tcl help facility, giving the name of a YP map and a utility:

sgitcl> help sautils/YPmap/utility



Next | Prev | Up | Top | Contents | Index