home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / share / pctty.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-19  |  1.2 KB  |  64 lines

  1. /*    SCCS Id: @(#)pctty.c    3.1    90/22/02
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. /* tty.c - (PC) version */
  6.  
  7. #define NEED_VARARGS /* Uses ... */    /* comment line for pre-compiled headers */
  8. #include "hack.h"
  9. #include "wintty.h"
  10.  
  11. char erase_char, kill_char;
  12.  
  13. /*
  14.  * Get initial state of terminal, set ospeed (for termcap routines)
  15.  * and switch off tab expansion if necessary.
  16.  * Called by startup() in termcap.c and after returning from ! or ^Z
  17.  */
  18. void
  19. gettty(){
  20.     erase_char = '\b';
  21.     kill_char = 21;        /* cntl-U */
  22.     flags.cbreak = TRUE;
  23. #if !defined(TOS)
  24.     disable_ctrlP();    /* turn off ^P processing */
  25. #endif
  26. }
  27.  
  28. /* reset terminal to original state */
  29. void
  30. settty(s)
  31. const char *s;
  32. {
  33.     end_screen();
  34.     if(s) raw_print(s);
  35. #if !defined(TOS)
  36.     enable_ctrlP();        /* turn on ^P processing */
  37. #endif
  38. }
  39.  
  40. /* called by init_nhwindows() and resume_nhwindows() */
  41. void
  42. setftty()
  43. {
  44.     start_screen();
  45. }
  46.  
  47. /* fatal error */
  48. /*VARARGS1*/
  49.  
  50. void
  51. error VA_DECL(const char *,s)
  52.     VA_START(s);
  53.     VA_INIT(s, const char *);
  54.     /* error() may get called before tty is initialized */
  55.     if (flags.window_inited) end_screen();
  56.     putchar('\n');
  57.     Vprintf(s,VA_ARGS);
  58.     putchar('\n');
  59.     VA_END();
  60.     exit(1);
  61. }
  62.  
  63. /*pctty.c*/
  64.