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