Drop main() prototype. Syncs with NetBSD-8
[minix.git] / external / bsd / less / dist / mkhelp.c
blobeeba9ed846593e5b4a51caff7907c069c62cf5db
1 /* $NetBSD: mkhelp.c,v 1.3 2013/09/04 19:44:21 tron Exp $ */
3 /*
4 * Copyright (C) 1984-2012 Mark Nudelman
6 * You may distribute under the terms of either the GNU General Public
7 * License or the Less License, as specified in the README file.
9 * For more information, see the README file.
14 * Silly little program to generate the help.c source file
15 * from the less.hlp text file.
16 * help.c just contains a char array whose contents are
17 * the contents of less.hlp.
20 #include <stdio.h>
22 int
23 main(argc, argv)
24 int argc;
25 char *argv[];
27 int ch;
28 int prevch;
30 printf("/* This file was generated by mkhelp from less.hlp */\n");
31 printf("#include \"less.h\"\n");
32 printf("constant char helpdata[] = {\n");
33 ch = 0;
34 while (prevch = ch, (ch = getchar()) != EOF)
36 switch (ch)
38 case '\'':
39 printf("'\\'',");
40 break;
41 case '\\':
42 printf("'\\\\',");
43 break;
44 case '\b':
45 printf("'\\b',");
46 break;
47 case '\t':
48 printf("'\\t',");
49 break;
50 case '\n':
51 if (prevch != '\r')
52 printf("'\\n',\n");
53 break;
54 case '\r':
55 if (prevch != '\n')
56 printf("'\\n',\n");
57 break;
58 default:
59 if (ch >= ' ' && ch < 0x7f)
60 printf("'%c',", ch);
61 else
62 printf("0x%02x,", ch);
63 break;
66 /* Add an extra null char to avoid having a trailing comma. */
67 printf(" 0 };\n");
68 printf("constant int size_helpdata = sizeof(helpdata) - 1;\n");
69 return (0);