source: trunk/mondo/mondo/xmondo/main.cpp @ 1

Last change on this file since 1 was 1, checked in by bcornec, 14 years ago

Initial import from latest mondo-2.04_cvs_20050503/mindi-1.04_cvs_20050503 on http://www.mondorescue.org

File size: 2.7 KB
Line 
1/***************************************************************************
2                          main.cpp  -  main file for XMondo
3                             -------------------
4    begin                : Thu Apr 24 19:44:32 PDT 2003
5    copyright            : (C) 2003 by Joshua Oreman
6    email                : oremanj@get-linux.org
7    cvsid                : $Id: main.cpp,v 1.1 2004/06/10 16:13:06 hugo Exp $
8 ***************************************************************************/
9
10/***************************************************************************
11 *                                                                         *
12 *   This program is free software; you can redistribute it and/or modify  *
13 *   it under the terms of the GNU General Public License as published by  *
14 *   the Free Software Foundation; either version 2 of the License, or     *
15 *   (at your option) any later version.                                   *
16 *                                                                         *
17 ***************************************************************************/
18
19#include <kcmdlineargs.h>
20#include <kaboutdata.h>
21#include <klocale.h>
22
23extern "C" {
24#include <libmondo-files-EXT.h>
25#include <libmondo-tools-EXT.h>
26    int g_ISO_restore_mode = 0;
27    extern int g_main_pid;
28}
29
30#include "xmondo.h"
31#include "xmondobackup.h"
32#include <X-specific.h>
33
34static char cvsid[] = "$Id: main.cpp,v 1.1 2004/06/10 16:13:06 hugo Exp $";
35static const char *description = I18N_NOOP("XMondo");
36// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE   
37
38static KCmdLineOptions options[] =
39{
40    { 0, 0, 0 }
41    // If you want automated backup, you run command-line Mondo. Period.
42};
43
44static void unregister_pid() 
45{
46    register_pid (0, "mondo");
47    register_pid (0, "xmondo");
48}
49
50
51int main(int argc, char *argv[])
52{   
53    KAboutData aboutData( "xmondo", I18N_NOOP("XMondo"),
54              VERSION, description, KAboutData::License_GPL,
55              "(c) 2003, Joshua Oreman", 0, 0, "oremanj@get-linux.org");
56    aboutData.addAuthor("Joshua Oreman",0, "oremanj@get-linux.org");
57    KCmdLineArgs::init( argc, argv, &aboutData );
58    KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
59   
60    KApplication a;
61
62    g_main_pid = getpid();
63    register_pid (g_main_pid, "mondo");
64    register_pid (g_main_pid, "xmondo");
65   
66    atexit (unregister_pid);
67   
68    malloc_libmondo_global_strings();
69
70    if (getuid() != 0) {
71    popup_and_OK ("Please run as root.");
72    exit (1);
73    }
74
75    char path[4096];
76    strncpy (path, getenv ("PATH"), 4050);
77    strcat (path, ":/sbin:/usr/sbin:/usr/local/sbin");
78    setenv ("PATH", path, TRUE);
79
80    XMondo *xmondo = new XMondo();
81    a.setMainWidget(xmondo);
82    xmondo->show(); 
83   
84    return a.exec();
85}
Note: See TracBrowser for help on using the repository browser.