/*
	BDM - Bulk disk management facility.

*/

#include "bdm.h"


			

/*   Global Data    */
struct pif_record record;
struct plist_type plist;		/* Partition information */
int pif_eof;
struct sys_ident_node *sys_info;	/* System information on idents */
char my_account[ACCOUNTNAMESIZE];
/* Command line parameters */
char pname[PNAMESIZE];
char username[USERNAMESIZE];
char ident[IDENTSIZE];
int  cl_type;
int  cl_size;
char owner[ACCOUNTNAMESIZE];
char partition[PNAMESIZE];		/* Command qualifier */
char expiration[EXPIRESIZE];
/* The cl_xxx flags indicate if a on/off qualifier was specified on the */
/* command line.							*/
int  cl_user;
int  cl_administrator;
int  cl_full;
int  cl_brief;
int  cl_write;
int  cl_read;
int  cl_repair;
int  cl_confirm;
char description[PDESCSIZE];
/* Flags. */
int  bd_master;	/* Flag indicating if user is a master. */
int  bd_viewer;	/* Flag indicating if user is a viewer. */
int  bd_cl_user_master; /* True if username specified on command */
			/* is a master user.			 */
int  bd_cl_user_viewer; /* True if username on command line is a */
			/* viewer.                               */



main(argc, argv)
int argc;
char *argv[];
{
  int sts;
  int command;
  int copy_pif=FALSE;		/* Flag indicating if new pif is valid. */

  get_my_account(); 	/* Get the account name of the caller */
  parse_command(argc, argv, &command);

  open_pif();
  check_flags();

  switch (command) {
	case CREATE_COMMAND:	bdm_create();
				copy_pif = TRUE;
				break;
	case DESTROY_COMMAND:	bdm_destroy();
				copy_pif = TRUE;
				break;
	case ADD_COMMAND:	bdm_add();
				copy_pif = TRUE;
				break;
	case MODIFY_COMMAND:	bdm_modify();
				copy_pif = TRUE;
				break;
	case REMOVE_COMMAND:	bdm_remove();
				copy_pif = TRUE;
				break;
	case VERIFY_COMMAND:	bdm_verify();
				break;
	case MOUNT_COMMAND:	dummy_routine();
				break;
	case REPORT_COMMAND:	bdm_report();
				break;
	case SHOW_COMMAND:	bdm_show();
				break;
	case EXPIRE_COMMAND:	bdm_expire();
				copy_pif = TRUE;
				break;
	default:
				break;
	}

  bdm_exit(copy_pif);

}
