64 lines
1.8 KiB
C++
Executable File
64 lines
1.8 KiB
C++
Executable File
#include "arclib.h"
|
|
#if !defined( AL_IBM )
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "alsimple.h"
|
|
|
|
void my_callback( const char AL_DLL_FAR *name,
|
|
int object_ratio,
|
|
int job_ratio )
|
|
{
|
|
if ( name )
|
|
cout << "\n" << name << " ";
|
|
if ( object_ratio >= 0 ) {
|
|
char buf[ 24 ];
|
|
sprintf( buf, "%d%% %d%%", object_ratio, job_ratio );
|
|
cout << " \b\b\b\b\b\b\b\b\b\b" << buf;
|
|
for ( int i = 0 ; i < (int) strlen( buf ) ; i++ )
|
|
cout << '\b';
|
|
}
|
|
}
|
|
|
|
int ratio( struct ALZipDir *z )
|
|
{
|
|
return int( 100L - ( ( 100L * z->compressed_size ) / (long) z->size ) );
|
|
}
|
|
|
|
main()
|
|
{
|
|
int i;
|
|
int count;
|
|
int error;
|
|
struct ALZipDir *z;
|
|
char *levels[] = { "Stored ",
|
|
"DeflatN",
|
|
"DeflatX",
|
|
"DeflatF",
|
|
"DeflatS" };
|
|
i = ALCreate( "libs.zip", "*.bak, build.*", 0, my_callback );
|
|
printf( "\nALCreate() returned %d\n", i );
|
|
z = ALReadDir( "libs.zip", &count, &error );
|
|
if ( z != 0 && error == AL_SUCCESS )
|
|
for ( i = 0 ; i < count ; i++ )
|
|
printf( "%7ld %s %7ld %3d%% %02d-%02d-%04d %02d:%02d %s %s\n",
|
|
z[ i ].size,
|
|
levels[ z[ i ].level ],
|
|
z[ i ].compressed_size,
|
|
ratio( z + i ),
|
|
z[ i ].month,
|
|
z[ i ].date,
|
|
z[ i ].year,
|
|
z[ i ].hour,
|
|
z[ i ].minute,
|
|
z[ i ].name,
|
|
z[ i ].comment );
|
|
ALFreeDir( z );
|
|
i = ALAppend( "libs.zip", "*.tr?", 1, my_callback );
|
|
printf( "\n" );
|
|
return i;
|
|
}
|
|
|