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