Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

tartspool.cc

Go to the documentation of this file.
00001 /* Copyright (C) 2003 Herbert Straub
00002  *
00003  * This program is free software; you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 2 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00016  */
00017 
00018 #include <iostream>
00019 
00020 #include "Article.h"
00021 #include "ArtSpooler.h"
00022 #include "Logger.h"
00023 
00024 Logger slog;
00025 
00026 using namespace std;
00027 
00028 int main(int argc, char **argv)
00029 {
00030         try {
00031                 string spoolDir("test");
00032                 ifstream is;
00033                 ArtSpooler spooler(spoolDir);
00034                 Article a, *pA;
00035 
00036                 if (argc == 2) {
00037                         is.open(*(argv + 1));
00038                         a.read(is);
00039                         is.close();
00040                         spooler.spoolArt(a);
00041                 } else {
00042                         pA = spooler.getSpooledArt();
00043                         if (pA != NULL) {
00044                                 spooler.storeBadArt(*pA);
00045                                 delete pA;
00046                         }
00047                 }
00048 
00049                 return (0);
00050         }
00051         catch(SystemError e) {
00052                 e.print();
00053                 return (1);
00054         }
00055         catch(Error e) {
00056                 e.print();
00057                 cerr << "Duplicate article" << endl;
00058                 return (1);
00059         }
00060         catch(...) {
00061                 cerr << "undefined error" << endl;
00062                 return (1);
00063         }
00064 }

Generated on Sun Oct 24 21:08:19 2004 for NewsCache by doxygen 1.3.6-20040222