Index: misc/unproto/Makefile
diff -c misc/unproto/Makefile:1.1.1.1 misc/unproto/Makefile:1.2
*** misc/unproto/Makefile:1.1.1.1	Tue Sep 26 15:45:15 1995
--- misc/unproto/Makefile	Sun Dec  8 23:29:02 1996
***************
*** 2,7 ****
--- 2,12 ----
  
  ## BEGIN CONFIGURATION STUFF
  
+ # The prefix to the area to install in.
+ #
+ #PREFIX	= /usr/local
+ PREFIX	= /local
+ 
  # In the unlikely case that your compiler has no hooks for alternate
  # compiler passes, use a "cc cflags -E file.c | unproto >file.i"
  # pipeline, then "cc cflags -c file.i" to compile the resulting
***************
*** 23,29 ****
  # compiler as a non-default preprocessor.
  #
  PROG	= cpp
! PIPE	= -DPIPE_THROUGH_CPP=\"/lib/cpp\"
  
  # Some compilers complain about some #directives. The following is only a
  # partial solution, because the directives are still seen by /lib/cpp.
--- 28,34 ----
  # compiler as a non-default preprocessor.
  #
  PROG	= cpp
! PIPE	= -DPIPE_THROUGH_CPP=\"/usr/lib/cpp\"
  
  # Some compilers complain about some #directives. The following is only a
  # partial solution, because the directives are still seen by /lib/cpp.
***************
*** 75,81 ****
  	hash.c strsave.c
  HFILES	= error.h token.h vstring.h symbol.h
  SCRIPTS	= cpp.sh acc.sh
! SAMPLES	= stdarg.h stddef.h stdlib.h varargs.c example.c example.out
  SOURCES	= README $(CFILES) $(HFILES) Makefile $(SCRIPTS) $(SAMPLES)
  FILES	= $(SOURCES) unproto.1
  OBJECTS	= tok_io.o tok_class.o tok_pool.o unproto.o vstring.o symbol.o error.o \
--- 80,86 ----
  	hash.c strsave.c
  HFILES	= error.h token.h vstring.h symbol.h
  SCRIPTS	= cpp.sh acc.sh
! SAMPLES	= stdarg.h stddef.h stdlib.h varargs.c example.c example.out #float.h
  SOURCES	= README $(CFILES) $(HFILES) Makefile $(SCRIPTS) $(SAMPLES)
  FILES	= $(SOURCES) unproto.1
  OBJECTS	= tok_io.o tok_class.o tok_pool.o unproto.o vstring.o symbol.o error.o \
***************
*** 85,98 ****
  #CFLAGS	= -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -p -Dstatic=
  #CFLAGS	= -g $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DDEBUG
  
  $(PROG): $(OBJECTS)
! 	$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(MALLOC)
  
  # For linting, enable all bells and whistles.
  
  lint:
  	lint -DPIPE_THROUGH_CPP=\"foo\" -DIGNORE_DIRECTIVES=\"foo\",\"bar\" \
! 	$(BELL) -DMAP_VOID $(ALIAS) $(CFILES)
  
  # Testing requires that the program is compiled with -DDEBUG.
  
--- 90,107 ----
  #CFLAGS	= -O $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -p -Dstatic=
  #CFLAGS	= -g $(PIPE) $(SKIP) $(BELL) $(MAP) $(ALIAS) -DDEBUG
  
+ LDFLAGS	= -O
+ #LDFLAGS = -g -p
+ #LDFLAGS = -g 
+ 
  $(PROG): $(OBJECTS)
! 	$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(MALLOC)
  
  # For linting, enable all bells and whistles.
  
  lint:
  	lint -DPIPE_THROUGH_CPP=\"foo\" -DIGNORE_DIRECTIVES=\"foo\",\"bar\" \
! 	  $(BELL) -DMAP_VOID $(ALIAS) $(CFILES)
  
  # Testing requires that the program is compiled with -DDEBUG.
  
***************
*** 101,106 ****
--- 110,133 ----
  	@echo the following diff command should produce no output
  	diff -b example.out example.tmp
  	rm -f example.tmp
