Ooops. It helps to p4 add the new file.
[p5sagit/p5-mst-13.2.git] / generate_uudmap.c
CommitLineData
6d62b57d 1#include <stdio.h>
2#include <stdlib.h>
3#include <ctype.h>
4
5static const char PL_uuemap[]
6= "`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
7
8typedef unsigned char U8;
9
10/* This will ensure it is all zeros. */
11static char PL_uudmap[256];
12
13int main() {
14 size_t i;
15 char *p;
16
17 for (i = 0; i < sizeof(PL_uuemap) - 1; ++i)
18 PL_uudmap[(U8)PL_uuemap[i]] = i;
19 /*
20 * Because ' ' and '`' map to the same value,
21 * we need to decode them both the same.
22 */
23 PL_uudmap[(U8)' '] = 0;
24
25 i = sizeof(PL_uudmap);
26 p = PL_uudmap;
27
28 fputs("{\n ", stdout);
29 while (i--) {
30 printf("%d", *p);
31 p++;
32 if (i) {
33 fputs(", ", stdout);
34 if (!(i & 15)) {
35 fputs("\n ", stdout);
36 }
37 }
38 }
39 puts("\n}");
40
41 return 0;
42}
43
44