home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / SOURCE / TOOLS / PREVIOUS.C < prev   
C/C++ Source or Header  |  1994-01-16  |  2KB  |  96 lines

  1. // Utilidad para comparar fechas y horas entre archivos
  2. // Utility for comparing dates & times between files
  3.  
  4. // ERRORLEVEL 1  --> no coinciden // does not match
  5. // ERRORLEVEL 0  -->    coinciden // does match
  6. // (c) A.Linares & F.Pulpón, 1993-4
  7.  
  8. // Build: BCC -ml timedate.c
  9.  
  10. #include <stdio.h>
  11. #include <dos.h>
  12.  
  13. void exit( unsigned char );
  14.  
  15. //----------------------------------------------------------------------------//
  16.  
  17. typedef unsigned char BYTE;
  18. typedef unsigned int  WORD;
  19. typedef unsigned long LONG;
  20.  
  21. typedef struct
  22. {
  23.    BYTE Buffer[ 21 ];
  24.    BYTE Attribute[ 1 ];
  25.    WORD wTime;
  26.    WORD wDate;
  27.    LONG lSize;
  28.    BYTE Name[ 13 ];
  29. } DTA;
  30.  
  31. //----------------------------------------------------------------------------//
  32.  
  33. void main( int Args, char * Arg[] )
  34. {
  35.    DTA * pDta;
  36.    WORD wTime1, wTime2;
  37.    WORD wDate1, wDate2;
  38.  
  39.    if( Args < 3 )
  40.    {
  41.       printf( "Time & Date files comparing utility v. 1.0\n" );
  42.       printf( "FiveWin tools - (c) A.Linares & F.Pulpón, 1993-4\n" );
  43.       return;
  44.    }
  45.  
  46.    printf( "Comparing Time & Date of files: " );
  47.    printf( Arg[ 1 ] ); printf( " / " ); printf( Arg[ 2 ] ); printf( "\n" );
  48.  
  49.    asm push ds;
  50.  
  51.    _CX = 0;
  52.    _AH = 0x4E;
  53.      _DX = FP_OFF( Arg[ 1 ] );
  54.      _DS = FP_SEG( Arg[ 1 ] );
  55.    asm int 0x21;
  56.  
  57.    asm pop ds;
  58.  
  59.    _AH = 0x2F;
  60.    asm int 0x21;
  61.  
  62.      pDta     = MK_FP( _ES, _BX );
  63.    wTime1 = pDta->wTime;
  64.    wDate1 = pDta->wDate;
  65.  
  66.    asm push ds;
  67.  
  68.    _CX = 0;
  69.    _AH = 0x4E;
  70.      _DX = FP_OFF( Arg[ 2 ] );
  71.      _DS = FP_SEG( Arg[ 2 ] );
  72.    asm int 0x21;
  73.  
  74.    asm pop ds;
  75.  
  76.    _AH = 0x2F;
  77.    asm int 0x21;
  78.  
  79.      pDta     = MK_FP( _ES, _BX );
  80.      wTime2 = pDta->wTime;
  81.      wDate2 = pDta->wDate;
  82.  
  83.    if( ( wTime1 < wTime2 ) && ( wDate1 <= wDate2 ) )
  84.    {
  85.       printf( "Need to update\n" );
  86.       exit( 1 );
  87.    }
  88.    else
  89.    {
  90.       printf( "No need to update\n" );
  91.       exit( 0 );
  92.    }
  93. }
  94.  
  95. //----------------------------------------------------------------------------//
  96.