Subversion Repositories SvarDOS

Rev

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

Rev 1659 Rev 1661
Line 31... Line 31...
31
#include <stdio.h>   /* printf() and friends */
31
#include <stdio.h>   /* printf() and friends */
32
#include <stdlib.h>  /* system() */
32
#include <stdlib.h>  /* system() */
33
#include <string.h>  /* memcpy() */
33
#include <string.h>  /* memcpy() */
34
#include <unistd.h>
34
#include <unistd.h>
35
 
35
 
-
 
36
#include "mdr\dos.h"
36
#include "svarlang.lib\svarlang.h"
37
#include "svarlang.lib\svarlang.h"
37
 
38
 
38
#include "input.h"
-
 
39
#include "video.h"
39
#include "video.h"
40
 
40
 
41
/* keyboard layouts and locales */
41
/* keyboard layouts and locales */
42
#include "keylay.h"
42
#include "keylay.h"
43
#include "keyoff.h"
43
#include "keyoff.h"
Line 190... Line 190...
190
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECT[mono], list[i + offset], width);
190
        video_putstringfix(ypos + 1 + i, xpos+1, COLOR_SELECT[mono], list[i + offset], width);
191
      } else {
191
      } else {
192
        video_putcharmulti(ypos + 1 + i, xpos, COLOR_SELECT[mono], ' ', width+2, 1);
192
        video_putcharmulti(ypos + 1 + i, xpos, COLOR_SELECT[mono], ' ', width+2, 1);
193
      }
193
      }
194
    }
194
    }
195
    key = input_getkey();
195
    key = mdr_dos_getkey();
