xref: /illumos-gate/usr/src/cmd/svr4pkg/hdrs/libadm.h (revision 66582b606a8194f7f3ba5b3a3a6dca5b0d346361)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 
28 #ifndef	__PKG_LIBADM_H__
29 #define	__PKG_LIBADM_H__
30 
31 #include <sys/types.h>
32 #include <sys/vtoc.h>
33 #include <limits.h>
34 #include <stdio.h>
35 #include <pkgstrct.h>
36 #include <pkginfo.h>
37 #include <valtools.h>
38 #include "install.h"
39 
40 #if defined(__STDC__)
41 #define	__P(protos) protos
42 #else	/* __STDC__ */
43 #define	__P(protos) ()
44 #endif	/* __STDC__ */
45 
46 
47 /*
48  * ckdate.c
49  */
50 extern int	ckdate_err __P((char *fmt, char *error));
51 extern int	ckdate_hlp __P((char *fmt, char *help));
52 extern int	ckdate_val __P((char *fmt, char *input));
53 extern int	ckdate __P((char *date, char *fmt, char *defstr, char *error,
54 				char *help, char *prompt));
55 
56 /*
57  * ckgid.c
58  */
59 extern int	ckgid_dsp __P((void));
60 extern int	ckgid_val __P((char *grpnm));
61 extern int	ckgrpfile __P((void));
62 extern void	ckgid_err __P((int disp, char *error));
63 extern void	ckgid_hlp __P((int disp, char *help));
64 extern int	ckgid __P((char *gid, short disp, char *defstr, char *error,
65 				char *help, char *prompt));
66 
67 /*
68  * ckint.c
69  */
70 extern int	ckint_val __P((char *value, short base));
71 extern void	ckint_err __P((short base, char *error));
72 extern void	ckint_hlp __P((short base, char *help));
73 extern int	ckint __P((long *intval, short base, char *defstr, char *error,
74 				char *help, char *prompt));
75 
76 /*
77  * ckitem.c
78  */
79 extern CKMENU	*allocmenu __P((char *label, int attr));
80 extern void	ckitem_err __P((CKMENU *menup, char *error));
81 extern void	ckitem_hlp __P((CKMENU *menup, char *help));
82 extern int	ckitem __P((CKMENU *menup, char *item[], short max,
83 				char *defstr, char *error, char *help,
84 				char *prompt));
85 extern int	setitem __P((CKMENU *menup, char *choice));
86 extern int	setinvis __P((CKMENU *menup, char *choice));
87 extern void	printmenu __P((CKMENU *menup));
88 
89 /*
90  * ckkeywd.c
91  */
92 extern int	ckkeywd __P((char *strval, char *keyword[], char *defstr,
93 				char *error, char *help, char *prompt));
94 
95 /*
96  * ckpath.c
97  */
98 extern int	ckpath_stx __P((int pflags));
99 extern int	ckpath_val __P((char *path, int pflags));
100 extern void	ckpath_err __P((int pflags, char *error, char *input));
101 extern void	ckpath_hlp __P((int pflags, char *help));
102 extern int	ckpath __P((char *pathval, int pflags, char *defstr,
103 				char *error, char *help, char *prompt));
104 
105 /*
106  * ckrange.c
107  */
108 extern void	ckrange_err __P((long lower, long upper, int base,
109 				char *error));
110 extern void	ckrange_hlp __P((long lower, long upper, int base, char *help));
111 extern int	ckrange_val __P((long lower, long upper, int base,
112 				char *input));
113 extern int	ckrange __P((long *rngval, long lower, long upper, short base,
114 				char *defstr, char *error, char *help,
115 				char *prompt));
116 
117 /*
118  * ckstr.c
119  */
120 extern int	ckstr_val __P((char *regexp[], int length, char *input));
121 extern void	ckstr_err __P((char *regexp[], int length, char *error,
122 				char *input));
123 extern void	ckstr_hlp __P((char *regexp[], int length, char *help));
124 extern int	ckstr __P((char *strval, char *regexp[], int length,
125 				char *defstr, char *error, char *help,
126 				char *prompt));
127 
128 /*
129  * cktime.c
130  */
131 extern int	cktime_val __P((char *fmt, char *input));
132 extern int	cktime_err __P((char *fmt, char *error));
133 extern int	cktime_hlp __P((char *fmt, char *help));
134 extern int	fmtcheck __P((char *fmt));
135 extern int	cktime __P((char *tod, char *fmt, char *defstr, char *error,
136 				char *help, char *prompt));
137 
138 /*
139  * ckuid.c
140  */
141 extern int	ckuid_dsp __P((void));
142 extern int	ckuid_val __P((char *usrnm));
143 extern int	ckpwdfile __P((void));
144 extern void	ckuid_err __P((short disp, char *error));
145 extern void	ckuid_hlp __P((int disp, char *help));
146 extern int	ckuid __P((char *uid, short disp, char *defstr, char *error,
147 				char *help, char *prompt));
148 
149 /*
150  * ckyorn.c
151  */
152 extern int	ckyorn_val __P((char *str));
153 extern void	ckyorn_err __P((char *error));
154 extern void	ckyorn_hlp __P((char *help));
155 extern int	ckyorn __P((char *yorn, char *defstr, char *error, char *help,
156 				char *prompt));
157 
158 /*
159  * devattr.c
160  */
161 extern char	*devattr __P((char *device, char *attribute));
162 
163 /*
164  * devreserv.c
165  */
166 extern char	*_rsvtabpath __P((void));
167 extern int	_openlkfile __P((void));
168 extern int	_closelkfile __P((void));
169 extern int	unreserv __P((long key, char *device));
170 extern char	**devreserv __P((long key, char **rsvlst[]));
171 extern int	devfree __P((long key, char *device));
172 extern struct	reservdev	**reservdev __P((void));
173 
174 /*
175  * devtab.c
176  */
177 extern void	_setdevtab __P((void));
178 extern void	_enddevtab __P((void));
179 extern char	*_devtabpath __P((void));
180 extern int	_opendevtab __P((char *mode));
181 extern int	_validalias __P((char *alias));
182 extern struct	devtabent	*_getdevtabent __P((void));
183 extern void	_freedevtabent __P((struct devtabent *ent));
184 extern struct	devtabent	*_getdevrec __P((char *device));
185 
186 /*
187  * dgrpent.c
188  */
189 extern void	_setdgrptab __P((void));
190 extern void	_enddgrptab __P((void));
191 extern char	*_dgrptabpath __P((void));
192 extern int	_opendgrptab __P((char *mode));
193 extern struct	dgrptabent	*_getdgrptabent __P((void));
194 extern void	_freedgrptabent __P((struct dgrptabent *ent));
195 extern struct	dgrptabent	*_getdgrprec __P((char *dgroup));
196 
197 /*
198  * fulldevnm.c
199  */
200 extern char	*getfullblkname __P((char *cp));
201 extern char	*getfullrawname __P((char *cp));
202 
203 /*
204  * getdev.c
205  */
206 extern char	**getdev __P((char **devices, char **criteria, int options));
207 
208 /*
209  * getdgrp.c
210  */
211 extern char	**getdgrp __P((char **dgroups, char **criteria, int options));
212 
213 /*
214  * getinput.c
215  */
216 extern int	getinput __P((char *s));
217 
218 /*
219  * getvol.c
220  */
221 extern int	getvol __P((char *device, char *label, int options,
222 				char *prompt));
223 extern int	_getvol __P((char *device, char *label, int options,
224 				char *prompt, char *norewind));
225 extern void	doremovecmd __P((char *device, int echo));
226 
227 /*
228  * listdev.c
229  */
230 extern char	**listdev __P((char *device));
231 
232 /*
233  * listdgrp.c
234  */
235 extern char	**listdgrp __P((char *dgroup));
236 
237 /*
238  * memory.c
239  */
240 extern long	sysmem __P((void));
241 extern long	asysmem __P((void));
242 
243 /*
244  * pkginfo.c
245  */
246 extern int	pkginfo __P((struct pkginfo *info, char *pkginst, ...));
247 extern int	fpkginfo __P((struct pkginfo *info, char *pkginst));
248 extern char	*fpkginst __P((char *pkg, ...));
249 
250 /*
251  * pkgnmchk.c
252  */
253 extern int	pkgnmchk __P((register char *pkg, register char *spec,
254 				int presvr4flg));
255 extern void	set_ABI_namelngth __P((void));
256 extern int	get_ABI_namelngth __P((void));
257 
258 /*
259  * pkgparam.c
260  */
261 extern char	*fpkgparam __P((FILE *fp, char *param));
262 extern char	*pkgparam __P((char *pkg, char *param));
263 extern void	set_PKGpaths __P((char *path));
264 extern char	*get_PKGLOC __P((void));
265 extern char	*get_PKGADM __P((void));
266 extern void	set_PKGADM(char *newpath);
267 extern void	set_PKGLOC(char *newpath);
268 
269 /*
270  * putdev.c
271  */
272 extern int	_putdevtabrec __P((FILE *stream, struct devtabent *rec));
273 extern int	_adddevtabrec __P((char *alias, char **attrval));
274 extern int	_moddevtabrec __P((char *device, char **attrval));
275 extern int	_rmdevtabrec __P((char *device));
276 extern int	_rmdevtabattrs __P((char *device, char **attributes,
277 				    char ***notfounds));
278 
279 /*
280  * putdgrp.c
281  */
282 extern int	_putdgrptabrec __P((FILE *stream, struct dgrptabent *rec));
283 extern int	_adddgrptabrec __P((char *dgrp, char **members));
284 extern int	_rmdgrptabrec __P((char *dgrp));
285 extern int	_rmdgrpmems __P((char *dgrp, char **mems, char ***notfounds));
286 
287 /*
288  * puterror.c
289  */
290 extern void	puterror __P((FILE *fp, char *defmesg, char *error));
291 
292 /*
293  * puthelp.c
294  */
295 extern void	puthelp __P((FILE *fp, char *defmesg, char *help));
296 
297 /*
298  * putprmpt.c
299  */
300 extern void	putprmpt __P((FILE *fp, char *prompt, char *choices[],
301 				char *defstr));
302 
303 /*
304  * puttext.c
305  */
306 extern int	puttext __P((FILE *fp, char *str, int lmarg, int rmarg));
307 
308 /*
309  * rdwr_vtoc.c
310  */
311 extern int	read_vtoc __P((int fd, struct vtoc *vtoc));
312 extern int	write_vtoc __P((int fd, struct vtoc *vtoc));
313 
314 #if defined(lint) && !defined(gettext)
315 #define	gettext(x)	x
316 #endif	/* defined(lint) && !defined(gettext) */
317 
318 #endif	/* __PKG_LIBADM_H__ */
319