3 #include <ncurses.h> /* keypad() */
4 #include <signal.h> /* struct sigaction, sigaction() */
5 #include <stdlib.h> /* exit() */
6 #include <string.h> /* memset() */
7 #include "../common/rexit.h" /* set_cleanup_func(), exit_trouble() */
8 #include "cleanup.h" /* cleanup(), set_cleanup_flag() */
9 #include "command_db.h" /* init_command_db() */
10 #include "io.h" /* io_loop(), try_send() */
11 #include "misc.h" /* load_interface_conf(), winch_called() */
12 #include "windows.h" /* struct Win, winch_called() */
13 #include "world.h" /* struct World */
21 int main(int argc, char * argv[])
23 char * f_name = "main()";
25 /* Declare hard-coded paths here. */
26 world.path_server_in = "server/in";
27 world.path_interface_conf = "confclient/interface_conf";
29 /* Parse command line arguments. */
30 obey_argv(argc, argv);
32 /* So error exits also go through the client's cleanup() function. */
33 set_cleanup_func(cleanup);
35 /* Initialize the whole interface. */
36 world.windb.t_screen = initscr();
37 set_cleanup_flag(CLEANUP_NCURSES);
40 keypad(world.windb.t_screen, TRUE);
41 init_command_db(); /* The command DB needs to be initialized before */
42 load_interface_conf(); /* the interface, whose keybindings depend on it. */
44 /* Set handler for terminal window resizing. */
46 memset(&act, 0, sizeof(act));
47 act.sa_handler = &winch_called;
48 exit_trouble(sigaction(SIGWINCH, &act, NULL), f_name, "sigaction()");
50 /* This is where most everything happens. */
51 char * quit_msg = io_loop();
55 printf("%s\n", quit_msg);