196
    if (key == 0x0D) { /* ENTER */
196
    if (key == 0x0D) { /* ENTER */
197
      return(res);
197
      return(res);
198
    } else if (key == 0x148) { /* up */
198
    } else if (key == 0x148) { /* up */
199
      if (res > 0) {
199
      if (res > 0) {
200
        res--;
200
        res--;
Line 547... Line 547...
547
      sprintf(buff, "FDISK /LOADIPL %d", driveid);
547
      sprintf(buff, "FDISK /LOADIPL %d", driveid);
548
      system(buff); /* writes BOOT.MBR into actual MBR */
548
      system(buff); /* writes BOOT.MBR into actual MBR */
549
      newscreen(2);
549
      newscreen(2);
550
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1); /* "Your computer will reboot now." */
550
      putstringnls(10, 10, COLOR_BODY[mono], 3, 1); /* "Your computer will reboot now." */
551
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
551
      putstringnls(12, 10, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
552
      input_getkey();
552
      mdr_dos_getkey();
553
      reboot();
553
      reboot();
554
      return(MENUQUIT);
554
      return(MENUQUIT);
555
    } else if (driveremovable > 0) {
555
    } else if (driveremovable > 0) {
556
      newscreen(2);
556
      newscreen(2);
557
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
557
      snprintf(buff, sizeof(buff), svarlang_strid(0x0302), cselecteddrive); /* "ERROR: Drive %c: is a removable device */
Line 586... Line 586...
586
      int y = 9;
586
      int y = 9;
587
      newscreen(2);
587
      newscreen(2);
588
      snprintf(buff, sizeof(buff), svarlang_strid(0x0304), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB." */
588
      snprintf(buff, sizeof(buff), svarlang_strid(0x0304), cselecteddrive, SVARDOS_DISK_REQ); /* "ERROR: Drive %c: is not big enough! SvarDOS requires a disk of at least %d MiB." */
589
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
589
      y += putstringwrap(y, 1, COLOR_BODY[mono], buff);
590
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
590
      putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
591
      input_getkey();
591
      mdr_dos_getkey();
592
      return(MENUQUIT);
592
      return(MENUQUIT);
593
    }
593
    }
594
    /* is the disk empty? */
594
    /* is the disk empty? */
595
    newscreen(0);
595
    newscreen(0);
596
    if (diskempty(selecteddrive) != 0) {
596
    if (diskempty(selecteddrive) != 0) {
Line 754... Line 754...
754
  newscreen(3);
754
  newscreen(3);
755
  /* load pkg list */
755
  /* load pkg list */
756
  fd = fopen("install.lst", "rb");
756
  fd = fopen("install.lst", "rb");
757
  if (fd == NULL) {
757
  if (fd == NULL) {
758
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST NOT FOUND", -1);
758
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST NOT FOUND", -1);
759
    input_getkey();
759
    mdr_dos_getkey();
760
    return(-1);
760
    return(-1);
761
  }
761
  }
762
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
762
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
763
  fclose(fd);
763
  fclose(fd);
764
  if (pkglistflen == sizeof(pkglist) - 2) {
764
  if (pkglistflen == sizeof(pkglist) - 2) {
765
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST TOO LARGE", -1);
765
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST TOO LARGE", -1);
766
    input_getkey();
766
    mdr_dos_getkey();
767
    return(-1);
767
    return(-1);
768
  }
768
  }
769
  /* mark the end of list */
769
  /* mark the end of list */
770
  pkglist[pkglistflen] = 0;
770
  pkglist[pkglistflen] = 0;
771
  pkglist[pkglistflen + 1] = 0xff;
771
  pkglist[pkglistflen + 1] = 0xff;
Line 812... Line 812...
812
      while (*pkgptr != 0) pkgptr++;
812
      while (*pkgptr != 0) pkgptr++;
813
      while (*pkgptr == 0) pkgptr++;
813
      while (*pkgptr == 0) pkgptr++;
814
      /* end of list? ask for next floppy, there's nothing interesting left on this one */
814
      /* end of list? ask for next floppy, there's nothing interesting left on this one */
815
      if (*pkgptr == 0xff) {
815
      if (*pkgptr == 0xff) {
816
        putstringnls(12, 1, COLOR_BODY[mono], 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
816
        putstringnls(12, 1, COLOR_BODY[mono], 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
817
        input_getkey();
817
        mdr_dos_getkey();
818
        video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
818
        video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
819
        goto RETRY_ENTIRE_LIST;
819
        goto RETRY_ENTIRE_LIST;
820
      }
820
      }
821
      goto TRY_NEXTPKG;
821
      goto TRY_NEXTPKG;
822
    }
822
    }
Line 828... Line 828...
828
 
828
 
829
    /* proceed with package copy */
829
    /* proceed with package copy */
830
    sprintf(buff, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
830
    sprintf(buff, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
831
    if (fcopy(buff, buff + 7, buff, sizeof(buff)) != 0) {
831
    if (fcopy(buff, buff + 7, buff, sizeof(buff)) != 0) {
832
      video_putstring(10, 30, COLOR_BODY[mono], "READ ERROR", -1);
832
      video_putstring(10, 30, COLOR_BODY[mono], "READ ERROR", -1);
833
      input_getkey();
833
      mdr_dos_getkey();
834
      fclose(fd);
834
      fclose(fd);
835
      return(-1);
835
      return(-1);
836
    }
836
    }
837
    /* write install instruction to post-install script */
837
    /* write install instruction to post-install script */
838
    fprintf(fd, "pkg install %s.svp\r\ndel %s.svp\r\n", pkgptr, pkgptr);
838
    fprintf(fd, "pkg install %s.svp\r\ndel %s.svp\r\n", pkgptr, pkgptr);
Line 880... Line 880...
880
static void finalreboot(void) {
880
static void finalreboot(void) {
881
  int y = 9;
881
  int y = 9;
882
  newscreen(2);
882
  newscreen(2);
883
  y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0); /* "Your computer will reboot now.\nPlease remove the installation disk from your drive" */
883
  y += putstringnls(y, 1, COLOR_BODY[mono], 5, 0); /* "Your computer will reboot now.\nPlease remove the installation disk from your drive" */
884
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
884
  putstringnls(++y, 1, COLOR_BODY[mono], 0, 5); /* "Press any key..." */
885
  input_getkey();
885
  mdr_dos_getkey();
886
  reboot();
886
  reboot();
887
}
887
}
888
 
888
 
889
 
889
 
890
static void loadcp(const struct slocales *locales) {
890
static void loadcp(const struct slocales *locales) {