Subversion Repositories SvarDOS

Rev

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

Rev 1043 Rev 1044
Line 722... Line 722...
722
 
722
 
723
 
723
 
724
/* fills fname with the path and filename to the linkfile related to the
724
/* fills fname with the path and filename to the linkfile related to the
725
 * executable link "linkname". returns 0 on success. */
725
 * executable link "linkname". returns 0 on success. */
726
int link_computefname(char *fname, const char *linkname, unsigned short env_seg) {
726
int link_computefname(char *fname, const char *linkname, unsigned short env_seg) {
727
  unsigned short pathlen;
727
  unsigned short pathlen, doserr = 0;
728
 
728
 
729
  /* fetch %DOSDIR% */
729
  /* fetch %DOSDIR% */
730
  pathlen = env_lookup_valcopy(fname, 128, env_seg, "DOSDIR");
730
  pathlen = env_lookup_valcopy(fname, 128, env_seg, "DOSDIR");
731
  if (pathlen == 0) {
731
  if (pathlen == 0) {
732
    nls_outputnl(29,5); /* "%DOSDIR% not defined" */
732
    nls_outputnl(29,5); /* "%DOSDIR% not defined" */
Line 734... Line 734...
734
  }
734
  }
735
 
735
 
736
  /* prep filename: %DOSDIR%\LINKS\PKG.LNK */
736
  /* prep filename: %DOSDIR%\LINKS\PKG.LNK */
737
  if (fname[pathlen - 1] == '\\') pathlen--;
737
  if (fname[pathlen - 1] == '\\') pathlen--;
738
  pathlen += sprintf(fname + pathlen, "\\LINKS");
738
  pathlen += sprintf(fname + pathlen, "\\LINKS");
-
 
739
  /* create \LINKS if not exists */
-
 
740
  if (file_getattr(fname) < 0) {
-
 
741
    _asm {
-
 
742
      push dx
-
 
743
      mov ah, 0x39
-
 
744
      mov dx, fname
-
 
745
      int 0x21
-
 
746
      jnc DONE
-
 
747
      mov doserr, ax
-
 
748
      DONE:
-
 
749
      pop dx
-
 
750
    }
-
 
751
    if (doserr) {
-
 
752
      output(fname);
-
 
753
      output(" - ");
-
 
754
      nls_outputnl(255, doserr);
-
 
755
      return(-1);
-
 
756
    }
-
 
757
  }
739
  /* quit early if dir does not exist */
758
  /* quit early if dir does not exist (or is not a dir) */
740
  if (file_getattr(fname) != DOS_ATTR_DIR) {
759
  if (file_getattr(fname) != DOS_ATTR_DIR) {
741
    output(fname);
760
    output(fname);
742
    output(" - ");
761
    output(" - ");
743
    nls_outputnl(255,3); /* path not found */
762
    nls_outputnl(255,3); /* path not found */
744
    return(-1);
763
    return(-1);