+ 
+ test-unproto: unproto example.c example.out
+ 	./unproto < example.c > example.tmp
+ 	@echo the following diff command should produce no output
+ 	diff -b example.out example.tmp
+ 	rm -f example.tmp
+ 
+ install: install-dirs
+ 	if test "$(PROG)" = cpp ; then \
+ 		cp cpp $(PREFIX)/lib/unproto ; \
+ 	else \
+ 		cp $(PROG) $(PREFIX)/bin ; \
+ 	fi
+ 	cp $(SAMPLES) $(PREFIX)/include/unproto
+ 
+ install-dirs:
+ 	-mkdir $(PREFIX)/lib/unproto
+ 	-mkdir $(PREFIX)/include/unproto
  
  shar:	$(FILES)
  	@shar $(FILES)
Index: misc/unproto/cpp.sh
diff -c misc/unproto/cpp.sh:1.1.1.1 misc/unproto/cpp.sh:1.2
*** misc/unproto/cpp.sh:1.1.1.1	Tue Sep 26 15:45:15 1995
--- misc/unproto/cpp.sh	Sun Dec  8 23:12:46 1996
***************
*** 1,4 ****
! #!/bin/sh
  
  # @(#) cpp.sh 1.3 92/01/15 21:53:22
  
--- 1,4 ----
! #! /bin/sh
  
  # @(#) cpp.sh 1.3 92/01/15 21:53:22
  
***************
*** 32,35 ****
  	shift
  done
  
! /lib/cpp $cpp_args | unproto
--- 32,35 ----
  	shift
  done
  
! /lib/cpp -Dvolatile= -Dconst= $cpp_args | unproto
Index: misc/unproto/example.c
diff -c misc/unproto/example.c:1.1.1.1 misc/unproto/example.c:1.2
*** misc/unproto/example.c:1.1.1.1	Tue Sep 26 15:45:16 1995
--- misc/unproto/example.c	Sun Dec  8 23:13:44 1996
***************
*** 220,222 ****
--- 220,238 ----
  void functie(ARGSTR() *cmdlin, ARGSTR() *c1)
  {
  }
+ 
+ /* const in argument list */
+ 
+ int
+ test27(char *foo,
+        int y,
+        const char *bar)
+ {
+ /* const and volatile locals... */
+ 	const int cint;
+ 	volatile char *vcharp;
+ /* body */
+ 
+ 	vcharp = (volatile char *)vcharp;
+ 	return 1;
+ }
Index: misc/unproto/example.out
diff -c misc/unproto/example.out:1.1.1.1 misc/unproto/example.out:1.2
*** misc/unproto/example.out:1.1.1.1	Tue Sep 26 15:45:16 1995
--- misc/unproto/example.out	Sun Dec  8 23:14:09 1996
***************
*** 24,32 ****
      } foo;
  } baz;
  # 18 "example.c"
! {/*1*/
!     /* end dcls */return (0);
! }/*1*/
  
   
  
--- 24,32 ----
      } foo;
  } baz;
  # 18 "example.c"
! {
!     return (0);
! }
  
   
  
***************
*** 36,42 ****
  
  baz0(bar)
  int (*(*bar)())();
! {/*1*/}/*1*/
  
   
  
--- 36,42 ----
  
  baz0(bar)
  int (*(*bar)())();
! {}
  
   
  
***************
*** 47,90 ****
  foo(bar)
  # 38 "example.c"
  int (*(*bar)())();
! {/*1*/
      int     (*baz)()= (int (*)()) 0,
  	    y = (y * (*baz)(y)),
  	    *(*z)()= (int *(*)()) 0;
  
!     struct {/*2*/ int (*foo)(); }/*2*/ *(*s)()= 
  	(struct { int (*foo)(); } *(*)()) 0;
  
!     /* end dcls */{/*2*/
! 	y /* end dcls */= (y * (*baz)(y));
!     }/*2*/
!     {/*2*/
! 	z /* end dcls */= (int *(*)()) 0;
!     }/*2*/
!     {/*2*/
! 	s /* end dcls */= (struct { int (*foo)(); } *(*)()) 0;
!     }/*2*/
  
      return (0);
! }/*1*/
  
  
  
  test1()
