tltest.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include "tl.h"

void main( int argc, char * argv[] )
{
	TEXTLINES * A;
	time_t t;
	char TheTime[64];

	if( argc!=3 )
	{
		printf("usage: %s inputfile outputfile\n", argv[0] );
		exit(0);
	}

	if( (A=TLConstruct()) == NULL )
		ErrMsgExit( ERR_NOMEM );
	
	ErrMsgExit( TLLoadFromFile( A, argv[1], 0 ) );
	TLEzSort( A, 0 );
	time(&t);
	strcpy( TheTime,asctime( localtime( &t ) ) );
	Trim( TheTime );
	TLInsert( A, 0, TheTime );
	ErrMsgExit( TLSaveToFile( A, argv[2] ) );
	
	exit(0);
}