1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include "hunzip.hxx"
6
7 #define DESC "hunzip - decompress a hzip file to the standard output\n" \
8 "Usage: hunzip file.hz [password]\n"
9
fail(const char * err,const char * par)10 int fail(const char * err, const char * par) {
11 fprintf(stderr, err, par);
12 return 1;
13 }
14
main(int argc,char ** argv)15 int main(int argc, char** argv) {
16 Hunzip * h;
17 const char * s;
18 if (argc == 1 || strcmp(argv[1], "-h") == 0) return fail(DESC, NULL);
19 h = new Hunzip(argv[1], (argc > 2) ? argv[2] : NULL);
20 while (h && (s = h->getline())) printf("%s", s);
21 return 0;
22 }
23