home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / EDITOR / NVI179B / NVI179B.ZIP / ip / ip_term.c < prev    next >
C/C++ Source or Header  |  1996-10-13  |  2KB  |  109 lines

  1. /*-
  2.  * Copyright (c) 1996
  3.  *    Keith Bostic.  All rights reserved.
  4.  *
  5.  * See the LICENSE file for redistribution information.
  6.  */
  7.  
  8. #include "config.h"
  9.  
  10. #ifndef lint
  11. static const char sccsid[] = "@(#)ip_term.c    8.2 (Berkeley) 10/13/96";
  12. #endif /* not lint */
  13.  
  14. #include <sys/types.h>
  15. #include <sys/queue.h>
  16.  
  17. #include <bitstring.h>
  18. #include <stdio.h>
  19.  
  20. #include "../common/common.h"
  21. #include "ip.h"
  22.  
  23. /*
  24.  * ip_term_init --
  25.  *    Initialize the terminal special keys.
  26.  *
  27.  * PUBLIC: int ip_term_init __P((SCR *));
  28.  */
  29. int
  30. ip_term_init(sp)
  31.     SCR *sp;
  32. {
  33.     SEQ *qp;
  34.  
  35.     /*
  36.      * Rework any function key mappings that were set before the
  37.      * screen was initialized.
  38.      */
  39.     for (qp = sp->gp->seqq.lh_first; qp != NULL; qp = qp->q.le_next)
  40.         if (F_ISSET(qp, SEQ_FUNCMAP))
  41.             (void)ip_fmap(sp, qp->stype,
  42.                 qp->input, qp->ilen, qp->output, qp->olen);
  43.     return (0);
  44. }
  45.  
  46. /*
  47.  * ip_term_end --
  48.  *    End the special keys defined by the termcap/terminfo entry.
  49.  *
  50.  * PUBLIC: int ip_term_end __P((GS *));
  51.  */
  52. int
  53. ip_term_end(gp)
  54.     GS *gp;
  55. {
  56.     SEQ *qp, *nqp;
  57.  
  58.     /* Delete screen specific mappings. */
  59.     for (qp = gp->seqq.lh_first; qp != NULL; qp = nqp) {
  60.         nqp = qp->q.le_next;
  61.         if (F_ISSET(qp, SEQ_SCREEN))
  62.             (void)seq_mdel(qp);
  63.     }
  64.     return (0);
  65. }
  66.  
  67. /*
  68.  * ip_fmap --
  69.  *    Map a function key.
  70.  *
  71.  * PUBLIC: int ip_fmap __P((SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t));
  72.  */
  73. int
  74. ip_fmap(sp, stype, from, flen, to, tlen)
  75.     SCR *sp;
  76.     seq_t stype;
  77.     CHAR_T *from, *to;
  78.     size_t flen, tlen;
  79. {
  80.     /* Bind a function key to a string sequence. */
  81.     return (1);
  82. }
  83.  
  84. /*
  85.  * ip_optchange --
  86.  *    IP screen specific "option changed" routine.
  87.  *
  88.  * PUBLIC: int ip_optchange __P((SCR *, int, char *, u_long *));
  89.  */
  90. int
  91. ip_optchange(sp, opt, str, valp)
  92.     SCR *sp;
  93.     int opt;
  94.     char *str;
  95.     u_long *valp;
  96. {
  97.     switch (opt) {
  98.     case O_COLUMNS:
  99.     case O_LINES:
  100.         F_SET(sp->gp, G_SRESTART);
  101.         F_CLR(sp, SC_SCR_EX | SC_SCR_VI);
  102.         break;
  103.     case O_TERM:
  104.         msgq(sp, M_ERR, "The screen type may not be changed");
  105.         return (1);
  106.     }
  107.     return (0);
  108. }
  109.