This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Avoid leaving a VAR.txt after testing terminates on any platform where
[perl5.git] / generate_uudmap.c
CommitLineData
6d62b57d
NC
1#include <stdio.h>
2#include <stdlib.h>
6d62b57d
NC
3
4static const char PL_uuemap[]
5= "`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
6
7typedef unsigned char U8;
8
9/* This will ensure it is all zeros. */
10static char PL_uudmap[256];
11
12int main() {
13 size_t i;
14 char *p;
15
16 for (i = 0; i < sizeof(PL_uuemap) - 1; ++i)
0934c9d9 17 PL_uudmap[(U8)PL_uuemap[i]] = (char)i;
6d62b57d
NC
18 /*
19 * Because ' ' and '`' map to the same value,
20 * we need to decode them both the same.
21 */
22 PL_uudmap[(U8)' '] = 0;
23
24 i = sizeof(PL_uudmap);
25 p = PL_uudmap;
26
27 fputs("{\n ", stdout);
28 while (i--) {
29 printf("%d", *p);
30 p++;
31 if (i) {
32 fputs(", ", stdout);
33 if (!(i & 15)) {
34 fputs("\n ", stdout);
35 }
36 }
37 }
38 puts("\n}");
39
40 return 0;
41}
42
43