#include<io.h>
#include<stdio.h>
int main ( int argc, char *argv[] )
{
char oldName [256];
char newName [256];
FILE *oldFile;
FILE *newFile;
int zeichen;
if ( argc < 2 ) {
printf ( "usage: TCONV <file>\n" );
printf ( "don't use suffix \".tex\"\n");
return -1;
};
strcpy (oldName, argv[1]);
strcat (oldName, ".bak");
strcpy (newName, argv[1]);
strcat (newName, ".tex");
if ( rename (newName, oldName) != 0 ) {
printf ("Konnte Datei nicht umbenennen (*.bak vorhanden ?)\n");
return -1;
};
oldFile = fopen ( oldName, "rb" );
newFile = fopen ( newName, "wb" );
if ( oldFile == NULL || newFile == NULL ) {
printf ("Fehler beim �ffnen der Dateien\n");
fcloseall ();
return -1;
};
do {
zeichen = getc (oldFile);
if ( zeichen == 132 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'a', newFile ); }
else if ( zeichen == 148 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'o', newFile ); }
else if ( zeichen == 129 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'u', newFile ); }
else if ( zeichen == 225 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 's', newFile ); }
else if ( zeichen == 142 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'A', newFile ); }
else if ( zeichen == 153 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'O', newFile ); }
else if ( zeichen == 154 ) { /* � */
putc ( (int) '\"', newFile ); putc ( (int) 'U', newFile ); }
else if (zeichen != EOF && zeichen != 26 && zeichen != 13) {
putc (zeichen, newFile); }
} while ( zeichen != EOF );
fcloseall ();
return 1;
};