home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s1.arc / INITOVLY.MOD < prev    next >
Text File  |  1988-02-13  |  4KB  |  93 lines

  1. (*----------------------------------------------------------------------*)
  2. (*              InitOvly --- Initialize PibTerm overlays                *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE InitOvly;
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     PROCEDURE:  InitOvly                                             *)
  10. (*                                                                      *)
  11. (*     Purpose:    Initializes PibTerm directory for overlay searches   *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        InitOvly;                                                     *)
  16. (*                                                                      *)
  17. (*     Remarks:                                                         *)
  18. (*                                                                      *)
  19. (*        The PibTerm directory should have been set by a previous      *)
  20. (*        SET PIBTERM=   DOS specification.                             *)
  21. (*                                                                      *)
  22. (*----------------------------------------------------------------------*)
  23.  
  24. VAR
  25.    Ovr_Dir      : AnyStr;
  26.    Ierr         : INTEGER;
  27.    I            : INTEGER;
  28.    Cur_Dir      : AnyStr;
  29.  
  30. (* STRUCTURED *) CONST
  31.    LetSet : SET OF CHAR = ['A'..'Z','a'..'z','\'];
  32.  
  33. BEGIN (* InitOvly *)
  34.                                    (* Get current drive and directory *)
  35.    GetDir( 0 , Cur_Dir );
  36.  
  37.    Ierr := IOResult;
  38.  
  39.    Home_Drive    := Cur_Dir[1];
  40.    Home_Dir_Path := COPY( Cur_Dir, 3, LENGTH( Cur_Dir ) - 2 );
  41.  
  42.                                    (* Search DOS environment for     *)
  43.                                    (* PIBTERM= definition.           *)
  44.  
  45.    Ovr_Dir := GetEnvStr('PIBTERM');
  46.  
  47.                                    (* See if environment string      *)
  48.                                    (* makes sense.                   *)
  49.  
  50.    IF ( LENGTH( Ovr_Dir ) > 0 ) THEN
  51.       IF ( NOT ( Ovr_Dir[1] IN LetSet ) ) THEN
  52.          Ovr_Dir := '';
  53.  
  54.    IF ( LENGTH( Ovr_Dir ) > 0 ) THEN
  55.       BEGIN
  56.                                    (* PIBTERM= found in environment --- *)
  57.                                    (* set home drive and directory      *)
  58.  
  59.          IF ( Ovr_Dir[2] = ':' ) THEN
  60.             BEGIN
  61.                Home_Drive := UpCase( Ovr_Dir[1] );
  62.                IF LENGTH( Ovr_Dir ) > 2 THEN
  63.                   Home_Dir_Path := COPY( Ovr_Dir, 3, LENGTH( Ovr_Dir ) - 2 )
  64.                ELSE
  65.                   Home_Dir_Path := '';
  66.             END
  67.          ELSE
  68.             Home_Dir_Path := Ovr_Dir;
  69.  
  70.       END;
  71.                                    (* Make PibTerm files findable    *)
  72.  
  73.    IF ( LENGTH( Home_Dir_Path ) <> 0 )  THEN
  74.       Home_Dir := Home_Drive + ':\' + Home_Dir_Path + '\'
  75.    ELSE
  76.       Home_Dir := Home_Drive + ':\';
  77.  
  78.    I := POS( '\\' , Home_Dir );
  79.  
  80.    WHILE( I > 0 ) DO
  81.       BEGIN
  82.          DELETE( Home_Dir, I, 1 );
  83.          I := POS( '\\' , Home_Dir );
  84.       END;
  85. {
  86.    WRITELN('Home_Dir      = ',Home_Dir);
  87.    WRITELN('Home_Drive    = ',Home_Drive);
  88.    WRITELN('Home_Dir_Path = ',Home_Dir_Path);
  89.    WRITELN('Ovr_Dir       = ',Ovr_Dir);
  90.    Ch := ReadKey;
  91. }
  92. END    (* InitOvly *);
  93.