Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 *
 *
 */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "hconf.h"

int main(int argc, char *argv[])
{
  char *filename;
  int res,ind,mk;

  /* command line parsing... to do better */
  if (argc<2) {
    fprintf(stderr,"a filename must be supplied!\n");
    exit(-1);
  }
  ind=1;
  mk=0;
  if (!strcmp(argv[1],"-m")) {
    mk=1;
    ind++;
  }
  if (ind!=argc-1) {
    fprintf(stderr,"command line error!\n");
    exit(-1);
  }
  filename=argv[ind];
 
  /* read config.in */
  res=readconfigin(filename);
  if (res) {
    fprintf(stderr,"\nerror %i on line %i reading %s!\n",res,line,filename);
    exit(-2);
  }  
  if (mainmenu==NULL) {
    fprintf(stderr,"\nno main menu found on %s file!\n",filename);
    exit(-3);
  }

  /* dump config.in */
  //dumpvariables();
  //dumpmenus();
  //return 0;

  /* read/show/write config.h */
  res=readconfig(filename);
  show();
  writeconfig(filename);
  if (mk) writeconfigmak(filename);
 
  return 0;
}