Newer
Older
/*
This file is part of SLC.
Copyright (C) 2008 Sebastien LUTTRINGER (<contact@seblu.net> )
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 US
*/
#include <getopt.h>
#include "slc.hh"
#include "options.hh"
/*!
** 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);
C.start();
// Treat keyboards events
S.eventsloop();
// Save history
H.save(O.history_file);
}
catch (const Error &e) {
endwin();
e.print();
_exit(e.code());
}
/*!
** 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;