import libtiff 3.8.2 into the trunk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-09-19 23:59:15 +00:00
parent 6854c3fccb
commit 8414a40c52
434 changed files with 171484 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
/*
* 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);
}
}
}