/* * main.cpp * Part of SQLMeta, a language to use sql-queries in html pages. * * Copyright (C) 2001 Daan Vreeken * * 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 "sqlmeta.h" #include #include #include #include #include #include #include #include #include using namespace std; using namespace cgicc; void Fail(char *Txt, ...) { va_list VA; printf("Error:
\n"); va_start(VA,Txt); vprintf(Txt,VA); va_end(VA); printf("
\n"); printf("\n"); printf("\n"); exit(0); } int main(int argc, char *argv[]) { SQLMeta Meta; char C = 0; int Readed = 1; Cgicc Cgi; char *FileName = NULL; printf("Content-type: text/html\n"); printf("\n"); Meta.InputStream=stdin; Meta.OutputStream=stdout; Meta.ErrorStream=stderr; Meta.Cgi=&Cgi; if (argc!=1) { //Open meta file Meta.InputStream=fopen(argv[argc-1],"r"); if (Meta.InputStream==NULL) { //EEK! fprintf(stderr,"Could not open file '%s'!\n",argv[argc-1]); exit(0); } FileName=argv[argc-1]; } Meta.Parse(FileName); //Close input file... fclose(Meta.InputStream); exit(1); }