diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-23 12:17:05 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2015-08-23 12:17:05 +0200 |
commit | c0b89ac5bfb90835ef01573267020e42d4fe070c (patch) | |
tree | 733c16852d964d84b7565af4bdaff0bcca901b88 /tiff/contrib/mac-mpw/mactrans.c | |
parent | 094535c010320967639e8e86f974d878e80baa72 (diff) |
Imported Upstream version 1.8.0upstream/1.8.0
Diffstat (limited to 'tiff/contrib/mac-mpw/mactrans.c')
-rw-r--r-- | tiff/contrib/mac-mpw/mactrans.c | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/tiff/contrib/mac-mpw/mactrans.c b/tiff/contrib/mac-mpw/mactrans.c deleted file mode 100644 index d35373e..0000000 --- a/tiff/contrib/mac-mpw/mactrans.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * mactrans.c -- Hack filter used to generate MPW files - * with special characters from pure ASCII, denoted "%nn" - * where nn is hex. (except for "%%", which is literal '%'). - * - * calling sequence: - * - * catenate file | mactrans [-toascii | -fromascii] > output - * - * Written by: Niles Ritter. - */ -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> - -void to_ascii(void); -void from_ascii(void); - -main(int argc, char *argv[]) -{ - if (argc<2 || argv[1][1]=='f') from_ascii(); - else to_ascii(); - exit (0); -} - -void from_ascii(void) -{ - char c; - int d; - while ((c=getchar())!=EOF) - { - if (c!='%' || (c=getchar())=='%') putchar(c); - else - { - ungetc(c,stdin); - scanf("%2x",&d); - *((unsigned char *)&c) = d; - putchar(c); - } - } -} - -void to_ascii(void) -{ - char c; - int d; - while ((c=getchar())!=EOF) - { - if (isascii(c)) putchar (c); - else - { - d = *((unsigned char *)&c); - printf("%%%2x",d); - } - } -} -/* - * Local Variables: - * mode: c - * c-basic-offset: 8 - * fill-column: 78 - * End: - */ |