00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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 }