sade.h revision 8107
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: sysinstall.h,v 1.1.1.1 1995/04/27 12:50:34 jkh Exp $
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,			/* Fork a shell */
58    MENU_DISPLAY_FILE,			/* Display a file's contents */
59    MENU_SUBMENU,			/* Recurse into another menu */
60    MENU_SYSTEM_COMMAND,		/* Run shell commmand */
61    MENU_SYSTEM_COMMAND_BOX,		/* Same as above, but in prgbox */
62    MENU_SET_VARIABLE,			/* Set an environment/system var */
63    MENU_CALL,				/* Call back a C function */
64    MENU_CANCEL,			/* Cancel out of this menu */
65} DMenuItemType;
66
67typedef struct _dmenuItem {
68    char *title;			/* Our title */
69    char *prompt;			/* Our prompt */
70    DMenuItemType type;			/* What type of item we are */
71    void *ptr;				/* Generic data ptr */
72    int disabled;			/* Are we temporarily disabled? */
73} DMenuItem;
74
75typedef struct _dmenu {
76    char *title;			/* Our title */
77    char *prompt;			/* Our prompt */
78    char *helpline;			/* Line of help at bottom */
79    char *helpfile;			/* Help file for "F1" */
80    DMenuItem *items;			/* Array of menu items */
81} DMenu;
82
83/* A sysconfig variable */
84typedef struct _variable {
85    struct _variable *next;
86    char value[1024];
87} Variable;
88
89
90/* Externs */
91extern int		CpioFD;	  /* The file descriptor for our CPIO floppy */
92extern int		DebugFD;  /* Where diagnostic output goes */
93extern Boolean		OnCDROM;  /* Are we running off of a CDROM? */
94extern Boolean		OnSerial; /* Are we on a serial console? */
95extern Boolean		DialogActive; /* Is the dialog() stuff up? */
96extern Variable		*VarHead; /* The head of the variable chain */
97
98/* All the menus to which forward references exist */
99extern DMenu		MenuDocumenation, MenuInitial, MenuLanguage;
100
101
102/* Prototypes */
103
104/* globals.c */
105extern void	globalsInit(void);
106
107/* install.c */
108extern int	installCustom(void);
109extern int	installExpress(void);
110
111/* system.c */
112extern void	systemInitialize(int argc, char **argv);
113extern void	systemShutdown(void);
114extern void	systemWelcome(void);
115extern int	systemExecute(char *cmd);
116
117/* dmenu.c */
118extern void	dmenuOpen(DMenu *menu, int *choice, int *scroll,
119			  int *curr, int *max);
120
121/* misc.c */
122extern Boolean	file_readable(char *fname);
123extern Boolean	file_executable(char *fname);
124extern char	*string_concat(char *p1, char *p2);
125extern char	*string_prune(char *str);
126extern char	*string_skipwhite(char *str);
127extern void	safe_free(void *ptr);
128extern char	**item_add(char **list, char *item, int *curr, int *max);
129extern void	items_free(char **list, int *curr, int *max);
130
131/* termcap.c */
132extern int	set_termcap(void);
133
134/* msg.c */
135extern void	msgInfo(char *fmt, ...);
136extern void	msgWarn(char *fmt, ...);
137extern void	msgError(char *fmt, ...);
138extern void	msgFatal(char *fmt, ...);
139
140/* media.c */
141extern int	mediaSetCDROM(void);
142
143#endif
144/* _SYSINSTALL_H_INCLUDE */
145