-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.cpp
78 lines (72 loc) · 2.07 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*----------------------------------------------------------------------
* $Id: main.cpp,v 1.6 2012-02-12 01:31:30 salem Exp $
*
*
* Copyright (C) 2005 Salem Ganzhorn <[email protected]>
*
* This file is part of kccmp - Kernel Config CoMPare
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public License
* as published by the Free Software Foundation.
*
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*----------------------------------------------------------------------*/
#include <QApplication>
#include <QFile>
#include "config.hpp"
#include "config_view.hpp"
#include <iostream>
#include <stdexcept>
using namespace std;
template< class _Type >
ostream & operator<< (
ostream &out,
const set<_Type> &d
)
{
typename set<_Type>::const_iterator i = d.begin();
while( d.end() != i ) {
out << *i << endl;
++i;
}
return out;
}
int
main(
int argc,
char ** argv
)
{
QApplication a(argc,argv);
if( 3 != argc ) {
cerr << "symtax error, should be:" << endl;
cerr << "% " << argv[0] << " config_file1 config_file2" << endl;
exit(-1);
}
int result;
try {
config_view view;
const char * title = "kccmp - v0.3";
view.setWindowTitle(title);
view.show();
a.connect(&a,SIGNAL(lastWindowClosed()),&a,SLOT(quit()));
view.compare( argv[1],argv[2] );
result = a.exec();
} catch( exception& e ) {
cerr << e.what() << endl;
result = 2;
} catch(...) {
cerr << "caught unhandled exception" << endl;
result = 1;
}
return result;
}