diff -c ./display.c ../goodwork/display.c
*** ./display.c	Sat Nov 21 15:34:21 1998
--- ../goodwork/display.c	Sat Nov 21 14:59:23 1998
***************
*** 574,580 ****
--- 574,582 ----
  char	*text; 
  {
  	extern	int	errno, sys_nerr;
+ #ifdef	NEEDS_SYS_ERRLIST_PROTO
  	extern	char	*sys_errlist[];
+ #endif
  	char	msg[MSGLEN + 1];	/* message */
  	register char	*s;
  
diff -c ./getwd.c ../goodwork/getwd.c
*** ./getwd.c	Sat Nov 21 15:34:22 1998
--- ../goodwork/getwd.c	Sat Nov 21 14:14:53 1998
***************
*** 14,20 ****
  	return(getcwd(dir, 200));
  }
  #else
! #ifndef BSD
  /*
   *	char *getwd(dir)
   *
--- 14,20 ----
  	return(getcwd(dir, 200));
  }
  #else
! #if	!defined(BSD) && !defined(__linux__)
  /*
   *	char *getwd(dir)
   *
diff -c ./global.h ../goodwork/global.h
*** ./global.h	Sat Nov 21 15:34:22 1998
--- ../goodwork/global.h	Sat Nov 21 14:55:55 1998
***************
*** 33,39 ****
  #if AIX
  typedef	long	pid_t;
  #else
! typedef	int	pid_t;
  #endif
  #endif
  #endif
--- 33,43 ----
  #if AIX
  typedef	long	pid_t;
  #else
! #if BSD
! #include <sys/types.h>	/* pid_t */
! #else
! typedef	int	pid_t; /
! #endif
  #endif
  #endif
  #endif
diff -c ./library.h ../goodwork/library.h
*** ./library.h	Sat Nov 21 15:34:22 1998
--- ../goodwork/library.h	Sat Nov 21 14:14:54 1998
***************
*** 42,47 ****
--- 42,48 ----
  
  /* vp*.c */
  FILE	*vpfopen(char *filename, char *type);
+ struct	stat;	/* Forward declaration */
  void	vpinit(char *currentdir);
  int	vpopen(char *path, int oflag);
  int	vpstat(char *path, struct stat *statp);
diff -c ./main.c ../goodwork/main.c
*** ./main.c	Sat Nov 21 15:34:23 1998
--- ../goodwork/main.c	Sat Nov 21 14:51:57 1998
***************
*** 1313,1319 ****
  	
  /* string comparison function for qsort */
  
