-FIELD* _nc_get_field(const FORM* frm, int idx) {
- if (frm && frm->field && idx>=0 && (idx<frm->maxfield))
- {
- return frm->field[idx];
- }
- else
- return (FIELD*)0;
+int
+main(
+ int argc GCC_UNUSED,
+ char *argv[] GCC_UNUSED)
+{
+ int j;
+ int active_tty = 0;
+ DITTO *data;
+
+ if (argc <= 1)
+ usage();
+
+ if ((data = (DITTO *)calloc(argc, sizeof(DITTO))) == 0)
+ failed("calloc data");
+
+ data[0].input = stdin;
+ data[0].output = stdout;
+ for (j = 1; j < argc; j++) {
+ data[j].input =
+ data[j].output = open_tty(argv[j]);
+ }
+
+ /*
+ * If we got this far, we have open connection(s) to the terminal(s).
+ * Set up the screens.
+ */
+ for (j = 0; j < argc; j++) {
+ active_tty++;
+ data[j].screen = newterm(
+ (char *)0, /* assume $TERM is the same */
+ data[j].output,
+ data[j].input);
+ if (data[j].screen == 0)
+ failed("newterm");
+ cbreak();
+ noecho();
+ scrollok(stdscr, TRUE);
+ }
+
+ /*
+ * Loop, reading characters from any of the inputs and writing to all
+ * of the screens.
+ */
+ for(;;) {
+ int ch;
+ set_term(data[0].screen);
+ ch = getch();
+ if (ch == ERR)
+ continue;
+ if (ch == 4)
+ break;
+ for (j = 0; j < argc; j++) {
+ set_term(data[j].screen);
+ addch(ch);
+ refresh();
+ }
+ }
+
+ /*
+ * Cleanup and exit
+ */
+ for (j = argc-1; j >= 0; j--) {
+ set_term(data[j].screen);
+ endwin();
+ }
+ return EXIT_SUCCESS;