[comp.sources.bugs] System V patches for "BSD indent

gst@gnosys.UUCP (Gary S. Trujillo) (03/25/89)

In the spirit of trying to start paying back for all the good stuff
I have received from the net, here are some patches for the recently-
posted "indent" program, whose header is as follows:

|From: rsalz@uunet.uu.net (Rich Salz)
|Newsgroups: comp.sources.unix
|Subject: v18i049:  Indent, C reformatting program, Part01/03
|Message-ID: <1596@casaba.bbn.com>
|Date: 21 Mar 89 21:25:41 GMT
|Lines: 1477
|Approved: rsalz@uunet.UU.NET
|
|Submitted-by: Ozan Yigit <oz@nexus.yorku.ca>
|Posting-number: Volume 18, Issue 49
|Archive-name: indent/part01
|
|[  Oz has done lots of work on cleaning up all the copyright questions,
|   and fixing one or two bugs.  Kudo's to him.  He might appreciate
|   fixes, and he might not. :-)  --r$  ]

I highly recommend this utility, as it enables one to make many of the
religious questions about coding style rather moot.  (However, I tend to
save code when it comes from the net in what I may consider to be its
original ugly form, just in case patches ever get posted.  Anyway, the
following patches should make the code compile just fine in a System V
environment.

---------------------------------(cut here)------------------------------------
*** MakefileORIG	Fri Mar 24 12:33:48 1989
--- Makefile	Fri Mar 24 13:35:25 1989
***************
*** 16,22
  #
  #	@(#)Makefile	5.9 (Berkeley) 9/15/88
  #
! CFLAGS=	-O
  LIBC=	/lib/libc.a
  SRCS=	indent.c io.c lexi.c parse.c pr_comment.c args.c
  OBJS=	indent.o io.o lexi.o parse.o pr_comment.o args.o

--- 16,22 -----
  #
  #	@(#)Makefile	5.9 (Berkeley) 9/15/88
  #
! CFLAGS=	-O -DMAXPATHLEN=256
  LIBC=	/lib/libc.a
  SRCS=	indent.c io.c lexi.c parse.c pr_comment.c args.c
  OBJS=	indent.o io.o lexi.o parse.o pr_comment.o args.o
*** indent.cORIG	Fri Mar 24 12:36:28 1989
--- indent.c	Fri Mar 24 14:14:33 1989
***************
*** 1018,1023
  			*sc_end++ = ' ';
  			--line_no;
  		    }
  		    bcopy(s_lab + com_start, sc_end, com_end - com_start);
  		    sc_end += com_end - com_start;
  		    if (sc_end >= &save_com[sc_size])

--- 1018,1024 -----
  			*sc_end++ = ' ';
  			--line_no;
  		    }
+ #ifdef BSD	/* gst 3/24/89 */
  		    bcopy(s_lab + com_start, sc_end, com_end - com_start);
  #else
  		    memcpy(sc_end, s_lab + com_start, com_end - com_start);
***************
*** 1019,1024
  			--line_no;
  		    }
  		    bcopy(s_lab + com_start, sc_end, com_end - com_start);
  		    sc_end += com_end - com_start;
  		    if (sc_end >= &save_com[sc_size])
  			abort();

--- 1020,1028 -----
  		    }
  #ifdef BSD	/* gst 3/89 */
  		    bcopy(s_lab + com_start, sc_end, com_end - com_start);
+ #else
+ 		    memcpy(sc_end, s_lab + com_start, com_end - com_start);
+ #endif
  		    sc_end += com_end - com_start;
  		    if (sc_end >= &save_com[sc_size])
  			abort();
*** indent_glbs.h-	Fri Mar 24 12:33:59 1989
--- indent_globs.h	Fri Mar 24 13:57:32 1989
***************
*** 21,26
   */
  
  #include <stdio.h>
  
  #define BACKSLASH '\\'
  #define bufsize 200		/* size of internal buffers */

--- 21,27 -----
   */
  
  #include <stdio.h>
+ #include <memory.h>		/* gst: 3/24/89 */
  
  #define BACKSLASH '\\'
  #define bufsize 200		/* size of internal buffers */
*** io.cORIG	Fri Mar 24 14:50:53 1989
--- io.c	Fri Mar 24 14:00:56 1989
***************
*** 542,547
      return s;
  }
  
  
  parsefont(f, s0)
      register struct fstate *f;

--- 542,550 -----
      return s;
  }
  
+ #ifndef BSD	/* gst 3/89 */
+ #define bzero(where, howmany) memset(where, (char)0, howmany)
+ #endif
  
  parsefont(f, s0)
      register struct fstate *f;
-- 
Gary S. Trujillo			      {linus,bbn,m2c}!spdcc!gnosys!gst
Somerville, Massachusetts		     {icus,ima,stech,wjh12}!gnosys!gst

gst@gnosys.UUCP (Gary S. Trujillo) (03/25/89)

In article <136@gnosys.UUCP> gst@gnosys.UUCP (Gary S. Trujillo) writes:
> In the spirit of trying to start paying back for all the good stuff
> I have received from the net, here are some patches for the recently-
> posted "indent" program...

Oops.  I forgot the patch for the io.c routine.  Here it is:

*** io.cORIG	Fri Mar 24 14:50:53 1989
--- io.c	Fri Mar 24 14:00:56 1989
***************
*** 542,547
      return s;
  }
  
  
  parsefont(f, s0)
      register struct fstate *f;

--- 542,550 -----
      return s;
  }
  
+ #ifndef BSD	/* gst 3/89 */
+ #define bzero(where, howmany) memset(where, (char)0, howmany)
+ #endif
  
  parsefont(f, s0)
      register struct fstate *f;
-- 
Gary S. Trujillo			      {linus,bbn,m2c}!spdcc!gnosys!gst
Somerville, Massachusetts		     {icus,ima,stech,wjh12}!gnosys!gst

gst@gnosys.UUCP (Gary S. Trujillo) (03/26/89)

I just received the following, and thought I should pass it on...

| Date: Sat, 25 Mar 89 17:38:39 PST
| From: ...!uunet!auspex!guy (Guy Harris)
| Message-Id: <8903260138.AA07744@auspex.com>
| To: gnosys!gst
| Subject: Re: System V patches for "BSD indent(1)
| 
| >! CFLAGS=	-O -DMAXPATHLEN=256
| 
| Try 1024.  The concept of "MAXPATHLEN" doesn't exist in pre-S5R3
| systems, and the equivalent number is 1024 in S5R3 as distributed by
| AT&T.

I stand corrected.  (Actually, I just guessed at the number, but I'm
sure Guy knows what he's talking about.)

	Gary
-- 
Gary S. Trujillo			      {linus,bbn,m2c}!spdcc!gnosys!gst
Somerville, Massachusetts		     {icus,ima,stech,wjh12}!gnosys!gst