home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 June / SIMTEL_0692.cdr / msdos / c / help.arc / FINDFILE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-11  |  2.9 KB  |  124 lines

  1. #define LINT_ARGS
  2. #include    <stdio.h>
  3. #include    <stdlib.h>
  4. #include    <ctype.h>
  5. #include    <string.h>
  6. #include    <dos.h>
  7. #include    "masdos.h"
  8.  
  9. static struct FILEINFO *Dta_save;
  10.  
  11. find_first( filespec, attributes, dta )
  12. char            *filespec;
  13. unsigned int    attributes;
  14. char             *dta;
  15. {
  16.         union REGS regs;
  17.         int         ercode;
  18.  
  19.         D_IN("find_first");
  20.         regs.x.ax = B_GETDTA;
  21.         intdos( ®s, ®s );
  22.         Dta_save = (struct FILEINFO *) regs.x.bx;
  23.         regs.x.ax = B_SETDTA;
  24.         regs.x.dx = dta;
  25.         intdos( ®s, ®s );
  26.         regs.x.ax = B_FINDFIRST;
  27.         regs.x.dx = (int) filespec;
  28.         regs.x.cx = attributes;
  29.         ercode = intdos( ®s, ®s );
  30.         regs.x.ax = B_SETDTA;
  31.         regs.x.dx = (unsigned int) Dta_save;
  32.         intdos( ®s, ®s );
  33.         if( ercode == 0 )
  34.         {
  35.                 D_PRT("find_first","no error");
  36.         }
  37.         D_OUT("find_first");
  38.         return( ercode );
  39. }
  40.  
  41. int find_next( dta )
  42. char    *dta;
  43. {
  44.         union REGS regs;
  45.         int         ercode;
  46.  
  47.         D_IN("find_next");
  48.         regs.x.ax = B_GETDTA;
  49.         intdos( ®s, ®s );
  50.         Dta_save = (struct FILEINFO *) regs.x.bx;
  51.         regs.x.ax = B_SETDTA;
  52.         regs.x.dx = dta;
  53.         intdos( ®s, ®s );
  54.         regs.x.ax = B_FINDNEXT;
  55.         ercode = intdos( ®s, ®s );
  56.         regs.x.ax = B_SETDTA;
  57.         regs.x.dx = (unsigned int) Dta_save;
  58.         intdos( ®s, ®s );
  59.         if( ercode == 0 )
  60.         {
  61.                 D_PRT("find_next","no error");
  62.         }
  63.         D_OUT("find_next");
  64.         return( ercode );
  65. }
  66.  
  67. ffind_first( filespec, attributes )
  68. char            *filespec;
  69. unsigned int    attributes;
  70. {
  71.         union REGS regs;
  72.         int         ercode;
  73.  
  74.         D_IN("find_first");
  75.         regs.x.ax = B_FINDFIRST;
  76.         regs.x.dx = (int) filespec;
  77.         regs.x.cx = attributes;
  78.         ercode = intdos( ®s, ®s );
  79.         if( ercode == 0 )
  80.         {
  81.                 D_PRT("find_first","no error");
  82.         }
  83.         D_OUT("find_first");
  84.         return( ercode );
  85. }
  86.  
  87. int ffind_next()
  88. {
  89.         union REGS regs;
  90.         int         ercode;
  91.  
  92.         D_IN("find_next");
  93.         regs.x.ax = B_FINDNEXT;
  94.         ercode = intdos( ®s, ®s );
  95.         if( ercode == 0 )
  96.         {
  97.                 D_PRT("find_next","no error");
  98.         }
  99.         D_OUT("find_next");
  100.         return( ercode );
  101. }
  102.  
  103. void frstdta()
  104. {
  105.         union REGS regs;
  106.  
  107.         regs.x.ax = B_SETDTA;
  108.         regs.x.dx = (unsigned int) Dta_save;
  109.         intdos( ®s, ®s );
  110. }
  111.  
  112. void fchgdta( dta )
  113. char             *dta;
  114. {
  115.         union REGS regs;
  116.  
  117.         regs.x.ax = B_GETDTA;
  118.         intdos( ®s, ®s );
  119.         Dta_save = (struct FILEINFO *) regs.x.bx;
  120.         regs.x.ax = B_SETDTA;
  121.         regs.x.dx = dta;
  122.         intdos( ®s, ®s );
  123. }
  124.