+ else if (key == 'a')
+ {
+ char host[80];
+
+ wprintw(main_win, "New Host: ");
+ echo();
+ wgetnstr(main_win, host, sizeof(host));
+ noecho();
+
+ if (ping_host_add(ping, host) < 0)
+ {
+ const char *errmsg = ping_get_error (ping);
+
+ wprintw (main_win, "Adding host `%s' failed: %s\n", host, errmsg);
+ }
+ else
+ {
+ int box_height = (opt_show_graph == 0) ? 4 : 5;
+
+ /* make sure old data is still visible */
+ for (int i = 0; i<box_height; i++)
+ wprintw (main_win, "\n");
+
+ need_resize = 1;
+ host_num++;
+ ping_initialize_contexts(ping);
+ }
+ }