Mercurial > cabal
comparison sources/cabal.cpp @ 0:bafff9de2a76
Initial commit since summer'07
| author | Vlad Glagolev <enqlave@gmail.com> |
|---|---|
| date | Sun, 20 Jan 2008 19:25:25 +0300 |
| parents | |
| children | 19227b0b7cc1 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:bafff9de2a76 |
|---|---|
| 1 /** | |
| 2 * cabal.cpp (2007-03-03) | |
| 3 * | |
| 4 * -- CABAL -- primary module | |
| 5 * | |
| 6 * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com> | |
| 7 * All rights reserved. | |
| 8 * | |
| 9 * Permission to use, copy, modify, and distribute this software for any | |
| 10 * purpose with or without fee is hereby granted, provided that the above | |
| 11 * copyright notice and this permission notice appear in all copies. | |
| 12 * | |
| 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
| 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
| 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
| 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 20 */ | |
| 21 | |
| 22 #include "cabal.h" | |
| 23 | |
| 24 Core *CABAL; | |
| 25 | |
| 26 void shut() | |
| 27 { | |
| 28 delete CABAL; | |
| 29 exit(0); | |
| 30 } | |
| 31 | |
| 32 void shut(string e) | |
| 33 { | |
| 34 cout << "Error: " << e << endl; | |
| 35 | |
| 36 delete CABAL; | |
| 37 exit(0); | |
| 38 } | |
| 39 | |
| 40 int main(int argc, char *argv[]) | |
| 41 { | |
| 42 cout | |
| 43 << "-- CABAL -- " << VERSION << " (CORE: " << VERSION_CORE ") | " \ | |
| 44 << "Compiled: " << __DATE__ << " at " << __TIME__ << endl; | |
| 45 | |
| 46 if (argc < 2) { | |
| 47 cout | |
| 48 << "\nUsage:\n" \ | |
| 49 << "\t-d, --daemon | daemon mode\n" \ | |
| 50 << "\t-c, --config <file> | configuration file\n" \ | |
| 51 << "\nCopyright (c) 2007 Vlad Glagolev (under the BSD license)\n"; | |
| 52 | |
| 53 exit(0); | |
| 54 } | |
| 55 | |
| 56 CABAL = new Core(); | |
| 57 | |
| 58 CABAL->commandParse(argc, argv); | |
| 59 CABAL->configParse(); | |
| 60 CABAL->pidCheck(); | |
| 61 | |
| 62 if (!CABAL->debug) | |
| 63 daemonize(); | |
| 64 | |
| 65 CABAL->pidWrite(); | |
| 66 | |
| 67 CABAL->work(); | |
| 68 | |
| 69 return 0; | |
| 70 } |
