Subversion Repositories SvarDOS

Rev

Rev 1668 | Rev 1671 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1668 Rev 1669
Line 94... Line 94...
94
  *rstaddr = 0x1234; /* 0x1234 = warm boot, 0 = cold boot */
94
  *rstaddr = 0x1234; /* 0x1234 = warm boot, 0 = cold boot */
95
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
95
  (*bootroutine)(); /* jump to the BIOS reboot routine at FFFF:0000 */
96
}
96
}
97
 
97
 
98
 
98
 
-
 
99
/* returns 1 if file exists, zero otherwise */
-
 
100
static int fileexists(const char *fname) {
-
 
101
  FILE *fd;
-
 
102
  fd = fopen(fname, "rb");
-
 
103
  if (fd == NULL) return(0);
-
 
104
  fclose(fd);
-
 
105
  return(1);
-
 
106
}
-
 
107
 
-
 
108
 
99
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
109
/* outputs a string to screen with taking care of word wrapping. returns amount of lines. */
100
static unsigned char putstringwrap(unsigned char y, unsigned char x, unsigned char attr, const char *s) {
110
static unsigned char putstringwrap(unsigned char y, unsigned char x, unsigned char attr, const char *s) {
101
  unsigned char linew, lincount;
111
  unsigned char linew, lincount;
102
  linew = 80 - (x << 1);
112
  linew = 80 - (x << 1);
103
 
113
 
Line 308... Line 318...
308
    "Swedish",
318
    "Swedish",
309
    "Turkish",
319
    "Turkish",
310
    NULL
320
    NULL
311
  };
321
  };
312
 
322
 
-
 
323
  /* do not ask for language on non-multilang setups */
-
 
324
  if (!fileexists("INSTALL.LNG")) {
-
 
325
    choice = 0;
-
 
326
    goto SkipLangSelect;
-
 
327
  }
-
 
328
 
313
  newscreen(1);
329
  newscreen(1);
314
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
330
  msg = svarlang_strid(0x0100); /* "Welcome to SvarDOS" */
315
  x = 40 - (strlen(msg) >> 1);
331
  x = 40 - (strlen(msg) >> 1);
316
  mdr_cout_str(4, x, msg, COLOR_BODY, 80);
332
  mdr_cout_str(4, x, msg, COLOR_BODY, 80);
317
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
333
  mdr_cout_char_rep(5, x, '=', COLOR_BODY, strlen(msg));
Line 324... Line 340...
324
    mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
340
    mdr_cout_str(8, 40 - (strlen(msg) / 2), msg, COLOR_BODY, 80);
325
  }
341
  }
326
 
342
 
327
  choice = menuselect(11, 9, langlist, -1);
343
  choice = menuselect(11, 9, langlist, -1);
328
  if (choice < 0) return(MENUPREV);
344
  if (choice < 0) return(MENUPREV);
-
 
345
 
-
 
346
  SkipLangSelect:
-
 
347
 
329
  /* populate locales with default values */
348
  /* populate locales with default values */
330
  memset(locales, 0, sizeof(struct slocales));
349
  memset(locales, 0, sizeof(struct slocales));
331
  switch (choice) {
350
  switch (choice) {
332
    case 1:
351
    case 1:
333
      strcpy(locales->lang, "BR");
352
      strcpy(locales->lang, "BR");
Line 486... Line 505...
486
  int86(0x21, &r, &r);
505
  int86(0x21, &r, &r);
487
  return(r.h.al);
506
  return(r.h.al);
488
}
507
}
489
 
508
 
490
 
509
 
491
/* returns 0 if file exists, non-zero otherwise */
-
 
492
static int fileexists(const char *fname) {
-
 
493
  FILE *fd;
-
 
494
  fd = fopen(fname, "rb");
-
 
495
  if (fd == NULL) return(-1);
-
 
496
  fclose(fd);
-
 
497
  return(0);
-
 
498
}
-
 
499
 
-
 
500
 
-
 
501
/* tries to write an empty file to drive.
510
/* tries to write an empty file to drive.
502
 * asks DOS to inhibit the int 24h handler for this job, so erros are
511
 * asks DOS to inhibit the int 24h handler for this job, so erros are
503
 * gracefully reported - unfortunately this does not work under FreeDOS because
512
 * gracefully reported - unfortunately this does not work under FreeDOS because
504
 * the DOS-C kernel does not implement the required flag.
513
 * the DOS-C kernel does not implement the required flag.
505
 * returns 0 on success (ie. "disk exists and is writeable"). */
