File: setaliasent.3

package info (click to toggle)
manpages-ja 0.5.0.0.20050315-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 18,620 kB
  • ctags: 4
  • sloc: sh: 12,675; perl: 157; makefile: 106
file content (141 lines) | stat: -rw-r--r-- 3,659 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
.\" Copyright 2003 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
.\" Distributed under GPL
.\"
.\" Polished a bit, added a little, aeb
.\"
.\" Japanese Version Copyright (c) 2004 Yuichi SATO
.\"         all rights reserved.
.\" Translated Sun Sep  5 20:44:27 JST 2004
.\"         by Yuichi SATO <ysato444@yahoo.co.jp>
.\"
.TH SETALIASENT 3 2003-09-09 "GNU" "access mail aliases database"
.SH ̾
setaliasent, endaliasent, getaliasent, getaliasent_r, getaliasbyname, getaliasbyname_r \- ꥢȥɤ߹
.SH 
.B #include <aliases.h>
.sp
.BI "void setaliasent(void);"
.sp 
.BI "void endaliasent(void);"
.sp
.BI "struct aliasent *getaliasent(void);"
.sp
.BI "int getaliasent_r(struct aliasent *" result ","
.br
.BI "    char *" buffer ", size_t " buflen ", struct aliasent **" res );
.sp
.BI "struct aliasent *getaliasbyname(const char *" name );
.sp
.BI "int getaliasbyname_r(const char *" name ,
.br
.BI "    struct aliasent *" result ,
.br
.BI "    char *" buffer ", size_t " buflen ", struct aliasent **" res );
.sp
.SH 
͡ॵӥå (Name Service Switch, NSS) 
Ѳǽʥǡ١ 1 ĤȤơ
᡼륨ꥢݻ륨ꥢǡ١롣
(ɤΥǡ١ݡȤƤ뤫Ĵ٤ˤϡ
getent \-\-help ¹Ԥ뤳ȡ)
ꥢǡ١˥뤿ˡ
6 Ĥδؿ󶡤Ƥ롣
.PP
.B getaliasent()
ؿϥꥢǡ١Ф
롼׾ޤ๽¤ΤؤΥݥ󥿤֤
1 ܤ˴ؿƤФ줿ȤˤϡǽΥȥ֤;
ʹߤϤθΥȥ֤
.PP
.B setaliasent() 
ؿϥեݥ󥿤򥨥ꥢǡ١Ƭ˴᤹
.PP
.B endaliasent() 
ؿϥꥢǡ١򥯥롣
.PP
.B getaliasent_r()
ؿϾ嵭δؿΥꥨȥǤǤ롣
׵ᤵ줿¤Τ 1 ˳Ǽ뤬
ץޤ¾ΰƤɬפ롣
ʬΰ褬ͿʤȡδؿϼԤ롣
.PP
ؿ
.B getaliasbyname()
 name Ȥꡢꥢǡ١򸡺롣
ȥ struct aliasent ؤΥݥ󥿤Ȥ֤롣
.PP
.B getaliasbyname_r()
Ͼ嵭δؿΥꥨȥǤǤ롣
׵ᤵ줿¤Τ 2 ˳Ǽ뤬
ץޤ¾ΰƤɬפ롣
ʬΰ褬ͿʤȡδؿϼԤ롣
.PP
struct aliasent  <aliases.h> Ƥ롣
.nf
struct aliasent {
    char *alias_name;              /* ꥢ̾ */
    size_t alias_members_len;           
    char **alias_members;          /* ꥢ̾Υꥹ */
    int alias_local;
};
.fi
.SH ե
ǥեȤΥꥢǡ١ϡե
.I /etc/aliases
Ǥ롣

.I /etc/nsswitch.conf
եѹǤ롣
.SH ֤
ؿ
.B getaliasent_r()

.B getaliasbyname_r()
ϡ顼ξ 0 ʳ֤ͤ
.SH 
ʲ gcc example.c -o example ǥѥǤ롣
ϥꥢǡ١ˤƤ̾פ롣
.sp
.nf
#include <aliases.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int main() {
  struct aliasent *al;
  setaliasent();
  for (;;) {
    al = getaliasent();
    if (al == NULL) break;
    printf("Name: %s\\n", al->alias_name);
  }
  if (errno) {
      perror("reading alias");
      exit(EXIT_FAILURE);
  }
  endaliasent();
  exit(EXIT_SUCCESS);
}
.fi
.SH 
Υ롼 glibc ͭΤΤǤ롣
NeXT ˤƱͤΥ롼󤬤롣
.RS
.nf
#include <aliasdb.h>
void alias_setent(void);
void alias_endent(void);
alias_ent *alias_getent(void);
alias_ent *alias_getbyname(char *name);
.fi
.RE
.SH Ϣ
.BR getgrent (3),
.BR getpwent (3),
.BR getspent (3),
.BR aliases (5)
.\"
.\" /etc/sendmail/aliases
.\" Yellow Pages
.\" newaliases, postalias