Line 161... |
Line 161... |
161 |
if (fd2 != NULL) fclose(fd2);
|
161 |
if (fd2 != NULL) fclose(fd2);
|
162 |
return(res);
|
162 |
return(res);
|
163 |
}
|
163 |
}
|
164 |
|
164 |
|
165 |
|
165 |
|
166 |
static int menuselect(unsigned char ypos, int xpos, unsigned char height, const char **list, int listlen) {
|
166 |
static int menuselect(unsigned char ypos, unsigned char height, const char **list, int maxlistlen) {
|
167 |
int i, offset = 0, res = 0, count, width = 0;
|
167 |
int i, offset = 0, res = 0, count;
|
168 |
unsigned char y;
|
168 |
unsigned char y, xpos, width = 0;
|
169 |
|
169 |
|
170 |
/* count how many positions there is, and check their width */
|
170 |
/* count how many positions there is, and check their width */
|
171 |
for (count = 0; (list[count] != NULL) && (count != listlen); count++) {
|
171 |
for (count = 0; (list[count] != NULL) && (count != maxlistlen); count++) {
|
172 |
int len = strlen(list[count]);
|
172 |
int len = strlen(list[count]);
|
173 |
if (len > width) width = len;
|
173 |
if (len > width) width = len;
|
174 |
}
|
174 |
}
|
175 |
|
175 |
|
176 |
/* if xpos negative, means 'center out' */
|
176 |
/* if xpos negative, means 'center out' */
|
177 |
if (xpos < 0) xpos = 39 - (width >> 1);
|
177 |
xpos = 39 - (width >> 1);
|
178 |
|
178 |
|
179 |
mdr_cout_char(ypos, xpos+width+2, 0xBF, COLOR_SELECT); /* \ */
|
179 |
mdr_cout_char(ypos, xpos+width+2, 0xBF, COLOR_SELECT); /* \ */
|
180 |
mdr_cout_char(ypos, xpos-1, 0xDA, COLOR_SELECT); /* / */
|
180 |
mdr_cout_char(ypos, xpos-1, 0xDA, COLOR_SELECT); /* / */
|
181 |
mdr_cout_char(ypos+height-1, xpos-1, 0xC0, COLOR_SELECT); /* \ */
|
181 |
mdr_cout_char(ypos+height-1, xpos-1, 0xC0, COLOR_SELECT); /* \ */
|
182 |
mdr_cout_char(ypos+height-1, xpos+width+2, 0xD9, COLOR_SELECT);/* / */
|
182 |
mdr_cout_char(ypos+height-1, xpos+width+2, 0xD9, COLOR_SELECT);/* / */
|
Line 303... |
Line 303... |
303 |
putstringwrap(8, 1, COLOR_BODY, msg);
|
303 |
putstringwrap(8, 1, COLOR_BODY, msg);
|
304 |
} else {
|
304 |
} else {
|
305 |
mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
|
305 |
mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
|
306 |
}
|
306 |
}
|
307 |
|
307 |
|
308 |
choice = menuselect(11, -1, 11, langlist, -1);
|
308 |
choice = menuselect(11, 11, langlist, -1);
|
309 |
if (choice < 0) return(MENUPREV);
|
309 |
if (choice < 0) return(MENUPREV);
|
310 |
/* populate locales with default values */
|
310 |
/* populate locales with default values */
|
311 |
memset(locales, 0, sizeof(struct slocales));
|
311 |
memset(locales, 0, sizeof(struct slocales));
|
312 |
switch (choice) {
|
312 |
switch (choice) {
|
313 |
case 1:
|
313 |
case 1:
|
Line 373... |
Line 373... |
373 |
if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
|
373 |
if (locales->keyblen == 1) return(MENUNEXT); /* do not ask for keyboard layout if only one is available for given language */
|
374 |
newscreen(0);
|
374 |
newscreen(0);
|
375 |
putstringnls(5, 1, COLOR_BODY, 1, 5); /* "SvarDOS supports different keyboard layouts */
|
375 |
putstringnls(5, 1, COLOR_BODY, 1, 5); /* "SvarDOS supports different keyboard layouts */
|
376 |
menuheight = locales->keyblen + 2;
|
376 |
menuheight = locales->keyblen + 2;
|
377 |
if (menuheight > 13) menuheight = 13;
|
377 |
if (menuheight > 13) menuheight = 13;
|
378 |
choice = menuselect(10, -1, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
|
378 |
choice = menuselect(10, menuheight, &(kblayouts[locales->keyboff]), locales->keyblen);
|
379 |
if (choice < 0) return(MENUPREV);
|
379 |
if (choice < 0) return(MENUPREV);
|
380 |
/* (re)load the keyboard layout & codepage setup */
|
380 |
/* (re)load the keyboard layout & codepage setup */
|
381 |
locales->keyboff += choice;
|
381 |
locales->keyboff += choice;
|
382 |
kblay2slocal(locales);
|
382 |
kblay2slocal(locales);
|
383 |
return(MENUNEXT);
|
383 |
return(MENUNEXT);
|
Line 391... |
Line 391... |
391 |
choice[0] = svarlang_strid(0x0001);
|
391 |
choice[0] = svarlang_strid(0x0001);
|
392 |
choice[1] = svarlang_strid(0x0002);
|
392 |
choice[1] = svarlang_strid(0x0002);
|
393 |
choice[2] = NULL;
|
393 |
choice[2] = NULL;
|
394 |
newscreen(0);
|
394 |
newscreen(0);
|
395 |
putstringnls(4, 1, COLOR_BODY, 2, 0); /* "You are about to install SvarDOS */
|
395 |
putstringnls(4, 1, COLOR_BODY, 2, 0); /* "You are about to install SvarDOS */
|
396 |
c = menuselect(13, -1, 4, choice, -1);
|
396 |
c = menuselect(13, 4, choice, -1);
|
397 |
if (c < 0) return(MENUPREV);
|
397 |
if (c < 0) return(MENUPREV);
|
398 |
if (c == 0) return(MENUNEXT);
|
398 |
if (c == 0) return(MENUNEXT);
|
399 |
return(MENUQUIT);
|
399 |
return(MENUQUIT);
|
400 |
}
|
400 |
}
|
401 |
|
401 |
|
Line 545... |
Line 545... |
545 |
list[0] = svarlang_str(0, 3); /* Create a partition automatically */
|
545 |
list[0] = svarlang_str(0, 3); /* Create a partition automatically */
|
546 |
list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
|
546 |
list[1] = svarlang_str(0, 4); /* Run the FDISK tool */
|
547 |
list[2] = svarlang_str(0, 2); /* Quit to DOS */
|
547 |
list[2] = svarlang_str(0, 2); /* Quit to DOS */
|
548 |
list[3] = NULL;
|
548 |
list[3] = NULL;
|
549 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0300), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: could not be found. Note, that SvarDOS requires at least %d MiB of available disk space */
|
549 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0300), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: could not be found. Note, that SvarDOS requires at least %d MiB of available disk space */
|
550 |
switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY, buff), -1, 5, list, -1)) {
|
550 |
switch (menuselect(6 + putstringwrap(4, 1, COLOR_BODY, buff), 5, list, -1)) {
|
551 |
case 0:
|
551 |
case 0:
|
552 |
sprintf(buff, "FDISK /PRI:MAX %d", driveid);
|
552 |
sprintf(buff, "FDISK /PRI:MAX %d", driveid);
|
553 |
system(buff);
|
553 |
system(buff);
|
554 |
break;
|
554 |
break;
|
555 |
case 1:
|
555 |
case 1:
|
Line 590... |
Line 590... |
590 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
|
590 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
|
591 |
list[0] = buff;
|
591 |
list[0] = buff;
|
592 |
list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
|
592 |
list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
|
593 |
list[2] = NULL;
|
593 |
list[2] = NULL;
|
594 |
|
594 |
|
595 |
choice = menuselect(12, -1, 4, list, -1);
|
595 |
choice = menuselect(12, 4, list, -1);
|
596 |
if (choice < 0) return(MENUPREV);
|
596 |
if (choice < 0) return(MENUPREV);
|
597 |
if (choice == 1) return(MENUQUIT);
|
597 |
if (choice == 1) return(MENUQUIT);
|
598 |
mdr_cout_cls(0x07);
|
598 |
mdr_cout_cls(0x07);
|
599 |
mdr_cout_locate(0, 0);
|
599 |
mdr_cout_locate(0, 0);
|
600 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
600 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
Line 623... |
Line 623... |
623 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
|
623 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0007), cselecteddrive); /* "Format drive %c:" */
|
624 |
list[0] = buff;
|
624 |
list[0] = buff;
|
625 |
list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
|
625 |
list[1] = svarlang_strid(0x0002); /* "Quit to DOS" */
|
626 |
list[2] = NULL;
|
626 |
list[2] = NULL;
|
627 |
|
627 |
|
628 |
choice = menuselect(++y, -1, 4, list, -1);
|
628 |
choice = menuselect(++y, 4, list, -1);
|
629 |
if (choice < 0) return(MENUPREV);
|
629 |
if (choice < 0) return(MENUPREV);
|
630 |
if (choice == 1) return(MENUQUIT);
|
630 |
if (choice == 1) return(MENUQUIT);
|
631 |
mdr_cout_cls(0x07);
|
631 |
mdr_cout_cls(0x07);
|
632 |
mdr_cout_locate(0, 0);
|
632 |
mdr_cout_locate(0, 0);
|
633 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
633 |
snprintf(buff, sizeof(buff), "FORMAT %c: /Q /U /Z:seriously /V:SVARDOS", cselecteddrive);
|
Line 639... |
Line 639... |
639 |
list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
|
639 |
list[0] = svarlang_strid(0x0001); /* Install SvarDOS */
|
640 |
list[1] = svarlang_strid(0x0002); /* Quit to DOS */
|
640 |
list[1] = svarlang_strid(0x0002); /* Quit to DOS */
|
641 |
list[2] = NULL;
|
641 |
list[2] = NULL;
|
642 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
|
642 |
snprintf(buff, sizeof(buff), svarlang_strid(0x0306), cselecteddrive); /* "The installation of SvarDOS to %c: is about to begin." */
|
643 |
mdr_cout_str(7, 40 - strlen(buff), buff, COLOR_BODY, 80);
|
643 |
mdr_cout_str(7, 40 - strlen(buff), buff, COLOR_BODY, 80);
|
644 |
choice = menuselect(10, -1, 4, list, -1);
|
644 |
choice = menuselect(10, 4, list, -1);
|
645 |
if (choice < 0) return(MENUPREV);
|
645 |
if (choice < 0) return(MENUPREV);
|
646 |
if (choice == 1) return(MENUQUIT);
|
646 |
if (choice == 1) return(MENUQUIT);
|
647 |
snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
|
647 |
snprintf(buff, sizeof(buff), "SYS %c: %c: > NUL", sourcedrv, cselecteddrive);
|
648 |
system(buff);
|
648 |
system(buff);
|
649 |
sprintf(buff, "FDISK /MBR %d", driveid);
|
649 |
sprintf(buff, "FDISK /MBR %d", driveid);
|