/*
 * PLAYROL redirector to PLAYCMF used with ADMENU.EXE
 *
 * (C) 1990 Duane Ellis, CIS ID: 76064,1107
 * Placed in the public domain - Duane Ellis
 *
 * This program has one *MAJOR* problem, it works... but...
 *
 *	It does no error checking - it should.
 *
 * Please see other files contained with this package for more 
 * information regarding this program.
 *
 * NOTE: This program does not PLAY the ROL files, it is a "quick and
 *       dirty patch" to make ADMENU.EXE use CMF files instead.
 */
  
#include <stdio.h>
#include <process.h>
#include <string.h>

main( int argc, char **argv )
{
char string[200], str2[200];
char *cp;

	/* incoming filename ends in ROL, we want CMF */
	
	strcpy( string, argv[1] ); /* make copy of file */
	
	/* find extension at the end. */
	cp = strrchr( string, '.' );
	if( !cp ){
		printf("cannot find stuff to change extension!");
		return 1; /* BARF! */
	}

	/* cp points to: ".ROL" at end of the filename */
	
	strcpy( cp, ".CMF" ); /* change last name to .CMF */
	
	/* rename ROL file to CMF file */
	rename( argv[1], string );

	/* play the CMF file */
	sprintf( str2, "playcmf %s", string  );
	system( str2 );
	
	/* rename the file back the way it was. */
	rename( string, argv[1] );
	return 0; /* bye bye! */
}

