|
From: Adrian S. J. <AS...@pa...> - 2001-12-12 09:28:54
|
> From: J.P. King [mailto:jp...@he...]
>=20
> I've changed, and committed the change to Makefile, there was a=20
> missing ' in a sed used in creating version.h Not sure how that
> happened, but it is there now.
Might have been me, with my Release tag version info thingy.
> 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.
>=20
> 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.
__lint is for when you use 'lint', the C program fluff finder.
I presume it is there specifically to avoid the double-defines, as lint
will complain loudly about them.
When I get a chance, I'll run the source through lint here (I have one
that deals with C++), and then let other people fix all the warnings...
Double-includes of header files should be OK if everyone remembers to
set include-guards.
> 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.
Ah, that one. My personal preference would be to take the programmer
who wrote those functions out to a wall and shoot them.
> I'll leave it for a while, and if noone shouts at me I'll commit the
> code.
>=20
> I've tested that it still compiles under Solaris, Linux and FreeBSD.
>=20
> (Note Linux still has one warning about PRIO_PROCESS in netmud.c)
>=20
> Oh, and all of these hacks I've been doing should probably be farmed=20
> off somewhere so as to make it easier to maintain, but I'm=20
> 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.
>=20
> Cheers,
>=20
> Julian
>=20
>=20
> Index: interface.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> 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 ----
>=20
> /* KEITH: Buy a surperior spellchecker too. - Luggs */
>=20
> + #define __lint
> +
> #include "copyright.h"
>=20
> #include <stdio.h>
> ***************
> *** 1841,1846 ****
> --- 1843,1854 ----
> {
> char *terminal;
>=20
> + char *tmpstring;
> + tmpstring=3D(char *)malloc(sizeof("lines ")); /*=20
> 'lines' is the longest
> + *=20
> string needed, the
> + *=20
> spaces are paranoia
> + */
> +
> terminal =3D safe_strdup(termtype);
>=20
> for(int i =3D 0; terminal[i]; i++)
> ***************
> *** 1867,1880 ****
>=20
> if (terminal_width =3D=3D 0)
> {
> ! terminal_width =3D tigetnum("cols");
> #ifdef DEBUG_TELNET
> Trace( "Terminal width (from terminfo): =20
> %d\n", terminal_width);
> #endif
> }
> if (terminal_height =3D=3D 0)
> {
> ! terminal_height =3D tigetnum("lines");
> #ifdef DEBUG_TELNET
> Trace( "Terminal height (from terminfo): =20
> %d\n", terminal_height);
> #endif
> --- 1875,1892 ----
>=20
> if (terminal_width =3D=3D 0)
> {
> ! strcpy(tmpstring,"cols");
> ! terminal_width =3D tigetnum(tmpstring);
> ! //terminal_width =3D tigetnum("cols");
> #ifdef DEBUG_TELNET
> Trace( "Terminal width (from terminfo): =20
> %d\n", terminal_width);
> #endif
> }
> if (terminal_height =3D=3D 0)
> {
> ! strcpy(tmpstring,"lines");
> ! terminal_height =3D tigetnum(tmpstring);
> ! //terminal_height =3D tigetnum("lines");
> #ifdef DEBUG_TELNET
> Trace( "Terminal height (from terminfo): =20
> %d\n", terminal_height);
> #endif
> ***************
> *** 1897,1903 ****
> * }
> */
>=20
> ! const char *const bold =3D tigetstr("bold");
> if (bold !=3D (char *)-1)
> {
> if (termcap.bold_on)
> --- 1909,1917 ----
> * }
> */
>=20
> ! strcpy(tmpstring,"bold");
> ! const char *const bold =3D tigetstr(tmpstring);
> ! //const char *const bold =3D tigetstr("bold");
> if (bold !=3D (char *)-1)
> {
> if (termcap.bold_on)
> ***************
> *** 1905,1911 ****
> termcap.bold_on =3D safe_strdup(bold);
> }
>=20
> ! const char *const bold_off =3D tigetstr("sgr0");
> if (bold_off !=3D (char *)-1)
> {
> if (termcap.bold_off)
> --- 1919,1927 ----
> termcap.bold_on =3D safe_strdup(bold);
> }
>=20
> ! strcpy(tmpstring,"sgr0");
> ! const char *const bold_off =3D tigetstr(tmpstring);
> ! //const char *const bold_off =3D tigetstr("sgr0");
> if (bold_off !=3D (char *)-1)
> {
> if (termcap.bold_off)
> ***************
> *** 1913,1919 ****
> termcap.bold_off =3D safe_strdup(bold_off);
> }
>=20
> ! const char *const underline =3D tigetstr("smul");
> if (underline !=3D (char *)-1)
> {
> if (termcap.underscore_on)
> --- 1929,1937 ----
> termcap.bold_off =3D safe_strdup(bold_off);
> }
>=20
> ! strcpy(tmpstring,"smul");
> ! const char *const underline =3D tigetstr(tmpstring);
> ! //const char *const underline =3D tigetstr("smul");
> if (underline !=3D (char *)-1)
> {
> if (termcap.underscore_on)
> ***************
> *** 1921,1927 ****
> termcap.underscore_on =3D safe_strdup(underline);
> }
>=20
> ! const char *const underscore_off =3D tigetstr("rmul");
> if (underscore_off !=3D (char *)-1)
> {
> if (termcap.underscore_off)
> --- 1939,1947 ----
> termcap.underscore_on =3D safe_strdup(underline);
> }
>=20
> ! strcpy(tmpstring,"rmul");
> ! const char *const underscore_off =3D tigetstr(tmpstring);
> ! //const char *const underscore_off =3D tigetstr("rmul");
> if (underscore_off !=3D (char *)-1)
> {
> if (termcap.underscore_off)
>=20
>=20
>=20
> _______________________________________________
> Uglycode-coders mailing list
> Ugl...@li...
> https://lists.sourceforge.net/lists/listinfo/uglycode-coders
>=20
|