/* * PVVMUD a 3D MUD * Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include "globals.h" #include "parse.h" #include "writebog.h" FILE * source; FILE * outfile; FILE * ndbFile; TreeNode_t * parseTree; int main(int argc, char * argv[]){ char ascfile[256]; char ndbfile[256]; char bogfile[256]; if (argc != 2) { fprintf(stderr,"usage: %s \n",argv[0]); exit(1); } strcpy(ascfile,argv[1]); if (strrchr (ascfile, '/') != NULL){ if (strchr (strrchr(ascfile,'/'), '.') == NULL) strcat(ascfile,".ase"); } else if (strchr (ascfile, '.') == NULL) strcat(ascfile,".ase"); source = fopen(ascfile,"r"); if (source == NULL){ fprintf(stderr,"File %s not found\n",ascfile); exit(1); } if (strrchr(ascfile,'/') != NULL){ strcpy(bogfile,strrchr(ascfile,'/')+1); } else strcpy(bogfile,ascfile); strcpy(strchr(bogfile,'.'),".bog"); strcpy(ndbfile,bogfile); strcpy(strchr(ndbfile,'.'),".ndb"); parseTree = parse(); fclose(source); outfile = fopen(bogfile,"w"); if (outfile == NULL){ fprintf(stderr,"Error: Failed to open output file %s\n",bogfile); exit(1); } ndbFile = fopen(ndbfile,"w"); if (ndbFile == NULL){ fprintf(stderr,"Error: Failed to open output file %s\n",ndbfile); exit(1); } writebogfile(parseTree,outfile,ndbFile); fclose(outfile); fclose(ndbFile); /* printTree(parseTree); */ return 0; }