File: setaliasent.3

package info (click to toggle)
manpages-ja 0.5.0.0.20100315-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 21,156 kB
  • ctags: 1
  • sloc: sh: 13,935; perl: 157; makefile: 114
file content (153 lines) | stat: -rw-r--r-- 3,746 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
142
143
144
145
146
147
148
149
150
151
152
153
.\" 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" "Linux Programmer's Manual"
.SH ̾
setaliasent, endaliasent, getaliasent, getaliasent_r, getaliasbyname, getaliasbyname_r \- ꥢȥɤ߹
.SH 
.B #include <aliases.h>
.sp
.B "void setaliasent(void);"
.sp
.B "void endaliasent(void);"
.sp
.B "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 ", struct aliasent *" result ,
.br
.BI "        char *" buffer ", size_t " buflen ", struct aliasent **" res );
.SH 
͡ॵӥå (Name Service Switch, NSS) 
Ѳǽʥǡ١ 1 ĤȤơ
᡼륨ꥢݻ륨ꥢǡ١롣
(ɤΥǡ١ݡȤƤ뤫Ĵ٤ˤϡ
getent \-\-help ¹Ԥ뤳ȡ)
ꥢǡ١˥뤿ˡ
6 Ĥδؿ󶡤Ƥ롣
.PP
.BR getaliasent ()
ؿϥꥢǡ١Ф
롼׾ޤ๽¤ΤؤΥݥ󥿤֤
1 ܤ˴ؿƤФ줿ȤˤϡǽΥȥ֤;
ʹߤϤθΥȥ֤
.PP
.BR setaliasent ()
ؿϥեݥ󥿤򥨥ꥢǡ١Ƭ˴᤹
.PP
.BR endaliasent ()
ؿϥꥢǡ١򥯥롣
.PP
.BR getaliasent_r ()
ؿϾ嵭δؿΥꥨȥǤǤ롣
׵ᤵ줿¤Τ 1 ˳Ǽ뤬
ץޤ¾ΰƤɬפ롣
ʬΰ褬ͿʤȡδؿϼԤ롣
.PP
ؿ
.BR getaliasbyname ()
 name Ȥꡢꥢǡ١򸡺롣
ȥ
.I "struct aliasent"
ؤΥݥ󥿤Ȥ֤롣
.PP
.BR getaliasbyname_r ()
Ͼ嵭δؿΥꥨȥǤǤ롣
׵ᤵ줿¤Τ 2 ˳Ǽ뤬
ץޤ¾ΰƤɬפ롣
ʬΰ褬ͿʤȡδؿϼԤ롣
.PP
.I "struct aliasent"

.I <aliases.h>
Ƥ롣
.in +4n
.nf

struct aliasent {
    char    *alias_name;             /* ꥢ̾ */
    size_t   alias_members_len;
    char   **alias_members;          /* ꥢ̾Υꥹ */
    int      alias_local;
};
.fi
.in
.SH ֤
ؿ
.BR getaliasent_r ()

.BR getaliasbyname_r ()
ϡ顼ξ 0 ʳ֤ͤ
.SH ե
ǥեȤΥꥢǡ١ϡե
.I /etc/aliases
Ǥ롣

.I /etc/nsswitch.conf
եѹǤ롣
.SH 
Υ롼 glibc ͭΤΤǤ롣
NeXT ˤƱͤΥ롼󤬤롣
.in +4n
.sp
.nf

#include <aliasdb.h>

void alias_setent(void);
void alias_endent(void);
alias_ent *alias_getent(void);
alias_ent *alias_getbyname(char *name);
.fi
.in
.SH 
ʲ
.I "gcc example.c -o example"
ǥѥǤ롣
ϥꥢǡ١ˤƤ̾פ롣
.sp
.nf
#include <aliases.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>

int
main(void)
{
    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 Ϣ
.BR getgrent (3),
.BR getpwent (3),
.BR getspent (3),
.BR aliases (5)
.\"
.\" /etc/sendmail/aliases
.\" Yellow Pages
.\" newaliases, postalias