/**************************************************************************

			       gfx2grob V1.0

				is FreeWare

    gfx2grob V1.0 converts graphic files from and to a HP48 calculator.
	     For more information look in the PrintMsg.c file.

			       Tab size = 8

       Copyright (C) 1994 by Alexandros Loghis,  All Rights Reserved

			 Fri Nov 11 12:38:27 1994

**************************************************************************/

#include <string.h>	/* memset */
#include <stdlib.h>	/* malloc, free */

#include "gfx2grob.h"
#include "PrintMsg.h"
#include "GetOpts.h"
#include "Convert.h"


#define FreeGlobalVars(V) free(V)


const char NULLSTR[] = ""; /* #define NULLSTR "": not always same address  */


static gvType *InitGlobalVars();

/*************************************************************************/

static gvType *InitGlobalVars()
{
  gvType *gv;


  if (!(gv = malloc(sizeof (gvType)))) PrintMsg(ERR_NOMEM);
  memset(gv, 0, sizeof (gvType));
  gv->Options.InputfileName  = NULLSTR;
  gv->Options.OutputfileName = NULLSTR;
  gv->Options.Option	     = OT_NOONE;
  gv->Options.Width	     = DEFAULDWIDTH;
  gv->Options.Height	     = DEFAULDHEIGHT;
  return (gv);
}

/*************************************************************************/

int main(int argc, char *argv[])
{
  gvType *gv;


  gv = InitGlobalVars();
  GetOptions(argc, argv, &gv->Options);
  ConvertFile(gv);
  FreeGlobalVars(gv);
  return (0);
}
