[comp.text.tex] A bug in BiBTeX

jeburke@jhunix.HCF.JHU.EDU (John Burke) (06/13/90)

Ho, netsters,

Welcome to the land of TeX arcana (not to be confused with Texarkana).

The problem:
	BiBTeX can't seem to see the \bibstyle, \bibdata, and \citation
	commands which appear in an  .aux file. This is the C version of 
	BiBTeX, the 0.99c release, running under AT&T Sys V.3.1.5. 

The solution:
	The procedure  input_ln is used in  bibtex.web to
	get lines of input from the  .aux file (and other files as
	well).  In  bibtex.ch,  input_ln is redefined
	using "an external C procedure" called  lineread() 
        I found lineread() in bibext.c, a set of C extensions for BiBTeX.

	   After a few days spent chasing through the code, I eventually 
	figured out that the cause of the problem lay, not in lineread, or
	in any of  command-parsing routines. Instead I found it to be at
	the top of bibext.c, in the variable declarations.  The variables 
	were declared improperly; we had
		extern char realnameoffile[];
		extern char xord[], buffer[], nameoffile[];
 	but should have had (in order to agree with the definitions in 
	bibtex.c)
		extern char realnameoffile[], nameoffile[];
		extern schar xord[], buffer[];
	With that correction, the whole thing compiled and ran beautifully.

	   It may be the case that under some operating systems, or under
	some versions of C, schar (which is typedef'ed in site.h) will be
	the same as char, but under our UNIX and our C, they most assuredly
	are not the same---schar is a short int.  It was sloppy of the
	authors of bibext.c not to use the types declared in site.h (and
	used in bibtex.c); of course, if our C compiler had been on top of
	things, the inconsistency of declarations would have been caught the
	first time the program was compiled.

Respectfully subimtted, 

John E. Burke
(jeburke@jhunix.hcf.jhu.edu)
============================================================================
There is only one thing that I know how to do well,
And I've always been told you should only do things 
	that you know how to do well.
And that's be you.
Be what you're like.
Be like yourself.
And so I'm having a wonderful time but I'd rather be 
Whistling in the dark.