getnetconfig.3 (32eef9aeb1f39a1623cea55da147c89abbd5b9a5) getnetconfig.3 (1fae73b137bfc5a237d7258e3c667ba87a36b7ff)
1.\" @(#)getnetconfig.3n 1.28 93/06/02 SMI; from SVr4
2.\" $NetBSD: getnetconfig.3,v 1.1 2000/06/02 23:11:11 fvdl Exp $
3.\" $FreeBSD$
4.\" Copyright 1989 AT&T
5.Dd April 22, 2000
6.Dt GETNETCONFIG 3
7.Os
8.Sh NAME

--- 23 unchanged lines hidden (view full) ---

32.Fn nc_perror "const char *msg"
33.Ft "char *"
34.Fn nc_sperror "void"
35.Sh DESCRIPTION
36The library routines described on this page
37provide the application access to
38the system network configuration database,
39.Pa /etc/netconfig .
1.\" @(#)getnetconfig.3n 1.28 93/06/02 SMI; from SVr4
2.\" $NetBSD: getnetconfig.3,v 1.1 2000/06/02 23:11:11 fvdl Exp $
3.\" $FreeBSD$
4.\" Copyright 1989 AT&T
5.Dd April 22, 2000
6.Dt GETNETCONFIG 3
7.Os
8.Sh NAME

--- 23 unchanged lines hidden (view full) ---