! {/*1*/
  	int foo2,*(*(*bar)())(),*baz();
! }/*1*/
  
  
  
  test2(y)
  # 69 "example.c"
  charstar y;
! {/*1*/
  	int foo = 5,atoi();
  
! 	foo /* end dcls */= 5,atoi(y);
! }/*1*/
  
  
  
--- 47,90 ----
  foo(bar)
  # 38 "example.c"
  int (*(*bar)())();
! {
      int     (*baz)()= (int (*)()) 0,
  	    y = (y * (*baz)(y)),
  	    *(*z)()= (int *(*)()) 0;
  
!     struct { int (*foo)(); } *(*s)()= 
  	(struct { int (*foo)(); } *(*)()) 0;
  
!     {
! 	y = (y * (*baz)(y));
!     }
!     {
! 	z = (int *(*)()) 0;
!     }
!     {
! 	s = (struct { int (*foo)(); } *(*)()) 0;
!     }
  
      return (0);
! }
  
  
  
  test1()
! {
  	int foo2,*(*(*bar)())(),*baz();
! }
  
  
  
  test2(y)
  # 69 "example.c"
  charstar y;
! {
  	int foo = 5,atoi();
  
! 	foo = 5,atoi(y);
! }
  
  
  
***************
*** 93,190 ****
  test5(y)
  # 80 "example.c"
  int y;
! {/*1*/
! 	/* end dcls */{/*2*/
! 		test3/* end dcls */;
! 	}/*2*/
! 	{/*2*/
! 		test4/* end dcls */(y);
! 	}/*2*/
! }/*1*/
  
  test6[1],test7();
  
  test7(x)
  # 92 "example.c"
  int x;
! {/*1*/
! 	/* end dcls */{/*2*/
! 		test6/* end dcls */[1];
! 	}/*2*/
! 	{/*2*/
! 		test7/* end dcls */(x);
! 	}/*2*/
! }/*1*/
  
  
  
! struct {/*1*/
!     struct {/*2*/
  	int (*f)(), o;
!     }/*2*/ bar;
! }/*1*/ (*baz2)()= (struct { struct { int (*f)(), o; } bar; } (*)()) 0;
  
  
  
  test8(x)
! {/*1*/
!     /* end dcls */{/*2*/
! 	struct {/*3*/
  	    int     foo;
! 	}/*3*/ bar();
!     }/*2*/
!     {/*2*/
! 	/* end dcls */do {/*3*/
  	    int     foo;
! 	}/*3*/ while (x);
!     }/*2*/
! }/*1*/
  
  
  
  test9(bar)
  # 128 "example.c"
  char *bar;
! {/*1*/
!     foo/* end dcls */(*bar);
! }/*1*/
  
  
  
  test10(x)
  # 135 "example.c"
  int x;
! {/*1*/
!     /* end dcls */{/*2*/
  	int test10();
! 	/* end dcls */do  test10(x);
  	while (x);
!     }/*2*/
!     {/*2*/
! 	/* end dcls */return test10(x);
!     }/*2*/
! }/*1*/
  
  test11(x)
  # 147 "example.c"
  int *x;
! {/*1*/
! 	/* end dcls */while (*x)
  	    (putchar(*x++));
! }/*1*/
  
  test11a(x)
  # 153 "example.c"
  int *x;
! {/*1*/
! 	/* end dcls */for (*x;;)
  	    (putchar(*x++));
! }/*1*/
  
  
  
  test12()
