home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / ckc095.zip / ckmusr.c < prev    next >
C/C++ Source or Header  |  1989-08-22  |  22KB  |  787 lines

  1. /* edit by John A. Oberschelp for Emory University -- vt102 printer support 22 May 1989 */
  2. /*                    Emory contact is Peter W. Day, ospwd@emoryu1.cc.emory.edu */ 
  3. /* various edits by PWP 8/88 -- 5/89: much rearangement, new menus 'n stuff */
  4. /* edit by PWP 3/27/88 -- Make the log session and transaction stuff a   */
  5. /*  separate menu. */
  6. /* edits by PWP -- Nov. 87..Mar. 88  Fixed several oversights, bugs, etc., */
  7. /* added MultiFinder support */
  8. /* Version 0.9(36) - Matthias Aebi, ECOFIN Research and Consulting, Ltd., */
  9. /*  Oct 1987 ported to MPW C */
  10. /* Version 0.8(35) - Jim Noble at Planning Research Corporation, June 1987. */
  11. /* Ported to Megamax native Macintosh C compiler. */
  12. /* DPVC at U of R, on Oct 1, to do blinking cursor and mouse cursor movement */
  13. /* Edit by Bill, Jeff, and Howie on Jun 13 */
  14. /* Add select window, drag */
  15. /* Edit by WBC3 on Apr 29 */
  16. /* Don't supply a second name for send as, otherwise file name translation */
  17. /* will not occur.  Let user type it if they want. */
  18. /* Edit by WBC3 on Apr 23 */
  19. /* Make typein to the emulator only take effect when it's the "front window" */
  20. /* Edit by WBC3 on Apr 23 */
  21. /* Make only Command-. stop protocol rather then anything but Command-. */
  22. /* Edit by WBC3 on Apr 22 */
  23. /* Make debug and tlog only show up if DEBUG is defined */
  24. /* Edit by Bill on Apr 21 17:51 */
  25. /* In Screen depelete event queue instead of handling one event at */
  26. /* a time, also don't loose events */
  27.  
  28. /*
  29.  * file ckmusr.c
  30.  *
  31.  * Module of mackermit containing code for the menus and other MacIntosh
  32.  * things.
  33.  *
  34.  */
  35.  
  36. /*
  37.  Copyright (C) 1985, Trustees of Columbia University in the City of New York.
  38.  Permission is granted to any individual or institution to use, copy, or
  39.  redistribute this software so long as it is not sold for profit, provided this
  40.  copyright notice is retained.
  41. */
  42.  
  43. #include "ckcdeb.h"
  44. #include "ckcker.h"
  45.  
  46. #define    __SEG__ ckmusr
  47. #include <desk.h>
  48. #include <files.h>
  49. #include <windows.h>
  50. #include <events.h>
  51. #include <dialogs.h>
  52. #include <fonts.h>
  53. #include <menus.h>
  54. #include <toolutils.h>
  55. #include <serial.h>
  56. #include <textedit.h>
  57. #include <segload.h>
  58. #include <ctype.h>
  59.  
  60. #include <printing.h>    /*JAO*/
  61.  
  62. /* here is what is different */
  63. #ifndef __QUICKDRAW__
  64. #include <QuickDraw.h>
  65. #endif
  66. #include <osutils.h>
  67. /* PWP: put the #include for the script manager here! */
  68.  
  69. #include "ckmdef.h"        /* General Mac defs */
  70. #include "ckmres.h"        /* Mac resource equates */
  71. #include "ckmasm.h"        /* new A8 and A9 traps */
  72.  
  73. /* Global Variables */
  74.  
  75. MenuHandle menus[MAX_MENU + 1];    /* handle on our menus */
  76.  
  77. short innum;            /* Input driver refnum */
  78. short outnum;            /* Output driver refnum */
  79. int protocmd;            /* protocol file cmd, or -1 for */
  80.  /* remote cmds, or 0 if not in */
  81.  /* protocol */
  82.  
  83. char *mybuff;            /* Serial drivers new buffer */
  84.  
  85. SerShk controlparam;        /* To change serial driver paramaters */
  86.  
  87. int quit = FALSE;
  88.  
  89. Boolean mcmdactive = TRUE;    /* Enable menu command keys */
  90. Boolean fkeysactive = TRUE;    /* Enable FKEYs */
  91.  
  92. WindowPtr terminalWindow;    /* the terminal window */
  93. extern WindowPtr remoteWindow;    /* the remote command window */
  94.  
  95.  
  96. /* local variables */
  97.  
  98. Boolean have_multifinder = FALSE; /* becomes true if we are running MF */
  99. Boolean in_background = FALSE;    /* becomes TRUE if have_multifinder and
  100.                  * we have recieved a "suspend" event */
  101.  
  102. long mf_sleep_time = 3L;    /* this is the number of (60Hz) ticks to
  103.                  * sleep before getting a nullEvent (to
  104.                  * flash our cursor) (and input chars from
  105.                  * the serial line)
  106.                  */
  107.  
  108. Boolean have_128roms = FALSE;    /* actually, a Mac + or better */
  109.  
  110. #define switchEvt     1        /* Switching event (suspend/resume )  for app4evt */
  111.  
  112. void updateCursor();
  113.  
  114. extern Handle    hPrintBuffer;            /*JAO*/
  115.  
  116. /****************************************************************************/
  117. /*
  118.  *  p a r s e r
  119.  *
  120.  *  Entry point for kermit.
  121.  *  Establish a virtual terminal connection with the remote host and
  122.  *  process mouse events, such as selecting items from the menu bars.
  123.  *
  124.  */
  125. /****************************************************************************/
  126. char
  127. parser ()
  128. {
  129.     char menu_event ();
  130.     char domouse ();
  131.     char nextcmd ();
  132.     char rstate = 0;
  133.     EventRecord myevent;
  134.  
  135.     if (tlevel > -1) {        /* if we are working under take-file */
  136.     rstate = nextcmd ();    /* file control, get next command */
  137.     if (!quit)
  138.         return (rstate);
  139.     }
  140.     protocmd = 0;        /* protocol not active */
  141.     updateCursor(1, NIL);    /* back to normal cursor */
  142.     
  143.     while (!(quit || rstate)) {    /* Until they want to quit */
  144.     /* or return */
  145.     if (!have_multifinder)    /* MF does this for us */
  146.         SystemTask ();    /* Update system things */
  147.  
  148.     /* Handle all the pending port chars */
  149.     inpchars ();
  150.  
  151.     if (have_multifinder)
  152.         /* task, task */
  153.         WaitNextEvent (everyEvent, &myevent, mf_sleep_time, NULL);
  154.     else
  155.         GetNextEvent (everyEvent, &myevent);
  156.  
  157.     switch (myevent.what) {    /* events */
  158.       case keyDown:    /* Handle char input */
  159.       case autoKey:    /* both ways */
  160.         if ((myevent.modifiers & cmdKey) && (mcmdactive)) {
  161.         rstate = menu_event (MenuKey (myevent.message & charCodeMask));
  162.         HiliteMenu (0);    /* Done, so un-hilite */
  163.         } else if (FrontWindow () == terminalWindow)
  164.         handle_char (&myevent);
  165.         break;
  166.  
  167.       case updateEvt:    /* A window update event */
  168.         doupdate ((WindowPtr) myevent.message);    /* Handle update */
  169.         break;
  170.  
  171.       case activateEvt:    /* (de)active a window */
  172.         doactivate ((WindowPtr) myevent.message, myevent.modifiers);
  173.         break;
  174.  
  175.       case mouseDown:    /* Mouse event */
  176.         rstate = domouse (&myevent);
  177.         break;
  178.  
  179.       case app4Evt:    /* could be a suspend/resume event */
  180.         if ((have_multifinder) &&
  181.             (((myevent.message >> 24) & 0xff) == switchEvt)) {
  182.         in_background = ((myevent.message & 0x1) == 0);
  183.         /* do suspend things */
  184.         }
  185.         updateCursor(1, myevent.message);
  186.         break;
  187.     }
  188.     
  189.     if (blinkcursor)    /* PWP: save some time */
  190.         flash_cursor (terminalWindow);    /* (UoR) for flashing cursor */
  191.  
  192.     updateCursor(0, NIL);
  193.     }
  194.  
  195.     if (quit)            /* want to exit the program? */
  196.     doexit (0);        /* yes, finish up */
  197.  
  198.     updateCursor(1, NIL);    /* set the watch */
  199.     return (rstate);        /* and return with state */
  200. }                /* parser */
  201.  
  202.  
  203.  
  204. /****************************************************************************/
  205. /* miniparser - called during protocol to handle events.  Handles dialog, */
  206. /*                  update, and keydown (the abort key) events.  Ignores */
  207. /*                  all other events.  The dialog events are assumed to */
  208. /*                  be for screen (status) display. */
  209. /****************************************************************************/
  210. miniparser (deplete)        /* deplete pending events */
  211. {
  212.     EventRecord ev;
  213.     DialogPtr mydlg;
  214.     short item;
  215.  
  216.     do {
  217.     if (have_multifinder) {
  218.         /* task, task */
  219.         WaitNextEvent (everyEvent, &ev, mf_sleep_time, NULL);
  220.     } else {
  221.         SystemTask ();    /* let the system move */
  222.         GetNextEvent (everyEvent, &ev);    /* get an event */
  223.     }
  224.  
  225.     if (ev.what == nullEvent)
  226.         return;        /* depleted pending events */
  227.  
  228.     if (IsDialogEvent (&ev))/* meant for dialog manager? */
  229.         /* must be for screen */
  230.         if (DialogSelect (&ev, &mydlg, &item))
  231.         scrmydlg (item);/* let him handle it */
  232.  
  233.     switch (ev.what) {    /* we may need to do something */
  234.       case updateEvt:
  235.         doupdate ((WindowPtr) ev.message);    /* handle updates */
  236.         break;
  237.  
  238.       case keyDown:
  239.         if ((ev.modifiers & cmdKey) && ((ev.message & 0x7f) == '.')) {
  240.         if (CautionAlert (ALERT_ABORT, NILPROC) == OKBtn)
  241.             sstate = 'a';    /* move into abort state */
  242. #ifdef COMMENT
  243.         } else {
  244.         if ((ev.message & 0x7f) == 015)    /* if RETURN */
  245.             resend();
  246. #endif
  247.         }
  248.         break;
  249.  
  250.       case app4Evt:    /* really a suspend/resume event */
  251.         if ((have_multifinder) &&
  252.             (((ev.message >> 24) & 0xff) == switchEvt)) {
  253.         in_background = ((ev.message & 0x1) == 0);
  254.         /* PWP: do stuff for disabling the status window here */
  255.         }
  256.         break;
  257.  
  258.     }
  259.     } while (deplete);        /* return now, or loop */
  260. }                /* miniparser */
  261.  
  262.  
  263.  
  264. /****************************************************************************/
  265. /* domouse  - handle mouse down events for different windows. */
  266. /****************************************************************************/
  267. char
  268. domouse (evt)
  269. EventRecord *evt;
  270. {
  271.     char state = 0;
  272.     WindowPtr window;
  273.     int evtwcode;
  274.  
  275.     evtwcode = FindWindow (&evt->where, &window);
  276.  
  277.     switch (evtwcode) {        /* Tell us where */
  278.       case inMenuBar:        /* Looking at the menus? */
  279.     updateCursor (1, (WindowPtr) NIL);    /* (UoR) mouse cursor off */
  280.     state = menu_event (MenuSelect (&evt->where));
  281.     HiliteMenu (0);        /* Done, so un-hilite */
  282.     break;            /* All done */
  283.  
  284.       case inSysWindow:    /* Looking at system, like */
  285.     SystemClick (evt, window);    /* a desk accessary */
  286.     break;            /* Let the system handle it */
  287.  
  288.       case inContent:
  289.     if (window != FrontWindow ())
  290.         SelectWindow (window);    /* make window current */
  291.     else if (window == terminalWindow)
  292.         termmouse (evt);
  293.     else if (window == remoteWindow)
  294.         rcdmouse (evt);
  295.     break;
  296.  
  297.       case inDrag:        /* Wanna drag? */
  298.     DragWindow (window, &evt->where, &qd.screenBits.bounds);
  299.     break;
  300.  
  301.       case inGoAway:
  302.     if (TrackGoAway (remoteWindow, &evt->where))
  303.         rcmdwhide ();    /* put it away */
  304.     break;
  305.  
  306.       case inGrow:
  307.     if (window != FrontWindow ())
  308.         SelectWindow (window);    /* make window current */
  309.     else if (window == terminalWindow)
  310.         growterm (&evt->where);
  311.     else if (window == remoteWindow)
  312.         growwindow (remoteWindow, &evt->where);
  313.     break;
  314.     }
  315.  
  316.     flash_cursor ((WindowPtr) NIL);    /* (UoR) reset timer for flashes */
  317.     return (state);        /* return with new state or 0 */
  318.  
  319. }                /* domouse */
  320.  
  321.  
  322.  
  323. /****************************************************************************/
  324. /* doupdate - handle update event on different windows, dispatch to */
  325. /*              redraw routines */
  326. /****************************************************************************/
  327. doupdate (window)
  328. WindowPtr window;
  329. {
  330.     GrafPtr savePort;
  331.  
  332.     GetPort (&savePort);
  333.     SetPort (window);
  334.     BeginUpdate (window);
  335.  
  336.     if (window == terminalWindow)
  337.     term_redraw ();        /* terminal window */
  338.     else if (window == remoteWindow)
  339.     rcdupdate (window);    /* Redraw remote command window */
  340.  
  341.     EndUpdate (window);
  342.     SetPort (savePort);
  343. }                /* doupdate */
  344.  
  345.  
  346.  
  347. /****************************************************************************/
  348. /* doactivate - activate a window */
  349. /****************************************************************************/
  350. doactivate (window, mod)
  351. WindowPtr window;
  352. int mod;
  353. {
  354.     GrafPtr savePort;
  355.  
  356.     GetPort (&savePort);
  357.     SetPort (window);
  358.  
  359.     HiliteWindow (window, ((mod & activeFlag) != 0));
  360.     if (window == remoteWindow) {
  361.     rcdactivate (mod);
  362.     } else if (window == terminalWindow) {
  363.         term_activate(mod & activeFlag);
  364.     }
  365.     updateCursor(1, window);
  366.     if (!EmptyRgn(((WindowPeek)terminalWindow)->updateRgn))
  367.     doupdate (terminalWindow);    /* Fake an update event */
  368.  
  369.     SetPort (savePort);
  370. }                /* doactivate */
  371.  
  372.  
  373.  
  374. char genstr[100];
  375.  
  376. #define VT100FONT  128        /* VT100 Terminal Font (not-bold) */        /*JAO*/
  377.  
  378. /****************************************************************************/
  379. /****************************************************************************/
  380. char
  381. menu_event (menu_item)
  382. long menu_item;
  383. {
  384.     short menu = HiWord (menu_item);    /* decompose arg */
  385.     short item = LoWord (menu_item);
  386.     char state = '\0';
  387.     int remotedialog ();    /* returns boolean */
  388.     WindowPtr window;
  389.  
  390.     switch (menu) {
  391.       case APPL_MENU:        /* Mac system menu item */
  392.     handapple (item);
  393.     break;            /* all done */
  394.  
  395.       case FILE_MENU:
  396.       case FILE_MEN2:
  397.     switch (item) {        /* Find out which was selected */
  398.       case QUIT_FIL:    /* Want to quit program? */
  399.         quit = TRUE;    /* Yes... flag it */
  400.         break;
  401.       case XFER_FIL:
  402.         handlelaunch ();    /* Handle x-fer to application */
  403.         break;
  404.  
  405.       case SAVE_FIL:    /* save settings */
  406.         savevals ();    /* save em */
  407.         break;
  408.  
  409.       case LOAD_FIL:    /* load settings */
  410.         loadvals ();
  411.         break;
  412.  
  413.       case SEND_FIL:    /* send a file: local, remote files */
  414.         if (!dosenddialog (&cmarg, &cmarg2))
  415.         break;
  416.         nfils = -1;        /* Use cmarg, not cmlist */
  417.         state = 's';    /* return with send state */
  418.         break;
  419.  
  420.       case RECV_FIL:    /* Ask for recv info -- */
  421.         initfilrecv ();    /* init recv flags */
  422.         state = 'v';    /* return with recv state */
  423.         break;
  424.  
  425.       case GETS_FIL:    /* Get from server */
  426.         if (dogetfdialog (&cmarg))    /* remote-file. */
  427.         state = 'r';    /* Say we want to get */
  428.         break;
  429.         
  430.       case STATS_FIL:    /* show transfer stats */
  431.         show_stats();
  432.         break;
  433.         
  434.       case CWD_FIL:        /* set transfer directory */
  435.         set_cwd();
  436.         break;
  437.     }
  438.  
  439.     if (state != '\0') {    /* going to enter protocol? */
  440.         protocmd = item;    /* yes, remember how */
  441.         scrcreate ();    /* create the status screen */
  442.     }
  443.     break;
  444.  
  445.       case EDIT_MENU:        /* PWP: good for DA editors */
  446.       case EDIT_MEN2:        /* PWP: good for DA editors */
  447.         window = FrontWindow();    /* we do different things based on this */
  448.     
  449.         switch(item) {
  450.       case UNDO_EDIT:    /* undo */
  451.         if (window == terminalWindow) {
  452.         SysBeep(3);
  453.         } else if (window == remoteWindow) {
  454.         SysBeep (3);
  455.         } else {
  456.         if (!SystemEdit (item - 1))
  457.             SysBeep (3);
  458.         }
  459.         break;
  460.  
  461.       case CUT_EDIT:    /* cut */
  462.         if (window == terminalWindow) {
  463.         SysBeep (3);
  464.         } else if (window == remoteWindow) {
  465.         SysBeep (3);
  466.         } else {
  467.         if (!SystemEdit (item - 1))
  468.             SysBeep (3);
  469.         }
  470.         break;
  471.  
  472.       case COPY_EDIT:    /* copy */
  473.         if (window == terminalWindow) {
  474.         scr_copy();
  475.         } else if (window == remoteWindow) {
  476.         SysBeep (3);
  477.         } else {
  478.         if (!SystemEdit (item - 1))
  479.             SysBeep (3);
  480.         }
  481.         break;
  482.  
  483.       case PASTE_EDIT:    /* paste */
  484.         if (window == terminalWindow) {
  485.         scr_paste();
  486.         } else if (window == remoteWindow) {
  487.         SysBeep (3);
  488.         } else {
  489.         if (!SystemEdit (item - 1))
  490.             SysBeep (3);
  491.         }
  492.         break;
  493.  
  494.       case CLEAR_EDIT:    /* clear */
  495.         if (window == terminalWindow) {
  496.         SysBeep(3);
  497.         } else if (window == remoteWindow) {
  498.         SysBeep (3);
  499.         } else {
  500.         if (!SystemEdit (item - 1))
  501.             SysBeep (3);
  502.         }
  503.         break;
  504.       
  505.       case BREAK_EDIT:    /* send break */
  506.         if (window == terminalWindow)
  507.         sendbreak(5);
  508.         else
  509.         SysBeep(3);
  510.         break;
  511.  
  512.       case LBREAK_EDIT:    /* send break */
  513.         if (window == terminalWindow)
  514.         sendbreak(70);
  515.         else
  516.         SysBeep(3);
  517.         break;
  518.  
  519.       case XON_EDIT:    /* send XON */
  520.         if (window == terminalWindow)
  521.         do_xon();
  522.         else
  523.         SysBeep(3);
  524.         break;
  525.  
  526.       case DTR_EDIT:    /* toggle DTR */
  527.         if (window == terminalWindow)
  528.         toggle_dtr(70);
  529.         else
  530.         SysBeep(3);
  531.         break;
  532.     }
  533.     break;
  534.  
  535.       case SETG_MENU:
  536.       case SETG_MEN2:
  537.     switch (item) {
  538.       case PROT_SETG:
  539.         protodialog ();
  540.         break;
  541.  
  542.       case COMM_SETG:
  543.         commdialog ();    /* communications dialog */
  544.         break;
  545.  
  546.       case FILE_SETG:
  547.         setfiledialog ();    /* do default file settings */
  548.         break;
  549.  
  550.       case TERM_SETG:    /* do terminal emulation settings */
  551.         termsetdialog ();
  552.         break;
  553.  
  554.       case CHARS_SETG:    /* do terminal emulation settings */
  555.         charsetdialog ();
  556.         break;
  557.  
  558.       case SCRD_SETG:    /* fkeys  active / not active */
  559.         CheckItem (menus[SETG_MENU], SCRD_SETG,
  560.                (fkeysactive = !fkeysactive));
  561.         ScrDmpEnb = (fkeysactive) ? scrdmpenabled : scrdmpdisabled;
  562.         break;
  563.  
  564.       case MCDM_SETG:    /* menu command keys active / not active */
  565.         CheckItem (menus[SETG_MENU], MCDM_SETG,
  566.                (mcmdactive = !mcmdactive));
  567.         setup_menus();    /* redo menus */
  568.         break;
  569.  
  570.       case KEYM_SETG:
  571.         keymacros ();
  572.         break;
  573.  
  574.       case MODF_SETG:
  575.         keymoddialog ();
  576.         break;
  577.     }
  578.     break;
  579.  
  580.     /*
  581.      * return either 'g' for generic or 'c' for host with cmarg holding
  582.      * cmd
  583.      */
  584.  
  585.       case REMO_MENU:
  586.       case REMO_MEN2:
  587.     cmarg = genstr;        /* indicate cmd ok to proceed */
  588.     switch (item) {
  589.       case RESP_REMO:    /* Want to toggle display */
  590.         togglercmdw ();    /* Do it */
  591.         cmarg = NILPTR;    /* Don't do anything else */
  592.         break;
  593.  
  594.       case FIN_REMO:
  595.         setgen (genstr, 'F', "", "", "");    /* Finish */
  596.         break;
  597.  
  598.       case BYE_REMO:
  599.         setgen (genstr, 'L', "", "", "");    /* Bye, logout */
  600.         break;
  601.  
  602.       case SERV_REMO:
  603.         displa = 1;
  604.         scrcreate ();    /* create the status screen */
  605.         protocmd = item;
  606.         return ('x');
  607.  
  608.       default:
  609.         if (!remotedialog (item, genstr))
  610.         cmarg = NILPTR;    /* cancel issued, prevent it */
  611.         break;
  612.     }
  613.  
  614.     if (cmarg == NILPTR)
  615.         break;        /* Gave up on this command? */
  616.     protocmd = -1;        /* hey we're going to protocol! */
  617.     if (item == HOST_REMO)    /* Remote host? */
  618.         state = 'c';    /* yes, return it to driver */
  619.     else
  620.         state = 'g';    /* else generic */
  621.     break;
  622.     
  623.       case LOG_MENU:
  624.       case LOG_MEN2:
  625.     switch(item) {
  626.       case SLOG_LOG:    /* session logging */
  627.         if (seslog) {
  628.             scrlasttolog();    /* save the last line on the screen */
  629.         closeslog ();
  630.         seslog = 0;
  631.         } else {
  632.         seslog = openslog ();
  633.         scrtolog ();    /* if the file is open, just do the dump */
  634.         }
  635.         CheckItem (menus[LOG_MENU], SLOG_LOG, seslog);
  636.         if (seslog)
  637.             EnableItem(menus[LOG_MENU], SDMP_LOG);
  638.         else
  639.             DisableItem(menus[LOG_MENU], SDMP_LOG);
  640.         break;
  641.  
  642.       case SDMP_LOG:    /* dump screen to session log */
  643.         if (seslog)    {    /* session logging active? */
  644.         scrtolog ();    /* if the file is open, just do the dump */
  645.         } else {
  646.         SysBeep(3);    /* can't dump screen without a log file. */
  647.             DisableItem(menus[LOG_MENU], SDMP_LOG);
  648.         }
  649.         break;
  650.  
  651. #ifdef TLOG
  652.       case TLOG_LOG:    /* transaction logging */
  653.         if (tralog) {
  654.         closetlog ();
  655.         tralog = 0;
  656.         } else {
  657.         tralog = opentlog ();
  658.         }
  659.         CheckItem (menus[LOG_MENU], TLOG_LOG, tralog);
  660.         break;
  661. #endif TLOG
  662.     }
  663.     break;
  664.  
  665.     case PRNT_MENU:                                                            /*JAO*/
  666.     case PRNT_MEN2:                                                            /*JAO*/
  667.     switch(item) {                                                                /*JAO*/
  668.       case NOW_PRNT:    /* Print the Buffer */
  669.         now_print();
  670.         break;
  671.         
  672.       case STAT_PRNT:    /* Print Buffer Status Dialog Box */
  673.         pr_stat();
  674.         break;
  675.         
  676.       case DISC_PRNT:    /* Discard the Print Buffer */
  677.         DisableItem(menus[PRNT_MENU], 0);
  678.         DrawMenuBar();
  679.         if (hPrintBuffer)
  680.         DisposHandle(hPrintBuffer);
  681.         hPrintBuffer = 0L;
  682.         break;
  683.     }
  684.     break;
  685.  
  686.     }
  687.     return (state);        /* Don't go into Kermit protocol */
  688. }                /* menu_event */
  689.  
  690. /****************************************************************************/
  691. /****************************************************************************/
  692. herald ()
  693. {
  694. }                /* herald */
  695.  
  696.  
  697.  
  698. /****************************************************************************/
  699. /****************************************************************************/
  700. conect ()
  701. {
  702.     /* we already ARE connected */
  703. }                /* conect */
  704.  
  705.  
  706. /****************************************************************************/
  707. /****************************************************************************/
  708. cmdlin ()
  709. {
  710.     return (0);            /* nothing parsed */
  711. }                /* cmdlin */
  712.  
  713.  
  714.  
  715. /****************************************************************************/
  716. /****************************************************************************/
  717. chkint ()
  718. {
  719. }                /* chkint */
  720.  
  721.  
  722.  
  723. #ifdef DEBUG
  724. /****************************************************************************/
  725. /****************************************************************************/
  726. debug (flags, str, str2, num)
  727. int flags;
  728. int num;
  729. char *str;
  730. char *str2;
  731. {
  732.     char numbuf[10];
  733.  
  734.     /* if (!debflg) return; */
  735.  
  736.     switch (flags) {
  737.       default:
  738.     NumToString ((long) num, numbuf);
  739.     ParamText (str, str2, numbuf, "");
  740.     CautionAlert (ALERT_DEBUG, NILPROC);
  741.     break;
  742.     }
  743. }                /* debug */
  744.  
  745. #endif
  746.  
  747.  
  748.  
  749. /****************************************************************************/
  750. /* sleep - called during protocol for a dismiss.  Keep machine running */
  751. /*           with calls to the miniparser during this period. */
  752. /****************************************************************************/
  753. sleep (secs)
  754. {
  755.     long finalticks;        /* tickscount for exit */
  756.  
  757.     finalticks = TickCount () + (60 * secs);    /* TickCount for exit  */
  758.     while (finalticks > TickCount ()) {    /* keep the machine running by */
  759.     miniparser (TRUE);    /* deplete the Q */
  760.     if (sstate == 'a')    /* if in abort state, forget */
  761.         return;        /* this wait */
  762.     }
  763. }                /* sleep */
  764.  
  765.  
  766.  
  767. /****************************************************************************/
  768. /****************************************************************************/
  769. ermsg (msg)            /* Print error message */
  770. char *msg;
  771. {
  772.     screen (SCR_EM, 0, 0l, msg);/* Put the error on the screen */
  773.     tlog (F110, "Error -", msg, 0l);
  774. }                /* ermsg */
  775.  
  776.  
  777.  
  778. /****************************************************************************/
  779. /****************************************************************************/
  780. intmsg (n)
  781. long n;
  782. {
  783.     return;
  784. }                /* intmsg */
  785.  
  786.  
  787.