comparison sources/cabal.cpp @ 2:19227b0b7cc1

.h => .hpp for the headers added year 2008 to copyright notes renamed some functions for better meaning prepared parser module for rewriting added showHelp() function some code clean up
author Vlad Glagolev <enqlave@gmail.com>
date Mon, 21 Jan 2008 01:14:10 +0300
parents bafff9de2a76
children 8d54d9fdeca3
comparison
equal deleted inserted replaced
1:08d8cdf4fe7f 2:19227b0b7cc1
1 /** 1 /**
2 * cabal.cpp (2007-03-03) 2 * cabal.cpp (2007-03-03)
3 * 3 *
4 * -- CABAL -- primary module 4 * -- CABAL -- primary module
5 * 5 *
6 * Copyright (c) 2007 Vlad Glagolev <enqlave@gmail.com> 6 * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com>
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Permission to use, copy, modify, and distribute this software for any 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 10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies. 11 * copyright notice and this permission notice appear in all copies.
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 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 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 */ 20 */
21 21
22 #include "cabal.h" 22 #include "cabal.hpp"
23 23
24 Core *CABAL; 24 Core *CABAL;
25 25
26 void shut() 26 void shut()
27 { 27 {
35 35
36 delete CABAL; 36 delete CABAL;
37 exit(0); 37 exit(0);
38 } 38 }
39 39
40 int main(int argc, char *argv[]) 40 void showHelp()
41 {
42 cout
43 << "\nUsage:\n" \
44 << "\t-d, --daemon | daemon mode\n" \
45 << "\t-c, --config <file> | configuration file\n" \
46 << "\t-h, --help | this message\n" \
47 << "\nCopyright (c) 2007-2008 Vlad Glagolev (BSD license)\n" << endl;
48
49 exit(0);
50 }
51
52 int main(int argc, char **argv)
41 { 53 {
42 cout 54 cout
43 << "-- CABAL -- " << VERSION << " (CORE: " << VERSION_CORE ") | " \ 55 << "-- CABAL -- " << VERSION << " (CORE: " << VERSION_CORE ") | " \
44 << "Compiled: " << __DATE__ << " at " << __TIME__ << endl; 56 << "Compiled: " << __DATE__ << " at " << __TIME__ << endl;
45 57
46 if (argc < 2) { 58 if (argc < 2)
47 cout 59 showHelp();
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 60
56 CABAL = new Core(); 61 CABAL = new Core();
57 62
58 CABAL->commandParse(argc, argv); 63 CABAL->parseCommandLine(argc, argv);
59 CABAL->configParse(); 64 CABAL->parseConfig();
60 CABAL->pidCheck(); 65 CABAL->checkPID();
61 66
62 if (!CABAL->debug) 67 if (!CABAL->debug)
63 daemonize(); 68 daemonize();
64 69
65 CABAL->pidWrite(); 70 CABAL->writePID();
66 71
67 CABAL->work(); 72 CABAL->work();
68 73
69 return 0; 74 return 0;
70 } 75 }