Article View: comp.windows.x
Article #36671Re: sscanf and gcc (Was "X11R4 gcc-1.36 SunOS 4.0.3 puzzle")
From: Mark Moraes
Date: Sun, 11 Feb 1990 23:48
Date: Sun, 11 Feb 1990 23:48
21 lines
1397 bytes
1397 bytes
mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) writes:
>> Reason: puzzle calls sscanf() with a constant string argument.
>> Fix: use gcc -fwritable-strings.
>Proper fix: use a non-broken stdio that doesn't stamp on strings passed
>to sscanf(). (Finding such a stdio may not be entirely trivial, alas.)
For those who have source to their libc (or a BSD4.[23] libc, or SysV
libc, since they seem to be identical in this regard) a simple fix is
to change ungetc to not write the character to the string if the
character is the same as what's in the string (only decrement the
buffer pointer)
We then add something like
#define BandAidLibraryNeeded YES
#define BandAidLibrarySources ungetc.c
#define BandAidLibraryObjects ungetc.o
#define BandAidLibraryMake() /* nothing to do here */
to our site.def and put the fixed ungetc.c in mit/lib/X. Seems to work
fine. (We don't compile with -fwritable-strings)
Technical Details
Message-ID:
<90Feb11.184732est.6696@neat.cs.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!neat.cs.toronto.edu!moraesReferences:
<9002110416.AA02139@Larry.McRCIM.McGill.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!neat.cs.toronto.edu!moraes Newsgroups: comp.windows.x From: moraes@cs.toronto.edu (Mark Moraes) Subject: Re: sscanf and gcc (Was "X11R4 gcc-1.36 SunOS 4.0.3 puzzle") Message-ID: <90Feb11.184732est.6696@neat.cs.toronto.edu> Organization: Department of Computer Science, University of Toronto References: <9002110416.AA02139@Larry.McRCIM.McGill.EDU> Date: 11 Feb 90 23:48:42 GMT Lines: 21