static void tfini(void) { #ifdef TERMINFO TPUTS(reset_1string); resetterm(); #endif #ifdef __unix__ tcsetattr(0, TCSAFLUSH, &save_tty); #endif tflush(); }
int dombwpages (int argc, char **argv, void *p) { struct mbx *m; char buf[80], *cp, origchar = 0; m = (struct mbx *) p; if (argc < 2) { tprintf (wp_syntax, m->privs & SYSOP_CMD ? " [@bbsname]" : ""); return 0; } if (!(m->privs & SYSOP_CMD) && argc > 2) { j2tputs (sorry); return 0; } if (argc == 2) /* lookup */ { /* 12Mar2012, Maiko, Original code put into separate function */ wpage_lookup (&argv[1], (char*)0, (struct mbx*)0); } else { /* else, setting it */ if (argv[2][0] != '@') j2tputs (wp_sysopsyntax); else { if ((cp = strchr (argv[2], '.')) != NULLCHAR) { sprintf (buf, &argv[2][1]); (void) strupr (buf); wpageAdd (buf, 1, 1, 'U'); origchar = *cp; *cp = 0; } sprintf (buf, "%s%s", argv[1], argv[2]); (void) strlwr (buf); wpageAdd (buf, 0, 1, 'U'); if (cp && origchar) *cp = origchar; j2tputs (updating); tflush (); pwait (NULL); RenewWPages (); } } return 0; }
void dxp_machine (int dev, HFDD_PARAMS *hfddp) { int c, bbs_mode = 0; hfdd_state = init; hfdd_conn_flag = 0; /* default no connected */ /* 19Feb2005, Maiko, Okay DXP now has bbs mode as well */ if (!memcmp ("bbs", hfddp->call, 3)) bbs_mode = 1; while (hfdd_state != finished) { if (pwait (NULL)) break; /* move init and connect into the machine now */ switch (hfdd_state) { case init: dxp_init (dev, hfddp->pactor); hfdd_state = call; break; case call: /* 19Feb2005, Maiko, Okay DXP now has bbs mode as well */ if (!bbs_mode) dxp_connect (dev, hfddp->call, hfddp->pactor); hfdd_state = called; break; case idle: case called: case connected: case finished: break; } if ((c = get_asy (dev)) == -1) break; if (c == 0x80) { #ifdef DEBUG log_flush (); #endif if ((c = get_asy (dev)) == -1) break; /* 04Oct2006, Maiko, More restructuring, etc */ if (c == 0x7a) { if (dxp_fsk_status (dev) == -1) break; continue; } if (dxp_status (dev, c) == -1) break; if (c == 0x23 || c == 0x24) { if (dxp_eat_the_END (dev) == -1) break; if (hfddp->keyboard) { if (c == 0x23) tprintf ("*** disconnected from %s\n", hfddp->call); else tprintf ("*** failure with %s\n", hfddp->call); } hfdd_state = finished; break; } /* 22Jan2005, Maiko, Stumbled across this new one */ else if (c == 0x09) { if (hfddp->keyboard) tprintf ("*** modem reset\n"); hfdd_state = finished; break; } /* * 21Jan2005, Maiko, Added 'signal lost' conditional * 14Feb2005, Maiko, Oops, HalComm says I should ignore this, * since the modem will send me the link failed status (8024) * when the link actually fails !!! I should NOT be terminating * session on 'signal lost' conditions. Just warn the user ! */ else if (c == 0x25) { if (dxp_eat_the_END (dev) == -1) break; if (hfddp->keyboard) tprintf ("*** signal lost with %s\n", hfddp->call); break; } else if (bbs_mode || (hfdd_state == call) || (hfdd_state == called)) { if (c == 0x10) { if (hfddp->keyboard) j2tputs ("Trying... Escape sequence is: +++<CR>\n"); } /* 16Feb2005, Maiko, Added P-Mode connected flag */ else if ((c == 0x20) || (c == 0x2b)) { if (bbs_mode) { /* 05Mar2005, Maiko, Get incoming callsign */ if (dxp_get_incall (dev, hfddp->call) == -1) { log (-1, "dxp_get_incall () failed !!!"); hfdd_state = finished; break; } /* 09Oct2006, Maiko, Lower case the call */ strlwr (hfddp->call); /* 06Mar2005, Maiko, Now a generic function */ hfdd_mbox (dev, mbxs, (void*)TTY_LINK, (void*)(hfddp->call)); } else { if (hfddp->keyboard) tprintf ("*** connected to %s\n", hfddp->call); hfdd_state = connected; } /* 18Jan2005, Maiko, integrated into fwding now */ /* 28Feb2005, Maiko, Set this either way !! */ hfdd_conn_flag = 1; } } #ifdef DONT_COMPILE if (hfddp->keyboard) usflush (Curproc->output); #endif continue; } /* * 04Oct2006, Maiko, Forgot about the *other* ESC character. If we * get one of these, then the byte that follows is actual DATA !!! */ if (c == 0x81) { log (-1, "escape character"); if ((c = get_asy (dev)) == -1) break; } #ifdef DEBUG log_data (c); #endif /* 18Jan2005, Maiko, Now doing fwd support for Halcomm */ if (hfdd_fwdsock != -1) { usputc (hfdd_fwdsock, c); usflush (hfdd_fwdsock); } else if (bbs_mode) { usputc (mbxs[0], c); usflush (mbxs[0]); } else { if (hfddp->keyboard) { /* Map to NL or else we loose data when we display it */ if (c == 0x0d) c = '\n'; tputc (c); /* assuming this is actual data (for now) */ tflush (); } } } if (hfddp->keyboard) usflush (Curproc->output); }