[net.sources] RT-11 floppy -- main.c

jrb@wdl1.UUCP (John R Blaker) (02/17/84)

/*==========================================================================*
 *			         == R T 1 1 ==				    *
 *==========================================================================*
 * John R Blaker -- Ford Aerospace & Communications Corporation -- Oct 1982 *
 *==========================================================================*
 * This program is designed to read, write and list RT11A format floppy     *
 * discs.  It will be implemented in the following stages:		    *
 *	0.  -v and -t options (needed for debugging)	DONE		    *
 *	1.  -0 and -1 options (needed for others)	DONE		    *
 *	2.  -l option -- List directory of disc		DONE		    *
 *	3.  -x option -- Extract files from disc	DONE		    *
 *	4   -c option -- Initialize a new disc				    *
 *	5.  -w option -- Write files on disc				    *
 * This program is contained in the following files:			    *
 *	main.c		Main program					    *
 *	listdir.c	List the disc directory				    *
 *	extract.c	Extract from disc				    *
 *	write.c		Write to disc					    *
 *	create.c	Create new disc					    *
 *	misc.c		Miscellaneous routines				    *
 *	radix50.c	Radix50 routines stolen from rk11(9)		    *
 *	disc.c		Disc access routines				    *
 *	direct.c	In-memory directory of disc			    *
 * It has the following options:					    *
 *	-l	List directory contents					    *
 *	-0	Select drive 0 (default)				    *
 *	-1	Select drive 1						    *
 *	-x	Extract files						    *
 *	-c	Create new disc		NOT IMPLEMENTED			    *
 *	-w	Write files		NOT IMPLEMENTED			    *
 *	-v	Be verbose						    *
 *	-t	Turn on tracing (This one will not be mentioned in the      *
 *		manual page						    *
 * This file contains the following function:				    *
 *	main()	Passes argc and argv on to getargs() and then does a large  *
 *		group of if statements calling the apropriate routines      *
 * See each of the source files above for the list of functions contained   *
 * within								    *
 *==========================================================================*
 */

 /*
  * Include file
  */

#include	"rt11.h"	/* Global definitions */

/*
 * main()
 * This is the main program.
 * First it sets the default flag values.
 * Then it calls getargs() to parse the
 * command line.  It then calls the appropriate one of
 * listdir(), extract(), create(), or Write()
 */

main(argc, argv)
int	argc;		/* Argument count */
char	*argv[];	/* Argument vector */
{
	TRACE = VERBOSE = EXTRACT = WRITE = CREATE = FALSE;
	LIST = TRUE;
	DRIVE = 0;

	getargs(argc, argv);	/* Get command line arguments */

	disc_open(DRIVE);	/* Open proper disc drive */

	makedir();		/* Make in memory directory */

	if (LIST)		/* List directory of disc */
		listdir();
	if (EXTRACT)		/* Extract files from disc */
		extract();
	if (CREATE)		/* Create new disc */
		create();
	if (WRITE)		/* Write files on disc */
		Write();
	
	disc_close();		/* Close disc drive */
} /* main */