[1] | 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
|
---|
[2708] | 7 | cvsid : $Id: main.cpp 2708 2011-01-27 18:31:44Z bruno $
|
---|
[1] | 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 |
|
---|
| 23 | extern "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 |
|
---|
[2708] | 34 | static char cvsid[] = "$Id: main.cpp 2708 2011-01-27 18:31:44Z bruno $";
|
---|
[1] | 35 | static const char *description = I18N_NOOP("XMondo");
|
---|
| 36 | // INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
|
---|
| 37 |
|
---|
| 38 | static KCmdLineOptions options[] =
|
---|
| 39 | {
|
---|
| 40 | { 0, 0, 0 }
|
---|
| 41 | // If you want automated backup, you run command-line Mondo. Period.
|
---|
| 42 | };
|
---|
| 43 |
|
---|
| 44 | static void unregister_pid()
|
---|
| 45 | {
|
---|
| 46 | register_pid (0, "mondo");
|
---|
| 47 | register_pid (0, "xmondo");
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | int 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 | }
|
---|