remove unneded includes

use dialog functions properly
move alloc_memory early to prevent core dump at stage 3
Change 25x80 to 24x80
Fix setenv diagnostic
Fix Fatal to call end_dialog()
This commit is contained in:
Andrey A. Chernov 1994-10-20 19:30:56 +00:00
parent 277a25ffe0
commit 35c9f61260
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3739
8 changed files with 35 additions and 39 deletions

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: main.c,v 1.3 1994/10/20 06:14:29 phk Exp $
* $Id: main.c,v 1.4 1994/10/20 06:48:39 phk Exp $
*
*/
@ -18,7 +18,6 @@
#include <fcntl.h>
#include <dialog.h>
#include <ncurses.h>
#include <sys/ioctl.h>
@ -61,6 +60,8 @@ jmp_buf jmp_restart;
* execl("/sbin/init");
*/
extern int alloc_memory();
int
main(int argc, char **argv)
{
@ -86,6 +87,9 @@ main(int argc, char **argv)
/* If we haven't crashed I guess dialog is running ! */
dialog_active = 1;
if (alloc_memory() < 0)
Fatal("No memory\n");
setjmp(jmp_restart);
if (getenv("STAGE0") || !access("/this_is_boot_flp",R_OK)) {
@ -112,7 +116,7 @@ main(int argc, char **argv)
} else if (getenv("STAGE3")) {
stage3();
} else {
fprintf(stderr,"Must setenv STAGE0 or STAGE3");
fprintf(stderr,"Must setenv STAGE0 or STAGE3\n");
}
return 0;
}

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id$
* $Id: stage0.c,v 1.2 1994/10/20 04:59:56 phk Exp $
*
*/
@ -15,7 +15,6 @@
#include <string.h>
#include <unistd.h>
#include <ncurses.h>
#include <dialog.h>
#include "sysinstall.h"
@ -24,11 +23,11 @@ void
stage0()
{
if (!access(README_FILE, R_OK)) {
clear();
dialog_textbox("READ ME FIRST", README_FILE, 25, 80);
dialog_clear();
dialog_textbox("READ ME FIRST", README_FILE, 24, 80);
}
if (!access(COPYRIGHT_FILE, R_OK)) {
clear();
dialog_textbox("COPYRIGHT", COPYRIGHT_FILE, 25, 80);
dialog_clear();
dialog_textbox("COPYRIGHT", COPYRIGHT_FILE, 24, 80);
}
}

View File

@ -20,7 +20,6 @@
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <ncurses.h>
#include <sys/types.h>
#include <sys/errno.h>
@ -189,7 +188,7 @@ select_disk()
AskAbort(scratch);
valid = 0;
}
clear();
dialog_clear();
} while (!valid);
return(atoi(selection) - 1);
}
@ -220,12 +219,12 @@ select_partition(int disk)
AskAbort(scratch);
valid = 0;
}
clear();
dialog_clear();
choice = atoi(selection);
if (!choice)
if (dialog_yesno(TITLE, "Installing to the whole disk will erase all its present data.\n\nAre you sure you want to do this?", 10, 75))
valid = 0;
clear();
dialog_clear();
} while (!valid);
return(atoi(selection) - 1);
@ -238,7 +237,6 @@ stage1()
int ok = 0;
int ready = 0;
alloc_memory();
while (!ready) {
ready = 1;
@ -257,7 +255,7 @@ stage1()
AskAbort(scratch);
if (!dialog_yesno(TITLE, "Are you sure you wish to proceed?",
10, 75)) {
clear();
dialog_clear();
clear_mbr(mbr);
ok = 1;
}
@ -267,7 +265,7 @@ stage1()
if (custom_install)
if (!dialog_yesno(TITLE, "Do you wish to edit the DOS partition table?",
10, 75)) {
clear();
dialog_clear();
edit_mbr(mbr, &avail_disklabels[inst_disk]);
}
@ -281,7 +279,7 @@ stage1()
sprintf(scratch, "The DOS partition table is inconsistent.\n\n%s\n\nDo you wish to edit it by hand?", errmsg);
if (!dialog_yesno(TITLE, scratch, 10, 75)) {
edit_mbr(mbr, &avail_disklabels[inst_disk]);
clear();
dialog_clear();
} else {
AskAbort("");
ok = 1;
@ -300,7 +298,7 @@ stage1()
AskAbort("");
ready = 0;
}
clear();
dialog_clear();
}
}

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: stage2.c,v 1.1 1994/10/20 04:59:58 phk Exp $
* $Id: stage2.c,v 1.2 1994/10/20 06:48:40 phk Exp $
*
*/
@ -18,7 +18,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <ncurses.h>
#include <dialog.h>
#include <errno.h>

