Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From b0146856d9a253a1cdd23a97dac50a681d0d84aa Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Thu, 4 Mar 2021 23:43:29 +0000
>Subject: [PATCH] term.c: various changes

  The declarations of "visual_on(void)", "xterm_mouse_on(void)", and
"xterm_mouse_off(void)" are removed as they are already declared.

  The declarations of "ding()", "clrmsg()", and "gotoxy()" are removed as
they are already declared.

  The declarations of "tgoto(...)" and "clrline_noflush()" are removed as
they are already declared.

  Add "__attribute ((unused))" to the functions "catch_winch(...)" and
"rd_timeout(...)" as their parameter is not used.

  Change type of "completion" from "fct_type" to "fct_type_char_int".

  Add code instead of "cfmakeraw()" depending of the definition of
"__osf__".

  Fix a comparison between "int" and "unsigned int".

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 term.c | 39 +++++++++++++++++++++++++++------------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/term.c b/term.c
index ed5158c..e15eb66 100644
--- a/term.c
+++ b/term.c
@@ -116,17 +116,18 @@ static int      nnstandout(int);
 
 static sig_type catch_winch(int n);
 
-void            visual_on(void);
-void            xterm_mouse_on(void);
-void            xterm_mouse_off(void);
+/*
+  visual_on(void), xterm_mouse_on(void), and xterm_mouse_off(void) are
+  declared in nn_term.h
+*/
 
 extern int      data_bits;
 extern int      batch_mode;
 extern char    *help_directory;
 
-extern void     ding();
-extern void     clrmsg();
-extern void     gotoxy();
+/*
+  ding(), clrmsg(), and gotoxy() are declared in nn_term.h
+*/
 
 struct msg_list {
     char           *buf;
@@ -167,7 +168,8 @@ static int      appl_keypad_mode = 0;
 #ifdef USE_TERMINFO
 #define HAS_CAP(str) (str && *str)
 
-extern char    *tgoto();       /* some systems don't have this in term.h */
+/* tgoto(const char *, int, int) is declared in /usr/include/term.h */
+/* extern char    *tgoto();    */ /* some systems don't have this in term.h */
 
 #else
 
@@ -395,7 +397,7 @@ dump_multi_keys(void)
 
 #ifdef RESIZING
 static          sig_type
-catch_winch(int n)
+catch_winch(int n  __attribute ((unused)) )
 {
     struct winsize  winsize;
     int             i;
@@ -670,7 +672,20 @@ init_term(int full)
 #else
 
 #ifdef HAVE_TERMIOS_H
+#  ifdef __osf__
     cfmakeraw(&raw_tty);
+#  else /* same as for HAVE_TERMIO_H */
+    raw_tty.c_iflag &= ~(BRKINT | INLCR | ICRNL | IGNCR | ISTRIP);
+    raw_tty.c_iflag |= IGNBRK | IGNPAR;
+    raw_tty.c_oflag &= ~OPOST;
+    raw_tty.c_lflag &= ~(ISIG | ICANON | XCASE | ECHO | NOFLSH);
+
+    /* read a maximum of 10 characters in one burst; timeout in 1-200 ms */
+    raw_tty.c_cc[VMIN] = KEY_BURST;
+    raw_tty.c_cc[VTIME] = ((int) (raw_tty.c_cflag & CBAUD) > B1200) ? 1 : 2;
+    set_term_speed((unsigned long) (raw_tty.c_cflag & CBAUD));
+#  endif
+
     /* read a maximum of 10 characters in one burst; timeout in 1-200 ms */
     raw_tty.c_cc[VMIN] = KEY_BURST;
 
@@ -797,7 +812,7 @@ gotoxy(int c, int l)
        fprintf(stderr, "gotoxy %d %d -> %d %d\n", curxy_c, curxy_l, c, l);
 #endif
 
-    if (Columns <= (unsigned) c || Lines <= (unsigned) l)
+    if ( (Columns <= c) || (Lines <= l) )
        return;
 
     if (!(c | l))
@@ -828,7 +843,7 @@ clrdisp(void)
     msg_ptr = msg_stack;
 }
 
-void            clrline_noflush();
+/* clrline_noflush() is declared in nn_term.h */
 
 void
 clrline(void)
@@ -1556,7 +1571,7 @@ static jmp_buf  fake_alarm_sig;
 #endif                         /* FAKE_INTERRUPT */
 
 static          sig_type
-rd_timeout(int n)
+rd_timeout(int n __attribute ((unused)) )
 {
     rd_alarm = 1;
 
@@ -1837,7 +1852,7 @@ redraw:
  */
 
 char           *
-get_s(char *dflt, char *prefill, char *break_chars, fct_type completion)
+get_s(char *dflt, char *prefill, char *break_chars, fct_type_char_int 
completion)
 {
     static key_type lbuf[GET_S_BUFFER];
     register char  *cp;
-- 
2.30.1



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to