/* reverse.c -- reverse a single line */ #include #include "ios.h" /* using the input/output service module */ #define MAX_LENGTH 120 #define ERR_LINE_SIZE 1 static char Buffer [MAX_LENGTH]; void main ( int argc, char * argv [] ) { int k, n; char * from; FILE * outfile; if ( argc < 3 ) err_command_line ( "reverse infile outfile" ); open_input_file ( argv [1] ); n = get_line_sure ( & from ); if ( n > MAX_LENGTH ) { printf ( "line length %d exceeds the maximum %d\n", n,MAX_LENGTH ); exit ( ERR_LINE_SIZE ); } for ( k=0; k= 0 ) printf ( "warning: only the first input line is processed\n" ); outfile = open_output_file ( argv [2] ); fprintf ( outfile, "[%s]\n", Buffer ); exit (0); } /* end of reverse.c */