15
15
You should have received a copy of the GNU General Public License
16
16
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
In addition, as a special exception, the copyright holders give
19
permission to link the code of portions of this program with the
20
OpenSSL library under certain conditions as described in each
21
individual source file, and distribute linked combinations including
24
You must obey the GNU General Public License in all respects for all
25
of the code used other than OpenSSL. If you modify file(s) with this
26
exception, you may extend this exception to your version of the
27
file(s), but you are not obligated to do so. If you do not wish to do
28
so, delete this exception statement from your version. If you delete
29
this exception statement from all source files in the program, then
19
33
#include "config.h"
21
35
#include <stdlib.h>
22
36
#include <string.h>
25
39
#include "stmclient.h"
26
40
#include "crypto.h"
27
41
#include "locale_utils.h"
29
/* these need to be included last because of conflicting defines */
42
#include "fatal_assert.h"
44
/* These need to be included last because of conflicting defines. */
46
* stmclient.h includes termios.h, and that will break termio/termios pull in on Solaris.
47
* The solution is to include termio.h also.
48
* But Mac OS X doesn't have termio.h, so this needs a guard.
54
#if defined HAVE_NCURSESW_CURSES_H
55
# include <ncursesw/curses.h>
56
# include <ncursesw/term.h>
57
#elif defined HAVE_NCURSESW_H
58
# include <ncursesw.h>
60
#elif defined HAVE_NCURSES_CURSES_H
61
# include <ncurses/curses.h>
62
# include <ncurses/term.h>
63
#elif defined HAVE_NCURSES_H
66
#elif defined HAVE_CURSES_H
70
# error "SysV or X/Open-compatible Curses header file required"
33
73
void usage( const char *argv0 ) {
34
74
fprintf( stderr, "mosh-client (%s)\n", PACKAGE_STRING );
58
98
/* For security, make sure we don't dump core */
59
99
Crypto::disable_dumping_core();
101
/* Detect edge case */
102
fatal_assert( argc > 0 );
61
104
/* Get arguments */
63
106
while ( (opt = getopt( argc, argv, "c" )) != -1 ) {
135
} catch ( Network::NetworkException e ) {
178
} catch ( const Network::NetworkException &e ) {
136
179
fprintf( stderr, "Network exception: %s: %s\r\n",
137
180
e.function.c_str(), strerror( e.the_errno ) );
138
} catch ( Crypto::CryptoException e ) {
181
} catch ( const Crypto::CryptoException &e ) {
139
182
fprintf( stderr, "Crypto exception: %s\r\n",
140
183
e.text.c_str() );