home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 35 Internet
/
35-Internet.zip
/
webkoi.zip
/
wpatch.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-10
|
2KB
|
84 lines
/*
* Patch Web Explorer translation table to see KOI-8 coded
* russian text
*/
#include <stdio.h>
#include <sys\types.h>
#include <sys\stat.h>
#include <string.h>
#include <stdlib.h>
#include "866.tbl"
char tst[4]={125,126,127,0};
void main(int argc, char *argv[])
{
FILE *fp;
int i;
char buf[200];
struct stat st;
int count;
char ch;
int found=0;
if(argc < 2)
{
printf("%s - Patch Web Explorer to display KOI-8 text\nUsage:\n\t%s <file> \
\n\n\tWhere <file> is the file to patch (i.e. explore.exe (prior to v0814)\
or\n\t\twebexwin.dll for latter versions\n",
argv[0], argv[0]);
exit(1);
}
stat(argv[1], &st);
count=st.st_size;
fp=fopen(argv[1], "rb+");
/*
Seek forward to fasten things a bit
you may remove this line and change
the next line to read "for(i=0; i < count; i++)"
if you have problems
fseek(fp, 2000, SEEK_SET); */
for(i=0; i < count; i++)
{
if(found==2)
break;
ch=fgetc(fp);
if(ch == tst[0])
{
fseek(fp, i, SEEK_SET);
fread(buf,1,3,fp);
buf[3]='\0';
/* printf("Buf:[%s]\n",buf); */
i+=2;
if(strcmp(buf, tst) == 0)
{
if(found == 0)
{
found++;
printf("Found table #1...\n");
fseek(fp, i+1, SEEK_SET);
if(fwrite(koi82alt,1,128,fp) < 128)
perror("Writing data");
i+=128;
fseek(fp, i, SEEK_SET);
}
else
{
found++;
printf("Found table #2...\n");
fseek(fp, i+1, SEEK_SET);
if(fwrite(koi82alt,1,128,fp) < 128)
perror("Writing data2");
i+=128;
fseek(fp, i, SEEK_SET);
}
}
}
}
fclose(fp);
}