[comp.windows.x] Removing -fwritable-strings dependencies once and for all

thakur@eddie.mit.edu (Manavendra K. Thakur) (05/07/90)

I think it's time to get rid of the -fwritable-strings dependency in
R4 code once and for all.  It has surprised many people compiling
X11R4 with gcc, and there's no reason to write into string constants
in code that is supposedly ANSI compliant.  (K&R 2nd Ed p. 194: "the
behavior of a program that attempts to alter a string literal is
undefined.")

So I'm volunteering to coordinate an effort to come up with a set of
"semi-approved" patches that will eliminate writing into string
constants in X11R4 mit core distribution code.

To wit, I'm asking people people to send me the following:

	1) The names of core mit programs that write into string
	   constants
	2) The list of particular *.c files (if known) where string
	   constants are being written into. 
	3) Any and all patches you've written or found on the net that
	   replaces writable strings with more appropriate code.

To start off with, I've read on the net about four X11R4 programs or
utilities that write into string constants:

	xterm	(in mit/clients/xterm/Tekproc.c -- anywhere else?)
	xfd	(in ???)
	bmtoa	(in mit/clients/bitmap/bmtoa.c)
	puzzle	(in ???)

Ok, you folks take it from here.  My email addresses are below.  Send
me any and all info you have.  I'll try to verify whether they truly
need -fwritable-strings or not.  Then I'll put the info and suggested
patches together in digest form and post it to xpert.  All you
interested folks can hack on it, and hopefully sooner or later we can
come to general agreement on the best ways to patch the code to
eliminate this annoying pebble in our collective X11R4 shoes.


Internet: thakur@zerkalo.harvard.edu	  Manavendra Thakur
	  thakur@eddie.mit.edu		  System Manager, High Energy Division,
BITNET:	  thakur@cfa.BITNET		  Harvard-Smithsonian Center for
DECNET:	  thakur@cfa.DECNET		  Astrophysics
UUCP:	  ...!mit-eddie!thakur

rcb@ccpv1.cc.ncsu.edu (Randy Buckland) (05/07/90)

One thing to be aware of is that at least for Ultrix V3.x, the libc routine
sscanf will write into it's input string. Therefore this string should not
be a constant.

---------------
Randy Buckland
North Carolina State University
rcb@ccpv1.ncsu.edu (919) 737-2517