Add an error check for correct formatting in Deflate uncompressed
[sgt/halibut] / help.c
1 /*
2 * help.c: usage instructions
3 */
4
5 #include <stdio.h>
6 #include "halibut.h"
7
8 static const char *const helptext[] = {
9 "usage: halibut [options] files",
10 "options: --text[=filename] generate plain text output",
11 " --html[=filename] generate XHTML output",
12 " --winhelp[=filename] generate Windows Help output",
13 " --man[=filename] generate man page output",
14 " --info[=filename] generate GNU info output",
15 " --ps[=filename] generate PostScript output",
16 " --pdf[=filename] generate PDF output",
17 " -Cfoo:bar:baz append \\cfg{foo}{bar}{baz} to input",
18 " --input-charset=cs change default input file charset",
19 " --list-charsets display supported character set names",
20 " --list-fonts display supported font names",
21 " --precise report column numbers in error messages",
22 " --help display this text",
23 " --version display version number",
24 " --licence display licence text",
25 NULL
26 };
27
28 static const char *const usagetext[] = {
29 "usage: halibut [--format[=filename]] [options] file.but [file.but...]",
30 NULL
31 };
32
33 void help(void) {
34 const char *const *p;
35 for (p = helptext; *p; p++)
36 puts(*p);
37 }
38
39 void usage(void) {
40 const char *const *p;
41 for (p = usagetext; *p; p++)
42 puts(*p);
43 }
44
45 void showversion(void) {
46 printf("Halibut, %s\n", version);
47 }
48
49 void listcharsets(void) {
50 int i = 0, c;
51 do {
52 c = charset_localenc_nth(i);
53 if (c == CS_NONE) break;
54 printf("%s\n", charset_to_localenc(c));
55 i++;
56 } while (1);
57 }