|
From: J.P. K. <jp...@he...> - 2001-12-11 19:06:03
|
I've changed, and committed the change to Makefile, there was a
missing ' in a sed used in creating version.h Not sure how that
happened, but it is there now.
I've also changed interface.c, I think this is safe, but I am feeling
paranoid. It removes the last set of warnings for Solaris compiles.
The '__lint' appears to avoid one set of defines kicking in
removing the warning about double defines. This is probably a
nasty hack, but based on my grep of the include files shouldn't
cause any other problems. However maybe someone knows what
it is supposed to be used for, and this isn't it. I can remove
that, and see about another way of removing the error if necessary.
The rest of the changes are the creation of a tmpstring which is
used when calling tigetnum (and friends) which insist on a char *
and not a const char *. Again, I believe this is safe, but I
don't tend to mess with strcpy or malloc, so I am quite prepared to
believe that it is wrong. Also, whilst I know that it is the
terminal handling code, I am not sure how to test it.
I'll leave it for a while, and if noone shouts at me I'll commit the
code.
I've tested that it still compiles under Solaris, Linux and FreeBSD.
(Note Linux still has one warning about PRIO_PROCESS in netmud.c)
Oh, and all of these hacks I've been doing should probably be farmed
off somewhere so as to make it easier to maintain, but I'm just trying to
get the code into a state where if you see a warning when it compiles
you notice, and maybe even investigate it.
Cheers,
Julian
Index: interface.c
===================================================================
RCS file: /cvsroot/uglycode/UglyCODE/interface.c,v
retrieving revision 1.32
diff -c -r1.32 interface.c
*** interface.c 2001/12/11 14:21:29 1.32
--- interface.c 2001/12/11 18:22:00
***************
*** 9,14 ****
--- 9,16 ----
/* KEITH: Buy a surperior spellchecker too. - Luggs */
+ #define __lint
+
#include "copyright.h"
#include <stdio.h>
***************
*** 1841,1846 ****
--- 1843,1854 ----
{
char *terminal;
+ char *tmpstring;
+ tmpstring=(char *)malloc(sizeof("lines ")); /* 'lines' is the longest
+ * string needed, the
+ * spaces are paranoia
+ */
+
terminal = safe_strdup(termtype);
for(int i = 0; terminal[i]; i++)
***************
*** 1867,1880 ****
if (terminal_width == 0)
{
! terminal_width = tigetnum("cols");
#ifdef DEBUG_TELNET
Trace( "Terminal width (from terminfo): %d\n", terminal_width);
#endif
}
if (terminal_height == 0)
{
! terminal_height = tigetnum("lines");
#ifdef DEBUG_TELNET
Trace( "Terminal height (from terminfo): %d\n", terminal_height);
#endif
--- 1875,1892 ----
if (terminal_width == 0)
{
! strcpy(tmpstring,"cols");
! terminal_width = tigetnum(tmpstring);
! //terminal_width = tigetnum("cols");
#ifdef DEBUG_TELNET
Trace( "Terminal width (from terminfo): %d\n", terminal_width);
#endif
}
if (terminal_height == 0)
{
! strcpy(tmpstring,"lines");
! terminal_height = tigetnum(tmpstring);
! //terminal_height = tigetnum("lines");
#ifdef DEBUG_TELNET
Trace( "Terminal height (from terminfo): %d\n", terminal_height);
#endif
***************
*** 1897,1903 ****
* }
*/
! const char *const bold = tigetstr("bold");
if (bold != (char *)-1)
{
if (termcap.bold_on)
--- 1909,1917 ----
* }
*/
! strcpy(tmpstring,"bold");
! const char *const bold = tigetstr(tmpstring);
! //const char *const bold = tigetstr("bold");
if (bold != (char *)-1)
{
if (termcap.bold_on)
***************
*** 1905,1911 ****
termcap.bold_on = safe_strdup(bold);
}
! const char *const bold_off = tigetstr("sgr0");
if (bold_off != (char *)-1)
{
if (termcap.bold_off)
--- 1919,1927 ----
termcap.bold_on = safe_strdup(bold);
}
! strcpy(tmpstring,"sgr0");
! const char *const bold_off = tigetstr(tmpstring);
! //const char *const bold_off = tigetstr("sgr0");
if (bold_off != (char *)-1)
{
if (termcap.bold_off)
***************
*** 1913,1919 ****
termcap.bold_off = safe_strdup(bold_off);
}
! const char *const underline = tigetstr("smul");
if (underline != (char *)-1)
{
if (termcap.underscore_on)
--- 1929,1937 ----
termcap.bold_off = safe_strdup(bold_off);
}
! strcpy(tmpstring,"smul");
! const char *const underline = tigetstr(tmpstring);
! //const char *const underline = tigetstr("smul");
if (underline != (char *)-1)
{
if (termcap.underscore_on)
***************
*** 1921,1927 ****
termcap.underscore_on = safe_strdup(underline);
}
! const char *const underscore_off = tigetstr("rmul");
if (underscore_off != (char *)-1)
{
if (termcap.underscore_off)
--- 1939,1947 ----
termcap.underscore_on = safe_strdup(underline);
}
! strcpy(tmpstring,"rmul");
! const char *const underscore_off = tigetstr(tmpstring);
! //const char *const underscore_off = tigetstr("rmul");
if (underscore_off != (char *)-1)
{
if (termcap.underscore_off)
|