View File

@ -6,14 +6,13 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id$
* $Id: stage3.c,v 1.2 1994/10/20 04:59:58 phk Exp $
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <dialog.h>
#include <ncurses.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
@ -136,9 +135,9 @@ stage3()
unlink("/sbin/oinit");
TellEm("link /stand/sysinstall /sbin/init");
link("/stand/sysinstall", "/sbin/init");
clear();
refresh();
endwin();
dialog_clear();
dialog_update();
end_dialog();
close(0);
close(1);
close(2);

View File

@ -20,7 +20,6 @@
#include <string.h>
#include <unistd.h>
#include <stdarg.h>
#include <ncurses.h>
#include <sys/types.h>
#include <sys/errno.h>
@ -76,7 +75,7 @@ abort_installation(char *prompt)
strcat(scratch,"\n\n Do you wish to abort the installation ?");
if (!dialog_yesno("Abort installation ?",scratch,10,75))
exit_prompt();
clear();
dialog_clear();
}
void
@ -85,7 +84,7 @@ exit_prompt()
sprintf(scratch,"Are you sure you want to exit sysinstall?");
if (!dialog_yesno("Exit sysinstall",scratch,10,75))
exit_sysinstall();
clear();
dialog_clear();
}
int
@ -257,7 +256,7 @@ select_disk()
abort_installation(scratch);
valid = 0;
}
clear();
dialog_clear();
} while (!valid);
return(atoi(selection) - 1);
}
@ -288,12 +287,12 @@ select_partition(int disk)
abort_installation(scratch);
valid = 0;
}
clear();
dialog_clear();
choice = atoi(selection);
if (!choice)
if (dialog_yesno(title, "Installing to the whole disk will erase all its present data.\n\nAre you sure you want to do this?", 10, 75))
valid = 0;
clear();
dialog_clear();
} while (!valid);
return(atoi(selection) - 1);
@ -528,7 +527,7 @@ stage1()
abort_installation(scratch);
if (!dialog_yesno(title, "Are you sure you wish to proceed?",
10, 75)) {
clear();
dialog_clear();
clear_mbr(mbr);
ok = 1;
}
@ -538,7 +537,7 @@ stage1()
if (custom_install)
if (!dialog_yesno(title, "Do you wish to edit the DOS partition table?",
10, 75)) {
clear();
dialog_clear();
edit_mbr(mbr, &avail_disklabels[inst_disk]);
}
@ -552,7 +551,7 @@ stage1()
sprintf(scratch, "The DOS partition table is inconsistent.\n\n%s\n\nDo you wish to edit it by hand?", errmsg);
if (!dialog_yesno(title, scratch, 10, 75)) {
edit_mbr(mbr, &avail_disklabels[inst_disk]);
clear();
dialog_clear();
} else {
abort_installation("");
ok = 1;
@ -571,7 +570,7 @@ stage1()
abort_installation("");
ready = 0;
}
clear();
dialog_clear();
}
}

View File

@ -17,8 +17,6 @@
#include <unistd.h>
#include <stdarg.h>
#include <fcntl.h>
#include <dialog.h>
#include <ncurses.h>
#include <machine/console.h>
#include "sysinstall.h"

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: utils.c,v 1.2 1994/10/20 05:00:00 phk Exp $
* $Id: utils.c,v 1.3 1994/10/20 06:48:40 phk Exp $
*
*/
@ -16,7 +16,6 @@
#include <unistd.h>
#include <string.h>
#include <dialog.h>
#include <ncurses.h>
#include <errno.h>
#include <sys/stat.h>
@ -51,6 +50,7 @@ Fatal(char *fmt, ...)
va_end(ap);
dialog_msgbox("Fatal", p, 12, 75, 1);
free(p);
end_dialog();
exit(7);
}