32.Fn nc_perror "const char *msg"
33.Ft "char *"
34.Fn nc_sperror "void"
35.Sh DESCRIPTION
36The library routines described on this page
37provide the application access to
38the system network configuration database,
39.Pa /etc/netconfig .
40The
40.Fn getnetconfig
41.Fn getnetconfig
42function
41returns a pointer to the
42current entry in the
43netconfig
44database, formatted as a
45.Ft "struct netconfig" .
46Successive calls will return successive netconfig
47entries in the netconfig database.
43returns a pointer to the
44current entry in the
45netconfig
46database, formatted as a
47.Ft "struct netconfig" .
48Successive calls will return successive netconfig
49entries in the netconfig database.
50The
48.Fn getnetconfig
51.Fn getnetconfig
52function
49can be used to search the entire netconfig
50file.
53can be used to search the entire netconfig
54file.
55The
51.Fn getnetconfig
56.Fn getnetconfig
57function
52returns
53.Dv NULL
54at the end of the file.
55.Fa handlep
56is the handle obtained through
57.Fn setnetconfig .
58.Pp
59A call to
60.Fn setnetconfig
61has the effect of
62.Dq binding
63to or
64.Dq rewinding
65the netconfig database.
58returns
59.Dv NULL
60at the end of the file.
61.Fa handlep
62is the handle obtained through
63.Fn setnetconfig .
64.Pp
65A call to
66.Fn setnetconfig
67has the effect of
68.Dq binding
69to or
70.Dq rewinding
71the netconfig database.
72The
66.Fn setnetconfig
73.Fn setnetconfig
74function
67must be called before the first call to
68.Fn getnetconfig
69and may be called at any other time.
75must be called before the first call to
76.Fn getnetconfig
77and may be called at any other time.
78The
70.Fn setnetconfig
79.Fn setnetconfig
80function
71need not be called before a call to
72.Fn getnetconfigent .
81need not be called before a call to
82.Fn getnetconfigent .
83The
73.Fn setnetconfig
84.Fn setnetconfig
85function
74returns a unique handle to be used by
75.Fn getnetconfig .
76.Pp
86returns a unique handle to be used by
87.Fn getnetconfig .
88.Pp
89The
77.Fn endnetconfig
90.Fn endnetconfig
91function
78should be called when processing is complete to release resources for reuse.
79.Fa handlep
80is the handle obtained through
81.Fn setnetconfig .
82Programmers should be aware, however, that the last call to
83.Fn endnetconfig
84frees all memory allocated by
85.Fn getnetconfig
86for the
87.Ft "struct netconfig"
88data structure.
92should be called when processing is complete to release resources for reuse.
93.Fa handlep
94is the handle obtained through
95.Fn setnetconfig .
96Programmers should be aware, however, that the last call to
97.Fn endnetconfig
98frees all memory allocated by
99.Fn getnetconfig
100for the
101.Ft "struct netconfig"
102data structure.
103The
89.Fn endnetconfig
104.Fn endnetconfig
105function
90may not be called before
91.Fn setnetconfig .
92.Pp
106may not be called before
107.Fn setnetconfig .
108.Pp
109The
93.Fn getnetconfigent
110.Fn getnetconfigent
111function
94returns a pointer
95to the netconfig structure corresponding
96to
97.Fa netid .
98It returns
99.Dv NULL
100if
101.Fa netid
102is invalid
103(that is, does not name an entry in the netconfig database).
104.Pp
112returns a pointer
113to the netconfig structure corresponding
114to
115.Fa netid .
116It returns
117.Dv NULL
118if
119.Fa netid
120is invalid
121(that is, does not name an entry in the netconfig database).
122.Pp
123The
105.Fn freenetconfigent
124.Fn freenetconfigent
125function
106frees the netconfig structure pointed to by
107.Fa netconfigp
108(previously returned by
109.Fn getnetconfigent ) .
110.Pp
126frees the netconfig structure pointed to by
127.Fa netconfigp
128(previously returned by
129.Fn getnetconfigent ) .
130.Pp
131The
111.Fn nc_perror
132.Fn nc_perror
133function
112prints a message to the standard error indicating why any of the
113above routines failed.
114The message is prepended with the string
115.Fa msg
116and a colon.
117A newline character is appended at the end of the message.
118.Pp
134prints a message to the standard error indicating why any of the
135above routines failed.
136The message is prepended with the string
137.Fa msg
138and a colon.
139A newline character is appended at the end of the message.
140.Pp
141The
119.Fn nc_sperror
142.Fn nc_sperror
143function
120is similar to
121.Fn nc_perror
122but instead of sending the message
123to the standard error, will return a pointer to a string that
124contains the error message.
125.Pp
144is similar to
145.Fn nc_perror
146but instead of sending the message
147to the standard error, will return a pointer to a string that
148contains the error message.
149.Pp
150The
126.Fn nc_perror
127and
128.Fn nc_sperror
151.Fn nc_perror
152and
153.Fn nc_sperror
154functions
129can also be used with the
130.Ev NETPATH
131access routines defined in
132.Xr getnetpath 3 .
133.Sh RETURN VALUES
155can also be used with the
156.Ev NETPATH
157access routines defined in
158.Xr getnetpath 3 .
159.Sh RETURN VALUES
160The
134.Fn setnetconfig
161.Fn setnetconfig
162function
135returns a unique handle to be used by
136.Fn getnetconfig .
137In the case of an error,
138.Fn setnetconfig
139returns
140.Dv NULL
141and
142.Fn nc_perror
143or
144.Fn nc_sperror
145can be used to print the reason for failure.
146.Pp
163returns a unique handle to be used by
164.Fn getnetconfig .
165In the case of an error,
166.Fn setnetconfig
167returns
168.Dv NULL
169and
170.Fn nc_perror
171or
172.Fn nc_sperror
173can be used to print the reason for failure.
174.Pp
175The
147.Fn getnetconfig
176.Fn getnetconfig
177function
148returns a pointer to the current entry in the netconfig
149database, formatted as a
150.Ft "struct netconfig" .
178returns a pointer to the current entry in the netconfig
179database, formatted as a
180.Ft "struct netconfig" .
181The
151.Fn getnetconfig
182.Fn getnetconfig
183function
152returns
153.Dv NULL
154at the end of the file, or upon failure.
155.Pp
184returns
185.Dv NULL
186at the end of the file, or upon failure.
187.Pp
188The
156.Fn endnetconfig
189.Fn endnetconfig
190function
157returns 0 on success and \-1 on failure
158(for example, if
159.Fn setnetconfig
160was not called previously).
161.Pp
162On success,
163.Fn getnetconfigent
164returns a pointer to the
165.Ft "struct netconfig"
166structure corresponding to
167.Fa netid ;
168otherwise it returns
169.Dv NULL .
170.Pp
191returns 0 on success and \-1 on failure
192(for example, if
193.Fn setnetconfig
194was not called previously).
195.Pp
196On success,
197.Fn getnetconfigent
198returns a pointer to the
199.Ft "struct netconfig"
200structure corresponding to
201.Fa netid ;
202otherwise it returns
203.Dv NULL .
204.Pp
205The
171.Fn nc_sperror
206.Fn nc_sperror
207function
172returns a pointer to a buffer which contains the error message string.
173This buffer is overwritten on each call.
174In multithreaded applications, this buffer is
175implemented as thread-specific data.
176.Sh FILES
177.Bl -tag -width /etc/netconfig -compact
178.It Pa /etc/netconfig
179.El
180.Sh SEE ALSO
181.Xr getnetpath 3 ,
182.Xr netconfig 5
208returns a pointer to a buffer which contains the error message string.
209This buffer is overwritten on each call.
210In multithreaded applications, this buffer is
211implemented as thread-specific data.
212.Sh FILES
213.Bl -tag -width /etc/netconfig -compact
214.It Pa /etc/netconfig
215.El
216.Sh SEE ALSO
217.Xr getnetpath 3 ,
218.Xr netconfig 5