2 * Copyright (c) 2000,2001,2002 Guido Draheim <guidod@gmx.de>
3 * Use freely under the restrictions of the ZLIB license.
14 static const char usage
[] =
17 " - prints a content table to stdout, but the dir can also be a zip-arch."
19 " To show the contents of a zip-archive named 'test.zip', you may write \n"
24 main (int argc
, char ** argv
)
29 if (argc
<= 1 || ! strcmp (argv
[1], "--help"))
34 if (! strcmp (argv
[1], "--version"))
36 printf (__FILE__
" version "ZZIP_PACKAGE
" "ZZIP_VERSION
"\n");
40 for (argn
=1; argn
< argc
; argn
++)
45 dir
= zzip_opendir(argv
[argn
]);
48 fprintf (stderr
, "did not open %s: ", argv
[argn
]);
54 if (argc
> 2) printf ("%s: \n", argv
[argn
]);
56 /* read each dir entry and show one line of info per file */
57 while ((d
= zzip_readdir (dir
)))
59 /* orignalsize / compression-type / compression-ratio / filename */
60 if (d
->st_size
> 999999)
62 printf ("%5dK %-9s %2d%% %s \n",
64 zzip_compr_str(d
->d_compr
),
65 100 - (d
->d_csize
|1)/((d
->st_size
/100)|1),
68 printf ("%6d %-9s %2d%% %s \n",
70 zzip_compr_str(d
->d_compr
),
71 100 - (d
->d_csize
|1)*100/(d
->st_size
|1),
84 * c-file-style: "stroustrup"