Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

chkfmt.cc

Go to the documentation of this file.
00001 // -*- Mode: C++; -*-
00002 //                            Package   : omniEvents
00003 // chkfmt.cc                  Created   : 1/10/99
00004 //                            Author    : Paul Nader (pwn)
00005 //
00006 //    Copyright (C) 1998 Paul Nader.
00007 //
00008 //    This file is part of the omniEvents application.
00009 //
00010 //    omniEvents is free software; you can redistribute it and/or
00011 //    modify it under the terms of the GNU Lesser General Public
00012 //    License as published by the Free Software Foundation; either
00013 //    version 2.1 of the License, or (at your option) any later version.
00014 //
00015 //    omniEvents is distributed in the hope that it will be useful,
00016 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 //    Lesser General Public License for more details.
00019 //
00020 //    You should have received a copy of the GNU Lesser General Public
00021 //    License along with this library; if not, write to the Free Software
00022 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 //
00024 // Description:
00025 //    chkfmt standalone utility for parsing omniEvents log files.
00026 //
00027 
00028 /*
00029   $Log: chkfmt.cc,v $
00030   Revision 1.2  2003/11/03 22:26:03  alextingle
00031   Removed all platform specific switches. Now uses autoconf, config.h.
00032 
00033   Revision 1.1.1.1  2002/09/25 19:00:26  shamus13
00034   Import of OmniEvents source tree from release 2.1.1
00035 
00036   Revision 1.0  1999/11/01 16:29:10  naderp
00037   Initial revision
00038 
00039 */
00040 
00041 #include <stdio.h>
00042 
00043 #ifdef HAVE_GETOPT
00044 #  include <unistd.h>
00045 #else
00046 #  include "getopt.h"
00047 #endif
00048 
00049 #include "omniEvents.h"
00050 #include "args.h"
00051 
00052 extern int yyparse();
00053 extern int yydebug;
00054 extern FILE *yyin;
00055 OEP_GlobalData *oep_global;
00056 
00057 static void usage();
00058 
00059 int main(int argc, char **argv)
00060 {
00061   //
00062   // Process Options
00063   int c;
00064   while ((c = getopt(argc,argv,"d")) != EOF)
00065   {
00066      switch (c)
00067      {
00068         case 'd': yydebug = 1;
00069                   removeArgs(argc, argv, 1, 1);
00070                   break;
00071 
00072         case 'h':
00073         default : usage();
00074                   exit(-1);
00075                   break;
00076      }
00077   }
00078 
00079   //
00080   // Last argument is optional filename
00081   if (argc > 1)
00082   {
00083      FILE *file = fopen(argv[1], "r");
00084      if (!file)
00085      {
00086         fprintf(stderr, "can't open %s\n", argv[1]);
00087         exit(-1);
00088      }
00089      yyin = file;
00090   }
00091 
00092   oep_global = new OEP_GlobalData();
00093   int result = yyparse();
00094   return result;
00095 }
00096 
00097 static void
00098 usage()
00099 {
00100    cerr << "\nusage: chkfmt [-d] [filename]" << endl;
00101 }

Generated on Fri Dec 12 10:53:02 2003 for OmniEvents by doxygen1.2.15