home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <string.h>
-
- #include <dos/dos.h>
- #include <exec/execbase.h>
- #include <exec/memory.h>
- #include <exec/types.h>
-
- #include <clib/exec_protos.h>
- #include <clib/dos_protos.h>
-
- #include <pragmas/exec_pragmas.h>
- #include <pragmas/dos_pragmas.h>
-
- #include <proof/proof.h>
- #include <proof/proof_protos.h>
- #include <proof/proof_pragmas.h>
-
- /* Function prototypes */
-
- /* Global variables */
- extern struct Library *DOSBase;
- struct Library *ProofBase;
-
- char *version = "$VER: ProofScan 1.0 (25.2.99)";
-
- void main( int argc, char **argv )
- {
- BPTR lock;
- char str[150];
-
- ProofBase = OpenLibrary( "proof.library", NULL );
- if ( ProofBase != NULL )
- {
- if ( argc > 1 )
- {
- struct FileInfoBlock *fib;
-
- fib = AllocDosObject( DOS_FIB, TAG_DONE );
- if ( fib != NULL )
- {
- lock = Lock( argv[1], ACCESS_READ );
- if ( lock != NULL )
- {
- if ( Examine( lock, fib ) )
- {
- LONG protbits;
-
- protbits = (LONG)fib->fib_Protection;
-
- if ( fib->fib_DirEntryType < 0 )
- {
- /* File */
- if ( IsProof( argv[1], PFN_TestProofByProtection, TRUE, NULL ) )
- {
- printf( "PROOF:%s\n", fib->fib_FileName );
- }
- }
- else
- {
- /* Directory */
- while ( ExNext( lock, fib ) != FALSE )
- {
- if ( fib->fib_DirEntryType < 0 )
- {
- strcpy( str, argv[1]);
- AddPart( str, fib->fib_FileName, 150 );
-
- if ( IsProof( str, PFN_TestProofByProtection, TRUE, NULL ) )
- {
- printf( "PROOF:%s\n", fib->fib_FileName );
- }
- }
- }
- }
- }
-
- UnLock( lock );
- }
- else printf( "Specified file/directory does not exist\n" );
-
- FreeDosObject( DOS_FIB, fib );
- }
- }
- else printf( "Usage: proofscan <path><filename>\n" );
- }
-
- if ( ProofBase != NULL ) CloseLibrary( ProofBase );
- }
-