🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #771

index-1.6 stdin bug? & question

#771
From: Craig Burley
Date: Wed, 09 Sep 1992 20:39
72 lines
2564 bytes
First, a bugfix, without which indent-1.6 can't reliably read from standard
input:

--------
diff -c io.c.~1~ io.c
*** io.c.~1~	Fri Aug 14 19:09:17 1992
--- io.c	Wed Sep  9 16:27:30 1992
***************
*** 504,509 ****
--- 504,510 ----
  	{
  	  size += (2 * BUFSIZ);
  	  stdinptr.data = xrealloc (stdinptr.data, size);
+ 	  p = stdinptr.data + stdinptr.size;
  	}
      }
    while (ch != EOF);
--------

Second, a question, as a new user of indent:

I get the impression that indent doesn't care at all about the _incoming_
whitespace, i.e. that it doesn't learn anything about the program by looking
at the nature of whitespace.  Is this a correct impression?  (I'm thinking
in terms of the "design" of indent; based on the docs, which I admit I haven't
read in great detail, it looks like it changes whitespace, but doesn't
try and interpret incoming whitespace per se.)

The reason I ask is that I have a situation where a command like

    bash$ indent < foo.c | indent -T bool -T ffelexToken | indent > bar.c

produces a file named bar.c that is different in subtle ways from the
file named baz.c produced by

    bash$ indent < foo.c > baz.c

(where foo.c remains the same in both cases).

Is what I'm observing possible, given the design of indent, or am I seeing
a manifestation of, perhaps, a bug like an uninitialized variable?

The actual differences are limited to cases of the form:

union
  {
    struct
      {
      blah blah blah;
      } xyzzy;
    ...
  } ...

In one file, the xyzzy; is as shown; in the other, it is on a subsequent
line indented so it lines up with the "struct":

    struct
      {
      blah blah blah;
      }
    xyzzy;
    ...

I was trying to determine whether, indenting with no options (i.e. -gnu),
there was any need for me to supply typedef names.  It _seems_ the answer
should be "no", but getting these differences worries me.

Let me know if I'm just missing the boat here, or if I've hit on something
and should send in some sample code (or if you want me to try and debug
this thang)!

        tq vm, (burley)
Technical Details
Message-ID: <9209092039.AA03285@tweedledumb.cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!burley

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!burley
From: burley@cygnus.com (Craig Burley)
Subject: index-1.6 stdin bug? & question
Message-ID: <9209092039.AA03285@tweedledumb.cygnus.com>
Sender: gnulists@ai.mit.edu
Reply-To: burley@gnu.ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 9 Sep 1992 20:39:28 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 73