514
 * returns 0 on success (ie. "disk exists and is writeable"). */
Line 846... Line 855...
846
    if (*pkgptr == 0xff) break; /* end of list: means all packages have been processed */
855
    if (*pkgptr == 0xff) break; /* end of list: means all packages have been processed */
847
 
856
 
848
    /* is this package present on the floppy disk? */
857
    /* is this package present on the floppy disk? */
849
    TRY_NEXTPKG:
858
    TRY_NEXTPKG:
850
    sprintf(buff, "%s.svp", pkgptr);
859
    sprintf(buff, "%s.svp", pkgptr);
851
    if (fileexists(buff) != 0) {
860
    if (!fileexists(buff)) {
852
      while (*pkgptr != 0) pkgptr++;
861
      while (*pkgptr != 0) pkgptr++;
853
      while (*pkgptr == 0) pkgptr++;
862
      while (*pkgptr == 0) pkgptr++;
854
      /* end of list? ask for next floppy, there's nothing interesting left on this one */
863
      /* end of list? ask for next floppy, there's nothing interesting left on this one */
855
      if (*pkgptr == 0xff) {
864
      if (*pkgptr == 0xff) {
856
        putstringnls(12, 1, COLOR_BODY, 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
865
        putstringnls(12, 1, COLOR_BODY, 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
Line 957... Line 966...
957
/* checks that drive drv contains SvarDOS packages
966
/* checks that drive drv contains SvarDOS packages
958
 * returns 0 if found, non-zero otherwise */
967
 * returns 0 if found, non-zero otherwise */
959
static int checkinstsrc(char drv) {
968
static int checkinstsrc(char drv) {
960
  char fname[16];
969
  char fname[16];
961
  snprintf(fname, sizeof(fname), "%c:\\ATTRIB.SVP", drv);
970
  snprintf(fname, sizeof(fname), "%c:\\ATTRIB.SVP", drv);
962
  return(fileexists(fname));
971
  return(!fileexists(fname));
963
}
972
}
964
#endif
973
#endif
965
 
974
 
966
 
975
 
967
int main(int argc, char **argv) {
976
int main(int argc, char **argv) {
Line 991... Line 1000...
991
  action = selectlang(&locales); /* welcome to svardos, select your language */
1000
  action = selectlang(&locales); /* welcome to svardos, select your language */
992
  if (action != MENUNEXT) goto Quit;
1001
  if (action != MENUNEXT) goto Quit;
993
  loadcp(&locales);
1002
  loadcp(&locales);
994
  svarlang_load("INSTALL.LNG", locales.lang); /* NLS support */
1003
  svarlang_load("INSTALL.LNG", locales.lang); /* NLS support */
995
 
1004
 
996
 SelectKeyb:
-
 
997
  action = selectkeyb(&locales);  /* what keyb layout should we use? */
1005
  action = selectkeyb(&locales);  /* what keyb layout should we use? */
998
  if (action == MENUQUIT) goto Quit;
1006
  if (action == MENUQUIT) goto Quit;
999
  if (action == MENUPREV) goto SelectLang;
1007
  if (action == MENUPREV) {
-
 
1008
    if (!fileexists("INSTALL.LNG")) goto Quit;
-
 
1009
    goto SelectLang;
-
 
1010
  }
1000
 
1011
 
1001
 WelcomeScreen:
1012
 WelcomeScreen:
1002
  action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
1013
  action = welcomescreen(); /* what svardos is, ask whether to run live dos or install */
1003
  if (action == MENUQUIT) goto Quit;
1014
  if (action == MENUQUIT) goto Quit;
1004
  if (action == MENUPREV) {
1015
  if (action == MENUPREV) goto SelectLang;
1005
    if (locales.keyblen > 1) goto SelectKeyb; /* if there is a choice of more than 1 layout, ask for it */
-
 
1006
    goto SelectLang;
-
 
1007
  }
1016
 
1008
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1017
  targetdrv = preparedrive(sourcedrv); /* what drive should we install from? check avail. space */
1009
  if (targetdrv == MENUQUIT) goto Quit;
1018
  if (targetdrv == MENUQUIT) goto Quit;
1010
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1019
  if (targetdrv == MENUPREV) goto WelcomeScreen;
1011
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
1020
  bootfilesgen(targetdrv, &locales); /* generate boot files and other configurations */
1012
  if (installpackages(targetdrv, sourcedrv, &locales, buildstring) != 0) goto Quit;    /* install packages */
1021
  if (installpackages(targetdrv, sourcedrv, &locales, buildstring) != 0) goto Quit;    /* install packages */