/* This file is part of SLC. Copyright (C) 2008 Sebastien LUTTRINGER SLC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. SLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SLC; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include "slc.hh" #include "options.hh" #include "screen.hh" #include "history.hh" #include "error.hh" #include "connection.hh" Screen S; Options O; History H; Connection C; pthread_t g_thread_reader; /*! ** Program entry point ** ** @param argc arg count ** @param argv arg vector ** ** @return program err code */ int main(int argc, char *argv[]) { try { // get argvline options O.load(argc, argv); // get environment options O.loadenv(); // load cmd history H.load(O.history_file); // Create graphic env S.init(); // Showing login screen. Retrieve user/pass. S.login(); // Showing dialog screen S.dialog(); // start connexion C.start(); // Treat keyboards events S.eventsloop(); // Save history H.save(O.history_file); } catch (const Error &e) { endwin(); e.print(); _exit(e.code()); } return 0; } /*! ** Entry point of the second thread which is used to ** print data sent by server */ void *thread_reader(void *) { while (C.connected()) S << "<< " << C.recvln() << "\n"; pthread_exit(0); return 0; }