You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(2) |
Feb
(9) |
Mar
(6) |
Apr
(8) |
May
(7) |
Jun
(49) |
Jul
(36) |
Aug
(8) |
Sep
(4) |
Oct
(11) |
Nov
(3) |
Dec
|
2002 |
Jan
(8) |
Feb
|
Mar
(7) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(9) |
Aug
(2) |
Sep
|
Oct
(3) |
Nov
|
Dec
(2) |
2003 |
Jan
(6) |
Feb
|
Mar
(2) |
Apr
(3) |
May
|
Jun
(5) |
Jul
|
Aug
(6) |
Sep
(6) |
Oct
(2) |
Nov
|
Dec
|
2004 |
Jan
(2) |
Feb
(12) |
Mar
|
Apr
(10) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
(4) |
2005 |
Jan
(4) |
Feb
(6) |
Mar
(3) |
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
2006 |
Jan
|
Feb
(2) |
Mar
|
Apr
(12) |
May
(2) |
Jun
|
Jul
(6) |
Aug
(4) |
Sep
(11) |
Oct
(10) |
Nov
|
Dec
|
2007 |
Jan
(4) |
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
2008 |
Jan
|
Feb
(2) |
Mar
(4) |
Apr
(2) |
May
|
Jun
(6) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
(6) |
May
(2) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(8) |
2010 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(5) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 20:29:17
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21832/src Modified Files: Makefile.am Makefile.in fscanner.l Log Message: Allow non-Unix linebreak characters in more places (fix #1563459). Index: Makefile.am =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.am,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** Makefile.am 30 Sep 2006 17:31:14 -0000 1.11 --- Makefile.am 30 Sep 2006 20:29:14 -0000 1.12 *************** *** 35,39 **** ## Hack to clean the generated files and not include them in a "make dist". ! # CLEANFILES = scanner.c fscanner.c egrep.c #dist-hook: # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c --- 35,39 ---- ## Hack to clean the generated files and not include them in a "make dist". ! CLEANFILES = scanner.c fscanner.c egrep.c #dist-hook: # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.in,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** Makefile.in 30 Sep 2006 17:31:14 -0000 1.13 --- Makefile.in 30 Sep 2006 20:29:14 -0000 1.14 *************** *** 229,234 **** cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) AM_CPPFLAGS = $(CURSES_INCLUDEDIR) ! ! # CLEANFILES = scanner.c fscanner.c egrep.c #dist-hook: # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c --- 229,233 ---- cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) AM_CPPFLAGS = $(CURSES_INCLUDEDIR) ! CLEANFILES = scanner.c fscanner.c egrep.c #dist-hook: # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c *************** *** 893,896 **** --- 892,896 ---- clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** fscanner.l 23 Jul 2006 20:59:20 -0000 1.11 --- fscanner.l 30 Sep 2006 20:29:14 -0000 1.12 *************** *** 131,135 **** comment "/*"([^*]*("*"+[^/])?)*"*/"|"//"[^\n]*\n ws [ \t\r\v\f] ! wsnl [ \t\n]|{comment} /* flex options: stack of start conditions, and don't use yywrap() */ --- 131,135 ---- comment "/*"([^*]*("*"+[^/])?)*"*/"|"//"[^\n]*\n ws [ \t\r\v\f] ! wsnl [ \t\r\v\f\n]|{comment} /* flex options: stack of start conditions, and don't use yywrap() */ |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 20:29:17
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21832 Modified Files: ChangeLog Log Message: Allow non-Unix linebreak characters in more places (fix #1563459). Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -r1.163 -r1.164 *** ChangeLog 30 Sep 2006 17:31:14 -0000 1.163 --- ChangeLog 30 Sep 2006 20:29:14 -0000 1.164 *************** *** 1,4 **** --- 1,8 ---- 2006-09-30 Hans-Bernhard Broeker <br...@ph...> + * src/fscanner.l (wsnl): Expand set of allowed characters to make + scanner more tolerant of non-Unix linebreaks (should fix SF Bug + #1563459) + * src/Makefile.am (CLEANFILES, dist-hook): Commented out, to reduce number of user reports from people without lex. *************** *** 9,13 **** * src/invlib.c (invnewterm): Correct loop test to account for ! maxback being unsigned (SF bug #1559495). * src/Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES, to quench --- 13,17 ---- * src/invlib.c (invnewterm): Correct loop test to account for ! maxback being unsigned (should fix SF bug #1559495). * src/Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES, to quench |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 17:31:20
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18761 Modified Files: ChangeLog aclocal.m4 configure configure.in Log Message: Keep and distribute lex and yacc output files. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -r1.162 -r1.163 *** ChangeLog 30 Sep 2006 16:51:44 -0000 1.162 --- ChangeLog 30 Sep 2006 17:31:14 -0000 1.163 *************** *** 1,4 **** --- 1,11 ---- 2006-09-30 Hans-Bernhard Broeker <br...@ph...> + * src/Makefile.am (CLEANFILES, dist-hook): Commented out, to + reduce number of user reports from people without lex. + + * configure.in: Change from AC_PROG_LEX to AM_PROG_LEX. + + * src/Makefile.am (cscope_SOURCES): Added alloc.h. Reindented. + * src/invlib.c (invnewterm): Correct loop test to account for maxback being unsigned (SF bug #1559495). Index: aclocal.m4 =================================================================== RCS file: /cvsroot/cscope/cscope/aclocal.m4,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** aclocal.m4 30 Sep 2006 16:51:45 -0000 1.7 --- aclocal.m4 30 Sep 2006 17:31:14 -0000 1.8 *************** *** 490,493 **** --- 490,514 ---- AC_SUBST([am__leading_dot])]) + # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 + # Free Software Foundation, Inc. + # + # This file is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + # serial 5 + + # AM_PROG_LEX + # ----------- + # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a + # "missing" invocation, for better error output. + AC_DEFUN([AM_PROG_LEX], + [AC_PREREQ(2.50)dnl + AC_REQUIRE([AM_MISSING_HAS_RUN])dnl + AC_REQUIRE([AC_PROG_LEX])dnl + if test "$LEX" = :; then + LEX=${am_missing_run}flex + fi]) + # Check to see how 'make' treats includes. -*- Autoconf -*- Index: configure =================================================================== RCS file: /cvsroot/cscope/cscope/configure,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** configure 30 Sep 2006 16:51:45 -0000 1.28 --- configure 30 Sep 2006 17:31:14 -0000 1.29 *************** *** 3265,3268 **** --- 3265,3271 ---- fi + if test "$LEX" = :; then + LEX=${am_missing_run}flex + fi *************** *** 3993,3997 **** ncurses_version=unknown cat > conftest.$ac_ext <<EOF ! #line 3995 "configure" #include "confdefs.h" #ifdef RENAMED_NCURSES --- 3996,4000 ---- ncurses_version=unknown cat > conftest.$ac_ext <<EOF ! #line 3998 "configure" #include "confdefs.h" #ifdef RENAMED_NCURSES Index: configure.in =================================================================== RCS file: /cvsroot/cscope/cscope/configure.in,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** configure.in 30 Sep 2006 16:51:45 -0000 1.33 --- configure.in 30 Sep 2006 17:31:14 -0000 1.34 *************** *** 16,20 **** AC_PROG_CC AC_EXEEXT ! AC_PROG_LEX AM_CONDITIONAL(USING_LEX, test "x$LEX" = "xlex") if test "x$LEX" = "xlex" ; then AC_DEFINE(USING_LEX, 1, --- 16,20 ---- AC_PROG_CC AC_EXEEXT ! AM_PROG_LEX AM_CONDITIONAL(USING_LEX, test "x$LEX" = "xlex") if test "x$LEX" = "xlex" ; then AC_DEFINE(USING_LEX, 1, |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 17:31:20
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18761/src Modified Files: Makefile.am Makefile.in Log Message: Keep and distribute lex and yacc output files. Index: Makefile.am =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.am,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** Makefile.am 30 Sep 2006 16:51:45 -0000 1.10 --- Makefile.am 30 Sep 2006 17:31:14 -0000 1.11 *************** *** 20,29 **** endif ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y \ ! alloc.c basename.c build.c build.h command.c compath.c constants.h crossref.c dir.c \ ! display.c edit.c exec.c find.c global.h help.c history.c input.c \ ! invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c \ ! mygetenv.c mypopen.c scanner.h version.h vp.h vpaccess.c vpfopen.c \ ! vpinit.c vpopen.c EXTRA_cscope_SOURCES = scanner.l fscanner.l --- 20,28 ---- endif ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y alloc.c alloc.h basename.c build.c \ ! build.h command.c compath.c constants.h crossref.c dir.c display.c edit.c \ ! exec.c find.c global.h help.c history.c input.c invlib.c invlib.h library.h \ ! logdir.c lookup.c lookup.h main.c mouse.c mygetenv.c mypopen.c scanner.h \ ! version.h vp.h vpaccess.c vpfopen.c vpinit.c vpopen.c EXTRA_cscope_SOURCES = scanner.l fscanner.l *************** *** 36,42 **** ## Hack to clean the generated files and not include them in a "make dist". ! CLEANFILES = scanner.c fscanner.c egrep.c ! dist-hook: ! rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c EXTRA_DIST = emacs.e gmacs.ml --- 35,41 ---- ## Hack to clean the generated files and not include them in a "make dist". ! # CLEANFILES = scanner.c fscanner.c egrep.c ! #dist-hook: ! # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c EXTRA_DIST = emacs.e gmacs.ml Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.in,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** Makefile.in 30 Sep 2006 16:51:45 -0000 1.12 --- Makefile.in 30 Sep 2006 17:31:14 -0000 1.13 *************** *** 52,56 **** binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) ! am__cscope_SOURCES_DIST = fscanner.l scanner.l egrep.y alloc.c \ basename.c build.c build.h command.c compath.c constants.h \ crossref.c dir.c display.c edit.c exec.c find.c global.h \ --- 52,56 ---- binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) ! am__cscope_SOURCES_DIST = fscanner.l scanner.l egrep.y alloc.c alloc.h \ basename.c build.c build.h command.c compath.c constants.h \ crossref.c dir.c display.c edit.c exec.c find.c global.h \ *************** *** 74,78 **** cscope_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__gscope_SOURCES_DIST = gscope.c fscanner.l scanner.l egrep.y \ ! alloc.c basename.c build.c build.h command.c compath.c \ constants.h crossref.c dir.c display.c edit.c exec.c find.c \ global.h help.c history.c input.c invlib.c invlib.h library.h \ --- 74,78 ---- cscope_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am__gscope_SOURCES_DIST = gscope.c fscanner.l scanner.l egrep.y \ ! alloc.c alloc.h basename.c build.c build.h command.c compath.c \ constants.h crossref.c dir.c display.c edit.c exec.c find.c \ global.h help.c history.c input.c invlib.c invlib.h library.h \ *************** *** 220,234 **** @USING_LEX_FALSE@LEXER_SOURCE = fscanner.l @USING_LEX_TRUE@LEXER_SOURCE = scanner.l ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y \ ! alloc.c basename.c build.c build.h command.c compath.c constants.h crossref.c dir.c \ ! display.c edit.c exec.c find.c global.h help.c history.c input.c \ ! invlib.c invlib.h library.h logdir.c lookup.c lookup.h main.c mouse.c \ ! mygetenv.c mypopen.c scanner.h version.h vp.h vpaccess.c vpfopen.c \ ! vpinit.c vpopen.c EXTRA_cscope_SOURCES = scanner.l fscanner.l cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) AM_CPPFLAGS = $(CURSES_INCLUDEDIR) ! CLEANFILES = scanner.c fscanner.c egrep.c EXTRA_DIST = emacs.e gmacs.ml @HAS_GNOME_TRUE@GNOME_SWITCH = -DUSING_GNOME_UI --- 220,236 ---- @USING_LEX_FALSE@LEXER_SOURCE = fscanner.l @USING_LEX_TRUE@LEXER_SOURCE = scanner.l ! cscope_SOURCES = $(LEXER_SOURCE) egrep.y alloc.c alloc.h basename.c build.c \ ! build.h command.c compath.c constants.h crossref.c dir.c display.c edit.c \ ! exec.c find.c global.h help.c history.c input.c invlib.c invlib.h library.h \ ! logdir.c lookup.c lookup.h main.c mouse.c mygetenv.c mypopen.c scanner.h \ ! version.h vp.h vpaccess.c vpfopen.c vpinit.c vpopen.c EXTRA_cscope_SOURCES = scanner.l fscanner.l cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) AM_CPPFLAGS = $(CURSES_INCLUDEDIR) ! ! # CLEANFILES = scanner.c fscanner.c egrep.c ! #dist-hook: ! # rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c EXTRA_DIST = emacs.e gmacs.ml @HAS_GNOME_TRUE@GNOME_SWITCH = -DUSING_GNOME_UI *************** *** 867,873 **** fi; \ done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook check-am: all-am check: check-am --- 869,872 ---- *************** *** 894,898 **** clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: --- 893,896 ---- *************** *** 955,959 **** .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ ! clean-generic ctags dist-hook distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ --- 953,957 ---- .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ ! clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ *************** *** 965,970 **** uninstall-am uninstall-binPROGRAMS uninstall-info-am - dist-hook: - rm -f $(distdir)/scanner.c $(distdir)/fscanner.c $(distdir)/egrep.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. --- 963,966 ---- |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 16:51:48
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3571/src Modified Files: Makefile.am Makefile.in Log Message: Refresh autoconfigury. Index: Makefile.am =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** Makefile.am 23 Jan 2003 17:30:44 -0000 1.9 --- Makefile.am 30 Sep 2006 16:51:45 -0000 1.10 *************** *** 33,37 **** cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) ! INCLUDES = $(CURSES_INCLUDEDIR) ## Hack to clean the generated files and not include them in a "make dist". --- 33,37 ---- cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) ! AM_CPPFLAGS = $(CURSES_INCLUDEDIR) ## Hack to clean the generated files and not include them in a "make dist". Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/src/Makefile.in,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** Makefile.in 19 Apr 2006 14:30:16 -0000 1.11 --- Makefile.in 30 Sep 2006 16:51:45 -0000 1.12 *************** *** 37,41 **** build_triplet = @build@ host_triplet = @host@ - LIBOBJDIR = @HAS_GNOME_TRUE@EXTRA_PROGRAMS = gscope$(EXEEXT) bin_PROGRAMS = cscope$(EXEEXT) --- 37,40 ---- *************** *** 230,234 **** EXTRA_cscope_SOURCES = scanner.l fscanner.l cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) ! INCLUDES = $(CURSES_INCLUDEDIR) CLEANFILES = scanner.c fscanner.c egrep.c EXTRA_DIST = emacs.e gmacs.ml --- 229,233 ---- EXTRA_cscope_SOURCES = scanner.l fscanner.l cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) ! AM_CPPFLAGS = $(CURSES_INCLUDEDIR) CLEANFILES = scanner.c fscanner.c egrep.c EXTRA_DIST = emacs.e gmacs.ml |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 16:51:48
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3571 Modified Files: ChangeLog Makefile.in aclocal.m4 configure configure.in Log Message: Refresh autoconfigury. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -r1.161 -r1.162 *** ChangeLog 30 Sep 2006 15:38:16 -0000 1.161 --- ChangeLog 30 Sep 2006 16:51:44 -0000 1.162 *************** *** 2,6 **** * src/invlib.c (invnewterm): Correct loop test to account for ! maxback being unsigned. 2006-08-20 Hans-Bernhard Broeker <br...@ph...> --- 2,16 ---- * src/invlib.c (invnewterm): Correct loop test to account for ! maxback being unsigned (SF bug #1559495). ! ! * src/Makefile.am (AM_CPPFLAGS): Renamed from INCLUDES, to quench ! an automake warning. ! ! * configure.in: Modernized via autoupdate. Fixed several ! 'underquoted' warnings from aclocal. Use a more telling source ! file name in AC_CONFIG_SRCDIR. ! ! * configure, aclocal.m4, Makefile.in, contrib/Makefile.in, ! doc/Makefile.in, src/Makefile.in: Regenerated. 2006-08-20 Hans-Bernhard Broeker <br...@ph...> Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/Makefile.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Makefile.in 19 Apr 2006 14:30:16 -0000 1.8 --- Makefile.in 30 Sep 2006 16:51:45 -0000 1.9 *************** *** 36,40 **** build_triplet = @build@ host_triplet = @host@ - LIBOBJDIR = DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ --- 36,39 ---- Index: aclocal.m4 =================================================================== RCS file: /cvsroot/cscope/cscope/aclocal.m4,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** aclocal.m4 19 Apr 2006 14:30:16 -0000 1.6 --- aclocal.m4 30 Sep 2006 16:51:45 -0000 1.7 *************** *** 341,356 **** ]) - # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 - # Free Software Foundation, Inc. - # - # This file is free software; the Free Software Foundation - # gives unlimited permission to copy and/or distribute it, - # with or without modifications, as long as this notice is preserved. - - # serial 8 - - # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. - AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) - # Do all the work for Automake. -*- Autoconf -*- --- 341,344 ---- Index: configure =================================================================== RCS file: /cvsroot/cscope/cscope/configure,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** configure 21 Apr 2006 10:41:21 -0000 1.27 --- configure 30 Sep 2006 16:51:45 -0000 1.28 *************** *** 272,276 **** PACKAGE_BUGREPORT= ! ac_unique_file="src/basename.c" # Factoring default headers for most tests. ac_includes_default="\ --- 272,276 ---- PACKAGE_BUGREPORT= ! ac_unique_file="src/crossref.c" # Factoring default headers for most tests. ac_includes_default="\ *************** *** 6334,6341 **** ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` ! # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR ! # will be set to the directory where LIBOBJS objects are built. ! ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ! ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs --- 6334,6340 ---- ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` ! # 2. Add them. ! ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ! ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs Index: configure.in =================================================================== RCS file: /cvsroot/cscope/cscope/configure.in,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -r1.32 -r1.33 *** configure.in 21 Apr 2006 10:41:21 -0000 1.32 --- configure.in 30 Sep 2006 16:51:45 -0000 1.33 *************** *** 1,8 **** dnl Process this file with autoconf to produce a configure script. AC_INIT ! AC_CONFIG_SRCDIR([src/basename.c]) AM_INIT_AUTOMAKE(cscope, 16.0a) ! AM_CONFIG_HEADER(config.h:config.h.in) ! AC_PREREQ(2.57) AC_CANONICAL_HOST --- 1,8 ---- dnl Process this file with autoconf to produce a configure script. AC_INIT ! AC_CONFIG_SRCDIR([src/crossref.c]) AM_INIT_AUTOMAKE(cscope, 16.0a) ! AC_CONFIG_HEADERS([config.h:config.h.in]) ! AC_PREREQ(2.59) AC_CANONICAL_HOST *************** *** 112,116 **** ! AC_DEFUN(AC_CHECK_CURSES,[ search_ncurses=true screen_manager="" --- 112,116 ---- ! AC_DEFUN([AC_CHECK_CURSES],[ search_ncurses=true screen_manager="" *************** *** 176,180 **** ! AC_DEFUN(AC_USE_SUNOS_CURSES, [ search_ncurses=false screen_manager="SunOS 4.x /usr/5include curses" --- 176,180 ---- ! AC_DEFUN([AC_USE_SUNOS_CURSES], [ search_ncurses=false screen_manager="SunOS 4.x /usr/5include curses" *************** *** 190,194 **** ]) ! AC_DEFUN(AC_USE_OSF1_CURSES, [ AC_MSG_RESULT(Using OSF1 curses) search_ncurses=false --- 190,194 ---- ]) ! AC_DEFUN([AC_USE_OSF1_CURSES], [ AC_MSG_RESULT(Using OSF1 curses) search_ncurses=false *************** *** 201,205 **** ]) ! AC_DEFUN(AC_USE_SYSV_CURSES, [ AC_MSG_RESULT(Using SysV curses) AC_DEFINE(HAS_CURSES) --- 201,205 ---- ]) ! AC_DEFUN([AC_USE_SYSV_CURSES], [ AC_MSG_RESULT(Using SysV curses) AC_DEFINE(HAS_CURSES) *************** *** 236,240 **** dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename dnl ! AC_DEFUN(AC_NCURSES, [ if $search_ncurses then --- 236,240 ---- dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename dnl ! AC_DEFUN([AC_NCURSES], [ if $search_ncurses then *************** *** 253,257 **** ]) ! AC_DEFUN(AC_SEARCH_NCURSES, [ AS_MESSAGE(checking "location of ncurses.h file"...) --- 253,257 ---- ]) ! AC_DEFUN([AC_SEARCH_NCURSES], [ AS_MESSAGE(checking "location of ncurses.h file"...) *************** *** 360,364 **** dnl Check for a GNOME installation ! AC_DEFUN(AC_CHECK_GNOME,[ has_gnome=false AC_CHECK_PROG(gnome1, gnome-config, true) --- 360,364 ---- dnl Check for a GNOME installation ! AC_DEFUN([AC_CHECK_GNOME],[ has_gnome=false AC_CHECK_PROG(gnome1, gnome-config, true) *************** *** 395,403 **** dnl This test was ripped from gnuplot's configure.in: AC_MSG_CHECKING(for sigsetjmp) ! AC_TRY_LINK([#include <setjmp.h>], [jmp_buf env; sigsetjmp(env, 1);], ! [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SIGSETJMP,1, ! [ Define if we have sigsetjmp(). ])], ! AC_MSG_RESULT(no)) dnl Checks for library functions. --- 395,401 ---- dnl This test was ripped from gnuplot's configure.in: AC_MSG_CHECKING(for sigsetjmp) ! AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <setjmp.h>]], [[jmp_buf env; sigsetjmp(env, 1);]])],[AC_MSG_RESULT(yes) AC_DEFINE(HAVE_SIGSETJMP,1, ! [ Define if we have sigsetjmp(). ])],[AC_MSG_RESULT(no)]) dnl Checks for library functions. |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 16:51:48
|
Update of /cvsroot/cscope/cscope/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3571/doc Modified Files: Makefile.in Log Message: Refresh autoconfigury. Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/doc/Makefile.in,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** Makefile.in 19 Apr 2006 14:30:16 -0000 1.7 --- Makefile.in 30 Sep 2006 16:51:45 -0000 1.8 *************** *** 36,40 **** build_triplet = @build@ host_triplet = @host@ - LIBOBJDIR = subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in --- 36,39 ---- |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 16:51:48
|
Update of /cvsroot/cscope/cscope/contrib In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3571/contrib Modified Files: Makefile.in Log Message: Refresh autoconfigury. Index: Makefile.in =================================================================== RCS file: /cvsroot/cscope/cscope/contrib/Makefile.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** Makefile.in 19 Apr 2006 14:30:16 -0000 1.8 --- Makefile.in 30 Sep 2006 16:51:45 -0000 1.9 *************** *** 37,41 **** build_triplet = @build@ host_triplet = @host@ - LIBOBJDIR = subdir = contrib DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in --- 37,40 ---- |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 15:50:32
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18606/src Modified Files: invlib.c Log Message: Fix bug 1559495. Index: invlib.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -r1.17 -r1.18 *** invlib.c 21 Apr 2006 10:43:42 -0000 1.17 --- invlib.c 30 Sep 2006 15:38:16 -0000 1.18 *************** *** 413,417 **** maxback = numinvitems - 2; howfar = 0; ! while (--maxback > 0) { howfar++; iteminfo.packword[0] = --- 413,417 ---- maxback = numinvitems - 2; howfar = 0; ! while (maxback-- > 1) { howfar++; iteminfo.packword[0] = |
From: Hans-Bernhard B. <br...@us...> - 2006-09-30 15:50:23
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18606 Modified Files: ChangeLog Log Message: Fix bug 1559495. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -r1.160 -r1.161 *** ChangeLog 20 Aug 2006 19:15:54 -0000 1.160 --- ChangeLog 30 Sep 2006 15:38:16 -0000 1.161 *************** *** 1,2 **** --- 1,7 ---- + 2006-09-30 Hans-Bernhard Broeker <br...@ph...> + + * src/invlib.c (invnewterm): Correct loop test to account for + maxback being unsigned. + 2006-08-20 Hans-Bernhard Broeker <br...@ph...> |
From: Hans-Bernhard B. <br...@us...> - 2006-08-20 19:16:00
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21649 Modified Files: ChangeLog Log Message: Bugfix: change on 2006-07-23 missed one place where s_len had to be written. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -r1.159 -r1.160 *** ChangeLog 20 Aug 2006 15:00:32 -0000 1.159 --- ChangeLog 20 Aug 2006 19:15:54 -0000 1.160 *************** *** 1,4 **** --- 1,7 ---- 2006-08-20 Hans-Bernhard Broeker <br...@ph...> + * src/find.c (findsymbol): Missed one place where s_len had to be + initialized. + * src/main.c (tempstring): Parametrize length by new macro TEMPSTRING_LEN. |
From: Hans-Bernhard B. <br...@us...> - 2006-08-20 19:15:59
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21649/src Modified Files: find.c Log Message: Bugfix: change on 2006-07-23 missed one place where s_len had to be written. Index: find.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/find.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -r1.19 -r1.20 *** find.c 23 Jul 2006 20:59:20 -0000 1.19 --- find.c 20 Aug 2006 19:15:54 -0000 1.20 *************** *** 185,188 **** --- 185,189 ---- default: /* other symbol */ s = symbol; + s_len = sizeof(symbol); } /* save the name */ |
From: Hans-Bernhard B. <br...@us...> - 2006-08-20 15:00:41
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19657/src Modified Files: build.c command.c dir.c display.c edit.c input.c main.c constants.h Log Message: Avoid some possible buffer overflows by limiting the size of scanf(%s). Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** build.c 23 Jul 2006 20:59:20 -0000 1.11 --- build.c 20 Aug 2006 15:00:33 -0000 1.12 *************** *** 125,129 **** /* see if the name list is the same */ for (i = 0; i < count; ++i) { ! if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, names[i])) { return(NO); --- 125,129 ---- /* see if the name list is the same */ for (i = 0; i < count; ++i) { ! if (! fgets(oldname, sizeof(oldname), oldrefs)|| strnotequal(oldname, names[i])) { return(NO); *************** *** 233,237 **** if ((oldrefs = vpfopen(reffile, "rb")) != NULL && unconditional == NO ! && fscanf(oldrefs, "cscope %d %s", &fileversion, olddir) == 2 && (strcmp(olddir, currentdir) == 0 /* remain compatible */ || strcmp(olddir, newdir) == 0)) { --- 233,237 ---- if ((oldrefs = vpfopen(reffile, "rb")) != NULL && unconditional == NO ! && fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2 && (strcmp(olddir, currentdir) == 0 /* remain compatible */ || strcmp(olddir, newdir) == 0)) { *************** *** 306,310 **** none have been changed up to the included files */ for (i = 0; i < nsrcfiles; ++i) { ! if (fscanf(oldrefs, "%s", oldname) != 1 || strnotequal(oldname, srcfiles[i]) || lstat(srcfiles[i], &statstruct) != 0 || --- 306,310 ---- none have been changed up to the included files */ for (i = 0; i < nsrcfiles; ++i) { ! if (! fgets(oldname, sizeof(oldname), oldrefs) || strnotequal(oldname, srcfiles[i]) || lstat(srcfiles[i], &statstruct) != 0 || *************** *** 315,319 **** /* the old cross-reference is up-to-date */ /* so get the list of included files */ ! while (i++ < oldnum && fscanf(oldrefs, "%s", oldname) == 1) { addsrcfile(oldname); } --- 315,319 ---- /* the old cross-reference is up-to-date */ /* so get the list of included files */ ! while (i++ < oldnum && fgets(oldname, sizeof(oldname), oldrefs)) { addsrcfile(oldname); } Index: command.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/command.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** command.c 23 Jul 2006 20:59:20 -0000 1.31 --- command.c 20 Aug 2006 15:00:33 -0000 1.32 *************** *** 729,733 **** seekline(1); for (i = 0; ! fscanf(refsfound, "%s%*s%s%*[^\n]", newfile, linenum) == 2; ++i) { /* see if the line is to be changed */ --- 729,733 ---- seekline(1); for (i = 0; ! fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", newfile, linenum) == 2; ++i) { /* see if the line is to be changed */ Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** dir.c 23 Jul 2006 20:59:20 -0000 1.27 --- dir.c 20 Aug 2006 15:00:34 -0000 1.28 *************** *** 331,335 **** /* Parse whitespace-terminated strings in line: */ point_in_line = line; ! while (sscanf(point_in_line, "%s", path) == 1) { /* Have to store this length --- inviewpath() will * modify path, later! */ --- 331,335 ---- /* Parse whitespace-terminated strings in line: */ point_in_line = line; ! while (sscanf(point_in_line, "%" PATHLEN_STR "s", path) == 1) { /* Have to store this length --- inviewpath() will * modify path, later! */ Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** display.c 23 Jul 2006 20:59:20 -0000 1.28 --- display.c 20 Aug 2006 15:00:34 -0000 1.29 *************** *** 225,229 **** ++disprefs, ++screenline) { /* read the reference line */ ! if (fscanf(refsfound, "%s%s%s %[^\n]", file, function, linenum, tempstring) < 4) { break; --- 225,229 ---- ++disprefs, ++screenline) { /* read the reference line */ ! if (fscanf(refsfound, "%" PATHLEN_STR "s%" PATHLEN_STR "s%" NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\n]", file, function, linenum, tempstring) < 4) { break; Index: edit.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/edit.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** edit.c 27 Mar 2001 14:09:19 -0000 1.5 --- edit.c 20 Aug 2006 15:00:34 -0000 1.6 *************** *** 61,65 **** /* get the file name and line number */ ! if (fscanf(refsfound, "%s%*s%s", file, linenum) == 2) { edit(file, linenum); /* edit it */ } --- 61,65 ---- /* get the file name and line number */ ! if (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s", file, linenum) == 2) { edit(file, linenum); /* edit it */ } *************** *** 84,88 **** /* get each file name and line number */ ! while (fscanf(refsfound, "%s%*s%s%*[^\n]", file, linenum) == 2) { edit(file, linenum); /* edit it */ if (editallprompt == YES) { --- 84,88 ---- /* get each file name and line number */ ! while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) { edit(file, linenum); /* edit it */ if (editallprompt == YES) { Index: input.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/input.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** input.c 21 Apr 2006 10:42:15 -0000 1.14 --- input.c 20 Aug 2006 15:00:34 -0000 1.15 *************** *** 291,304 **** if (*out == '\0') { v = getenv("HOME"); ! } ! else { /* get the home directory of the login name */ v = logdir(out); } ! /* copy the directory name */ ! if (v != NULL) { strcpy(out - 1, v); out += strlen(v) - 1; ! } ! else { /* login not found, so ~ must be part of the file name */ out += strlen(out); } --- 291,303 ---- if (*out == '\0') { v = getenv("HOME"); ! } else { /* get the home directory of the login name */ v = logdir(out); } ! /* copy the directory name if it isn't too big */ ! if (v != NULL && strlen(v) < (lastchar - out)) { strcpy(out - 1, v); out += strlen(v) - 1; ! } else { ! /* login not found, so ~ must be part of the file name */ out += strlen(out); } *************** *** 319,328 **** *s = '\0'; ! /* get its value */ ! if ((v = getenv(out)) != NULL) { strcpy(out - 1, v); out += strlen(v) - 1; ! } ! else { /* var not found, so $ must be part of the file name */ out += strlen(out); } --- 318,328 ---- *s = '\0'; ! /* get its value, but only it isn't too big */ ! if ((v = getenv(out)) != NULL && strlen(v) < (lastchar - out)) { strcpy(out - 1, v); out += strlen(v) - 1; ! } else { ! /* var not found, or too big, so assume $ must be part of the ! * file name */ out += strlen(out); } Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -r1.40 -r1.41 *** main.c 23 Jul 2006 20:59:20 -0000 1.40 --- main.c 20 Aug 2006 15:00:34 -0000 1.41 *************** *** 102,109 **** char temp1[PATHLEN + 1]; /* temporary file name */ char temp2[PATHLEN + 1]; /* temporary file name */ ! char tempdirpv[PATHLEN +1]; /* private temp directory */ long totalterms; /* total inverted index terms */ BOOL trun_syms; /* truncate symbols to 8 characters */ ! char tempstring[8192]; /* use this as a buffer, instead of 'yytext', * which had better be left alone */ char *tmpdir; /* temporary directory */ --- 102,109 ---- char temp1[PATHLEN + 1]; /* temporary file name */ char temp2[PATHLEN + 1]; /* temporary file name */ ! char tempdirpv[PATHLEN + 1]; /* private temp directory */ long totalterms; /* total inverted index terms */ BOOL trun_syms; /* truncate symbols to 8 characters */ ! char tempstring[TEMPSTRING_LEN + 1]; /* use this as a buffer, instead of 'yytext', * which had better be left alone */ char *tmpdir; /* temporary directory */ *************** *** 270,273 **** --- 270,278 ---- case 'f': /* alternate cross-reference file */ reffile = s; + if (strlen(reffile) > sizeof(path) - 1) { + postfatal("\ + cscope: reffile too long, cannot be > %d characters\n", sizeof(path) - 1); + /* NOTREACHED */ + } strcpy(path, s); #ifdef SHORT_NAMES_ONLY *************** *** 503,511 **** /* read any -p option from it */ ! while (fscanf(names, "%s", path) == 1 && *path == '-') { i = path[1]; s = path + 2; /* for "-Ipath" */ if (*s == '\0') { /* if "-I path" */ ! fscanf(names, "%s", path); s = path; } --- 508,516 ---- /* read any -p option from it */ ! while (fgets(path, sizeof(path), names) != NULL && *path == '-') { i = path[1]; s = path + 2; /* for "-Ipath" */ if (*s == '\0') { /* if "-I path" */ ! fgets(path, sizeof(path), names); s = path; } *************** *** 523,527 **** } else { for (i = 0; i < nsrcfiles; ++i) { ! if (fscanf(oldrefs, "%s", path) != 1) { postfatal("\ cscope: cannot read source file name from file %s\n", --- 528,532 ---- } else { for (i = 0; i < nsrcfiles; ++i) { ! if (!fgets(path, sizeof(path), oldrefs) ) { postfatal("\ cscope: cannot read source file name from file %s\n", Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** constants.h 23 Jul 2006 20:59:20 -0000 1.14 --- constants.h 20 Aug 2006 15:00:34 -0000 1.15 *************** *** 69,72 **** --- 69,73 ---- #define PATHLEN 250 /* file pathname length */ #define PATLEN 250 /* symbol pattern length */ + #define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */ #define REFFILE "cscope.out" /* cross-reference output file */ #define NAMEFILE "cscope.files" /* default list-of-files file */ *************** *** 78,81 **** --- 79,89 ---- #define STMTMAX 10000 /* maximum source statement length */ + #define STR2(x) #x + #define STRINGIZE(x) STR2(x) + #define PATLEN_STR STRINGIZE(PATLEN) + #define PATHLEN_STR STRINGIZE(PATHLEN) + #define NUMLEN_STR STRINGIZE(NUMLEN) + #define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN) + /* screen lines */ #define FLDLINE (LINES - FIELDS - 1) /* first input field line */ |
From: Hans-Bernhard B. <br...@us...> - 2006-08-20 15:00:38
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19657 Modified Files: ChangeLog Log Message: Avoid some possible buffer overflows by limiting the size of scanf(%s). Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -r1.158 -r1.159 *** ChangeLog 23 Jul 2006 20:59:20 -0000 1.158 --- ChangeLog 20 Aug 2006 15:00:32 -0000 1.159 *************** *** 1,2 **** --- 1,35 ---- + 2006-08-20 Hans-Bernhard Broeker <br...@ph...> + + * src/main.c (tempstring): Parametrize length by new macro + TEMPSTRING_LEN. + (main): Check against too long -f file name. + (main): Put explicit %s field widths into fscanf() call. + (main): Replace some fscanf() calls by fgets(). + + * src/input.c (shellpath): Limit size of strings copied from + environment. + + * src/edit.c (editref, editall): Put explicit %s field widths into + fscanf() calls. + + * src/display.c (display): Put explicit %s field widths into + fscanf() call. + + * src/dir.c (makefilelist): Put explicit %s field width into + sscanf() call. + + * src/constants.h (TEMPSTRING_LEN): New macro, needed to + parametrize a fscanf() call. + (STRINGIZE): New macro used to build the following. + (PATLEN_STR, PATHLEN_STR, NUMLEN_STR, TEMPSTRING_LEN_STR): Buffer + lengths (minus 1) expressed as a string literal, to be used in as + field widths in {f,s}scanf() calls. + + * src/command.c (changestring): Put explicit %s field widths into + fscanf() call. + + * src/build.c (samelist, build): fgets() replaces fscanf(). + (build): Put explicit %s field widths into fscanf() call. + 2006-07-23 Hans-Bernhard Broeker <br...@ph...> |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 21:06:36
|
Update of /cvsroot/cscope/cscope/doc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32375/doc Added Files: .cvsignore Log Message: Added some .cvsignore files for cleaner behaviour --- NEW FILE --- Makefile .cvsignore |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 21:06:36
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32375/src Added Files: .cvsignore Log Message: Added some .cvsignore files for cleaner behaviour --- NEW FILE --- Makefile .deps cscope.out egrep.c fscanner.c gscope.c .cvsignore |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 21:06:35
|
Update of /cvsroot/cscope/cscope/contrib In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32375/contrib Added Files: .cvsignore Log Message: Added some .cvsignore files for cleaner behaviour --- NEW FILE --- Makefile .cvsignore |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 21:06:35
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32375 Added Files: .cvsignore Log Message: Added some .cvsignore files for cleaner behaviour --- NEW FILE --- Makefile autom4te.cache config.h config.log config.status stamp-h1 .cvsignore |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 20:59:25
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29812/src Modified Files: alloc.c build.c command.c constants.h crossref.c dir.c display.c find.c fscanner.l global.h history.c library.h main.c vpinit.c Added Files: alloc.h Log Message: Break out a new header: alloc.h Avoid buffer overflow by telling putstring about size of output buffer Rename stralloc -> my_strdup Rename putstring -> fetch_string_from_dbase Rename putinclude -> fetch_include_from_dbase --- NEW FILE --- /*=========================================================================== Copyright (c) 1998-2000, The Santa Cruz Operation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. *Neither name of The Santa Cruz Operation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =========================================================================*/ /* $Id: alloc.h,v 1.1 2006/07/23 20:59:20 broeker Exp $ */ #ifndef CSCOPE_ALLOC_H #define CSCOPE_ALLOC_H #include <string.h> /* need size_t ... */ /* memory allocation support */ void *mycalloc(size_t nelem, size_t size); void *mymalloc(size_t size); void *myrealloc(void *p, size_t size); char *my_strdup(char *s); #endif /* CSCOPE_ALLOC_H */ Index: alloc.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/alloc.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** alloc.c 21 Apr 2006 10:45:48 -0000 1.7 --- alloc.c 23 Jul 2006 20:59:20 -0000 1.8 *************** *** 35,40 **** #include <stdio.h> #include <string.h> ! #include "library.h" ! #include "global.h" static char const rcsid[] = "$Id$"; --- 35,41 ---- #include <stdio.h> #include <string.h> ! #include "alloc.h" ! ! #include "global.h" /* for postfatal() */ static char const rcsid[] = "$Id$"; *************** *** 53,59 **** char * ! stralloc(char *s) { ! return(strcpy(mymalloc((int) strlen(s) + 1), s)); } --- 54,60 ---- char * ! my_strdup(char *s) { ! return(strcpy(mymalloc(strlen(s) + 1), s)); } Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** build.c 21 Apr 2006 10:45:48 -0000 1.10 --- build.c 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 42,45 **** --- 42,46 ---- #include "library.h" + #include "alloc.h" #include "scanner.h" #include "version.h" /* for FILEVERSION */ *************** *** 88,92 **** static void movefile(char *new, char *old); static void putheader(char *dir); ! static void putinclude(char *s); static void putlist(char **names, int count); static BOOL samelist(FILE *oldrefs, char **names, int count); --- 89,93 ---- static void movefile(char *new, char *old); static void putheader(char *dir); ! static void fetch_include_from_dbase(char *, size_t); static void putlist(char **names, int count); static BOOL samelist(FILE *oldrefs, char **names, int count); *************** *** 147,155 **** ++s; strcpy(s, mybasename(reffile)); ! newreffile = stralloc(path); strcpy(s, mybasename(invname)); ! newinvname = stralloc(path); strcpy(s, mybasename(invpost)); ! newinvpost = stralloc(path); free(path); } --- 148,156 ---- ++s; strcpy(s, mybasename(reffile)); ! newreffile = my_strdup(path); strcpy(s, mybasename(invname)); ! newinvname = my_strdup(path); strcpy(s, mybasename(invpost)); ! newinvpost = my_strdup(path); free(path); } *************** *** 523,527 **** if (*blockp == NEWFILE) { skiprefchar(); ! putstring(file); if (file[0] != '\0') { /* if not end-of-crossref */ return(file); --- 524,528 ---- if (*blockp == NEWFILE) { skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (file[0] != '\0') { /* if not end-of-crossref */ return(file); *************** *** 626,630 **** if (*cp == INCLUDE) { blockp = cp; ! putinclude(symbol); writestring(symbol); setmark('\t'); --- 627,631 ---- if (*cp == INCLUDE) { blockp = cp; ! fetch_include_from_dbase(symbol, sizeof(symbol)); writestring(symbol); setmark('\t'); *************** *** 678,687 **** return; case INCLUDE: /* #included file */ ! putinclude(symbol); goto output; } dbputc(type); skiprefchar(); ! putstring(symbol); goto output; } --- 679,688 ---- return; case INCLUDE: /* #included file */ ! fetch_include_from_dbase(symbol, sizeof(symbol)); goto output; } dbputc(type); skiprefchar(); ! fetch_string_from_dbase(symbol, sizeof(symbol)); goto output; } *************** *** 693,697 **** if (isalpha((unsigned char)c) || c == '_') { blockp = cp; ! putstring(symbol); type = ' '; output: --- 694,698 ---- if (isalpha((unsigned char)c) || c == '_') { blockp = cp; ! fetch_string_from_dbase(symbol, sizeof(symbol)); type = ' '; output: *************** *** 724,732 **** /* process the #included file in the old database */ static void ! putinclude(char *s) { dbputc(INCLUDE); skiprefchar(); ! putstring(s); incfile(s + 1, s); } --- 725,733 ---- /* process the #included file in the old database */ static void ! fetch_include_from_dbase(char *s, size_t length) { dbputc(INCLUDE); skiprefchar(); ! fetch_string_from_dbase(s, length); incfile(s + 1, s); } Index: command.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/command.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** command.c 21 Apr 2006 10:45:48 -0000 1.30 --- command.c 23 Jul 2006 20:59:20 -0000 1.31 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" #include "build.h" /* for rebuild() */ + #include "alloc.h" + #include <stdlib.h> #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) Index: constants.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/constants.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** constants.h 30 Apr 2004 15:28:25 -0000 1.13 --- constants.h 23 Jul 2006 20:59:20 -0000 1.14 *************** *** 65,69 **** #define DEL '\177' /* delete character */ #define DUMMYCHAR ' ' /* use space as a dummy character */ ! #define MSGLEN PATLEN + 80 /* displayed message length */ #define NUMLEN 5 /* line number length */ #define PATHLEN 250 /* file pathname length */ --- 65,69 ---- #define DEL '\177' /* delete character */ #define DUMMYCHAR ' ' /* use space as a dummy character */ ! #define MSGLEN ((PATLEN) + 80) /* displayed message length */ #define NUMLEN 5 /* line number length */ #define PATHLEN 250 /* file pathname length */ Index: crossref.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/crossref.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -r1.13 -r1.14 *** crossref.c 21 Apr 2006 10:45:48 -0000 1.13 --- crossref.c 23 Jul 2006 20:59:20 -0000 1.14 *************** *** 41,44 **** --- 41,45 ---- #include "build.h" #include "scanner.h" + #include "alloc.h" #include <stdlib.h> Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** dir.c 21 Apr 2006 10:45:48 -0000 1.26 --- dir.c 23 Jul 2006 20:59:20 -0000 1.27 *************** *** 37,46 **** */ #include <stdlib.h> #include <sys/types.h> /* needed by stat.h and dirent.h */ #include <dirent.h> #include <sys/stat.h> /* stat */ - #include "global.h" - #include "vp.h" /* vpdirs and vpndirs */ static char const rcsid[] = "$Id$"; --- 37,48 ---- */ + #include "global.h" + #include "alloc.h" + #include "vp.h" /* vpdirs and vpndirs */ + #include <stdlib.h> #include <sys/types.h> /* needed by stat.h and dirent.h */ #include <dirent.h> #include <sys/stat.h> /* stat */ static char const rcsid[] = "$Id$"; *************** *** 123,127 **** makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ /* parse the directory list */ --- 125,129 ---- makevpsrcdirs(); /* make the view source directory list */ ! dirlist = my_strdup(dirlist); /* don't change environment variable text */ /* parse the directory list */ *************** *** 165,169 **** srcdirs = myrealloc(srcdirs, msrcdirs * sizeof(char *)); } ! srcdirs[nsrcdirs++] = stralloc(dir); } } --- 167,171 ---- srcdirs = myrealloc(srcdirs, msrcdirs * sizeof(char *)); } ! srcdirs[nsrcdirs++] = my_strdup(dir); } } *************** *** 191,195 **** makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ /* parse the directory list */ --- 193,197 ---- makevpsrcdirs(); /* make the view source directory list */ ! dirlist = my_strdup(dirlist); /* don't change environment variable text */ /* parse the directory list */ *************** *** 237,242 **** mincdirs * sizeof(char *)); } ! incdirs[nincdirs] = stralloc(path); ! incnames[nincdirs++] = stralloc(name); } } --- 239,244 ---- mincdirs * sizeof(char *)); } ! incdirs[nincdirs] = my_strdup(path); ! incnames[nincdirs++] = my_strdup(name); } } *************** *** 683,689 **** } /* add the file to the list */ ! srcfiles[nsrcfiles++] = stralloc(compath(path)); p = mymalloc(sizeof(struct listitem)); ! p->text = stralloc(compath(path)); i = hash(p->text) % HASHMOD; p->next = srcnames[i]; --- 685,691 ---- } /* add the file to the list */ ! srcfiles[nsrcfiles++] = my_strdup(compath(path)); p = mymalloc(sizeof(struct listitem)); ! p->text = my_strdup(compath(path)); i = hash(p->text) % HASHMOD; p->next = srcnames[i]; Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -r1.27 -r1.28 *** display.c 21 Apr 2006 10:45:48 -0000 1.27 --- display.c 23 Jul 2006 20:59:20 -0000 1.28 *************** *** 38,41 **** --- 38,42 ---- #include "global.h" #include "build.h" + #include "alloc.h" #ifdef CCS *************** *** 44,47 **** --- 45,49 ---- #include "version.h" /* FILEVERSION and FIXVERSION */ #endif + #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) #include <ncurses.h> Index: find.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/find.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -r1.18 -r1.19 *** find.c 21 Apr 2006 10:45:48 -0000 1.18 --- find.c 23 Jul 2006 20:59:20 -0000 1.19 *************** *** 40,43 **** --- 40,45 ---- #include "build.h" #include "scanner.h" /* for token definitions */ + + #include <assert.h> #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) #include <ncurses.h> *************** *** 93,96 **** --- 95,99 ---- char *cp; char *s; + size_t s_len = 0; char firstchar; /* first character of a potential symbol */ BOOL fcndef = NO; *************** *** 110,118 **** } ! (void) scanpast('\t'); /* find the end of the header */ ! skiprefchar(); /* skip the file marker */ ! putstring(file); /* save the file name */ ! (void) strcpy(function, global);/* set the dummy global function name */ ! (void) strcpy(macro, global);/* set the dummy global macro name */ /* find the next symbol */ --- 113,121 ---- } ! (void) scanpast('\t'); /* find the end of the header */ ! skiprefchar(); /* skip the file marker */ ! fetch_string_from_dbase(file, sizeof(file)); ! strcpy(function, global); /* set the dummy global function name */ ! strcpy(macro, global); /* set the dummy global macro name */ /* find the next symbol */ *************** *** 144,148 **** /* save the name */ skiprefchar(); ! putstring(file); /* check for the end of the symbols */ --- 147,151 ---- /* save the name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); /* check for the end of the symbols */ *************** *** 159,163 **** case FCNDEF: /* function name */ fcndef = YES; ! s = function; break; --- 162,167 ---- case FCNDEF: /* function name */ fcndef = YES; ! s = function; ! s_len = sizeof(function); break; *************** *** 165,171 **** if (fileversion >= 10) { s = macro; ! } ! else { s = symbol; } break; --- 169,176 ---- if (fileversion >= 10) { s = macro; ! s_len = sizeof(macro); ! } else { s = symbol; + s_len = sizeof(symbol); } break; *************** *** 183,187 **** /* save the name */ skiprefchar(); ! putstring(s); /* see if this is a regular expression pattern */ --- 188,192 ---- /* save the name */ skiprefchar(); ! fetch_string_from_dbase(s, s_len); /* see if this is a regular expression pattern */ *************** *** 221,225 **** if (isalpha((unsigned char)firstchar) || firstchar == '_') { blockp = cp; ! putstring(symbol); if (caseless == YES) { s = lcasify(symbol); /* point to lower case version */ --- 226,230 ---- if (isalpha((unsigned char)firstchar) || firstchar == '_') { blockp = cp; ! fetch_string_from_dbase(symbol, sizeof(symbol)); if (caseless == YES) { s = lcasify(symbol); /* point to lower case version */ *************** *** 302,306 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 307,311 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 346,350 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 351,355 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 360,364 **** case CLASSDEF: skiprefchar(); /* save function name */ ! putstring(function); /* output the file, function and source line */ --- 365,369 ---- case CLASSDEF: skiprefchar(); /* save function name */ ! fetch_string_from_dbase(function, sizeof(function)); /* output the file, function and source line */ *************** *** 403,407 **** case NEWFILE: /* save file name */ skiprefchar(); ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 408,412 ---- case NEWFILE: /* save file name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 414,418 **** if (fileversion >= 10) { skiprefchar(); ! putstring(macro); } break; --- 419,423 ---- if (fileversion >= 10) { skiprefchar(); ! fetch_string_from_dbase(macro, sizeof(macro)); } break; *************** *** 424,428 **** case FCNDEF: /* save calling function name */ skiprefchar(); ! putstring(function); for (i = 0; i < morefuns; i++) if ( !strcmp(tmpfunc[i], function) ) --- 429,433 ---- case FCNDEF: /* save calling function name */ skiprefchar(); ! fetch_string_from_dbase(function, sizeof(function)); for (i = 0; i < morefuns; i++) if ( !strcmp(tmpfunc[i], function) ) *************** *** 560,564 **** case NEWFILE: /* save file name */ skiprefchar(); ! putstring(file); if (*file == '\0') { /* if end of symbols */ return NULL; --- 565,569 ---- case NEWFILE: /* save file name */ skiprefchar(); ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return NULL; *************** *** 711,715 **** /* see if this is a regular expression pattern */ if (isregexp_valid == YES) { ! putstring(string); if (*string == '\0') { return(NO); --- 716,720 ---- /* see if this is a regular expression pattern */ if (isregexp_valid == YES) { ! fetch_string_from_dbase(string, sizeof(string)); if (*string == '\0') { return(NO); *************** *** 858,889 **** } - /* put the rest of the cross-reference line into the string */ void ! putstring(char *s) { char *cp; ! unsigned c; ! setmark('\n'); cp = blockp; do { ! while ((c = (unsigned)(*cp)) != '\n') { ! if (c > '\177') { ! c &= 0177; *s++ = dichar1[c / 8]; *s++ = dichar2[c & 7]; ! } ! else { *s++ = c; } ++cp; } ! } while (*(cp + 1) == '\0' && (cp = read_block()) != NULL); blockp = cp; *s = '\0'; } - /* scan past the next occurence of this character in the cross-reference */ char * scanpast(char c) --- 863,898 ---- } + /* put the rest of the cross-reference line into the string */ void ! fetch_string_from_dbase(char *s, size_t length) { char *cp; ! unsigned int c; ! ! assert(length > sizeof (char *)); ! setmark('\n'); cp = blockp; do { ! while (length > 1 && (c = (unsigned int)(*cp)) != '\n') { ! if (c >= 0x80 && length > 2) { ! c &= 0x7f; *s++ = dichar1[c / 8]; *s++ = dichar2[c & 7]; ! length -= 2; ! } else { *s++ = c; + length--; } ++cp; } ! } while (length > 0 && cp[1] == '\0' && (cp = read_block()) != NULL); blockp = cp; *s = '\0'; } + + /* scan past the next occurence of this character in the cross-reference */ char * scanpast(char c) *************** *** 980,984 **** case NEWFILE: skiprefchar(); /* save file name */ ! putstring(file); if (*file == '\0') { /* if end of symbols */ return(&found_caller); --- 989,993 ---- case NEWFILE: skiprefchar(); /* save file name */ ! fetch_string_from_dbase(file, sizeof(file)); if (*file == '\0') { /* if end of symbols */ return(&found_caller); *************** *** 1115,1119 **** if (dbseek(p->lineoffset) != -1) { scanpast(FCNDEF); ! putstring(function); } } --- 1124,1129 ---- if (dbseek(p->lineoffset) != -1) { scanpast(FCNDEF); ! fetch_string_from_dbase(function, ! sizeof(function)); } } *************** *** 1124,1128 **** else if (p->fcnoffset != lastfcnoffset) { if (dbseek(p->fcnoffset) != -1) { ! putstring(function); lastfcnoffset = p->fcnoffset; } --- 1134,1138 ---- else if (p->fcnoffset != lastfcnoffset) { if (dbseek(p->fcnoffset) != -1) { ! fetch_string_from_dbase(function, sizeof(function)); lastfcnoffset = p->fcnoffset; } Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** fscanner.l 6 May 2006 13:07:39 -0000 1.10 --- fscanner.l 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 37,40 **** --- 37,41 ---- */ #include "global.h" + #include "alloc.h" #include "scanner.h" #include "lookup.h" Index: global.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/global.h,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -r1.34 -r1.35 *** global.h 21 Apr 2006 10:45:48 -0000 1.34 --- global.h 23 Jul 2006 20:59:20 -0000 1.35 *************** *** 381,385 **** void postfatal(const char *msg,...); void putposting(char *term, int type); ! void putstring(char *s); void resetcmd(void); void seekline(unsigned int line); --- 381,385 ---- void postfatal(const char *msg,...); void putposting(char *term, int type); ! void fetch_string_from_dbase(char *, size_t); void resetcmd(void); void seekline(unsigned int line); Index: history.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/history.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** history.c 3 May 2000 22:02:10 -0000 1.2 --- history.c 23 Jul 2006 20:59:20 -0000 1.3 *************** *** 38,41 **** --- 38,43 ---- #include "global.h" + #include "alloc.h" + static char const rcsid[] = "$Id$"; *************** *** 59,63 **** } h->field = f; ! h->text = stralloc( s); current = 0; } --- 61,65 ---- } h->field = f; ! h->text = my_strdup( s); current = 0; } Index: library.h =================================================================== RCS file: /cvsroot/cscope/cscope/src/library.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** library.h 21 Apr 2006 10:45:48 -0000 1.10 --- library.h 23 Jul 2006 20:59:20 -0000 1.11 *************** *** 43,53 **** char *logdir(char *name); char *mybasename(char *path); - void *mycalloc(size_t nelem, size_t size); FILE *myfopen(char *path, char *mode); char *mygetenv(char *variable, char *deflt); - void *mymalloc(size_t size); int myopen(char *path, int flag, int mode); - void *myrealloc(void *p, size_t size); - char *stralloc(char *s); FILE *mypopen(char *cmd, char *mode); int mypclose(FILE *ptr); --- 43,49 ---- *************** *** 55,64 **** void egrepcaseless(int i); - /* Programmer's Workbench library (-lPW) */ - /* FIXME HBB 20010705: these should never be here. We should just - * #include the relevant header, instead. Moreover, they don't seem - * to be used, anyway ... */ - #if 0 - char *regcmp(), *regex(); - #endif #endif /* CSCOPE_LIBRARY_H */ --- 51,53 ---- Index: main.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/main.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** main.c 21 Apr 2006 10:45:48 -0000 1.39 --- main.c 23 Jul 2006 20:59:20 -0000 1.40 *************** *** 43,46 **** --- 43,48 ---- #include "version.h" /* FILEVERSION and FIXVERSION */ #include "scanner.h" + #include "alloc.h" + #include <stdlib.h> /* atoi */ #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) *************** *** 278,284 **** s = path + strlen(path); strcpy(s, ".in"); ! invname = stralloc(path); strcpy(s, ".po"); ! invpost = stralloc(path); break; case 'F': /* symbol reference lines file */ --- 280,286 ---- s = path + strlen(path); strcpy(s, ".in"); ! invname = my_strdup(path); strcpy(s, ".po"); ! invpost = my_strdup(path); break; case 'F': /* symbol reference lines file */ *************** *** 385,393 **** sprintf(path, "%s/%s", home, reffile); if (isuptodate == NO || access(path, READ) == 0) { ! reffile = stralloc(path); sprintf(path, "%s/%s", home, invname); ! invname = stralloc(path); sprintf(path, "%s/%s", home, invpost); ! invpost = stralloc(path); } } --- 387,395 ---- sprintf(path, "%s/%s", home, reffile); if (isuptodate == NO || access(path, READ) == 0) { ! reffile = my_strdup(path); sprintf(path, "%s/%s", home, invname); ! invname = my_strdup(path); sprintf(path, "%s/%s", home, invpost); ! invpost = my_strdup(path); } } *************** *** 527,531 **** /* NOTREACHED */ } ! srcfiles[i] = stralloc(path); } } --- 529,533 ---- /* NOTREACHED */ } ! srcfiles[i] = my_strdup(path); } } Index: vpinit.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/vpinit.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** vpinit.c 21 Feb 2006 19:54:57 -0000 1.7 --- vpinit.c 23 Jul 2006 20:59:20 -0000 1.8 *************** *** 38,41 **** --- 38,42 ---- #include <unistd.h> #include "vp.h" + #include "alloc.h" #include "library.h" #include "global.h" *************** *** 108,112 **** /* don't change VPATH in the environment */ ! vpath = stralloc(vpath); /* split the view path into nodes */ --- 109,113 ---- /* don't change VPATH in the environment */ ! vpath = my_strdup(vpath); /* split the view path into nodes */ |
From: Hans-Bernhard B. <br...@us...> - 2006-07-23 20:59:25
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29812 Modified Files: ChangeLog Log Message: Break out a new header: alloc.h Avoid buffer overflow by telling putstring about size of output buffer Rename stralloc -> my_strdup Rename putstring -> fetch_string_from_dbase Rename putinclude -> fetch_include_from_dbase Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -r1.157 -r1.158 *** ChangeLog 6 May 2006 13:07:38 -0000 1.157 --- ChangeLog 23 Jul 2006 20:59:20 -0000 1.158 *************** *** 1,2 **** --- 1,59 ---- + 2006-07-23 Hans-Bernhard Broeker <br...@ph...> + + * src/global.h: Rename putstring() to fetch_string_from_dbase(), + add a parameter. + + * src/find.c: Add #include <assert.h> + (fetch_string_from_dbase): Renamed from misleading name + putstring(). Add new parameter, and use it to avoid overflowing + the output buffer. + (findsymbol): New local: s_len. Rename calls to putstring(). Add + new argument, some of them from s_len. + (finddef, findallfcns, findcalling, findinclude, match, + findcalledby, putpostingref): Rename calls to putstring(). Add new + argument. + + * src/constants.h (MSGLEN): Add safety parentheses. + + * src/library.h: Remove prototypes of alloc.c functions. + + * src/alloc.h: New file. Moved prototypes of alloc.c functions in + here, out of library.h. + + * src/alloc.c: Include new header file from here. + (my_strdup): Changed name from misleading stralloc(). Remove + incorrect cast. + + * src/build.c: Add #include "alloc.h". + (fetch_include_from_dbase): Renamed from misleading name + putinclude(). Add length of target string as an argument. + (setup_build_filenames): Rename calls of stralloc(). + (getoldfile, copyinverted): Rename calls of putstring(). Add new + argument. + (copydata, coypinverted): Rename calls of putinclude(). Add new + argument. + + * src/vpinit.c: Add #include "alloc.h" + (vpinit): Rename calls of stralloc(). + + * src/main.c: Add #include "alloc.h". + (main): Rename calls of stralloc(). + + * src/history.c: Add #include "alloc.h". + (addcmd): Rename call of stralloc(). + + * src/fscanner.l: Add #include "alloc.h". + + * src/display.c: Add #include "alloc.h". + + * src/dir.c: Add #include "alloc.h". Move project includes above + system headers. + (sourcedir, addsrcdir, includedir, addincdir, addsrcfile): Rename + calls to stralloc(). + + * src/crossref.c: Add #include "alloc.h" + + * src/command.c: Add #include "alloc.h". + 2006-05-06 Hans-Bernhard Broeker <br...@ph...> |
From: Hans-Bernhard B. <br...@us...> - 2006-05-06 13:07:45
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1291/src Modified Files: fscanner.l Log Message: Fixed parsing of numeric literals in function calls/definitions. Index: fscanner.l =================================================================== RCS file: /cvsroot/cscope/cscope/src/fscanner.l,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** fscanner.l 20 Jun 2002 16:25:33 -0000 1.9 --- fscanner.l 6 May 2006 13:07:39 -0000 1.10 *************** *** 522,526 **** <WAS_IDENTIFIER>{ ! {ws}*\(({wsnl}|{identifier}|[*&[\]=,.])*\)([()]|{wsnl})*[:a-zA-Z_#{] { /* a function definition */ /* note: "#define a (b) {" and "#if defined(a)\n#" --- 522,526 ---- <WAS_IDENTIFIER>{ ! {ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.])*\)([()]|{wsnl})*[:a-zA-Z_#{] { /* a function definition */ /* note: "#define a (b) {" and "#if defined(a)\n#" *************** *** 544,548 **** /* NOTREACHED */ } ! {ws}*\(([*&[\]=,.]|{identifier}|{wsnl})* { /* function call */ fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) { token = FCNCALL; --- 544,548 ---- /* NOTREACHED */ } ! {ws}*\(([*&[\]=,.]|{identifier}|{number}|{wsnl})* { /* function call */ fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) { token = FCNCALL; |
From: Hans-Bernhard B. <br...@us...> - 2006-05-06 13:07:42
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1291 Modified Files: ChangeLog Log Message: Fixed parsing of numeric literals in function calls/definitions. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -r1.156 -r1.157 *** ChangeLog 21 Apr 2006 10:47:59 -0000 1.156 --- ChangeLog 6 May 2006 13:07:38 -0000 1.157 *************** *** 1,2 **** --- 1,7 ---- + 2006-05-06 Hans-Bernhard Broeker <br...@ph...> + + * src/fscanner.l: Accept numeric literals inside fcn definitions + and calls. + 2006-04-21 Hans-Bernhard Broeker <br...@ph...> |
From: Hans-Bernhard B. <br...@us...> - 2006-04-21 10:48:05
|
Update of /cvsroot/cscope/cscope In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25965 Modified Files: ChangeLog Log Message: Updated after lots of changes. Index: ChangeLog =================================================================== RCS file: /cvsroot/cscope/cscope/ChangeLog,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -r1.155 -r1.156 *** ChangeLog 19 Apr 2006 14:30:16 -0000 1.155 --- ChangeLog 21 Apr 2006 10:47:59 -0000 1.156 *************** *** 1,4 **** --- 1,84 ---- + 2006-04-21 Hans-Bernhard Broeker <br...@ph...> + + Make source clean under -Wsign-compare. + + * src/main.c (fileargc): Make counter unsigned. + (main): Make local counter unsigned. + (main): Fixed two sprintf() excess arguments. + + * src/lookup.c (initsymtab): Make local counters unsigned. + + * src/invlib.c (LINEMAX): Removed. + (invmake): Change length of local variable "line" to TERMMAX. + (numpost, numlogblk, amtused, nextpost, lastinblk, numinvitems): + Make counters unsigned. + (invnewterm): Make local counters unsigned. + + * src/input.c (mygetline): Make local counters unsigned. + + * src/find.c (findregexp, findfile): Make local counters unsigned. + + * src/egrep.y (line, left, right, parent): Make unsigned. + (enter, cclenter): Return unsigned. + (follow): Make argument unsigned. + (cclenter, cfoll, cgotofn, member, add, follow): Make local + counters unsigned. + (cgotofn, member): Cast char to unsigned char, not unsigned int, + for use as an index. + + * src/display.c (disprefs, mdisprefs, nextline, topline, + totallines): Make unsigned. + (search): Removed unused locals. + (seekline): Make argument unsigned. + + * src/dir.c (nincdirs, nsrcdirs, nsrcfiles, msrcfiles, mincdirs, + msrcdirs, nvpsrcdirs): Make unsigned long. + (sourcedir, includedir, makefilelist, incfile, inviewpath): Make + local counters unsigned. + + * src/crossref.c (symbols, msymbols): Make unsigned long. + (struct symbol): Make elements first, last, length and fcn_level + unsigned. + (crossref, putcrossref): Make local counters unsigned. + + * src/command.c (curdispline): Make unsigned. + (mark): Make argument and local counter unsigned. + (command): Make KEY_LL conditional on KEY_LL, not KEY_HOME. + (changestring): Made local counter unsigned. + + * src/build.c (build): Change several local ints to unsigned + longs. + + * src/global.h: Updated lots of declarations to match the above. + + * src/alloc.c (mymalloc, mycalloc, myrealloc): Make size arguments + size_t. Remove pointless casts in several of their callers. + + * src/library.h (mymalloc, mycalloc, myrealloc): Updated + prototoypes. + + 2006-04-20 Hans-Bernhard Broeker <br...@ph...> + + * src/input.c (askforreturn): If curses is handling the display, + redraw the screen before returning, to keep error messages from + permanently scrambling the display. + + * configure.in: Add test for <io.h>. + + * configure, config.h.in: Regenerated. + + * src/mypopen.c [HAVE_IO_H]: #include <io.h> it, for the setmode() + declaration. + 2006-04-19 Hans-Bernhard Broeker <br...@ph...> + General change: indentation width of touched areas changed to 4 + spaces, open braces not on lines of their own, single-line "else + if", get rid of (void) casts of unused function return values. + + * src/global.h (select_large): Removed declaration. + + * src/main.c (select_large, main): Removed long unused global. + * src/dir.c (scan_dir): Get rid of d_ino check --- this field is not reliably present in struct dirent, and doesn't achieve enough |
From: Hans-Bernhard B. <br...@us...> - 2006-04-21 10:45:51
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24733 Modified Files: alloc.c build.c command.c crossref.c dir.c display.c egrep.y exec.c find.c global.h library.h lookup.c main.c Log Message: Overall signed/unsigned cleanup. Re-formatting to 4-space indentation and no dangling open braces. Index: alloc.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/alloc.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** alloc.c 8 Jan 2004 14:07:20 -0000 1.6 --- alloc.c 21 Apr 2006 10:45:48 -0000 1.7 *************** *** 45,52 **** * succeed more reliably than the defined(__STDC__) one I replaced */ #if STDC_HEADERS ! #include <stdlib.h> ! # else char *calloc(), *malloc(), *realloc(), *strcpy(); ! # endif /* allocate a string */ --- 45,52 ---- * succeed more reliably than the defined(__STDC__) one I replaced */ #if STDC_HEADERS ! # include <stdlib.h> ! #else char *calloc(), *malloc(), *realloc(), *strcpy(); ! #endif /* allocate a string */ *************** *** 58,94 **** } - /* version of malloc that only returns if successful */ void * ! mymalloc(int size) { ! return(alloctest(malloc((unsigned) size))); } - /* version of calloc that only returns if successful */ void * ! mycalloc(int nelem, int size) { ! return(alloctest(calloc((unsigned) nelem, (unsigned) size))); } - /* version of realloc that only returns if successful */ void * ! myrealloc(void *p, int size) { ! return(alloctest(realloc(p, (unsigned) size))); } - /* check for memory allocation failure */ static void * alloctest(void *p) { ! if (p == NULL) { ! postfatal("\n%s: out of storage\n", argv0); ! /* NOTREACHED */ ! } ! return(p); } --- 58,94 ---- } + /* version of malloc that only returns if successful */ void * ! mymalloc(size_t size) { ! return(alloctest(malloc((unsigned) size))); } + /* version of calloc that only returns if successful */ void * ! mycalloc(size_t nelem, size_t size) { ! return(alloctest(calloc((unsigned) nelem, (unsigned) size))); } + /* version of realloc that only returns if successful */ void * ! myrealloc(void *p, size_t size) { ! return(alloctest(realloc(p, (unsigned) size))); } + /* check for memory allocation failure */ static void * alloctest(void *p) { ! if (p == NULL) { ! postfatal("\n%s: out of storage\n", argv0); ! /* NOTREACHED */ ! } ! return(p); } Index: build.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/build.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** build.c 8 Jul 2005 11:16:29 -0000 1.9 --- build.c 21 Apr 2006 10:45:48 -0000 1.10 *************** *** 73,84 **** INVCONTROL invcontrol; /* inverted file control structure */ - /* Local variables: */ static char *newinvname; /* new inverted index file name */ static char *newinvpost; /* new inverted index postings file name */ static long traileroffset; /* file trailer offset */ - /* Internal prototypes: */ [...1238 lines suppressed...] ! unlink(old); ! if (rename(new, old) == -1) { ! myperror("cscope"); ! postfatal("cscope: cannot rename file %s to file %s\n", ! new, old); ! /* NOTREACHED */ ! } } + /* process the #included file in the old database */ static void putinclude(char *s) { ! dbputc(INCLUDE); ! skiprefchar(); ! putstring(s); ! incfile(s + 1, s); } Index: command.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/command.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -r1.29 -r1.30 *** command.c 8 Jul 2005 11:00:20 -0000 1.29 --- command.c 21 Apr 2006 10:45:48 -0000 1.30 *************** *** 50,54 **** int selecting; ! int curdispline = 0; BOOL caseless; /* ignore letter case when searching */ --- 50,54 ---- int selecting; ! unsigned int curdispline = 0; [...1704 lines suppressed...] + + /* restrict the width of displayed columns */ + /* HBB FIXME 20060419: magic number alert! */ + i = (COLS - 5) / 3; + if (ogs == YES) { + i = (COLS - 7) / 5; + } + if (filelen > i && i > 4) { + filelen = i; + } + if (subsystemlen > i && i > 9) { + subsystemlen = i; + } + if (booklen > i && i > 4) { + booklen = i; + } + if (fcnlen > i && i > 8) { + fcnlen = i; + } } Index: crossref.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/crossref.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** crossref.c 29 Apr 2003 14:08:45 -0000 1.12 --- crossref.c 21 Apr 2006 10:45:48 -0000 1.13 *************** *** 69,84 **** int nsrcoffset; /* number of file name database offsets */ long *srcoffset; /* source file name database offsets */ ! int symbols; /* number of symbols */ static char *filename; /* file name for warning messages */ static long fcnoffset; /* function name database offset */ static long macrooffset; /* macro name database offset */ ! static int msymbols = SYMBOLINC; /* maximum number of symbols */ struct symbol { /* symbol data */ ! int type; /* type */ ! int first; /* index of first character in text */ ! int last; /* index of last+1 character in text */ ! int length; /* symbol length */ ! int fcn_level; /* function level of the symbol */ }; static struct symbol *symbol; --- 69,85 ---- int nsrcoffset; /* number of file name database offsets */ long *srcoffset; /* source file name database offsets */ ! unsigned long symbols; /* number of symbols */ static char *filename; /* file name for warning messages */ static long fcnoffset; /* function name database offset */ static long macrooffset; /* macro name database offset */ ! static unsigned long msymbols = SYMBOLINC; /* maximum number of symbols */ ! struct symbol { /* symbol data */ ! int type; /* type */ ! unsigned int first; /* index of first character in text */ ! unsigned int last; /* index of last+1 character in text */ ! unsigned int length; /* symbol length */ ! unsigned int fcn_level; /* function level of the symbol */ }; static struct symbol *symbol; *************** *** 90,191 **** crossref(char *srcfile) { ! int i; ! int length; /* symbol length */ ! int entry_no; /* function level of the symbol */ ! int token; /* current token */ ! struct stat st; ! ! if (! ((stat(srcfile, &st) == 0) ! && S_ISREG(st.st_mode))) { ! cannotopen(srcfile); ! errorsfound = YES; ! return; ! } ! entry_no = 0; ! /* open the source file */ ! if ((yyin = myfopen(srcfile, "r")) == NULL) { ! cannotopen(srcfile); ! errorsfound = YES; ! return; ! } ! filename = srcfile; /* save the file name for warning messages */ ! putfilename(srcfile); /* output the file name */ ! dbputc('\n'); ! dbputc('\n'); ! ! /* read the source file */ ! initscanner(srcfile); ! fcnoffset = macrooffset = 0; ! symbols = 0; ! if (symbol == NULL) { ! symbol = mymalloc(msymbols * sizeof(struct symbol)); ! } ! for (;;) { ! /* get the next token */ ! switch (token = yylex()) { ! default: ! /* if requested, truncate C symbols */ ! length = last - first; ! if (trun_syms == YES && length > 8 && ! token != INCLUDE && token != NEWFILE) { ! length = 8; ! last = first + 8; ! } ! /* see if the token has a symbol */ ! if (length == 0) { ! savesymbol(token, entry_no); ! break; ! } ! /* update entry_no if see function entry */ ! if (token == FCNDEF) { ! entry_no++; ! } ! /* see if the symbol is already in the list */ ! for (i = 0; i < symbols; ++i) { ! if (length == symbol[i].length ! && strncmp(my_yytext + first, ! my_yytext + symbol[i].first, ! length) == 0 ! && entry_no == symbol[i].fcn_level ! && token == symbol[i].type ! ) { /* could be a::a() */ ! break; ! } ! } ! if (i == symbols) { /* if not already in list */ ! savesymbol(token, entry_no); ! } ! break; ! case NEWLINE: /* end of line containing symbols */ ! entry_no = 0; /* reset entry_no for each line */ #ifdef USING_LEX ! --yyleng; /* remove the newline */ #endif ! putcrossref(); /* output the symbols and source line */ ! lineno = myylineno; /* save the symbol line number */ #ifndef USING_LEX ! /* HBB 20010425: replaced yyleng-- by this chunk: */ ! if (my_yytext) ! *my_yytext = '\0'; ! my_yyleng = 0; #endif ! break; ! case LEXEOF: /* end of file; last line may not have \n */ /* if there were symbols, output them and the source line */ ! if (symbols > 0) { ! putcrossref(); ! } ! (void) fclose(yyin); /* close the source file */ ! ! /* output the leading tab expected by the next call */ ! dbputc('\t'); ! return; ! } } } --- 91,192 ---- crossref(char *srcfile) { ! unsigned int i; ! unsigned int length; /* symbol length */ ! unsigned int entry_no; /* function level of the symbol */ ! int token; /* current token */ ! struct stat st; ! ! if (! ((stat(srcfile, &st) == 0) ! && S_ISREG(st.st_mode))) { ! cannotopen(srcfile); ! errorsfound = YES; ! return; ! } ! entry_no = 0; ! /* open the source file */ ! if ((yyin = myfopen(srcfile, "r")) == NULL) { ! cannotopen(srcfile); ! errorsfound = YES; ! return; ! } ! filename = srcfile; /* save the file name for warning messages */ ! putfilename(srcfile); /* output the file name */ ! dbputc('\n'); ! dbputc('\n'); ! ! /* read the source file */ ! initscanner(srcfile); ! fcnoffset = macrooffset = 0; ! symbols = 0; ! if (symbol == NULL) { ! symbol = mymalloc(msymbols * sizeof(struct symbol)); ! } ! for (;;) { ! /* get the next token */ ! switch (token = yylex()) { ! default: ! /* if requested, truncate C symbols */ ! length = last - first; ! if (trun_syms == YES && length > 8 && ! token != INCLUDE && token != NEWFILE) { ! length = 8; ! last = first + 8; ! } ! /* see if the token has a symbol */ ! if (length == 0) { ! savesymbol(token, entry_no); ! break; ! } ! /* update entry_no if see function entry */ ! if (token == FCNDEF) { ! entry_no++; ! } ! /* see if the symbol is already in the list */ ! for (i = 0; i < symbols; ++i) { ! if (length == symbol[i].length ! && strncmp(my_yytext + first, ! my_yytext + symbol[i].first, ! length) == 0 ! && entry_no == symbol[i].fcn_level ! && token == symbol[i].type ! ) { /* could be a::a() */ ! break; ! } ! } ! if (i == symbols) { /* if not already in list */ ! savesymbol(token, entry_no); ! } ! break; ! case NEWLINE: /* end of line containing symbols */ ! entry_no = 0; /* reset entry_no for each line */ #ifdef USING_LEX ! --yyleng; /* remove the newline */ #endif ! putcrossref(); /* output the symbols and source line */ ! lineno = myylineno; /* save the symbol line number */ #ifndef USING_LEX ! /* HBB 20010425: replaced yyleng-- by this chunk: */ ! if (my_yytext) ! *my_yytext = '\0'; ! my_yyleng = 0; #endif ! break; ! case LEXEOF: /* end of file; last line may not have \n */ /* if there were symbols, output them and the source line */ ! if (symbols > 0) { ! putcrossref(); ! } ! (void) fclose(yyin); /* close the source file */ ! ! /* output the leading tab expected by the next call */ ! dbputc('\t'); ! return; } + } } *************** *** 195,211 **** savesymbol(int token, int num) { ! /* make sure there is room for the symbol */ ! if (symbols == msymbols) { ! msymbols += SYMBOLINC; ! symbol = myrealloc(symbol, ! msymbols * sizeof(struct symbol)); ! } ! /* save the symbol */ ! symbol[symbols].type = token; ! symbol[symbols].first = first; ! symbol[symbols].last = last; ! symbol[symbols].length = last - first; ! symbol[symbols].fcn_level = num; ! ++symbols; } --- 196,211 ---- savesymbol(int token, int num) { ! /* make sure there is room for the symbol */ ! if (symbols == msymbols) { ! msymbols += SYMBOLINC; ! symbol = myrealloc(symbol, msymbols * sizeof(struct symbol)); ! } ! /* save the symbol */ ! symbol[symbols].type = token; ! symbol[symbols].first = first; ! symbol[symbols].last = last; ! symbol[symbols].length = last - first; ! symbol[symbols].fcn_level = num; ! ++symbols; } *************** *** 234,377 **** putcrossref(void) { ! int i, j; ! unsigned char c; ! BOOL blank; /* blank indicator */ ! int symput = 0; /* symbols output */ ! int type; ! ! /* output the source line */ ! lineoffset = dboffset; ! dboffset += fprintf(newrefs, "%d ", lineno); #ifdef PRINTF_RETVAL_BROKEN ! dboffset = ftell(newrefs); /* fprintf doesn't return chars written */ #endif ! /* HBB 20010425: added this line: */ ! my_yytext[my_yyleng] = '\0'; ! blank = NO; ! for (i = 0; i < my_yyleng; ++i) { ! /* change a tab to a blank and compress blanks */ ! if ((c = my_yytext[i]) == ' ' || c == '\t') { ! blank = YES; ! } ! /* look for the start of a symbol */ ! else if (symput < symbols && i == symbol[symput].first) { ! ! /* check for compressed blanks */ ! if (blank == YES) { ! blank = NO; ! dbputc(' '); ! } ! dbputc('\n'); /* symbols start on a new line */ ! /* output any symbol type */ ! if ((type = symbol[symput].type) != IDENT) { ! dbputc('\t'); ! dbputc(type); ! } ! else { ! type = ' '; ! } ! /* output the symbol */ ! j = symbol[symput].last; ! c = my_yytext[j]; ! my_yytext[j] = '\0'; ! if (invertedindex == YES) { ! putposting(my_yytext + i, type); ! } ! writestring(my_yytext + i); ! dbputc('\n'); ! my_yytext[j] = c; ! i = j - 1; ! ++symput; } ! else { ! /* HBB: try to save some time by early-out handling of ! * non-compressed mode */ ! if (compress == NO) { ! if (blank == YES) { ! dbputc(' '); ! blank = NO; ! } ! j = i + strcspn(my_yytext+i, "\t "); ! if (symput < symbols ! && j >= symbol[symput].first) ! j = symbol[symput].first; ! c = my_yytext[j]; ! my_yytext[j] = '\0'; ! writestring(my_yytext + i); ! my_yytext[j] = c; ! i = j - 1; ! /* finished this 'i', continue with the blank */ ! continue; ! } ! ! /* check for compressed blanks */ ! if (blank == YES) { ! if (dicode2[c]) { ! c = DICODE_COMPRESS(' ', c); ! } ! else { ! dbputc(' '); ! } ! } ! /* compress digraphs */ ! else if (IS_A_DICODE(c, my_yytext[i + 1]) ! && symput < symbols ! && i + 1 != symbol[symput].first ! ) { ! c = DICODE_COMPRESS(c, my_yytext[i + 1]); ! ++i; ! } ! dbputc((int) c); ! blank = NO; ! /* skip compressed characters */ ! if (c < ' ') { ! ++i; ! /* skip blanks before a preprocesor keyword */ ! /* note: don't use isspace() because \f and \v ! are used for keywords */ ! while ((j = my_yytext[i]) == ' ' || j == '\t') { ! ++i; ! } ! /* skip the rest of the keyword */ ! while (isalpha((unsigned char)my_yytext[i])) { ! ++i; ! } ! /* skip space after certain keywords */ ! if (keyword[c].delim != '\0') { ! while ((j = my_yytext[i]) == ' ' || j == '\t') { ! ++i; ! } ! } ! /* skip a '(' after certain keywords */ ! if (keyword[c].delim == '(' ! && my_yytext[i] == '(') { ! ++i; ! } ! --i; /* compensate for ++i in for() */ ! } /* if compressed char */ ! } /* else: not a symbol */ ! } /* for(i) */ ! ! /* ignore trailing blanks */ ! dbputc('\n'); dbputc('\n'); ! ! /* output any #define end marker */ ! /* note: must not be part of #define so putsource() doesn't discard it ! so findcalledbysub() can find it and return */ ! if (symput < symbols && symbol[symput].type == DEFINEEND) { ! dbputc('\t'); ! dbputc(DEFINEEND); ! dbputc('\n'); ! dbputc('\n'); /* mark beginning of next source line */ ! macrooffset = 0; ! } ! symbols = 0; } --- 234,371 ---- putcrossref(void) { ! unsigned int i, j; ! unsigned char c; ! BOOL blank; /* blank indicator */ ! unsigned int symput = 0; /* symbols output */ ! int type; ! ! /* output the source line */ ! lineoffset = dboffset; ! dboffset += fprintf(newrefs, "%d ", lineno); #ifdef PRINTF_RETVAL_BROKEN ! dboffset = ftell(newrefs); /* fprintf doesn't return chars written */ #endif ! /* HBB 20010425: added this line: */ ! my_yytext[my_yyleng] = '\0'; ! blank = NO; ! for (i = 0; i < my_yyleng; ++i) { ! /* change a tab to a blank and compress blanks */ ! if ((c = my_yytext[i]) == ' ' || c == '\t') { ! blank = YES; ! } else if (symput < symbols && i == symbol[symput].first) { ! /* look for the start of a symbol */ ! ! /* check for compressed blanks */ ! if (blank == YES) { ! blank = NO; ! dbputc(' '); ! } ! dbputc('\n'); /* symbols start on a new line */ ! /* output any symbol type */ ! if ((type = symbol[symput].type) != IDENT) { ! dbputc('\t'); ! dbputc(type); ! } else { ! type = ' '; ! } ! /* output the symbol */ ! j = symbol[symput].last; ! c = my_yytext[j]; ! my_yytext[j] = '\0'; ! if (invertedindex == YES) { ! putposting(my_yytext + i, type); ! } ! writestring(my_yytext + i); ! dbputc('\n'); ! my_yytext[j] = c; ! i = j - 1; ! ++symput; ! } else { ! /* HBB: try to save some time by early-out handling of ! * non-compressed mode */ ! if (compress == NO) { ! if (blank == YES) { ! dbputc(' '); ! blank = NO; ! } ! j = i + strcspn(my_yytext+i, "\t "); ! if (symput < symbols ! && j >= symbol[symput].first) ! j = symbol[symput].first; ! c = my_yytext[j]; ! my_yytext[j] = '\0'; ! writestring(my_yytext + i); ! my_yytext[j] = c; ! i = j - 1; ! /* finished this 'i', continue with the blank */ ! continue; ! } ! ! /* check for compressed blanks */ ! if (blank == YES) { ! if (dicode2[c]) { ! c = DICODE_COMPRESS(' ', c); ! } else { ! dbputc(' '); } ! } else if (IS_A_DICODE(c, my_yytext[i + 1]) ! && symput < symbols ! && i + 1 != symbol[symput].first) { ! /* compress digraphs */ ! c = DICODE_COMPRESS(c, my_yytext[i + 1]); ! ++i; ! } ! dbputc((int) c); ! blank = NO; ! /* skip compressed characters */ ! if (c < ' ') { ! ++i; ! /* skip blanks before a preprocesor keyword */ ! /* note: don't use isspace() because \f and \v ! are used for keywords */ ! while ((j = my_yytext[i]) == ' ' || j == '\t') { ! ++i; ! } ! /* skip the rest of the keyword */ ! while (isalpha((unsigned char)my_yytext[i])) { ! ++i; ! } ! /* skip space after certain keywords */ ! if (keyword[c].delim != '\0') { ! while ((j = my_yytext[i]) == ' ' || j == '\t') { ! ++i; ! } ! } ! /* skip a '(' after certain keywords */ ! if (keyword[c].delim == '(' ! && my_yytext[i] == '(') { ! ++i; ! } ! --i; /* compensate for ++i in for() */ ! } /* if compressed char */ ! } /* else: not a symbol */ ! } /* for(i) */ ! ! /* ignore trailing blanks */ ! dbputc('\n'); ! dbputc('\n'); ! ! /* output any #define end marker */ ! /* note: must not be part of #define so putsource() doesn't discard it ! so findcalledbysub() can find it and return */ ! if (symput < symbols && symbol[symput].type == DEFINEEND) { ! dbputc('\t'); ! dbputc(DEFINEEND); dbputc('\n'); ! dbputc('\n'); /* mark beginning of next source line */ ! macrooffset = 0; ! } ! symbols = 0; } Index: dir.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/dir.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -r1.25 -r1.26 *** dir.c 19 Apr 2006 15:20:21 -0000 1.25 --- dir.c 21 Apr 2006 10:45:48 -0000 1.26 *************** *** 56,68 **** char **srcdirs; /* source directories */ char **srcfiles; /* source files */ ! int nincdirs; /* number of #include directories */ ! int nsrcdirs; /* number of source directories */ ! int nsrcfiles; /* number of source files */ ! int msrcfiles = SRCINC; /* maximum number of source files */ static char **incnames; /* #include directory names without view pathing */ ! static int mincdirs = DIRINC; /* maximum number of #include directories */ ! static int msrcdirs; /* maximum number of source directories */ ! static int nvpsrcdirs; /* number of view path source directories */ static struct listitem { /* source file names without view pathing */ --- 56,68 ---- char **srcdirs; /* source directories */ char **srcfiles; /* source files */ ! unsigned long nincdirs; /* number of #include directories */ ! unsigned long nsrcdirs; /* number of source directories */ ! unsigned long nsrcfiles; /* number of source files */ ! unsigned long msrcfiles = SRCINC; /* maximum number of source files */ static char **incnames; /* #include directory names without view pathing */ ! static unsigned long mincdirs = DIRINC; /* maximum number of #include directories */ ! static unsigned long msrcdirs; /* maximum number of source directories */ ! static unsigned long nvpsrcdirs; /* number of view path source directories */ static struct listitem { /* source file names without view pathing */ *************** *** 92,97 **** /* get the current directory name */ if (getcwd(currentdir, PATHLEN) == NULL) { ! (void) fprintf(stderr, "cscope: warning: cannot get current directory name\n"); ! (void) strcpy(currentdir, "<unknown>"); } /* see if there is a view path and this directory is in it */ --- 92,97 ---- /* get the current directory name */ if (getcwd(currentdir, PATHLEN) == NULL) { ! fprintf(stderr, "cscope: warning: cannot get current directory name\n"); ! strcpy(currentdir, "<unknown>"); } /* see if there is a view path and this directory is in it */ *************** *** 118,150 **** sourcedir(char *dirlist) { ! char path[PATHLEN + 1]; ! char *dir; ! int i; ! makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ ! /* parse the directory list */ ! dir = strtok(dirlist, DIRSEPS); ! while (dir != NULL) { ! int dir_len = strlen(dir); ! ! addsrcdir(dir); ! ! /* if it isn't a full path name and there is a ! multi-directory view path */ ! if (*dirlist != '/' && vpndirs > 1) { ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! (void) sprintf(path, "%.*s/%s", ! PATHLEN - 2 - dir_len, ! srcdirs[i], dir); ! addsrcdir(path); ! } ! } ! dir = strtok(NULL, DIRSEPS); ! } ! free(dirlist); /* HBB 20000421: avoid memory leaks */ } --- 118,150 ---- sourcedir(char *dirlist) { ! char path[PATHLEN + 1]; ! char *dir; ! unsigned int i; ! makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ ! /* parse the directory list */ ! dir = strtok(dirlist, DIRSEPS); ! while (dir != NULL) { ! int dir_len = strlen(dir); ! ! addsrcdir(dir); ! ! /* if it isn't a full path name and there is a ! multi-directory view path */ ! if (*dirlist != '/' && vpndirs > 1) { ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! sprintf(path, "%.*s/%s", ! PATHLEN - 2 - dir_len, ! srcdirs[i], dir); ! addsrcdir(path); ! } ! } ! dir = strtok(NULL, DIRSEPS); ! } ! free(dirlist); /* HBB 20000421: avoid memory leaks */ } *************** *** 186,218 **** includedir(char *dirlist) { ! char path[PATHLEN + 1]; ! char *dir; ! int i; ! makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ ! /* parse the directory list */ ! dir = strtok(dirlist, DIRSEPS); ! while (dir != NULL) { ! int dir_len = strlen(dir); ! ! addincdir(dir, dir); ! ! /* if it isn't a full path name and there is a ! multi-directory view path */ ! if (*dirlist != '/' && vpndirs > 1) { ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! (void) sprintf(path, "%.*s/%s", ! PATHLEN - 2 - dir_len, ! srcdirs[i], dir); ! addincdir(dir, path); ! } ! } ! dir = strtok(NULL, DIRSEPS); ! } ! free(dirlist); /* HBB 20000421: avoid leaks */ } --- 186,218 ---- includedir(char *dirlist) { ! char path[PATHLEN + 1]; ! char *dir; ! unsigned int i; ! makevpsrcdirs(); /* make the view source directory list */ ! dirlist = stralloc(dirlist); /* don't change environment variable text */ ! /* parse the directory list */ ! dir = strtok(dirlist, DIRSEPS); ! while (dir != NULL) { ! size_t dir_len = strlen(dir); ! ! addincdir(dir, dir); ! ! /* if it isn't a full path name and there is a ! multi-directory view path */ ! if (*dirlist != '/' && vpndirs > 1) { ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! sprintf(path, "%.*s/%s", ! PATHLEN - 2 - dir_len, ! srcdirs[i], dir); ! addincdir(dir, path); ! } ! } ! dir = strtok(NULL, DIRSEPS); ! } ! free(dirlist); /* HBB 20000421: avoid leaks */ } *************** *** 263,372 **** makefilelist(void) { ! static BOOL firstbuild = YES; /* first time through */ ! FILE *names; /* name file pointer */ ! char dir[PATHLEN + 1]; ! char path[PATHLEN + 1]; ! char line[PATHLEN * 10]; ! char *file; ! char *s; ! int i; ! makevpsrcdirs(); /* make the view source directory list */ ! /* if -i was NOT given and there are source file arguments */ ! if (namefile == NULL && fileargc > 0) { ! /* put them in a list that can be expanded */ ! for (i = 0; i < fileargc; ++i) { ! file = fileargv[i]; ! if (infilelist(file) == NO) { ! if ((s = inviewpath(file)) != NULL) { ! addsrcfile(s); ! } else { ! (void) fprintf(stderr, "cscope: cannot find file %s\n", ! file); ! errorsfound = YES; ! } ! } } ! return; ! } ! ! /* see if a file name file exists */ ! if (namefile == NULL && vpaccess(NAMEFILE, READ) == 0) { ! namefile = NAMEFILE; } ! if (namefile == NULL) { ! /* No namefile --> make a list of all the source files ! * in the directories */ ! for (i = 0; i < nsrcdirs; ++i) { ! scan_dir(srcdirs[i], recurse_dir); ! } ! return; } ! /* Came here --> there is a file of source file names */ ! if (strcmp(namefile, "-") == 0) ! names = stdin; ! else if ((names = vpfopen(namefile, "r")) == NULL) { ! cannotopen(namefile); ! myexit(1); ! } ! ! /* get the names in the file */ ! while (fgets(line, 10*PATHLEN, names) != NULL) { ! char *point_in_line = line + (strlen(line) - 1); ! size_t length_of_name = 0; ! int unfinished_option = 0; ! BOOL done = NO; ! ! /* Kill away \n left at end of fgets()'d string: */ ! if (*point_in_line == '\n') ! *point_in_line = '\0'; ! /* Parse whitespace-terminated strings in line: */ ! point_in_line = line; ! while (sscanf(point_in_line, "%s", path) == 1) { ! /* Have to store this length --- inviewpath() will ! * modify path, later! */ ! length_of_name = strlen(path); ! if (*path == '-') { /* if an option */ ! if (unfinished_option) { ! /* Can't have another option directly after an ! * -I or -p option with no name after it! */ ! (void) fprintf(stderr, "\ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", ! namefile); ! unfinished_option = 0; ! } ! i = path[1]; ! switch (i) { ! case 'c': /* ASCII characters only in crossref */ ! compress = NO; ! break; ! case 'k': /* ignore DFLT_INCDIR */ ! kernelmode = YES; ! break; ! case 'q': /* quick search */ ! invertedindex = YES; ! break; ! case 'T': /* truncate symbols to 8 characters */ ! trun_syms = YES; ! break; ! case 'I': /* #include file directory */ ! case 'p': /* file path components to display */ ! s = path + 2; /* for "-Ipath" */ ! if (*s == '\0') { /* if "-I path" */ ! unfinished_option = i; ! break; ! } ! ! /* this code block used several times in here ! * --> make it a macro to avoid unnecessary ! * duplication */ #define HANDLE_OPTION_ARGUMENT(i, s) \ switch (i) { \ --- 263,372 ---- makefilelist(void) { ! static BOOL firstbuild = YES; /* first time through */ ! FILE *names; /* name file pointer */ ! char dir[PATHLEN + 1]; ! char path[PATHLEN + 1]; ! char line[PATHLEN * 10]; ! char *file; ! char *s; ! unsigned int i; ! makevpsrcdirs(); /* make the view source directory list */ ! /* if -i was NOT given and there are source file arguments */ ! if (namefile == NULL && fileargc > 0) { ! /* put them in a list that can be expanded */ ! for (i = 0; i < fileargc; ++i) { ! file = fileargv[i]; ! if (infilelist(file) == NO) { ! if ((s = inviewpath(file)) != NULL) { ! addsrcfile(s); ! } else { ! fprintf(stderr, "cscope: cannot find file %s\n", ! file); ! errorsfound = YES; } ! } } + return; + } ! /* see if a file name file exists */ ! if (namefile == NULL && vpaccess(NAMEFILE, READ) == 0) { ! namefile = NAMEFILE; ! } ! ! if (namefile == NULL) { ! /* No namefile --> make a list of all the source files ! * in the directories */ ! for (i = 0; i < nsrcdirs; ++i) { ! scan_dir(srcdirs[i], recurse_dir); } + return; + } ! /* Came here --> there is a file of source file names */ ! if (strcmp(namefile, "-") == 0) ! names = stdin; ! else if ((names = vpfopen(namefile, "r")) == NULL) { ! cannotopen(namefile); ! myexit(1); ! } ! ! /* get the names in the file */ ! while (fgets(line, 10*PATHLEN, names) != NULL) { ! char *point_in_line = line + (strlen(line) - 1); ! size_t length_of_name = 0; ! int unfinished_option = 0; ! BOOL done = NO; ! ! /* Kill away \n left at end of fgets()'d string: */ ! if (*point_in_line == '\n') ! *point_in_line = '\0'; ! /* Parse whitespace-terminated strings in line: */ ! point_in_line = line; ! while (sscanf(point_in_line, "%s", path) == 1) { ! /* Have to store this length --- inviewpath() will ! * modify path, later! */ ! length_of_name = strlen(path); ! if (*path == '-') { /* if an option */ ! if (unfinished_option) { ! /* Can't have another option directly after an ! * -I or -p option with no name after it! */ ! fprintf(stderr, "\ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n", ! namefile); ! unfinished_option = 0; ! } ! i = path[1]; ! switch (i) { ! case 'c': /* ASCII characters only in crossref */ ! compress = NO; ! break; ! case 'k': /* ignore DFLT_INCDIR */ ! kernelmode = YES; ! break; ! case 'q': /* quick search */ ! invertedindex = YES; ! break; ! case 'T': /* truncate symbols to 8 characters */ ! trun_syms = YES; ! break; ! case 'I': /* #include file directory */ ! case 'p': /* file path components to display */ ! s = path + 2; /* for "-Ipath" */ ! if (*s == '\0') { /* if "-I path" */ ! unfinished_option = i; ! break; ! } ! ! /* this code block used several times in here ! * --> make it a macro to avoid unnecessary ! * duplication */ #define HANDLE_OPTION_ARGUMENT(i, s) \ switch (i) { \ *************** *** 382,386 **** case 'p': /* file path components to display */ \ if (*(s) < '0' || *(s) > '9') { \ ! (void) fprintf(stderr, \ "cscope: -p option in file %s: missing or invalid numeric value\n", \ namefile); \ --- 382,386 ---- case 'p': /* file path components to display */ \ if (*(s) < '0' || *(s) > '9') { \ ! fprintf(stderr, \ "cscope: -p option in file %s: missing or invalid numeric value\n", \ namefile); \ *************** *** 394,474 **** } /* switch(i) */ ! /* ... and now call it for the first time */ ! HANDLE_OPTION_ARGUMENT(i, s) ! break; ! default: ! (void) fprintf(stderr, "cscope: only -I, -c, -k, -p, and -T options can be in file %s\n", ! namefile); ! } /* switch(i) */ ! } /* if('-') */ ! else if (*path == '"') { ! /* handle quoted filenames... */ ! size_t in = 1, out = 0; ! char *newpath = mymalloc(PATHLEN + 1); ! ! while (in < PATHLEN && point_in_line[in] != '\0') { ! if (point_in_line[in] == '"') { ! newpath[out] = '\0'; ! /* Tell outer loop to skip over this entire quoted string */ ! length_of_name = in + 1; ! break; /* found end of quoted string */ ! } else if (point_in_line[in] == '\\' ! && in < PATHLEN - 1 ! && (point_in_line[in + 1]== '"' ! || point_in_line[in + 1] == '\\')) { ! /* un-escape \" or \\ sequence */ ! newpath[out++] = point_in_line[in + 1]; ! in += 2; ! } else { ! newpath[out++] = point_in_line[in++]; ! } ! } /* while(in) */ ! if (in >= PATHLEN) { /* safeguard against almost-overflow */ ! newpath[out]='\0'; ! } ! ! /* If an -I or -p arguments was missing before, ! * treat this name as the argument: */ ! HANDLE_OPTION_ARGUMENT(unfinished_option, newpath); ! if (! done) { ! if ((s = inviewpath(newpath)) != NULL) { ! addsrcfile(s); ! } else { ! (void) fprintf(stderr, ! "cscope: cannot find file %s\n", ! newpath); ! errorsfound = YES; ! } ! } ! } /* if(quoted name) */ ! else { ! /* ... so this is an ordinary file name, unquoted */ ! ! /* If an -I or -p arguments was missing before, ! * treat this name as the argument: */ ! HANDLE_OPTION_ARGUMENT(unfinished_option, path); ! if (!done) { ! if ((s = inviewpath(path)) != NULL) { ! addsrcfile(s); ! } else { ! (void) fprintf(stderr, "cscope: cannot find file %s\n", ! path); ! errorsfound = YES; ! } ! } ! } /* else(ordinary name) */ ! ! point_in_line += length_of_name; ! while (isspace((unsigned char) *point_in_line)) ! point_in_line ++; ! } /* while(sscanf(line)) */ ! } /* while(fgets(line)) */ ! ! if (names == stdin) ! clearerr(stdin); ! else ! (void) fclose(names); ! firstbuild = NO; ! return; } --- 394,474 ---- } /* switch(i) */ ! /* ... and now call it for the first time */ ! HANDLE_OPTION_ARGUMENT(i, s) ! break; ! default: ! fprintf(stderr, "cscope: only -I, -c, -k, -p, and -T options can be in file %s\n", ! namefile); ! } /* switch(i) */ ! } /* if('-') */ ! else if (*path == '"') { ! /* handle quoted filenames... */ ! size_t in = 1, out = 0; ! char *newpath = mymalloc(PATHLEN + 1); ! ! while (in < PATHLEN && point_in_line[in] != '\0') { ! if (point_in_line[in] == '"') { ! newpath[out] = '\0'; ! /* Tell outer loop to skip over this entire quoted string */ ! length_of_name = in + 1; ! break; /* found end of quoted string */ ! } else if (point_in_line[in] == '\\' ! && in < PATHLEN - 1 ! && (point_in_line[in + 1]== '"' ! || point_in_line[in + 1] == '\\')) { ! /* un-escape \" or \\ sequence */ ! newpath[out++] = point_in_line[in + 1]; ! in += 2; ! } else { ! newpath[out++] = point_in_line[in++]; ! } ! } /* while(in) */ ! if (in >= PATHLEN) { /* safeguard against almost-overflow */ ! newpath[out]='\0'; ! } ! ! /* If an -I or -p arguments was missing before, ! * treat this name as the argument: */ ! HANDLE_OPTION_ARGUMENT(unfinished_option, newpath); ! if (! done) { ! if ((s = inviewpath(newpath)) != NULL) { ! addsrcfile(s); ! } else { ! fprintf(stderr, ! "cscope: cannot find file %s\n", ! newpath); ! errorsfound = YES; ! } ! } ! } /* if(quoted name) */ ! else { ! /* ... so this is an ordinary file name, unquoted */ ! ! /* If an -I or -p arguments was missing before, ! * treat this name as the argument: */ ! HANDLE_OPTION_ARGUMENT(unfinished_option, path); ! if (!done) { ! if ((s = inviewpath(path)) != NULL) { ! addsrcfile(s); ! } else { ! fprintf(stderr, "cscope: cannot find file %s\n", ! path); ! errorsfound = YES; ! } ! } ! } /* else(ordinary name) */ ! ! point_in_line += length_of_name; ! while (isspace((unsigned char) *point_in_line)) ! point_in_line ++; ! } /* while(sscanf(line)) */ ! } /* while(fgets(line)) */ ! ! if (names == stdin) ! clearerr(stdin); ! else ! fclose(names); ! firstbuild = NO; ! return; } *************** *** 515,520 **** } - /* see if this is a source file */ static BOOL issrcfile(char *path) --- 515,520 ---- } + /* see if this is a source file */ static BOOL issrcfile(char *path) *************** *** 580,638 **** } - /* add an include file to the source file list */ void incfile(char *file, char *type) { ! char name[PATHLEN + 1]; ! char path[PATHLEN + 1]; ! char *s; ! int i; ! ! /* see if the file is already in the source file list */ ! if (infilelist(file) == YES) { ! return; ! } ! /* look in current directory if it was #include "file" */ ! if (type[0] == '"' && (s = inviewpath(file)) != NULL) { ! addsrcfile(s); ! } else { ! int file_len = strlen(file); ! /* search for the file in the #include directory list */ ! for (i = 0; i < nincdirs; ++i) { ! ! /* don't include the file from two directories */ ! (void) sprintf(name, "%.*s/%s", ! PATHLEN - 2 - file_len, incnames[i], ! file); ! if (infilelist(name) == YES) { ! break; ! } ! /* make sure it exists and is readable */ ! (void) sprintf(path, "%.*s/%s", ! PATHLEN - 2 - file_len, incdirs[i], ! file); ! if (access(compath(path), READ) == 0) { ! addsrcfile(path); ! break; ! } ! } } } - /* see if the file is already in the list */ BOOL infilelist(char *path) { ! struct listitem *p; ! for (p = srcnames[hash(compath(path)) % HASHMOD]; p != NULL; p = p->next) { ! if (strequal(path, p->text)) { ! return(YES); ! } } ! return(NO); } --- 580,639 ---- } + /* add an include file to the source file list */ void incfile(char *file, char *type) { ! char name[PATHLEN + 1]; ! char path[PATHLEN + 1]; ! char *s; ! unsigned int i; ! /* see if the file is already in the source file list */ ! if (infilelist(file) == YES) { ! return; ! } ! /* look in current directory if it was #include "file" */ ! if (type[0] == '"' && (s = inviewpath(file)) != NULL) { ! addsrcfile(s); ! } else { ! size_t file_len = strlen(file); ! ! /* search for the file in the #include directory list */ ! for (i = 0; i < nincdirs; ++i) { ! /* don't include the file from two directories */ ! sprintf(name, "%.*s/%s", ! PATHLEN - 2 - file_len, incnames[i], ! file); ! if (infilelist(name) == YES) { ! break; ! } ! /* make sure it exists and is readable */ ! sprintf(path, "%.*s/%s", ! PATHLEN - 2 - file_len, incdirs[i], ! file); ! if (access(compath(path), READ) == 0) { ! addsrcfile(path); ! break; ! } } + } } + /* see if the file is already in the list */ BOOL infilelist(char *path) { ! struct listitem *p; ! for (p = srcnames[hash(compath(path)) % HASHMOD]; ! p != NULL; ! p = p->next) { ! if (strequal(path, p->text)) { ! return(YES); } ! } ! return(NO); } *************** *** 642,667 **** inviewpath(char *file) { ! static char path[PATHLEN + 1]; ! int i; ! /* look for the file */ ! if (access(compath(file), READ) == 0) { ! return(file); ! } ! /* if it isn't a full path name and there is a multi-directory view path */ ! if (*file != '/' && vpndirs > 1) { ! int file_len = strlen(file); ! ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! (void) sprintf(path, "%.*s/%s", ! PATHLEN - 2 - file_len, srcdirs[i], ! file); ! if (access(compath(path), READ) == 0) { ! return(path); ! } ! } } ! return(NULL); } --- 643,670 ---- inviewpath(char *file) { ! static char path[PATHLEN + 1]; ! unsigned int i; ! /* look for the file */ ! if (access(compath(file), READ) == 0) { ! return(file); ! } ! ! /* if it isn't a full path name and there is a multi-directory ! * view path */ ! if (*file != '/' && vpndirs > 1) { ! int file_len = strlen(file); ! ! /* compute its path from higher view path source dirs */ ! for (i = 1; i < nvpsrcdirs; ++i) { ! sprintf(path, "%.*s/%s", ! PATHLEN - 2 - file_len, srcdirs[i], ! file); ! if (access(compath(path), READ) == 0) { ! return(path); ! } } ! } ! return(NULL); } Index: display.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/display.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -r1.26 -r1.27 *** display.c 27 Oct 2004 11:32:46 -0000 1.26 --- display.c 21 Apr 2006 10:45:48 -0000 1.27 *************** *** 65,81 **** int booklen; /* OGS book name display field length */ int *displine; /* screen line of displayed reference */ ! int disprefs; /* displayed references */ int field; /* input field */ int filelen; /* file name display field length */ int fcnlen; /* function name display field length */ ! int mdisprefs; /* maximum displayed references */ ! int nextline; /* next line to be shown */ FILE *nonglobalrefs; /* non-global references file */ int numlen; /* line number display field length */ ! int topline = 1; /* top line of page */ int bottomline; /* bottom line of page */ long searchcount; /* count of files searched */ int subsystemlen; /* OGS subsystem name display field length */ ! int totallines; /* total reference lines */ unsigned fldcolumn; /* input field column */ --- 65,81 ---- int booklen; /* OGS book name display field length */ int *displine; /* screen line of displayed reference */ ! unsigned int disprefs; /* displayed references */ int field; /* input field */ int filelen; /* file name display field length */ int fcnlen; /* function name display field length */ ! unsigned int mdisprefs; /* maximum displayed references */ ! unsigned int nextline; /* next line to be shown */ FILE *nonglobalrefs; /* non-global references file */ int numlen; /* line number display field length */ ! unsigned int topline = 1; /* top line of page */ int bottomline; /* bottom line of page */ long searchcount; /* count of files searched */ int subsystemlen; /* OGS subsystem name display field length */ ! unsigned int totallines; /* total reference lines */ unsigned fldcolumn; /* input field column */ *************** *** 144,374 **** display(void) { ! char *subsystem; /* OGS subsystem name */ ! char *book; /* OGS book name */ ! char file[PATHLEN + 1]; /* file name */ ! char function[PATLEN + 1]; /* function name */ ! char linenum[NUMLEN + 1]; /* line number */ ! int screenline; /* screen line number */ ! int width; /* source line display width */ ! int i; ! char *s; ! ! /* see if this is the initial display */ ! erase(); ! if (refsfound == NULL) { #if CCS ! if (displayversion == YES) { ! printw("cscope %s", ESG_REL); ! } ! else { ! printw("cscope"); ! } #else ! printw("Cscope version %d%s", FILEVERSION, FIXVERSION); #endif ! move(0, COLS - (int) sizeof(helpstring)); ! addstr(helpstring); ! } else if (totallines == 0) { ! /* if no references were found */ ! /* redisplay the last message */ ! addstr(lastmsg); } else { ! /* display the pattern */ ! if (changing == YES) { ! printw("Change \"%s\" to \"%s\"", Pattern, newpat); ! } else { ! printw("%c%s: %s", toupper((unsigned char)fields[field].text2[0]), ! fields[field].text2 + 1, Pattern); ! } ! /* display the column headings */ ! move(2, 2); ! if (ogs == YES && field != FILENAME) { ! printw("%-*s ", subsystemlen, "Subsystem"); ! printw("%-*s ", booklen, "Book"); ! } ! if (dispcomponents > 0) ! printw("%-*s ", filelen, "File"); ! if (field == SYMBOL || field == CALLEDBY || field == CALLING) { ! printw("%-*s ", fcnlen, "Function"); ! } ! if (field != FILENAME) { ! addstr("Line"); ! } ! addch('\n'); ! /* if at end of file go back to beginning */ ! if (nextline > totallines) { ! seekline(1); ! } ! /* calculate the source text column */ ! width = COLS - numlen - 3; if (ogs == YES) { ! width -= subsystemlen + booklen + 2; } if (dispcomponents > 0) { ! width -= filelen + 1; ! } ! if (field == SYMBOL || field == CALLEDBY || field == CALLING) { ! width -= fcnlen + 1; } ! /* until the max references have been displayed or ! there is no more room */ ! topline = nextline; ! for (disprefs = 0, screenline = REFLINE; ! disprefs < mdisprefs && screenline <= lastdispline; ! ++disprefs, ++screenline) { ! /* read the reference line */ ! if (fscanf(refsfound, "%s%s%s %[^\n]", file, function, ! linenum, tempstring) < 4) { ! break; ! } ! ++nextline; ! displine[disprefs] = screenline; ! ! /* if no mouse, display the selection number */ ! if (mouse == YES) { ! addch(' '); ! } else { ! printw("%c", dispchars[disprefs]); ! } ! ! /* display any change mark */ ! if (changing == YES && ! change[topline + disprefs - 1] == YES) { ! addch('>'); ! } else { ! addch(' '); ! } ! ! /* display the file name */ ! if (field == FILENAME) { ! printw("%-*s ", filelen, file); ! } else { ! /* if OGS, display the subsystem and book names */ ! if (ogs == YES) { ! ogsnames(file, &subsystem, &book); ! printw("%-*.*s ", subsystemlen, subsystemlen, subsystem); ! printw("%-*.*s ", booklen, booklen, book); ! } ! /* display the requested path components */ ! if (dispcomponents > 0) { ! printw("%-*.*s ", filelen, filelen, ! pathcomponents(file, dispcomponents)); ! } ! } /* else(field == FILENAME) */ ! ! /* display the function name */ ! if (field == SYMBOL || field == CALLEDBY || field == CALLING) { ! printw("%-*.*s ", fcnlen, fcnlen, function); ! } ! if (field == FILENAME) { ! addch('\n'); /* go to next line */ ! continue; ! } ! ! /* display the line number */ ! printw("%*s ", numlen, linenum); ! /* there may be tabs in egrep output */ ! while ((s = strchr(tempstring, '\t')) != NULL) { ! *s = ' '; ! } ! ! /* display the source line */ ! s = tempstring; ! for (;;) { ! /* see if the source line will fit */ ! if ((i = strlen(s)) > width) { ! /* find the nearest blank */ ! for (i = width; s[i] != ' ' && i > 0; --i) { ! ; ! } ! if (i == 0) { ! i = width; /* no blank */ ! } ! } ! /* print up to this point */ ! printw("%.*s", i, s); ! s += i; ! /* if line didn't wrap around */ ! if (i < width) { ! addch('\n'); /* go to next line */ ! } ! /* skip blanks */ ! while (*s == ' ') { ! ++s; ! } ! /* see if there is more text */ ! if (*s == '\0') { ! break; ! } ! /* if the source line is too long */ ! if (++screenline > lastdispline) { ! ! /* if this is the first displayed line, ! display what will fit on the screen */ ! if (topline == nextline -1) { ! disprefs++; ! /* break out of two loops */ ! goto endrefs; ! } ! /* erase the reference */ ! while (--screenline >= displine[disprefs]) { ! move(screenline, 0); ! clrtoeol(); ! } ! ++screenline; ! /* go back to the beginning of this reference */ ! --nextline; ! seekline(nextline); ! goto endrefs; ! } ! /* indent the continued source line */ ! move(screenline, COLS - width); ! } /* for(ever) */ ! } /* for(reference output lines) */ ! endrefs: ! /* position the cursor for the message */ ! i = FLDLINE - 1; ! if (screenline < i) { ! addch('\n'); ! } ! else { ! move(i, 0); ! } ! /* check for more references */ ! i = totallines - nextline + 1; ! bottomline = nextline; ! if (i > 0) { ! s = "s"; ! if (i == 1) { ! s = ""; ! } ! printw("* %d more line%s - press the space bar to display more *", i, s); ! } ! /* if this is the last page of references */ ! else if (topline > 1 && nextline > totallines) { ! addstr("* Press the space bar to display the first lines again *"); ! } } ! /* display the input fields */ ! move(FLDLINE, 0); ! for (i = 0; i < FIELDS; ++i) { ! printw("%s %s:\n", fields[i].text1, fields[i].text2); } ! /* display any prompt */ ! if (changing == YES) { ! move(PRLINE, 0); ! addstr(selprompt); } ! drawscrollbar(topline, nextline); /* display the scrollbar */ ! refresh(); } --- 144,374 ---- display(void) { ! char *subsystem; /* OGS subsystem name */ ! char *book; /* OGS book name */ ! char file[PATHLEN + 1]; /* file name */ ! char function[PATLEN + 1]; /* function name */ ! char linenum[NUMLEN + 1]; /* line number */ ! int screenline; /* screen line number */ ! int width; /* source line display width */ ! int i; ! char *s; ! ! /* see if this is the initial display */ ! erase(); ! if (refsfound == NULL) { #if CCS ! if (displayversion == YES) { ! printw("cscope %s", ESG_REL); ! } ! else { ! printw("cscope"); ! } #else ! printw("Cscope version %d%s", FILEVERSION, FIXVERSION); #endif ! move(0, COLS - (int) sizeof(helpstring)); ! addstr(helpstring); ! } else if (totallines == 0) { ! /* if no references were found */ ! /* redisplay the last message */ ! addstr(lastmsg); ! } else { ! /* display the pattern */ ! if (changing == YES) { ! printw("Change \"%s\" to \"%s\"", Pattern, newpat); } else { ! printw("%c%s: %s", toupper((unsigned char)fields[field].text2[0]), ! fields[field].text2 + 1, Pattern); ! } ! /* display the column headings */ ! move(2, 2); ! if (ogs == YES && field != FILENAME) { ! printw("%-*s ", subsystemlen, "Subsystem"); ! printw("%-*s ", booklen, "Book"); ! } ! if (dispcomponents > 0) ! printw("%-*s ", filelen, "File"); ! if (field == SYMBOL || field == CALLEDBY || field == CALLING) { ! printw("%-*s ", fcnlen, "Function"); ! } ! if (field != FILENAME) { ! addstr("Line"); ! } ! addch('\n'); ! /* if at end of file go back to beginning */ ! if (nextline > totallines) { ! seekline(1); ! } ! /* calculate the source text column */ ! width = COLS - numlen - 3; + if (ogs == YES) { + width -= subsystemlen + booklen + 2; + } + if (dispcomponents > 0) { + width -= filelen + 1; + } + if (field == SYMBOL || field == CALLEDBY || field == CALLING) { + width -= fcnlen + 1; + } + + /* until the max references have been displayed or + there is no more room */ + topline = nextline; + for (disprefs = 0, screenline = REFLINE; + disprefs < mdisprefs && screenline <= lastdispline; + ++disprefs, ++screenline) { + /* read the reference line */ + if (fscanf(refsfound, "%s%s%s %[^\n]", file, function, + linenum, tempstring) < 4) { + break; + } + ++nextline; + displine[disprefs] = screenline; + + /* if no mouse, display the selection number */ + if (mouse == YES) { + addch(' '); + } else { + printw("%c", dispchars[disprefs]); + } + + /* display any change mark */ + if (changing == YES && + change[topline + disprefs - 1] == YES) { + addch('>'); + } else { + addch(' '); + } + + /* display the file name */ + if (field == FILENAME) { + printw("%-*s ", filelen, file); + } else { + /* if OGS, display the subsystem and book names */ if (ogs == YES) { ! ogsnames(file, &subsystem, &book); ! printw("%-*.*s ", subsystemlen, subsystemlen, subsystem); ! printw("%-*.*s ", booklen, booklen, book); } + /* display the requested path components */ if (dispcomponents > 0) { ! printw("%-*.*s ", filelen, filelen, ! pathcomponents(file, dispcomponents)); } + } /* else(field == FILENAME) */ ! /* display the function name */ ! if (field == SYMBOL || field == CALLEDBY || field == CALLING) { ! printw("%-*.*s ", fcnlen, fcnlen, function); ! } ! if (field == FILENAME) { ! addch('\n'); /* go to next line */ ! continue; ! } ! ! /* display the line number */ ! printw("%*s ", numlen, linenum); ! /* there may be tabs in egrep output */ ! while ((s = strchr(tempstring, '\t')) != NULL) { ! *s = ' '; ! } ! ! /* display the source line */ ! s = tempstring; ! for (;;) { ! /* see if the source line will fit */ ! if ((i = strlen(s)) > width) { ! /* find the nearest blank */ ! for (i = width; s[i] != ' ' && i > 0; --i) { ! ; ! } ! if (i == 0) { ! i = width; /* no blank */ ! } ! } ! /* print up to this point */ ! printw("%.*s", i, s); ! s += i; ! /* if line didn't wrap around */ ! if (i < width) { ! addch('\n'); /* go to next line */ ! } ! /* skip blanks */ ! while (*s == ' ') { ! ++s; ! } ! /* see if there is more text */ ! if (*s == '\0') { ! break; ! } ! /* if the source line is too long */ ! if (++screenline > lastdispline) { ! ! /* if this is the first displayed line, ! display what will fit on the screen */ ! if (topline == nextline -1) { ! disprefs++; ! /* break out of two loops */ ! goto endrefs; ! } ! /* erase the reference */ ! while (--screenline >= displine[disprefs]) { ! move(screenline, 0); ! clrtoeol(); ! } ! ++screenline; ! /* go back to the beginning of this reference */ ! --nextline; ! seekline(nextline); ! goto endrefs; ! } ! /* indent the continued source line */ ! move(screenline, COLS - width); ! } /* for(ever) */ ! } /* for(reference output lines) */ ! endrefs: ! /* position the cursor for the message */ ! i = FLDLINE - 1; ! if (screenline < i) { ! addch('\n'); } ! else { ! move(i, 0); } ! /* check for more references */ ! i = totallines - nextline + 1; ! bottomline = nextline; ! if (i > 0) { ! s = "s"; ! if (i == 1) { ! s = ""; ! } ! printw("* %d more line%s - press the space bar to display more *", i, s); ! } ! /* if this is the last page of references */ ! else if (topline > 1 && nextline > totallines) { ! addstr("* Press the space bar to display the first lines again *"); } ! } ! /* display the input fields */ ! move(FLDLINE, 0); ! for (i = 0; i < FIELDS; ++i) { ! printw("%s %s:\n", fields[i].text1, fields[i].text2); ! } ! /* display any prompt */ ! if (changing == YES) { ! move(PRLINE, 0); ! addstr(selprompt); ! } ! drawscrollbar(topline, nextline); /* display the scrollbar */ ! refresh(); } *************** *** 412,420 **** search(void) { - char *subsystem; /* OGS subsystem name */ - char *book; /* OGS book name */ - char file[PATHLEN + 1]; /* file name */ - char function[PATLEN + 1]; /* function name */ - char linenum[NUMLEN + 1]; /* line number */ char *findresult = NULL; /* find function output */ BOOL funcexist = YES; /* find "function" error */ --- 412,415 ---- *************** *** 422,426 **** sighandler_t savesig; /* old value of signal */ FP f; /* searching function */ ! int c, i; /* open the references found file for writing */ --- 417,421 ---- sighandler_t savesig; /* old value of signal */ FP f; /* searching function */ ! int c; /* open the references found file for writing */ *************** *** 434,438 **** searchcount = 0; savesig = signal(SIGINT, jumpback); ! if (sigsetjmp(env,1) == 0) { f = fields[field].findfcn; if (f == findregexp || f == findstring) { --- 429,433 ---- searchcount = 0; savesig = signal(SIGINT, jumpback); ! if (sigsetjmp(env, 1) == 0) { f = fields[field].findfcn; if (f == findregexp || f == findstring) { *************** *** 688,692 **** void ! seekline(int line) { int c; --- 683,687 ---- void ! seekline(unsigned int line) { int c; Index: egrep.y =================================================================== RCS file: /cvsroot/cscope/cscope/src/egrep.y,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** egrep.y 14 Mar 2005 17:23:05 -0000 1.10 --- egrep.y 21 Apr 2006 10:45:48 -0000 1.11 *************** *** 62,70 **** static int state[NSTATES]; static char out[NSTATES]; ! static int line; static int name[MAXLIN]; ! static int left[MAXLIN]; ! static int right[MAXLIN]; ! static int parent[MAXLIN]; static int foll[MAXLIN]; static int positions[MAXPOS]; --- 62,70 ---- static int state[NSTATES]; static char out[NSTATES]; ! static unsigned int line; static int name[MAXLIN]; ! static unsigned int left[MAXLIN]; ! static unsigned int right[MAXLIN]; ! static unsigned int parent[MAXLIN]; static int foll[MAXLIN]; static int positions[MAXPOS]; *************** *** 92,100 **** static void overflo(void); static void add(int *array, int n); ! static void follow(int v); static int unary(int x, int d); static int node(int x, int l, int r); ! static int cclenter(int x); ! static int enter(int x); static int yylex(void); --- 92,100 ---- static void overflo(void); static void add(int *array, int n); ! static void follow(unsigned int v); static int unary(int x, int d); static int node(int x, int l, int r); ! static unsigned int cclenter(int x); ! static unsigned int enter(int x); static int yylex(void); *************** *** 152,155 **** --- 152,156 ---- message = s; longjmp(env, 1); + return 1; /* silence a warning */ } *************** *** 228,251 **** synerror(void) { ! yyerror("Syntax error"); } ! static int enter(int x) { ! if(line >= MAXLIN) overflo(); ! name[line] = x; ! left[line] = 0; ! right[line] = 0; ! return(line++); } ! static int cclenter(int x) { ! int linno; ! linno = enter(x); ! right[linno] = count; ! return (linno); } --- 229,254 ---- synerror(void) { ! yyerror("Syntax error"); ... [truncated message content] |
From: Hans-Bernhard B. <br...@us...> - 2006-04-21 10:43:46
|
Update of /cvsroot/cscope/cscope/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23608 Modified Files: invlib.c Log Message: Fix buffer overflow in invlib by making source bufferr same size as target. Index: invlib.c =================================================================== RCS file: /cvsroot/cscope/cscope/src/invlib.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** invlib.c 22 Nov 2005 11:28:55 -0000 1.16 --- invlib.c 21 Apr 2006 10:43:42 -0000 1.17 *************** *** 48,52 **** #define DEBUG 0 /* debugging code and realloc messages */ #define BLOCKSIZE 2 * BUFSIZ /* logical block size */ - #define LINEMAX 1000 /* sorted posting line max size */ #define POSTINC 10000 /* posting buffer size increment */ #define SEP ' ' /* sorted posting field separator */ --- 48,51 ---- *************** *** 84,89 **** static FILE *outfile, *fpost; static unsigned supersize = SUPERINC, supintsize; ! static int numpost, numlogblk, amtused, nextpost, ! lastinblk, numinvitems; static POSTING *POST, *postptr; static unsigned long *SUPINT, *supint, nextsupfing; --- 83,88 ---- static FILE *outfile, *fpost; static unsigned supersize = SUPERINC, supintsize; ! static unsigned int numpost, numlogblk, amtused, nextpost; ! static unsigned int lastinblk, numinvitems; static POSTING *POST, *postptr; static unsigned long *SUPINT, *supint, nextsupfing; *************** *** 113,117 **** unsigned postsize = POSTINC * sizeof(POSTING); unsigned long *intptr; ! char line[LINEMAX]; long tlong; PARAM param; --- 112,116 ---- unsigned postsize = POSTINC * sizeof(POSTING); unsigned long *intptr; ! char line[TERMMAX]; long tlong; PARAM param; *************** *** 178,182 **** /* now loop as long as more to read (till eof) */ ! while (fgets(line, LINEMAX, infile) != NULL) { #if DEBUG || STATS ++totpost; --- 177,181 ---- /* now loop as long as more to read (till eof) */ ! while (fgets(line, TERMMAX, infile) != NULL) { #if DEBUG || STATS ++totpost; *************** *** 354,506 **** invnewterm(void) { ! int backupflag, i, j, maxback, holditems, gooditems, howfar; ! int len, numwilluse, wdlen; ! char *tptr, *tptr2, *tptr3; ! union { ! unsigned long packword[2]; ! ENTRY e; ! } iteminfo; ! gooditems = 0; /* initialize, to avoid warning */ ! totterm++; #if STATS ! /* keep zipfian info on the distribution */ ! if (numpost <= ZIPFSIZE) ! zipf[numpost]++; ! else ! zipf[0]++; ! #endif ! len = strlen(thisterm); ! wdlen = (len + (sizeof(long) - 1)) / sizeof(long); ! numwilluse = (wdlen + 3) * sizeof(long); ! /* new block if at least 1 item in block */ ! if (numinvitems && numwilluse + amtused > sizeof(t_logicalblk)) { ! /* set up new block */ ! if (supfing + 500 > SUPFING + supersize) { ! i = supfing - SUPFING; ! supersize += 20000; ! if ((SUPFING = (char *)realloc(SUPFING, supersize)) == NULL) { ! invcannotalloc(supersize); ! return(0); ! } ! supfing = i + SUPFING; #if DEBUG ! printf("reallocated superfinger space to %d, totpost=%ld\n", ! supersize, totpost); #endif ! } ! /* check that room for the offset as well */ ! /* FIXME HBB: magic number alert (10) */ ! if ((numlogblk + 10) > supintsize) { ! i = supint - SUPINT; ! supintsize += SUPERINC; ! if ((SUPINT = realloc(SUPINT, supintsize * sizeof(long))) == NULL) { ! invcannotalloc(supintsize * sizeof(long)); ! return(0); ! } ! supint = i + SUPINT; #if DEBUG ! printf("reallocated superfinger offset to %d, totpost = %ld\n", ! supintsize * sizeof(long), totpost); #endif ! } ! /* See if backup is efficatious */ ! backupflag = 0; ! maxback = (int) strlen(thisterm) / 10; ! holditems = numinvitems; ! if (maxback > numinvitems) ! maxback = numinvitems - 2; ! howfar = 0; ! while (--maxback > 0) { ! howfar++; ! iteminfo.packword[0] = logicalblk.invblk[--holditems * 2+(sizeof(long) - 1)]; ! if ((i = iteminfo.e.size / 10) < maxback) { ! maxback = i; ! backupflag = howfar; ! gooditems = holditems; ! tptr2 = logicalblk.chrblk + iteminfo.e.offset; ! } ! } ! /* see if backup will occur */ ! if (backupflag) { ! numinvitems = gooditems; ! } ! logicalblk.invblk[0] = numinvitems; ! /* set forward pointer pointing to next */ ! logicalblk.invblk[1] = numlogblk + 1; ! /* set back pointer to last block */ ! logicalblk.invblk[2] = numlogblk - 1; ! if (fwrite(logicalblk.chrblk, 1, sizeof(t_logicalblk), outfile) == 0) { ! invcannotwrite(indexfile); ! return(0); ! } ! amtused = 16; ! numlogblk++; ! /* check if had to back up, if so do it */ ! if (backupflag) { ! /* find out where the end of the new block is */ ! iteminfo.packword[0] = logicalblk.invblk[numinvitems*2+1]; ! tptr3 = logicalblk.chrblk + iteminfo.e.offset; ! /* move the index for this block */ ! for (i = 3; i <= (backupflag * 2 + 2); i++) ! logicalblk.invblk[i] = logicalblk.invblk[numinvitems*2+i]; ! /* move the word into the super index */ ! iteminfo.packword[0] = logicalblk.invblk[3]; ! iteminfo.packword[1] = logicalblk.invblk[4]; ! tptr2 = logicalblk.chrblk + iteminfo.e.offset; ! strncpy(supfing, tptr2, (int) iteminfo.e.size); ! *(supfing + iteminfo.e.size) = '\0'; #if DEBUG ! printf("backup %d at term=%s to term=%s\n", ! backupflag, thisterm, supfing); #endif ! *supint++ = nextsupfing; ! nextsupfing += strlen(supfing) + 1; ! supfing += strlen(supfing) + 1; ! /* now fix up the logical block */ ! tptr = logicalblk.chrblk + lastinblk; ! lastinblk = sizeof(t_logicalblk); ! tptr2 = logicalblk.chrblk + lastinblk; ! j = tptr3 - tptr; ! while (tptr3 > tptr) ! *--tptr2 = *--tptr3; ! lastinblk -= j; ! amtused += (8 * backupflag + j); ! for (i = 3; i < (backupflag * 2 + 2); i += 2) { ! iteminfo.packword[0] = logicalblk.invblk[i]; ! iteminfo.e.offset += (tptr2 - tptr3); ! logicalblk.invblk[i] = iteminfo.packword[0]; ! } ! numinvitems = backupflag; ! } else { /* no backup needed */ ! numinvitems = 0; ! lastinblk = sizeof(t_logicalblk); ! /* add new term to superindex */ ! strcpy(supfing, thisterm); ! supfing += strlen(thisterm) + 1; ! *supint++ = nextsupfing; ! nextsupfing += strlen(thisterm) + 1; ! } ! } ! /* HBB 20010501: Fixed bug by replacing magic number '8' by ! * what it actually represents. */ ! lastinblk -= (numwilluse - 2 * sizeof(long)); ! iteminfo.e.offset = lastinblk; ! iteminfo.e.size = len; ! iteminfo.e.space = 0; ! iteminfo.e.post = numpost; ! strncpy(logicalblk.chrblk + lastinblk, thisterm, len); ! amtused += numwilluse; ! logicalblk.invblk[(lastinblk/sizeof(long))+wdlen] = nextpost; ! if ((i = postptr - POST) > 0) { ! if (fwrite(POST, sizeof(POSTING), i, fpost) == 0) { ! invcannotwrite(postingfile); ! return(0); ! } ! nextpost += i * sizeof(POSTING); ! } ! logicalblk.invblk[3+2*numinvitems++] = iteminfo.packword[0]; ! logicalblk.invblk[2+2*numinvitems] = iteminfo.packword[1]; ! return(1); } --- 353,508 ---- invnewterm(void) { ! int backupflag, i, j, holditems, gooditems, howfar; ! unsigned int maxback, len, numwilluse, wdlen; ! char *tptr, *tptr2, *tptr3; ! ! union { ! unsigned long packword[2]; ! ENTRY e; ! } iteminfo; ! gooditems = 0; /* initialize, to avoid warning */ ! totterm++; #if STATS ! /* keep zipfian info on the distribution */ ! if (numpost <= ZIPFSIZE) ! zipf[numpost]++; ! else ! zipf[0]++; ! #endif ! len = strlen(thisterm); ! wdlen = (len + (sizeof(long) - 1)) / sizeof(long); ! /* HBB FIXME 20060419: magic number: 3 */ ! numwilluse = (wdlen + 3) * sizeof(long); ! /* new block if at least 1 item in block */ ! if (numinvitems && numwilluse + amtused > sizeof(t_logicalblk)) { ! /* set up new block */ ! if (supfing + 500 > SUPFING + supersize) { ! i = supfing - SUPFING; ! supersize += 20000; ! if ((SUPFING = (char *)realloc(SUPFING, supersize)) == NULL) { ! invcannotalloc(supersize); ! return(0); ! } ! supfing = i + SUPFING; #if DEBUG ! printf("reallocated superfinger space to %d, totpost=%ld\n", ! supersize, totpost); #endif ! } ! /* check that room for the offset as well */ ! /* FIXME HBB: magic number alert (10) */ ! if ((numlogblk + 10) > supintsize) { ! i = supint - SUPINT; ! supintsize += SUPERINC; ! if ((SUPINT = realloc(SUPINT, supintsize * sizeof(long))) == NULL) { ! invcannotalloc(supintsize * sizeof(long)); ! return(0); ! } ! supint = i + SUPINT; #if DEBUG ! printf("reallocated superfinger offset to %d, totpost = %ld\n", ! supintsize * sizeof(long), totpost); #endif ! } ! /* See if backup is efficatious */ ! backupflag = 0; ! maxback = (int) strlen(thisterm) / 10; ! holditems = numinvitems; ! if (maxback > numinvitems) ! maxback = numinvitems - 2; ! howfar = 0; ! while (--maxback > 0) { ! howfar++; ! iteminfo.packword[0] = ! logicalblk.invblk[--holditems * 2 + (sizeof(long) - 1)]; ! if ((i = iteminfo.e.size / 10) < maxback) { ! maxback = i; ! backupflag = howfar; ! gooditems = holditems; ! tptr2 = logicalblk.chrblk + iteminfo.e.offset; ! } ! } ! /* see if backup will occur */ ! if (backupflag) { ! numinvitems = gooditems; ! } ! logicalblk.invblk[0] = numinvitems; ! /* set forward pointer pointing to next */ ! logicalblk.invblk[1] = numlogblk + 1; ! /* set back pointer to last block */ ! logicalblk.invblk[2] = numlogblk - 1; ! if (fwrite(logicalblk.chrblk, 1, sizeof(t_logicalblk), outfile) == 0) { ! invcannotwrite(indexfile); ! return(0); ! } ! amtused = 16; ! numlogblk++; ! /* check if had to back up, if so do it */ ! if (backupflag) { ! /* find out where the end of the new block is */ ! iteminfo.packword[0] = logicalblk.invblk[numinvitems*2+1]; ! tptr3 = logicalblk.chrblk + iteminfo.e.offset; ! /* move the index for this block */ ! for (i = 3; i <= (backupflag * 2 + 2); i++) ! logicalblk.invblk[i] = logicalblk.invblk[numinvitems*2+i]; ! /* move the word into the super index */ ! iteminfo.packword[0] = logicalblk.invblk[3]; ! iteminfo.packword[1] = logicalblk.invblk[4]; ! tptr2 = logicalblk.chrblk + iteminfo.e.offset; ! strncpy(supfing, tptr2, (int) iteminfo.e.size); ! *(supfing + iteminfo.e.size) = '\0'; #if DEBUG ! printf("backup %d at term=%s to term=%s\n", ! backupflag, thisterm, supfing); #endif ! *supint++ = nextsupfing; ! nextsupfing += strlen(supfing) + 1; ! supfing += strlen(supfing) + 1; ! /* now fix up the logical block */ ! tptr = logicalblk.chrblk + lastinblk; ! lastinblk = sizeof(t_logicalblk); ! tptr2 = logicalblk.chrblk + lastinblk; ! j = tptr3 - tptr; ! while (tptr3 > tptr) ! *--tptr2 = *--tptr3; ! lastinblk -= j; ! amtused += (8 * backupflag + j); ! for (i = 3; i < (backupflag * 2 + 2); i += 2) { ! iteminfo.packword[0] = logicalblk.invblk[i]; ! iteminfo.e.offset += (tptr2 - tptr3); ! logicalblk.invblk[i] = iteminfo.packword[0]; ! } ! numinvitems = backupflag; ! } else { /* no backup needed */ ! numinvitems = 0; ! lastinblk = sizeof(t_logicalblk); ! /* add new term to superindex */ ! strcpy(supfing, thisterm); ! supfing += strlen(thisterm) + 1; ! *supint++ = nextsupfing; ! nextsupfing += strlen(thisterm) + 1; ! } ! } ! /* HBB 20010501: Fixed bug by replacing magic number '8' by ! * what it actually represents. */ ! lastinblk -= (numwilluse - 2 * sizeof(long)); ! iteminfo.e.offset = lastinblk; ! iteminfo.e.size = len; ! iteminfo.e.space = 0; ! iteminfo.e.post = numpost; ! strncpy(logicalblk.chrblk + lastinblk, thisterm, len); ! amtused += numwilluse; ! logicalblk.invblk[(lastinblk/sizeof(long))+wdlen] = nextpost; ! if ((i = postptr - POST) > 0) { ! if (fwrite(POST, sizeof(POSTING), i, fpost) == 0) { ! invcannotwrite(postingfile); ! return(0); ! } ! nextpost += i * sizeof(POSTING); ! } ! logicalblk.invblk[3+2*numinvitems++] = iteminfo.packword[0]; ! logicalblk.invblk[2+2*numinvitems] = iteminfo.packword[1]; ! return(1); } |