! {/*1*/
  	char *x = 
  # 1 "/dev/null" 1
  # 165 "example.c" 2
--- 93,190 ----
  test5(y)
  # 80 "example.c"
  int y;
! {
! 	{
! 		test3;
! 	}
! 	{
! 		test4(y);
! 	}
! }
  
  test6[1],test7();
  
  test7(x)
  # 92 "example.c"
  int x;
! {
! 	{
! 		test6[1];
! 	}
! 	{
! 		test7(x);
! 	}
! }
  
  
  
! struct {
!     struct {
  	int (*f)(), o;
!     } bar;
! } (*baz2)()= (struct { struct { int (*f)(), o; } bar; } (*)()) 0;
  
  
  
  test8(x)
! {
!     {
! 	struct {
  	    int     foo;
! 	} bar();
!     }
!     {
! 	do {
  	    int     foo;
! 	} while (x);
!     }
! }
  
  
  
  test9(bar)
  # 128 "example.c"
  char *bar;
! {
!     foo(*bar);
! }
  
  
  
  test10(x)
  # 135 "example.c"
  int x;
! {
!     {
  	int test10();
! 	do  test10(x);
  	while (x);
!     }
!     {
! 	return test10(x);
!     }
! }
  
  test11(x)
  # 147 "example.c"
  int *x;
! {
! 	while (*x)
  	    (putchar(*x++));
! }
  
  test11a(x)
  # 153 "example.c"
  int *x;
! {
! 	for (*x;;)
  	    (putchar(*x++));
! }
  
  
  
  test12()
! {
  	char *x = 
  # 1 "/dev/null" 1
  # 165 "example.c" 2
***************
*** 193,203 ****
  
  		;
  
! 	printf/* end dcls */("foobarbaz"    );
  
  	*x = '\007';
  	*x = '\377';
! }/*1*/
  
  int test13();
  
--- 193,203 ----
  
  		;
  
! 	printf("foobarbaz"    );
  
  	*x = '\007';
  	*x = '\377';
! }
  
  int test13();
  
***************
*** 216,222 ****
  # 186 "example.c"
  charstar foo[bar];
  # 186 "example.c"
! {/*1*/}/*1*/
  
  int (*(*test18[bar])())()= 	(int (*(*[bar])())()) 0;
  
--- 216,222 ----
  # 186 "example.c"
  charstar foo[bar];
  # 186 "example.c"
! {}
  
  int (*(*test18[bar])())()= 	(int (*(*[bar])())()) 0;
  
***************
*** 231,252 ****
  # 197 "example.c"
  int test21();
  # 197 "example.c"
! {/*1*/}/*1*/
  
  void test22(test23)
  # 199 "example.c"
  struct { int foo; } test23();
  # 199 "example.c"
! {/*1*/}/*1*/
  
  
  
  void    test23()
! {/*1*/
      int     (*test24())(),
              y = (*test24(2)) (3),
              z = ((*test24(2))(3));
! }/*1*/
  
  
  
--- 231,252 ----
  # 197 "example.c"
  int test21();
  # 197 "example.c"
! {}
  
  void test22(test23)
  # 199 "example.c"
  struct { int foo; } test23();
  # 199 "example.c"
! {}
  
  
  
  void    test23()
! {
      int     (*test24())(),
              y = (*test24(2)) (3),
              z = ((*test24(2))(3));
! }
  
  
  
***************
*** 254,264 ****
  # 212 "example.c"
  long foo;
  # 212 "example.c"
! {/*1*/  }/*1*/
  
  int (*(*test26(foo))())()
  long foo;
! {/*1*/  }/*1*/
  
  
  
--- 254,264 ----
  # 212 "example.c"
  long foo;
  # 212 "example.c"
! {  }
  
  int (*(*test26(foo))())()
  long foo;
! {  }
  
  
  
***************
*** 267,271 ****
  struct {int l; char c[1];} *cmdlin;
  # 220 "example.c"
  struct {int l; char c[1];} *c1;
! {/*1*/
! }/*1*/
--- 267,291 ----
  struct {int l; char c[1];} *cmdlin;
  # 220 "example.c"
  struct {int l; char c[1];} *c1;
! {
! }
! 
! 
! 
! int
! test27(foo,
! y,
! bar)
! # 227 "example.c"
! char *foo;
! int y;
! const char *bar;
! {
! 
! 	const int cint;
! 	volatile char *vcharp;
! 
! 
! 	vcharp = (volatile char *)vcharp;
! 	return 1;
! }
Index: misc/unproto/stdarg.h
diff -c misc/unproto/stdarg.h:1.1.1.1 misc/unproto/stdarg.h:1.2
*** misc/unproto/stdarg.h:1.1.1.1	Tue Sep 26 15:45:15 1995
--- misc/unproto/stdarg.h	Sun Dec  8 23:16:09 1996
***************
*** 32,37 ****
--- 32,40 ----
    * verify that the stdarg.h file has been set up correctly.
    */
  
