components/ircii/patches/term-fixes.patch
changeset 3974 221bc3d28397
parent 1304 428fd83fdeb2
equal deleted inserted replaced
3966:cca72467a46d 3974:221bc3d28397
       
     1 Needed to get ircii to successfully build and run in 64-bit mode with Solaris
       
     2 libtermcap (really libcurses). Also need to have -DINCLUDE_CURSES_H
       
     3 defined in the component Makefile.
       
     4 
       
     5 On Linux systems you do not need to have -DINCLUDE_CURSES_H defined, in
       
     6 order to build ircii. The tgoto() routine has a prototype definition in
       
     7 /usr/include/termcap.h (supplied by the ncurses package), which is
       
     8 found by configure:
       
     9 
       
    10 ...
       
    11 checking for termcap.h... yes
       
    12 ...
       
    13 
       
    14 On Solaris, we do not have a /usr/include/termcap.h file. Therefore,
       
    15 according to the curs_termcap(3CURSES) man page, for C sources files
       
    16 that want to use the tgoto() routine, we need to include both
       
    17 "#include <curses.h" and "#include <term.h>". For that we need to define
       
    18 -DINCLUDE_CURSES_H and also patch it to include term.h
       
    19 
       
    20 But then we have another problem. /usr/include/term.h on Solaris has:
       
    21 
       
    22 #define lines                           CUR _c3
       
    23 
       
    24 which causes the pre-processor to screw up occurrences of variable "lines"
       
    25 in two source files.
       
    26 
       
    27 The patch needs to be reworked before it can be sent upstream. The Solaris
       
    28 integration of termcap diverges from the way that Linux systems do this.
       
    29 
       
    30 --- ircii-20141122/include/ircterm.h.orig	2015-03-18 09:31:15.080165469 -0700
       
    31 +++ ircii-20141122/include/ircterm.h	2015-03-18 09:31:50.292380649 -0700
       
    32 @@ -39,6 +39,7 @@
       
    33  
       
    34  #ifdef INCLUDE_CURSES_H
       
    35  # include <curses.h>
       
    36 +# include <term.h>
       
    37  #endif /* INCLUDE_CURSES_H */
       
    38  
       
    39  #ifdef NCURSES_VERSION
       
    40 --- ircii-20141122/source/lastlog.c.orig	2015-03-18 09:17:28.728033735 -0700
       
    41 +++ ircii-20141122/source/lastlog.c	2015-03-18 09:36:08.526848734 -0700
       
    42 @@ -48,7 +48,7 @@
       
    43  {
       
    44  	int	level;
       
    45  	u_char	*msg;
       
    46 -	u_char	**lines;
       
    47 +	u_char	**log_lines;
       
    48  	int	cols;	/* If this doesn't match the current columns,
       
    49  			 * we have to recalculate the whole thing. */
       
    50  	struct	lastlog_stru	*next;
       
    51 @@ -209,11 +209,11 @@
       
    52  static	void
       
    53  free_lastlog_lines(Lastlog *log)
       
    54  {
       
    55 -	u_char **lines;
       
    56 +	u_char **log_lines;
       
    57  
       
    58 -	for (lines = log->lines; *lines; lines++)
       
    59 -		new_free(lines);
       
    60 -	new_free(&log->lines);
       
    61 +	for (log_lines = log->log_lines; *log_lines; log_lines++)
       
    62 +		new_free(log_lines);
       
    63 +	new_free(&log->log_lines);
       
    64  }
       
    65  
       
    66  static	void
       
    67 @@ -499,7 +499,7 @@
       
    68  			malloc_strcpy(&new->msg, line);
       
    69  			copy_window_size(NULL, &new->cols);
       
    70  			Debug(DB_LASTLOG, "columns = %d", new->cols);
       
    71 -			new->lines = split_up_line_alloc(line);
       
    72 +			new->log_lines = split_up_line_alloc(line);
       
    73  
       
    74  			if (info->lastlog_head)
       
    75  				info->lastlog_head->prev = new;
       
    76 @@ -513,7 +513,7 @@
       
    77  		}
       
    78  	}
       
    79  	if (new)
       
    80 -		return new->lines;
       
    81 +		return new->log_lines;
       
    82  	return NULL;
       
    83  }
       
    84  
       
    85 @@ -600,9 +600,9 @@
       
    86  			/* Must free and re-calculate */
       
    87  			free_lastlog_lines(LogLine);
       
    88  			LogLine->cols = cols;
       
    89 -			LogLine->lines = split_up_line_alloc(LogLine->msg);
       
    90 +			LogLine->log_lines = split_up_line_alloc(LogLine->msg);
       
    91  		}
       
    92 -		TheirLines = LogLine->lines;
       
    93 +		TheirLines = LogLine->log_lines;
       
    94  		for (row = 0; TheirLines[row]; row++)
       
    95  			/* count the rows */;
       
    96  		if (window)
       
    97 --- ircii-20141122/source/status.c.orig	2015-03-18 09:50:11.971051956 -0700
       
    98 +++ ircii-20141122/source/status.c	2015-03-18 09:51:38.224735226 -0700
       
    99 @@ -1120,9 +1120,9 @@
       
   100  	u_char	*ptr = NULL;
       
   101  	int	num;
       
   102  	u_char	localbuf[40];
       
   103 -	int	lines = window_held_lines(window);
       
   104 +	int	held_lines = window_held_lines(window);
       
   105  
       
   106 -	num = lines - lines % 10;
       
   107 +	num = held_lines - held_lines % 10;
       
   108  	if (num)
       
   109  	{
       
   110  		u_char	lbuf[BIG_BUFFER_SIZE];
       
   111 @@ -1142,10 +1142,10 @@
       
   112  {
       
   113  	u_char	*ptr = NULL,
       
   114  		*text;
       
   115 -	int	lines = window_get_all_scrolled_lines(window);
       
   116 +	int	scrolled_lines = window_get_all_scrolled_lines(window);
       
   117  
       
   118 -	Debug(DB_STATUS, "status_scrolled: lines = %d", lines);
       
   119 -	if (lines && (text = get_string_var(STATUS_SCROLLED_VAR)))
       
   120 +	Debug(DB_STATUS, "status_scrolled: lines = %d", scrolled_lines);
       
   121 +	if (scrolled_lines && (text = get_string_var(STATUS_SCROLLED_VAR)))
       
   122  		malloc_strcpy(&ptr, text);
       
   123  	else
       
   124  		malloc_strcpy(&ptr, empty_string());
       
   125 @@ -1157,20 +1157,20 @@
       
   126  {
       
   127  	u_char	*ptr = NULL;
       
   128  	u_char	localbuf[40];
       
   129 -	int	lines = window_get_all_scrolled_lines(window);
       
   130 +	int	scrolled_lines = window_get_all_scrolled_lines(window);
       
   131  
       
   132 -	if (lines)
       
   133 +	if (scrolled_lines)
       
   134  	{
       
   135  		u_char	lbuf[BIG_BUFFER_SIZE];
       
   136  
       
   137 -		snprintf(CP(localbuf), sizeof localbuf, "%d", lines);
       
   138 +		snprintf(CP(localbuf), sizeof localbuf, "%d", scrolled_lines);
       
   139  		snprintf(CP(lbuf), sizeof lbuf, CP(hold_lines_format),
       
   140  			 localbuf);
       
   141  		malloc_strcpy(&ptr, lbuf);
       
   142  	}
       
   143  	else
       
   144  		malloc_strcpy(&ptr, empty_string());
       
   145 -	Debug(DB_STATUS, "status_scrolled_lines: lines = %d, str = '%s'", lines, ptr);
       
   146 +	Debug(DB_STATUS, "status_scrolled_lines: lines = %d, str = '%s'", scrolled_lines, ptr);
       
   147  	return (ptr);
       
   148  }
       
   149