program envpath ; const maxpath = 127 ; { enforced by maximum number of console chracters typeable } maxdir = 66 ; { found by repeated md x, cd x until error } maxdiree = 56 ; { maximum length that easyedit will work with } type arraych = array[1..8192] of char ; var curdire : integer ; dirn : string ; envptr : ^arraych ; envx : string ; maxdire : integer ; maxex : integer ; maxfn : integer ; invalid : boolean ; pathlen : integer ; i : integer ; procedure chkfn(filename : string) ; var i : integer ; err : boolean ; begin ; err := false ; if length(filename) > 12 then err := true else begin ; i := pos('.',filename) ; if i = 0 then i := length(filename) + 1 ; if (i > 9) or (length(filename) - i > 3) then err := true ; end ; if pos(' ',filename) <> 0 then err := true ; if err then begin ; writeln('Directory Name - ',filename, ' is invalid') ; invalid := true ; end ; end ; procedure chkdir ; var filenm : string ; i : integer ; begin ; if dirn[2] <> ':' then begin ; invalid := true ; writeln('Second character of diretory not :') ; end else begin ; filenm := '' ; for i := 3 to length(dirn) do begin ; if dirn[i] = '\' then begin ; chkfn(filenm) ; filenm := '' ; end else filenm := filenm + dirn[i] ; end ; chkfn(filenm) ; end ; { writeln ; writeln(dirn) ;} end ; begin if paramcount <> 0 then begin ; writeln ; writeln('CHKPATH checks the valididy of the path created by the NTVDM') ; writeln ; writeln('The validity of the directories in the path are not checked') ; writeln('The legality of the directory names is not checked, only the length') ; halt(1) ; end ; envptr := ptr(word(ptr(prefixseg,$2c)^),0) ; maxdire := 0 ; curdire := 0 ; pathlen := 0 ; dirn := '' ; maxfn := 0 ; maxex := 0 ; invalid := false ; i := 1 ; writeln('Path for 16 bit programs is :-') ; while envptr^[i] <> #0 do begin ; envx := '' ; while envptr^[i] <> #0 do begin ; if copy(envx,1,5) = 'PATH=' then begin ; write(envptr^[i]) ; end ; envx := envx + envptr^[i] ; inc(i) ; end ; inc(i) ; end ; writeln ; i := 1 ; writeln ; while envptr^[i] <> #0 do begin ; envx := '' ; while envptr^[i] <> #0 do begin ; if copy(envx,1,5) = 'PATH=' then begin ; inc(pathlen) ; if envptr^[i] = ';' then begin ; chkdir ; if curdire > maxdire then maxdire := curdire ; curdire := 0 ; dirn := '' ; end else begin ; inc(curdire) ; dirn := dirn + envptr^[i] ; end ; end ; envx := envx + envptr^[i] ; inc(i) ; end ; inc(i) ; end ; chkdir ; if invalid then writeln('Path contains invalid directories') ; write('Length of path = ',pathlen) ; if pathlen > maxpath then write(' <==== Which is longer than the old MSDOS limit of ',maxpath) ; writeln ; write('Maximum Dir name = ',maxdire) ; if maxdire > maxdir then write(' <==== Which is longer than the old MSDOS limit of ',maxdir) ; writeln ; if maxdire > maxdiree then writeln('Maximum dir name is longer than ',maxdiree,' Easyedit will not work') else writeln('Easyedit is likely to work') ; end .