Mercurial > cabal
view 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 |
line wrap: on
line source
/** * cabal.cpp (2007-03-03) * * -- CABAL -- primary module * * Copyright (c) 2007-2008 Vlad Glagolev <enqlave@gmail.com> * All rights reserved. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "cabal.hpp" Core *CABAL; void shut() { delete CABAL; exit(0); } void shut(string e) { cout << "Error: " << e << endl; delete CABAL; exit(0); } void showHelp() { cout << "\nUsage:\n" \ << "\t-d, --daemon | daemon mode\n" \ << "\t-c, --config <file> | configuration file\n" \ << "\t-h, --help | this message\n" \ << "\nCopyright (c) 2007-2008 Vlad Glagolev (BSD license)\n" << endl; exit(0); } int main(int argc, char **argv) { cout << "-- CABAL -- " << VERSION << " (CORE: " << VERSION_CORE ") | " \ << "Compiled: " << __DATE__ << " at " << __TIME__ << endl; if (argc < 2) showHelp(); CABAL = new Core(); CABAL->parseCommandLine(argc, argv); CABAL->parseConfig(); CABAL->checkPID(); if (!CABAL->debug) daemonize(); CABAL->writePID(); CABAL->work(); return 0; }
