From nobody  Sun Mar 15 06:37:02 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id GAA20672;
          Sun, 15 Mar 1998 06:37:02 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199803151437.GAA20672@hub.freebsd.org>
Date: Sun, 15 Mar 1998 06:37:02 -0800 (PST)
From: schweikh@noc.dfn.de
To: freebsd-gnats-submit@freebsd.org
Subject: indent(1) breaks source with backslash newline continuation
X-Send-Pr-Version: www-1.0

>Number:         6015
>Category:       bin
>Synopsis:       indent(1) breaks source with backslash newline continuation
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    schweikh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 15 06:40:01 PST 1998
>Closed-Date:    Fri Oct 19 12:10:48 PDT 2001
>Last-Modified:  Fri Oct 19 12:12:47 PDT 2001
>Originator:     Jens Schweikhardt
>Release:        2.2.5-RELEASE FreeBSD
>Organization:
DFN NOC
>Environment:
>Description:
FreeBSD's indent(1) breaks programs with line continuation in keywords or
identifiers. It insert a space before the backslash and indents the next
continuation line. The result is uncompilable. No indentation should
break code... "It looks beautiful to my eyes, but will it compile?" :-)

>How-To-Repeat:
2.2.5-RELEASE FreeBSD
 
$ cat tst.c
int main (void) { re\
turn 0; }
$ indent tst.c
$ cat tst.c
int 
main(void)
{
        re \
        turn 0;
}

>Fix:

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: johan 
State-Changed-When: Wed Oct 10 13:24:57 PDT 2001 
State-Changed-Why:  
Ok, indent(1) is broken as you say. 
However, it will not get fixed unless someone (you?) 
sends a patch. 

Moreover, you should not write your c code like that :-) 

Closed since the PR is too old and noone will fix it. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=6015 

From: "Alexey V.Neyman" <alex.neyman@auriga.ru>
To: schweikh@noc.dfn.de, johan@FreeBSD.ORG, freebsd-bugs@FreeBSD.ORG
Cc:  
Subject: Re: bin/6015: indent(1) breaks source with backslash newline continuation
Date: Thu, 11 Oct 2001 16:38:12 +0400

 --------------Boundary-00=_OFK13LWOU3XJV6M73E0I
 Content-Type: text/plain;
   charset="koi8-r"
 Content-Transfer-Encoding: 8bit
 
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Hello there!
 
 On 11 October 2001 00:28, johan@FreeBSD.org wrote:
 > 	Moreover, you should not write your c code like that :-)
 > 	Closed since the PR is too old and noone will fix it.
 Please review & try the patch attached.
 
 Also, I thought that confirmed PRs are not to be closed, as the bug still 
 exists. Isn't it what 'suspended' state is for?
 
 Regards,
 Alexey.
 
 - -- 
 - -------------------------------+---------------------------------
      May the Sun and Water     |     Regards, Alexey V. Neyman
      always fall upon you!     |   mailto: alex.neyman@auriga.ru
 - -------------------------------+---------------------------------
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.4 (GNU/Linux)
 Comment: For info see http://www.gnupg.org
 
 iD8DBQE7xZK09lSeDZjilyARAhk4AJ9TujgePR/IWnIlfYLa8foAwXDgWACcClr3
 2WG7pQSrnANpdOWC0hZh8Sw=
 =v+lZ
 -----END PGP SIGNATURE-----
 
 --------------Boundary-00=_OFK13LWOU3XJV6M73E0I
 Content-Type: text/x-c;
   charset="koi8-r";
   name="indent.patch"
 Content-Transfer-Encoding: 8bit
 Content-Disposition: attachment; filename="indent.patch"
 
 --- lexi.c.orig	Thu Oct 11 16:27:31 2001
 +++ lexi.c	Thu Oct 11 16:27:42 2001
 @@ -209,8 +209,19 @@
  	    }
  	}
  	else
 -	    while (chartype[*buf_ptr] == alphanum) {	/* copy it over */
 +	    while (chartype[*buf_ptr] == alphanum || *buf_ptr == BACKSLASH) {
 +		/* fill_buffer() terminates buffer with newline */
 +		if (*buf_ptr == BACKSLASH) {
 +		    if (*(buf_ptr + 1) == '\n') {
 +			buf_ptr += 2;
 +			if (buf_ptr >= buf_end)
 +			    fill_buffer();
 +		    }
 +		    else
 +			break;
 +		}
  		CHECK_SIZE_TOKEN;
 +		/* copy it over */
  		*e_token++ = *buf_ptr++;
  		if (buf_ptr >= buf_end)
  		    fill_buffer();
 
 --------------Boundary-00=_OFK13LWOU3XJV6M73E0I--
 
 To Unsubscribe: send mail to majordomo@FreeBSD.org
 with "unsubscribe freebsd-bugs" in the body of the message
State-Changed-From-To: closed->open 
State-Changed-By: johan 
State-Changed-When: Thu Oct 11 11:40:59 PDT 2001 
State-Changed-Why:  
We actually got a patch, thanks. 

Jens is now a committer and can have a look at 
the attached patch. 


Responsible-Changed-From-To: freebsd-bugs->schweikh 
Responsible-Changed-By: johan 
Responsible-Changed-When: Thu Oct 11 11:40:59 PDT 2001 
Responsible-Changed-Why:  

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=6015 
State-Changed-From-To: open->closed 
State-Changed-By: schweikh 
State-Changed-When: Fri Oct 19 12:10:48 PDT 2001 
State-Changed-Why:  
Patch looks good and after indenting my chess problem solver it 
still passes the test suite. So I don't expect any regressions. 
Thanks, Alexey! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=6015 
>Unformatted:
