int main( int argc, char * const argv[] ) #endif { libcerror_error_t *error = NULL; libcstring_system_character_t *program = _LIBCSTRING_SYSTEM_STRING( "odrawinfo" ); libcstring_system_character_t *source = NULL; libcstring_system_integer_t option = 0; uint8_t ignore_data_files = 0; int verbose = 0; libcnotify_stream_set( stderr, NULL ); libcnotify_verbose_set( 1 ); if( libclocale_initialize( "odrawtools", &error ) != 1 ) { fprintf( stderr, "Unable to initialize locale values.\n" ); goto on_error; } if( libcsystem_initialize( _IONBF, &error ) != 1 ) { fprintf( stderr, "Unable to initialize system values.\n" ); goto on_error; } odrawoutput_version_fprint( stdout, program ); while( ( option = libcsystem_getopt( argc, argv, _LIBCSTRING_SYSTEM_STRING( "ihvV" ) ) ) != (libcstring_system_integer_t) -1 ) { switch( option ) { case (libcstring_system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_LIBCSTRING_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); return( EXIT_FAILURE ); case (libcstring_system_integer_t) 'h': usage_fprint( stdout ); return( EXIT_SUCCESS ); case (libcstring_system_integer_t) 'i': ignore_data_files = 1; break; case (libcstring_system_integer_t) 'v': verbose = 1; break; case (libcstring_system_integer_t) 'V': odrawoutput_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { fprintf( stderr, "Missing source file.\n" ); usage_fprint( stdout ); return( EXIT_FAILURE ); } source = argv[ optind ]; libcnotify_verbose_set( verbose ); #if !defined( HAVE_LOCAL_LIBODRAW ) libodraw_notify_set_stream( stderr, NULL ); libodraw_notify_set_verbose( verbose ); #endif if( info_handle_initialize( &odrawinfo_info_handle, &error ) != 1 ) { odrawoutput_version_fprint( stderr, program ); fprintf( stderr, "Unable to create info handle.\n" ); goto on_error; } odrawinfo_info_handle->ignore_data_files = ignore_data_files; if( libcsystem_signal_attach( odrawinfo_signal_handler, &error ) != 1 ) { fprintf( stderr, "Unable to attach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_open_input( odrawinfo_info_handle, source, &error ) != 1 ) { fprintf( stderr, "Unable to open file: %" PRIs_LIBCSTRING_SYSTEM ".\n", source ); goto on_error; } if( info_handle_handle_fprint( odrawinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print information.\n" ); goto on_error; } if( info_handle_close( odrawinfo_info_handle, &error ) != 0 ) { fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( libcsystem_signal_detach( &error ) != 1 ) { fprintf( stderr, "Unable to detach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_free( &odrawinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } if( odrawinfo_abort != 0 ) { fprintf( stdout, "%" PRIs_LIBCSTRING_SYSTEM ": ABORTED\n", program ); return( EXIT_FAILURE ); } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( odrawinfo_info_handle != NULL ) { info_handle_free( &odrawinfo_info_handle, NULL ); } return( EXIT_FAILURE ); }
int main( int argc, char * const argv[] ) #endif { #if defined( HAVE_GETRLIMIT ) struct rlimit limit_data; #endif libcstring_system_character_t * const *source_filenames = NULL; #if !defined( HAVE_GLOB_H ) libcsystem_glob_t *glob = NULL; #endif libcerror_error_t *error = NULL; libcstring_system_character_t *option_date_format = NULL; libcstring_system_character_t *option_header_codepage = NULL; libcstring_system_character_t *option_output_format = NULL; libcstring_system_character_t *program = _LIBCSTRING_SYSTEM_STRING( "ewfinfo" ); libcstring_system_integer_t option = 0; uint8_t verbose = 0; char info_option = 'a'; int number_of_filenames = 0; int print_header = 1; int result = 0; libcnotify_stream_set( stderr, NULL ); libcnotify_verbose_set( 1 ); if( libclocale_initialize( "ewftools", &error ) != 1 ) { fprintf( stderr, "Unable to initialize locale values.\n" ); goto on_error; } if( libcsystem_initialize( _IONBF, &error ) != 1 ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Unable to initialize system values.\n" ); goto on_error; } while( ( option = libcsystem_getopt( argc, argv, _LIBCSTRING_SYSTEM_STRING( "A:d:ef:himvV" ) ) ) != (libcstring_system_integer_t) -1 ) { switch( option ) { case (libcstring_system_integer_t) '?': default: ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Invalid argument: %" PRIs_LIBCSTRING_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); goto on_error; case (libcstring_system_integer_t) 'A': option_header_codepage = optarg; break; case (libcstring_system_integer_t) 'd': option_date_format = optarg; break; case (libcstring_system_integer_t) 'e': if( info_option != 'a' ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Conflicting options: %" PRIc_LIBCSTRING_SYSTEM " and %c\n", option, info_option ); usage_fprint( stdout ); goto on_error; } info_option = 'e'; break; case (libcstring_system_integer_t) 'f': option_output_format = optarg; break; case (libcstring_system_integer_t) 'h': ewfoutput_version_fprint( stdout, program ); usage_fprint( stdout ); return( EXIT_SUCCESS ); case (libcstring_system_integer_t) 'i': if( info_option != 'a' ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Conflicting options: %" PRIc_LIBCSTRING_SYSTEM " and %c\n", option, info_option ); usage_fprint( stdout ); goto on_error; } info_option = 'i'; break; case (libcstring_system_integer_t) 'm': if( info_option != 'a' ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Conflicting options: %" PRIc_LIBCSTRING_SYSTEM " and %c\n", option, info_option ); usage_fprint( stdout ); goto on_error; } info_option = 'm'; break; case (libcstring_system_integer_t) 'v': verbose = 1; break; case (libcstring_system_integer_t) 'V': ewfoutput_version_fprint( stdout, program ); ewfoutput_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Missing EWF image file(s).\n" ); usage_fprint( stdout ); goto on_error; } libcnotify_verbose_set( verbose ); #if !defined( HAVE_LOCAL_LIBEWF ) libewf_notify_set_verbose( verbose ); libewf_notify_set_stream( stderr, NULL ); #endif if( info_handle_initialize( &ewfinfo_info_handle, &error ) != 1 ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Unable to create info handle.\n" ); goto on_error; } if( option_output_format != NULL ) { result = info_handle_set_output_format( ewfinfo_info_handle, option_output_format, &error ); if( result == -1 ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Unable to set output format.\n" ); goto on_error; } else if( result == 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; fprintf( stderr, "Unsupported output format defaulting to: text.\n" ); } } if( ewfinfo_info_handle->output_format == INFO_HANDLE_OUTPUT_FORMAT_DFXML ) { if( info_handle_dfxml_header_fprint( ewfinfo_info_handle, &error ) != 1 ) { ewfoutput_version_fprint( stderr, program ); fprintf( stderr, "Unable to print header.\n" ); goto on_error; } } else if( ewfinfo_info_handle->output_format == INFO_HANDLE_OUTPUT_FORMAT_TEXT ) { ewfoutput_version_fprint( stdout, program ); print_header = 0; } if( ( option_output_format == NULL ) && ( option_date_format != NULL ) ) { result = info_handle_set_date_format( ewfinfo_info_handle, option_date_format, &error ); if( result == -1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to set date format.\n" ); goto on_error; } else if( result == 0 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unsupported date format defaulting to: ctime.\n" ); } } if( option_header_codepage != NULL ) { result = info_handle_set_header_codepage( ewfinfo_info_handle, option_header_codepage, &error ); if( result == -1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to set header codepage in info handle.\n" ); goto on_error; } else if( result == 0 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unsupported header codepage defaulting to: ascii.\n" ); } } #if !defined( HAVE_GLOB_H ) if( libcsystem_glob_initialize( &glob, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to initialize glob.\n" ); goto on_error; } if( libcsystem_glob_resolve( glob, &( argv[ optind ] ), argc - optind, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to resolve glob.\n" ); goto on_error; } if( libcsystem_glob_get_results( glob, &number_of_filenames, (libcstring_system_character_t ***) &source_filenames, &error ) != 1 ) { fprintf( stderr, "Unable to retrieve glob results.\n" ); goto on_error; } #else source_filenames = &( argv[ optind ] ); number_of_filenames = argc - optind; #endif #if defined( HAVE_GETRLIMIT ) if( getrlimit( RLIMIT_NOFILE, &limit_data ) != 0 ) { fprintf( stderr, "Unable to determine limit: number of open file descriptors.\n" ); } if( limit_data.rlim_max > (rlim_t) INT_MAX ) { limit_data.rlim_max = (rlim_t) INT_MAX; } if( limit_data.rlim_max > 0 ) { limit_data.rlim_max /= 2; } if( info_handle_set_maximum_number_of_open_handles( ewfinfo_info_handle, (int) limit_data.rlim_max, &error ) != 1 ) { fprintf( stderr, "Unable to set maximum number of open file handles.\n" ); goto on_error; } #endif if( libcsystem_signal_attach( ewfinfo_signal_handler, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to attach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } result = info_handle_open_input( ewfinfo_info_handle, source_filenames, number_of_filenames, &error ); if( ewfinfo_abort != 0 ) { goto on_abort; } if( result != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to open EWF file(s).\n" ); goto on_error; } #if !defined( HAVE_GLOB_H ) if( libcsystem_glob_free( &glob, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to free glob.\n" ); goto on_error; } #endif if( ( info_option == 'a' ) || ( info_option == 'i' ) ) { if( info_handle_header_values_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print header values.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } } if( ( info_option == 'a' ) || ( info_option == 'm' ) ) { if( info_handle_media_information_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print media information.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_hash_values_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print hash values.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_sessions_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print sessions.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_tracks_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print tracks.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } } if( ( info_option == 'a' ) || ( info_option == 'e' ) ) { if( info_handle_acquiry_errors_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print acquiry errors.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } } if( info_handle_single_files_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print single files.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( ewfinfo_info_handle->output_format == INFO_HANDLE_OUTPUT_FORMAT_DFXML ) { if( info_handle_dfxml_footer_fprint( ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to print footer.\n" ); goto on_error; } } on_abort: if( info_handle_close( ewfinfo_info_handle, &error ) != 0 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( libcsystem_signal_detach( &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to detach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( info_handle_free( &ewfinfo_info_handle, &error ) != 1 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } if( ewfinfo_abort != 0 ) { if( print_header != 0 ) { ewfoutput_version_fprint( stderr, program ); print_header = 0; } fprintf( stdout, "%" PRIs_LIBCSTRING_SYSTEM ": ABORTED\n", program ); return( EXIT_FAILURE ); } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( ewfinfo_info_handle != NULL ) { info_handle_free( &ewfinfo_info_handle, NULL ); } #if !defined( HAVE_GLOB_H ) if( glob != NULL ) { libcsystem_glob_free( &glob, NULL ); } #endif return( EXIT_FAILURE ); }
int main( int argc, char * const argv[] ) #endif { libcerror_error_t *error = NULL; system_character_t *option_ascii_codepage = NULL; system_character_t *source = NULL; char *program = "pffinfo"; system_integer_t option = 0; uint8_t show_allocation_information = 0; int result = 0; int verbose = 0; libcnotify_stream_set( stderr, NULL ); libcnotify_verbose_set( 1 ); if( libclocale_initialize( "pfftools", &error ) != 1 ) { fprintf( stderr, "Unable to initialize locale values.\n" ); goto on_error; } if( pfftools_output_initialize( _IONBF, &error ) != 1 ) { fprintf( stderr, "Unable to initialize output settings.\n" ); goto on_error; } pfftools_output_version_fprint( stdout, program ); while( ( option = pfftools_getopt( argc, argv, _SYSTEM_STRING( "ac:hvV" ) ) ) != (system_integer_t) -1 ) { switch( option ) { case (system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); return( EXIT_FAILURE ); case (system_integer_t) 'a': show_allocation_information = 1; break; case (system_integer_t) 'c': option_ascii_codepage = optarg; break; case (system_integer_t) 'h': usage_fprint( stdout ); return( EXIT_SUCCESS ); case (system_integer_t) 'v': verbose = 1; break; case (system_integer_t) 'V': pfftools_output_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { fprintf( stderr, "Missing source file.\n" ); usage_fprint( stdout ); return( EXIT_FAILURE ); } source = argv[ optind ]; libcnotify_verbose_set( verbose ); libpff_notify_set_stream( stderr, NULL ); libpff_notify_set_verbose( verbose ); if( info_handle_initialize( &pffinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to initialize info handle.\n" ); goto on_error; } if( option_ascii_codepage != NULL ) { result = info_handle_set_ascii_codepage( pffinfo_info_handle, option_ascii_codepage, &error ); if( result == -1 ) { fprintf( stderr, "Unable to set ASCII codepage in info handle.\n" ); goto on_error; } else if( result == 0 ) { fprintf( stderr, "Unsupported ASCII codepage defaulting to: windows-1252.\n" ); } } /* TODO if( pfftools_signal_attach( pffinfo_signal_handler, &error ) != 1 ) { fprintf( stderr, "Unable to attach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } */ if( info_handle_open_input( pffinfo_info_handle, source, &error ) != 1 ) { fprintf( stderr, "Unable to open: %" PRIs_SYSTEM ".\n", source ); goto on_error; } if( info_handle_file_fprint( pffinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file information.\n" ); goto on_error; } if( info_handle_message_store_fprint( pffinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file stream and storage items.\n" ); goto on_error; } if( show_allocation_information != 0 ) { if( info_handle_unallocated_blocks_fprint( pffinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file unallocated blocks.\n" ); goto on_error; } } /* TODO if( pfftools_signal_detach( &error ) != 1 ) { fprintf( stderr, "Unable to detach signal handler.\n" ); libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } */ if( info_handle_close( pffinfo_info_handle, &error ) != 0 ) { fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( info_handle_free( &pffinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( pffinfo_info_handle != NULL ) { info_handle_close( pffinfo_info_handle, NULL ); info_handle_free( &pffinfo_info_handle, NULL ); } return( EXIT_FAILURE ); }
int main( int argc, char * const argv[] ) #endif { libesedb_error_t *error = NULL; libcstring_system_character_t *source = NULL; char *program = "esedbinfo"; libcstring_system_integer_t option = 0; int verbose = 0; libsystem_notify_set_stream( stderr, NULL ); libsystem_notify_set_verbose( 1 ); if( libsystem_initialize( "esedbtools", _IONBF, &error ) != 1 ) { fprintf( stderr, "Unable to initialize system values.\n" ); libsystem_notify_print_error_backtrace( error ); liberror_error_free( &error ); return( EXIT_FAILURE ); } esedboutput_version_fprint( stdout, program ); while( ( option = libsystem_getopt( argc, argv, _LIBCSTRING_SYSTEM_STRING( "hvV" ) ) ) != (libcstring_system_integer_t) -1 ) { switch( option ) { case (libcstring_system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_LIBCSTRING_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); return( EXIT_FAILURE ); case (libcstring_system_integer_t) 'h': usage_fprint( stdout ); return( EXIT_SUCCESS ); case (libcstring_system_integer_t) 'v': verbose = 1; break; case (libcstring_system_integer_t) 'V': esedboutput_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { fprintf( stderr, "Missing source file.\n" ); usage_fprint( stdout ); return( EXIT_FAILURE ); } source = argv[ optind ]; libsystem_notify_set_verbose( verbose ); libesedb_notify_set_stream( stderr, NULL ); libesedb_notify_set_verbose( verbose ); if( info_handle_initialize( &esedbinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to initialize info handle.\n" ); goto on_error; } if( info_handle_open( esedbinfo_info_handle, source, &error ) != 1 ) { fprintf( stderr, "Unable to open: %" PRIs_LIBCSTRING_SYSTEM ".\n", source ); goto on_error; } if( info_handle_file_fprint( esedbinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file information.\n" ); goto on_error; } if( info_handle_close( esedbinfo_info_handle, &error ) != 0 ) { fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( info_handle_free( &esedbinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libsystem_notify_print_error_backtrace( error ); liberror_error_free( &error ); } if( esedbinfo_info_handle != NULL ) { info_handle_free( &esedbinfo_info_handle, NULL ); } return( EXIT_FAILURE ); }
int main( int argc, char * const argv[] ) #endif { libevtx_error_t *error = NULL; system_character_t *option_ascii_codepage = NULL; system_character_t *source = NULL; char *program = "evtxinfo"; system_integer_t option = 0; int result = 0; int verbose = 0; libcnotify_stream_set( stderr, NULL ); libcnotify_verbose_set( 1 ); if( libclocale_initialize( "evtxtools", &error ) != 1 ) { fprintf( stderr, "Unable to initialize locale values.\n" ); goto on_error; } if( evtxtools_output_initialize( _IONBF, &error ) != 1 ) { fprintf( stderr, "Unable to initialize output settings.\n" ); goto on_error; } evtxoutput_version_fprint( stdout, program ); while( ( option = evtxtools_getopt( argc, argv, _SYSTEM_STRING( "c:hvV" ) ) ) != (system_integer_t) -1 ) { switch( option ) { case (system_integer_t) '?': default: fprintf( stderr, "Invalid argument: %" PRIs_SYSTEM "\n", argv[ optind - 1 ] ); usage_fprint( stdout ); return( EXIT_FAILURE ); case (system_integer_t) 'c': option_ascii_codepage = optarg; break; case (system_integer_t) 'h': usage_fprint( stdout ); return( EXIT_SUCCESS ); case (system_integer_t) 'v': verbose = 1; break; case (system_integer_t) 'V': evtxoutput_copyright_fprint( stdout ); return( EXIT_SUCCESS ); } } if( optind == argc ) { fprintf( stderr, "Missing source file.\n" ); usage_fprint( stdout ); return( EXIT_FAILURE ); } source = argv[ optind ]; libcnotify_verbose_set( verbose ); libevtx_notify_set_stream( stderr, NULL ); libevtx_notify_set_verbose( verbose ); if( info_handle_initialize( &evtxinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to initialize info handle.\n" ); goto on_error; } if( option_ascii_codepage != NULL ) { result = info_handle_set_ascii_codepage( evtxinfo_info_handle, option_ascii_codepage, &error ); if( result == -1 ) { fprintf( stderr, "Unable to set ASCII codepage in info handle.\n" ); goto on_error; } else if( result == 0 ) { fprintf( stderr, "Unsupported ASCII codepage defaulting to: windows-1252.\n" ); } } result = info_handle_set_event_log_type_from_filename( evtxinfo_info_handle, source, &error ); if( result == -1 ) { fprintf( stderr, "Unable to set event log type from filename in info handle.\n" ); goto on_error; } if( info_handle_open( evtxinfo_info_handle, source, &error ) != 1 ) { fprintf( stderr, "Unable to open: %" PRIs_SYSTEM ".\n", source ); goto on_error; } if( info_handle_file_fprint( evtxinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to print file information.\n" ); goto on_error; } if( info_handle_close( evtxinfo_info_handle, &error ) != 0 ) { fprintf( stderr, "Unable to close info handle.\n" ); goto on_error; } if( info_handle_free( &evtxinfo_info_handle, &error ) != 1 ) { fprintf( stderr, "Unable to free info handle.\n" ); goto on_error; } return( EXIT_SUCCESS ); on_error: if( error != NULL ) { libcnotify_print_error_backtrace( error ); libcerror_error_free( &error ); } if( evtxinfo_info_handle != NULL ) { info_handle_free( &evtxinfo_info_handle, NULL ); } return( EXIT_FAILURE ); }