~ubuntu-branches/ubuntu/precise/mosh/precise-backports

« back to all changes in this revision

Viewing changes to src/frontend/mosh-client.cc

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman
  • Date: 2013-07-27 09:27:56 UTC
  • mfrom: (5.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130727092756-e71no75ezcsg1569
Tags: 1.2.4a-1~ubuntu12.04.1
No-change backport to precise (LP: #1205640)

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
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/>.
 
17
 
 
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
 
22
    the two.
 
23
 
 
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
 
30
    also delete it here.
17
31
*/
18
32
 
19
33
#include "config.h"
20
34
 
21
35
#include <stdlib.h>
22
36
#include <string.h>
23
 
#include <getopt.h>
 
37
#include <unistd.h>
24
38
 
25
39
#include "stmclient.h"
26
40
#include "crypto.h"
27
41
#include "locale_utils.h"
28
 
 
29
 
/* these need to be included last because of conflicting defines */
30
 
#include <curses.h>
31
 
#include <term.h>
 
42
#include "fatal_assert.h"
 
43
 
 
44
/* These need to be included last because of conflicting defines. */
 
45
/*
 
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.
 
49
 */
 
50
#ifdef HAVE_TERMIO_H
 
51
#include <termio.h>
 
52
#endif
 
53
 
 
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>
 
59
#  include <term.h>
 
60
#elif defined HAVE_NCURSES_CURSES_H
 
61
#  include <ncurses/curses.h>
 
62
#  include <ncurses/term.h>
 
63
#elif defined HAVE_NCURSES_H
 
64
#  include <ncurses.h>
 
65
#  include <term.h>
 
66
#elif defined HAVE_CURSES_H
 
67
#  include <curses.h>
 
68
#  include <term.h>
 
69
#else
 
70
#  error "SysV or X/Open-compatible Curses header file required"
 
71
#endif
32
72
 
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();
60
100
 
 
101
  /* Detect edge case */
 
102
  fatal_assert( argc > 0 );
 
103
 
61
104
  /* Get arguments */
62
105
  int opt;
63
106
  while ( (opt = getopt( argc, argv, "c" )) != -1 ) {
132
175
 
133
176
    try {
134
177
      client.main();
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() );
141
184
    }