Subversion Repositories SvarDOS

Rev

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

Rev 1109 Rev 1125
Line 748... Line 748...
748
  if (fd == NULL) {
748
  if (fd == NULL) {
749
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST NOT FOUND", -1);
749
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST NOT FOUND", -1);
750
    input_getkey();
750
    input_getkey();
751
    return(-1);
751
    return(-1);
752
  }
752
  }
753
  pkglistflen = fread(pkglist, 1, sizeof(pkglist), fd);
753
  pkglistflen = fread(pkglist, 1, sizeof(pkglist) - 2, fd);
754
  fclose(fd);
754
  fclose(fd);
755
  if (pkglistflen == sizeof(pkglist)) {
755
  if (pkglistflen == sizeof(pkglist) - 2) {
756
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST TOO LARGE", -1);
756
    video_putstring(10, 30, COLOR_BODY[mono], "ERROR: INSTALL.LST TOO LARGE", -1);
757
    input_getkey();
757
    input_getkey();
758
    return(-1);
758
    return(-1);
759
  }
759
  }
760
  pkglist[pkglistflen] = 0xff; /* mark the end of list */
760
  /* mark the end of list */
-
 
761
  pkglist[pkglistflen] = 0;
-
 
762
  pkglist[pkglistflen + 1] = 0xff;
761
  /* replace all \r and \n chars by 0 bytes, and count the number of packages */
763
  /* replace all \r and \n chars by 0 bytes, and count the number of packages */
762
  pkglistlen = 0;
764
  pkglistlen = 0;
763
  for (i = 0; i < pkglistflen; i++) {
765
  for (i = 0; i < pkglistflen; i++) {
764
    switch (pkglist[i]) {
766
    switch (pkglist[i]) {
765
      case '\n':
767
      case '\n':
Line 785... Line 787...
785
  fprintf(fd, "COPY \\COMMAND.COM \\CMD.COM\r\n");
787
  fprintf(fd, "COPY \\COMMAND.COM \\CMD.COM\r\n");
786
  fprintf(fd, "SET COMSPEC=%c:\\CMD.COM\r\n", targetdrv);
788
  fprintf(fd, "SET COMSPEC=%c:\\CMD.COM\r\n", targetdrv);
787
  fprintf(fd, "DEL \\COMMAND.COM\r\n");
789
  fprintf(fd, "DEL \\COMMAND.COM\r\n");
788
 
790
 
789
  /* copy packages */
791
  /* copy packages */
790
  pkgptr = pkglist;
-
 
791
  for (i = 0;; i++) {
792
  for (i = 0;; i++) {
-
 
793
    RETRY_ENTIRE_LIST:
-
 
794
 
792
    /* move forward to nearest entry or end of list */
795
    /* move forward to nearest entry or end of list */
-
 
796
    for (pkgptr = pkglist; *pkgptr == 0; pkgptr++);
-
 
797
    if (*pkgptr == 0xff) break; /* end of list: means all packages have been processed */
-
 
798
 
-
 
799
    /* is this package present on the floppy disk? */
-
 
800
    TRY_NEXTPKG:
-
 
801
    sprintf(buff, "%s.svp", pkgptr);
-
 
802
    if (fileexists(buff) != 0) {
-
 
803
      while (*pkgptr != 0) pkgptr++;
793
    while (*pkgptr == 0) pkgptr++;
804
      while (*pkgptr == 0) pkgptr++;
-
 
805
      /* end of list? ask for next floppy, there's nothing interesting left on this one */
794
    if (*pkgptr == 0xff) break;
806
      if (*pkgptr == 0xff) {
-
 
807
        putstringnls(12, 1, COLOR_BODY[mono], 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
-
 
808
        input_getkey();
-
 
809
        video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
-
 
810
        goto RETRY_ENTIRE_LIST;
-
 
811
      }
-
 
812
      goto TRY_NEXTPKG;
-
 
813
    }
-
 
814
 
795
    /* install the package */
815
    /* install the package */
796
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
816
    snprintf(buff, sizeof(buff), svarlang_strid(0x0400), i+1, pkglistlen, pkgptr); /* "Installing package %d/%d: %s" */
797
    strcat(buff, "       ");
817
    strcat(buff, "       ");
798
    video_putstringfix(10, 1, COLOR_BODY[mono], buff, sizeof(buff));
818
    video_putstringfix(10, 1, COLOR_BODY[mono], buff, sizeof(buff));
799
    /* wait for new diskette if package not found */
-
 
800
    snprintf(buff, sizeof(buff), "%c:\\%s.svp", srcdrv, pkgptr);
-
 
801
    while (fileexists(buff) != 0) {
-
 
802
      putstringnls(12, 1, COLOR_BODY[mono], 4, 1); /* "INSERT THE DISK THAT CONTAINS THE REQUIRED FILE AND PRESS ANY KEY" */
-
 
803
      input_getkey();
-
 
804
      video_putstringfix(12, 1, COLOR_BODY[mono], "", 80); /* erase the 'insert disk' message */
-
 
805
    }
819
 
806
    /* proceed with package copy (buff contains the src filename already) */
820
    /* proceed with package copy */
807
    snprintf(buff + 32, sizeof(buff) - 32, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
821
    sprintf(buff, "%c:\\temp\\%s.svp", targetdrv, pkgptr);
808
    if (fcopy(buff + 32, buff, buff, sizeof(buff)) != 0) {
822
    if (fcopy(buff, buff + 7, buff, sizeof(buff)) != 0) {
809
      video_putstring(10, 30, COLOR_BODY[mono], "READ ERROR", -1);
823
      video_putstring(10, 30, COLOR_BODY[mono], "READ ERROR", -1);
810
      input_getkey();
824
      input_getkey();
811
      fclose(fd);
825
      fclose(fd);
812
      return(-1);
826
      return(-1);
813
    }
827
    }
814
    /* write install instruction to post-install script */
828
    /* write install instruction to post-install script */
815
    fprintf(fd, "pkg install %s.svp\r\ndel %s.svp\r\n", pkgptr, pkgptr);
829
    fprintf(fd, "pkg install %s.svp\r\ndel %s.svp\r\n", pkgptr, pkgptr);
816
    /* jump to next entry or end of list */
830
    /* jump to next entry or end of list and zero out the pkg name in the process */
817
    while ((*pkgptr != 0) && (*pkgptr != 0xff)) pkgptr++;
831
    while ((*pkgptr != 0) && (*pkgptr != 0xff)) {
818
    if (*pkgptr == 0xff) break;
832
      *pkgptr = 0;
-
 
833
      pkgptr++;
-
 
834
    }
819
  }
835
  }
820
  /* set up locales so the "installation over" message is nicely displayed */
836
  /* set up locales so the "installation over" message is nicely displayed */
821
  genlocalesconf(fd, locales);
837
  genlocalesconf(fd, locales);
822
  /* replace autoexec.bat and config.sys now and write some nice message on screen */
838
  /* replace autoexec.bat and config.sys now and write some nice message on screen */
823
  fprintf(fd, "DEL pkg.exe\r\n"
839
  fprintf(fd, "DEL pkg.exe\r\n"