1/*
2 * This program is copyright Alec Muffett 1993. The author disclaims all
3 * responsibility or liability with respect to it's usage or its effect
4 * upon hardware or computer systems, and maintains copyright as set out
5 * in the "LICENCE" document which accompanies distributions of Crack v4.0
6 * and upwards.
7 */
8
9#include "packer.h"
10
11int
12main(argc, argv)
13    int argc;
14    char *argv[];
15{
16    int32 readed;
17    int32 wrote;
18    PWDICT *pwp;
19    char buffer[STRINGSIZE];
20
21    if (argc <= 1)
22    {
23	fprintf(stderr, "Usage:\t%s dbname\n", argv[0]);
24	return (-1);
25    }
26
27    if (!(pwp = PWOpen(argv[1], "w")))
28    {
29	perror(argv[1]);
30	return (-1);
31    }
32
33    wrote = 0;
34
35    for (readed = 0; fgets(buffer, STRINGSIZE, stdin); /* nothing */)
36    {
37    	readed++;
38
39	buffer[MAXWORDLEN - 1] = '\0';
40
41	Chop(buffer);
42
43	if (!buffer[0])
44	{
45	    fprintf(stderr, "skipping line: %lu\n", readed);
46	    continue;
47	}
48
49	if (PutPW(pwp, buffer))
50	{
51	    fprintf(stderr, "error: PutPW '%s' line %luy\n", buffer, readed);
52	}
53
54	wrote++;
55    }
56
57    PWClose(pwp);
58
59    printf("%lu %lu\n", readed, wrote);
60
61    return (0);
62}
63