🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #707

Bug in etags ignoring first line of TeX input files

#707
From: Geoff Oakley
Date: Tue, 18 Aug 1992 22:38
68 lines
2357 bytes
There is an apparent bug in etags in ignoring the first line of TeX
input files.

The source file etags.c includes:

++  TEX_funcs (fi)
++      FILE *fi;
++  {
++    char *lasthit;
++  
++    lineno = 0;
++    charno = 0;
++    pfcnt = 0;
++  
++    /* Select either \ or ! as escape character.  */
++    TEX_mode (fi);
++  
++    /* Initialize token table once from environment. */
++    if (!TEX_toktab)
++      TEX_toktab = TEX_decode_env ("TEXTAGS", TEX_defenv);
++    while (!feof (fi))
++      {
++        lineno++;
++        linecharno = charno;
++        charno += readline (&lb, fi) + 1;
++        dbp = lb.buffer;
++        lasthit = dbp;
++  
++        while (!feof (fi))
++          {       /* Scan each line in file */
++            lineno++;
++            linecharno = charno;
++            charno += readline (&lb, fi) + 1;
++            dbp = lb.buffer;
++            lasthit = dbp;
++            while (dbp = index (dbp, TEX_esc)) /* Look at each escape in line */
++              {
++                register int i;
++  
++                if (! *(++dbp))
++                  break;
++                linecharno += dbp - lasthit;
++                lasthit = dbp;
++                i = TEX_Token (lasthit);
++                if (0 <= i)
++                  {
++                    TEX_getit (lasthit, TEX_toktab[i].len);
++                    break;                /* We only save a line once */
++                  }
++              }
++          }
++      }
++  }


The outer while loop reads and discards the first line of the input
file, then the second while loop actually does useful work reading
through the remainder of the input file.

A solution is to discard the outer while loop.


Geoff O


	       geoffo@spectrum.cs.unsw.oz.au
Geoff Oakley:  CS & E, UNSW, PO Box 1, Kensington, NSW 2033, Australia
	       Phone: +61 2 697 4043	Fax: +61 2 313 7987
Technical Details
Message-ID: <920818023849.28094@cs.unsw.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.unsw.oz.AU!geoffo

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.unsw.oz.AU!geoffo
From: geoffo@cs.unsw.oz.AU (Geoff Oakley)
Subject: Bug in etags ignoring first line of TeX input files
Message-ID: <920818023849.28094@cs.unsw.oz.au>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 18 Aug 1992 22:38:49 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 69