Fix several warnings that appear in gcc 4.3.2.
[wvstreams.git] / utils / tests / diritertest.cc
blob51ad8c640c5a54c83b9f5e83e5ab844db1ec72e0
1 /*
2 * Worldvisions Weaver Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
5 * Test program for WvDirIter. Takes a directory on the command line, and
6 * prints everything it sees.
8 */
10 #define __STDC_FORMAT_MACROS
12 #include <sys/types.h>
13 #include <inttypes.h>
14 #include "wvdiriter.h"
16 int main( int argc, char * argv[] )
17 /*********************************/
19 WvString dirname;
20 bool recurse = false;
21 bool skip_mounts = false;
23 for( int i=1; i<argc; i++ ) {
24 if( !strcmp( argv[i], "-R" ) )
25 recurse = true;
26 else if ( !strcmp( argv[i], "-S" ) )
27 skip_mounts = true;
28 else
29 dirname = argv[i];
32 if( !dirname ) {
33 fprintf( stderr, "Usage: %s [-R] [-S] directory\n", argv[0] );
34 return( -1 );
37 WvDirIter i( dirname, recurse, skip_mounts );
38 for( i.rewind(); i.next(); ) {
39 printf( "%s -- (filename = [%s]) -- mode %u -- size %" PRIu64 "\n",
40 (const char *) i->fullname, i->name.cstr(), i->st_mode,
41 uint64_t(i->st_size) );
44 return( 0 );