1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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.
*/
sprintf(scratch, "\nLoading MBR code from %s\n", bootcode);
dialog_msgbox(TITLE, scratch, 5, 60, 0);
TellEm("Loading MBR code from %s", bootcode);
fd = open(bootcode, O_RDONLY);
if (fd < 0) {
sprintf(errmsg, "Couldn't open boot file %s\n", bootcode);
@ -245,7 +244,7 @@ get_geom_values(int disk)
keypad(window, TRUE);
dialog_clear();
dialog_clear_norefresh();
draw_box(window, 0, 0, 9, 40, dialog_attr, border_attr);
while (key != ESC) {
@ -304,22 +303,20 @@ edit_mbr(int disk)
while (!ok) {
AskAbort(scratch);
if (!dialog_yesno(TITLE,
"Are you sure you wish to proceed ?",
10, 75)) {
dialog_clear();
"Are you sure you wish to proceed ?",
-1, -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);
return(-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.");
dialog_clear();
if (!dialog_yesno(TITLE, scratch, 10, 75))
dialog_clear_norefresh();
if (!dialog_yesno(TITLE, scratch, -1, -1))
if (dedicated_mbr(mbr, boot1, &disk_list[disk].lbl) == -1) {
sprintf(scratch, "\n\nCouldn't dedicate disk to FreeBSD.\n\n %s", errmsg);
return(-1);
@ -335,7 +332,7 @@ edit_mbr(int disk)
keypad(window, TRUE);
dialog_clear();
dialog_clear_norefresh();
draw_box(window, 0, 0, 24, 79, dialog_attr, border_attr);
cur_field = 1;
@ -380,11 +377,11 @@ edit_mbr(int disk)
beep();
else
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?");
dialog_clear();
if (!dialog_yesno("Write new MBR?", scratch, 10, 75)) {
dialog_clear_norefresh();
if (!dialog_yesno("Write new MBR?", scratch, -1, -1)) {
sprintf(scratch, "/dev/r%s%dd", disk_list[disk].devconf->dc_name,
disk_list[disk].devconf->dc_unit);
if (write_mbr(scratch, mbr) == -1) {

View File

@ -205,14 +205,12 @@ select_disk()
dialog_clear_norefresh();
if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,no_disks+1), no_disks+1,
options, selection)) {
dialog_clear_norefresh();
sprintf(scratch,"\n\n\nYou selected cancel\n\n");
sprintf(scratch,"You selected cancel.");
AskAbort(scratch);
valid = 0;
continue;
}
dialog_clear();
choice = atoi(selection);
if (choice == no_disks+1)
valid = 1;
@ -222,6 +220,7 @@ select_disk()
else
disk_list[choice-1].selected = 1;
} while (!valid);
dialog_clear();
return(0);
}
@ -256,31 +255,33 @@ configure_disks()
dialog_clear_norefresh();
if (dialog_menu("FreeBSD Installation", scratch, -1, -1, min(5,items), items,
options, selection)) {
dialog_clear_norefresh();
sprintf(scratch,"\n\n\nYou selected cancel\n\n");
sprintf(scratch,"You selected cancel.");
AskAbort(scratch);
valid = 0;
continue;
}
dialog_clear();
choice = atoi(selection);
if (choice == items)
valid = 1;
else {
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);
valid = 0;
continue;
};
disk_list[disks[choice-1]].inst_part = select_partition(disks[choice-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);
valid = 0;
continue;
}
}
} while (!valid);
dialog_clear();
}
int
select_partition(int disk)
{
@ -302,7 +303,6 @@ select_partition(int disk)
if (dialog_menu(TITLE,
scratch, -1, -1, 4, 4, options, selection)) {
sprintf(scratch,"You did not select a valid partition");
dialog_clear_norefresh();
AskAbort(scratch);
valid = 0;
}

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.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);
vsnprintf(p, 2048, fmt, ap);
va_end(ap);
strcat(p, "\n\nDo you wish to abort the installation?");
if (!dialog_yesno("Abort", p, -1, -1)) {
dialog_clear_norefresh();
strcat(p, "\nDo you wish to abort the installation?");
if (!dialog_yesno("Abort", p, -1, -1))
Abort();
}
dialog_clear();
else
dialog_clear();
free(p);
}
void
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)) {
dialog_clear();
return;