1 .\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
4 .\" Polished a bit, added a little, aeb
6 .TH SETALIASENT 3 2003-09-09 "GNU" "Linux Programmer's Manual"
8 setaliasent, endaliasent, getaliasent, getaliasent_r,
9 getaliasbyname, getaliasbyname_r \- read an alias entry
11 .B #include <aliases.h>
13 .B "void setaliasent(void);"
15 .B "void endaliasent(void);"
17 .B "struct aliasent *getaliasent(void);"
19 .BI "int getaliasent_r(struct aliasent *" result ","
21 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
23 .BI "struct aliasent *getaliasbyname(const char *" name );
25 .BI "int getaliasbyname_r(const char *" name ", struct aliasent *" result ,
27 .BI " char *" buffer ", size_t " buflen ", struct aliasent **" res );
29 One of the databases available with the Name Service Switch (NSS)
30 is the aliases database, that contains mail aliases.
31 (To find out which databases are supported, try \fIgetent \-\-help\fP.)
32 Six functions are provided to access the aliases database.
36 function returns a pointer to a structure containing
37 the group information from the aliases database.
38 The first time it is called it returns the first entry;
39 thereafter, it returns successive entries.
43 function rewinds the file pointer to the beginning of the
48 function closes the aliases database.
51 is the reentrant version of the previous function.
52 The requested structure
53 is stored via the first argument but the programmer needs to fill the other
55 Not providing enough space causes the function to fail.
59 takes the name argument and searches the aliases database.
60 The entry is returned as a pointer to a
61 .IR "struct aliasent" .
63 .BR getaliasbyname_r ()
64 is the reentrant version of the previous function.
65 The requested structure
66 is stored via the second argument but the programmer needs to fill the other
68 Not providing enough space causes the function to fail.
78 char *alias_name; /* alias name */
79 size_t alias_members_len;
80 char **alias_members; /* alias name list */
89 .BR getaliasbyname_r ()
90 return a non-zero value on error.
92 The default alias database is the file
94 This can be changed in the
98 These routines are glibc-specific.
99 The NeXT has similar routines:
105 void alias_setent(void);
106 void alias_endent(void);
107 alias_ent *alias_getent(void);
108 alias_ent *alias_getbyname(char *name);
112 The following example compiles with
113 .IR "gcc example.c \-o example" .
114 It will dump all names in the alias database.
131 printf("Name: %s\\n", al\->alias_name);
134 perror("reading alias");
147 .\" /etc/sendmail/aliases
149 .\" newaliases, postalias