converter.c
/* Zielformat: "DATUM"|"DATUM"|...|"DATUM"\n */
#ifndef STDIO
#include
#define STDIO
#endif
#ifndef CONSTANTEN
#include "constanten.c"
#endif
#ifndef BEZEICHNER
#include "bezeichner.c"
#endif
#ifndef WERT
#include "wert.c"
#endif
#ifndef FILTER
#include "filter.c"
#endif
FILE *open_input(char * prog,char *input_file)
{
FILE *ifp;
if (( ifp = fopen( input_file, "r" )) == NULL )
{
fprintf( stderr, "%s: can't open %s.\n", prog, input_file);
}
return ( ifp );
}
main ( int argc, char *argv[])
{
FILE *ifp;
/* void filter( FILE *, int out); */
char *prog = argv[0]; /* Programmname */
char input_file[max_len];
int flag = DATEN;
if ( argc <= 1 ) /* kein Argument, Standarteingabe copieren */
{ fprintf( stdout, "%s:%s\n", prog, HELP);}
else
while ( --argc > 0 )
{
if(( argc>0 ) && ( strcmp( argv[argc], "-k") == 0))
{
--argc;
flag=NUR_KOPF;
}
else
{
if(( argc>0 ) && ( strcmp( argv[argc], "-u") == 0))
{
--argc;
flag=MIT_UMLAUTE;
}
}
strcpy( input_file, argv[argc]);
/* Erstellen der Kopfinformation */
if((ifp = open_input( prog, input_file)) == NULL)
{ exit(DATEN_LESE_FEHLER);}
else
{
init_bez();
init_ds();
filter( ifp, 0);
fclose(ifp);
}
if((ifp = open_input( prog, input_file)) == NULL)
{ exit(DATEN_LESE_FEHLER);}
else
{
init_ds();
filter( ifp, flag);
fclose( ifp);
if(flag == 1)
output_bez( stdout);
}
del_bez();
flag=DATEN;
}
if (ferror( stdout ))
{
fprintf( stderr, "%s: error writing stdout! \n", prog );
exit(AUSGABE_FEHLER);
}
exit(KEIN_FEHLER);
}
CSLIB 2000
Zurück: Persönliche Hypertexte