sade.h revision 8098
1/*
2 * The new sysinstall program.
3 *
4 * This is probably the last attempt in the `sysinstall' line, the next
5 * generation being slated to essentially a complete rewrite.
6 *
7 * $Id$
8 *
9 * Copyright (c) 1995
10 *	Jordan Hubbard.  All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer,
17 *    verbatim and that no modifications are made prior to this
18 *    point in the file.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 *    notice, this list of conditions and the following disclaimer in the
21 *    documentation and/or other materials provided with the distribution.
22 * 3. All advertising materials mentioning features or use of this software
23 *    must display the following acknowledgement:
24 *	This product includes software developed by Jordan Hubbard
25 *	for the FreeBSD Project.
26 * 4. The name of Jordan Hubbard or the FreeBSD project may not be used to
27 *    endorse or promote products derived from this software without specific
28 *    prior written permission.
29 *
30 * THIS SOFTWARE IS PROVIDED BY JORDAN HUBBARD ``AS IS'' AND
31 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 * ARE DISCLAIMED.  IN NO EVENT SHALL JORDAN HUBBARD OR HIS PETS BE LIABLE
34 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE.
41 *
42 */
43
44#ifndef _SYSINSTALL_H_INCLUDE
45#define _SYSINSTALL_H_INCLUDE
46
47#include <stdio.h>
48#include <stdlib.h>
49#include <string.h>
50#include <unistd.h>
51#include <dialog.h>
52
53/* Types */
54typedef unsigned int Boolean;
55
56typedef enum {
57    MENU_SHELL_ESCAPE,
58    MENU_DISPLAY_FILE,
59    MENU_SUBMENU,
60    MENU_SYSTEM_COMMAND,
61    MENU_SET_VARIABLE,
62    MENU_CALL
63} DMenuItemType;
64
65typedef struct _dmenuItem {
66    char *title;
67    char *prompt;
68    DMenuItemType type;
69    void *ptr;
70    int disabled;
71} DMenuItem;
72
73typedef struct _dmenu {
74    char *title;
75    char *prompt;
76    char *helpline;
77    char *helpfile;
78    DMenuItem *items;
79} DMenu;
80
81/* A sysconfig variable */
82typedef struct _variable {
83    struct _variable *next;
84    char value[1024];
85} Variable;
86
87
88/* Externs */
89extern int		CpioFD;	  /* The file descriptor for our CPIO floppy */
90extern int		DebugFD;  /* Where diagnostic output goes */
91extern Boolean		OnCDROM;  /* Are we running off of a CDROM? */
92extern Boolean		OnSerial; /* Are we on a serial console? */
93extern Boolean		DialogActive; /* Is the dialog() stuff up? */
94extern Variable		*VarHead; /* The head of the variable chain */
95
96/* All the menus to which forward references exist */
97extern DMenu		MenuDocumenation, MenuInitial, MenuLanguage;
98
99
100/* Prototypes */
101extern void	globalsInit(void);
102
103extern void	installExpress(void);
104extern void	installCustom(void);
105
106extern void	systemInitialize(int argc, char **argv);
107extern void	systemShutdown(void);
108extern void	systemWelcome(void);
109extern int	systemExecute(char *cmd);
110
111extern void	dmenuOpen(DMenu *menu, int *choice, int *scroll,
112			  int *curr, int *max);
113
114extern Boolean	file_readable(char *fname);
115extern Boolean	file_executable(char *fname);
116extern char	*string_concat(char *p1, char *p2);
117extern char	*string_prune(char *str);
118extern char	*string_skipwhite(char *str);
119extern void	safe_free(void *ptr);
120extern char	**item_add(char **list, char *item, int *curr, int *max);
121extern void	items_free(char **list, int *curr, int *max);
122
123extern int	set_termcap(void);
124
125extern void	msgInfo(char *fmt, ...);
126extern void	msgWarn(char *fmt, ...);
127extern void	msgError(char *fmt, ...);
128extern void	msgFatal(char *fmt, ...);
129
130#endif
131/* _SYSINSTALL_H_INCLUDE */
132