/**************************************************************************
* help.c:	Functions for giving help to the user.
*		Part of MP, the MIDI Playground.
*
* Author:	Daniel Barrett
* Version:	See the file "version.h".
* Copyright:	None!  This program is in the Public Domain.
*		Please share it with others.
***************************************************************************/

	
#include "mp.h"
#include "version.h"

	
/* Print a detailed help message. */

void Help(char *progName)
{
	FILE *fp = stderr;

	fprintf(fp, "MIDI Playground (%s), version %s, by Daniel Barrett."
		    "  100%% Public Domain!\n",
		progName, VERSION);
	fprintf(fp,
	   "Usage: %s -%c<FORMAT> -%c<FORMAT> [-%c infile] [-%c outfile]\n",
	   progName,
	   OPT_INPUT, OPT_OUTPUT, OPT_INFILE, OPT_OUTFILE);

	fprintf(fp,
		"The program quits at end-of-file, or when ^C is pressed.\n");

	fprintf(fp, "\nThe flags may appear in any order:\n");
	fprintf(fp, "\t-%c\tSpecify the input format.   [MANDATORY]\n",
		OPT_INPUT);
	fprintf(fp, "\t-%c\tSpecify the output format.  [MANDATORY]\n",
		OPT_OUTPUT);
	fprintf(fp, "\t\t\"-%c\" and \"-%c\" must EACH be followed by",
		OPT_INPUT, OPT_OUTPUT);
	fprintf(fp, " exactly one of:\n");
	fprintf(fp, "\t\t\t%c\tText (readable by humans).\n", OPT_TEXT);
	fprintf(fp, "\t\t\t%c\tBinary data (for files).\n", OPT_BINARY);
	fprintf(fp, "\t\t\t%c\tMIDI (using MIDI port).\n", OPT_MIDI);
	fprintf(fp, "\t-%c\tGet data from this file.    [Default=keyboard]\n",
		OPT_INFILE);
	fprintf(fp, "\t-%c\tPut data into this file.    [Default=screen]\n",
		OPT_OUTFILE);

	fprintf(fp, "\nExamples:\n");
	fprintf(fp, "\t%s -%c%c -%c%c -%c data\t%s\n",
		progName,
		OPT_INPUT, OPT_MIDI, OPT_OUTPUT, OPT_BINARY,
		OPT_OUTFILE,
		"Read MIDI & put it into binary file \"data\".");
	fprintf(fp,
		"\t%s -%c%c -%c%c\t\tRead typed text, send to MIDI (fun!).\n",
		progName,
		OPT_INPUT, OPT_TEXT, OPT_OUTPUT, OPT_MIDI);

	fprintf(fp, "\n\"%s -%c%c\" understands decimal, octal, hex,",
		progName, OPT_INPUT, OPT_TEXT);
	fprintf(fp, " binary, characters, and strings.\n");
	fprintf(fp, "For details, type %c while in \"-%c%c\" mode.\n",
		HELP_SYMBOL, OPT_INPUT, OPT_TEXT);
}

	
/* Tell the user how to get more help. */

void BegForUsage(char *progName)
{
	fprintf(stderr, "Please type \"%s ?\" for instructions.\n",
		progName);
}
