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 */
50extern int	ckdate_err __P((char *fmt, char *error));
51extern int	ckdate_hlp __P((char *fmt, char *help));
52extern int	ckdate_val __P((char *fmt, char *input));
53extern int	ckdate __P((char *date, char *fmt, char *defstr, char *error,
54				char *help, char *prompt));
55
56/*
57 * ckgid.c
58 */
59extern int	ckgid_dsp __P((void));
60extern int	ckgid_val __P((char *grpnm));
61extern int	ckgrpfile __P((void));
62extern void	ckgid_err __P((int disp, char *error));
63extern void	ckgid_hlp __P((int disp, char *help));
64extern int	ckgid __P((char *gid, short disp, char *defstr, char *error,
65				char *help, char *prompt));
66
67/*
68 * ckint.c
69 */
70extern int	ckint_val __P((char *value, short base));
71extern void	ckint_err __P((short base, char *error));
72extern void	ckint_hlp __P((short base, char *help));
73extern int	ckint __P((long *intval, short base, char *defstr, char *error,
74				char *help, char *prompt));
75
76/*
77 * ckitem.c
78 */
79extern CKMENU	*allocmenu __P((char *label, int attr));
80extern void	ckitem_err __P((CKMENU *menup, char *error));
81extern void	ckitem_hlp __P((CKMENU *menup, char *help));
82extern int	ckitem __P((CKMENU *menup, char *item[], short max,
83				char *defstr, char *error, char *help,
84				char *prompt));
85extern int	setitem __P((CKMENU *menup, char *choice));
86extern int	setinvis __P((CKMENU *menup, char *choice));
87extern void	printmenu __P((CKMENU *menup));
88
89/*
90 * ckkeywd.c
91 */
92extern int	ckkeywd __P((char *strval, char *keyword[], char *defstr,
93				char *error, char *help, char *prompt));
94
95/*
96 * ckpath.c
97 */
98extern int	ckpath_stx __P((int pflags));
99extern int	ckpath_val __P((char *path, int pflags));
100extern void	ckpath_err __P((int pflags, char *error, char *input));
101extern void	ckpath_hlp __P((int pflags, char *help));
102extern int	ckpath __P((char *pathval, int pflags, char *defstr,
103				char *error, char *help, char *prompt));
104
105/*
106 * ckrange.c
107 */
108extern void	ckrange_err __P((long lower, long upper, int base,
109				char *error));
110extern void	ckrange_hlp __P((long lower, long upper, int base, char *help));
111extern int	ckrange_val __P((long lower, long upper, int base,
112				char *input));
113extern 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 */
120extern int	ckstr_val __P((char *regexp[], int length, char *input));
121extern void	ckstr_err __P((char *regexp[], int length, char *error,
122				char *input));
123extern void	ckstr_hlp __P((char *regexp[], int length, char *help));
124extern 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 */
131extern int	cktime_val __P((char *fmt, char *input));
132extern int	cktime_err __P((char *fmt, char *error));
133extern int	cktime_hlp __P((char *fmt, char *help));
134extern int	fmtcheck __P((char *fmt));
135extern int	cktime __P((char *tod, char *fmt, char *defstr, char *error,
136				char *help, char *prompt));
137
138/*
139 * ckuid.c
140 */
141extern int	ckuid_dsp __P((void));
142extern int	ckuid_val __P((char *usrnm));
143extern int	ckpwdfile __P((void));
144extern void	ckuid_err __P((short disp, char *error));
145extern void	ckuid_hlp __P((int disp, char *help));
146extern int	ckuid __P((char *uid, short disp, char *defstr, char *error,
147				char *help, char *prompt));
148
149/*
150 * ckyorn.c
151 */
152extern int	ckyorn_val __P((char *str));
153extern void	ckyorn_err __P((char *error));
154extern void	ckyorn_hlp __P((char *help));
155extern int	ckyorn __P((char *yorn, char *defstr, char *error, char *help,
156				char *prompt));
157
158/*
159 * devattr.c
160 */
161extern char	*devattr __P((char *device, char *attribute));
162
163/*
164 * devreserv.c
165 */
166extern char	*_rsvtabpath __P((void));
167extern int	_openlkfile __P((void));
168extern int	_closelkfile __P((void));
169extern int	unreserv __P((long key, char *device));
170extern char	**devreserv __P((long key, char **rsvlst[]));
171extern int	devfree __P((long key, char *device));
172extern struct	reservdev	**reservdev __P((void));
173
174/*
175 * devtab.c
176 */
177extern void	_setdevtab __P((void));
178extern void	_enddevtab __P((void));
179extern char	*_devtabpath __P((void));
180extern int	_opendevtab __P((char *mode));
181extern int	_validalias __P((char *alias));
182extern struct	devtabent	*_getdevtabent __P((void));
183extern void	_freedevtabent __P((struct devtabent *ent));
184extern struct	devtabent	*_getdevrec __P((char *device));
185
186/*
187 * dgrpent.c
188 */
189extern void	_setdgrptab __P((void));
190extern void	_enddgrptab __P((void));
191extern char	*_dgrptabpath __P((void));
192extern int	_opendgrptab __P((char *mode));
193extern struct	dgrptabent	*_getdgrptabent __P((void));
194extern void	_freedgrptabent __P((struct dgrptabent *ent));
195extern struct	dgrptabent	*_getdgrprec __P((char *dgroup));
196
197/*
198 * fulldevnm.c
199 */
200extern char	*getfullblkname __P((char *cp));
201extern char	*getfullrawname __P((char *cp));
202
203/*
204 * getdev.c
205 */
206extern char	**getdev __P((char **devices, char **criteria, int options));
207
208/*
209 * getdgrp.c
210 */
211extern char	**getdgrp __P((char **dgroups, char **criteria, int options));
212
213/*
214 * getinput.c
215 */
216extern int	getinput __P((char *s));
217
218/*
219 * getvol.c
220 */
221extern int	getvol __P((char *device, char *label, int options,
222				char *prompt));
223extern int	_getvol __P((char *device, char *label, int options,
224				char *prompt, char *norewind));
225extern void	doremovecmd __P((char *device, int echo));
226
227/*
228 * listdev.c
229 */
230extern char	**listdev __P((char *device));
231
232/*
233 * listdgrp.c
234 */
235extern char	**listdgrp __P((char *dgroup));
236
237/*
238 * memory.c
239 */
240extern long	sysmem __P((void));
241extern long	asysmem __P((void));
242
243/*
244 * pkginfo.c
245 */
246extern int	pkginfo __P((struct pkginfo *info, char *pkginst, ...));
247extern int	fpkginfo __P((struct pkginfo *info, char *pkginst));
248extern char	*fpkginst __P((char *pkg, ...));
249
250/*
251 * pkgnmchk.c
252 */
253extern int	pkgnmchk __P((register char *pkg, register char *spec,
254				int presvr4flg));
255extern void	set_ABI_namelngth __P((void));
256extern int	get_ABI_namelngth __P((void));
257
258/*
259 * pkgparam.c
260 */
261extern char	*fpkgparam __P((FILE *fp, char *param));
262extern char	*pkgparam __P((char *pkg, char *param));
263extern void	set_PKGpaths __P((char *path));
264extern char	*get_PKGLOC __P((void));
265extern char	*get_PKGADM __P((void));
266extern void	set_PKGADM(char *newpath);
267extern void	set_PKGLOC(char *newpath);
268
269/*
270 * putdev.c
271 */
272extern int	_putdevtabrec __P((FILE *stream, struct devtabent *rec));
273extern int	_adddevtabrec __P((char *alias, char **attrval));
274extern int	_moddevtabrec __P((char *device, char **attrval));
275extern int	_rmdevtabrec __P((char *device));
276extern int	_rmdevtabattrs __P((char *device, char **attributes,
277				    char ***notfounds));
278
279/*
280 * putdgrp.c
281 */
282extern int	_putdgrptabrec __P((FILE *stream, struct dgrptabent *rec));
283extern int	_adddgrptabrec __P((char *dgrp, char **members));
284extern int	_rmdgrptabrec __P((char *dgrp));
285extern int	_rmdgrpmems __P((char *dgrp, char **mems, char ***notfounds));
286
287/*
288 * puterror.c
289 */
290extern void	puterror __P((FILE *fp, char *defmesg, char *error));
291
292/*
293 * puthelp.c
294 */
295extern void	puthelp __P((FILE *fp, char *defmesg, char *help));
296
297/*
298 * putprmpt.c
299 */
300extern void	putprmpt __P((FILE *fp, char *prompt, char *choices[],
301				char *defstr));
302
303/*
304 * puttext.c
305 */
306extern int	puttext __P((FILE *fp, char *str, int lmarg, int rmarg));
307
308/*
309 * rdwr_vtoc.c
310 */
311extern int	read_vtoc __P((int fd, struct vtoc *vtoc));
312extern 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