summaryrefslogtreecommitdiff
path: root/src/tools/hunzip.cxx
blob: 5d1581d3a336308b6b7574a2222649a207d4a052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "hunzip.hxx"

#define DESC "hunzip - decompress a hzip file to the standard output\n" \
"Usage: hunzip file.hz [password]\n"

int fail(const char * err, const char * par) {
    fprintf(stderr, err, par);
    return 1;
}

int main(int argc, char** argv) {
    Hunzip * h;
    const char * s;
    if (argc == 1 || strcmp(argv[1], "-h") == 0) return fail(DESC, NULL);
    h = new Hunzip(argv[1], (argc > 2) ? argv[2] : NULL);
    while (h && (s = h->getline())) printf("%s", s);
    return 0;
}