+ #ifndef __stdarg_h__
+ # define __stdarg_h__
+ 
  #ifdef sparc /* tested with SunOS 4.1.1 */
  
  #define _VA_ALIST_		"__builtin_va_alist"
***************
*** 83,85 ****
--- 86,90 ----
  #endif /* m88k */
  #endif /* mips */
  #endif /* sparc */
+ 
+ #endif /* __stdarg_h__ */
Index: misc/unproto/stddef.h
diff -c misc/unproto/stddef.h:1.1.1.1 misc/unproto/stddef.h:1.2
*** misc/unproto/stddef.h:1.1.1.1	Tue Sep 26 15:45:16 1995
--- misc/unproto/stddef.h	Sun Dec  8 23:19:03 1996
***************
*** 1,7 ****
  /* @(#) stddef.h 1.1 92/02/15 17:25:46 */
  
! #ifndef _stddef_h_
! #define _stddef_h_
  
  /* NULL is also defined in <stdio.h> */
  
--- 1,7 ----
  /* @(#) stddef.h 1.1 92/02/15 17:25:46 */
  
! #ifndef __stddef_h__
! #define __stddef_h__
  
  /* NULL is also defined in <stdio.h> */
  
***************
*** 15,23 ****
  
  /* Some of the following types may already be defined in <sys/types.h>. */
  
! /* #include <sys/types.h> */
  /* typedef long ptrdiff_t;		/* type of pointer difference */
  /* typedef unsigned short wchar_t;	/* wide character type */
  /* typedef unsigned size_t;		/* type of sizeof */
  
! #endif /* _stddef_h_ */
--- 15,23 ----
  
  /* Some of the following types may already be defined in <sys/types.h>. */
  
! #include <sys/types.h>
  /* typedef long ptrdiff_t;		/* type of pointer difference */
  /* typedef unsigned short wchar_t;	/* wide character type */
  /* typedef unsigned size_t;		/* type of sizeof */
  
! #endif /* __stddef_h__ */
Index: misc/unproto/stdlib.h
diff -c misc/unproto/stdlib.h:1.1.1.1 misc/unproto/stdlib.h:1.2
*** misc/unproto/stdlib.h:1.1.1.1	Tue Sep 26 15:45:16 1995
--- misc/unproto/stdlib.h	Sun Dec  8 23:17:30 1996
***************
*** 1,12 ****
  /* @(#) stdlib.h 1.1 92/02/15 17:25:45 */
  
! #ifndef _stdlib_h_
! #define _stdlib_h_
  
  /* NULL is also defined in <stdio.h> */
  
  #ifndef NULL
! #define NULL	0
  #endif
  
  /*
--- 1,12 ----
  /* @(#) stdlib.h 1.1 92/02/15 17:25:45 */
  
! #ifndef __stdlib_h__
! # define __stdlib_h__
  
  /* NULL is also defined in <stdio.h> */
  
  #ifndef NULL
! # define NULL	0
  #endif
  
  /*
***************
*** 36,41 ****
--- 36,42 ----
  extern void qsort();
  extern int abs();
  extern long labs();
+ extern char *strerror();
  
  typedef struct {
      int     quot;
***************
*** 50,53 ****
  extern div_t div();
  extern ldiv_t ldiv();
  
! #endif /* _stdlib_h_ */
--- 51,54 ----
  extern div_t div();
  extern ldiv_t ldiv();
  
! #endif /* __stdlib_h__ */
Index: misc/unproto/unproto.1
diff -c misc/unproto/unproto.1:1.1.1.1 misc/unproto/unproto.1:1.2
*** misc/unproto/unproto.1:1.1.1.1	Tue Sep 26 15:45:16 1995
--- misc/unproto/unproto.1	Sun Dec  8 23:24:58 1996
***************
*** 12,18 ****
  .SH SYNOPSIS
  .na
  .nf
! /somewhere/cpp ...
  
  cc cflags -E file.c | unproto >file.i; cc cflags -c file.i
  .SH DESCRIPTION
--- 12,18 ----
  .SH SYNOPSIS
  .na
  .nf
! /local/lib/unproto/cpp ...
  
  cc cflags -E file.c | unproto >file.i; cc cflags -c file.i
  .SH DESCRIPTION
