Fix more dialog bugs and core dumps introduced by previous commiter

This commit is contained in:
Andrey A. Chernov 1994-11-19 00:09:00 +00:00
parent bc9c7467df
commit f3dc909d25
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=4662
3 changed files with 27 additions and 31 deletions

View File

@ -155,8 +155,7 @@ clear_mbr(struct mbr *mbr, char *bootcode)
* then clobber any existing bootcode. * then clobber any existing bootcode.
*/ */
sprintf(scratch, "\nLoading MBR code from %s\n", bootcode); TellEm("Loading MBR code from %s", bootcode);
dialog_msgbox(TITLE, scratch, 5, 60, 0);
fd = open(bootcode, O_RDONLY); fd = open(bootcode, O_RDONLY);
if (fd < 0) { if (fd < 0) {
sprintf(errmsg, "Couldn't open boot file %s\n", bootcode); sprintf(errmsg, "Couldn't open boot file %s\n", bootcode);
@ -245,7 +244,7 @@ get_geom_values(int disk)
keypad(window, TRUE); keypad(window, TRUE);
dialog_clear(); dialog_clear_norefresh();
draw_box(window, 0, 0, 9, 40, dialog_attr, border_attr); draw_box(window, 0, 0, 9, 40, dialog_attr, border_attr);
while (key != ESC) { while (key != ESC) {
@ -304,22 +303,20 @@ edit_mbr(int disk)
while (!ok) { while (!ok) {
AskAbort(scratch); AskAbort(scratch);
if (!dialog_yesno(TITLE, if (!dialog_yesno(TITLE,
"Are you sure you wish to proceed ?", "Are you sure you wish to proceed ?",
10, 75)) { -1, -1)) {
dialog_clear();
if (dedicated_mbr(mbr, boot1, &disk_list[disk].lbl) == -1) { if (dedicated_mbr(mbr, boot1, &disk_list[disk].lbl) == -1) {
sprintf(scratch, "\n\nCouldn't create new master boot record.\n\n%s", errmsg); sprintf(scratch, "\n\nCouldn't create new master boot record.\n\n%s", errmsg);
return(-1); return(-1);
} }
ok = 1; ok = 1;
} }
dialog_clear();
} }
} }
sprintf(scratch, "Do you wish to dedicate the whole disk to FreeBSD?\n\nDoing so will overwrite any existing data on the disk."); sprintf(scratch, "Do you wish to dedicate the whole disk to FreeBSD?\n\nDoing so will overwrite any existing data on the disk.");
dialog_clear(); dialog_clear_norefresh();
if (!dialog_yesno(TITLE, scratch, 10, 75)) if (!dialog_yesno(TITLE, scratch, -1, -1))
if (dedicated_mbr(mbr, boot1, &disk_list[disk].lbl) == -1) { if (dedicated_mbr(mbr, boot1, &disk_list[disk].lbl) == -1) {
sprintf(scratch, "\n\nCouldn't dedicate disk to FreeBSD.\n\n %s", errmsg); sprintf(scratch, "\n\nCouldn't dedicate disk to FreeBSD.\n\n %s", errmsg);
return(-1); return(-1);
@ -335,7 +332,7 @@ edit_mbr(int disk)
keypad(window, TRUE); keypad(window, TRUE);
dialog_clear(); dialog_clear_norefresh();
draw_box(window, 0, 0, 24, 79, dialog_attr, border_attr); draw_box(window, 0, 0, 24, 79, dialog_attr, border_attr);
cur_field = 1; cur_field = 1;
@ -380,11 +377,11 @@ edit_mbr(int disk)
beep(); beep();
else else
cur_field = next; cur_field = next;
} }
sprintf(scratch, "Writing a new master boot record can erase the current disk contents.\n\n Are you sure you want to write the new MBR?"); sprintf(scratch, "Writing a new master boot record can erase the current disk contents.\n\n Are you sure you want to write the new MBR?");
dialog_clear(); dialog_clear_norefresh();
if (!dialog_yesno("Write new MBR?", scratch, 10, 75)) { if (!dialog_yesno("Write new MBR?", scratch, -1, -1)) {
sprintf(scratch, "/dev/r%s%dd", disk_list[disk].devconf->dc_name, sprintf(scratch, "/dev/r%s%dd", disk_list[disk].devconf->dc_name,
disk_list[disk].devconf->dc_unit); disk_list[disk].devconf->dc_unit);
if (write_mbr(scratch, mbr) == -1) { if (write_mbr(scratch, mbr) == -1) {

View File

@ -205,14 +205,12 @@ select_disk()
dialog_clear_norefresh(); dialog_clear_norefresh();
if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,no_disks+1), no_disks+1, if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,no_disks+1), no_disks+1,
options, selection)) { options, selection)) {
dialog_clear_norefresh(); sprintf(scratch,"You selected cancel.");
sprintf(scratch,"\n\n\nYou selected cancel\n\n");
AskAbort(scratch); AskAbort(scratch);
valid = 0; valid = 0;
continue;
} }
dialog_clear();
choice = atoi(selection); choice = atoi(selection);
if (choice == no_disks+1) if (choice == no_disks+1)
valid = 1; valid = 1;
@ -222,6 +220,7 @@ select_disk()
else else
disk_list[choice-1].selected = 1; disk_list[choice-1].selected = 1;
} while (!valid); } while (!valid);
dialog_clear();
return(0); return(0);
} }
@ -256,31 +255,33 @@ configure_disks()
dialog_clear_norefresh(); dialog_clear_norefresh();
if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,items), items, if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,items), items,
options, selection)) { options, selection)) {
dialog_clear_norefresh(); sprintf(scratch,"You selected cancel.");
sprintf(scratch,"\n\n\nYou selected cancel\n\n");
AskAbort(scratch); AskAbort(scratch);
valid = 0; valid = 0;
continue;
} }
dialog_clear();
choice = atoi(selection); choice = atoi(selection);
if (choice == items) if (choice == items)
valid = 1; valid = 1;
else { else {
if (edit_mbr(disks[choice-1]) == -1) { if (edit_mbr(disks[choice-1]) == -1) {
sprintf(scratch, "The following error occured while\nediting the master boot record.\n\n%s", errmsg); sprintf(scratch, "The following error occured while\nediting the master boot record.\n%s", errmsg);
AskAbort(scratch); AskAbort(scratch);
valid = 0; valid = 0;
continue;
}; };
disk_list[disks[choice-1]].inst_part = select_partition(disks[choice-1]); disk_list[disks[choice-1]].inst_part = select_partition(disks[choice-1]);
if (edit_disklabel(disks[choice-1]) == -1) { if (edit_disklabel(disks[choice-1]) == -1) {
sprintf(scratch, "The following error occured while\nediting the disklabel.\n\n%s", errmsg); sprintf(scratch, "The following error occured while\nediting the disklabel.\n%s", errmsg);
AskAbort(scratch); AskAbort(scratch);
valid = 0; valid = 0;
continue;
} }
} }
} while (!valid); } while (!valid);
dialog_clear();
} }
int int
select_partition(int disk) select_partition(int disk)
{ {
@ -302,7 +303,6 @@ select_partition(int disk)
if (dialog_menu(TITLE, if (dialog_menu(TITLE,
scratch, -1, -1, 4, 4, options, selection)) { scratch, -1, -1, 4, 4, options, selection)) {
sprintf(scratch,"You did not select a valid partition"); sprintf(scratch,"You did not select a valid partition");
dialog_clear_norefresh();
AskAbort(scratch); AskAbort(scratch);
valid = 0; valid = 0;
} }

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* *
* $Id: utils.c,v 1.29 1994/11/17 19:44:55 ache Exp $ * $Id: utils.c,v 1.30 1994/11/17 23:36:49 ache Exp $
* *
*/ */
@ -99,19 +99,18 @@ AskAbort(char *fmt, ...)
va_start(ap,fmt); va_start(ap,fmt);
vsnprintf(p, 2048, fmt, ap); vsnprintf(p, 2048, fmt, ap);
va_end(ap); va_end(ap);
strcat(p, "\n\nDo you wish to abort the installation?"); strcat(p, "\nDo you wish to abort the installation?");
if (!dialog_yesno("Abort", p, -1, -1)) { if (!dialog_yesno("Abort", p, -1, -1))
dialog_clear_norefresh();
Abort(); Abort();
} else
dialog_clear(); dialog_clear();
free(p); free(p);
} }
void void
Abort() Abort()
{ {
if (dialog_yesno("Exit sysinstall","\n\nAre you sure you want to quit?", if (dialog_yesno("Exit sysinstall","Are you sure you want to quit?",
-1, -1)) { -1, -1)) {
dialog_clear(); dialog_clear();
return; return;