diff options
author | Nicholas Clark <nick@ccl4.org> | 2007-04-24 23:16:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2007-04-24 23:16:12 +0000 |
commit | 6d62b57de119943ad42625b9ea2237bdac6e25bb (patch) | |
tree | 326344665f8c81ad3b62615f9658dad86b4b5d5b /generate_uudmap.c | |
parent | 9444d2138b6b5264fb9381e43188986db5564e80 (diff) | |
download | perl-6d62b57de119943ad42625b9ea2237bdac6e25bb.tar.gz |
Ooops. It helps to p4 add the new file.
p4raw-id: //depot/perl@31060
Diffstat (limited to 'generate_uudmap.c')
-rw-r--r-- | generate_uudmap.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/generate_uudmap.c b/generate_uudmap.c new file mode 100644 index 0000000000..5b940f769b --- /dev/null +++ b/generate_uudmap.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +static const char PL_uuemap[] += "`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"; + +typedef unsigned char U8; + +/* This will ensure it is all zeros. */ +static char PL_uudmap[256]; + +int main() { + size_t i; + char *p; + + for (i = 0; i < sizeof(PL_uuemap) - 1; ++i) + PL_uudmap[(U8)PL_uuemap[i]] = i; + /* + * Because ' ' and '`' map to the same value, + * we need to decode them both the same. + */ + PL_uudmap[(U8)' '] = 0; + + i = sizeof(PL_uudmap); + p = PL_uudmap; + + fputs("{\n ", stdout); + while (i--) { + printf("%d", *p); + p++; + if (i) { + fputs(", ", stdout); + if (!(i & 15)) { + fputs("\n ", stdout); + } + } + } + puts("\n}"); + + return 0; +} + + |