[net.bugs.4bsd] yet another 4.2 bug

budd@arizona.UUCP (12/06/83)

Here is another 4.2 bogosity (this is what I've pieced together.  The
lawyers still have our 4.2 tape!!).  The ``bib'' bibliographic database
software, written here by myself and gary levin, is on the 4.2 distribution
tape.  (This is a replacement for refer, was posted to the net several
months ago).  Immediately before 4.2 was set in stone, the people at
berkeley asked for the latest version.  I got the copy they had, which had
been berkeletised, and compared the updates they had made to the improvements
I had made and took the best of both worlds and made a new version.

Now here comes the tricky part.  The berkeley people use SCCS, I don't.
There were several %D formats in the source which the berkeley people changed
to %ld, however I didn't take note of this in making my updates, and
apparently It wasn't caught when I shipped the source back to berkeley.
(Also, they seem to have re-berkeletised it, putting back in the features
I had taken out of their earlier version).

Here's the bug: There are two %D%D formats in scanf's in the file invert.c.
The sccs system uses %D% as a keyword, replacing it with the current date.
This, of course, messes everything up.

guy@rlgvax.UUCP (12/14/83)

While we're on the subject of %D, please note that System III and later
versions of UNIX do *NOT* support %D as a synonym for %ld.  More specifically,
%X doesn't mean %lx, it means "%x only put the hex digits 'a' through 'f'
out in upper case."  (This would have been useful for someone who complained
a few months ago that it was a pain to get "*printf" to produce output to
make his PROM burner, which expected upper-case hex, happy.)  Since "%ld"
will work on any reasonable (i.e., V6 with V7 Phototypesetter or later) UNIX,
but "%D" works on pre-S3 UNIXes, people should get in the habit of using "%ld"
rather than "%D" (it will also keep SCCS happier).

While you're all fixing your code, note that printing a long should *always*
be done with "%ld", not "%d", even though you "know" you're running on a machine
with 32-bit "int"s.  The next person that compiles your program may not be
running on such a machine...

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy