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 |
From: Peter C. <pet...@ne...> - 2001-12-12 09:31:56
|
> From: Adrian St. John [mailto:AS...@pa...] > When I get a chance, I'll run the source through lint here (I have one > that deals with C++) Cool! What is it, and is it generally available? > > 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. Do all the platforms we use have C++ compilers that can cope with const_cast<char *>(str)? - Peter |
From: Adrian S. J. <AS...@pa...> - 2001-12-12 09:40:54
|
> From: Peter Crowther [mailto:pet...@ne...] > > > From: Adrian St. John [mailto:AS...@pa...] > > When I get a chance, I'll run the source through lint here=20 > (I have one > > that deals with C++) >=20 > Cool! What is it, and is it generally available? It's Flex PC-Lint, and it is commercial. It is also available for UNIX (as source code!), but that would cost lots of money for a licence. >=20 > > > 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=20 > 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. > >=20 > > Ah, that one. My personal preference would be to take the programmer > > who wrote those functions out to a wall and shoot them. >=20 > Do all the platforms we use have C++ compilers that can cope with > const_cast<char *>(str)? Given that all the platforms we use tend to be up to date, using g++, I suspect so. Adrian |
From: Adrian S. J. <AS...@pa...> - 2001-12-12 10:35:51
|
> From: J.P. King [mailto:jp...@he...] >=20 > > __lint is for when you use 'lint', the C program fluff finder. > > I presume it is there specifically to avoid the=20 > double-defines, as lint > > will complain loudly about them. > >=20 > > When I get a chance, I'll run the source through lint here=20 > (I have one > > that deals with C++), and then let other people fix all the=20 > warnings... >=20 > Heh - want me to run the code through Sun's compiler suite? :-) > I don't know if there is a lint included there, although I can try it. There probably isn't. But good luck, as Sun's compiler suite is suitably different from g++. Oh hang on, yes there is a lint with it, but it (at least 4 years ago) doesn't handle C++. > I could probably install it on something, but that would be... > what is the word I am looking for? Oh yes, 'illegal'. >:-> You can get hold of temporary 1 month licence if you're that bothered. > > Ah, that one. My personal preference would be to take the programmer > > who wrote those functions out to a wall and shoot them. >=20 > The 'Ugly' functions or just whoever is responsible for=20 > termcap/terminfo? Whoever is responsible for termcap/terminfo. Unfortunately that would mean shooting the author of one of my favourite games, rogue, as curses/termcap evolved out of that. Adrian. |
From: J.P. K. <jp...@he...> - 2001-12-12 11:03:55
|
> There probably isn't. But good luck, as Sun's compiler suite is > suitably different from g++. > Oh hang on, yes there is a lint with it, but it (at least 4 years ago) > doesn't handle C++. Yes, there is a lint, it appears to handle C++ style comments, and not a lot more. > > I could probably install it on something, but that would be... > > what is the word I am looking for? Oh yes, 'illegal'. >:-> > > You can get hold of temporary 1 month licence if you're that bothered. Yeah, but I have a site licence here - it would only be useful for people wanting to develop the code on there properly. I have been having a quick play and it doesn't like the code at all. Lots of wonderful warnings, and errors. > Whoever is responsible for termcap/terminfo. Unfortunately that would > mean shooting the author of one of my favourite games, rogue, as > curses/termcap evolved out of that. Actually termcap isn't _that_ bad, I meant curses, which is pretty dire. > Adrian. Julian |
From: J.P. K. <jp...@he...> - 2001-12-12 10:23:14
|
> __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... Heh - want me to run the code through Sun's compiler suite? :-) I don't know if there is a lint included there, although I can try it. I could probably install it on something, but that would be... what is the word I am looking for? Oh yes, 'illegal'. >:-> > Double-includes of header files should be OK if everyone remembers to > set include-guards. These were two separate header files though... seemed remarkably odd to be honest, I merely used some functionality that was already there. > Ah, that one. My personal preference would be to take the programmer > who wrote those functions out to a wall and shoot them. The 'Ugly' functions or just whoever is responsible for termcap/terminfo? Julian |