1 .\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
7 .\" Polished a bit, added a little, aeb
9 .TH SETALIASENT 3 2003-09-09 "GNU" "Linux Programmer's Manual"
11 setaliasent, endaliasent, getaliasent, getaliasent_r,
12 getaliasbyname, getaliasbyname_r \- read an alias entry
14 .B #include <aliases.h>
16 .B "void setaliasent(void);"
18 .B "void endaliasent(void);"
20 .B "struct aliasent *getaliasent(void);"
22 .BI "int getaliasent_r(struct aliasent *" result ","
24 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
26 .BI "struct aliasent *getaliasbyname(const char *" name );
28 .BI "int getaliasbyname_r(const char *" name ", struct aliasent *" result ,
30 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
32 One of the databases available with the Name Service Switch (NSS)
33 is the aliases database, that contains mail aliases.
34 (To find out which databases are supported, try \fIgetent \-\-help\fP.)
35 Six functions are provided to access the aliases database.
39 function returns a pointer to a structure containing
40 the group information from the aliases database.
41 The first time it is called it returns the first entry;
42 thereafter, it returns successive entries.
46 function rewinds the file pointer to the beginning of the
51 function closes the aliases database.
54 is the reentrant version of the previous function.
55 The requested structure
56 is stored via the first argument but the programmer needs to fill the other
58 Not providing enough space causes the function to fail.
62 takes the name argument and searches the aliases database.
63 The entry is returned as a pointer to a
64 .IR "struct aliasent" .
66 .BR getaliasbyname_r ()
67 is the reentrant version of the previous function.
68 The requested structure
69 is stored via the second argument but the programmer needs to fill the other
71 Not providing enough space causes the function to fail.
81 char *alias_name; /* alias name */
82 size_t alias_members_len;
83 char **alias_members; /* alias name list */
92 .BR getaliasbyname_r ()
93 return a nonzero value on error.
95 The default alias database is the file
97 This can be changed in the
101 These routines are glibc-specific.
102 The NeXT system has similar routines:
108 void alias_setent(void);
109 void alias_endent(void);
110 alias_ent *alias_getent(void);
111 alias_ent *alias_getbyname(char *name);
115 The following example compiles with
116 .IR "gcc example.c \-o example" .
117 It will dump all names in the alias database.
134 printf("Name: %s\\n", al\->alias_name);
137 perror("reading alias");
150 .\" /etc/sendmail/aliases
152 .\" newaliases, postalias