cftd.c 776 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include <stdio.h>
#include <stdlib.h>
#include "conftree.h"
#include "confpile.h"


main(int argc,char *argv[]){
  int iError;
  tConfigTree MyCONF;

  if( argc < 3 ){
    fprintf(stderr,"Usage: cfgc binaryinput textoutput\n"
                   "\ndump config information.\n");
    exit(1);
    }

  cft_init(&MyCONF,NULL,NULL,NULL);
  iError = cft_ReadConfig(&MyCONF,argv[1]);
  if( iError != 0 ){
    fprintf(stderr,"Input file %s can not be processed.\n",argv[1]);
    fprintf(stderr,"The error code is %d\n",iError);
    exit(iError);
    }


  iError = cft_DumpConfig(&MyCONF,argv[2]);
  if( iError != 0 ){
    fprintf(stderr,"Output file %s can not be processed.\n",argv[1]);
    fprintf(stderr,"The error code is %d\n",iError);
    exit(iError);
    }

  exit(0);
  }