home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / PIBTERM.ZIP / PIBDIR.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1987-11-25  |  28.8 KB  |  604 lines

  1. (*----------------------------------------------------------------------*)
  2. (*        DIRMAN.PAS --- MSDOS Directory Routines for Turbo Pascal      *)
  3. (*----------------------------------------------------------------------*)
  4. (*                                                                      *)
  5. (*  Author:  Philip R. Burns                                            *)
  6. (*  Date:    January, 1985                                              *)
  7. (*  Version: 1.0                                                        *)
  8. (*  Systems: For MS-DOS on IBM PCs and close compatibles only.          *)
  9. (*           Note:  I have checked these on Zenith 151s under           *)
  10. (*                  MSDOS 2.1 and IBM PCs under PCDOS 2.0.              *)
  11. (*                                                                      *)
  12. (*  Needs:   Global types from GLOBTYPE.PAS.                            *)
  13. (*                                                                      *)
  14. (*  History: Original with me.                                          *)
  15. (*                                                                      *)
  16. (*           Suggestions for improvements or corrections are welcome.   *)
  17. (*           Please leave messages on Gene Plantz's BBS (312) 882 4145  *)
  18. (*           or Ron Fox's BBS (312) 940 6496.                           *)
  19. (*                                                                      *)
  20. (*           If you use this code in your own programs, please be nice  *)
  21. (*           and give proper credit.                                    *)
  22. (*                                                                      *)
  23. (*----------------------------------------------------------------------*)
  24. (*                                                                      *)
  25. (*  Routines:                                                           *)
  26. (*                                                                      *)
  27. (*      Convert_AsciiZ_To_String                                        *)
  28. (*      Convert_String_To_AsciiZ                                        *)
  29. (*      Dir_Get_Default_Drive                                           *)
  30. (*      Dir_Set_Default_Drive                                           *)
  31. (*      Dir_Get_Current_Path                                            *)
  32. (*      Dir_Set_Current_Path                                            *)
  33. (*      Dir_Set_Disk_Transfer_Address                                   *)
  34. (*      Dir_Delete_File                                                 *)
  35. (*      Dir_Count_Drives                                                *)
  36. (*      Dir_Convert_Time                                                *)
  37. (*      Dir_Convert_Date                                                *)
  38. (*      Dir_Find_First_File                                             *)
  39. (*      Dir_Find_Next_File                                              *)
  40. (*                                                                      *)
  41. (*----------------------------------------------------------------------*)
  42.  
  43. (*----------------------------------------------------------------------*)
  44. (*                  Map of MsDos Directory Entry                        *)
  45. (*----------------------------------------------------------------------*)
  46.  
  47. Type
  48.  
  49.    Directory_Record = Record
  50.                          Filler    : Array[1..21] Of Byte;
  51.                          File_Attr : Byte;
  52.                          File_Time : Integer;
  53.                          File_Date : Integer;
  54.                          File_Size : Array[1..2] Of Integer;
  55.                          File_Name : Array[1..80] Of Char;
  56.                       End;
  57.  
  58. (*----------------------------------------------------------------------*)
  59. (*   Convert_AsciiZ_To_String -- Convert Ascii Z string to Turbo String *)
  60. (*----------------------------------------------------------------------*)
  61.  
  62. Procedure Convert_AsciiZ_To_String( Var S: AnyStr );
  63.  
  64. (*                                                                      *)
  65. (*     Procedure:  Convert_AsciiZ_To_String                             *)
  66. (*                                                                      *)
  67. (*     Purpose:    Convert Ascii Z string to Turbo String               *)
  68. (*                                                                      *)
  69. (*     Calling Sequence:                                                *)
  70. (*                                                                      *)
  71. (*        Convert_AsciiZ_To_String( Var S: AnyStr );                    *)
  72. (*                                                                      *)
  73. (*           S --- Ascii Z string to be turned into Turbo string        *)
  74. (*                                                                      *)
  75. (*     Calls:                                                           *)
  76. (*                                                                      *)
  77. (*        None                                                          *)
  78. (*                                                                      *)
  79. (*     Remarks:                                                         *)
  80. (*                                                                      *)
  81. (*        The string S is assumed to have already received the Ascii Z  *)
  82. (*        string in its [1]st thru [l]th locations.                     *)
  83. (*        This routine searches for the 0-character marking the end of  *)
  84. (*        the string and changes the Turbo string length (in S[0]) to   *)
  85. (*        reflect the actual string length.                             *)
  86.  
  87. Var
  88.    I: Integer;
  89.  
  90. Begin (* Convert_AsciiZ_To_String *)
  91.  
  92.    I := 1;
  93.    While( S[I] <> CHR(0) ) Do I := I + 1;
  94.  
  95.    S[0] := CHR( I - 1 );
  96.  
  97. End   (* Convert_AsciiZ_To_String *);
  98.  
  99. (*----------------------------------------------------------------------*)
  100. (*   Convert_String_To_AsciiZ -- Convert Turbo string to Ascii Z String *)
  101. (*----------------------------------------------------------------------*)
  102.  
  103. Procedure Convert_String_To_AsciiZ( Var S: AnyStr );
  104.  
  105. (*                                                                      *)
  106. (*     Procedure:  Convert_String_To_AsciiZ                             *)
  107. (*                                                                      *)
  108. (*     Purpose:    Convert Turbo string to ascii Z string               *)
  109. (*                                                                      *)
  110. (*     Calling Sequence:                                                *)
  111. (*                                                                      *)
  112. (*        Convert_String_To_AsciiZ( Var S: AnyStr );                    *)
  113. (*                                                                      *)
  114. (*           S --- Turbo string to be turned into Ascii Z string        *)
  115. (*                                                                      *)
  116. (*     Calls:                                                           *)
  117. (*                                                                      *)
  118. (*        None                                                          *)
  119. (*                                                                      *)
  120.  
  121. Begin (* Convert_String_To_AsciiZ *)
  122.  
  123.    S := S + CHR( 0 );
  124.  
  125. End   (* Convert_String_To_AsciiZ *);
  126.  
  127. (*----------------------------------------------------------------------*)
  128. (*     Dir_Get_Current_Path -- Get current directory path name          *)
  129. (*----------------------------------------------------------------------*)
  130.  
  131. Function Dir_Get_Current_Path( Drive         : Char;
  132.                                Var Path_Name : AnyStr ) : Integer;
  133.  
  134. (*                                                                      *)
  135. (*     Function:   Dir_Get_Current_Path                                 *)
  136. (*                                                                      *)
  137. (*     Purpose:    Gets text of current directory path name             *)
  138. (*                                                                      *)
  139. (*     Calling Sequence:                                                *)
  140. (*                                                                      *)
  141. (*        Iok := Dir_Get_Current_Path( Drive : Char;                    *)
  142. (*                                     Var Path_Name : AnyStr ) :       *)
  143. (*                                     Integer;                         *)
  144. (*                                                                      *)
  145. (*           Drive      --- Drive to look on                            *)
  146. (*           Path_Name  --- returned current path name                  *)
  147. (*                                                                      *)
  148. (*           Iok        --- 0 if all went well, else DOS return code    *)
  149. (*                                                                      *)
  150. (*     Calls:                                                           *)
  151. (*                                                                      *)
  152. (*        MsDos                                                         *)
  153. (*        Convert_String_To_AsciiZ                                      *)
  154. (*                                                                      *)
  155.  
  156. Var
  157.    Dir_Reg: RegPack;
  158.  
  159. Begin (* Dir_Get_Current_Path *)
  160.  
  161.     Dir_Reg.Ah := $47;
  162.     Dir_Reg.Ds := SEG( Path_Name[1] );
  163.     Dir_Reg.Si := OFS( Path_Name[1] );
  164.     Dir_Reg.Dl := ORD( UpCase( Drive ) ) - ORD( '@' );
  165.  
  166.     MsDos( Dir_Reg );
  167.  
  168.     If ( Carry_Flag AND Dir_Reg.Flags ) = 0 Then
  169.        Begin
  170.           Dir_Get_Current_Path := 0;
  171.           Convert_AsciiZ_To_String( Path_Name );
  172.        End
  173.     Else
  174.        Dir_Get_Current_Path := Dir_Reg.Ax;
  175.  
  176. End   (* Dir_Get_Current_Path *);
  177.  
  178. (*----------------------------------------------------------------------*)
  179. (*     Dir_Set_Current_Path -- Set current directory path name          *)
  180. (*----------------------------------------------------------------------*)
  181.  
  182. Function Dir_Set_Current_Path( Path_Name : AnyStr ) : Integer;
  183.  
  184. (*                                                                      *)
  185. (*     Function:   Dir_Set_Current_Path                                 *)
  186. (*                                                                      *)
  187. (*     Purpose:    Sets new current directory path name                 *)
  188. (*                                                                      *)
  189. (*     Calling Sequence:                                                *)
  190. (*                                                                      *)
  191. (*        Iok := Dir_Set_Current_Path( Path_Name : AnyStr ) :           *)
  192. (*                                     Integer;                         *)
  193. (*                                                                      *)
  194. (*           Path_Name  --- New current path name                       *)
  195. (*                                                                      *)
  196. (*     Calls:                                                           *)
  197. (*                                                                      *)
  198. (*        MsDos                                                         *)
  199. (*        Convert_AsciiZ_To_String                                      *)
  200. (*                                                                      *)
  201.  
  202. Var
  203.    Dir_Reg: RegPack;
  204.    I      : Integer;
  205.  
  206. Begin (* Dir_Set_Current_Path *)
  207.  
  208.    Convert_String_To_AsciiZ( Path_Name );
  209.  
  210.    Dir_Reg.Ah := $3B;
  211.    Dir_Reg.Ds := SEG( Path_Name[1] );
  212.    Dir_Reg.Dx := OFS( Path_Name[1] );
  213.  
  214.    MsDos( Dir_Reg );
  215.  
  216.    If ( Carry_Flag AND Dir_Reg.Flags ) = 0 Then
  217.       Dir_Set_Current_Path := 0
  218.    Else
  219.       Dir_Set_Current_Path := Dir_Reg.Ax;
  220.  
  221. End   (* Dir_Set_Current_Path *);
  222.  
  223.  
  224. (*----------------------------------------------------------------------*)
  225. (*     Dir_Set_Disk_Transfer_Address --- Set DMA address for disk I/O   *)
  226. (*----------------------------------------------------------------------*)
  227.  
  228. Procedure Dir_Set_Disk_Transfer_Address( Var DMA_Buffer );
  229.  
  230. (*                                                                      *)
  231. (*     Procedure:  Dir_Set_Disk_Transfer_Address                        *)
  232. (*                                                                      *)
  233. (*     Purpose:    Sets DMA address for disk transfers                  *)
  234. (*                                                                      *)
  235. (*     Calling Sequence:                                                *)
  236. (*                                                                      *)
  237. (*        Dir_Set_Disk_Transfer_Address( Var DMA_Buffer );              *)
  238. (*                                                                      *)
  239. (*           DMA_Buffer --- direct memory access buffer                 *)
  240. (*                                                                      *)
  241. (*     Calls:                                                           *)
  242. (*                                                                      *)
  243. (*        MsDos                                                         *)
  244. (*                                                                      *)
  245.  
  246. Var
  247.    Dir_Reg: RegPack;
  248.  
  249. Begin (* Dir_Set_Disk_Transfer_Address *)
  250.  
  251.    Dir_Reg.Ax := $1A00;
  252.    Dir_Reg.Ds := SEG( DMA_Buffer );
  253.    Dir_Reg.Dx := OFS( DMA_Buffer );
  254.  
  255.    MsDos( Dir_Reg );
  256.  
  257. End   (* Dir_Set_Disk_Transfer_Address *);
  258.  
  259. (*----------------------------------------------------------------------*)
  260. (*            Dir_Set_Default_Drive --- Set Default Drive               *)
  261. (*----------------------------------------------------------------------*)
  262.  
  263. Procedure Dir_Set_Default_Drive( Drive: Char );
  264.  
  265. (*                                                                      *)
  266. (*     Procedure:  Dir_Set_Default_Drive                                *)
  267. (*                                                                      *)
  268. (*     Purpose:    Sets default drive for disk I/O                      *)
  269. (*                                                                      *)
  270. (*     Calling Sequence:                                                *)
  271. (*                                                                      *)
  272. (*        Dir_Set_Default_Drive( Drive : Char );                        *)
  273. (*                                                                      *)
  274. (*           Drive --- letter of default drive                          *)
  275. (*                                                                      *)
  276. (*     Calls:                                                           *)
  277. (*                                                                      *)
  278. (*        MsDos                                                         *)
  279. (*                                                                      *)
  280.  
  281. Var
  282.    Dir_Reg: RegPack;
  283.  
  284. Begin  (* Dir_Set_Default_Drive *)
  285.  
  286.    Dir_Reg.Ah := $0E;
  287.    Dir_Reg.Dl := ORD( UpCase( Drive ) ) - ORD( 'A' );
  288.  
  289.    MsDos( Dir_Reg );
  290.  
  291. End   (* Dir_Set_Default_Drive *);
  292.  
  293.  
  294. (*----------------------------------------------------------------------*)
  295. (*            Dir_Get_Default_Drive --- Get Default Drive               *)
  296. (*----------------------------------------------------------------------*)
  297.  
  298. Function Dir_Get_Default_Drive: Char;
  299.  
  300. (*                                                                      *)
  301. (*     Function:  Dir_Get_Default_Drive                                 *)
  302. (*                                                                      *)
  303. (*     Purpose:   Gets default drive for disk I/O                       *)
  304. (*                                                                      *)
  305. (*     Calling Sequence:                                                *)
  306. (*                                                                      *)
  307. (*        Def_Drive := Dir_Get_Default_Drive : Char;                    *)
  308. (*                                                                      *)
  309. (*           Def_Drive --- Letter of default drive                      *)
  310. (*                                                                      *)
  311. (*     Calls:                                                           *)
  312. (*                                                                      *)
  313. (*        MsDos                                                         *)
  314. (*                                                                      *)
  315.  
  316. Var
  317.    Dir_Reg: RegPack;
  318.  
  319. Begin  (* Dir_Get_Default_Drive *)
  320.  
  321.    Dir_Reg.Ah := $19;
  322.  
  323.    MsDos( Dir_Reg );
  324.  
  325.    Dir_Get_Default_Drive := CHR( Dir_Reg.Al + ORD( 'A' ) );
  326.  
  327. End   (* Dir_Get_Default_Drive *);
  328.  
  329. (*----------------------------------------------------------------------*)
  330. (*            Dir_Delete_File --- Delete A File                         *)
  331. (*----------------------------------------------------------------------*)
  332.  
  333. Function Dir_Delete_File( File_Name : AnyStr ) : Integer;
  334.  
  335. (*                                                                      *)
  336. (*     Function:  Dir_Delete_File                                       *)
  337. (*                                                                      *)
  338. (*     Purpose:   Deletes file in current directory                     *)
  339. (*                                                                      *)
  340. (*     Calling Sequence:                                                *)
  341. (*                                                                      *)
  342. (*        Ideleted := Dir_Delete_File( File_Name : AnyStr ): Integer;   *)
  343. (*                                                                      *)
  344. (*           File_Name --- name of file to delete                       *)
  345. (*           Ideleted  --- 0 if delete goes OK, else MSDOS return code  *)
  346. (*                                                                      *)
  347. (*     Calls:                                                           *)
  348. (*                                                                      *)
  349. (*        MsDos                                                         *)
  350. (*        Convert_String_To_AsciiZ                                      *)
  351. (*                                                                      *)
  352.  
  353. Var
  354.    Dir_Reg: RegPack;
  355.  
  356. Begin  (* Dir_Delete_File *)
  357.  
  358.    Convert_String_To_AsciiZ( File_Name );
  359.  
  360.    Dir_Reg.Ah := $41;
  361.    Dir_Reg.Ds := SEG( File_Name[1] );
  362.    Dir_Reg.Dx := OFS( File_Name[1] );
  363.  
  364.    MsDos( Dir_Reg );
  365.  
  366.    If ( Carry_Flag AND Dir_Reg.Flags ) = 0 Then
  367.       Dir_Delete_File := 0
  368.    Else
  369.       Dir_Delete_File := Dir_Reg.Ax;
  370.  
  371. End   (* Dir_Delete_File *);
  372.  
  373. (*----------------------------------------------------------------------*)
  374. (*            Dir_Count_Drives --- Count number of drives in system     *)
  375. (*----------------------------------------------------------------------*)
  376.  
  377. Function Dir_Count_Drives : Integer;
  378.  
  379. (*                                                                      *)
  380. (*     Function:  Dir_Count_Drives                                      *)
  381. (*                                                                      *)
  382. (*     Purpose:   Finds number of installed DOS drives                  *)
  383. (*                                                                      *)
  384. (*     Calling Sequence:                                                *)
  385. (*                                                                      *)
  386. (*        ndrives := Dir_Count_Drives : Integer;                        *)
  387. (*                                                                      *)
  388. (*           ndrives --- number of drives in system                     *)
  389. (*                                                                      *)
  390. (*     Calls:                                                           *)
  391. (*                                                                      *)
  392. (*        MsDos                                                         *)
  393. (*                                                                      *)
  394.  
  395. Var
  396.    Dir_Reg: RegPack;
  397.  
  398. Begin  (* Dir_Count_Drives *)
  399.  
  400.    Dir_Reg.Ah := $19;
  401.  
  402.    MsDos( Dir_Reg );
  403.  
  404.    Dir_Reg.Ah := $0E;
  405.    Dir_Reg.Dl := Dir_Reg.Al;
  406.  
  407.    MsDos( Dir_Reg );
  408.  
  409.    Dir_Count_Drives := Dir_Reg.Al;
  410.  
  411. End   (* Dir_Count_Drives *);
  412.  
  413.  
  414. (*----------------------------------------------------------------------*)
  415. (*            Dir_Convert_Time --- Convert directory creation time      *)
  416. (*----------------------------------------------------------------------*)
  417.  
  418. Procedure Dir_Convert_Time ( Time : Integer; Var S_Time : AnyStr );
  419.  
  420. (*                                                                      *)
  421. (*     Procedure: Dir_Convert_Time                                      *)
  422. (*                                                                      *)
  423. (*     Purpose:   Convert creation time from directory to characters.   *)
  424. (*                                                                      *)
  425. (*     Calling Sequence:                                                *)
  426. (*                                                                      *)
  427. (*        Dir_Convert_Time( Time       : Integer;                       *)
  428. (*                          Var S_Time : AnyStr ) : Integer;            *)
  429. (*                                                                      *)
  430. (*           Time   --- time as read from directory                     *)
  431. (*           S_Time --- converted time in hh:mm:ss                      *)
  432. (*                                                                      *)
  433. (*     Calls:                                                           *)
  434. (*                                                                      *)
  435. (*        STR                                                           *)
  436. (*                                                                      *)
  437.  
  438. Var
  439.    HH : String[2];
  440.    MM : String[2];
  441.    SS : String[2];
  442.  
  443. Begin (* Dir_Convert_Time *)
  444.  
  445.    STR( ( Time SHR 11 ):2 , HH );
  446.    If HH[1] = ' ' Then HH[1] := '0';
  447.  
  448.    STR( ( ( Time AND $07E0 ) SHR 5 ):2 , MM );
  449.    If MM[1] = ' ' Then MM[1] := '0';
  450.  
  451.    STR( ( Time AND $001F ):2 , SS );
  452.    If SS[1] = ' ' Then SS[1] := '0';
  453.  
  454.    S_Time := HH + ':' + MM + ':' + SS;
  455.  
  456. End  (* Dir_Convert_Time *);
  457.  
  458. (*----------------------------------------------------------------------*)
  459. (*            Dir_Convert_Date --- Convert directory creation date      *)
  460. (*----------------------------------------------------------------------*)
  461.  
  462. Procedure Dir_Convert_Date ( Date : Integer; Var S_Date : AnyStr );
  463.  
  464. (*                                                                      *)
  465. (*     Procedure: Dir_Convert_Date                                      *)
  466. (*                                                                      *)
  467. (*     Purpose:   Convert creation date from directory to characters.   *)
  468. (*                                                                      *)
  469. (*     Calling Sequence:                                                *)
  470. (*                                                                      *)
  471. (*        Dir_Convert_Date( Date       : Integer;                       *)
  472. (*                          Var S_Date : AnyStr ) : Integer;            *)
  473. (*                                                                      *)
  474. (*           Date   --- date as read from directory                     *)
  475. (*           S_Date --- converted date in yy/mm/dd                      *)
  476. (*                                                                      *)
  477. (*     Calls:                                                           *)
  478. (*                                                                      *)
  479. (*        STR                                                           *)
  480. (*                                                                      *)
  481.  
  482. Var
  483.    YY : String[2];
  484.    MM : String[2];
  485.    DD : String[2];
  486.  
  487. Begin (* Dir_Convert_Date *)
  488.  
  489.    STR( ( 80 + ( Date SHR 9 ) ) : 2 , YY );
  490.  
  491.    STR( ( ( Date AND $01E0 ) SHR 5 ):2 , MM );
  492.    If MM[1] = ' ' Then MM[1] := '0';
  493.  
  494.    STR( ( Date AND $001F ):2 , DD );
  495.    If DD[1] = ' ' Then DD[1] := '0';
  496.  
  497.    S_Date := YY + '/' + MM + '/' + DD;
  498.  
  499. End  (* Dir_Convert_Date *);
  500.  
  501. (*----------------------------------------------------------------------*)
  502. (*   Dir_Find_First_File --- Find First File Matching Given Specs       *)
  503. (*----------------------------------------------------------------------*)
  504.  
  505. Function Dir_Find_First_File(     File_Pattern: AnyStr;
  506.                               Var First_File  : Directory_Record  ):
  507.                               Integer;
  508.  
  509. (*                                                                      *)
  510. (*     Function:   Dir_Find_First_File                                  *)
  511. (*                                                                      *)
  512. (*     Purpose:    Find first file in directory matching specs          *)
  513. (*                                                                      *)
  514. (*     Calling Sequence:                                                *)
  515. (*                                                                      *)
  516. (*        Iok := Dir_Find_First_File(     File_Pattern: AnyStr;         *)
  517. (*                                    Var First_File  :                 *)
  518. (*                                        Directory_Record ): Integer;  *)
  519. (*                                                                      *)
  520. (*           File_Pattern --- File pattern to look for.                 *)
  521. (*           First_File   --- First file matching specs.                *)
  522. (*           Iok          --- 0 if file found, else MsDos return code.  *)
  523. (*                                                                      *)
  524. (*     Calls:                                                           *)
  525. (*                                                                      *)
  526. (*        Dir_Set_Disk_Transfer_Address                                 *)
  527. (*        MsDos                                                         *)
  528. (*                                                                      *)
  529. (*     Remarks:                                                         *)
  530. (*                                                                      *)
  531. (*        The file pattern can be any standard MSDOS file pattern,      *)
  532. (*        including wildcards.  For a complete directory list, enter    *)
  533. (*        '*.*' as the pattern.   Use routine 'Dir_Find_Next_File'      *)
  534. (*        to get the remaining files.                                   *)
  535. (*                                                                      *)
  536.  
  537. Var
  538.    Dir_Reg: RegPack;
  539.  
  540. Begin (* Find_First_File *)
  541.  
  542.    Dir_Set_Disk_Transfer_Address( First_File );
  543.  
  544.    Convert_String_To_AsciiZ( File_Pattern );
  545.  
  546.    Dir_Reg.Ds := SEG( File_Pattern[1] );
  547.    Dir_Reg.Dx := OFS( File_Pattern[1] );
  548.    Dir_Reg.Ax := $4E00;
  549.    Dir_Reg.Cx := $FF;
  550.  
  551.    MsDos( Dir_Reg );
  552.  
  553.    If ( Carry_Flag AND Dir_Reg.Flags ) = 0 Then
  554.       Dir_Find_First_File := 0
  555.    Else
  556.       Dir_Find_First_File := Dir_Reg.Ax;
  557.  
  558. End   (* Find_First_File *);
  559.  
  560.  
  561. (*----------------------------------------------------------------------*)
  562. (*     Dir_Find_Next_File  --- Find Next File Matching Given Specs      *)
  563. (*----------------------------------------------------------------------*)
  564.  
  565. Function Dir_Find_Next_File ( Var Next_File : Directory_Record ) : Integer;
  566.  
  567. (*                                                                      *)
  568. (*     Function:   Dir_Find_Next_File                                   *)
  569. (*                                                                      *)
  570. (*     Purpose:    Finds next file in directory matching specs          *)
  571. (*                                                                      *)
  572. (*     Calling Sequence:                                                *)
  573. (*                                                                      *)
  574. (*        Iok := Dir_Find_Next_File ( Var Next_File :                   *)
  575. (*                                        Directory_Record ) : Integer; *)
  576. (*                                                                      *)
  577. (*           Next_File    --- Next file matching specs.                 *)
  578. (*           Iok          --- Returned as 0 if file found, else MsDos   *)
  579. (*                            return code indicating error.             *)
  580. (*                                                                      *)
  581. (*     Calls:                                                           *)
  582. (*                                                                      *)
  583. (*        MsDos                                                         *)
  584. (*        Dir_Set_Disk_Transfer_Address                                 *)
  585. (*                                                                      *)
  586.  
  587. Var
  588.    Dir_Reg : RegPack;
  589.  
  590. Begin (* Find_Next_File  *)
  591.  
  592.    Dir_Set_Disk_Transfer_Address( Next_File );
  593.  
  594.    Dir_Reg.Ax := $4F00;
  595.  
  596.    MsDos( Dir_Reg );
  597.  
  598.    If ( Carry_Flag AND Dir_Reg.Flags ) = 0 Then
  599.       Dir_Find_Next_File := 0
  600.    Else
  601.       Dir_Find_Next_File := Dir_Reg.Ax;
  602.  
  603. End   (* Find_Next_File  *);
  604.