! #ifdef __BORLANDC__
  int
  compare(const void *s1, const void *s2)
  {
--- 1313,1319 ----
  	
  /* string comparison function for qsort */
  
! #if	defined(__BORLANDC__) || defined(__STDC__)
  int
  compare(const void *s1, const void *s2)
  {
diff -c ./makefile ../goodwork/makefile
*** ./makefile	Sat Nov 21 15:34:23 1998
--- ../goodwork/makefile	Sat Nov 21 15:32:51 1998
***************
*** 1,7 ****
--- 1,12 ----
+ # DEBUG=-pg
  PROGRAM = cscope
  BIN = $(HOME)/bin
  CURSES = -lcurses
  LIBS = -lPW
+ # Linux calls it libfl
+ # LEXLIB=-lfl
+ LEXLIB=-ll
+ 
  
  # for System V Release 2 change the U to D:
  SVR2 = U
***************
*** 11,22 ****
  
  # for System V Release 4  or  Solaris  remove the #:
  #LIBS = -lgen
  
  # for Berkeley UNIX based machines change the U to D:
! BSD = U
  
  # for Berkeley UNIX based machines remove the #:
! #LIBS = -ltermcap
  
  # for Berkeley UNIX 4.2 change the U to D:
  BSD42 = U
--- 16,28 ----
  
  # for System V Release 4  or  Solaris  remove the #:
  #LIBS = -lgen
+ #CFLAGS+=-DNEEDS_SYS_ERRLIST_PROTO -DHAS_ATTLEX
  
  # for Berkeley UNIX based machines change the U to D:
! BSD = D
  
  # for Berkeley UNIX based machines remove the #:
! LIBS = -ltermcap
  
  # for Berkeley UNIX 4.2 change the U to D:
  BSD42 = U
***************
*** 30,36 ****
  
  TMPDIR= /usr/tmp
  
! CFLAGS  = -O $(DEBUG) -$(SVR2)SVR2 -$(BSD)BSD -$(BSD42)BSD42 \
  	  $(LINUX) -$(AIX)AIX -DTMPDIR=\"$(TMPDIR)\"
  
  LDFLAGS = $(DEBUG)
--- 36,42 ----
  
  TMPDIR= /usr/tmp
  
! CFLAGS  += -$(SVR2)SVR2 -$(BSD)BSD -$(BSD42)BSD42 \
  	  $(LINUX) -$(AIX)AIX -DTMPDIR=\"$(TMPDIR)\"
  
  LDFLAGS = $(DEBUG)
***************
*** 55,61 ****
  FILES	= $(OTHER) $(SOURCE) $(PROGRAM).1 $(EXTRA)
  
  $(PROGRAM): $(OBJECTS)
! 	$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(CURSES) -ll $(LIBS)
  $(OBJ): constants.h
  crossref.o find.o invlib.o: invlib.h
  dir.o: ndir.h vp.h
--- 61,67 ----
  FILES	= $(OTHER) $(SOURCE) $(PROGRAM).1 $(EXTRA)
  
  $(PROGRAM): $(OBJECTS)
! 	$(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(CURSES) $(LEXLIB) $(LIBS)
  $(OBJ): constants.h
  crossref.o find.o invlib.o: invlib.h
  dir.o: ndir.h vp.h
***************
*** 115,123 ****
  rmake:  rmake!svr2 rmake.svr2 rmake.svr3 rmake.svr4 rmake.bsd rmake.solaris
  
  # set NAME to "and name=type" to select individual types
! rmake!svr2:		cscope.cpio
! 		$(TOOLS)/adm/bin/machines -f type name!=3b20 and name!=vax and release!=SunOS and release!=BSD4.3 and release!=SVR4 and name!=i386 $(NAME) | xargs -l1 -i -t $(RMAKE) -p cscope -P .pkg.cscope -s cscope.cpio -t cscope -u -m {}
! 
  rmake.svr2:		cscope.cpio
  		$(TOOLS)/adm/bin/machines -f type release=SVR2 and name!=ibm $(NAME) | xargs -l1 -i -t $(RMAKE) -p cscope -P .pkg.cscope -s cscope.cpio -t cscope -u -m {} SVR2=D
  
--- 121,129 ----
  rmake:  rmake!svr2 rmake.svr2 rmake.svr3 rmake.svr4 rmake.bsd rmake.solaris
  
  # set NAME to "and name=type" to select individual types
! #rmake!svr2:		cscope.cpio
! #		$(TOOLS)/adm/bin/machines -f type name!=3b20 and name!=vax and release!=SunOS and release!=BSD4.3 and release!=SVR4 and name!=i386 $(NAME) | xargs -l1 -i -t $(RMAKE) -p cscope -P .pkg.cscope -s cscope.cpio -t cscope -u -m {}
! #
  rmake.svr2:		cscope.cpio
  		$(TOOLS)/adm/bin/machines -f type release=SVR2 and name!=ibm $(NAME) | xargs -l1 -i -t $(RMAKE) -p cscope -P .pkg.cscope -s cscope.cpio -t cscope -u -m {} SVR2=D
  
***************
*** 138,141 ****
  
  repall:		
  		$(TOOLS)/adm/bin/machines types | xargs -l1 -i -t $(REPFILE) -p cscope -P .pkg.cscope -s cscope.{} -t bin/cscope -x -v {}
- 
--- 144,146 ----
diff -c ./scanner.l ../goodwork/scanner.l
*** ./scanner.l	Sat Nov 21 15:34:24 1998
--- ../goodwork/scanner.l	Sat Nov 21 15:01:56 1998
***************
*** 1,3 ****
--- 1,4 ----
+ %array
  %{
  /*	Copyright (c) 1988 AT&T	*/
  /*	  All Rights Reserved  	*/
***************
*** 13,18 ****
--- 14,20 ----
  
  #include "global.h"
  
+ #ifdef	HAS_ATTLEX
  /* the line counting has been moved from character reading for speed */
  /* comments are discarded */
  #undef	input
***************
*** 27,32 ****
--- 29,43 ----
  #endif
  #undef	unput
  #define unput(c) (*yysptr++=(c))
+ #else	/* HAS_ATTLEX */
+ int 
+ noncommentinput()
+ {
+ 	int c;
+ 	c = input();
+ 	return  (c == EOF) ? LEXEOF : c;
+ }
+ #endif	/* HAS_ATTLEX */
  
  /* not a preprocessor line (allow Ingres(TM) "## char var;" lines) */
  #define	notpp()	(ppdefine == NO && (*yytext != '#' || yytext[1] == '#'))
***************
*** 40,45 ****
--- 51,59 ----
  int	first;	/* buffer index for first char of symbol */
  int	last;	/* buffer index for last char of symbol */
  int	lineno;	/* symbol line number */
+ #ifndef	HAS_ATTLEX
+ int	yylineno; /* current line number */
+ #endif
  
  static	BOOL	arraydimension;		/* inside array dimension declaration */
  static	BOOL	bplisting;		/* breakpoint listing */
***************
*** 74,79 ****
--- 88,94 ----
  static	int	token;			/* token found */
  
  void	multicharconstant();
+ 
  %}
  identifier	[a-zA-Z_][a-zA-Z_0-9]*
  number		\.?[0-9][.0-9a-fA-FlLuUxX]*
***************
*** 197,202 ****
--- 212,256 ----
  			return(INCLUDE);
  			/* NOTREACHED */
  		}
+ "//"		{		/* Skip C++ comment */
+ 			int c;
+ 			while ( (c = input()) != '\n' && c != EOF) 
+ 				;
+ 			if (c == EOF) {
+ 				return LEXEOF;
+ 			} else {
+ 				unput(c);
+ 			}
+ 			goto more;
+ 		}
+ 
+ "/*"		{
+ 			int c;
+ 
+ 			for ( ; ; ) {
+ 				/* eat up text of comment */
+ 				while ( (c = input()) != '*' && c != EOF ) {
+ 					if (c == '\n') {
+ 						yylineno++;    
+ 					}
+ 				}
+ 		    
+ 
+ 				if ( c == '*' ) {
+ 					while ( (c = input()) == '*' )
+ 						;
+ 					if (c == '\n') {
+ 						yylineno++;
+ 					}
+ 					if ( c == '/' )
+ 						break;    /* found the end */
+ 				}
+ 
+ 				if ( c == EOF )
+ 					return LEXEOF;
+ 			}
+ 			goto more;
+ 		}
  \{		{	/* count unmatched left braces for fcn def detection */
  			++braces;
  			
***************
*** 589,595 ****
  \n		{	/* end of the line */
  			if (ppdefine == YES) {	/* end of a #define */
  				ppdefine = NO;
! 				(void) yyless(yyleng - 1);	/* rescan \n */
  				last = first;
  				yymore();
  				return(DEFINEEND);
--- 643,649 ----
  \n		{	/* end of the line */
  			if (ppdefine == YES) {	/* end of a #define */
  				ppdefine = NO;
! 				yyless(yyleng - 1);	/* rescan \n */
  				last = first;
  				yymore();
  				return(DEFINEEND);
