/* Play.c

   Soundtracker-Player using "STReplay.Library"

   by Olli, dem Größten
   
   for Lattice C 5.02

*/

#include "streplay.h"
#include <proto/exec.h>
#include <workbench/startup.h>
#include <proto/dos.h>

extern struct WBStartup *WBenchMsg;
struct Library *STReplayBase;

long LoadModule(char *);
void StartSong(void);
void UnloadModule(void);

_main(line)
char *line;
{
	char	*temp;

	if(!(STReplayBase=OpenLibrary("streplay.library",33))) 
	return(20);

	if(!WBenchMsg)
	{
		while(*line!=' '&&*line) line++;
		temp=line++;
		while(*temp!=10)	temp++;
		*temp=0;
	}
	else
	{
		CurrentDir(WBenchMsg->sm_ArgList[1].wa_Lock);
		line=WBenchMsg->sm_ArgList[1].wa_Name;
	}
	if(LoadModule(line)) UnloadModule();
	else StartSong();
	CloseLibrary(STReplayBase);
	return(0);
}
