1 // KDat - a tar-based DAT archiver
2 // Copyright (C) 1998-2000 Sean Vyain, svyain@mail.tds.net
3 // Copyright (C) 2001-2002 Lawrence Widman, kdat@cardiothink.com
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <sys/types.h>
29 #include <kcmdlineargs.h>
30 #include <kaboutdata.h>
32 #include <kmessagebox.h>
37 #include "KDatMainWindow.h"
39 static const char description
[] =
40 I18N_NOOP("tar-based DAT archiver for KDE");
42 /* in ErrorHandler.cpp */
43 void error_handler(int err_sig
);
45 int main( int argc
, char** argv
)
47 KAboutData
aboutData( "kdat", 0, ki18n("KDat"),
48 KDAT_VERSION
, ki18n(description
), KAboutData::License_GPL
,
49 ki18n("(c) 1999-2000, Sean Vyain; 2001-2002 Lawrence Widman"));
51 /* 2002-01-28 LEW: so we can dump core if we want to */
52 // KCrash::setCrashHandler(0); // this is supposed to work, but it doesn't
56 if( ( newarg
= (char *)malloc( strlen("--nocrashhandler") + 1 ) ) == NULL
)
58 KMessageBox::sorry(NULL
, i18n("Cannot allocate memory in kdat"));
61 strcpy( newarg
, "--nocrashhandler" );
62 argv
[ argc
] = newarg
;
67 for(i
=0; i
<argc
; i
++){
68 printf("Arg %d: %s\n", i
, argv
[i
]);
74 KCmdLineArgs::init( argc
, argv
, &aboutData
);
75 aboutData
.addAuthor( ki18n("Lawrence Widman"), KLocalizedString(), "kdat@cardiothink.com");
76 // KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
79 app
.setMainWidget( KDatMainWindow::getInstance() );
81 /* set up error handler so we don't crash without notice */
82 signal(SIGHUP
, error_handler
);
83 signal(SIGINT
, error_handler
);
84 signal(SIGFPE
, error_handler
);
85 signal(SIGSEGV
, error_handler
);
86 signal(SIGTERM
, error_handler
);
88 if ( app
.isSessionRestored() && KDatMainWindow::canBeRestored( 1 ) ) {
89 KDatMainWindow::getInstance()->restore( 1 );
91 KDatMainWindow::getInstance()->show();