diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2006-11-13 22:13:33 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@xenon.tklauser.home> | 2006-11-13 22:13:33 +0100 |
commit | b37e0da0b7dc72ddfa513e319ca71b5f5b8aeb7d (patch) | |
tree | 810ec4a83a30b7e001321fdb2402c756f511727e |
Initial import15.6-2
124 files changed, 36191 insertions, 0 deletions
@@ -0,0 +1,34 @@ +Joe Steffen - Creator of Cscope +Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> - Maintainer +Petr Sorfa <petr@users.sourceforge.net> - Initial OpenSource Maintainer +Simon Cozens - autoconf setup +garp@digi.com - .cc .hh support +jens persson <cscope@persson.cx> - new man page +Edgar Toernig - cscope stability +Martin Kraemer - various improvments +Joshua Uziel <uzi@linuxcare.com> - code clean up, -h and -k options, and lots more (including autoconf) +Mike Hopkirk <hops@sco.com> - osr5 build, ocs +Darrylo Okahata <darrylo@users.sourceforge.net> - code quality improvements +Brent Verner <brent@rcfile.org> - -R option to recurse sub directories +Thomas Klausner - NetBSD support +Andrew Sharpe - progress bar, tab between line selection and prompts and more +Carl Mascott - FreeBSD support +Rich Salz - Allow -i accept stdio as input as "-" +Stephane Fritsch - BeOS support +Andy Newman <atrn> - FreeBSD support patch +Sascha Blank - FreeBSD support +Bruce Frost - Stability +Chuck Marco and Wilfredo Sanchez - Darwin support +Jason Duell - CSCOPE_EDITOR and CSCOPE_LINEFLAG*, invname database +Tom Hull - Similar work to CSCOPE_EDITOR and friends +Donald Slutz - Various fixes +OGAWA Hirofumi - line mode fixes +Garret Hade - Various ocs fixes +Nick Dixon - Improvement in key handling +Triet H. Lai <thlai@mail.usyd.edu.au> - GNU Emacs fixes for xcscope.el +Steven Elliott <selliott4@austin.rr.com> - Fuzzy pattern matching for xcscope.el +Ragho Mahalingam <ragho@mahalingam.com> - webcscope +Dmitry Obukhov - Hilight code in webcscope +David Cohrs - LEX and SUNOS scanner fix +Valentin Podlovchenko - Overflow prevention and link recursion fix patch +Neil Horman <nhorman@gmail.com> - Various Bug Fixes @@ -0,0 +1,29 @@ +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. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..7873f3f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,524 @@ +2006-09-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * 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. + + * 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 (should fix 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 <broeker@physik.rwth-aachen.de> + + * 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. + (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 <broeker@physik.rwth-achen.de> + + * 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 <broeker@physik.rwth-achen.de> + + * src/fscanner.l: Accept numeric literals inside fcn definitions + and calls. + +2006-04-21 Hans-Bernhard Broeker <broeker@physik.rwth-achen.de> + + 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 <broeker@physik.rwth-achen.de> + + * 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 <broeker@physik.rwth-achen.de> + + 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 + to be worth autoconf-ing around. Works around problems compiling on + Cygwin release 1.5.19. + + * Makefile.in, aclocal.m4, configure, contrib/Makefile.in, + doc/Makefile.in, src/Makefile.in: Regenerated with current auto + tools (autoconf-2.59, automake 1.9.6). + +2006-02-21 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/vpinit.c (vpinit): Fix handling of slightly malformed VPATH + environment variable contents. + +2005-11-22 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/dir.c (issrcfile): Finally added auto-searching for + three-letter C++ file extensions *.tcc, *.cpp, *.cxx. Test all + matches to be regular files, not just those with two- and + three-character extensions. + + * src/invlib.c: Some cleanup. Replace 0 third argument to fseek + by proper SEEK_SET. Got rid of (void) result casts and some + function argument casts. + (invmake): Fix one sizeof(long)==4 assumption. + +2005-08-16 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/main.c: Uncluttered by removing nitpicky (void) casts. + (longusage): Reworked for source legibility even on 80-column + displays. + (main): If in verbose linemode, print number of references found, + first off. Patch from Elad Lahav, for Kscope + +2005-07-08 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/build.c (invname_buf, invpost_buf, reffile_buf): Make + modifiable copies of the default file names. + (invname, invpost, reffile): Initialize pointers to modifiable + copies, rather than to string literals. + + * packages/MSDOS/djmake.bat: Adapt to modern position of ylwrap + script. + + * src/command.c (command) [KEY_RESIZE]: Protect by + !defined(__DJGPP__). That platform doesn't have sigaction() and + associated machinery, nor does it really support terminal size + changes to begin with. + + * src/main.c (sigwinch_handler): Likewise. + (main): Likewise. + +2005-04-29 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/command.c (command): Additional hotkey mapping of Ctrl-A to + same function as Ctrl-Y, like AT&T cscope, to evade Ctrl-Y + occupied as the DSUSP signal key on BSD'ish platforms. + + * src/help.c (help): Document additonal hotkey ^A. Mention + possible unavailability of some Ctrl keys because of terminal + settings. + +2005-03-14 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/input.c (getline): Removed. Was just a minimally simplified + copy of mygetline() anyway, and it threatened to collide with a + like-named routine in libc. + + * src/global.h (getline): Removed prototype. + + * src/command.c (command): Changed all calls of getline() to + mygetline() with an empty string as the first argument. + + * src/egrep.y (memset): Changed #if condition around fallback + implementation to match that of the prototype in global.h. Should + fix SF bug #1163104 (build failure on FreeBSD). + +2005-02-16 Neil Horman <nhorman@gmail.com> + + * src/command.c (command): Added ifdef KEY_RESIZE around + KEY_RESIZE case in switch statement to allow curses + libraries which don't support resize events to build + + * src/main.c (main): Added ifdef KEY_RESIZE around + SIGWINCH handler and signal registration logic to + remove resize code from cscope when building with + curses libraries that don't support resize events + +2005-02-04 Neil Horman <nhorman@gmail.com> + + * src/command.c (command): Added KEY_RESIZE event case to + command switch to handle window re-drawing when a resize + event was received. + + * src/input.c (mygetch): Added error checking of return code + to restart call to getch in the event it returned early due + to a signal being delivered. + + * src/main.c (main): Registered a signal handler for the + SIGWINCH handler which is delivered when a terminal is + resized. Handler pushes a KEY_RESIZE event onto the head + of the command input queue. + +2005-02-01 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/build.c (build): Keep interactive mode on, even if on a + terminal, if verbose mode (-v) was turned on. + +2005-01-31 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/scanner.h: Declare yytext signed on AIX (without stating a + version number, for now). + +2005-01-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/mypopen.c (mypopen): Make closing argument to execlp() a + manifest null pointer, not just a zero. + +2004-12-08 Neil Horman <nhorman@gmail.com> + + * src/dir.c: Fix to dissallow unreadable files from + srcfiles list (sourceforge bug number 1040690) + +2004-12-06 Neil Horman <nhorman@gmail.com> + + * src/main.c: Fix for temp file security bug (sourceforge + bug number 1062807 / CAN-2004-0970) + +2004-11-22 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * doc/cscope.1: Make ESR happy: change man page summary section to + avoid [0-9] syntax. + +2004-10-27 Hans-Bernhard Broeker <broeker@accip02.physik.rwth-aachen.de> + + * src/display.c (search): Replace duplicated code by a call to + countrefs(). Duplicate lacked adjustment of column widths in case + of very long function/file names. Thanks to Darlene Wong for + spotting this. + + * src/global.h (countrefs): Prototype added. + + * src/command.c (countrefs): Made globally available. + +2004-06-23 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/dir.c (makefilelist): Fix broken movement of point_in_line + when parsing quoted names. Simplify structure by moving default + handling upward. + +2004-06-21 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * contrib/ocs (SYSDIR): Only set to /usr/local/lib/cs if not + already set in outside environment. Check that $(SYSDIR) exists + before proceeding. From SF patch #976788 by Neil Horman. + +2004-04-30 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/vpinit.c (vpinit): Renamed argument currentdir to + current_dir to avoid name clash with same-named global. + + * src/command.c (Pattern): Renamed from "pattern", to avoid + multitute of compiler warnings about shadowing by locally defined + variables of the same name. Changed all usages of this variable, + too. + (command): Test for individual KEY_* macros instead of TERMINFO + whenever one of the KEY_* macros is referenced. This should + reduce the TERMINFO mess a little. + + * src/find.c (read_block): Renamed from "readblock", to avoid name + clash with QNX system function of that name. Calls changed + accordingly, all over the place. + + * src/display.c: Fix fall-back definition of sigjmp_buf. + + * src/constants.h: Activate TERMINFO for FreeBSD. + + * src/input.c (mygetline): New function. Poor-man's readline + imitation. From SF Patch #937310. + + * src/global.h (mygetline): Prototype added. + + * src/command.c (command): Use mygetline() instead of letting + ncsurses doing it all. Make Ctrl-B/F special hotkeys that are + handled here instead of in mygetline(), to preserve their meaning. + + * packages/cscope.spec: Updated by SF patch #920586 to be more + compatible with current expectations. + +2004-02-24 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * configure.in (AC_CHECK_HEADERS): Added check for NSK-Tandem + special magic header file <floss.h>. + + * src/global.h [HAVE_FLOSS_H]: Added #include <floss.h> if it + exists. + +2004-02-14 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/command.c (countrefs): Fix off-by-one length specification + of %s format. Thanks to <anil@recoil.org> for spotting it. + +2004-02-12 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + Fix SF bug #892731: Ctrl-C interruption of search works only once + per session. + + * configure.in (sigsetjmp): Added test for presence of this + function. + + * src/display.c (sigsetjmp) [!HAVE_SIGSETJMP]: Provide fallback + definitions for functions sigsetjmp, siglongjmp and type + sigjmp_buf. + (search): Move call to signal() above that to setjmp(). Call + sigsetjmp() instead of setjmp(). + + * configure, config.h.in: Regenerated. + + * Makefile.in, src/Makefile.in, contrib/Makefile.in, + doc/Makefile.in, aclocal.m4: Rebuilt by automake-1.7.9. + + +2004-02-11 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * configure.in (signal.h) Check added. + (sighandler_t): Check for this type. Should be defined on POSIX + platforms, but is treated as a GNU extension sometimes. + + * src/global.h (sighandler_t) [!HAVE_SIGHANDLER_T]: Provide + fallback definition of function pointer typedef for signal + handlers if <signal.h> doesn't provide it. Simplifies cscope's + work when working on its own source code --- function pointers + confuse it quite badly, so it's best to minimize their visibility. + + * src/input.c (mygetch): Type of local variable savesig written + using sighandler_t. + + * src/display.c (search): Type of local variable savesig written + using sighandler_t. + + * src/exec.c (oldsigtstp): Renamed, from oldsigstp. + (oldsigtstp,oldsighup,oldsigquit): Changed from function pointer + type to new typedef name sighandler_t. + +2004-02-05 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/global.h (tolower) [BSD]: Fix stupid typo in overrides for + toupper and tolower. + +2004-01-08 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/display.c (clearmsg): New function. Does essentially the + same thing previously achieved by a rather more cryptic + postmsg(""). + (postfatal): New function to printout a fatal error message and + terminate the program. Works like posterr(), but exits curses + first, so the message should end up visible after the program + exits. Using this instead of posterr()+myexit() fixes SF bug + #419510. + (dispinit): Use postfatal:(). + (postmsg): Use clearmsg(). + (postmsg2): Call curses refresh() after change. + + * src/global.h: Add prototypes for new functions clearmsg() and + postfatal(). + + * src/find.c (putsource): Use postfatal(). + + * src/main.c (main, skiplist): Use postfatal() and clearmsg(). + + * src/command.c (command): Use clearmsg(). + + * src/build.c (build, seek_to_trailer, movefile): Use postfatal(). + + * src/alloc.c (alloctest): Use postfatal(). + + * src/display.c (jumpback): Re-instate signal handler, in an + attempt to fix problems reported with the general behaviour of + signal handlers in cscope. + + * src/scanner.l (ws, wsnl): Two new predefined patterns to catch + not only blanks and tabs, but all generally allowed white-space + characters in source files: form feeds, vertical tabs, carriage + returns. Replaced most occurence of [ \t] and [ \t\n] by these. + This is a back-port from fscanner.l. Should fix SF bug #508060. + +Wed Oct 15 16:05:46 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/dir.c (scan_dir): Don't reduce path to basename before + calling issrcfile. + (issrcfile): Use either basename or full path, as necessary for + the individual tests. Reorganized to reduce nesting. + +Mon Sep 15 12:34:46 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/egrep.y (yylex, member, egrep, cgotofn): Reindented. Fixed + implicit int declarations and casts. + + * src/global.h (tolower, tolower) [BSD]: Fix override definitions + for these so they don't mung non-alphabetic input. + +Fri Sep 12 09:33:19 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + * src/vp.h: Add #include of <sys/types.h> to fix problem on + Solaris. + +Fri Sep 12 09:33:19 2003 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + + I'm finally starting a new, GNU-format ChangeLog file. The format + of the previous was too terse to be really useful. This begins + with the first changes after release 15.5. + + * ChangeLog.old: New file. Renamed copy of old-format ChangeLog + file. + + * ChangeLog: Started from scratch. + + @@ -0,0 +1,60 @@ +***** BUILDING: + +This program's build procedure is fairly standard. Try: + + ./configure + make + make install + +Options to the configure script are up to you. For details, run: + + ./configure --help + +Please report build problems at: + + http://sourceforge.net/bugs/?func=addbug&group_id=4664 + +(yes, even non-Linux problems). + + +***** TIPS AND PROBLEMS: + +- Try to use flex as the lexical analyzer. The lex scanner is now +separated from the flex version to allow the flex scanner to be +optimized. It's also a lot harder to diagnose and debug problems +without having full access to the particular platform and its version of +lex being used. flex is available everywhere --- AT&T lex is not. + +- On Solaris, the native lex fails to catch our redefinition of YYLMAX +early enough, which leads to possible buffer overflows. + +- On Linux systems (and possibly others) configure may fail if lex is + a synomyn for flex. To fix, do the following: + + make distclean + ./configure --with-flex + make + +- On HP-UX several problems exist when using configure. Try the following + to solve this: + + CFLAGS='-Ae -DYYCHAR_ARRAY' CURSES_LIBS=-lHcurses ./configure + +- On Tru64, formerly known as Digital Unix, formerly known as DEC OSF/1, + the system-supplied libcurses causes cscope to terminate itself + immediately as it comes back to foreground after being suspended by + the user (Ctrl-Z). Using GNU Ncurses instead of OSF1 curses works + around the problem. According to the lynx and ncurses people, this + is a design problem of curses vs. signal handling, at the heart of it. + +- Solaris 2.8 on Intel hardware may not work using the vendor's curses + implementation. Using the free NCurses should help. + +- Some ancient Unix filesytems supported only 14 characters in + filenames. cscope no longer cares for that by default. If you want + to run it on such a system, #define the macro SHORT_NAMES_ONLY manually + (there's a definition in global.h you can uncomment). + +Browse to http://cscope.sourceforge.net for more current information, +like reported bugs whose solutions haven't been put into this source +distribution yet. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..f7746f6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,6 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = doc src contrib + +EXTRA_DIST = packages + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..f1515b1 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,600 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + TODO compile config.guess config.sub depcomp install-sh \ + missing mkinstalldirs ylwrap +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@ +CURSES_LIBS = @CURSES_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@ +GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@ +HAS_CURSES_FALSE = @HAS_CURSES_FALSE@ +HAS_CURSES_TRUE = @HAS_CURSES_TRUE@ +HAS_GNOME_FALSE = @HAS_GNOME_FALSE@ +HAS_GNOME_TRUE = @HAS_GNOME_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USING_GNOME2_FALSE = @USING_GNOME2_FALSE@ +USING_GNOME2_TRUE = @USING_GNOME2_TRUE@ +USING_LEX_FALSE = @USING_LEX_FALSE@ +USING_LEX_TRUE = @USING_LEX_TRUE@ +VERSION = @VERSION@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +gnome1 = @gnome1@ +gnome2 = @gnome2@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = doc src contrib +EXTRA_DIST = packages +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-recursive ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \ + dist-tarZ dist-zip distcheck distclean distclean-generic \ + distclean-hdr distclean-recursive distclean-tags \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-recursive pdf \ + pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-info-am + +# 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. +.NOEXPORT: @@ -0,0 +1,4 @@ +2003/09/04 - Release of version 15.5. +2002/08/15 - Release of version 15.4. +2001/07/02 - Release of version 15.3. +2000/04/18 - Release of Version 13.0 into Open Source. Initial Linux port @@ -0,0 +1,24 @@ +Cscope is a text screen based source browsing tool. Although it is +primarily designed to search C code (including lex and yacc files), it +can also be used for C++ code. + +Using cscope, you can easily search for where symbols are used and +defined. Cscope is designed to answer questions like: + + Where is this variable used? + What is the value of this preprocessor symbol? + Where is this function in the source files? + What functions call this function? + What functions are called by this function? + Where does the message "out of space" come from? + Where is this source file in the directory structure? + What files include this header file? + +It has been released by The Santa Cruz Operation, Inc as Open Source +under the BSD license. Please look at COPYING for a detailed +description of the license. + +For instructions on how to build and install cscope, see the file, +"INSTALL". + +Browse to http://cscope.sourceforge.net for more current information @@ -0,0 +1,24 @@ +Open + ++ Display the current case mode (^C) onscreen + ++ emacs like key bindings + ^S for searching (^Y) + Up/dwn Arrow support Next/Prev field. ?? + Inline editing on Input fields ( ??^B/^F ) + ^X^C to quit ( ^Q ??) + Pagdwn/PageUp/+/- + ++ Same capabilities as interactive in non interactive (one shot) mode + ++ Provide some how-do-I-use-this-thing doc. + ++ Replace invlib.[ch] by real database. Failing that, at least sanitize it. + +Possible changes: + +? Change to full screen target display and use bottom line for command, + control or fn keys for operations (cf pine) + +? Apply added capability from osr5 codebase + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..dfba1f9 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,871 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Copyright (C) 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. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 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. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 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 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 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 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 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 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 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. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 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 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +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 -*- + +# Copyright (C) 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 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 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 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 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. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 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 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# 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 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 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. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 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 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar <conftest.tar]) + grep GrepMe conftest.dir/file >/dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + @@ -0,0 +1,99 @@ +#! /bin/sh + +# Wrapper for compilers which do not understand `-c -o'. + +# Copyright 1999, 2000 Free Software Foundation, Inc. +# Written by Tom Tromey <tromey@cygnus.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# compile PROGRAM [ARGS]... +# `-o FOO.o' is removed from the args passed to the actual compile. + +prog=$1 +shift + +ofile= +cfile= +args= +while test $# -gt 0; do + case "$1" in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we do something ugly here. + ofile=$2 + shift + case "$ofile" in + *.o | *.obj) + ;; + *) + args="$args -o $ofile" + ofile= + ;; + esac + ;; + *.c) + cfile=$1 + args="$args $1" + ;; + *) + args="$args $1" + ;; + esac + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$prog" $args +fi + +# Name of file we expect compiler to create. +cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d +while true; do + if mkdir $lockdir > /dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir $lockdir; exit 1" 1 2 15 + +# Run the compile. +"$prog" $args +status=$? + +if test -f "$cofile"; then + mv "$cofile" "$ofile" +fi + +rmdir $lockdir +exit $status diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..396482d --- /dev/null +++ b/config.guess @@ -0,0 +1,1500 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-07-02' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner <per@bothner.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + x86:Interix*:[3456]*) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T:Interix*:[3456]*) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..a9e9207 --- /dev/null +++ b/config.h.in @@ -0,0 +1,188 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* We're using a BSD-flavoured Unix */ +#undef BSD + +/* Found some version of curses that we're going to use */ +#undef HAS_CURSES + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the <fcntl.h> header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `fixkeypad' function. */ +#undef HAVE_FIXKEYPAD + +/* Define to 1 if you have the <floss.h> header file. */ +#undef HAVE_FLOSS_H + +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <io.h> header file. */ +#undef HAVE_IO_H + +/* Define to 1 if you have the `regex' library (-lregex). */ +#undef HAVE_LIBREGEX + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +#undef HAVE_LSTAT_EMPTY_STRING_BUG + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#undef HAVE_MEMSET + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you have the `regcmp' function. */ +#undef HAVE_REGCMP + +/* Define to 1 if you have the `regcomp' function. */ +#undef HAVE_REGCOMP + +/* Define to 1 if you have the `setmode' function. */ +#undef HAVE_SETMODE + +/* Define to 1 if you have the <signal.h> header file. */ +#undef HAVE_SIGNAL_H + +/* Define if we have sigsetjmp(). */ +#undef HAVE_SIGSETJMP + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/termios.h> header file. */ +#undef HAVE_SYS_TERMIOS_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <sys/window.h> header file. */ +#undef HAVE_SYS_WINDOW_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the `_setmode' function. */ +#undef HAVE__SETMODE + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#undef LSTAT_FOLLOWS_SLASHED_SYMLINK + +/* We're using some variant of Linux */ +#undef Linux + +/* Set to reflect version of ncurses: 0 = version 1.* 1 = version 1.9.9g 2 = + version 4.0/4.1 */ +#undef NCURSES_970530 + +/* If your Curses does not have color define this one */ +#undef NO_COLOR_CURSES + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define if you want to turn on SCO-specific code */ +#undef SCO_FLAVOR + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Use Ncurses? */ +#undef USE_NCURSES + +/* Use SunOS SysV curses? */ +#undef USE_SUNOS_CURSES + +/* Use SystemV curses? */ +#undef USE_SYSV_CURSES + +/* Define this if the scanner is run through lex, not flex */ +#undef USING_LEX + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +#undef YYTEXT_POINTER + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if <sys/types.h> does not define. */ +#undef mode_t + +/* Define to `int' if <sys/types.h> does not define. */ +#undef pid_t + +/* Define to `unsigned' if <sys/types.h> does not define. */ +#undef size_t diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..fab0aa3 --- /dev/null +++ b/config.sub @@ -0,0 +1,1616 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. + +timestamp='2006-09-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..4135b4a --- /dev/null +++ b/configure @@ -0,0 +1,7726 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for cscope 15.6. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='cscope' +PACKAGE_TARNAME='cscope' +PACKAGE_VERSION='15.6' +PACKAGE_STRING='cscope 15.6' +PACKAGE_BUGREPORT='' + +ac_unique_file="src/crossref.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE LEX LEXLIB LEX_OUTPUT_ROOT USING_LEX_TRUE USING_LEX_FALSE YACC CURSES_LIBS CURSES_INCLUDEDIR CPP EGREP HAS_CURSES_TRUE HAS_CURSES_FALSE gnome1 gnome2 USING_GNOME2_TRUE USING_GNOME2_FALSE HAS_GNOME_TRUE HAS_GNOME_FALSE GNOME_LINUX_TRUE GNOME_LINUX_FALSE LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures cscope 15.6 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cscope 15.6:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-sco Use this to turn on SCO-specific code + --with-sunos-curses Used to force SunOS 4.x curses + --with-osf1-curses Used to force OSF/1 curses + --with-vcurses=incdir Used to force SysV curses + --with-ncurses=dir Compile with ncurses/locate base dir + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +cscope configure 15.6 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cscope $as_me 15.6, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + +am__api_version="1.9" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='cscope' + VERSION='15.6' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + ac_config_headers="$ac_config_headers config.h:config.h.in" + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + + + +for ac_prog in flex lex +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_LEX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_LEX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +LEX=$ac_cv_prog_LEX +if test -n "$LEX"; then + echo "$as_me:$LINENO: result: $LEX" >&5 +echo "${ECHO_T}$LEX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$LEX" && break +done +test -n "$LEX" || LEX=":" + +if test -z "$LEXLIB" +then + echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 +echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 +if test "${ac_cv_lib_fl_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lfl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_fl_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_fl_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 +if test $ac_cv_lib_fl_yywrap = yes; then + LEXLIB="-lfl" +else + echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 +echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 +if test "${ac_cv_lib_l_yywrap+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ll $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char yywrap (); +int +main () +{ +yywrap (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_l_yywrap=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_l_yywrap=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 +echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 +if test $ac_cv_lib_l_yywrap = yes; then + LEXLIB="-ll" +fi + +fi + +fi + +if test "x$LEX" != "x:"; then + echo "$as_me:$LINENO: checking lex output file root" >&5 +echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_root+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +cat >conftest.l <<_ACEOF +%% +%% +_ACEOF +{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 + (eval $LEX conftest.l) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 +rm -f conftest.l +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root + +echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 +echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS=$LIBS +LIBS="$LIBS $LEXLIB" +cat >conftest.$ac_ext <<_ACEOF +`cat $LEX_OUTPUT_ROOT.c` +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_lex_yytext_pointer=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_save_LIBS +rm -f "${LEX_OUTPUT_ROOT}.c" + +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 +echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 +if test $ac_cv_prog_lex_yytext_pointer = yes; then + +cat >>confdefs.h <<\_ACEOF +#define YYTEXT_POINTER 1 +_ACEOF + +fi + +fi +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi + + +if test "x$LEX" = "xlex"; then + USING_LEX_TRUE= + USING_LEX_FALSE='#' +else + USING_LEX_TRUE='#' + USING_LEX_FALSE= +fi + +if test "x$LEX" = "xlex" ; then +cat >>confdefs.h <<\_ACEOF +#define USING_LEX 1 +_ACEOF + +fi +for ac_prog in 'bison -y' byacc +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_YACC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_YACC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +YACC=$ac_cv_prog_YACC +if test -n "$YACC"; then + echo "$as_me:$LINENO: result: $YACC" >&5 +echo "${ECHO_T}$YACC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" + + + + + + + + + + + + + + + + + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + + + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + + + + +# Check whether --with-sco or --without-sco was given. +if test "${with_sco+set}" = set; then + withval="$with_sco" + + if test x$withval = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define SCO_FLAVOR 1 +_ACEOF + + CFLAGS="$CFLAGS -D_SVID3" + fi + +fi; + + +# Check whether --with-sunos-curses or --without-sunos-curses was given. +if test "${with_sunos_curses+set}" = set; then + withval="$with_sunos_curses" + + if test x$withval = xyes; then + + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + echo "$as_me:$LINENO: result: Using SunOS 4.x /usr/5include curses" >&5 +echo "${ECHO_T}Using SunOS 4.x /usr/5include curses" >&6 + +cat >>confdefs.h <<\_ACEOF +#define USE_SUNOS_CURSES 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + +cat >>confdefs.h <<\_ACEOF +#define NO_COLOR_CURSES 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define USE_SYSV_CURSES 1 +_ACEOF + + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + echo "$as_me:$LINENO: result: Please note that some screen refreshs may fail" >&5 +echo "${ECHO_T}Please note that some screen refreshs may fail" >&6 + + fi + +fi; + + +# Check whether --with-osf1-curses or --without-osf1-curses was given. +if test "${with_osf1_curses+set}" = set; then + withval="$with_osf1_curses" + + if test x$withval = xyes; then + + echo "$as_me:$LINENO: result: Using OSF1 curses" >&5 +echo "${ECHO_T}Using OSF1 curses" >&6 + search_ncurses=false + screen_manager="OSF1 curses" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define NO_COLOR_CURSES 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define USE_SYSV_CURSES 1 +_ACEOF + + CURSES_LIBS="-lcurses" + + fi + +fi; + + +# Check whether --with-vcurses or --without-vcurses was given. +if test "${with_vcurses+set}" = set; then + withval="$with_vcurses" + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + + echo "$as_me:$LINENO: result: Using SysV curses" >&5 +echo "${ECHO_T}Using SysV curses" >&6 + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_SYSV_CURSES 1 +_ACEOF + + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" + + +fi; + + +# Check whether --with-ncurses or --without-ncurses was given. +if test "${with_ncurses+set}" = set; then + withval="$with_ncurses" + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + +cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + fi + +fi; + + if $search_ncurses + then + + { echo "$as_me:$LINENO: checking \"location of ncurses.h file\"..." >&5 +echo "$as_me: checking \"location of ncurses.h file\"..." >&6;} + + + if $search_ncurses + then + if test -f /usr/include/ncurses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/include/ncurses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/include/ncurses.h" >&6 + CURSES_LIBS="-lncurses" + CURSES_INCLUDEDIR="" + search_ncurses=false + screen_manager="ncurses on /usr/include" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + if $search_ncurses + then + if test -f /usr/include/ncurses/ncurses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/include/ncurses/ncurses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/include/ncurses/ncurses.h" >&6 + CURSES_LIBS="-lncurses" + CURSES_INCLUDEDIR="-I/usr/include/ncurses" + search_ncurses=false + screen_manager="ncurses on /usr/include/ncurses" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + if $search_ncurses + then + if test -f /usr/local/include/ncurses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/local/include/ncurses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/local/include/ncurses.h" >&6 + CURSES_LIBS="-L/usr/local/lib -lncurses" + CURSES_INCLUDEDIR="-I/usr/local/include" + search_ncurses=false + screen_manager="ncurses on /usr/local" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + if $search_ncurses + then + if test -f /usr/local/include/ncurses/ncurses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/local/include/ncurses/ncurses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/local/include/ncurses/ncurses.h" >&6 + CURSES_LIBS="-L/usr/local/lib -L/usr/local/lib/ncurses -lncurses" + CURSES_INCLUDEDIR="-I/usr/local/include/ncurses" + search_ncurses=false + screen_manager="ncurses on /usr/local/include/ncurses" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + + if $search_ncurses + then + if test -f /usr/local/include/ncurses/curses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/local/include/ncurses/curses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/local/include/ncurses/curses.h" >&6 + CURSES_LIBS="-L/usr/local/lib -lncurses" + CURSES_INCLUDEDIR="-I/usr/local/include/ncurses -DRENAMED_NCURSES" + search_ncurses=false + screen_manager="renamed ncurses on /usr/local/.../ncurses" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + + if $search_ncurses + then + if test -f /usr/include/ncurses/curses.h + then + echo "$as_me:$LINENO: result: Found ncurses on /usr/include/ncurses/curses.h" >&5 +echo "${ECHO_T}Found ncurses on /usr/include/ncurses/curses.h" >&6 + CURSES_LIBS="-lncurses" + CURSES_INCLUDEDIR="-I/usr/include/ncurses -DRENAMED_NCURSES" + search_ncurses=false + screen_manager="renamed ncurses on /usr/include/ncurses" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + fi + fi + + + if $search_ncurses + then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <curses.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "init_color" >/dev/null 2>&1; then + + echo "$as_me:$LINENO: result: Using SysV curses" >&5 +echo "${ECHO_T}Using SysV curses" >&6 + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_SYSV_CURSES 1 +_ACEOF + + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" + +fi +rm -f conftest* + + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include <curses.h> +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "USE_NCURSES" >/dev/null 2>&1; then + + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + cat >>confdefs.h <<\_ACEOF +#define USE_NCURSES 1 +_ACEOF + + search_ncurses=false + screen_manager="ncurses installed as curses" + +fi +rm -f conftest* + + fi + + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + echo "$as_me:$LINENO: result: Using SunOS 4.x /usr/5include curses" >&5 +echo "${ECHO_T}Using SunOS 4.x /usr/5include curses" >&6 + +cat >>confdefs.h <<\_ACEOF +#define USE_SUNOS_CURSES 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define HAS_CURSES 1 +_ACEOF + + has_curses=true + +cat >>confdefs.h <<\_ACEOF +#define NO_COLOR_CURSES 1 +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define USE_SYSV_CURSES 1 +_ACEOF + + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + echo "$as_me:$LINENO: result: Please note that some screen refreshs may fail" >&5 +echo "${ECHO_T}Please note that some screen refreshs may fail" >&6 + + fi + else + # check for ncurses version, to properly ifdef mouse-fix + echo "$as_me:$LINENO: checking for ncurses version" >&5 +echo $ECHO_N "checking for ncurses version... $ECHO_C" >&6 + ncurses_version=unknown +cat > conftest.$ac_ext <<EOF +#line 4010 "configure" +#include "confdefs.h" +#ifdef RENAMED_NCURSES +#include <curses.h> +#else +#include <ncurses.h> +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "VERSION:" >conftest.out 2>&1; then + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` + fi + rm -rf conftest* + echo "$as_me:$LINENO: result: $ncurses_version" >&5 +echo "${ECHO_T}$ncurses_version" >&6 + case "$ncurses_version" in + 4.[01]) + +cat >>confdefs.h <<\_ACEOF +#define NCURSES_970530 2 +_ACEOF + + ;; + 1.9.9g) + cat >>confdefs.h <<\_ACEOF +#define NCURSES_970530 1 +_ACEOF + + ;; + 1*) + cat >>confdefs.h <<\_ACEOF +#define NCURSES_970530 0 +_ACEOF + + ;; + esac + fi + + fi + + + + + +if test "$has_curses" = true; then + HAS_CURSES_TRUE= + HAS_CURSES_FALSE='#' +else + HAS_CURSES_TRUE='#' + HAS_CURSES_FALSE= +fi + + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +if test "${ac_cv_header_regex_h+set}" = set; then + echo "$as_me:$LINENO: checking for regex.h" >&5 +echo $ECHO_N "checking for regex.h... $ECHO_C" >&6 +if test "${ac_cv_header_regex_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_regex_h" >&5 +echo "${ECHO_T}$ac_cv_header_regex_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking regex.h usability" >&5 +echo $ECHO_N "checking regex.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <regex.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking regex.h presence" >&5 +echo $ECHO_N "checking regex.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <regex.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: regex.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: regex.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: regex.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: regex.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: regex.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: regex.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: regex.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: regex.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: regex.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: regex.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: regex.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## --------------------------------- ## +## Report this to the cscope lists. ## +## --------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for regex.h" >&5 +echo $ECHO_N "checking for regex.h... $ECHO_C" >&6 +if test "${ac_cv_header_regex_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_regex_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_regex_h" >&5 +echo "${ECHO_T}$ac_cv_header_regex_h" >&6 + +fi +if test $ac_cv_header_regex_h = yes; then + : +else + + { { echo "$as_me:$LINENO: error: necessary header <regex.h> not found" >&5 +echo "$as_me: error: necessary header <regex.h> not found" >&2;} + { (exit 1); exit 1; }; } + +fi + + + + +echo "$as_me:$LINENO: checking for regcomp in -lregex" >&5 +echo $ECHO_N "checking for regcomp in -lregex... $ECHO_C" >&6 +if test "${ac_cv_lib_regex_regcomp+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lregex $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char regcomp (); +int +main () +{ +regcomp (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_regex_regcomp=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_regex_regcomp=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_regex_regcomp" >&5 +echo "${ECHO_T}$ac_cv_lib_regex_regcomp" >&6 +if test $ac_cv_lib_regex_regcomp = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBREGEX 1 +_ACEOF + + LIBS="-lregex $LIBS" + +fi + + + + + + + has_gnome=false + # Extract the first word of "gnome-config", so it can be a program name with args. +set dummy gnome-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_gnome1+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$gnome1"; then + ac_cv_prog_gnome1="$gnome1" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_gnome1="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +gnome1=$ac_cv_prog_gnome1 +if test -n "$gnome1"; then + echo "$as_me:$LINENO: result: $gnome1" >&5 +echo "${ECHO_T}$gnome1" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_gnome2+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$gnome2"; then + ac_cv_prog_gnome2="$gnome2" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_gnome2="true" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +gnome2=$ac_cv_prog_gnome2 +if test -n "$gnome2"; then + echo "$as_me:$LINENO: result: $gnome2" >&5 +echo "${ECHO_T}$gnome2" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test x$gnome1 = xtrue; then + has_gnome=true + fi + + if test x$gnome2 = xtrue; then + has_gnome=true + fi + + + +if pkg-config --exists gtk+-2.0; then + USING_GNOME2_TRUE= + USING_GNOME2_FALSE='#' +else + USING_GNOME2_TRUE='#' + USING_GNOME2_FALSE= +fi + + + +if test "$has_gnome" = true; then + HAS_GNOME_TRUE= + HAS_GNOME_FALSE='#' +else + HAS_GNOME_TRUE='#' + HAS_GNOME_FALSE= +fi + + + +if test "$host_os" = Linux; then + GNOME_LINUX_TRUE= + GNOME_LINUX_FALSE='#' +else + GNOME_LINUX_TRUE='#' + GNOME_LINUX_FALSE= +fi + + + + + + + +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <$ac_hdr> + +int +main () +{ +if ((DIR *) 0) +return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +_ACEOF + +ac_header_dirent=$ac_hdr; break +fi + +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in dir; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + +fi + +else + echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 +if test "${ac_cv_search_opendir+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_func_search_save_LIBS=$LIBS +ac_cv_search_opendir=no +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="none required" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test "$ac_cv_search_opendir" = no; then + for ac_lib in x; do + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir (); +int +main () +{ +opendir (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_search_opendir="-l$ac_lib" +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + done +fi +LIBS=$ac_func_search_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6 +if test "$ac_cv_search_opendir" != no; then + test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" + +fi + +fi + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + + + + + + + +for ac_header in fcntl.h sys/window.h sys/termios.h unistd.h signal.h floss.h io.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## --------------------------------- ## +## Report this to the cscope lists. ## +## --------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for mode_t" >&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6 +if test "${ac_cv_type_mode_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((mode_t *) 0) + return 0; +if (sizeof (mode_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_mode_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_mode_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6 +if test $ac_cv_type_mode_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define mode_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6 +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((pid_t *) 0) + return 0; +if (sizeof (pid_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_pid_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6 +if test $ac_cv_type_pid_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for sighandler_t" >&5 +echo $ECHO_N "checking for sighandler_t... $ECHO_C" >&6 +if test "${ac_cv_type_sighandler_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#ifdef HAVE_SIGNAL_H +# include <signal.h> +#endif + +int +main () +{ +if ((sighandler_t *) 0) + return 0; +if (sizeof (sighandler_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_sighandler_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_sighandler_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_sighandler_t" >&5 +echo "${ECHO_T}$ac_cv_type_sighandler_t" >&6 + +echo "$as_me:$LINENO: checking for sigsetjmp" >&5 +echo $ECHO_N "checking for sigsetjmp... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <setjmp.h> +int +main () +{ +jmp_buf env; sigsetjmp(env, 1); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SIGSETJMP 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <signal.h> +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + + + + + + +for ac_func in strchr memcpy memset setmode _setmode +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + + +for ac_func in getcwd regcmp regcomp strerror vsnprintf snprintf lstat +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in fixkeypad +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5 +echo $ECHO_N "checking whether lstat dereferences a symlink specified with a trailing slash... $ECHO_C" >&6 +if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + rm -f conftest.sym conftest.file +echo >conftest.file +if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then + if test "$cross_compiling" = yes; then + ac_cv_func_lstat_dereferences_slashed_symlink=no +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_lstat_dereferences_slashed_symlink=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file + +fi +echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 +echo "${ECHO_T}$ac_cv_func_lstat_dereferences_slashed_symlink" >&6 + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + case $LIBOBJS in + "lstat.$ac_objext" | \ + *" lstat.$ac_objext" | \ + "lstat.$ac_objext "* | \ + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; +esac + +fi + +echo "$as_me:$LINENO: checking whether lstat accepts an empty string" >&5 +echo $ECHO_N "checking whether lstat accepts an empty string... $ECHO_C" >&6 +if test "${ac_cv_func_lstat_empty_string_bug+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_lstat_empty_string_bug=yes +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + exit (lstat ("", &sbuf) ? 1 : 0); + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_lstat_empty_string_bug=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_func_lstat_empty_string_bug=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_func_lstat_empty_string_bug" >&5 +echo "${ECHO_T}$ac_cv_func_lstat_empty_string_bug" >&6 +if test $ac_cv_func_lstat_empty_string_bug = yes; then + case $LIBOBJS in + "lstat.$ac_objext" | \ + *" lstat.$ac_objext" | \ + "lstat.$ac_objext "* | \ + *" lstat.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; +esac + + +cat >>confdefs.h <<_ACEOF +#define HAVE_LSTAT_EMPTY_STRING_BUG 1 +_ACEOF + +fi + + +case "$host_os" in + linux*) + +cat >>confdefs.h <<\_ACEOF +#define Linux 1 +_ACEOF + + ;; + netbsd*|freebsd*|darwin*) + +cat >>confdefs.h <<\_ACEOF +#define BSD 1 +_ACEOF + + ;; +esac + + ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile contrib/Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + 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 + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${USING_LEX_TRUE}" && test -z "${USING_LEX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USING_LEX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USING_LEX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAS_CURSES_TRUE}" && test -z "${HAS_CURSES_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAS_CURSES\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAS_CURSES\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${USING_GNOME2_TRUE}" && test -z "${USING_GNOME2_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"USING_GNOME2\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"USING_GNOME2\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${HAS_GNOME_TRUE}" && test -z "${HAS_GNOME_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"HAS_GNOME\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"HAS_GNOME\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GNOME_LINUX_TRUE}" && test -z "${GNOME_LINUX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GNOME_LINUX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GNOME_LINUX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by cscope $as_me 15.6, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +cscope config.status 15.6 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; + "contrib/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.h.in" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@LEX@,$LEX,;t t +s,@LEXLIB@,$LEXLIB,;t t +s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t +s,@USING_LEX_TRUE@,$USING_LEX_TRUE,;t t +s,@USING_LEX_FALSE@,$USING_LEX_FALSE,;t t +s,@YACC@,$YACC,;t t +s,@CURSES_LIBS@,$CURSES_LIBS,;t t +s,@CURSES_INCLUDEDIR@,$CURSES_INCLUDEDIR,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@HAS_CURSES_TRUE@,$HAS_CURSES_TRUE,;t t +s,@HAS_CURSES_FALSE@,$HAS_CURSES_FALSE,;t t +s,@gnome1@,$gnome1,;t t +s,@gnome2@,$gnome2,;t t +s,@USING_GNOME2_TRUE@,$USING_GNOME2_TRUE,;t t +s,@USING_GNOME2_FALSE@,$USING_GNOME2_FALSE,;t t +s,@HAS_GNOME_TRUE@,$HAS_GNOME_TRUE,;t t +s,@HAS_GNOME_FALSE@,$HAS_GNOME_FALSE,;t t +s,@GNOME_LINUX_TRUE@,$GNOME_LINUX_TRUE,;t t +s,@GNOME_LINUX_FALSE@,$GNOME_LINUX_FALSE,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..85d4697 --- /dev/null +++ b/configure.in @@ -0,0 +1,418 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(cscope, 15.6) +AC_CONFIG_SRCDIR([src/crossref.c]) +AM_INIT_AUTOMAKE([1.9]) +AC_CONFIG_HEADERS([config.h:config.h.in]) +AC_PREREQ(2.59) +AC_CANONICAL_HOST + +dnl User specification of lexer +dnl AC_CHECK_LEXER +dnl User specification of yacc +dnl AC_CHECK_YACC + +dnl Checks for programs. +AC_PROG_INSTALL +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, + [Define this if the scanner is run through lex, not flex]) +fi +AC_PROG_YACC + +dnl === BEGIN CURSES CHECK +dnl Curses detection: Munged from Midnight Commander's configure.in +dnl +dnl What it does: +dnl ============= +dnl +dnl - Determine which version of curses is installed on your system +dnl and set the -I/-L/-l compiler entries and add a few preprocessor +dnl symbols +dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that +dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in +dnl Makefile.in's +dnl - Modify the following configure variables (these are the only +dnl curses.m4 variables you can access from within configure.in) +dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if +dnl an ncurses.h that's been renamed to curses.h +dnl is found. +dnl CURSES_LIBS - sets -L and -l's appropriately +dnl CFLAGS - if --with-sco, add -D_SVID3 +dnl has_curses - exports result of tests to rest of configure +dnl +dnl Usage: +dnl ====== +dnl 1) Add lines indicated below to acconfig.h +dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in +dnl 3) Instead of #include <curses.h> you should use the following to +dnl properly locate ncurses or curses header file +dnl +dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +dnl #include <ncurses.h> +dnl #else +dnl #include <curses.h> +dnl #endif +dnl +dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags +dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS +dnl +dnl Notes with automake: +dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from +dnl configure.in +dnl - your Makefile.am can look something like this +dnl ----------------------------------------------- +dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR) +dnl if HAS_CURSES +dnl CURSES_TARGETS=name_of_curses_prog +dnl endif +dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS) +dnl other_programs_SOURCES = blah blah blah +dnl name_of_curses_prog_SOURCES = blah blah blah +dnl other_programs_LDADD = blah +dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS) +dnl ----------------------------------------------- +dnl +dnl +dnl The following lines should be added to acconfig.h: +dnl ================================================== +dnl +dnl /*=== Curses version detection defines ===*/ +dnl /* Found some version of curses that we're going to use */ +dnl #undef HAS_CURSES +dnl +dnl /* Use SunOS SysV curses? */ +dnl #undef USE_SUNOS_CURSES +dnl +dnl /* Use old BSD curses - not used right now */ +dnl #undef USE_BSD_CURSES +dnl +dnl /* Use SystemV curses? */ +dnl #undef USE_SYSV_CURSES +dnl +dnl /* Use Ncurses? */ +dnl #undef USE_NCURSES +dnl +dnl /* If you Curses does not have color define this one */ +dnl #undef NO_COLOR_CURSES +dnl +dnl /* Define if you want to turn on SCO-specific code */ +dnl #undef SCO_FLAVOR +dnl +dnl /* Set to reflect version of ncurses * +dnl * 0 = version 1.* +dnl * 1 = version 1.9.9g +dnl * 2 = version 4.0/4.1 */ +dnl #undef NCURSES_970530 +dnl +dnl /*=== End new stuff for acconfig.h ===*/ +dnl + + +AC_DEFUN([AC_CHECK_CURSES],[ + search_ncurses=true + screen_manager="" + has_curses=false + + CFLAGS=${CFLAGS--O} + + AC_SUBST(CURSES_LIBS) + AC_SUBST(CURSES_INCLUDEDIR) + + AC_ARG_WITH(sco, + [ --with-sco Use this to turn on SCO-specific code],[ + if test x$withval = xyes; then + AC_DEFINE(SCO_FLAVOR, 1, [Define if you want to turn on SCO-specific code]) + CFLAGS="$CFLAGS -D_SVID3" + fi + ]) + + AC_ARG_WITH(sunos-curses, + [ --with-sunos-curses Used to force SunOS 4.x curses],[ + if test x$withval = xyes; then + AC_USE_SUNOS_CURSES + fi + ]) + + AC_ARG_WITH(osf1-curses, + [ --with-osf1-curses Used to force OSF/1 curses],[ + if test x$withval = xyes; then + AC_USE_OSF1_CURSES + fi + ]) + + AC_ARG_WITH(vcurses, + [ --with-vcurses[=incdir] Used to force SysV curses], + if test x$withval != xyes; then + CURSES_INCLUDEDIR="-I$withval" + fi + AC_USE_SYSV_CURSES + ) + + AC_ARG_WITH(ncurses, + [ --with-ncurses[=dir] Compile with ncurses/locate base dir], + if test x$withval = xno ; then + search_ncurses=false + elif test x$withval != xyes ; then + CURSES_LIBS="$LIBS -L$withval/lib -lncurses" + CURSES_INCLUDEDIR="-I$withval/include" + search_ncurses=false + screen_manager="ncurses" + AC_DEFINE(USE_NCURSES, 1, [Use Ncurses?]) + AC_DEFINE(HAS_CURSES, 1, [Found some version of curses that we're going to use]) + has_curses=true + fi + ) + + if $search_ncurses + then + AC_SEARCH_NCURSES() + fi + + +]) + + +AC_DEFUN([AC_USE_SUNOS_CURSES], [ + search_ncurses=false + screen_manager="SunOS 4.x /usr/5include curses" + AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses) + AC_DEFINE(USE_SUNOS_CURSES, 1, [Use SunOS SysV curses?]) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES, 1, [If your Curses does not have color define this one]) + AC_DEFINE(USE_SYSV_CURSES, 1, [Use SystemV curses?]) + CURSES_INCLUDEDIR="-I/usr/5include" + CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a" + AC_MSG_RESULT(Please note that some screen refreshs may fail) +]) + +AC_DEFUN([AC_USE_OSF1_CURSES], [ + AC_MSG_RESULT(Using OSF1 curses) + search_ncurses=false + screen_manager="OSF1 curses" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(NO_COLOR_CURSES) + AC_DEFINE(USE_SYSV_CURSES) + CURSES_LIBS="-lcurses" +]) + +AC_DEFUN([AC_USE_SYSV_CURSES], [ + AC_MSG_RESULT(Using SysV curses) + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_SYSV_CURSES) + search_ncurses=false + screen_manager="SysV/curses" + CURSES_LIBS="-lcurses" +]) + +dnl AC_ARG_WITH(bsd-curses, +dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy], +dnl search_ncurses=false +dnl screen_manager="Ultrix/cursesX" +dnl if test $system = ULTRIX +dnl then +dnl THIS_CURSES=cursesX +dnl else +dnl THIS_CURSES=curses +dnl fi +dnl +dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap" +dnl AC_DEFINE(HAS_CURSES) +dnl has_curses=true +dnl AC_DEFINE(USE_BSD_CURSES) +dnl AC_MSG_RESULT(Please note that some screen refreshs may fail) +dnl AC_MSG_WARN([Use of the bsdcurses extension has some]) +dnl AC_MSG_WARN([display/input problems.]) +dnl AC_MSG_WARN([Reconsider using xcurses]) +dnl) + + +dnl +dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename +dnl +AC_DEFUN([AC_NCURSES], [ + if $search_ncurses + then + if test -f $1/$2 + then + AC_MSG_RESULT(Found ncurses on $1/$2) + CURSES_LIBS="$3" + CURSES_INCLUDEDIR="$4" + search_ncurses=false + screen_manager=$5 + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + fi + fi +]) + +AC_DEFUN([AC_SEARCH_NCURSES], [ + AS_MESSAGE(checking "location of ncurses.h file"...) + + AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include") + AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses") + AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local") + AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses") + + AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses") + + AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses") + + dnl + dnl We couldn't find ncurses, try SysV curses + dnl + if $search_ncurses + then + AC_EGREP_HEADER(init_color, curses.h, + AC_USE_SYSV_CURSES) + AC_EGREP_CPP(USE_NCURSES,[ +#include <curses.h> +#ifdef __NCURSES_H +#undef USE_NCURSES +USE_NCURSES +#endif +],[ + CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES" + AC_DEFINE(HAS_CURSES) + has_curses=true + AC_DEFINE(USE_NCURSES) + search_ncurses=false + screen_manager="ncurses installed as curses" +]) + fi + + dnl + dnl Try SunOS 4.x /usr/5{lib,include} ncurses + dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES + dnl should be replaced by a more fine grained selection routine + dnl + if $search_ncurses + then + if test -f /usr/5include/curses.h + then + AC_USE_SUNOS_CURSES + fi + else + # check for ncurses version, to properly ifdef mouse-fix + AC_MSG_CHECKING(for ncurses version) + ncurses_version=unknown +cat > conftest.$ac_ext <<EOF +[#]line __oline__ "configure" +#include "confdefs.h" +#ifdef RENAMED_NCURSES +#include <curses.h> +#else +#include <ncurses.h> +#endif +#undef VERSION +VERSION:NCURSES_VERSION +EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD() | + egrep "VERSION:" >conftest.out 2>&1; then +changequote(,)dnl + ncurses_version=`cat conftest.out|sed -e 's/^[^"]*"//' -e 's/".*//'` +changequote([,])dnl + fi + rm -rf conftest* + AC_MSG_RESULT($ncurses_version) + case "$ncurses_version" in +changequote(,)dnl + 4.[01]) +changequote([,])dnl + AC_DEFINE(NCURSES_970530,2, + [Set to reflect version of ncurses: + 0 = version 1.* + 1 = version 1.9.9g + 2 = version 4.0/4.1]) + ;; + 1.9.9g) + AC_DEFINE(NCURSES_970530,1) + ;; + 1*) + AC_DEFINE(NCURSES_970530,0) + ;; + esac + fi +]) +dnl === END CURSES CHECK + +AC_CHECK_CURSES +AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) + +dnl Checks for libraries. +dnl Replace `main' with a function in -lcurses: +dnl AC_CHECK_LIB(curses, main) + +AC_CHECK_HEADER(regex.h, [], [ + AC_MSG_ERROR([necessary header <regex.h> not found]) +]) + +dnl Cygwin is a bit peculiar: it has the regcomp() functions, but in a +dnl separate library, so we have to check for that: +AC_CHECK_LIB(regex, regcomp) + +dnl Check for a GNOME installation + +AC_DEFUN([AC_CHECK_GNOME],[ + has_gnome=false + AC_CHECK_PROG(gnome1, gnome-config, true) + AC_CHECK_PROG(gnome2, pkg-config, true) + + if test x$gnome1 = xtrue; then + has_gnome=true + fi + + if test x$gnome2 = xtrue; then + has_gnome=true + fi + + AM_CONDITIONAL(USING_GNOME2, pkg-config --exists gtk+-2.0) + AM_CONDITIONAL(HAS_GNOME, test "$has_gnome" = true) + AM_CONDITIONAL(GNOME_LINUX, test "$host_os" = Linux) +]) + +AC_CHECK_GNOME +dnl Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h sys/window.h sys/termios.h unistd.h signal.h floss.h io.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_MODE_T +AC_TYPE_PID_T +AC_TYPE_SIZE_T +AC_CHECK_TYPE(sighandler_t,[],[],[ +#ifdef HAVE_SIGNAL_H +# include <signal.h> +#endif]) +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. +AC_TYPE_SIGNAL +AC_CHECK_FUNCS(strchr memcpy memset setmode _setmode) +AC_CHECK_FUNCS(getcwd regcmp regcomp strerror vsnprintf snprintf lstat) +AC_CHECK_FUNCS(fixkeypad) +AC_FUNC_LSTAT + +case "$host_os" in + linux*) + AC_DEFINE(Linux, 1, [We're using some variant of Linux]) + ;; + netbsd*|freebsd*|darwin*) + AC_DEFINE(BSD, 1, [We're using a BSD-flavoured Unix]) + ;; +esac + +AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile contrib/Makefile]) +AC_OUTPUT diff --git a/contrib/Makefile.am b/contrib/Makefile.am new file mode 100644 index 0000000..5e9b75f --- /dev/null +++ b/contrib/Makefile.am @@ -0,0 +1,6 @@ +## Process this file with automake to produce Makefile.in + +bin_SCRIPTS = ocs + +EXTRA_DIST = ocs README xcscope webcscope + diff --git a/contrib/Makefile.in b/contrib/Makefile.in new file mode 100644 index 0000000..0951263 --- /dev/null +++ b/contrib/Makefile.in @@ -0,0 +1,328 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = contrib +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binSCRIPT_INSTALL = $(INSTALL_SCRIPT) +SCRIPTS = $(bin_SCRIPTS) +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@ +CURSES_LIBS = @CURSES_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@ +GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@ +HAS_CURSES_FALSE = @HAS_CURSES_FALSE@ +HAS_CURSES_TRUE = @HAS_CURSES_TRUE@ +HAS_GNOME_FALSE = @HAS_GNOME_FALSE@ +HAS_GNOME_TRUE = @HAS_GNOME_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USING_GNOME2_FALSE = @USING_GNOME2_FALSE@ +USING_GNOME2_TRUE = @USING_GNOME2_TRUE@ +USING_LEX_FALSE = @USING_LEX_FALSE@ +USING_LEX_TRUE = @USING_LEX_TRUE@ +VERSION = @VERSION@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +gnome1 = @gnome1@ +gnome2 = @gnome2@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +bin_SCRIPTS = ocs +EXTRA_DIST = ocs README xcscope webcscope +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu contrib/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu contrib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + if test -f $$d$$p; then \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " $(binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(bindir)/$$f"; \ + else :; fi; \ + done + +uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(SCRIPTS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binSCRIPTS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binSCRIPTS uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-binSCRIPTS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-info-am + +# 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. +.NOEXPORT: diff --git a/contrib/README b/contrib/README new file mode 100644 index 0000000..9bd66c6 --- /dev/null +++ b/contrib/README @@ -0,0 +1,11 @@ +Contributed addons and wrappers for cscope +$Id: README,v 1.3 2001/07/02 20:57:45 petr Exp $ + +ocs - wrapper for cscope providing database generation through recursive + directory set (among other things) - docced in script itself. + contributed from SCO osr5. + +webcscope - a web cgi interface to cscope. Contributed by Ragho Mahalingam, + using code from Dmitry Obukhovi and Steven E. Brenner. + +xcscope - An (X)Emacs interface to cscope. diff --git a/contrib/ocs b/contrib/ocs new file mode 100755 index 0000000..736de94 --- /dev/null +++ b/contrib/ocs @@ -0,0 +1,308 @@ +#!/bin/sh +# $Id: ocs,v 1.4 2004/06/21 18:13:21 broeker Exp $ +# This utility maintains the database for cscope on a recursive dir set +# Author: donwo Tue Jun 25 15:36:39 PDT 1996 +# Modified: hops Jan 2000 chg defaults to not update if files exist and force +# +# These comments ARE the manual. What more do you really need? +# if using unadorned cscope with this use cscope -d so not trash db +# cscope -L -0 <ptn> - to display ptn matches on stdout +# +# The lists of files are kept in two forms: +# TMP cscope.tmplst +# The list generated by this program +# This list will be updated each time this program +# is executed. +# +# LST cscope.lst +# The fixed list generated by some other process +# This list will be used, if found, rather than +# the TMP form generated here. +# +# CSD cscope.csd +# The fixed list generated by some other process +# This list will be used, if found, rather than +# the LST or TMP forms. CSD differs from LST in +# that the CSD list is used where the source files +# change only seldom. Cscope is requested not to +# check for changed files. This can be +# significantly faster on large source trees. +# +# INC cscope.inc +# This is a list of additional directories +# in which to search for include files. +# +# Three hierarchies of libraries are supported: +# Local In the current directory ./ +# This is most useful for transient projects or +# where the information is of no use to others on +# the system. This type is NOT usable on source +# directories that are read-only. +# Home In users home directory $HOME/lib/cs/`pwd` +# This is good for items that seldom change but are +# of use only the the current user. This type is +# usable on source directories that are read-only. +# System In a global system directory $SYSDIR/`pwd` +# This is for items that are of interest to all accounts. +# This option is not available unless the system directory +# is writable by the current user. This type is usable +# on source directories that are read-only. +# +# If a shell script named ./cscope.rc is found and is +# executable, the execution of it will be included within this +# script after defaults_set/cmdline_parse and locating the +# database. +# +# Command line options: +# -x set shell debugging +# -f force +# o Do not ask about regenerating TMP. Just do it. +# o Allow cscope to regenerate libraries for CSD lists. +# -q Tell cscope to build an inverted index for quick +# symbol searching. There is a SIGNIFICANT +# increase in speed with this option however the +# disk space used is doubled. Once the quick +# database is generated, cs will detect the files +# and continue to use them. +# -d Do not regenerate. Intended for cscope sub-tasks. +# -u Update/regenerate. + +# +# Here is where we put things + +CSCOPE=cscope +HOMEDIR=${HOME}/lib/cs + +#set the default value for SYSDIR +if [ -z "${SYSDIR}" ]; then + SYSDIR=/usr/local/lib/cs + echo setting default sysdir +fi + +#check that SYSDIR exists +if [ ! -d ${SYSDIR} ]; then + echo -n $SYSDIR does not exist. + echo Please create the directory and set SYSDIR appropriately + exit +fi + +# Check that cscope is in PATH +type cscope 1>/dev/null 2>&1 + +if [ $? -ne 0 ] +then + echo "ERROR: cscope is not in \$PATH" >&2 + echo " Please set \$PATH correctly or make sure cscope is installed" >&2 + exit 1 +fi + +# popup editor +#XCS_EDITOR=${HOME}/bin/x_cscope_editor +XCS_EDITOR=${HOME}/bin/xme +if [ -n "$DISPLAY" -a -x ${XCS_EDITOR} ] +then + EDITOR=${XCS_EDITOR} + export EDITOR +fi +unset XCS_EDITOR + +# +# Misc defaults + +#FORCE=N +#NOUPDATE= +FORCE=Y # hops - default to force rather than query +NOUPDATE=-d # hops - default to no update if files already exist +QUICK= +SPECDEST= # hops - query for files + +# +# Parse the command line + +set -- `getopt xfqdu $*` + +if [ $? -ne 0 ] +then + echo "Use: cs [-x] [-f] [-q] [-u]" >&2 + echo " -x debug on " >&2 + echo " -q quick Index - faster search but larger index" >&2 + echo " -f ask about about regeneration" >&2 + echo " -d don't update database (default)" >&2 + echo " -u update database" >&2 + echo " -s specify where files go" >&2 + exit 1 +fi + +for arg +do + case $arg in + -x ) set -x; shift ;; + -f ) FORCE=N; NOUPDATE=; shift;; + -q ) QUICK=-q; shift ;; + -d ) NOUPDATE=-d; shift ;; + -u ) NOUPDATE=; shift ;; + -s ) SPECDEST=Y; shift ;; + esac +done + +# +# Here is the security hole. Execute whatever is needed for +# this project. A per-project setup script may be available. + +[ -x ./cscope.rc ] && { + . ./cscope.rc +} + +# +# We look hard for appropriate files to scope. We ignore items +# containing "SCCS" assuming that these are directories of +# source code control data. + +create_list() +{ + LIST=$1 + + if [ -f ${LIST} ] + then + [ -n "${NOUPDATE}" ] && return + + if [ "${FORCE}" != "Y" ] + then + echo "\n${LIST}" + echo "Update the library? <(Y)es, (N)o, (Q)uit> [n] \c" + read x y + case $x in + [Yy]* ) ;; + [Qq]* ) exit 1 ;; + *) return ;; + esac + fi + echo "Updating library:\n ${LIST} \c" + else + echo "Creating library:\n ${LIST} \c" + fi + + ( + find . -follow -type f \( -name \*.[sScChHlyG] -o \ + -name \*.asm -o \ + -name \*.cc -o \ + -name \*.cxx -o \ + -name \*.ccP -o \ + -name \*.hP -o \ + -name \*.inc -o \ + -name \*.ed -o \ + -name vuifile -o \ + -name Gensymvals -o \ + -name \[mM\]ake\* \) \ + -print + ) | grep -v SCCS | sort -u > ${LIST} + + echo "\n`cat ${LIST} | wc -l` files listed" +} + +# +# Expand the include file list into command line arguments + +exp_inc() +{ + theInc=$1 + + if [ -s "${theInc}" ] + then + for i in `cat ${theInc}` + do + echo "-I $i \c" + done + fi +} + +# +# This routine does not return to the caller + +do_cscope() +{ + LIST=$1 + CSLIB=$2 + INC=$3 + shift;shift;shift + ARGS="$*" + + INCARGS=`exp_inc ${INC}` + + echo "exec cscope" + exec $CSCOPE ${ARGS} -p 2 ${INCARGS} -i ${LIST} -f ${CSLIB} + echo "exec of $CSCOPE failed" >&2 + exit 1 +} + +# +# If we have existing libraries, we should use them. +std_libs() +{ + DIR=$1 + OUT=${DIR}/cscope.out + LST=${DIR}/cscope.lst + CSD=${DIR}/cscope.csd + TMP=${DIR}/cscope.tmplst + INC=${DIR}/cscope.inc + QCK=${DIR}/cscope.out.po + + [ -s ${QCK} ] && QUICK=-q + + [ -f ${CSD} ] && { + if [ "${FORCE}" = "Y" ] + then + do_cscope ${CSD} ${OUT} ${INC} ${QUICK} + else + do_cscope ${CSD} ${OUT} ${INC} ${QUICK} -d + fi + } + + [ -f ${LST} ] && do_cscope ${LST} ${OUT} ${INC} ${QUICK} ${NOUPDATE} + + [ -f ${TMP} ] && { + create_list ${TMP} + do_cscope ${TMP} ${OUT} ${INC} ${QUICK} ${NOUPDATE} + } +} + +# +# ######## main() ####### + +umask 0 +PWD=`pwd` + +umask 02 + +# +# Check for existing libraries + +std_libs $PWD +std_libs ${HOMEDIR}$PWD +std_libs ${SYSDIR}$PWD + +# +# We may need to create one for this area + +DIR=$PWD +if [ ! -n "${NOUPDATE}" -o -n "${SPECDEST}" ] ; then +echo "Create new library? <(L)ocal, (H)ome, (S)ystem, (Q)uit> [q] \c" +read x y +case $x in + [Ll]* ) DIR=$PWD ;; + [Hh]* ) DIR=${HOMEDIR}$PWD ;; + [Ss]* ) DIR=${SYSDIR}$PWD ;; + *) exit 1 ;; +esac +fi +[ -d $DIR ] || { + mkdir -p $DIR || exit $? +} + +OUT=${DIR}/cscope.out +TMP=${DIR}/cscope.tmplst +INC=${DIR}/cscope.inc + +create_list ${TMP} +do_cscope ${TMP} ${OUT} ${INC} ${QUICK} + diff --git a/contrib/webcscope/CVS/Entries b/contrib/webcscope/CVS/Entries new file mode 100644 index 0000000..998a8cd --- /dev/null +++ b/contrib/webcscope/CVS/Entries @@ -0,0 +1,7 @@ +D/icons//// +/INSTALL/1.1/Fri Jun 29 14:20:16 2001// +/LICENSE/1.1/Fri Jun 29 14:20:16 2001// +/TODO/1.1/Fri Jun 29 14:20:16 2001// +/cgi-lib.pl/1.1/Fri Jun 29 14:20:16 2001// +/cscope/1.1/Fri Jun 29 14:20:16 2001// +/hilite.c/1.1/Fri Jun 29 14:20:16 2001// diff --git a/contrib/webcscope/CVS/Repository b/contrib/webcscope/CVS/Repository new file mode 100644 index 0000000..1868bd7 --- /dev/null +++ b/contrib/webcscope/CVS/Repository @@ -0,0 +1 @@ +cscope/contrib/webcscope diff --git a/contrib/webcscope/CVS/Root b/contrib/webcscope/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/contrib/webcscope/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/contrib/webcscope/INSTALL b/contrib/webcscope/INSTALL new file mode 100644 index 0000000..0ea0d9c --- /dev/null +++ b/contrib/webcscope/INSTALL @@ -0,0 +1,31 @@ +WebCScope Installation + +Quick Install + +0. Create a directory called cscope under your /cgi-bin (virtual) directory. + Copy all the files in the distribution to this directory. + +1. Edit the 'cscope' file and change the following items: + - Location to the perl interpreter + - Location of the cscope database and other modifiable parameters + - Feedback name and email + - Location of the syntax highlighter, if you wish to use it + +2. Syntax highlighter + - The syntax highlighter must be built if you decide to use it. If you + do not want syntax highlighting, you can ignore this step and set the + highlighter to /bin/cat. + - Compile 'hilite.c' using 'gcc -o hilite hilite.c' + +3. Icons + - Copy the images from the icons directory into the /icons (virtual) + directory on the web server. You can also replace these images with + whatever you choose. + +4. Organizing your CScope databases + - WebCScope supports multiple databases in $cscopedir + - Create a directory for each project or sub-source in $cscopedir and, + generate your cscope database using the following commands. + - find /some/source/dir -name '*.[chyls]' -print > cscope.files + - cscope -b -q + - Repeat the above step for each database you wish to create diff --git a/contrib/webcscope/LICENSE b/contrib/webcscope/LICENSE new file mode 100644 index 0000000..5b6e7c6 --- /dev/null +++ b/contrib/webcscope/LICENSE @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/contrib/webcscope/TODO b/contrib/webcscope/TODO new file mode 100644 index 0000000..4e61555 --- /dev/null +++ b/contrib/webcscope/TODO @@ -0,0 +1,5 @@ + +- Better error checking and the like +- Add a more robust cookie mechanism +- More efficient way of searching 'all' databases +- Fix bugs diff --git a/contrib/webcscope/cgi-lib.pl b/contrib/webcscope/cgi-lib.pl new file mode 100644 index 0000000..97d0caa --- /dev/null +++ b/contrib/webcscope/cgi-lib.pl @@ -0,0 +1,471 @@ +# Perl Routines to Manipulate CGI input +# cgi-lib@pobox.com +# $Id: cgi-lib.pl,v 1.1 2001/06/29 14:20:16 petr Exp $ +# +# Copyright (c) 1993-1999 Steven E. Brenner +# Unpublished work. +# Permission granted to use and modify this library so long as the +# copyright above is maintained, modifications are documented, and +# credit is given for any use of the library. +# +# Thanks are due to many people for reporting bugs and suggestions + +# For more information, see: +# http://cgi-lib.stanford.edu/cgi-lib/ + +$cgi_lib'version = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/); + + +# Parameters affecting cgi-lib behavior +# User-configurable parameters affecting file upload. +$cgi_lib'maxdata = 131072; # maximum bytes to accept via POST - 2^17 +$cgi_lib'writefiles = 0; # directory to which to write files, or + # 0 if files should not be written +$cgi_lib'filepre = "cgi-lib"; # Prefix of file names, in directory above + +# Do not change the following parameters unless you have special reasons +$cgi_lib'bufsize = 8192; # default buffer size when reading multipart +$cgi_lib'maxbound = 100; # maximum boundary length to be encounterd +$cgi_lib'headerout = 0; # indicates whether the header has been printed + + +# ReadParse +# Reads in GET or POST data, converts it to unescaped text, and puts +# key/value pairs in %in, using "\0" to separate multiple selections + +# Returns >0 if there was input, 0 if there was no input +# undef indicates some failure. + +# Now that cgi scripts can be put in the normal file space, it is useful +# to combine both the form and the script in one place. If no parameters +# are given (i.e., ReadParse returns FALSE), then a form could be output. + +# If a reference to a hash is given, then the data will be stored in that +# hash, but the data from $in and @in will become inaccessable. +# If a variable-glob (e.g., *cgi_input) is the first parameter to ReadParse, +# information is stored there, rather than in $in, @in, and %in. +# Second, third, and fourth parameters fill associative arrays analagous to +# %in with data relevant to file uploads. + +# If no method is given, the script will process both command-line arguments +# of the form: name=value and any text that is in $ENV{'QUERY_STRING'} +# This is intended to aid debugging and may be changed in future releases + +sub ReadParse { + # Disable warnings as this code deliberately uses local and environment + # variables which are preset to undef (i.e., not explicitly initialized) + local ($perlwarn); + $perlwarn = $^W; + $^W = 0; + + local (*in) = shift if @_; # CGI input + local (*incfn, # Client's filename (may not be provided) + *inct, # Client's content-type (may not be provided) + *insfn) = @_; # Server's filename (for spooled files) + local ($len, $type, $meth, $errflag, $cmdflag, $got, $name); + + binmode(STDIN); # we need these for DOS-based systems + binmode(STDOUT); # and they shouldn't hurt anything else + binmode(STDERR); + + # Get several useful env variables + $type = $ENV{'CONTENT_TYPE'}; + $len = $ENV{'CONTENT_LENGTH'}; + $meth = $ENV{'REQUEST_METHOD'}; + + if ($len > $cgi_lib'maxdata) { #' + &CgiDie("cgi-lib.pl: Request to receive too much data: $len bytes\n"); + } + + if (!defined $meth || $meth eq '' || $meth eq 'GET' || + $meth eq 'HEAD' || + $type eq 'application/x-www-form-urlencoded') { + local ($key, $val, $i); + + # Read in text + if (!defined $meth || $meth eq '') { + $in = $ENV{'QUERY_STRING'}; + $cmdflag = 1; # also use command-line options + } elsif($meth eq 'GET' || $meth eq 'HEAD') { + $in = $ENV{'QUERY_STRING'}; + } elsif ($meth eq 'POST') { + if (($got = read(STDIN, $in, $len) != $len)) + {$errflag="Short Read: wanted $len, got $got\n";}; + } else { + &CgiDie("cgi-lib.pl: Unknown request method: $meth\n"); + } + + @in = split(/[&;]/,$in); + push(@in, @ARGV) if $cmdflag; # add command-line parameters + + foreach $i (0 .. $#in) { + # Convert plus to space + $in[$i] =~ s/\+/ /g; + + # Split into key and value. + ($key, $val) = split(/=/,$in[$i],2); # splits on the first =. + + # Convert %XX from hex numbers to alphanumeric + $key =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; + $val =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge; + + # Associate key and value + $in{$key} .= "\0" if (defined($in{$key})); # \0 is the multiple separator + $in{$key} .= $val; + } + + } elsif ($ENV{'CONTENT_TYPE'} =~ m#^multipart/form-data#) { + # for efficiency, compile multipart code only if needed +$errflag = !(eval <<'END_MULTIPART'); + + local ($buf, $boundary, $head, @heads, $cd, $ct, $fname, $ctype, $blen); + local ($bpos, $lpos, $left, $amt, $fn, $ser); + local ($bufsize, $maxbound, $writefiles) = + ($cgi_lib'bufsize, $cgi_lib'maxbound, $cgi_lib'writefiles); + + + # The following lines exist solely to eliminate spurious warning messages + $buf = ''; + + ($boundary) = $type =~ /boundary="([^"]+)"/; #"; # find boundary + ($boundary) = $type =~ /boundary=(\S+)/ unless $boundary; + &CgiDie ("Boundary not provided: probably a bug in your server") + unless $boundary; + $boundary = "--" . $boundary; + $blen = length ($boundary); + + if ($ENV{'REQUEST_METHOD'} ne 'POST') { + &CgiDie("Invalid request method for multipart/form-data: $meth\n"); + } + + if ($writefiles) { + local($me); + stat ($writefiles); + $writefiles = "/tmp" unless -d _ && -w _; + # ($me) = $0 =~ m#([^/]*)$#; + $writefiles .= "/$cgi_lib'filepre"; + } + + # read in the data and split into parts: + # put headers in @in and data in %in + # General algorithm: + # There are two dividers: the border and the '\r\n\r\n' between + # header and body. Iterate between searching for these + # Retain a buffer of size(bufsize+maxbound); the latter part is + # to ensure that dividers don't get lost by wrapping between two bufs + # Look for a divider in the current batch. If not found, then + # save all of bufsize, move the maxbound extra buffer to the front of + # the buffer, and read in a new bufsize bytes. If a divider is found, + # save everything up to the divider. Then empty the buffer of everything + # up to the end of the divider. Refill buffer to bufsize+maxbound + # Note slightly odd organization. Code before BODY: really goes with + # code following HEAD:, but is put first to 'pre-fill' buffers. BODY: + # is placed before HEAD: because we first need to discard any 'preface,' + # which would be analagous to a body without a preceeding head. + + $left = $len; + PART: # find each part of the multi-part while reading data + while (1) { + die $@ if $errflag; + + $amt = ($left > $bufsize+$maxbound-length($buf) + ? $bufsize+$maxbound-length($buf): $left); + $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); + die "Short Read: wanted $amt, got $got\n" if $errflag; + $left -= $amt; + + $in{$name} .= "\0" if defined $in{$name}; + $in{$name} .= $fn if $fn; + + $name=~/([-\w]+)/; # This allows $insfn{$name} to be untainted + if (defined $1) { + $insfn{$1} .= "\0" if defined $insfn{$1}; + $insfn{$1} .= $fn if $fn; + } + + BODY: + while (($bpos = index($buf, $boundary)) == -1) { + if ($left == 0 && $buf eq '') { + foreach $value (values %insfn) { + unlink(split("\0",$value)); + } + &CgiDie("cgi-lib.pl: reached end of input while seeking boundary " . + "of multipart. Format of CGI input is wrong.\n"); + } + die $@ if $errflag; + if ($name) { # if no $name, then it's the prologue -- discard + if ($fn) { print FILE substr($buf, 0, $bufsize); } + else { $in{$name} .= substr($buf, 0, $bufsize); } + } + $buf = substr($buf, $bufsize); + $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf); + $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); + die "Short Read: wanted $amt, got $got\n" if $errflag; + $left -= $amt; + } + if (defined $name) { # if no $name, then it's the prologue -- discard + if ($fn) { print FILE substr($buf, 0, $bpos-2); } + else { $in {$name} .= substr($buf, 0, $bpos-2); } # kill last \r\n + } + close (FILE); + last PART if substr($buf, $bpos + $blen, 2) eq "--"; + substr($buf, 0, $bpos+$blen+2) = ''; + $amt = ($left > $bufsize+$maxbound-length($buf) + ? $bufsize+$maxbound-length($buf) : $left); + $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); + die "Short Read: wanted $amt, got $got\n" if $errflag; + $left -= $amt; + + + undef $head; undef $fn; + HEAD: + while (($lpos = index($buf, "\r\n\r\n")) == -1) { + if ($left == 0 && $buf eq '') { + foreach $value (values %insfn) { + unlink(split("\0",$value)); + } + &CgiDie("cgi-lib: reached end of input while seeking end of " . + "headers. Format of CGI input is wrong.\n$buf"); + } + die $@ if $errflag; + $head .= substr($buf, 0, $bufsize); + $buf = substr($buf, $bufsize); + $amt = ($left > $bufsize ? $bufsize : $left); #$maxbound==length($buf); + $errflag = (($got = read(STDIN, $buf, $amt, length($buf))) != $amt); + die "Short Read: wanted $amt, got $got\n" if $errflag; + $left -= $amt; + } + $head .= substr($buf, 0, $lpos+2); + push (@in, $head); + @heads = split("\r\n", $head); + ($cd) = grep (/^\s*Content-Disposition:/i, @heads); + ($ct) = grep (/^\s*Content-Type:/i, @heads); + + ($name) = $cd =~ /\bname="([^"]+)"/i; #"; + ($name) = $cd =~ /\bname=([^\s:;]+)/i unless defined $name; + + ($fname) = $cd =~ /\bfilename="([^"]*)"/i; #"; # filename can be null-str + ($fname) = $cd =~ /\bfilename=([^\s:;]+)/i unless defined $fname; + $incfn{$name} .= (defined $in{$name} ? "\0" : "") . + (defined $fname ? $fname : ""); + + ($ctype) = $ct =~ /^\s*Content-type:\s*"([^"]+)"/i; #"; + ($ctype) = $ct =~ /^\s*Content-Type:\s*([^\s:;]+)/i unless defined $ctype; + $inct{$name} .= (defined $in{$name} ? "\0" : "") . $ctype; + + if ($writefiles && defined $fname) { + $ser++; + $fn = $writefiles . ".$$.$ser"; + open (FILE, ">$fn") || &CgiDie("Couldn't open $fn\n"); + binmode (FILE); # write files accurately + } + substr($buf, 0, $lpos+4) = ''; + undef $fname; + undef $ctype; + } + +1; +END_MULTIPART + if ($errflag) { + local ($errmsg, $value); + $errmsg = $@ || $errflag; + foreach $value (values %insfn) { + unlink(split("\0",$value)); + } + &CgiDie($errmsg); + } else { + # everything's ok. + } + } else { + &CgiDie("cgi-lib.pl: Unknown Content-type: $ENV{'CONTENT_TYPE'}\n"); + } + + # no-ops to avoid warnings + $insfn = $insfn; + $incfn = $incfn; + $inct = $inct; + + $^W = $perlwarn; + + return ($errflag ? undef : scalar(@in)); +} + + +# PrintHeader +# Returns the magic line which tells WWW that we're an HTML document + +sub PrintHeader { + return "Content-type: text/html\n\n"; +} + + +# HtmlTop +# Returns the <head> of a document and the beginning of the body +# with the title and a body <h1> header as specified by the parameter + +sub HtmlTop +{ + local ($title) = @_; + + return <<END_OF_TEXT; +<html> +<head> +<title>$title</title> +</head> +<body> +<h1>$title</h1> +END_OF_TEXT +} + + +# HtmlBot +# Returns the </body>, </html> codes for the bottom of every HTML page + +sub HtmlBot +{ + return "</body>\n</html>\n"; +} + + +# SplitParam +# Splits a multi-valued parameter into a list of the constituent parameters + +sub SplitParam +{ + local ($param) = @_; + local (@params) = split ("\0", $param); + return (wantarray ? @params : $params[0]); +} + + +# MethGet +# Return true if this cgi call was using the GET request, false otherwise + +sub MethGet { + return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "GET"); +} + + +# MethPost +# Return true if this cgi call was using the POST request, false otherwise + +sub MethPost { + return (defined $ENV{'REQUEST_METHOD'} && $ENV{'REQUEST_METHOD'} eq "POST"); +} + + +# MyBaseUrl +# Returns the base URL to the script (i.e., no extra path or query string) +sub MyBaseUrl { + local ($ret, $perlwarn); + $perlwarn = $^W; $^W = 0; + $ret = 'http://' . $ENV{'SERVER_NAME'} . + ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . + $ENV{'SCRIPT_NAME'}; + $^W = $perlwarn; + return $ret; +} + + +# MyFullUrl +# Returns the full URL to the script (i.e., with extra path or query string) +sub MyFullUrl { + local ($ret, $perlwarn); + $perlwarn = $^W; $^W = 0; + $ret = 'http://' . $ENV{'SERVER_NAME'} . + ($ENV{'SERVER_PORT'} != 80 ? ":$ENV{'SERVER_PORT'}" : '') . + $ENV{'SCRIPT_NAME'} . $ENV{'PATH_INFO'} . + (length ($ENV{'QUERY_STRING'}) ? "?$ENV{'QUERY_STRING'}" : ''); + $^W = $perlwarn; + return $ret; +} + + +# MyURL +# Returns the base URL to the script (i.e., no extra path or query string) +# This is obsolete and will be removed in later versions +sub MyURL { + return &MyBaseUrl; +} + + +# CgiError +# Prints out an error message which which containes appropriate headers, +# markup, etcetera. +# Parameters: +# If no parameters, gives a generic error message +# Otherwise, the first parameter will be the title and the rest will +# be given as different paragraphs of the body + +sub CgiError { + local (@msg) = @_; + local ($i,$name); + + if (!@msg) { + $name = &MyFullUrl; + @msg = ("Error: script $name encountered fatal error\n"); + }; + + if (!$cgi_lib'headerout) { #') + print &PrintHeader; + print "<html>\n<head>\n<title>$msg[0]</title>\n</head>\n<body>\n"; + } + print "<h1>$msg[0]</h1>\n"; + foreach $i (1 .. $#msg) { + print "<p>$msg[$i]</p>\n"; + } + + $cgi_lib'headerout++; +} + + +# CgiDie +# Identical to CgiError, but also quits with the passed error message. + +sub CgiDie { + local (@msg) = @_; + &CgiError (@msg); + die @msg; +} + + +# PrintVariables +# Nicely formats variables. Three calling options: +# A non-null associative array - prints the items in that array +# A type-glob - prints the items in the associated assoc array +# nothing - defaults to use %in +# Typical use: &PrintVariables() + +sub PrintVariables { + local (*in) = @_ if @_ == 1; + local (%in) = @_ if @_ > 1; + local ($out, $key, $output); + + $output = "\n<dl compact>\n"; + foreach $key (sort keys(%in)) { + foreach (split("\0", $in{$key})) { + ($out = $_) =~ s/\n/<br>\n/g; + $output .= "<dt><b>$key</b>\n <dd>:<i>$out</i>:<br>\n"; + } + } + $output .= "</dl>\n"; + + return $output; +} + +# PrintEnv +# Nicely formats all environment variables and returns HTML string +sub PrintEnv { + &PrintVariables(*ENV); +} + + +# The following lines exist only to avoid warning messages +$cgi_lib'writefiles = $cgi_lib'writefiles; +$cgi_lib'bufsize = $cgi_lib'bufsize ; +$cgi_lib'maxbound = $cgi_lib'maxbound; +$cgi_lib'version = $cgi_lib'version; +$cgi_lib'filepre = $cgi_lib'filepre; + +1; #return true + diff --git a/contrib/webcscope/cscope b/contrib/webcscope/cscope new file mode 100755 index 0000000..7d98fce --- /dev/null +++ b/contrib/webcscope/cscope @@ -0,0 +1,446 @@ +#!/bin/perl + +# $Id: cscope,v 1.1 2001/06/29 14:20:16 petr Exp $ +# +# WebCscope: A web interface to the cscope application +# Copyright (C) 2001, Ragho Mahalingam <ragho@mahalingam.com> +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Change History: +# +# $Log: cscope,v $ +# Revision 1.1 2001/06/29 14:20:16 petr +# Added webcscope to contribs. +# +# Revision 1.3.4.1 2001/02/05 15:14:34 rmahalin +# initial release with some bug fixes +# +# Revision 1.3.3.1 2001/01/22 22:21:23 rmahalin +# added multi-database support +# fixed cookie support for trivial functions; removed global trivials +# added syntax highlighting for files displayed on browser +# +# Revision 1.3.1.1 2001/01/11 22:17:30 rmahalin +# added direct download with mime-type 'text/c-source' and made cosmetic changes +# +# Revision 1.3 2001/01/11 21:36:39 rmahalin +# *** empty log message *** +# +# Revision 1.2 2001/01/11 21:34:13 rmahalin +# incorporated draft feedback changes +# +# Revision 1.1 2001/01/11 21:19:32 rmahalin +# Initial revision +# + +require "cgi-lib.pl"; + +# current code version being used +$version = "iSOS 2.5/int16"; +# full path to the cscope binary +$cscopecmd = "/usr/global/bin/cscope"; +# cscope working directory, where all the in/out and db files are stored +$cscopedir = "/usr/local/cscope"; +# trivial functions not to display, one per line in the trivs file +$trivs = "/usr/local/htdocs/cscope/trivials"; +# temporary storage directory +$tmpdir = "/tmp"; +$tmpinfile = $tmpdir . "/cscopein.$$"; +$tmpoutfile = $tmpdir . "/cscopeout.$$"; +$showfile = $tmpdir . "/showfile.$$"; +# C syntax highlighting application or uncomment the line beneath to just cat +#$hiliter = "/bin/cat"; +$hiliter = "/usr/local/cgi-bin/cscope/hilite"; +($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time+1000000); +$cookie_exp = sprintf("%s %02d-%s-%s %02d:%02d:%02d GMT", $wday, $mday, $mon, $year, $hour, $min, $sec); + +# standard images, from the apache distribution +$img{openfile} = "/icons/folder.gif"; +$img{downloadfile} = "/icons/folder.open.gif"; +$img{csymbol} = "/icons/c.gif"; +$img{upfunc} = "/icons/up.gif"; +$img{downfunc} = "/icons/down.gif"; +$img{globalfunc} = "/icons/world2.gif"; +$img{trashfunc} = "/icons/bomb.gif"; +$img{untrashfunc} = "/icons/back.gif"; +$img{back} = "/icons/left.gif"; + +# feedback details +$comment{name} = "Ragho Mahalingam"; +$comment{email} = "ragho\@mahalingam.com"; + +# operations allowed +@oper = ( "Find this C symbol", +"Find this global symbol", +"Find functions called by", +"Find functions calling", +"Find this text string", +"---------------------", +"Find this egrep pattern", +"Find this file", +"Find files #including this file" ); + +# -- removed global trivial function list in favor of customized trivials +#open(TRIVIAL_FUNC, $trivs); +#@trivial = <TRIVIAL_FUNC>; +#close(TRIVIAL_FUNC); +@trivial = (); + +MAIN: + +{ + $starttime = time; + + if (&ReadParse(*input)) { + &ProcessCookie; + &ProcessForm; + } else { + &PrintForm; + } +} + +sub ProcessCookie { + + if ( defined $ENV{HTTP_COOKIE} ) { + ($var, $val) = split('=',$ENV{HTTP_COOKIE}); + $Cookie{$var} = $val; + if ( defined $Cookie{'cs-trivf'} ) { + # do nothing, else initialize it to null + } else { + $Cookie{'cs-trivf'} = "defined"; + } + @loc_trivial = split(',', $Cookie{'cs-trivf'}); + @trivial = ( @loc_trivial ); + + } +} + +sub ProcessTrashForm { + + if ( defined $input{'trash'} ) { + @trivial = (@trivial, $input{'func'}); + } else { + @tmptriv = (); + for ($i=0; $i <= $#trivial; $i++) { + $fhash = unpack('H*', $input{'func'}); + $thash = unpack('H*', $trivial[$i]); + if ( $fhash != $thash ) { + @tmptriv = ( @tmptriv, $trivial[$i] ); + } + } + @trivial = @tmptriv; + } + + $Cookie{'cs-trivf'} = join(',',@trivial); + + print "Content-type: text/html\n"; + print "Set-Cookie: cs-trivf=$Cookie{'cs-trivf'}; path=$ENV{SCRIPT_NAME}; expires $cookie_exp\n\n"; + print &HtmlTop("Your WebCScope Trivial Functions"); + print "<ul>"; + for ($i=0; $i <= $#trivial; $i++) { + print "<li><a href=\"$ENV{SCRIPT_NAME}?untrash=&func=$trivial[$i]\"><img src=$img{untrashfunc} border=0></a> $trivial[$i]"; + } + print "</ul><hr>\n"; + print "Click <a href=\"#\" onClick=\"history.back();\"><img src=$img{back} border=0></a> to go back.\n"; + print &HtmlBot; + +} + +sub ProcessForm { + + chdir $cscopedir; + opendir(DIRLIST,$cscopedir); + @dirlist = readdir(DIRLIST); + closedir(DIRLIST); + + if ( $input{'db'} eq "all" ) { + @csdirs = (); + for ($i=0; $i <= $#dirlist; $i++ ) { + if ( ($dirlist[$i] ne ".") && ($dirlist[$i] ne "..") && ( -d $dirlist[$i] ) ) { + @csdirs = ( @csdirs, $dirlist[$i] ); + } + } + } else { + @csdirs = ( $input{'db'} ); + } + + $op = $input{'op'}; + $arg = $input{'arg'}; + $shtriv = $input{'triv'}; + $db = $input{'db'}; + + if ( defined $input{'fshow'} ) { &ShowFileForm; exit; } + if ( defined $input{'load'} ) { &DownloadFileForm; exit; } + if ( (defined $input{'trash'}) || (defined $input{'untrash'}) ) { + &ProcessTrashForm; exit; } + + print &PrintHeader; + print &HtmlTop ("WebCscope"); + print <<ENDOFHDR; +<h3>Instructions</h3><p> +<ul> +<li><img src=$img{csymbol}> will find a symbol with this name<br> +<li><img src=$img{upfunc}> will find functions <i>calling</i> this function<br> +<li><img src=$img{downfunc}> will find functions <i>called</i> by this +function<br> +<li><img src=$img{globalfunc}> will locate a global definition of this name<br> +<li><img src=$img{openfile}> will display this file and highlight +the fragment line<br> +<li><img src=$img{downloadfile}> will download this file with mimetype "text/c-source"<br> +<li><img src=$img{trashfunc}> will add this symbol/function to your trivial list<br> +</ul> +<p><hr> +ENDOFHDR + + foreach $index ( 0 .. $#csdirs ) { + + unlink $tmpinfile, $tmpoutfile; + open(CSCOPEIN, ">$tmpinfile"); + print CSCOPEIN "$op$arg\n"; + print CSCOPEIN "exit\n"; + close(CSCOPEIN); + + $dbdir = $cscopedir . "/" . $csdirs[$index]; + chdir($dbdir); + + $syscmd = "cd $dbdir; $cscopecmd -d -l < $tmpinfile > $tmpoutfile;"; + system($syscmd); + + $count = 1; + open(CSCOPEIN, "$tmpoutfile"); + + $line = <CSCOPEIN>; + @temp = split(' ',$line); + $numresult = $temp[2]; + + print <<ENDOFHDRs; +<h2>Search Results from <b>$csdirs[$index]</b></h2> +<font size=+1>$oper[$op]: <b>$arg</b></font><br> +Matches: $numresult<p> +<table border=1 cellpadding=2 cellspacing=2> +<tr><td><b>Num</b></td><td><b>File</b></td><td><b>Function</b></td> +<td><b>Line</b></td><td><b>Fragment</b></td></tr> +ENDOFHDRs + + $trivs_rm = 0; + + for ($i=0; $i < $numresult; $i++ ) { + $line = <CSCOPEIN>; + @fields = split(' ',$line); + $file = shift @fields; + $fshowfile = $file; + $func = shift @fields; + $lnum = shift @fields; + @filef = split('/',$file); + $file = $filef[$#filef]; + $frag = join(' ',@fields); + + if ( ! $shtriv ) { + for ( $j=0; $j <= $#trivial; $j++ ) + { + $fhash = unpack('H*', $func); + $thash = unpack('H*', $trivial[$j]); + if ( $fhash == $thash ) { $trivs_rm++; goto done; } + } + } + + if ( $func ne "<global>" && $func ne "<unknown>" ) { + print <<ENDOFBODY1; +<tr><td>$count</td> +<td><a href="$ENV{SCRIPT_NAME}?fshow=1&fshowfile=$fshowfile&line=$lnum&db=$db"> +<img src=$img{openfile} border=0></a> $file + <a href="$ENV{SCRIPT_NAME}?load=1&file=$fshowfile&db=$db"> +<img src=$img{downloadfile} border=0></a> +</td> +<td><a href="$ENV{SCRIPT_NAME}?op=0&triv=$shtriv&arg=$func&db=$db"> +<img src=$img{csymbol} border=0></a> +<a href="$ENV{SCRIPT_NAME}?op=3&triv=$shtriv&arg=$func&db=$db"> +<img src=$img{upfunc} border=0></a> +$func +<a href="$ENV{SCRIPT_NAME}?op=2&triv=$shtriv&arg=$func&db=$db"> +<img src=$img{downfunc} border=0></a> +<a href="$ENV{SCRIPT_NAME}?op=1&triv=$shtriv&arg=$func&db=$db"> +<img src=$img{globalfunc} border=0></a> +<a href="$ENV{SCRIPT_NAME}?trash=&func=$func&db=$db"> +<img src=$img{trashfunc} border=0></a> +</td> +<td>$lnum</td> +<td>$frag</td></tr> +ENDOFBODY1 + +} else { + $func =~ tr/<>/[]/; + print <<ENDOFBODY2; +<tr><td>$count</td> +<td><a href="$ENV{SCRIPT_NAME}?fshow=1&fshowfile=$fshowfile&line=$lnum&db=$db"> +<img src=$img{openfile} border=0></a> $file + <a href="$ENV{SCRIPT_NAME}?load=1&file=$fshowfile&db=$db"> +<img src=$img{downloadfile} border=0></a> +</td> +<td>$func</td> +<td>$lnum</td> +<td><$frag</td></tr> +ENDOFBODY2 + +} + + $count++; +done: + + } + + close(CSCOPEIN); + print "</table>\n"; + print "<br>Eliminated $trivs_rm line item(s) as trivial functions<p><hr>\n"; + unlink $tmpinfile, $tmpoutfile; + +} + + print &OperationTime; + print &Feedback; + print &HtmlBot; + +} + +sub DownloadFileForm { + $file = $input{'file'}; + print "Content-type: text/c-source\n\n"; + open(SHOWFILE, $file); + while (<SHOWFILE>) { print; } + close(SHOWFILE); +} + +sub ShowFileForm { + + $file = $input{'fshowfile'}; + $lnum = $input{'line'}; + + print &PrintHeader; + print &HtmlTop ("WebCscope"); + print "<b>Note</b>: Click <a href=#ref><img src=$img{downfunc} border=0></a> to go to the reference line<p><hr>\n"; + print "<hr>"; + + unlink $showfile; + system("$hiliter $file > $showfile"); + open(SHOWFILE, $showfile); + + $curline = 1; + while ( <SHOWFILE> ) { + $line = $_; + if ( $curline == $lnum ) { + print "<a name=ref><blink>$line</blink>"; + } else { + print $line; + } + $curline++; + } + + close (SHOWFILE); + + + + print &OperationTime; + print &Feedback; + print &HtmlBot; +} + +sub PrintForm { + + chdir $cscopedir; + opendir(DIRLIST,$cscopedir); + @dirlist = readdir(DIRLIST); + closedir(DIRLIST); + + @csdirs = (); + for ($i=0; $i <= $#dirlist; $i++ ) { + if ( ($dirlist[$i] ne ".") && ($dirlist[$i] ne "..") && ( -d $dirlist[$i] ) ) { + @csdirs = ( @csdirs, $dirlist[$i] ); + } + } + + print &PrintHeader; + print &HtmlTop ("Web-CScope"); + + print <<ENDOFTEXTA; +Select an operation below and enter a symbol, function or text to search in +the database. The active version is $version. Input is case-sensitive, +so if your search returns no results, check the case and the symbol name.<hr> +<form method="get" action="$ENV{SCRIPT_NAME}"> +<table border=0 cellpadding=2 cellspacing=2> +<tr> +<td>Operation:</td> +<td> +<select name="op"> +ENDOFTEXTA + + foreach $opi ( 0 .. $#oper ) { + print "<option value=$opi>$oper[$opi]"; + } + + print <<ENDOFTEXTB; +</select> +</td> +</tr> +<tr> +<td>CScope Database:</td> +<td> +<select name="db"> + <option selected value="all">All Databases +ENDOFTEXTB + + for ($i=0; $i <= $#csdirs; $i++) { + print " <option value=\"$csdirs[$i]\">$csdirs[$i]\n"; + } + + print <<ENDOFTEXT2; +</select> +<tr> +<td>Symbol, function or text:</td> +<td><input name="arg" size=30></td> +</tr> +<tr> +<td></td> +<td halign=center>Show trivial functions: +<input type=radio name="triv" value=1>Yes +<input type=radio name="triv" value=0 checked>No +<br><br> +<input type="submit" value="Scope It!"></td> +</tr> +</table> +<hr> +</form> +ENDOFTEXT2 + + print &Feedback; + print &HtmlBot; +} + +sub Feedback { + + $feedback = "<font size=-1>"; + $feedback .= '$Id: cscope,v 1.1 2001/06/29 14:20:16 petr Exp $<br>'; + $feedback .= "$comment{name}<i><"; + $feedback .= "<a href=\"mailto:$comment{email}\">"; + $feedback .= "$comment{email}</a>></i></font>"; + return $feedback; +} + +sub OperationTime { + + $deltime = time - $starttime; + return "Operation took $deltime second(s)<br>"; + +} diff --git a/contrib/webcscope/hilite.c b/contrib/webcscope/hilite.c new file mode 100644 index 0000000..4f5af07 --- /dev/null +++ b/contrib/webcscope/hilite.c @@ -0,0 +1,360 @@ +/* + CopyRight (C) 1999, Dmitry Obukhov, dso@usa.net + mailto: dso@usa.net + http://www.EmbeddedStuff.com + + ---------------------------------------------- + Last modified 6 Apr 97 + ---------------------------------------------- + Converts C (C++) source to HTML code fragment + with syntax highlighting. + Since program written for personal purpose + the <TABLE> tags generated. This is optional + page format specific thing. + + Usage: CTHM <input_file>. All output is done + to STDOUTPUT, error messages to STDERR. + For HTML fragment generation: + CHTM file.c > file.htm + + - Some input convertion required to use this + code as CGI module. Will be done soon. + - Optimization required for blocks of EOL + comments +*/ + +#include <stdio.h> + +// ------------------- Decoding status values + +#define START 0 +#define INLINE 1 +#define DEFINE 2 +// ------------------- Decoding Remark +#define REM1 20 +#define REM2 21 +#define REM_END 22 +#define REM_STAR 23 +#define REM_STAR_1 24 +#define STRING 25 // String is "like" remark + + +// ------------------- HTML TAG Generation +#define ON 1 +#define OFF 0 + +// ------------------- HTML TAG type +#define MODE_KEYWORD 0 +#define MODE_REMARK 2 +#define MODE_REMARK_EOL 4 +#define MODE_DEFINE 6 +#define MODE_STRING 8 + + +int is_delimeter(char c) +{ + int ii=0; + char dlms[] = + "\t\r\n (){}[]+-*/%\"'&|^~:;<>.,"; + //-------------------------------- + while (dlms[ii]) + { + if (c==dlms[ii++]) return 1; + } + return 0; +} + +int is_keyword(char * str) +{ + char * kwords[] = + { + "asm", "auto", + "break", "case", + "cdecl", "char", + "class", "const", + "continue", "default", + "delete", "do", + "double", "else", + "enum", "extern", + "far", "float", + "for", "friend", + "goto", "huge", + "if", "inline", + "int", "interrupt", + "long", "near", + "new", "operator", + "pascal", "private", + "protected", "public", + "register", "return", + "short", "signed", + "sizeof", "static", + "struct", "switch", + "template", "this", + "typedef", "union", + "unsigned", "virtual", + "void", "volatile", + "while", NULL + }; + int ii=0; + int jj; + int check; + + while (kwords[ii]) + { + jj = 0; + check = 1; + while (kwords[ii][jj] && check) + { + if (str[jj] != kwords[ii][jj]) + { + check = 0; + } + jj++; + } + if (check) return 1; + ii++; + } + return 0; +} + + +void set_mode(int on_off, int mode) +{ + char * tags[] = + { + //-------------------- KEYWORD + "<strong>", + "</strong>", + //-------------------- Classic remarks + "<font color=\"#336600\">", + "</font>", + //-------------------- EOL Remarks + "<font color=\"#336600\">", + "</font>", + //-------------------- #DEFINE + "<font color=\"#663300\"><strong>", + "</strong></font>", + //-------------------- "string" + "<font color=\"#0000CC\">", + "</font>", + NULL, NULL + }; + fprintf(stdout,tags[mode + 1 - on_off]); +} + +void print_char_html(char c) +{ + switch (c) + { + case '<': + fprintf(stdout,"<"); + break; + case '>': + fprintf(stdout,">"); + break; + case '"': + fprintf(stdout,"""); + break; + case '&': + fprintf(stdout,"&"); + break; + case '|': + fprintf(stdout,"¦"); + break; + default: + fprintf(stdout,"%c",c); + } +} + + + +int main(int _argc, char** _argv) +{ + FILE *in, *out; + char c; + int mode; + char buf[80]; + int bufidx = 0; + int progress = 1; + int echo; + int saved_mode; + int kw; + char tmpc; + char prevc; + + if (_argc < 2) + { + fprintf(stderr, + "USAGE: c2html <file>\n"); + return 1; + } + + + if ((in = fopen(_argv[1], "rt")) == NULL) + { + fprintf(stderr, + "Cannot open input file.\n"); + return 1; + } + + fprintf(stdout, "<pre>"); + mode = START; + + while (!feof(in) && progress) + { + echo = 1; + prevc = c; + c = fgetc(in); + + if (c=='/' && (mode < REM1)) + { + saved_mode = mode; + mode = REM1; + } + + switch (mode) + { + case REM1: + echo = 0; + mode = REM2; + break; + + case REM2: + if (c=='/') + { + if (saved_mode == DEFINE) + { + set_mode(OFF, MODE_DEFINE); + } + mode = REM_END; + set_mode(ON, MODE_REMARK_EOL); + } + else if (c=='*') + { + if (saved_mode == DEFINE) + { + set_mode(OFF, MODE_DEFINE); + } + mode = REM_STAR; + set_mode(ON, MODE_REMARK); + } + else + { + mode = saved_mode; + } + printf("/"); + break; + + case REM_END: + if (c=='\n') + { + set_mode(OFF, MODE_REMARK_EOL); + } + break; + + case REM_STAR: + if (c=='*') + { + mode = REM_STAR_1; + } + break; + + case REM_STAR_1: + if (c=='/') + { + mode = INLINE; + fprintf(stdout,"/"); + echo = 0; + set_mode(OFF, MODE_REMARK); + } + else mode = REM_STAR; + break; + + case START: + if (c=='#') + { + mode = DEFINE; + set_mode(ON, MODE_DEFINE); + break; + } + else if (c==' ') break; + + mode = INLINE; + // and continue in next case + + case INLINE: + if (c=='"' && // + prevc != 0x27 && // + prevc != '\\') // + { + set_mode(ON, MODE_STRING); + mode = STRING; + } + break; + + case STRING: + if (c=='"' && prevc != '\\') + { + print_char_html('"'); + set_mode(OFF, MODE_STRING); + echo = 0; + mode = INLINE; + } + break; + + case DEFINE: + if (c=='\n') + { + set_mode(OFF, MODE_DEFINE); + } + break; + + } + + if (echo && // + (mode == INLINE || // + (mode!=INLINE && // + bufidx))) // + { + buf[bufidx++] = c; + buf[bufidx] = 0; + if (is_delimeter(c)) + { + kw = 0; + if (bufidx>2) + { + kw = is_keyword(buf); + } + if (kw) + { + set_mode(ON, MODE_KEYWORD); + } + tmpc = buf[bufidx-1]; + buf[bufidx-1] = 0; + fprintf(stdout,"%s",buf); + if (kw) + { + set_mode(OFF, MODE_KEYWORD); + } + print_char_html(tmpc); + bufidx = 0; + buf[0] = 0; + } + } + else if (echo) print_char_html(c); + + if (c=='\n' && mode != REM_STAR) + { + mode = START; + } + } + + fclose(in); + fprintf(stdout,"</pre>\n"); + fprintf(stdout, + "<!-- == Generated by CHTM convertor -->\n"); + fprintf(stdout, + "<!-- == CopyRight (C) 1999, Dmitry Obukhov, dso@usa.net -->\n"); + + return 0; +} diff --git a/contrib/webcscope/icons/CVS/Entries b/contrib/webcscope/icons/CVS/Entries new file mode 100644 index 0000000..22f20b0 --- /dev/null +++ b/contrib/webcscope/icons/CVS/Entries @@ -0,0 +1,10 @@ +/back.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/bomb.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/c.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/down.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/folder.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/folder.open.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/left.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/up.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +/world2.gif/1.3/Fri Jun 29 15:58:07 2001/-kb/ +D diff --git a/contrib/webcscope/icons/CVS/Repository b/contrib/webcscope/icons/CVS/Repository new file mode 100644 index 0000000..cf072b6 --- /dev/null +++ b/contrib/webcscope/icons/CVS/Repository @@ -0,0 +1 @@ +cscope/contrib/webcscope/icons diff --git a/contrib/webcscope/icons/CVS/Root b/contrib/webcscope/icons/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/contrib/webcscope/icons/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/contrib/webcscope/icons/back.gif b/contrib/webcscope/icons/back.gif Binary files differnew file mode 100644 index 0000000..a694ae1 --- /dev/null +++ b/contrib/webcscope/icons/back.gif diff --git a/contrib/webcscope/icons/bomb.gif b/contrib/webcscope/icons/bomb.gif Binary files differnew file mode 100644 index 0000000..270fdb1 --- /dev/null +++ b/contrib/webcscope/icons/bomb.gif diff --git a/contrib/webcscope/icons/c.gif b/contrib/webcscope/icons/c.gif Binary files differnew file mode 100644 index 0000000..7555b6c --- /dev/null +++ b/contrib/webcscope/icons/c.gif diff --git a/contrib/webcscope/icons/down.gif b/contrib/webcscope/icons/down.gif Binary files differnew file mode 100644 index 0000000..a354c87 --- /dev/null +++ b/contrib/webcscope/icons/down.gif diff --git a/contrib/webcscope/icons/folder.gif b/contrib/webcscope/icons/folder.gif Binary files differnew file mode 100644 index 0000000..4826460 --- /dev/null +++ b/contrib/webcscope/icons/folder.gif diff --git a/contrib/webcscope/icons/folder.open.gif b/contrib/webcscope/icons/folder.open.gif Binary files differnew file mode 100644 index 0000000..30979cb --- /dev/null +++ b/contrib/webcscope/icons/folder.open.gif diff --git a/contrib/webcscope/icons/left.gif b/contrib/webcscope/icons/left.gif Binary files differnew file mode 100644 index 0000000..279e671 --- /dev/null +++ b/contrib/webcscope/icons/left.gif diff --git a/contrib/webcscope/icons/up.gif b/contrib/webcscope/icons/up.gif Binary files differnew file mode 100644 index 0000000..6d6d6d1 --- /dev/null +++ b/contrib/webcscope/icons/up.gif diff --git a/contrib/webcscope/icons/world2.gif b/contrib/webcscope/icons/world2.gif Binary files differnew file mode 100644 index 0000000..e3203f7 --- /dev/null +++ b/contrib/webcscope/icons/world2.gif diff --git a/contrib/xcscope/CVS/Entries b/contrib/xcscope/CVS/Entries new file mode 100644 index 0000000..f7439f6 --- /dev/null +++ b/contrib/xcscope/CVS/Entries @@ -0,0 +1,3 @@ +/cscope-indexer/1.2/Thu Jun 28 04:39:47 2001// +/xcscope.el/1.14/Wed Apr 10 16:59:00 2002// +D diff --git a/contrib/xcscope/CVS/Repository b/contrib/xcscope/CVS/Repository new file mode 100644 index 0000000..f1ac4c6 --- /dev/null +++ b/contrib/xcscope/CVS/Repository @@ -0,0 +1 @@ +cscope/contrib/xcscope diff --git a/contrib/xcscope/CVS/Root b/contrib/xcscope/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/contrib/xcscope/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/contrib/xcscope/cscope-indexer b/contrib/xcscope/cscope-indexer new file mode 100755 index 0000000..13c0ae2 --- /dev/null +++ b/contrib/xcscope/cscope-indexer @@ -0,0 +1,166 @@ +#! /bin/sh +############################################################################### +# +# File: cscope-indexer +# RCS: $Header: /cvsroot/cscope/cscope/contrib/xcscope/cscope-indexer,v 1.2 2001/06/28 04:39:47 darrylo Exp $ +# Description: Script to index files for cscope +# +# This script generates a list of files to index +# (cscope.out), which is then (optionally) used to +# generate a cscope database. You can use this script +# to just build a list of files, or it can be used to +# build a list and database. This script is not used to +# just build a database (skipping the list of files +# step), as this can be simply done by just calling +# "cscope -b". +# +# Normally, cscope will do its own indexing, but this +# script can be used to force indexing. This is useful +# if you need to recurse into subdirectories, or have +# many files to index (you can run this script from a +# cron job, during the night). It is especially useful +# for large projects, which can contstantly have source +# files added and deleted; by using this script, the +# changing sources files are automatically handled. +# +# Currently, any paths containing "/CVS/" or "/RCS/" are +# stripped out (ignored). +# +# This script is written to use only basic shell features, as +# not all shells have advanced features. +# +# Author: Darryl Okahata +# Created: Thu Apr 27 17:12:14 2000 +# Modified: Tue Jun 19 09:47:45 2001 (Darryl Okahata) darrylo@soco.agilent.com +# Language: Shell-script +# Package: N/A +# Status: Experimental +# +# (C) Copyright 2000, Darryl Okahata, all rights reserved. +# +############################################################################### +# +# Usage: +# +# cscope-indexer [ -v ] [-f database_file ] [-i list_file ] [ -l ] [ -r ] +# +# where: +# +# -f database_file +# Specifies the cscope database file (default: cscope.out). +# +# -i list_file +# Specifies the name of the file into which the list of files +# to index is placed (default: cscope.files). +# +# -l +# Suppress the generation/updating of the cscope database +# file. Only a list of files is generated. +# +# -r +# Recurse into subdirectories to locate files to index. +# Without this option, only the current directory is +# searched. +# +# -v +# Be verbose. Output simple progress messages. +# +# +############################################################################### +set -e + +# May have to edit this: +PATH="/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin:$PATH" +export PATH + +LIST_ONLY= +DIR='.' +LIST_FILE='cscope.files' +DATABASE_FILE='cscope.out' +RECURSE= +VERBOSE= +export DIR RECURSE # Need to pass these to subprocesses + +while [ -n "$1" ] +do + case "$1" in + -f) + if [ "X$2" = "X" ] + then + echo "$0: No database file specified" >&2 + exit 1 + fi + DATABASE_FILE="$2" + shift + ;; + -i) + if [ "X$2" = "X" ] + then + echo "$0: No list file specified" >&2 + exit 1 + fi + LIST_FILE="$2" + shift + ;; + -l) + LIST_ONLY=1 + ;; + -r) + RECURSE=1 + ;; + -v) + VERBOSE=1 + ;; + *) + DIR="$1" + ;; + esac + shift +done + +cd $DIR + +if [ "X$VERBOSE" != "X" ] +then + echo "Creating list of files to index ..." +fi + +( + if [ "X$RECURSE" = "X" ] + then + # Ugly, inefficient, but it works. + for f in * + do + echo "$DIR/$f" + done + else + find $DIR \( -type f -o -type l \) + fi +) | \ + egrep -i '\.([chly](xx|pp)*|cc|hh)$' | \ + sed -e '/\/CVS\//d' -e '/\/RCS\//d' -e 's/^\.\///' | \ + sort > $LIST_FILE + +if [ "X$VERBOSE" != "X" ] +then + echo "Creating list of files to index ... done" +fi + +if [ "X$LIST_ONLY" != "X" ] +then + exit 0 +fi + +if [ "X$VERBOSE" != "X" ] +then + echo "Indexing files ..." +fi + +cscope -b -i $LIST_FILE -f $DATABASE_FILE + +if [ "X$VERBOSE" != "X" ] +then + echo "Indexing files ... done" +fi + +exit 0 diff --git a/contrib/xcscope/xcscope.el b/contrib/xcscope/xcscope.el new file mode 100644 index 0000000..ce382a4 --- /dev/null +++ b/contrib/xcscope/xcscope.el @@ -0,0 +1,2463 @@ +; -*-Emacs-Lisp-*- +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; File: xcscope.el +; RCS: $RCSfile: xcscope.el,v $ $Revision: 1.14 $ $Date: 2002/04/10 16:59:00 $ $Author: darrylo $ +; Description: cscope interface for (X)Emacs +; Author: Darryl Okahata +; Created: Wed Apr 19 17:03:38 2000 +; Modified: Thu Apr 4 17:22:22 2002 (Darryl Okahata) darrylo@soco.agilent.com +; Language: Emacs-Lisp +; Package: N/A +; Status: Experimental +; +; (C) Copyright 2000, 2001, 2002, Darryl Okahata <darrylo@sonic.net>, +; all rights reserved. +; GNU Emacs enhancements (C) Copyright 2001, +; Triet H. Lai <thlai@mail.usyd.edu.au> +; Fuzzy matching and navigation code (C) Copyright 2001, +; Steven Elliott <selliott4@austin.rr.com> +; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ALPHA VERSION 0.96 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to +;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; This is a cscope interface for (X)Emacs. +;; It currently runs under Unix only. +;; +;; Using cscope, you can easily search for where symbols are used and defined. +;; Cscope is designed to answer questions like: +;; +;; Where is this variable used? +;; What is the value of this preprocessor symbol? +;; Where is this function in the source files? +;; What functions call this function? +;; What functions are called by this function? +;; Where does the message "out of space" come from? +;; Where is this source file in the directory structure? +;; What files include this header file? +;; +;; Send comments to one of: darrylo@soco.agilent.com +;; darryl_okahata@agilent.com +;; darrylo@sonic.net +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; ***** INSTALLATION ***** +;; +;; * NOTE: this interface currently runs under Unix only. +;; +;; This module needs a shell script called "cscope-indexer", which +;; should have been supplied along with this emacs-lisp file. The +;; purpose of "cscope-indexer" is to create and optionally maintain +;; the cscope databases. If all of your source files are in one +;; directory, you don't need this script; it's very nice to have, +;; though, as it handles recursive subdirectory indexing, and can be +;; used in a nightly or weekly cron job to index very large source +;; repositories. See the beginning of the file, "cscope-indexer", for +;; usage information. +;; +;; Installation steps: +;; +;; 0. (It is, of course, assumed that cscope is already properly +;; installed on the current system.) +;; +;; 1. Install the "cscope-indexer" script into some convenient +;; directory in $PATH. The only real constraint is that (X)Emacs +;; must be able to find and execute it. You may also have to edit +;; the value of PATH in the script, although this is unlikely; the +;; majority of people should be able to use the script, "as-is". +;; +;; 2. Make sure that the "cscope-indexer" script is executable. In +;; particular, if you had to ftp this file, it is probably no +;; longer executable. +;; +;; 3. Put this emacs-lisp file somewhere where (X)Emacs can find it. It +;; basically has to be in some directory listed in "load-path". +;; +;; 4. Edit your ~/.emacs file to add the line: +;; +;; (require 'xcscope) +;; +;; 5. If you intend to use xcscope.el often you can optionally edit your +;; ~/.emacs file to add keybindings that reduce the number of keystrokes +;; required. For example, the following will add "C-f#" keybindings, which +;; are easier to type than the usual "C-c s" prefixed keybindings. Note +;; that specifying "global-map" instead of "cscope:map" makes the +;; keybindings available in all buffers: +;; +;; (define-key global-map [(control f3)] 'cscope-set-initial-directory) +;; (define-key global-map [(control f4)] 'cscope-unset-initial-directory) +;; (define-key global-map [(control f5)] 'cscope-find-this-symbol) +;; (define-key global-map [(control f6)] 'cscope-find-global-definition) +;; (define-key global-map [(control f7)] +;; 'cscope-find-global-definition-no-prompting) +;; (define-key global-map [(control f8)] 'cscope-pop-mark) +;; (define-key global-map [(control f9)] 'cscope-next-symbol) +;; (define-key global-map [(control f10)] 'cscope-next-file) +;; (define-key global-map [(control f11)] 'cscope-prev-symbol) +;; (define-key global-map [(control f12)] 'cscope-prev-file) +;; (define-key global-map [(meta f9)] 'cscope-display-buffer) +;; (defin-ekey global-map [(meta f10)] 'cscope-display-buffer-toggle) +;; +;; 6. Restart (X)Emacs. That's it. +;; +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; ***** USING THIS MODULE ***** +;; +;; * Basic usage: +;; +;; If all of your C/C++/lex/yacc source files are in the same +;; directory, you can just start using this module. If your files are +;; spread out over multiple directories, see "Advanced usage", below. +;; +;; Just edit a source file, and use the pull-down or pop-up (button 3) +;; menus to select one of: +;; +;; Find symbol +;; Find global definition +;; Find called functions +;; Find functions calling a function +;; Find text string +;; Find egrep pattern +;; Find a file +;; Find files #including a file +;; +;; The cscope database will be automatically created in the same +;; directory as the source files (assuming that you've never used +;; cscope before), and a buffer will pop-up displaying the results. +;; You can then use button 2 (the middle button) on the mouse to edit +;; the selected file, or you can move the text cursor over a selection +;; and press [Enter]. +;; +;; Hopefully, the interface should be fairly intuitive. +;; +;; +;; * Locating the cscope databases: +;; +;; This module will first use the variable, `cscope-database-regexps', +;; to search for a suitable database directory. If a database location +;; cannot be found using this variable then a search is begun at the +;; variable, `cscope-initial-directory', if set, or the current +;; directory otherwise. If the directory is not a cscope database +;; directory then the directory's parent, parent's parent, etc. is +;; searched until a cscope database directory is found, or the root +;; directory is reached. If the root directory is reached, the current +;; directory will be used. +;; +;; A cscope database directory is one in which EITHER a cscope database +;; file (e.g., "cscope.out") OR a cscope file list (e.g., +;; "cscope.files") exists. If only "cscope.files" exists, the +;; corresponding "cscope.out" will be automatically created by cscope +;; when a search is done. By default, the cscope database file is called +;; "cscope.out", but this can be changed (on a global basis) via the +;; variable, `cscope-database-file'. There is limited support for cscope +;; databases that are named differently than that given by +;; `cscope-database-file', using the variable, `cscope-database-regexps'. +;; +;; Note that the variable, `cscope-database-regexps', is generally not +;; needed, as the normal hierarchical database search is sufficient +;; for placing and/or locating the cscope databases. However, there +;; may be cases where it makes sense to place the cscope databases +;; away from where the source files are kept; in this case, this +;; variable is used to determine the mapping. One use for this +;; variable is when you want to share the database file with other +;; users; in this case, the database may be located in a directory +;; separate from the source files. +;; +;; Setting the variable, `cscope-initial-directory', is useful when a +;; search is to be expanded by specifying a cscope database directory +;; that is a parent of the directory that this module would otherwise +;; use. For example, consider a project that contains the following +;; cscope database directories: +;; +;; /users/jdoe/sources +;; /users/jdoe/sources/proj1 +;; /users/jdoe/sources/proj2 +;; +;; If a search is initiated from a .c file in /users/jdoe/sources/proj1 +;; then (assuming the variable, `cscope-database-regexps', is not set) +;; /users/jdoe/sources/proj1 will be used as the cscope data base directory. +;; Only matches in files in /users/jdoe/sources/proj1 will be found. This +;; can be remedied by typing "C-c s a" and then "M-del" to remove single +;; path element in order to use a cscope database directory of +;; /users/jdoe/sources. Normal searching can be restored by typing "C-c s A". +;; +;; +;; * Keybindings: +;; +;; All keybindings use the "C-c s" prefix, but are usable only while +;; editing a source file, or in the cscope results buffer: +;; +;; C-c s s Find symbol. +;; C-c s d Find global definition. +;; C-c s g Find global definition (alternate binding). +;; C-c s G Find global definition without prompting. +;; C-c s c Find functions calling a function. +;; C-c s C Find called functions (list functions called +;; from a function). +;; C-c s t Find text string. +;; C-c s e Find egrep pattern. +;; C-c s f Find a file. +;; C-c s i Find files #including a file. +;; +;; These pertain to navigation through the search results: +;; +;; C-c s b Display *cscope* buffer. +;; C-c s B Auto display *cscope* buffer toggle. +;; C-c s n Next symbol. +;; C-c s N Next file. +;; C-c s p Previous symbol. +;; C-c s P Previous file. +;; C-c s u Pop mark. +;; +;; These pertain to setting and unsetting the variable, +;; `cscope-initial-directory', (location searched for the cscope database +;; directory): +;; +;; C-c s a Set initial directory. +;; C-c s A Unset initial directory. +;; +;; These pertain to cscope database maintenance: +;; +;; C-c s L Create list of files to index. +;; C-c s I Create list and index. +;; C-c s E Edit list of files to index. +;; C-c s W Locate this buffer's cscope directory +;; ("W" --> "where"). +;; C-c s S Locate this buffer's cscope directory. +;; (alternate binding: "S" --> "show"). +;; C-c s T Locate this buffer's cscope directory. +;; (alternate binding: "T" --> "tell"). +;; C-c s D Dired this buffer's directory. +;; +;; +;; * Advanced usage: +;; +;; If the source files are spread out over multiple directories, +;; you've got a few choices: +;; +;; [ NOTE: you will need to have the script, "cscope-indexer", +;; properly installed in order for the following to work. ] +;; +;; 1. If all of the directories exist below a common directory +;; (without any extraneous, unrelated subdirectories), you can tell +;; this module to place the cscope database into the top-level, +;; common directory. This assumes that you do not have any cscope +;; databases in any of the subdirectories. If you do, you should +;; delete them; otherwise, they will take precedence over the +;; top-level database. +;; +;; If you do have cscope databases in any subdirectory, the +;; following instructions may not work right. +;; +;; It's pretty easy to tell this module to use a top-level, common +;; directory: +;; +;; a. Make sure that the menu pick, "Cscope/Index recursively", is +;; checked (the default value). +;; +;; b. Select the menu pick, "Cscope/Create list and index", and +;; specify the top-level directory. This will run the script, +;; "cscope-indexer", in the background, so you can do other +;; things if indexing takes a long time. A list of files to +;; index will be created in "cscope.files", and the cscope +;; database will be created in "cscope.out". +;; +;; Once this has been done, you can then use the menu picks +;; (described in "Basic usage", above) to search for symbols. +;; +;; Note, however, that, if you add or delete source files, you'll +;; have to either rebuild the database using the above procedure, +;; or edit the file, "cscope.files" to add/delete the names of the +;; source files. To edit this file, you can use the menu pick, +;; "Cscope/Edit list of files to index". +;; +;; +;; 2. If most of the files exist below a common directory, but a few +;; are outside, you can use the menu pick, "Cscope/Create list of +;; files to index", and specify the top-level directory. Make sure +;; that "Cscope/Index recursively", is checked before you do so, +;; though. You can then edit the list of files to index using the +;; menu pick, "Cscope/Edit list of files to index". Just edit the +;; list to include any additional source files not already listed. +;; +;; Once you've created, edited, and saved the list, you can then +;; use the menu picks described under "Basic usage", above, to +;; search for symbols. The first time you search, you will have to +;; wait a while for cscope to fully index the source files, though. +;; If you have a lot of source files, you may want to manually run +;; cscope to build the database: +;; +;; cd top-level-directory # or wherever +;; rm -f cscope.out # not always necessary +;; cscope -b +;; +;; +;; 3. If the source files are scattered in many different, unrelated +;; places, you'll have to manually create cscope.files and put a +;; list of all pathnames into it. Then build the database using: +;; +;; cd some-directory # wherever cscope.files exists +;; rm -f cscope.out # not always necessary +;; cscope -b +;; +;; Next, read the documentation for the variable, +;; "cscope-database-regexps", and set it appropriately, such that +;; the above-created cscope database will be referenced when you +;; edit a related source file. +;; +;; Once this has been done, you can then use the menu picks +;; described under "Basic usage", above, to search for symbols. +;; +;; +;; * Interesting configuration variables: +;; +;; "cscope-truncate-lines" +;; This is the value of `truncate-lines' to use in cscope +;; buffers; the default is the current setting of +;; `truncate-lines'. This variable exists because it can be +;; easier to read cscope buffers with truncated lines, while +;; other buffers do not have truncated lines. +;; +;; "cscope-use-relative-paths" +;; If non-nil, use relative paths when creating the list of files +;; to index. The path is relative to the directory in which the +;; cscope database will be created. If nil, absolute paths will +;; be used. Absolute paths are good if you plan on moving the +;; database to some other directory (if you do so, you'll +;; probably also have to modify `cscope-database-regexps'). +;; Absolute paths may also be good if you share the database file +;; with other users (you'll probably want to specify some +;; automounted network path for this). +;; +;; "cscope-index-recursively" +;; If non-nil, index files in the current directory and all +;; subdirectories. If nil, only files in the current directory +;; are indexed. This variable is only used when creating the +;; list of files to index, or when creating the list of files and +;; the corresponding cscope database. +;; +;; "cscope-name-line-width" +;; The width of the combined "function name:line number" field in +;; the cscope results buffer. If negative, the field is +;; left-justified. +;; +;; "cscope-do-not-update-database" +;; If non-nil, never check and/or update the cscope database when +;; searching. Beware of setting this to non-nil, as this will +;; disable automatic database creation, updating, and +;; maintenance. +;; +;; "cscope-display-cscope-buffer" +;; If non-nil, display the *cscope* buffer after each search +;; (default). This variable can be set in order to reduce the +;; number of keystrokes required to navigate through the matches. +;; +;; "cscope-database-regexps" +;; List to force directory-to-cscope-database mappings. +;; This is a list of `(REGEXP DBLIST [ DBLIST ... ])', where: +;; +;; REGEXP is a regular expression matched against the current buffer's +;; current directory. The current buffer is typically some source file, +;; and you're probably searching for some symbol in or related to this +;; file. Basically, this regexp is used to relate the current directory +;; to a cscope database. You need to start REGEXP with "^" if you want +;; to match from the beginning of the current directory. +;; +;; DBLIST is a list that contains one or more of: +;; +;; ( DBDIR ) +;; ( DBDIR ( OPTIONS ) ) +;; ( t ) +;; t +;; +;; Here, DBDIR is a directory (or a file) that contains a cscope +;; database. If DBDIR is a directory, then it is expected that the +;; cscope database, if present, has the filename given by the variable, +;; `cscope-database-file'; if DBDIR is a file, then DBDIR is the path +;; name to a cscope database file (which does not have to be the same as +;; that given by `cscope-database-file'). If only DBDIR is specified, +;; then that cscope database will be searched without any additional +;; cscope command-line options. If OPTIONS is given, then OPTIONS is a +;; list of strings, where each string is a separate cscope command-line +;; option. +;; +;; In the case of "( t )", this specifies that the search is to use the +;; normal hierarchical database search. This option is used to +;; explicitly search using the hierarchical database search either before +;; or after other cscope database directories. +;; +;; If "t" is specified (not inside a list), this tells the searching +;; mechanism to stop searching if a match has been found (at the point +;; where "t" is encountered). This is useful for those projects that +;; consist of many subprojects. You can specify the most-used +;; subprojects first, followed by a "t", and then followed by a master +;; cscope database directory that covers all subprojects. This will +;; cause the most-used subprojects to be searched first (hopefully +;; quickly), and the search will then stop if a match was found. If not, +;; the search will continue using the master cscope database directory. +;; +;; Here, `cscope-database-regexps' is generally not used, as the normal +;; hierarchical database search is sufficient for placing and/or locating +;; the cscope databases. However, there may be cases where it makes +;; sense to place the cscope databases away from where the source files +;; are kept; in this case, this variable is used to determine the +;; mapping. +;; +;; This module searches for the cscope databases by first using this +;; variable; if a database location cannot be found using this variable, +;; then the current directory is searched, then the parent, then the +;; parent's parent, until a cscope database directory is found, or the +;; root directory is reached. If the root directory is reached, the +;; current directory will be used. +;; +;; A cscope database directory is one in which EITHER a cscope database +;; file (e.g., "cscope.out") OR a cscope file list (e.g., +;; "cscope.files") exists. If only "cscope.files" exists, the +;; corresponding "cscope.out" will be automatically created by cscope +;; when a search is done. By default, the cscope database file is called +;; "cscope.out", but this can be changed (on a global basis) via the +;; variable, `cscope-database-file'. There is limited support for cscope +;; databases that are named differently than that given by +;; `cscope-database-file', using the variable, `cscope-database-regexps'. +;; +;; Here is an example of `cscope-database-regexps': +;; +;; (setq cscope-database-regexps +;; '( +;; ( "^/users/jdoe/sources/proj1" +;; ( t ) +;; ( "/users/jdoe/sources/proj2") +;; ( "/users/jdoe/sources/proj3/mycscope.out") +;; ( "/users/jdoe/sources/proj4") +;; t +;; ( "/some/master/directory" ("-d" "-I/usr/local/include") ) +;; ) +;; ( "^/users/jdoe/sources/gnome/" +;; ( "/master/gnome/database" ("-d") ) +;; ) +;; )) +;; +;; If the current buffer's directory matches the regexp, +;; "^/users/jdoe/sources/proj1", then the following search will be +;; done: +;; +;; 1. First, the normal hierarchical database search will be used to +;; locate a cscope database. +;; +;; 2. Next, searches will be done using the cscope database +;; directories, "/users/jdoe/sources/proj2", +;; "/users/jdoe/sources/proj3/mycscope.out", and +;; "/users/jdoe/sources/proj4". Note that, instead of the file, +;; "cscope.out", the file, "mycscope.out", will be used in the +;; directory "/users/jdoe/sources/proj3". +;; +;; 3. If a match was found, searching will stop. +;; +;; 4. If a match was not found, searching will be done using +;; "/some/master/directory", and the command-line options "-d" +;; and "-I/usr/local/include" will be passed to cscope. +;; +;; If the current buffer's directory matches the regexp, +;; "^/users/jdoe/sources/gnome", then the following search will be +;; done: +;; +;; The search will be done only using the directory, +;; "/master/gnome/database". The "-d" option will be passed to +;; cscope. +;; +;; If the current buffer's directory does not match any of the above +;; regexps, then only the normal hierarchical database search will be +;; done. +;; +;; +;; * Other notes: +;; +;; 1. The script, "cscope-indexer", uses a sed command to determine +;; what is and is not a C/C++/lex/yacc source file. It's idea of a +;; source file may not correspond to yours. +;; +;; 2. This module is called, "xcscope", because someone else has +;; already written a "cscope.el" (although it's quite old). +;; +;; +;; * KNOWN BUGS: +;; +;; 1. Cannot handle whitespace in directory or file names. +;; +;; 2. By default, colored faces are used to display results. If you happen +;; to use a black background, part of the results may be invisible +;; (because the foreground color may be black, too). There are at least +;; two solutions for this: +;; +;; 2a. Turn off colored faces, by setting `cscope-use-face' to `nil', +;; e.g.: +;; +;; (setq cscope-use-face nil) +;; +;; 2b. Explicitly set colors for the faces used by cscope. The faces +;; are: +;; +;; cscope-file-face +;; cscope-function-face +;; cscope-line-number-face +;; cscope-line-face +;; cscope-mouse-face +;; +;; The face most likely to cause problems (e.g., black-on-black +;; color) is `cscope-line-face'. +;; +;; 3. The support for cscope databases different from that specified by +;; `cscope-database-file' is quirky. If the file does not exist, it +;; will not be auto-created (unlike files names by +;; `cscope-database-file'). You can manually force the file to be +;; created by using touch(1) to create a zero-length file; the +;; database will be created the next time a search is done. +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(require 'easymenu) + + +(defgroup cscope nil + "Cscope interface for (X)Emacs. +Using cscope, you can easily search for where symbols are used and defined. +It is designed to answer questions like: + + Where is this variable used? + What is the value of this preprocessor symbol? + Where is this function in the source files? + What functions call this function? + What functions are called by this function? + Where does the message \"out of space\" come from? + Where is this source file in the directory structure? + What files include this header file? +" + :prefix "cscope-" + :group 'tools) + + +(defcustom cscope-do-not-update-database nil + "*If non-nil, never check and/or update the cscope database when searching. +Beware of setting this to non-nil, as this will disable automatic database +creation, updating, and maintenance." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-database-regexps nil + "*List to force directory-to-cscope-database mappings. +This is a list of `(REGEXP DBLIST [ DBLIST ... ])', where: + +REGEXP is a regular expression matched against the current buffer's +current directory. The current buffer is typically some source file, +and you're probably searching for some symbol in or related to this +file. Basically, this regexp is used to relate the current directory +to a cscope database. You need to start REGEXP with \"^\" if you want +to match from the beginning of the current directory. + +DBLIST is a list that contains one or more of: + + ( DBDIR ) + ( DBDIR ( OPTIONS ) ) + ( t ) + t + +Here, DBDIR is a directory (or a file) that contains a cscope database. +If DBDIR is a directory, then it is expected that the cscope database, +if present, has the filename given by the variable, +`cscope-database-file'; if DBDIR is a file, then DBDIR is the path name +to a cscope database file (which does not have to be the same as that +given by `cscope-database-file'). If only DBDIR is specified, then that +cscope database will be searched without any additional cscope +command-line options. If OPTIONS is given, then OPTIONS is a list of +strings, where each string is a separate cscope command-line option. + +In the case of \"( t )\", this specifies that the search is to use the +normal hierarchical database search. This option is used to +explicitly search using the hierarchical database search either before +or after other cscope database directories. + +If \"t\" is specified (not inside a list), this tells the searching +mechanism to stop searching if a match has been found (at the point +where \"t\" is encountered). This is useful for those projects that +consist of many subprojects. You can specify the most-used +subprojects first, followed by a \"t\", and then followed by a master +cscope database directory that covers all subprojects. This will +cause the most-used subprojects to be searched first (hopefully +quickly), and the search will then stop if a match was found. If not, +the search will continue using the master cscope database directory. + +Here, `cscope-database-regexps' is generally not used, as the normal +hierarchical database search is sufficient for placing and/or locating +the cscope databases. However, there may be cases where it makes +sense to place the cscope databases away from where the source files +are kept; in this case, this variable is used to determine the +mapping. + +This module searches for the cscope databases by first using this +variable; if a database location cannot be found using this variable, +then the current directory is searched, then the parent, then the +parent's parent, until a cscope database directory is found, or the +root directory is reached. If the root directory is reached, the +current directory will be used. + +A cscope database directory is one in which EITHER a cscope database +file (e.g., \"cscope.out\") OR a cscope file list (e.g., +\"cscope.files\") exists. If only \"cscope.files\" exists, the +corresponding \"cscope.out\" will be automatically created by cscope +when a search is done. By default, the cscope database file is called +\"cscope.out\", but this can be changed (on a global basis) via the +variable, `cscope-database-file'. There is limited support for cscope +databases that are named differently than that given by +`cscope-database-file', using the variable, `cscope-database-regexps'. + +Here is an example of `cscope-database-regexps': + + (setq cscope-database-regexps + '( + ( \"^/users/jdoe/sources/proj1\" + ( t ) + ( \"/users/jdoe/sources/proj2\") + ( \"/users/jdoe/sources/proj3/mycscope.out\") + ( \"/users/jdoe/sources/proj4\") + t + ( \"/some/master/directory\" (\"-d\" \"-I/usr/local/include\") ) + ) + ( \"^/users/jdoe/sources/gnome/\" + ( \"/master/gnome/database\" (\"-d\") ) + ) + )) + +If the current buffer's directory matches the regexp, +\"^/users/jdoe/sources/proj1\", then the following search will be +done: + + 1. First, the normal hierarchical database search will be used to + locate a cscope database. + + 2. Next, searches will be done using the cscope database + directories, \"/users/jdoe/sources/proj2\", + \"/users/jdoe/sources/proj3/mycscope.out\", and + \"/users/jdoe/sources/proj4\". Note that, instead of the file, + \"cscope.out\", the file, \"mycscope.out\", will be used in the + directory \"/users/jdoe/sources/proj3\". + + 3. If a match was found, searching will stop. + + 4. If a match was not found, searching will be done using + \"/some/master/directory\", and the command-line options \"-d\" + and \"-I/usr/local/include\" will be passed to cscope. + +If the current buffer's directory matches the regexp, +\"^/users/jdoe/sources/gnome\", then the following search will be +done: + + The search will be done only using the directory, + \"/master/gnome/database\". The \"-d\" option will be passed to + cscope. + +If the current buffer's directory does not match any of the above +regexps, then only the normal hierarchical database search will be +done. + +" + :type '(repeat (list :format "%v" + (choice :value "" + (regexp :tag "Buffer regexp") + string) + (choice :value "" + (directory :tag "Cscope database directory") + string) + (string :value "" + :tag "Optional cscope command-line arguments") + )) + :group 'cscope) +(defcustom cscope-name-line-width -30 + "*The width of the combined \"function name:line number\" field in the +cscope results buffer. If negative, the field is left-justified." + :type 'integer + :group 'cscope) + + +(defcustom cscope-truncate-lines truncate-lines + "*The value of `truncate-lines' to use in cscope buffers. +This variable exists because it can be easier to read cscope buffers +with truncated lines, while other buffers do not have truncated lines." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-display-times t + "*If non-nil, display how long each search took. +The elasped times are in seconds. Floating-point support is required +for this to work." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-program "cscope" + "*The pathname of the cscope executable to use." + :type 'string + :group 'cscope) + + +(defcustom cscope-index-file "cscope.files" + "*The name of the cscope file list file." + :type 'string + :group 'cscope) + + +(defcustom cscope-database-file "cscope.out" + "*The name of the cscope database file." + :type 'string + :group 'cscope) + + +(defcustom cscope-edit-single-match t + "*If non-nil and only one match is output, edit the matched location." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-display-cscope-buffer t + "*If non-nil automatically display the *cscope* buffer after each search." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-stop-at-first-match-dir nil + "*If non-nil, stop searching through multiple databases if a match is found. +This option is useful only if multiple cscope database directories are being +used. When multiple databases are searched, setting this variable to non-nil +will cause searches to stop when a search outputs anything; no databases after +this one will be searched." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-use-relative-paths t + "*If non-nil, use relative paths when creating the list of files to index. +The path is relative to the directory in which the cscope database +will be created. If nil, absolute paths will be used. Absolute paths +are good if you plan on moving the database to some other directory +(if you do so, you'll probably also have to modify +\`cscope-database-regexps\'). Absolute paths may also be good if you +share the database file with other users (you\'ll probably want to +specify some automounted network path for this)." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-index-recursively t + "*If non-nil, index files in the current directory and all subdirectories. +If nil, only files in the current directory are indexed. This +variable is only used when creating the list of files to index, or +when creating the list of files and the corresponding cscope database." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-no-mouse-prompts nil + "*If non-nil, use the symbol under the cursor instead of prompting. +Do not prompt for a value, except for when seaching for a egrep pattern +or a file." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-suppress-empty-matches t + "*If non-nil, delete empty matches.") + + +(defcustom cscope-indexing-script "cscope-indexer" + "*The shell script used to create cscope indices." + :type 'string + :group 'cscope) + + +(defcustom cscope-symbol-chars "A-Za-z0-9_" + "*A string containing legal characters in a symbol. +The current syntax table should really be used for this." + :type 'string + :group 'cscope) + + +(defcustom cscope-filename-chars "-.,/A-Za-z0-9_~!@#$%&+=\\\\" + "*A string containing legal characters in a symbol. +The current syntax table should really be used for this." + :type 'string + :group 'cscope) + + +(defcustom cscope-allow-arrow-overlays t + "*If non-nil, use an arrow overlay to show target lines. +Arrow overlays are only used when the following functions are used: + + cscope-show-entry-other-window + cscope-show-next-entry-other-window + cscope-show-prev-entry-other-window + +The arrow overlay is removed when other cscope functions are used. +Note that the arrow overlay is not an actual part of the text, and can +be removed by quitting the cscope buffer." + :type 'boolean + :group 'cscope) + + +(defcustom cscope-overlay-arrow-string "=>" + "*The overlay string to use when displaying arrow overlays." + :type 'string + :group 'cscope) + + +(defvar cscope-minor-mode-hooks nil + "List of hooks to call when entering cscope-minor-mode.") + + +(defconst cscope-separator-line + "-------------------------------------------------------------------------------\n" + "Line of text to use as a visual separator. +Must end with a newline.") + + +;;;; +;;;; Faces for fontification +;;;; + +(defcustom cscope-use-face t + "*Whether to use text highlighting (à la font-lock) or not." + :group 'cscope + :type '(boolean)) + + +(defface cscope-file-face + '((((class color) (background dark)) + (:foreground "yellow")) + (((class color) (background light)) + (:foreground "blue")) + (t (:bold t))) + "Face used to highlight file name in the *cscope* buffer." + :group 'cscope) + + +(defface cscope-function-face + '((((class color) (background dark)) + (:foreground "cyan")) + (((class color) (background light)) + (:foreground "magenta")) + (t (:bold t))) + "Face used to highlight function name in the *cscope* buffer." + :group 'cscope) + + +(defface cscope-line-number-face + '((((class color) (background dark)) + (:foreground "red")) + (((class color) (background light)) + (:foreground "red")) + (t (:bold t))) + "Face used to highlight line number in the *cscope* buffer." + :group 'cscope) + + +(defface cscope-line-face + '((((class color) (background dark)) + (:foreground "green")) + (((class color) (background light)) + (:foreground "black")) + (t (:bold nil))) + "Face used to highlight the rest of line in the *cscope* buffer." + :group 'cscope) + + +(defface cscope-mouse-face + '((((class color) (background dark)) + (:foreground "white" :background "blue")) + (((class color) (background light)) + (:foreground "white" :background "blue")) + (t (:bold nil))) + "Face used when mouse pointer is within the region of an entry." + :group 'cscope) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Probably, nothing user-customizable past this point. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defconst cscope-running-in-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) + +(defvar cscope-list-entry-keymap nil + "The keymap used in the *cscope* buffer which lists search results.") +(if cscope-list-entry-keymap + nil + (setq cscope-list-entry-keymap (make-keymap)) + (suppress-keymap cscope-list-entry-keymap) + ;; The following section does not appear in the "Cscope" menu. + (if cscope-running-in-xemacs + (define-key cscope-list-entry-keymap [button2] 'cscope-mouse-select-entry-other-window) + (define-key cscope-list-entry-keymap [mouse-2] 'cscope-mouse-select-entry-other-window)) + (define-key cscope-list-entry-keymap [return] 'cscope-select-entry-other-window) + (define-key cscope-list-entry-keymap " " 'cscope-show-entry-other-window) + (define-key cscope-list-entry-keymap "o" 'cscope-select-entry-one-window) + (define-key cscope-list-entry-keymap "q" 'cscope-bury-buffer) + (define-key cscope-list-entry-keymap "Q" 'cscope-quit) + (define-key cscope-list-entry-keymap "h" 'cscope-help) + (define-key cscope-list-entry-keymap "?" 'cscope-help) + ;; The following line corresponds to be beginning of the "Cscope" menu. + (define-key cscope-list-entry-keymap "s" 'cscope-find-this-symbol) + (define-key cscope-list-entry-keymap "d" 'cscope-find-this-symbol) + (define-key cscope-list-entry-keymap "g" 'cscope-find-global-definition) + (define-key cscope-list-entry-keymap "G" + 'cscope-find-global-definition-no-prompting) + (define-key cscope-list-entry-keymap "c" 'cscope-find-functions-calling-this-function) + (define-key cscope-list-entry-keymap "C" 'cscope-find-called-functions) + (define-key cscope-list-entry-keymap "t" 'cscope-find-this-text-string) + (define-key cscope-list-entry-keymap "e" 'cscope-find-egrep-pattern) + (define-key cscope-list-entry-keymap "f" 'cscope-find-this-file) + (define-key cscope-list-entry-keymap "i" 'cscope-find-files-including-file) + ;; --- (The '---' indicates that this line corresponds to a menu separator.) + (define-key cscope-list-entry-keymap "n" 'cscope-next-symbol) + (define-key cscope-list-entry-keymap "N" 'cscope-next-file) + (define-key cscope-list-entry-keymap "p" 'cscope-prev-symbol) + (define-key cscope-list-entry-keymap "P" 'cscope-prev-file) + (define-key cscope-list-entry-keymap "u" 'cscope-pop-mark) + ;; --- + (define-key cscope-list-entry-keymap "a" 'cscope-set-initial-directory) + (define-key cscope-list-entry-keymap "A" 'cscope-unset-initial-directory) + ;; --- + (define-key cscope-list-entry-keymap "L" 'cscope-create-list-of-files-to-index) + (define-key cscope-list-entry-keymap "I" 'cscope-index-files) + (define-key cscope-list-entry-keymap "E" 'cscope-edit-list-of-files-to-index) + (define-key cscope-list-entry-keymap "W" 'cscope-tell-user-about-directory) + (define-key cscope-list-entry-keymap "S" 'cscope-tell-user-about-directory) + (define-key cscope-list-entry-keymap "T" 'cscope-tell-user-about-directory) + (define-key cscope-list-entry-keymap "D" 'cscope-dired-directory) + ;; The previous line corresponds to be end of the "Cscope" menu. + ) + + +(defvar cscope-list-entry-hook nil + "*Hook run after cscope-list-entry-mode entered.") + + +(defun cscope-list-entry-mode () + "Major mode for jumping/showing entry from the list in the *cscope* buffer. + +\\{cscope-list-entry-keymap}" + (use-local-map cscope-list-entry-keymap) + (setq buffer-read-only t + mode-name "cscope" + major-mode 'cscope-list-entry-mode + overlay-arrow-string cscope-overlay-arrow-string) + (or overlay-arrow-position + (setq overlay-arrow-position (make-marker))) + (run-hooks 'cscope-list-entry-hook)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar cscope-output-buffer-name "*cscope*" + "The name of the cscope output buffer.") + + +(defvar cscope-info-buffer-name "*cscope-info*" + "The name of the cscope information buffer.") + + +(defvar cscope-process nil + "The current cscope process.") +(make-variable-buffer-local 'cscope-process) + + +(defvar cscope-process-output nil + "A buffer for holding partial cscope process output.") +(make-variable-buffer-local 'cscope-process-output) + + +(defvar cscope-command-args nil + "Internal variable for holding major command args to pass to cscope.") +(make-variable-buffer-local 'cscope-command-args) + + +(defvar cscope-start-directory nil + "Internal variable used to save the initial start directory. +The results buffer gets reset to this directory when a search has +completely finished.") +(make-variable-buffer-local 'cscope-start-directory) + + +(defvar cscope-search-list nil + "A list of (DIR . FLAGS) entries. +This is a list of database directories to search. Each entry in the list +is a (DIR . FLAGS) cell. DIR is the directory to search, and FLAGS are the +flags to pass to cscope when using this database directory. FLAGS can be +nil (meaning, \"no flags\").") +(make-variable-buffer-local 'cscope-search-list) + + +(defvar cscope-searched-dirs nil + "The list of database directories already searched.") +(make-variable-buffer-local 'cscope-searched-dirs) + + +(defvar cscope-filter-func nil + "Internal variable for holding the filter function to use (if any) when +searching.") +(make-variable-buffer-local 'cscope-filter-func) + + +(defvar cscope-sentinel-func nil + "Internal variable for holding the sentinel function to use (if any) when +searching.") +(make-variable-buffer-local 'cscope-filter-func) + + +(defvar cscope-last-file nil + "The file referenced by the last line of cscope process output.") +(make-variable-buffer-local 'cscope-last-file) + + +(defvar cscope-start-time nil + "The search start time, in seconds.") +(make-variable-buffer-local 'cscope-start-time) + + +(defvar cscope-first-match nil + "The first match result output by cscope.") +(make-variable-buffer-local 'cscope-first-match) + + +(defvar cscope-first-match-point nil + "Buffer location of the first match.") +(make-variable-buffer-local 'cscope-first-match-point) + + +(defvar cscope-item-start nil + "The point location of the start of a search's output, before header info.") +(make-variable-buffer-local 'cscope-output-start) + + +(defvar cscope-output-start nil + "The point location of the start of a search's output.") +(make-variable-buffer-local 'cscope-output-start) + + +(defvar cscope-matched-multiple nil + "Non-nil if cscope output multiple matches.") +(make-variable-buffer-local 'cscope-matched-multiple) + + +(defvar cscope-stop-at-first-match-dir-meta nil + "") +(make-variable-buffer-local 'cscope-stop-at-first-match-dir-meta) + + +(defvar cscope-symbol nil + "The last symbol searched for.") + + +(defvar cscope-adjust t + "True if the symbol searched for (cscope-symbol) should be on +the line specified by the cscope database. In such cases the point will be +adjusted if need be (fuzzy matching).") + + +(defvar cscope-adjust-range 1000 + "How far the point should be adjusted if the symbol is not on the line +specified by the cscope database.") + + +(defvar cscope-marker nil + "The location from which cscope was invoked.") + + +(defvar cscope-marker-window nil + "The window which should contain cscope-marker. This is the window from +which cscope-marker is set when searches are launched from the *cscope* +buffer.") + + +(defvar cscope-marker-ring-length 16 + "Length of the cscope marker ring.") + + +(defvar cscope-marker-ring (make-ring cscope-marker-ring-length) + "Ring of markers which are locations from which cscope was invoked.") + + +(defvar cscope-initial-directory nil + "When set the directory in which searches for the cscope database +directory should begin.") + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar cscope:map nil + "The cscope keymap.") +(if cscope:map + nil + (setq cscope:map (make-sparse-keymap)) + ;; The following line corresponds to be beginning of the "Cscope" menu. + (define-key cscope:map "\C-css" 'cscope-find-this-symbol) + (define-key cscope:map "\C-csd" 'cscope-find-global-definition) + (define-key cscope:map "\C-csg" 'cscope-find-global-definition) + (define-key cscope:map "\C-csG" 'cscope-find-global-definition-no-prompting) + (define-key cscope:map "\C-csc" 'cscope-find-functions-calling-this-function) + (define-key cscope:map "\C-csC" 'cscope-find-called-functions) + (define-key cscope:map "\C-cst" 'cscope-find-this-text-string) + (define-key cscope:map "\C-cse" 'cscope-find-egrep-pattern) + (define-key cscope:map "\C-csf" 'cscope-find-this-file) + (define-key cscope:map "\C-csi" 'cscope-find-files-including-file) + ;; --- (The '---' indicates that this line corresponds to a menu separator.) + (define-key cscope:map "\C-csb" 'cscope-display-buffer) + (define-key cscope:map "\C-csB" 'cscope-display-buffer-toggle) + (define-key cscope:map "\C-csn" 'cscope-next-symbol) + (define-key cscope:map "\C-csN" 'cscope-next-file) + (define-key cscope:map "\C-csp" 'cscope-prev-symbol) + (define-key cscope:map "\C-csP" 'cscope-prev-file) + (define-key cscope:map "\C-csu" 'cscope-pop-mark) + ;; --- + (define-key cscope:map "\C-csa" 'cscope-set-initial-directory) + (define-key cscope:map "\C-csA" 'cscope-unset-initial-directory) + ;; --- + (define-key cscope:map "\C-csL" 'cscope-create-list-of-files-to-index) + (define-key cscope:map "\C-csI" 'cscope-index-files) + (define-key cscope:map "\C-csE" 'cscope-edit-list-of-files-to-index) + (define-key cscope:map "\C-csW" 'cscope-tell-user-about-directory) + (define-key cscope:map "\C-csS" 'cscope-tell-user-about-directory) + (define-key cscope:map "\C-csT" 'cscope-tell-user-about-directory) + (define-key cscope:map "\C-csD" 'cscope-dired-directory)) + ;; The previous line corresponds to be end of the "Cscope" menu. + +(easy-menu-define cscope:menu + (list cscope:map cscope-list-entry-keymap) + "cscope menu" + '("Cscope" + [ "Find symbol" cscope-find-this-symbol t ] + [ "Find global definition" cscope-find-global-definition t ] + [ "Find global definition no prompting" + cscope-find-global-definition-no-prompting t ] + [ "Find functions calling a function" + cscope-find-functions-calling-this-function t ] + [ "Find called functions" cscope-find-called-functions t ] + [ "Find text string" cscope-find-this-text-string t ] + [ "Find egrep pattern" cscope-find-egrep-pattern t ] + [ "Find a file" cscope-find-this-file t ] + [ "Find files #including a file" + cscope-find-files-including-file t ] + "-----------" + [ "Display *cscope* buffer" cscope-display-buffer t ] + [ "Auto display *cscope* buffer toggle" + cscope-display-buffer-toggle t ] + [ "Next symbol" cscope-next-symbol t ] + [ "Next file" cscope-next-file t ] + [ "Previous symbol" cscope-prev-symbol t ] + [ "Previous file" cscope-prev-file t ] + [ "Pop mark" cscope-pop-mark t ] + "-----------" + ( "Cscope Database" + [ "Set initial directory" + cscope-set-initial-directory t ] + [ "Unset initial directory" + cscope-unset-initial-directory t ] + "-----------" + [ "Create list of files to index" + cscope-create-list-of-files-to-index t ] + [ "Create list and index" + cscope-index-files t ] + [ "Edit list of files to index" + cscope-edit-list-of-files-to-index t ] + [ "Locate this buffer's cscope directory" + cscope-tell-user-about-directory t ] + [ "Dired this buffer's cscope directory" + cscope-dired-directory t ] + ) + "-----------" + ( "Options" + [ "Auto edit single match" + (setq cscope-edit-single-match + (not cscope-edit-single-match)) + :style toggle :selected cscope-edit-single-match ] + [ "Auto display *cscope* buffer" + (setq cscope-display-cscope-buffer + (not cscope-display-cscope-buffer)) + :style toggle :selected cscope-display-cscope-buffer ] + [ "Stop at first matching database" + (setq cscope-stop-at-first-match-dir + (not cscope-stop-at-first-match-dir)) + :style toggle + :selected cscope-stop-at-first-match-dir ] + [ "Never update cscope database" + (setq cscope-do-not-update-database + (not cscope-do-not-update-database)) + :style toggle :selected cscope-do-not-update-database ] + [ "Index recursively" + (setq cscope-index-recursively + (not cscope-index-recursively)) + :style toggle :selected cscope-index-recursively ] + [ "Suppress empty matches" + (setq cscope-suppress-empty-matches + (not cscope-suppress-empty-matches)) + :style toggle :selected cscope-suppress-empty-matches ] + [ "Use relative paths" + (setq cscope-use-relative-paths + (not cscope-use-relative-paths)) + :style toggle :selected cscope-use-relative-paths ] + [ "No mouse prompts" (setq cscope-no-mouse-prompts + (not cscope-no-mouse-prompts)) + :style toggle :selected cscope-no-mouse-prompts ] + ) + )) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Internal functions and variables +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar cscope-common-text-plist + (let (plist) + (setq plist (plist-put plist 'mouse-face 'cscope-mouse-face)) + plist) + "List of common text properties to be added to the entry line.") + + +(defun cscope-insert-with-text-properties (text filename &optional line-number) + "Insert an entry with given TEXT, add entry attributes as text properties. +The text properties to be added: +- common property: mouse-face, +- properties are used to open target file and its location: cscope-file, + cscope-line-number" + (let ((plist cscope-common-text-plist) + beg end) + (setq beg (point)) + (insert text) + (setq end (point) + plist (plist-put plist 'cscope-file filename)) + (if line-number + (progn + (if (stringp line-number) + (setq line-number (string-to-number line-number))) + (setq plist (plist-put plist 'cscope-line-number line-number)) + )) + (add-text-properties beg end plist) + )) + + +(if cscope-running-in-xemacs + (progn + (defalias 'cscope-event-window 'event-window) + (defalias 'cscope-event-point 'event-point) + (defalias 'cscope-recenter 'recenter) + ) + (defun cscope-event-window (event) + "Return the window at which the mouse EVENT occurred." + (posn-window (event-start event))) + (defun cscope-event-point (event) + "Return the point at which the mouse EVENT occurred." + (posn-point (event-start event))) + (defun cscope-recenter (&optional n window) + "Center point in WINDOW and redisplay frame. With N, put point on line N." + (save-selected-window + (if (windowp window) + (select-window window)) + (recenter n))) + ) + + +(defun cscope-show-entry-internal (file line-number + &optional save-mark-p window arrow-p) + "Display the buffer corresponding to FILE and LINE-NUMBER +in some window. If optional argument WINDOW is given, +display the buffer in that WINDOW instead. The window is +not selected. Save point on mark ring before goto +LINE-NUMBER if optional argument SAVE-MARK-P is non-nil. +Put `overlay-arrow-string' if arrow-p is non-nil. +Returns the window displaying BUFFER." + (let (buffer old-pos old-point new-point forward-point backward-point + line-end line-length) + (if (and (stringp file) + (integerp line-number)) + (progn + (unless (file-readable-p file) + (error "%s is not readable or exists" file)) + (setq buffer (find-file-noselect file)) + (if (windowp window) + (set-window-buffer window buffer) + (setq window (display-buffer buffer))) + (set-buffer buffer) + (if (> line-number 0) + (progn + (setq old-pos (point)) + (goto-line line-number) + (setq old-point (point)) + (if (and cscope-adjust cscope-adjust-range) + (progn + ;; Calculate the length of the line specified by cscope. + (end-of-line) + (setq line-end (point)) + (goto-char old-point) + (setq line-length (- line-end old-point)) + + ;; Search forward and backward for the pattern. + (setq forward-point (search-forward + cscope-symbol + (+ old-point + cscope-adjust-range) t)) + (goto-char old-point) + (setq backward-point (search-backward + cscope-symbol + (- old-point + cscope-adjust-range) t)) + (if forward-point + (progn + (if backward-point + (setq new-point + ;; Use whichever of forward-point or + ;; backward-point is closest to old-point. + ;; Give forward-point a line-length advantage + ;; so that if the symbol is on the current + ;; line the current line is chosen. + (if (<= (- (- forward-point line-length) + old-point) + (- old-point backward-point)) + forward-point + backward-point)) + (setq new-point forward-point))) + (if backward-point + (setq new-point backward-point) + (setq new-point old-point))) + (goto-char new-point) + (beginning-of-line) + (setq new-point (point))) + (setq new-point old-point)) + (set-window-point window new-point) + (if (and cscope-allow-arrow-overlays arrow-p) + (set-marker overlay-arrow-position (point)) + (set-marker overlay-arrow-position nil)) + (or (not save-mark-p) + (= old-pos (point)) + (push-mark old-pos)) + )) + + (if cscope-marker + (progn ;; The search was successful. Save the marker so it + ;; can be returned to by cscope-pop-mark. + (ring-insert cscope-marker-ring cscope-marker) + ;; Unset cscope-marker so that moving between matches + ;; (cscope-next-symbol, etc.) does not fill + ;; cscope-marker-ring. + (setq cscope-marker nil))) + (setq cscope-marker-window window) + ) + (message "No entry found at point.")) + ) + window) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; functions in *cscope* buffer which lists the search results +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun cscope-select-entry-other-window () + "Display the entry at point in other window, select the window. +Push current point on mark ring and select the entry window." + (interactive) + (let ((file (get-text-property (point) 'cscope-file)) + (line-number (get-text-property (point) 'cscope-line-number)) + window) + (setq window (cscope-show-entry-internal file line-number t)) + (if (windowp window) + (select-window window)) + )) + + +(defun cscope-select-entry-one-window () + "Display the entry at point in one window, select the window." + (interactive) + (let ((file (get-text-property (point) 'cscope-file)) + (line-number (get-text-property (point) 'cscope-line-number)) + window) + (setq window (cscope-show-entry-internal file line-number t)) + (if (windowp window) + (progn + (select-window window) + (sit-for 0) ;; Redisplay hack to allow delete-other-windows + ;; to continue displaying the correct location. + (delete-other-windows window) + )) + )) + + +(defun cscope-select-entry-specified-window (window) + "Display the entry at point in a specified window, select the window." + (interactive) + (let ((file (get-text-property (point) 'cscope-file)) + (line-number (get-text-property (point) 'cscope-line-number))) + (setq window (cscope-show-entry-internal file line-number t window)) + (if (windowp window) + (select-window window)) + )) + + +(defun cscope-mouse-select-entry-other-window (event) + "Display the entry over which the mouse event occurred, select the window." + (interactive "e") + (let ((ep (cscope-event-point event)) + (win (cscope-event-window event)) + buffer file line-number window) + (if ep + (progn + (setq buffer (window-buffer win) + file (get-text-property ep 'cscope-file buffer) + line-number (get-text-property ep 'cscope-line-number buffer)) + (select-window win) + (setq window (cscope-show-entry-internal file line-number t)) + (if (windowp window) + (select-window window)) + ) + (message "No entry found at point.") + ) + )) + + +(defun cscope-show-entry-other-window () + "Display the entry at point in other window. +Point is not saved on mark ring." + (interactive) + (let ((file (get-text-property (point) 'cscope-file)) + (line-number (get-text-property (point) 'cscope-line-number))) + (cscope-show-entry-internal file line-number nil nil t) + )) + + +(defun cscope-buffer-search (do-symbol do-next) + "The body of the following four functions." + (let* (line-number old-point point + (search-file (not do-symbol)) + (search-prev (not do-next)) + (direction (if do-next 1 -1)) + (old-buffer (current-buffer)) + (old-buffer-window (get-buffer-window old-buffer)) + (buffer (get-buffer cscope-output-buffer-name)) + (buffer-window (get-buffer-window (or buffer (error "The *cscope* buffer does not exist yet")))) + ) + (set-buffer buffer) + (setq old-point (point)) + (forward-line direction) + (setq point (point)) + (setq line-number (get-text-property point 'cscope-line-number)) + (while (or (not line-number) + (or (and do-symbol (= line-number -1)) + (and search-file (/= line-number -1)))) + (forward-line direction) + (setq point (point)) + (if (or (and do-next (>= point (point-max))) + (and search-prev (<= point (point-min)))) + (progn + (goto-char old-point) + (error "The %s of the *cscope* buffer has been reached" + (if do-next "end" "beginning")))) + (setq line-number (get-text-property point 'cscope-line-number))) + (if (eq old-buffer buffer) ;; In the *cscope* buffer. + (cscope-show-entry-other-window) + (cscope-select-entry-specified-window old-buffer-window) ;; else + (if (windowp buffer-window) + (set-window-point buffer-window point))) + (set-buffer old-buffer) + )) + + +(defun cscope-display-buffer () + "Display the *cscope* buffer." + (interactive) + (let ((buffer (get-buffer cscope-output-buffer-name))) + (if buffer + (pop-to-buffer buffer) + (error "The *cscope* buffer does not exist yet")))) + + +(defun cscope-display-buffer-toggle () + "Toggle cscope-display-cscope-buffer, which corresponds to +\"Auto display *cscope* buffer\"." + (interactive) + (setq cscope-display-cscope-buffer (not cscope-display-cscope-buffer)) + (message "The cscope-display-cscope-buffer variable is now %s." + (if cscope-display-cscope-buffer "set" "unset"))) + + +(defun cscope-next-symbol () + "Move to the next symbol in the *cscope* buffer." + (interactive) + (cscope-buffer-search t t)) + + +(defun cscope-next-file () + "Move to the next file in the *cscope* buffer." + (interactive) + (cscope-buffer-search nil t)) + + +(defun cscope-prev-symbol () + "Move to the previous symbol in the *cscope* buffer." + (interactive) + (cscope-buffer-search t nil)) + + +(defun cscope-prev-file () + "Move to the previous file in the *cscope* buffer." + (interactive) + (cscope-buffer-search nil nil)) + + +(defun cscope-pop-mark () + "Pop back to where cscope was last invoked." + (interactive) + + ;; This function is based on pop-tag-mark, which can be found in + ;; lisp/progmodes/etags.el. + + (if (ring-empty-p cscope-marker-ring) + (error "There are no marked buffers in the cscope-marker-ring yet")) + (let* ( (marker (ring-remove cscope-marker-ring 0)) + (old-buffer (current-buffer)) + (marker-buffer (marker-buffer marker)) + marker-window + (marker-point (marker-position marker)) + (cscope-buffer (get-buffer cscope-output-buffer-name)) ) + + ;; After the following both cscope-marker-ring and cscope-marker will be + ;; in the state they were immediately after the last search. This way if + ;; the user now makes a selection in the previously generated *cscope* + ;; buffer things will behave the same way as if that selection had been + ;; made immediately after the last search. + (setq cscope-marker marker) + + (if marker-buffer + (if (eq old-buffer cscope-buffer) + (progn ;; In the *cscope* buffer. + (set-buffer marker-buffer) + (setq marker-window (display-buffer marker-buffer)) + (set-window-point marker-window marker-point) + (select-window marker-window)) + (switch-to-buffer marker-buffer)) + (error "The marked buffer has been deleted")) + (goto-char marker-point) + (set-buffer old-buffer))) + + +(defun cscope-set-initial-directory (cs-id) + "Set the cscope-initial-directory variable. The +cscope-initial-directory variable, when set, specifies the directory +where searches for the cscope database directory should begin. This +overrides the current directory, which would otherwise be used." + (interactive "DCscope Initial Directory: ") + (setq cscope-initial-directory cs-id)) + + +(defun cscope-unset-initial-directory () + "Unset the cscope-initial-directory variable." + (interactive) + (setq cscope-initial-directory nil) + (message "The cscope-initial-directory variable is now unset.")) + + +(defun cscope-help () + (interactive) + (message + (format "RET=%s, SPC=%s, o=%s, n=%s, p=%s, q=%s, h=%s" + "Select" + "Show" + "SelectOneWin" + "ShowNext" + "ShowPrev" + "Quit" + "Help"))) + + +(defun cscope-bury-buffer () + "Clean up cscope, if necessary, and bury the buffer." + (interactive) + (let () + (if overlay-arrow-position + (set-marker overlay-arrow-position nil)) + (setq overlay-arrow-position nil + overlay-arrow-string nil) + (bury-buffer (get-buffer cscope-output-buffer-name)) + )) + + +(defun cscope-quit () + (interactive) + (cscope-bury-buffer) + (kill-buffer cscope-output-buffer-name) + ) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun cscope-canonicalize-directory (dir) + (or dir + (setq dir default-directory)) + (setq dir (file-name-as-directory + (expand-file-name (substitute-in-file-name dir)))) + dir + ) + + +(defun cscope-search-directory-hierarchy (directory) + "Look for a cscope database in the directory hierarchy. +Starting from DIRECTORY, look upwards for a cscope database." + (let (this-directory database-dir) + (catch 'done + (if (file-regular-p directory) + (throw 'done directory)) + (setq directory (cscope-canonicalize-directory directory) + this-directory directory) + (while this-directory + (if (or (file-exists-p (concat this-directory cscope-database-file)) + (file-exists-p (concat this-directory cscope-index-file))) + (progn + (setq database-dir this-directory) + (throw 'done database-dir) + )) + (if (string-match "^\\(/\\|[A-Za-z]:[\\/]\\)$" this-directory) + (throw 'done directory)) + (setq this-directory (file-name-as-directory + (file-name-directory + (directory-file-name this-directory)))) + )) + )) + + +(defun cscope-find-info (top-directory) + "Locate a suitable cscope database directory. +First, `cscope-database-regexps' is used to search for a suitable +database directory. If a database location cannot be found using this +variable, then the current directory is searched, then the parent, +then the parent's parent, until a cscope database directory is found, +or the root directory is reached. If the root directory is reached, +the current directory will be used." + (let (info regexps dir-regexp this-directory) + (setq top-directory (cscope-canonicalize-directory + (or top-directory cscope-initial-directory))) + (catch 'done + ;; Try searching using `cscope-database-regexps' ... + (setq regexps cscope-database-regexps) + (while regexps + (setq dir-regexp (car (car regexps))) + (cond + ( (stringp dir-regexp) + (if (string-match dir-regexp top-directory) + (progn + (setq info (cdr (car regexps))) + (throw 'done t) + )) ) + ( (and (symbolp dir-regexp) dir-regexp) + (progn + (setq info (cdr (car regexps))) + (throw 'done t) + ) )) + (setq regexps (cdr regexps)) + ) + + ;; Try looking in the directory hierarchy ... + (if (setq this-directory + (cscope-search-directory-hierarchy top-directory)) + (progn + (setq info (list (list this-directory))) + (throw 'done t) + )) + + ;; Should we add any more places to look? + + ) ;; end catch + (if (not info) + (setq info (list (list top-directory)))) + info + )) + + +(defun cscope-make-entry-line (func-name line-number line) + ;; The format of entry line: + ;; func-name[line-number]______line + ;; <- cscope-name-line-width -> + ;; `format' of Emacs doesn't have "*s" spec. + (let* ((fmt (format "%%%ds %%s" cscope-name-line-width)) + (str (format fmt (format "%s[%s]" func-name line-number) line)) + beg end) + (if cscope-use-face + (progn + (setq end (length func-name)) + (put-text-property 0 end 'face 'cscope-function-face str) + (setq beg (1+ end) + end (+ beg (length line-number))) + (put-text-property beg end 'face 'cscope-line-number-face str) + (setq end (length str) + beg (- end (length line))) + (put-text-property beg end 'face 'cscope-line-face str) + )) + str)) + + +(defun cscope-process-filter (process output) + "Accept cscope process output and reformat it for human readability. +Magic text properties are added to allow the user to select lines +using the mouse." + (let ( (old-buffer (current-buffer)) ) + (unwind-protect + (progn + (set-buffer (process-buffer process)) + ;; Make buffer-read-only nil + (let (buffer-read-only line file function-name line-number moving) + (setq moving (= (point) (process-mark process))) + (save-excursion + (goto-char (process-mark process)) + ;; Get the output thus far ... + (if cscope-process-output + (setq cscope-process-output (concat cscope-process-output + output)) + (setq cscope-process-output output)) + ;; Slice and dice it into lines. + ;; While there are whole lines left ... + (while (and cscope-process-output + (string-match "\\([^\n]+\n\\)\\(\\(.\\|\n\\)*\\)" + cscope-process-output)) + (setq file nil + glimpse-stripped-directory nil + ) + ;; Get a line + (setq line (substring cscope-process-output + (match-beginning 1) (match-end 1))) + (setq cscope-process-output (substring cscope-process-output + (match-beginning 2) + (match-end 2))) + (if (= (length cscope-process-output) 0) + (setq cscope-process-output nil)) + + ;; This should always match. + (if (string-match + "^\\([^ \t]+\\)[ \t]+\\([^ \t]+\\)[ \t]+\\([0-9]+\\)[ \t]+\\(.*\\)\n" + line) + (progn + (let (str) + (setq file (substring line (match-beginning 1) + (match-end 1)) + function-name (substring line (match-beginning 2) + (match-end 2)) + line-number (substring line (match-beginning 3) + (match-end 3)) + line (substring line (match-beginning 4) + (match-end 4)) + ) + ;; If the current file is not the same as the previous + ;; one ... + (if (not (and cscope-last-file + (string= file cscope-last-file))) + (progn + ;; The current file is different. + + ;; Insert a separating blank line if + ;; necessary. + (if cscope-last-file (insert "\n")) + ;; Insert the file name + (setq str (concat "*** " file ":")) + (if cscope-use-face + (put-text-property 0 (length str) + 'face 'cscope-file-face + str)) + (cscope-insert-with-text-properties + str + (expand-file-name file) + ;; Yes, -1 is intentional + -1) + (insert "\n") + )) + (if (not cscope-first-match) + (setq cscope-first-match-point (point))) + ;; ... and insert the line, with the + ;; appropriate indentation. + (cscope-insert-with-text-properties + (cscope-make-entry-line function-name + line-number + line) + (expand-file-name file) + line-number) + (insert "\n") + (setq cscope-last-file file) + (if cscope-first-match + (setq cscope-matched-multiple t) + (setq cscope-first-match + (cons (expand-file-name file) + (string-to-number line-number)))) + )) + (insert line "\n") + )) + (set-marker (process-mark process) (point)) + ) + (if moving + (goto-char (process-mark process))) + (set-buffer-modified-p nil) + )) + (set-buffer old-buffer)) + )) + + +(defun cscope-process-sentinel (process event) + "Sentinel for when the cscope process dies." + (let* ( (buffer (process-buffer process)) window update-window + (done t) (old-buffer (current-buffer)) + (old-buffer-window (get-buffer-window old-buffer)) ) + (set-buffer buffer) + (save-window-excursion + (save-excursion + (if (or (and (setq window (get-buffer-window buffer)) + (= (window-point window) (point-max))) + (= (point) (point-max))) + (progn + (setq update-window t) + )) + (delete-process process) + (let (buffer-read-only continue) + (goto-char (point-max)) + (if (and cscope-suppress-empty-matches + (= cscope-output-start (point))) + (delete-region cscope-item-start (point-max)) + (progn + (if (not cscope-start-directory) + (setq cscope-start-directory default-directory)) + (insert cscope-separator-line) + )) + (setq continue + (and cscope-search-list + (not (and cscope-first-match + cscope-stop-at-first-match-dir + (not cscope-stop-at-first-match-dir-meta))))) + (if continue + (setq continue (cscope-search-one-database))) + (if continue + (progn + (setq done nil) + ) + (progn + (insert "\nSearch complete.") + (if cscope-display-times + (let ( (times (current-time)) cscope-stop elapsed-time ) + (setq cscope-stop (+ (* (car times) 65536.0) + (car (cdr times)) + (* (car (cdr (cdr times))) 1.0E-6))) + (setq elapsed-time (- cscope-stop cscope-start-time)) + (insert (format " Search time = %.2f seconds." + elapsed-time)) + )) + (setq cscope-process nil) + (if cscope-running-in-xemacs + (setq modeline-process ": Search complete")) + (if cscope-start-directory + (setq default-directory cscope-start-directory)) + (if (not cscope-first-match) + (message "No matches were found.")) + ) + )) + (set-buffer-modified-p nil) + )) + (if (and done cscope-first-match-point update-window) + (if window + (set-window-point window cscope-first-match-point) + (goto-char cscope-first-match-point)) + ) + (cond + ( (not done) ;; we're not done -- do nothing for now + (if update-window + (if window + (set-window-point window (point-max)) + (goto-char (point-max)))) + ) + ( cscope-first-match + (if cscope-display-cscope-buffer + (if (and cscope-edit-single-match (not cscope-matched-multiple)) + (cscope-show-entry-internal(car cscope-first-match) + (cdr cscope-first-match) t)) + (cscope-select-entry-specified-window old-buffer-window)) + ) + ) + (if (and done (eq old-buffer buffer) cscope-first-match) + (cscope-help)) + (set-buffer old-buffer) + )) + + +(defun cscope-search-one-database () + "Pop a database entry from cscope-search-list and do a search there." + (let ( next-item options cscope-directory database-file outbuf done + base-database-file-name) + (setq outbuf (get-buffer-create cscope-output-buffer-name)) + (save-excursion + (catch 'finished + (set-buffer outbuf) + (setq options '("-L")) + (while (and (not done) cscope-search-list) + (setq next-item (car cscope-search-list) + cscope-search-list (cdr cscope-search-list) + base-database-file-name cscope-database-file + ) + (if (listp next-item) + (progn + (setq cscope-directory (car next-item)) + (if (not (stringp cscope-directory)) + (setq cscope-directory + (cscope-search-directory-hierarchy + default-directory))) + (if (file-regular-p cscope-directory) + (progn + ;; Handle the case where `cscope-directory' is really + ;; a full path name to a cscope database. + (setq base-database-file-name + (file-name-nondirectory cscope-directory) + cscope-directory + (file-name-directory cscope-directory)) + )) + (setq cscope-directory + (file-name-as-directory cscope-directory)) + (if (not (member cscope-directory cscope-searched-dirs)) + (progn + (setq cscope-searched-dirs (cons cscope-directory + cscope-searched-dirs) + done t) + )) + ) + (progn + (if (and cscope-first-match + cscope-stop-at-first-match-dir + cscope-stop-at-first-match-dir-meta) + (throw 'finished nil)) + )) + ) + (if (not done) + (throw 'finished nil)) + (if (car (cdr next-item)) + (let (newopts) + (setq newopts (car (cdr next-item))) + (if (not (listp newopts)) + (error (format "Cscope options must be a list: %s" newopts))) + (setq options (append options newopts)) + )) + (if cscope-command-args + (setq options (append options cscope-command-args))) + (setq database-file (concat cscope-directory base-database-file-name) + cscope-searched-dirs (cons cscope-directory + cscope-searched-dirs) + ) + + ;; The database file and the directory containing the database file + ;; must both be writable. + (if (or (not (file-writable-p database-file)) + (not (file-writable-p (file-name-directory database-file))) + cscope-do-not-update-database) + (setq options (cons "-d" options))) + + (goto-char (point-max)) + (setq cscope-item-start (point)) + (if (string= base-database-file-name cscope-database-file) + (insert "\nDatabase directory: " cscope-directory "\n" + cscope-separator-line) + (insert "\nDatabase directory/file: " + cscope-directory base-database-file-name "\n" + cscope-separator-line)) + ;; Add the correct database file to search + (setq options (cons base-database-file-name options)) + (setq options (cons "-f" options)) + (setq cscope-output-start (point)) + (setq default-directory cscope-directory) + (if cscope-filter-func + (progn + (setq cscope-process-output nil + cscope-last-file nil + ) + (setq cscope-process + (apply 'start-process "cscope" outbuf + cscope-program options)) + (set-process-filter cscope-process cscope-filter-func) + (set-process-sentinel cscope-process cscope-sentinel-func) + (set-marker (process-mark cscope-process) (point)) + (process-kill-without-query cscope-process) + (if cscope-running-in-xemacs + (setq modeline-process ": Searching ...")) + (setq buffer-read-only t) + ) + (apply 'call-process cscope-program nil outbuf t options) + ) + t + )) + )) + + +(defun cscope-call (msg args &optional directory filter-func sentinel-func) + "Generic function to call to process cscope requests. +ARGS is a list of command-line arguments to pass to the cscope +process. DIRECTORY is the current working directory to use (generally, +the directory in which the cscope database is located, but not +necessarily), if different that the current one. FILTER-FUNC and +SENTINEL-FUNC are optional process filter and sentinel, respectively." + (let ( (outbuf (get-buffer-create cscope-output-buffer-name)) + (old-buffer (current-buffer)) ) + (if cscope-process + (error "A cscope search is still in progress -- only one at a time is allowed")) + (setq directory (cscope-canonicalize-directory + (or cscope-initial-directory directory))) + (if (eq outbuf old-buffer) ;; In the *cscope* buffer. + (if cscope-marker-window + (progn + ;; Assume that cscope-marker-window is the window, from the + ;; users perspective, from which the search was launched and the + ;; window that should be returned to upon cscope-pop-mark. + (set-buffer (window-buffer cscope-marker-window)) + (setq cscope-marker (point-marker)) + (set-buffer old-buffer))) + (progn ;; Not in the *cscope buffer. + ;; Set the cscope-marker-window to whichever window this search + ;; was launched from. + (setq cscope-marker-window (get-buffer-window old-buffer)) + (setq cscope-marker (point-marker)))) + (save-excursion + (set-buffer outbuf) + (if cscope-display-times + (let ( (times (current-time)) ) + (setq cscope-start-time (+ (* (car times) 65536.0) (car (cdr times)) + (* (car (cdr (cdr times))) 1.0E-6))))) + (setq default-directory directory + cscope-start-directory nil + cscope-search-list (cscope-find-info directory) + cscope-searched-dirs nil + cscope-command-args args + cscope-filter-func filter-func + cscope-sentinel-func sentinel-func + cscope-first-match nil + cscope-first-match-point nil + cscope-stop-at-first-match-dir-meta (memq t cscope-search-list) + cscope-matched-multiple nil + buffer-read-only nil) + (buffer-disable-undo) + (erase-buffer) + (setq truncate-lines cscope-truncate-lines) + (if msg + (insert msg "\n")) + (cscope-search-one-database) + ) + (if cscope-display-cscope-buffer + (progn + (pop-to-buffer outbuf) + (cscope-help)) + (set-buffer outbuf)) + (goto-char (point-max)) + (cscope-list-entry-mode) + )) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar cscope-unix-index-process-buffer-name "*cscope-indexing-buffer*" + "The name of the buffer to use for displaying indexing status/progress.") + + +(defvar cscope-unix-index-process-buffer nil + "The buffer to use for displaying indexing status/progress.") + + +(defvar cscope-unix-index-process nil + "The current indexing process.") + + +(defun cscope-unix-index-files-sentinel (process event) + "Simple sentinel to print a message saying that indexing is finished." + (let (buffer) + (save-window-excursion + (save-excursion + (setq buffer (process-buffer process)) + (set-buffer buffer) + (goto-char (point-max)) + (insert cscope-separator-line "\nIndexing finished\n") + (delete-process process) + (setq cscope-unix-index-process nil) + (set-buffer-modified-p nil) + )) + )) + + +(defun cscope-unix-index-files-internal (top-directory header-text args) + "Core function to call the indexing script." + (let () + (save-excursion + (setq top-directory (cscope-canonicalize-directory top-directory)) + (setq cscope-unix-index-process-buffer + (get-buffer-create cscope-unix-index-process-buffer-name)) + (display-buffer cscope-unix-index-process-buffer) + (set-buffer cscope-unix-index-process-buffer) + (setq buffer-read-only nil) + (setq default-directory top-directory) + (buffer-disable-undo) + (erase-buffer) + (if header-text + (insert header-text)) + (setq args (append args + (list "-v" + "-i" cscope-index-file + "-f" cscope-database-file + (if cscope-use-relative-paths + "." top-directory)))) + (if cscope-index-recursively + (setq args (cons "-r" args))) + (setq cscope-unix-index-process + (apply 'start-process "cscope-indexer" + cscope-unix-index-process-buffer + cscope-indexing-script args)) + (set-process-sentinel cscope-unix-index-process + 'cscope-unix-index-files-sentinel) + (process-kill-without-query cscope-unix-index-process) + ) + )) + + +(defun cscope-index-files (top-directory) + "Index files in a directory. +This function creates a list of files to index, and then indexes +the listed files. +The variable, \"cscope-index-recursively\", controls whether or not +subdirectories are indexed." + (interactive "DIndex files in directory: ") + (let () + (cscope-unix-index-files-internal + top-directory + (format "Creating cscope index `%s' in:\n\t%s\n\n%s" + cscope-database-file top-directory cscope-separator-line) + nil) + )) + + +(defun cscope-create-list-of-files-to-index (top-directory) + "Create a list of files to index. +The variable, \"cscope-index-recursively\", controls whether or not +subdirectories are indexed." + (interactive "DCreate file list in directory: ") + (let () + (cscope-unix-index-files-internal + top-directory + (format "Creating cscope file list `%s' in:\n\t%s\n\n" + cscope-index-file top-directory) + '("-l")) + )) + + +(defun cscope-edit-list-of-files-to-index () + "Search for and edit the list of files to index. +If this functions causes a new file to be edited, that means that a +cscope.out file was found without a corresponding cscope.files file." + (interactive) + (let (info directory file) + (setq info (cscope-find-info nil)) + (if (/= (length info) 1) + (error "There is no unique cscope database directory!")) + (setq directory (car (car info))) + (if (not (stringp directory)) + (setq directory + (cscope-search-directory-hierarchy default-directory))) + (setq file (concat (file-name-as-directory directory) cscope-index-file)) + (find-file file) + (message (concat "File: " file)) + )) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun cscope-tell-user-about-directory () + "Display the name of the directory containing the cscope database." + (interactive) + (let (info directory) + (setq info (cscope-find-info nil)) + (if (= (length info) 1) + (progn + (setq directory (car (car info))) + (message (concat "Cscope directory: " directory)) + ) + (let ( (outbuf (get-buffer-create cscope-info-buffer-name)) ) + (display-buffer outbuf) + (save-excursion + (set-buffer outbuf) + (buffer-disable-undo) + (erase-buffer) + (insert "Cscope search directories:\n") + (while info + (if (listp (car info)) + (progn + (setq directory (car (car info))) + (if (not (stringp directory)) + (setq directory + (cscope-search-directory-hierarchy + default-directory))) + (insert "\t" directory "\n") + )) + (setq info (cdr info)) + ) + ) + )) + )) + + +(defun cscope-dired-directory () + "Run dired upon the cscope database directory. +If possible, the cursor is moved to the name of the cscope database +file." + (interactive) + (let (info directory buffer p1 p2 pos) + (setq info (cscope-find-info nil)) + (if (/= (length info) 1) + (error "There is no unique cscope database directory!")) + (setq directory (car (car info))) + (if (not (stringp directory)) + (setq directory + (cscope-search-directory-hierarchy default-directory))) + (setq buffer (dired-noselect directory nil)) + (switch-to-buffer buffer) + (set-buffer buffer) + (save-excursion + (goto-char (point-min)) + (setq p1 (search-forward cscope-index-file nil t)) + (if p1 + (setq p1 (- p1 (length cscope-index-file)))) + ) + (save-excursion + (goto-char (point-min)) + (setq p2 (search-forward cscope-database-file nil t)) + (if p2 + (setq p2 (- p2 (length cscope-database-file)))) + ) + (cond + ( (and p1 p2) + (if (< p1 p2) + (setq pos p1) + (setq pos p2)) + ) + ( p1 + (setq pos p1) + ) + ( p2 + (setq pos p2) + ) + ) + (if pos + (set-window-point (get-buffer-window buffer) pos)) + )) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun cscope-extract-symbol-at-cursor (extract-filename) + (let* ( (symbol-chars (if extract-filename + cscope-filename-chars + cscope-symbol-chars)) + (symbol-char-regexp (concat "[" symbol-chars "]")) + ) + (save-excursion + (buffer-substring-no-properties + (progn + (if (not (looking-at symbol-char-regexp)) + (re-search-backward "\\w" nil t)) + (skip-chars-backward symbol-chars) + (point)) + (progn + (skip-chars-forward symbol-chars) + (point) + ))) + )) + + +(defun cscope-prompt-for-symbol (prompt extract-filename) + "Prompt the user for a cscope symbol." + (let (sym) + (setq sym (cscope-extract-symbol-at-cursor extract-filename)) + (if (or (not sym) + (string= sym "") + (not (and cscope-running-in-xemacs + cscope-no-mouse-prompts current-mouse-event + (or (mouse-event-p current-mouse-event) + (misc-user-event-p current-mouse-event)))) + ;; Always prompt for symbol in dired mode. + (eq major-mode 'dired-mode) + ) + (setq sym (read-from-minibuffer prompt sym)) + sym) + )) + + +(defun cscope-find-this-symbol (symbol) + "Locate a symbol in source code." + (interactive (list + (cscope-prompt-for-symbol "Find this symbol: " nil) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding symbol: %s" symbol) + (list "-0" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-global-definition (symbol) + "Find a symbol's global definition." + (interactive (list + (cscope-prompt-for-symbol "Find this global definition: " nil) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding global definition: %s" symbol) + (list "-1" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-global-definition-no-prompting () + "Find a symbol's global definition without prompting." + (interactive) + (let ( (symbol (cscope-extract-symbol-at-cursor nil)) + (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding global definition: %s" symbol) + (list "-1" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-called-functions (symbol) + "Display functions called by a function." + (interactive (list + (cscope-prompt-for-symbol + "Find functions called by this function: " nil) + )) + (let ( (cscope-adjust nil) ) ;; Disable fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding functions called by: %s" symbol) + (list "-2" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-functions-calling-this-function (symbol) + "Display functions calling a function." + (interactive (list + (cscope-prompt-for-symbol + "Find functions calling this function: " nil) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding functions calling: %s" symbol) + (list "-3" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-this-text-string (symbol) + "Locate where a text string occurs." + (interactive (list + (cscope-prompt-for-symbol "Find this text string: " nil) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding text string: %s" symbol) + (list "-4" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-egrep-pattern (symbol) + "Run egrep over the cscope database." + (interactive (list + (let (cscope-no-mouse-prompts) + (cscope-prompt-for-symbol "Find this egrep pattern: " nil)) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding egrep pattern: %s" symbol) + (list "-6" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-this-file (symbol) + "Locate a file." + (interactive (list + (let (cscope-no-mouse-prompts) + (cscope-prompt-for-symbol "Find this file: " t)) + )) + (let ( (cscope-adjust nil) ) ;; Disable fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding file: %s" symbol) + (list "-7" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +(defun cscope-find-files-including-file (symbol) + "Locate all files #including a file." + (interactive (list + (let (cscope-no-mouse-prompts) + (cscope-prompt-for-symbol + "Find files #including this file: " t)) + )) + (let ( (cscope-adjust t) ) ;; Use fuzzy matching. + (setq cscope-symbol symbol) + (cscope-call (format "Finding files #including file: %s" symbol) + (list "-8" symbol) nil 'cscope-process-filter + 'cscope-process-sentinel) + )) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defvar cscope-minor-mode nil + "") +(make-variable-buffer-local 'cscope-minor-mode) +(put 'cscope-minor-mode 'permanent-local t) + + +(defun cscope-minor-mode (&optional arg) + "" + (progn + (setq cscope-minor-mode (if (null arg) t (car arg))) + (if cscope-minor-mode + (progn + (easy-menu-add cscope:menu cscope:map) + (run-hooks 'cscope-minor-mode-hooks) + )) + cscope-minor-mode + )) + + +(defun cscope:hook () + "" + (progn + (cscope-minor-mode) + )) + + +(or (assq 'cscope-minor-mode minor-mode-map-alist) + (setq minor-mode-map-alist (cons (cons 'cscope-minor-mode cscope:map) + minor-mode-map-alist))) + +(add-hook 'c-mode-hook (function cscope:hook)) +(add-hook 'c++-mode-hook (function cscope:hook)) +(add-hook 'dired-mode-hook (function cscope:hook)) + +(provide 'xcscope) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..db2961e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,192 @@ +cscope (15.6-2) unstable; urgency=low + + * Fix crash on resize when used inside vim. Patch taken from upstream BTS + (Closes: #374994) + * Add watch file again + + -- Tobias Klauser <tklauser@access.unizh.ch> Sat, 21 Oct 2006 14:46:49 +0200 + +cscope (15.6-1) unstable; urgency=low + + * New upstream release + - Fixes a segfault when creating an inverted index and thus makes our own + patch obsolete (#386595). + + -- Tobias Klauser <tklauser@access.unizh.ch> Tue, 17 Oct 2006 14:16:17 +0200 + +cscope (15.5+cvs20060902-3) unstable; urgency=low + + * Fix a segfault when creating an inverted index (Closes: #386595). Thanks + to Mike Stroyan <mike.stroyan@hp.com> + * Replace symlink to the GPL in /usr/share/doc/cscope/contrib/webcscope by a + license statement in debian/copyright. This fixes a linda warning. + * Mention xcscope license and copyright information in debian/copyright + * Remove pointless symlink to xcscope.el from cscope documentation + directory. + * CVE-2006-4262 was fixed with 15.5+cvs20060902-1 but I forgot to mention in + the changelog, sorry! + + -- Tobias Klauser <tklauser@access.unizh.ch> Fri, 29 Sep 2006 12:03:40 +0200 + +cscope (15.5+cvs20060902-2) unstable; urgency=low + + * Restore accidentally removed manpages ocs.1 and cscope-indexer.1 + + -- Tobias Klauser <tklauser@access.unizh.ch> Sun, 3 Sep 2006 15:38:23 +0200 + +cscope (15.5+cvs20060902-1) unstable; urgency=low + + * New snapshot from upstream CVS as of 2006-09-02. Fixes the following bug: + - Handle trailing ':' in VPATH envvar correctly, thanks Mattia Dongili + (Closes: #353528) + * New maintainer (Closes: #378802) + * Remove Build-Depends on automake-1.7 as it was only there to shut up a + warning which does not show up anymore. + * Remove watch file + + -- Tobias Klauser <tklauser@access.unizh.ch> Sat, 2 Sep 2006 19:25:48 +0200 + +cscope (15.5+cvs20050816-2) unstable; urgency=low + + * QA Upload (Ack NMU, Closes: #340177) + * Set Maintainer to QA Group, Orphaned: #378802 + * Conforms to latest Standards Version 3.7.2 + + -- Michael Ablassmeier <abi@debian.org> Tue, 1 Aug 2006 11:04:19 +0200 + +cscope (15.5+cvs20050816-1.1) unstable; urgency=high + + * Non-maintainer upload. + * Apply patch from Alec Berryman <alec@thened.net> to fix + CVE-2004-2541.diff (Closes: #340177). + + -- Julien Cristau <julien.cristau@ens-lyon.org> Sat, 10 Jun 2006 20:06:36 +0200 + +cscope (15.5+cvs20050816-1) unstable; urgency=low + + * New upstream CVS as of 2005-08-16. Fixes the following in Debian BTS: + - 2004-06-23 Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> + * src/dir.c (makefilelist): Fix broken movement of point_in_line + when parsing quoted names. Simplify structure by moving default + handling upward. + Closes: Bug#298931 - bug in handling quote-protected filenames in + cscope.files + - 2004-12-06 Neil Horman <nhorman@gmail.com> + * src/main.c: Fix for temp file security bug (sourceforge + bug number 1062807 / CAN-2004-0970 [sic, should be CAN-2004-0996]) + Acknowledge NMU of 15.5-1.1 (Thanks to Joey Hess, Martin Pitt + and Gerardo Di Giacomo). Upstream fixed the same issue in a + slightly different way, by creating a temp directory to store + the temp files. (Closes: #282815) + * xcscope.el: Applied Lasse Kantola's change_let_to_setq.patch + so that disabling of fuzzy matching would work correctly. + (Closes: Bug#315466) + * Adds Build-Depends: automake1.7 to avoid warnings. + * Updated Standards-Version: from to 3.6.2. + * Updated author list in debian/copyright. + + -- Anthony Fok <foka@debian.org> Sun, 13 Nov 2005 00:30:02 +0800 + +cscope (15.5-1.1) unstable; urgency=HIGH + + * NMU to fix temp file security hole. Closes: #282815 (CAN-2004-0996) + * Incorporates a patch by Martin Pitt <martin.pitt@canonical.com>: + * SECURITY UPDATE: insecure temp file creation vulnerability + * src/main.c: + - modified the temporary file creation procedure + * References: + - CAN-2004-0996 + - http://lists.netsys.com/pipermail/full-disclosure/2004-November/029341.html + * Thanks to Gerardo Di Giacomo <gerardo@linux.it> for his assistance with + the patch + + -- Joey Hess <joeyh@debian.org> Sun, 5 Dec 2004 12:45:00 -0500 + +cscope (15.5-1) unstable; urgency=low + + * New upstream release. (Closes: Bug#236296) + * cscope man page line-breaking problem has been fixed upstream. + (Closes: Bug#176003, Bug#245705) + * Added cscope-index.1 man page, thanks to Robert Lemmen! + (Closes: Bug#174689) + * Updated to Standards-Version: 3.6.1. + * Fixed debian/watch. + + -- Anthony Fok <foka@debian.org> Thu, 29 Apr 2004 22:35:29 +0800 + +cscope (15.4-2) unstable; urgency=high + + * config.guess and config.sub too old. Updated with the ones in + /usr/share/misc. Thanks to LaMont Jones for the bug report. + Also, the new bison did not like the extraneous "=". Removed them. + Thanks to Junichi Uekawa for the added note. (Closes: Bug#163465) + * Minor fixes (incremented debhelper dependencies, shortened description) + + -- Anthony Fok <foka@debian.org> Sun, 3 Nov 2002 00:28:19 +0800 + +cscope (15.4-1) unstable; urgency=low + + * New upstream release. Thanks to GOTO Masanori for notifying me. + (Closes: Bug#163309) + + -- Anthony Fok <foka@debian.org> Sun, 6 Oct 2002 03:59:56 +0800 + +cscope (15.3-1) unstable; urgency=low + + * New upstream release. (Thanks to GOTO Masanori for the notification). + (Closes: Bug#104084) + * Upstream seems to have fixed the "cscope hangs on trivial file not + ending in newline" problem too. :-) Thanks to Bradley A. Bosch + for reporting the problem. (Closes: Bug#98461) + * Added manpage for ocs(1) kindly provided by Nick Rusnov <nick@grawk.net>. + Many thanks! (Closes: Bug#100418) + * Upgraded to Standards-Version: 3.5.6. + * Added webcscope in /usr/share/doc/cscope/contrib. + * Installed xcscope, an (X)Emacs interface for cscope. + + -- Anthony Fok <foka@debian.org> Mon, 12 Nov 2001 01:48:57 +0800 + +cscope (15.1-1) unstable; urgency=low + + * New upstream release. + + -- Anthony Fok <foka@debian.org> Sat, 2 Dec 2000 03:40:32 -0700 + +cscope (15.0bl2-1) unstable; urgency=low + + * New upstream release. According to the upstream maintainer, + it should be a lot more stable than 13.0x even though it's still + in a pre-alpha stage, + * Added contrib files in /usr/share/doc/cscope/contrib. + + -- Anthony Fok <foka@debian.org> Wed, 17 May 2000 13:51:19 -0600 + +cscope (13.0.0.20000419-2) unstable; urgency=low + + * [debian/control]: + - Now Suggests: cbrowser, a great Tcl-based front-end to cscope. + - Added "Open-Sourced by" and "Maintainer" to the package description. + + -- Anthony Fok <foka@debian.org> Wed, 17 May 2000 02:02:26 -0600 + +cscope (13.0.0.20000419-1) unstable; urgency=low + + * New upstream post-13.0 CVS updates as of 2000-04-19. + * [common/library.h]: Added parentheses around `strcpy', `strncpy', + `strpbrk' and `strchr' since they are defined as macros in + glibc2, and cscope would not compile with CFLAGS="-O2" unless + things like `char *strcpy()' is changed to `char *(strcpy)()'. + * [debian/rules]: Uses CFLAGS="-O2 -g -Wall". + * [debian/control]: Added Build-Depends line. + * [debian/copyright]: Added the address to cscope's home page. + + -- Anthony Fok <foka@debian.org> Thu, 20 Apr 2000 13:15:18 -0600 + +cscope (13.0-1) unstable; urgency=low + + * Initial Release. + * [common/main.c]: Changed TMPDIR from "/usr/tmp" to "/tmp" as per FHS, + otherwise cscope simply doesn't work. /usr/tmp does not exist + on Debian. + + -- Anthony Fok <foka@debian.org> Wed, 19 Apr 2000 15:34:00 -0600 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +4 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..175a823 --- /dev/null +++ b/debian/control @@ -0,0 +1,29 @@ +Source: cscope +Section: devel +Priority: optional +Maintainer: Tobias Klauser <tklauser@access.unizh.ch> +Build-Depends: debhelper (>= 4), dpatch, autotools-dev, bison, flex, libncurses5-dev +Standards-Version: 3.7.2 + +Package: cscope +Architecture: any +Depends: ${shlibs:Depends} +Suggests: cbrowser +Description: Interactively examine a C program source + Cscope is an interactive text screen based source browsing tool. + Although it is primarily designed to search C code (including lex + and yacc files), it can also be used for C++ code. + . + Using cscope, you can easily search for where symbols are used and + defined. Cscope is designed to answer questions like: + . + Where is this variable used? + What is the value of this preprocessor symbol? + Where is this function in the source files? + What functions call this function? + What functions are called by this function? + Where does the message "out of space" come from? + Where is this source file in the directory structure? + What files include this header file? + . + Homepage: <http://cscope.sourceforge.net/> diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..ca8bbfd --- /dev/null +++ b/debian/copyright @@ -0,0 +1,93 @@ +This package was first debianized by Anthony Fok <foka@debian.org> on +Wed, 19 Apr 2000 13:23:08 -0600. + +It was downloaded from <http://cscope.sourceforge.net/> + +Upstream Authors: + Joe Steffen - Creator of Cscope + Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de> - Maintainer + Petr Sorfa <petr@users.sourceforge.net> - Initial OpenSource Maintainer + + Courtesy of: + The Santa Cruz Operation, Inc. (SCO) who released cscope + as Open Source software in April 2000. + +Copyright: (a BSD-style license, from the file COPYING) + + 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. + +Copyright: (webcscope) + Copyright (C) 2001, Ragho Mahalingam <ragho@mahalingam.com> + Copyright (C) 1999, Dmitry Obukhov, <dso@usa.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public +License can be found in `/usr/share/common-licenses/GPL'. + +Copyright: (cgi-lib.pl, part of webcscope) + Copyright (C) 1993-1999 Steven E. Brenner + + Permission granted to use and modify this library so long as the + copyright above is maintained, modifications are documented, and + credit is given for any use of the library. + +Copyright: (xcscope and cscope-indexer) + Copyright (C) 2000, Darryl Okahata <darrylo@sonic.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public +License can be found in `/usr/share/common-licenses/GPL'. diff --git a/debian/cscope-indexer.1 b/debian/cscope-indexer.1 new file mode 100644 index 0000000..5e0f296 --- /dev/null +++ b/debian/cscope-indexer.1 @@ -0,0 +1,61 @@ +.TH cscope-indexer 1 "30. December 2002" "Script to index files for cscope" +.SH NAME +cscope-indexer \- Script to index files for cscope + +.SH SYNOPSIS +.B cscope-indexer [\fI-v\fR] [\fI-f database_file\fR] [\fI-i list_file\fR] +[\fI-l\fR] [\fI-r\fR] + +.SH DESCRIPTION +This script generates a list of files to index +(cscope.out), which is then (optionally) used to +generate a cscope database. You can use this script +to just build a list of files, or it can be used to +build a list and database. This script is not used to +just build a database (skipping the list of files +step), as this can be simply done by just calling +"cscope -b". + +Normally, cscope will do its own indexing, but this +script can be used to force indexing. This is useful +if you need to recurse into subdirectories, or have +many files to index (you can run this script from a +cron job, during the night). It is especially useful +for large projects, which can contstantly have source +files added and deleted; by using this script, the +changing sources files are automatically handled. + +Currently, any paths containing "/CVS/" or "/RCS/" are +stripped out (ignored). + +.SH OPTIONS +.TP +.B \-f database_file +Specifies the cscope database file (default: cscope.out). + +.TP +.B \-i list_file +Specifies the name of the file into which the list of files +to index is placed (default: cscope.files). + +.TP +.B \-l +Suppress the generation/updating of the cscope database +file. Only a list of files is generated. + +.TP +.B \-r +Recurse into subdirectories to locate files to index. +Without this option, only the current directory is +searched. + +.TP +.B \-v +Be verbose. Output simple progress messages. + +.SH "SEE ALSO" +.BR cscope (1) + +.SH AUTHOR +This manual page was written for the Debian GNU/Linux system by Robert Lemmen +<robertle@semistable.com> (but may be used by others, of course) diff --git a/debian/emacsen-startup b/debian/emacsen-startup new file mode 100644 index 0000000..5de02b7 --- /dev/null +++ b/debian/emacsen-startup @@ -0,0 +1 @@ +(require 'xcscope) diff --git a/debian/ocs.1 b/debian/ocs.1 new file mode 100644 index 0000000..450fea1 --- /dev/null +++ b/debian/ocs.1 @@ -0,0 +1,62 @@ +.\" +.\" This document is free to modify and distribute. +.\" +.TH ocs 1 "June 2001" "The Debian Project" + +.SH NAME +ocs \- creates and maintains the database for cscope on a recursive directory set +.SH SYNOPSIS +.B ocs +[-x] [-f] [-q] [-u] +.br + +.SH DESCRIPTION +This manual page briefly documents +.B ocs +, a shell script wrapper that automates the creation and maintainence of a +.BR cscope(1) +database on a recursive set of directories. Under normal circumstances, +.B ocs +generates a cscope database on a recursive group of directories starting from the current working directory, before launching +.BR cscope(1) +in interactive mode. +.br + +.SH OPTIONS +.B +.IP -x +Enable debugging. +.br +.B +.IP -f +Force. Do not ask about regenerating 'TMP' lists (lists generated by +.B ocs +), just do it; Allow the regeneration of 'CSD' (lists generated by +.BR cscope(1) +) lists. +.br +.B +.IP -q +Tell cscope to build a fast reverse index. Database disk space usage is doubled, but searching speed is increased. +.br +.B +.IP -u +Request that the database be updated or regenerated. +.br +.SH FILES +.IP ./cscope.rc +If this is an executable shell script, it will be included in the body of +.B ocs +in order to override intenal filenames and other options. See the comments at the top of +.B /usr/bin/ocs +for more information. +.SH BUGS +None noted. +.SH SEE ALSO +.BR cscope(1), +.BR /usr/bin/ocs. +.SH AUTHORS +.br +This manpage originally prepared by +.B Nick Rusnov +<nick@grawk.net> for the Debian Project. diff --git a/debian/patches/00list b/debian/patches/00list new file mode 100644 index 0000000..759b17a --- /dev/null +++ b/debian/patches/00list @@ -0,0 +1 @@ +01-fix-resize-crash-inside-vim diff --git a/debian/patches/01-fix-resize-crash-inside-vim.dpatch b/debian/patches/01-fix-resize-crash-inside-vim.dpatch new file mode 100755 index 0000000..e2fe9d2 --- /dev/null +++ b/debian/patches/01-fix-resize-crash-inside-vim.dpatch @@ -0,0 +1,55 @@ +#!/bin/sh /usr/share/dpatch/dpatch-run +## 01-fix-resize-crash-inside-vim.dpatch taken from upstream BTS +## +## DP: Fixes a crash on resize when used inside vim +## DP: (Closes: #374994) + +diff -urpN cscope-15.6.orig/src/main.c cscope-15.6/src/main.c +--- cscope-15.6.orig/src/main.c 2006-10-21 14:42:04.000000000 +0200 ++++ cscope-15.6/src/main.c 2006-10-21 14:44:50.000000000 +0200 +@@ -64,7 +64,7 @@ + #define DFLT_INCDIR "/usr/include" + #endif + +-static char const rcsid[] = "$Id: main.c,v 1.41 2006/08/20 15:00:34 broeker Exp $"; ++static char const rcsid[] = "$Id: main.c,v 1.42 2006/10/10 11:42:17 nhorman Exp $"; + + /* note: these digraph character frequencies were calculated from possible + printable digraphs in the cross-reference for the C compiler */ +@@ -128,7 +128,8 @@ sigwinch_handler(int sig, siginfo_t *inf + (void) sig; + (void) info; + (void) unused; +- ungetch(KEY_RESIZE); ++ if(incurses == YES) ++ ungetch(KEY_RESIZE); + } + #endif + +@@ -153,12 +154,6 @@ main(int argc, char **argv) + yyout = stdout; + /* save the command name for messages */ + argv0 = argv[0]; +-#if defined(KEY_RESIZE) && !defined(__DJGPP__) +- winch_action.sa_sigaction = sigwinch_handler; +- sigemptyset(&winch_action.sa_mask); +- winch_action.sa_flags = SA_SIGINFO; +- sigaction(SIGWINCH,&winch_action,NULL); +-#endif + /* set the options */ + while (--argc > 0 && (*++argv)[0] == '-') { + /* HBB 20030814: add GNU-style --help and --version options */ +@@ -403,6 +398,13 @@ cscope: Could not create private temp di + signal(SIGINT, SIG_IGN); /* ignore interrupts */ + signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */ + ++#if defined(KEY_RESIZE) && !defined(__DJGPP__) ++ winch_action.sa_sigaction = sigwinch_handler; ++ sigemptyset(&winch_action.sa_mask); ++ winch_action.sa_flags = SA_SIGINFO; ++ sigaction(SIGWINCH,&winch_action,NULL); ++#endif ++ + /* initialize the curses display package */ + initscr(); /* initialize the screen */ + entercurses(); diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..969ccc2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,92 @@ +#!/usr/bin/make -f + +include /usr/share/dpatch/dpatch.make + +DEST = $(CURDIR)/debian/cscope + +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +config.status: patch-stamp configure + dh_testdir + CFLAGS="$(CFLAGS) -Wl,-z,defs" ./configure --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info + + +build: build-stamp + +build-stamp: config.status + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: unpatch + dh_testdir + dh_testroot + rm -f build-stamp + + -$(MAKE) distclean + +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs usr/share/emacs/site-lisp + + $(MAKE) install DESTDIR=$(DEST) + + # Install xcscope + install -m755 -p contrib/xcscope/cscope-indexer $(DEST)/usr/bin/ + install -m644 -p contrib/xcscope/xcscope.el $(DEST)/usr/share/emacs/site-lisp/ + +binary-indep: build install +# We have nothing to do by default. + +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs AUTHORS NEWS README TODO + dh_installman debian/ocs.1 debian/cscope-indexer.1 + install -d $(DEST)/usr/share/doc/cscope/contrib/webcscope + cp -av contrib/README $(DEST)/usr/share/doc/cscope/contrib + cp -av contrib/webcscope/cgi-lib.pl contrib/webcscope/cscope \ + contrib/webcscope/hilite.c contrib/webcscope/icons \ + contrib/webcscope/INSTALL contrib/webcscope/TODO \ + $(DEST)/usr/share/doc/cscope/contrib/webcscope + # Prevent CVS metadata from being installed + find $(DEST)/usr/share/doc/cscope/contrib/webcscope -type d -name CVS | xargs rm -rf + dh_installmenu + dh_installemacsen + dh_installchangelogs ChangeLog + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..17393d0 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://sf.net/cscope/cscope-(.*)\.tar\.gz @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..3663bcd --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,4 @@ +## Process this file with automake to produce Makefile.in + +man_MANS = cscope.1 +EXTRA_DIST = $(man_MANS) diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..a0e2233 --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,355 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = doc +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +man1dir = $(mandir)/man1 +am__installdirs = "$(DESTDIR)$(man1dir)" +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@ +CURSES_LIBS = @CURSES_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@ +GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@ +HAS_CURSES_FALSE = @HAS_CURSES_FALSE@ +HAS_CURSES_TRUE = @HAS_CURSES_TRUE@ +HAS_GNOME_FALSE = @HAS_GNOME_FALSE@ +HAS_GNOME_TRUE = @HAS_GNOME_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USING_GNOME2_FALSE = @USING_GNOME2_FALSE@ +USING_GNOME2_TRUE = @USING_GNOME2_TRUE@ +USING_LEX_FALSE = @USING_LEX_FALSE@ +USING_LEX_TRUE = @USING_LEX_TRUE@ +VERSION = @VERSION@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +gnome1 = @gnome1@ +gnome2 = @gnome2@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +man_MANS = cscope.1 +EXTRA_DIST = $(man_MANS) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-man1 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am uninstall-info-am uninstall-man uninstall-man1 + +# 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. +.NOEXPORT: diff --git a/doc/cscope.1 b/doc/cscope.1 new file mode 100644 index 0000000..3a6a6e6 --- /dev/null +++ b/doc/cscope.1 @@ -0,0 +1,592 @@ +.PU +.TH CSCOPE "1" "August 2003" "The Santa Cruz Operation" +.SH NAME +cscope - interactively examine a C program +.SH SYNOPSIS +.B cscope +.B [\-bCcdehkLlqRTUuVv] +.BI [\-F symfile ] +.BI [\-f reffile ] +.BI [\-I incdir ] +.BI [\-i namefile ] +.BI [\-[ 0123456789 ] pattern ] +.BI [\-p n ] +.BI [\-s dir ] +.BI [ files ] +.SH DESCRIPTION +.I cscope +is an interactive, screen-oriented tool that allows the user to +browse through C source files for specified elements of code. +.PP +By default, +.I cscope +examines the C (.c and .h), lex (.l), and yacc (.y) +source files in the current directory. +.I cscope +may also be invoked for +source files named on the command line. In either case, +.I cscope +searches the standard directories for #include files that it does not +find in the current directory. +.I cscope +uses a symbol cross-reference, called +cscope.out by default, to locate functions, function calls, macros, +variables, and preprocessor symbols in the files. +.PP +.I cscope +builds the symbol cross-reference the first time it is used on +the source files for the program being browsed. On a subsequent +invocation, +.I cscope +rebuilds the cross-reference only if a source file +has changed or the list of source files is different. When the +cross-reference is rebuilt, the data for the unchanged files are +copied from the old cross-reference, which makes rebuilding faster +than the initial build. +.SH OPTIONS +Some command line arguments can only occur as the the ony argument in +the execution of cscope. They cause the program to just print out +some output and exit immediately: +.TP +.B -h +View the long usage help display. +.TP +.B -V +Print on the first line of screen the version number of cscope. +.TP +.B --help +Same as +.B -h +.TP +.B --version +Same as +.B -V + +.PP +The following options can appear in any combination: +.TP +.B -b +Build the cross-reference only. +.TP +.B -C +Ignore letter case when searching. +.TP +.B -c +Use only ASCII characters in the cross-reference file, that is, +do not compress the data. +.TP +.B -d +Do not update the cross-reference. +.TP +.B -e +Suppress the <Ctrl>-e command prompt between files. +.TP +.BI -F symfile +Read symbol reference lines from +.I symfile. +(A symbol reference +file is created by > and >>, and can also be read using the < +command, described under ``Issuing Subsequent Requests,'' +below.) +.TP +.BI -f reffile +Use +.I reffile +as the cross-reference file name instead of the default "cscope.out". +.TP +.BI -I incdir +Look in +.I incdir +(before looking in $INCDIR, the standard place +for header files, normally /usr/include) for any #include files +whose names do not begin with ``/'' and that are not specified +on the command line or in +.I namefile +below. (The #include files +may be specified with either double quotes or angle brackets.) +The incdir directory is searched in addition to the current +directory (which is searched first) and the standard list +(which is searched last). If more than one occurrence of -I +appears, the directories are searched in the order they appear +on the command line. +.TP +.BI -i namefile +Browse through all source files whose names are listed in +.I namefile +(file names separated by spaces, tabs, or new-lines) instead of the +default name list file, which is called cscope.files. If this option +is specified, cscope ignores any file names appearing on the command +line. The argument namefile can be set to ``-'' to accept a list of +files from the standard input. Filenames in the namefile that contain +whitespace have to be enclosed in "double quotes". Inside such quoted +filenames, any double-quote and backslash characters have to be +escaped by backslashes. +.TP +.B -k +``Kernel Mode'', turns off the use of the default include dir +(usually /usr/include) when building the database, since kernel +source trees generally do not use it. +.TP +.B -L +Do a single search with line-oriented output when used with the +-num pattern option. +.TP +.B -l +Line-oriented interface (see ``Line-Oriented Interface'' +below). +.TP +.BI -[ "0-9" ] pattern +Go to input field +.I num +(counting from 0) and find +.I pattern. +.TP +.BI -P path +Prepend +.I path +to relative file names in a pre-built cross-reference file so you do +not have to change to the directory where the cross-reference file was +built. This option is only valid with the -d option. +.TP +.BI -p n +Display the last +.I n +file path components instead of the default (1). Use +.I 0 +to not display the file name at all. +.TP +.B -q +Enable fast symbol lookup via an inverted index. This option +causes cscope to create 2 more files (default names +``cscope.in.out'' and ``cscope.po.out'') in addition to the normal +database. This allows a faster symbol search algorithm that +provides noticeably faster lookup performance for large projects. +.TP +.B -R +Recurse subdirectories during search for source files. +.TP +.BI -s dir +Look in +.I dir +for additional source files. This option is ignored if source files +are given on the command line. +.TP +.B -T +Use only the first eight characters to match against C symbols. +A regular expression containing special characters other than a +period (.) will not match any symbol if its minimum length is +greater than eight characters. +.TP +.B -U +Check file time stamps. This option will update the time stamp +on the database even if no files have changed. +.TP +.B -u +Unconditionally build the cross-reference file (assume that all +files have changed). +.TP +.B -v +Be more verbose in line-oriented mode. Output progress updates during +database building and searches. +.TP +.I files +A list of file names to operate on. +.PP +The -I, -c, -k, -p, -q, and -T options can also be in the cscope.files file. +.PP +.B Requesting the initial search +.PP +After the cross-reference is ready, cscope will display this menu: +.PP +.B Find this C symbol: +.PD 0 +.TP +.B Find this function definition: +.TP +.B Find functions called by this function: +.TP +.B Find functions calling this function: +.TP +.B Find this text string: +.TP +.B Change this text string: +.TP +.B Find this egrep pattern: +.TP +.B Find this file: +.TP +.B Find files #including this file: +.PD 1 +.PP +Press the <Up> or <Down> keys repeatedly to move to the desired input +field, type the text to search for, and then press the <Return> key. +.PP +.SH "Issuing subsequent requests" +If the search is successful, any of these single-character commands +can be used: +.TP +.B 0-9a-zA-Z +Edit the file referenced by the given line number. +.TP +.B <Space> +Display next set of matching lines. +.TP +.B <Tab> +Alternate between the menu and the list of matching lines +.TP +.B <Up> +Move to the previous menu item (if the cursor is in the menu) +or move to the previous matching line (if the cursor is in the +matching line list.) +.TP +.B <Down> +Move to the next menu item (if the cursor is in the menu) +or move to the next matching line (if the cursor is in the +matching line list.) +.TP +.B + +Display next set of matching lines. +.TP +.B - +Display previous set of matching lines. +.TP +.B ^e +Edit displayed files in order. +.TP +.B > +Write the displayed list of lines to a file. +.TP +.B >> +Append the displayed list of lines to a file. +.TP +.B < +Read lines from a file that is in symbol reference format +(created by > or >>), just like the -F option. +.TP +.B ^ +Filter all lines through a shell command and display the +resulting lines, replacing the lines that were already there. +.TP +.B | +Pipe all lines to a shell command and display them without +changing them. +.PP +At any time these single-character commands can also be used: +.TP +.B <Return> +Move to next input field. +.TP +.B ^n +Move to next input field. +.TP +.B ^p +Move to previous input field. +.TP +.B ^y +Search with the last text typed. +.TP +.B ^b +Move to previous input field and search pattern. +.TP +.B ^f +Move to next input field and search pattern. +.TP +.B ^c +Toggle ignore/use letter case when searching. (When ignoring +letter case, search for ``FILE'' will match ``File'' and +``file''.) +.TP +.B ^r +Rebuild the cross-reference. +.TP +.B ! +Start an interactive shell (type ^d to return to cscope). +.TP +.B ^l +Redraw the screen. +.TP +.B ? +Give help information about cscope commands. +.TP +.B ^d +Exit cscope. +.PP +.PP +.B NOTE: If the first character of the text to be searched for matches +.B one of the above commands, escape it by typing a (backslash) first. +.PP +.B Substituting new text for old text +.PP +After the text to be changed has been typed, cscope will prompt for +the new text, and then it will display the lines containing the old +text. Select the lines to be changed with these single-character +commands: +.PP +.TP +.B 0-9a-zA-Z +Mark or unmark the line to be changed. +.TP +.B * +Mark or unmark all displayed lines to be changed. +.TP +.B <Space> +Display next set of lines. +.TP +.B + +Display next set of lines. +.TP +.B - +Display previous set of lines. +.TP +.B a +Mark or unmark all lines to be changed. +.TP +.B ^d +Change the marked lines and exit. +.TP +.B <Esc> +Exit without changing the marked lines. +.TP +.B ! +Start an interactive shell (type ^d to return to cscope). +.TP +.B ^l +Redraw the screen. +.TP +.B ? +Give help information about cscope commands. +.TP +.B Special keys +.PP +If your terminal has arrow keys that work in vi, you can use them +to move around the input fields. The up-arrow key is useful to move to +the previous +input field instead of using the <Tab> key repeatedly. If you have +<CLEAR>, <NEXT>, or <PREV> keys they will act as the ^l, +, and - +commands, respectively. +.PP +.B Line-Oriented interface +.PP +The -l option lets you use cscope where a screen-oriented interface +would not be useful, for example, from another screen-oriented +program. +.PP +cscope will prompt with >> when it is ready for an input line starting +with the field number (counting from 0) immediately followed by the +search pattern, for example, ``lmain'' finds the definition of the +main function. +.PP +If you just want a single search, instead of the -l option use the -L +and -num pattern options, and you won't get the >> prompt. +.PP +For -l, cscope outputs the number of reference lines +cscope: 2 lines +.PP +For each reference found, cscope outputs a line consisting of the file +name, function name, line number, and line text, separated by spaces, +for example, +main.c main 161 main(argc, argv) +.PP +Note that the editor is not called to display a single reference, +unlike the screen-oriented interface. +.PP +You can use the c command to toggle ignore/use letter case when +searching. (When ignoring letter case, search for ``FILE'' will match +``File'' and ``file''.) +.PP +You can use the r command to rebuild the database. +.PP +cscope will quit when it detects end-of-file, or when the first +character of an input line is ``^d'' or ``q''. +.PP +.SH "ENVIRONMENT VARIABLES" +.TP +.B CSCOPE_EDITOR +Overrides the EDITOR and VIEWER variables. Use this if you wish to use +a different editor with cscope than that specified by your +EDITOR/VIEWER variables. +.TP +.B CSCOPE_LINEFLAG +Format of the line number flag for your editor. By default, cscope +invokes your editor via the equivalent of ``editor +N file'', where +``N'' is the line number that the editor should jump to. This format +is used by both emacs and vi. If your editor needs something +different, specify it in this variable, with ``%s'' as a placeholder +for the line number. Ex: if your editor needs to be invoked as +``editor -#103 file'' to go to line 103, set this variable to +``-#%s''. +.TP +.B CSCOPE_LINEFLAG_AFTER_FILE +Set this variable to ``yes'' if your editor needs to be invoked with +the line number option after the filename to be edited. To continue +the example from CSCOPE_LINEFLAG, above: if your editor needs to see +``editor file -#number'', set this environment variable. Users of most +standard editors (vi, emacs) do not need to set this variable. +.TP +.B EDITOR +Preferred editor, which defaults to vi. +.TP +.B HOME +Home directory, which is automatically set at login. +.TP +.B INCLUDEDIRS +Colon-separated list of directories to search for #include +files. +.TP +.B SHELL +Preferred shell, which defaults to sh. +.TP +.B SOURCEDIRS +Colon-separated list of directories to search for additional +source files. +.TP +.B TERM +Terminal type, which must be a screen terminal. +.TP +.B TERMINFO +Terminal information directory full path name. If your terminal +is not in the standard terminfo directory, see curses +and terminfo for how to make your own terminal description. +.TP +.B TMPDIR +Temporary file directory, which defaults to /var/tmp. +.TP +.B VIEWER +Preferred file display program (such as less), which overrides +EDITOR (see above). +.TP +.B VPATH +A colon-separated list of directories, each of which has the +same directory structure below it. If VPATH is set, cscope +searches for source files in the directories specified; if it +is not set, cscope searches only in the current directory. +.PP +.SH FILES +.TP +.B cscope.files +Default files containing -I, -p, -q, and -T options and the +list of source files (overridden by the -i option). +.TP +.B cscope.out +Symbol cross-reference file (overridden by the -f option), +which is put in the home directory if it cannot be created in +the current directory. +.TP +.PD 0 +.B cscope.in.out +.TP +.B cscope.po.out +.PD 1 +Default files containing the inverted index used for quick +symbol searching (-q option). If you use the -f option to +rename the cross-reference file (so it's not cscope.out), the +names for these inverted index files will be created by adding + .in and .po to the name you supply with -f. For example, if you +indicated -f xyz, then these files would be named xyz.in and +xyz.po. +.TP +.B INCDIR +Standard directory for #include files (usually /usr/include). +.SH Notices +.I cscope +recognizes function definitions of the form: +.PD 0 +.TP +fname blank ( args ) white arg_decs white { +.PD 1 +.TP +where: +.I fname +is the function name +.TP +.I blank +is zero or more spaces, tabs, vtabs, form feeds or carriage returns, +not including newlines +.TP +.I args +is any string that does not contain a ``"'' or a newline +.TP +.I white +is zero or more spaces, tabs, vtabs, form feeds, carriage returns or newlines +.TP +.I arg_decs +are zero or more argument declarations (arg_decs may include +comments and white space) +.PP +It is not necessary for a function declaration to start at the +beginning of a line. The return type may precede the function name; +cscope will still recognize the declaration. Function definitions that +deviate from this form will not be recognized by cscope. +.PP +The ``Function'' column of the search output for the menu option Find +functions called by this function: input field will only display the +first function called in the line, that is, for this function +.PP + e() + { + return (f() + g()); + } +.PP +the display would be +.PP + Functions called by this function: e + File Function Line + a.c f 3 return(f() + g()); +.PP +Occasionally, a function definition or call may not be recognized +because of braces inside #if statements. Similarly, the use of a +variable may be incorrectly recognized as a definition. +.PP +A +.B typedef +name preceding a preprocessor statement will be incorrectly +recognized as a global definition, for example, +.PP + LDFILE * + #if AR16WR +.PP +Preprocessor statements can also prevent the recognition of a global +definition, for example, +.PP + char flag + #ifdef ALLOCATE_STORAGE + = -1 + #endif + ; +.PP +A function declaration inside a function is incorrectly recognized as +a function call, for example, +.PP + f() + { + void g(); + } +.PP +is incorrectly recognized as a call to g. +.PP +.I cscope +recognizes C++ classes by looking for the class keyword, but +doesn't recognize that a struct is also a class, so it doesn't +recognize inline member function definitions in a structure. It also +doesn't expect the class keyword in a +.I typedef +, so it incorrectly +recognizes X as a definition in +.PP + typedef class X * Y; +.PP +It also doesn't recognize operator function definitions +.PP + Bool Feature::operator==(const Feature & other) + { + ... + } +.PP +Nor does it recognize function definitions with a function pointer +argument +.PP + ParseTable::Recognize(int startState, char *pattern, + int finishState, void (*FinalAction)(char *)) + { + ... + } diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..36f96f3 --- /dev/null +++ b/install-sh @@ -0,0 +1,276 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd=$cpprog + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "$0: no input file specified" >&2 + exit 1 +else + : +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d "$dst" ]; then + instcmd=: + chmodcmd="" + else + instcmd=$mkdirprog + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" ] || [ -d "$src" ] + then + : + else + echo "$0: $src does not exist" >&2 + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "$0: no destination specified" >&2 + exit 1 + else + : + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d "$dst" ] + then + dst=$dst/`basename "$src"` + else + : + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' + ' +IFS="${IFS-$defaultIFS}" + +oIFS=$IFS +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS=$oIFS + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp=$pathcomp$1 + shift + + if [ ! -d "$pathcomp" ] ; + then + $mkdirprog "$pathcomp" + else + : + fi + + pathcomp=$pathcomp/ +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd "$dst" && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename "$dst"` + else + dstfile=`basename "$dst" $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename "$dst"` + else + : + fi + +# Make a couple of temp file names in the proper directory. + + dsttmp=$dstdir/#inst.$$# + rmtmp=$dstdir/#rm.$$# + +# Trap to clean up temp files at exit. + + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0 + trap '(exit $?); exit' 1 2 13 15 + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" "$dsttmp" && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi && + +# Now remove or move aside any old file at destination location. We try this +# two ways since rm can't unlink itself on some systems and the destination +# file might be busy for other reasons. In this case, the final cleanup +# might fail but the new file should still install successfully. + +{ + if [ -f "$dstdir/$dstfile" ] + then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null || + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null || + { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit + } + else + : + fi +} && + +# Now rename the file to the real destination. + + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + +fi && + +# The final little trick to "correctly" pass the exit status to the exit trap. + +{ + (exit 0); exit +} @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..d2d5f21 --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,111 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" 1>&2 + exit 0 + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +case $dirmode in + '') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi + ;; + *) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi + ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: +# mkinstalldirs ends here diff --git a/packages/CVS/Entries b/packages/CVS/Entries new file mode 100644 index 0000000..34d2ce4 --- /dev/null +++ b/packages/CVS/Entries @@ -0,0 +1,3 @@ +D/MSDOS//// +D/uw7//// +/cscope.spec/1.11/Sat Sep 30 08:12:59 2006// diff --git a/packages/CVS/Repository b/packages/CVS/Repository new file mode 100644 index 0000000..9ae870c --- /dev/null +++ b/packages/CVS/Repository @@ -0,0 +1 @@ +cscope/packages diff --git a/packages/CVS/Root b/packages/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/packages/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/packages/MSDOS/CVS/Entries b/packages/MSDOS/CVS/Entries new file mode 100644 index 0000000..53f6ad7 --- /dev/null +++ b/packages/MSDOS/CVS/Entries @@ -0,0 +1,4 @@ +/README/1.1/Thu Jun 28 15:56:06 2001// +/djmake.bat/1.4/Sat Sep 30 08:12:59 2006/-kb/ +/ylwrap.pat/1.2/Thu Jul 5 13:47:53 2001// +D diff --git a/packages/MSDOS/CVS/Repository b/packages/MSDOS/CVS/Repository new file mode 100644 index 0000000..835e575 --- /dev/null +++ b/packages/MSDOS/CVS/Repository @@ -0,0 +1 @@ +cscope/packages/MSDOS diff --git a/packages/MSDOS/CVS/Root b/packages/MSDOS/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/packages/MSDOS/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/packages/MSDOS/README b/packages/MSDOS/README new file mode 100644 index 0000000..e026e05 --- /dev/null +++ b/packages/MSDOS/README @@ -0,0 +1,74 @@ + +------------------------------------ + cscope for DOS using DJGPP +------------------------------------ + +*) You need a rather recent DJGPP version and tools + installed. For running cscope on DOS, be sure you + have: + + * GNU ed for cscope's automated editing of files. It's quite likely + you didn't have this installed, unless you're a collector of Unix + tools. + + * an editor or viewer to be used as a child program when you open + a match, inside cscope. DJGPP-compiled versions, if possible. + + Choose either + + -- `less' if you're content with viewing the file + -- some version of `vi' (VIM, Elvis, or NVI) use cscope in it's + "classical" way + -- GNU Emacs for the full glory :-) + + Set the environment variable CSCOPE_EDITOR or EDITOR to the name + of the editor you want to use. You may want to create a [cscope] + section in your djgpp.env file, if you know how to do it. + + For more details what cscope is, and how to use it, see the + documentation in the root directory of the cscope sources, or the + man page. + +*) For compiling cscope from sources, you need a much more complete + collection of GNU development and commandline tools, in addition + to the above, and the obvious GCC and binutils: + + * bash + * make + * flex + * bison + * sed + * patch + * fileutils (cp, ln, ...) + * textutils (cat) + + Optionally, if you plan to modify the sources. + + * autoconf + * automake + * Perl + + These are the ones I'm sure you need --- I may have overlooked some. + + The DJGPP source packages is already configured, so you can just + run 'make' to get the package. Then + + make install prefix=d:/djgpp" + + (or wherever else your DJGPP is) to install it. + + Or cd to the top source directory and execute the supplied + djmake.bat: + + cd d:\djgpp\contrib\cscope + packages\msdos\djmake.bat + + and watch it compile. This will be necessary if you made any + substantial changes to the sources. + +Have fun with it. In case of problem, mail to djgpp@delorie.com (or the +attached Usenet newsgroup) or file a bug report at cscope's page on +Sourceforge.net. + +Hans-Bernhard Br"oker (broeker@physik.rwth-aachen.de) + (Hans-Bernhard.Broeker@epost.de) diff --git a/packages/MSDOS/djmake.bat b/packages/MSDOS/djmake.bat new file mode 100644 index 0000000..260bb11 --- /dev/null +++ b/packages/MSDOS/djmake.bat @@ -0,0 +1,22 @@ +@echo off
+
+if exist src\fscanner.l goto dir_okay
+echo !!!! Must run this batch file from the main source directory!
+exit
+
+:dir_okay
+
+echo ---- Start by patching the ylwrap script to avoid problems
+echo with "ln -s":
+
+if exist src\ylwrap patch -p0 -i packages/MSDOS/ylwrap.pat
+if exist ylwrap patch -p1 -i packages/MSDOS/ylwrap.pat
+
+echo ---- Now configure and make it.
+echo -- NOTE --: this assumes you have pdcurses installed!
+echo -- NOTE --: Will be using '-f' mode of flex, for faster scanning
+bash configure
+make CURSES_LIBS=-lpdcurses LFLAGS="-f8B"
+
+echo ---- You may now call "make install", if desired.
+echo -- DONE --
diff --git a/packages/MSDOS/ylwrap.pat b/packages/MSDOS/ylwrap.pat new file mode 100644 index 0000000..f60049d --- /dev/null +++ b/packages/MSDOS/ylwrap.pat @@ -0,0 +1,11 @@ +--- src/ylwrap Tue Jun 26 15:23:52 2001 ++++ src.DOS/ylwrap Thu Jun 28 17:39:31 2001 +@@ -80,7 +80,7 @@ + ;; + *) + # Make a symbolic link, hard link or hardcopy. +- ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" . ++ ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" . + ;; + esac + $prog ${1+"$@"} "$input" diff --git a/packages/cscope.spec b/packages/cscope.spec new file mode 100644 index 0000000..dcb1060 --- /dev/null +++ b/packages/cscope.spec @@ -0,0 +1,65 @@ +Summary: cscope is an interactive, screen-oriented tool that allows the user to browse through C source files for specified elements of code. +Name: cscope +Version: 15.6 +Release: 1 +Epoch: 1 +License: BSD +Group: Development/Tools +Source: cscope-15.6.tar.gz +URL: http://cscope.sourceforge.net +Buildroot: %{_tmppath}/%{name}-root + +%description +cscope is an interactive, screen-oriented tool that allows the user to browse through C source files for specified elements of code. + +%prep +%setup -q + +%build +%configure +make + +%install +rm -rf %{buildroot} +%makeinstall + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%doc TODO COPYING ChangeLog AUTHORS README NEWS INSTALL +%{_bindir}/* +%{_mandir}/man1/* + +%changelog +* Sun Oct 01 2006 Hans-Bernhard Broeker <broeker@users.sourceforge.net> +- Changed version number to 15.6 +* Sun Mar 21 2004 Adam Monsen <adamm@wazamatta.com> +- updated packages/cscope.spec to use more RPM macros and shell globs. + Should be more generic/robust/up-to-date/etc. +* Mon Jul 2 2001 Cscope development team <cscope-devel@lists.sourceforge.net> +- Version 15.3 release +- New flex scanner +- XEmacs support improvements +- Vim support improvements +- 64 bit fixes +- MSDOS support +- More editing keys +- Webcscope added to contrib +* Wed Nov 20 2000 Cscope development team <cscope-devel@lists.sourceforge.net> +- Version 15.1 release +- New menu and line matching interface +- Support for up to 62 (up from 9) matching lines on screen +- Numerous fixes +- Updated documentation +* Tue May 15 2000 Cscope development team <cscope-devel@lists.sourceforge.net> +- Version 15.0bl2 (build 2) pre-alpha release +- Fixes and enhancements +- Updated documentation +- Autoconf/automake support +- directory restructuring +* Sun Apr 16 2000 Petr Sorfa <petrs@sco.com> +- Initial Open Source release +- Ported to GNU environment +- Created rpm package diff --git a/packages/uw7/CVS/Entries b/packages/uw7/CVS/Entries new file mode 100644 index 0000000..563b97c --- /dev/null +++ b/packages/uw7/CVS/Entries @@ -0,0 +1,4 @@ +/Prototype/1.1/Wed Nov 22 15:42:16 2000// +/cscope_pkg.sh/1.3/Tue Jul 3 22:09:50 2001// +/pkginfo/1.3/Tue Jul 3 22:09:50 2001// +D diff --git a/packages/uw7/CVS/Repository b/packages/uw7/CVS/Repository new file mode 100644 index 0000000..cbff275 --- /dev/null +++ b/packages/uw7/CVS/Repository @@ -0,0 +1 @@ +cscope/packages/uw7 diff --git a/packages/uw7/CVS/Root b/packages/uw7/CVS/Root new file mode 100644 index 0000000..e0eb551 --- /dev/null +++ b/packages/uw7/CVS/Root @@ -0,0 +1 @@ +broeker@cscope.cvs.sourceforge.net:/cvsroot/cscope diff --git a/packages/uw7/Prototype b/packages/uw7/Prototype new file mode 100644 index 0000000..e301a03 --- /dev/null +++ b/packages/uw7/Prototype @@ -0,0 +1,11 @@ +i pkginfo +d none /usr ? ? ? +d none /usr/local 0755 root bin +d none /usr/local/bin 0755 root bin +d none /usr/local/man 0755 root bin +d none /usr/local/man/man1 0755 root bin +! search /usr/local/bin +f none /usr/local/bin/cscope 0755 root bin +f none /usr/local/bin/ocs 0755 root bin +! search /usr/local/man/man1 +f none /usr/local/man/man1/cscope.1 0644 root bin diff --git a/packages/uw7/cscope_pkg.sh b/packages/uw7/cscope_pkg.sh new file mode 100755 index 0000000..9c5e77f --- /dev/null +++ b/packages/uw7/cscope_pkg.sh @@ -0,0 +1,98 @@ +#!/bin/sh + +#=========================================================================== +# 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. +# =========================================================================*/ + +# This simple script creates an UW7 pkg for cscope +# Execute these commands as root + +BINDIR=/usr/local/bin/ +LIBDIR=/usr/local/lib/ +MANDIR=/usr/local/man/man1/ +SPOOLDIR=/var/spool/pkg/ + +# Check that the user is root + +if [ `id -un` != "root" ] +then + echo "ERROR: Need to be root to build package" >&2 + exit 1; +fi + +# Check that cscope has been installed +if [ ! -f $BINDIR/cscope ] +then + echo "ERROR: cscope not installed" >&2 + exit 1 +fi + +if [ ! -f $BINDIR/ocs ] +then + echo "ERROR: ocs not installed" >&2 + exit 1 +fi + +if [ ! -f $MANDIR/cscope.1 ] +then + echo "ERROR: cscope man page not installed" >&2 + exit 1 +fi + +# Check that there is no current cscope pkg spooled + +if [ -d $SPOOLDIR/cscope ] +then + echo "ERROR: cscope is currently spooled in $SPOOLDIR/cscope." >&2 + echo " Please remove this directory and its contents to" >&2 + echo " continue." >&2 + exit 1 +fi + +# Make the spool dir entry +# Note that cscope must be already installed +echo "INFO: Spooling package" >&2 +pkgmk +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred during spooling the package" >&2 + exit 1 +fi + +# Install the spool dir cscope entry into the package +echo "INFO: creating package" >&2 +pkgtrans -s /var/spool/pkg cscope.15.6.pkg cscope +if [ $? -ne 0 ] +then + echo "ERROR: An error occurred while creating the package" >&2 + exit 1 +fi + diff --git a/packages/uw7/pkginfo b/packages/uw7/pkginfo new file mode 100644 index 0000000..d45d6c2 --- /dev/null +++ b/packages/uw7/pkginfo @@ -0,0 +1,6 @@ +PKG="cscope" +NAME="cscope" +VERSION="15.6 UW7.1.1 07/03/2001" +CATEGORY="utilities" +ARCH=i386 +PSTAMP= diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..f649ca7 --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,55 @@ +## Process this file with automake to produce Makefile.in + +if HAS_GNOME +if USING_GNOME2 +GNOMECFLAGS = `pkg-config --cflags libgnomeui-2.0 libpanelapplet-2.0 libglade-2.0` +GNOMELINKAGE = `pkg-config --libs libgnomeui-2.0 libpanelapplet-2.0 libglade-2.0|sed -e 's/-lz //'` +else +GNOMECFLAGS = `gnome-config --cflags gnomeui applets libglade` +GNOMELINKAGE = `gnome-config --libs gnomeui applets libglade|sed -e 's/-lz //'` +endif + +EXTRA_PROGRAMS = gscope +endif +bin_PROGRAMS = cscope + +if USING_LEX +LEXER_SOURCE=scanner.l +else +LEXER_SOURCE=fscanner.l +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 + +LEXLIB = @LEXLIB@ + +cscope_LDADD = $(CURSES_LIBS) $(LEXLIB) + +AM_CPPFLAGS = $(CURSES_INCLUDEDIR) + +## 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 + +if HAS_GNOME +GNOME_SWITCH=-DUSING_GNOME_UI + +## if we compile gscope under Linux, we need to supply libglade the callback pointers +if GNOME_LINUX +GNOME_LINUX_FLAG = "-rdynamic" +endif + +gscope_CFLAGS = $(GNOMECFLAGS) $(GNOME_SWITCH) +gscope_LDADD = $(CURSES_LIBS) $(LEXLIB) +gscope_SOURCES = gscope.c $(cscope_SOURCES) +gscope_LDFLAGS = $(GNOMELINKAGE) $(GNOME_LINUX_FLAG) +endif diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..0842105 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,967 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in 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. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@HAS_GNOME_TRUE@EXTRA_PROGRAMS = gscope$(EXEEXT) +bin_PROGRAMS = cscope$(EXEEXT) +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in egrep.c \ + fscanner.c scanner.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +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 \ + 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 +@USING_LEX_FALSE@am__objects_1 = fscanner.$(OBJEXT) +@USING_LEX_TRUE@am__objects_1 = scanner.$(OBJEXT) +am_cscope_OBJECTS = $(am__objects_1) egrep.$(OBJEXT) alloc.$(OBJEXT) \ + basename.$(OBJEXT) build.$(OBJEXT) command.$(OBJEXT) \ + compath.$(OBJEXT) crossref.$(OBJEXT) dir.$(OBJEXT) \ + display.$(OBJEXT) edit.$(OBJEXT) exec.$(OBJEXT) find.$(OBJEXT) \ + help.$(OBJEXT) history.$(OBJEXT) input.$(OBJEXT) \ + invlib.$(OBJEXT) logdir.$(OBJEXT) lookup.$(OBJEXT) \ + main.$(OBJEXT) mouse.$(OBJEXT) mygetenv.$(OBJEXT) \ + mypopen.$(OBJEXT) vpaccess.$(OBJEXT) vpfopen.$(OBJEXT) \ + vpinit.$(OBJEXT) vpopen.$(OBJEXT) +cscope_OBJECTS = $(am_cscope_OBJECTS) +am__DEPENDENCIES_1 = +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 \ + 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 +@USING_LEX_FALSE@am__objects_2 = gscope-fscanner.$(OBJEXT) +@USING_LEX_TRUE@am__objects_2 = gscope-scanner.$(OBJEXT) +am__objects_3 = $(am__objects_2) gscope-egrep.$(OBJEXT) \ + gscope-alloc.$(OBJEXT) gscope-basename.$(OBJEXT) \ + gscope-build.$(OBJEXT) gscope-command.$(OBJEXT) \ + gscope-compath.$(OBJEXT) gscope-crossref.$(OBJEXT) \ + gscope-dir.$(OBJEXT) gscope-display.$(OBJEXT) \ + gscope-edit.$(OBJEXT) gscope-exec.$(OBJEXT) \ + gscope-find.$(OBJEXT) gscope-help.$(OBJEXT) \ + gscope-history.$(OBJEXT) gscope-input.$(OBJEXT) \ + gscope-invlib.$(OBJEXT) gscope-logdir.$(OBJEXT) \ + gscope-lookup.$(OBJEXT) gscope-main.$(OBJEXT) \ + gscope-mouse.$(OBJEXT) gscope-mygetenv.$(OBJEXT) \ + gscope-mypopen.$(OBJEXT) gscope-vpaccess.$(OBJEXT) \ + gscope-vpfopen.$(OBJEXT) gscope-vpinit.$(OBJEXT) \ + gscope-vpopen.$(OBJEXT) +@HAS_GNOME_TRUE@am_gscope_OBJECTS = gscope-gscope.$(OBJEXT) \ +@HAS_GNOME_TRUE@ $(am__objects_3) +gscope_OBJECTS = $(am_gscope_OBJECTS) +@HAS_GNOME_TRUE@gscope_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +@HAS_GNOME_TRUE@ $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/ylwrap +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +SOURCES = $(cscope_SOURCES) $(EXTRA_cscope_SOURCES) $(gscope_SOURCES) +DIST_SOURCES = $(am__cscope_SOURCES_DIST) $(EXTRA_cscope_SOURCES) \ + $(am__gscope_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURSES_INCLUDEDIR = @CURSES_INCLUDEDIR@ +CURSES_LIBS = @CURSES_LIBS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GNOME_LINUX_FALSE = @GNOME_LINUX_FALSE@ +GNOME_LINUX_TRUE = @GNOME_LINUX_TRUE@ +HAS_CURSES_FALSE = @HAS_CURSES_FALSE@ +HAS_CURSES_TRUE = @HAS_CURSES_TRUE@ +HAS_GNOME_FALSE = @HAS_GNOME_FALSE@ +HAS_GNOME_TRUE = @HAS_GNOME_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USING_GNOME2_FALSE = @USING_GNOME2_FALSE@ +USING_GNOME2_TRUE = @USING_GNOME2_TRUE@ +USING_LEX_FALSE = @USING_LEX_FALSE@ +USING_LEX_TRUE = @USING_LEX_TRUE@ +VERSION = @VERSION@ +YACC = @YACC@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +gnome1 = @gnome1@ +gnome2 = @gnome2@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +@HAS_GNOME_TRUE@@USING_GNOME2_FALSE@GNOMECFLAGS = `gnome-config --cflags gnomeui applets libglade` +@HAS_GNOME_TRUE@@USING_GNOME2_TRUE@GNOMECFLAGS = `pkg-config --cflags libgnomeui-2.0 libpanelapplet-2.0 libglade-2.0` +@HAS_GNOME_TRUE@@USING_GNOME2_FALSE@GNOMELINKAGE = `gnome-config --libs gnomeui applets libglade|sed -e 's/-lz //'` +@HAS_GNOME_TRUE@@USING_GNOME2_TRUE@GNOMELINKAGE = `pkg-config --libs libgnomeui-2.0 libpanelapplet-2.0 libglade-2.0|sed -e 's/-lz //'` +@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 +@GNOME_LINUX_TRUE@@HAS_GNOME_TRUE@GNOME_LINUX_FLAG = "-rdynamic" +@HAS_GNOME_TRUE@gscope_CFLAGS = $(GNOMECFLAGS) $(GNOME_SWITCH) +@HAS_GNOME_TRUE@gscope_LDADD = $(CURSES_LIBS) $(LEXLIB) +@HAS_GNOME_TRUE@gscope_SOURCES = gscope.c $(cscope_SOURCES) +@HAS_GNOME_TRUE@gscope_LDFLAGS = $(GNOMELINKAGE) $(GNOME_LINUX_FLAG) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .l .o .obj .y +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +cscope$(EXEEXT): $(cscope_OBJECTS) $(cscope_DEPENDENCIES) + @rm -f cscope$(EXEEXT) + $(LINK) $(cscope_LDFLAGS) $(cscope_OBJECTS) $(cscope_LDADD) $(LIBS) +gscope$(EXEEXT): $(gscope_OBJECTS) $(gscope_DEPENDENCIES) + @rm -f gscope$(EXEEXT) + $(LINK) $(gscope_LDFLAGS) $(gscope_OBJECTS) $(gscope_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/build.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crossref.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/display.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egrep.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/find.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fscanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-alloc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-basename.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-build.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-command.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-compath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-crossref.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-dir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-display.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-edit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-egrep.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-exec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-find.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-fscanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-gscope.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-help.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-history.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-invlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-logdir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-lookup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-mouse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-mygetenv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-mypopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-scanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-vpaccess.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-vpfopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-vpinit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gscope-vpopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/history.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/invlib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logdir.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lookup.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mouse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mygetenv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mypopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpaccess.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpfopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpinit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vpopen.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +gscope-gscope.o: gscope.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-gscope.o -MD -MP -MF "$(DEPDIR)/gscope-gscope.Tpo" -c -o gscope-gscope.o `test -f 'gscope.c' || echo '$(srcdir)/'`gscope.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-gscope.Tpo" "$(DEPDIR)/gscope-gscope.Po"; else rm -f "$(DEPDIR)/gscope-gscope.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gscope.c' object='gscope-gscope.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-gscope.o `test -f 'gscope.c' || echo '$(srcdir)/'`gscope.c + +gscope-gscope.obj: gscope.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-gscope.obj -MD -MP -MF "$(DEPDIR)/gscope-gscope.Tpo" -c -o gscope-gscope.obj `if test -f 'gscope.c'; then $(CYGPATH_W) 'gscope.c'; else $(CYGPATH_W) '$(srcdir)/gscope.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-gscope.Tpo" "$(DEPDIR)/gscope-gscope.Po"; else rm -f "$(DEPDIR)/gscope-gscope.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gscope.c' object='gscope-gscope.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-gscope.obj `if test -f 'gscope.c'; then $(CYGPATH_W) 'gscope.c'; else $(CYGPATH_W) '$(srcdir)/gscope.c'; fi` + +gscope-fscanner.o: fscanner.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-fscanner.o -MD -MP -MF "$(DEPDIR)/gscope-fscanner.Tpo" -c -o gscope-fscanner.o `test -f 'fscanner.c' || echo '$(srcdir)/'`fscanner.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-fscanner.Tpo" "$(DEPDIR)/gscope-fscanner.Po"; else rm -f "$(DEPDIR)/gscope-fscanner.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fscanner.c' object='gscope-fscanner.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-fscanner.o `test -f 'fscanner.c' || echo '$(srcdir)/'`fscanner.c + +gscope-fscanner.obj: fscanner.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-fscanner.obj -MD -MP -MF "$(DEPDIR)/gscope-fscanner.Tpo" -c -o gscope-fscanner.obj `if test -f 'fscanner.c'; then $(CYGPATH_W) 'fscanner.c'; else $(CYGPATH_W) '$(srcdir)/fscanner.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-fscanner.Tpo" "$(DEPDIR)/gscope-fscanner.Po"; else rm -f "$(DEPDIR)/gscope-fscanner.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fscanner.c' object='gscope-fscanner.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-fscanner.obj `if test -f 'fscanner.c'; then $(CYGPATH_W) 'fscanner.c'; else $(CYGPATH_W) '$(srcdir)/fscanner.c'; fi` + +gscope-scanner.o: scanner.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-scanner.o -MD -MP -MF "$(DEPDIR)/gscope-scanner.Tpo" -c -o gscope-scanner.o `test -f 'scanner.c' || echo '$(srcdir)/'`scanner.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-scanner.Tpo" "$(DEPDIR)/gscope-scanner.Po"; else rm -f "$(DEPDIR)/gscope-scanner.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scanner.c' object='gscope-scanner.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-scanner.o `test -f 'scanner.c' || echo '$(srcdir)/'`scanner.c + +gscope-scanner.obj: scanner.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-scanner.obj -MD -MP -MF "$(DEPDIR)/gscope-scanner.Tpo" -c -o gscope-scanner.obj `if test -f 'scanner.c'; then $(CYGPATH_W) 'scanner.c'; else $(CYGPATH_W) '$(srcdir)/scanner.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-scanner.Tpo" "$(DEPDIR)/gscope-scanner.Po"; else rm -f "$(DEPDIR)/gscope-scanner.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scanner.c' object='gscope-scanner.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-scanner.obj `if test -f 'scanner.c'; then $(CYGPATH_W) 'scanner.c'; else $(CYGPATH_W) '$(srcdir)/scanner.c'; fi` + +gscope-egrep.o: egrep.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-egrep.o -MD -MP -MF "$(DEPDIR)/gscope-egrep.Tpo" -c -o gscope-egrep.o `test -f 'egrep.c' || echo '$(srcdir)/'`egrep.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-egrep.Tpo" "$(DEPDIR)/gscope-egrep.Po"; else rm -f "$(DEPDIR)/gscope-egrep.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='egrep.c' object='gscope-egrep.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-egrep.o `test -f 'egrep.c' || echo '$(srcdir)/'`egrep.c + +gscope-egrep.obj: egrep.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-egrep.obj -MD -MP -MF "$(DEPDIR)/gscope-egrep.Tpo" -c -o gscope-egrep.obj `if test -f 'egrep.c'; then $(CYGPATH_W) 'egrep.c'; else $(CYGPATH_W) '$(srcdir)/egrep.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-egrep.Tpo" "$(DEPDIR)/gscope-egrep.Po"; else rm -f "$(DEPDIR)/gscope-egrep.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='egrep.c' object='gscope-egrep.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-egrep.obj `if test -f 'egrep.c'; then $(CYGPATH_W) 'egrep.c'; else $(CYGPATH_W) '$(srcdir)/egrep.c'; fi` + +gscope-alloc.o: alloc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-alloc.o -MD -MP -MF "$(DEPDIR)/gscope-alloc.Tpo" -c -o gscope-alloc.o `test -f 'alloc.c' || echo '$(srcdir)/'`alloc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-alloc.Tpo" "$(DEPDIR)/gscope-alloc.Po"; else rm -f "$(DEPDIR)/gscope-alloc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='alloc.c' object='gscope-alloc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-alloc.o `test -f 'alloc.c' || echo '$(srcdir)/'`alloc.c + +gscope-alloc.obj: alloc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-alloc.obj -MD -MP -MF "$(DEPDIR)/gscope-alloc.Tpo" -c -o gscope-alloc.obj `if test -f 'alloc.c'; then $(CYGPATH_W) 'alloc.c'; else $(CYGPATH_W) '$(srcdir)/alloc.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-alloc.Tpo" "$(DEPDIR)/gscope-alloc.Po"; else rm -f "$(DEPDIR)/gscope-alloc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='alloc.c' object='gscope-alloc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-alloc.obj `if test -f 'alloc.c'; then $(CYGPATH_W) 'alloc.c'; else $(CYGPATH_W) '$(srcdir)/alloc.c'; fi` + +gscope-basename.o: basename.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-basename.o -MD -MP -MF "$(DEPDIR)/gscope-basename.Tpo" -c -o gscope-basename.o `test -f 'basename.c' || echo '$(srcdir)/'`basename.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-basename.Tpo" "$(DEPDIR)/gscope-basename.Po"; else rm -f "$(DEPDIR)/gscope-basename.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basename.c' object='gscope-basename.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-basename.o `test -f 'basename.c' || echo '$(srcdir)/'`basename.c + +gscope-basename.obj: basename.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-basename.obj -MD -MP -MF "$(DEPDIR)/gscope-basename.Tpo" -c -o gscope-basename.obj `if test -f 'basename.c'; then $(CYGPATH_W) 'basename.c'; else $(CYGPATH_W) '$(srcdir)/basename.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-basename.Tpo" "$(DEPDIR)/gscope-basename.Po"; else rm -f "$(DEPDIR)/gscope-basename.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='basename.c' object='gscope-basename.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-basename.obj `if test -f 'basename.c'; then $(CYGPATH_W) 'basename.c'; else $(CYGPATH_W) '$(srcdir)/basename.c'; fi` + +gscope-build.o: build.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-build.o -MD -MP -MF "$(DEPDIR)/gscope-build.Tpo" -c -o gscope-build.o `test -f 'build.c' || echo '$(srcdir)/'`build.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-build.Tpo" "$(DEPDIR)/gscope-build.Po"; else rm -f "$(DEPDIR)/gscope-build.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='build.c' object='gscope-build.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-build.o `test -f 'build.c' || echo '$(srcdir)/'`build.c + +gscope-build.obj: build.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-build.obj -MD -MP -MF "$(DEPDIR)/gscope-build.Tpo" -c -o gscope-build.obj `if test -f 'build.c'; then $(CYGPATH_W) 'build.c'; else $(CYGPATH_W) '$(srcdir)/build.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-build.Tpo" "$(DEPDIR)/gscope-build.Po"; else rm -f "$(DEPDIR)/gscope-build.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='build.c' object='gscope-build.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-build.obj `if test -f 'build.c'; then $(CYGPATH_W) 'build.c'; else $(CYGPATH_W) '$(srcdir)/build.c'; fi` + +gscope-command.o: command.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-command.o -MD -MP -MF "$(DEPDIR)/gscope-command.Tpo" -c -o gscope-command.o `test -f 'command.c' || echo '$(srcdir)/'`command.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-command.Tpo" "$(DEPDIR)/gscope-command.Po"; else rm -f "$(DEPDIR)/gscope-command.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='gscope-command.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-command.o `test -f 'command.c' || echo '$(srcdir)/'`command.c + +gscope-command.obj: command.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-command.obj -MD -MP -MF "$(DEPDIR)/gscope-command.Tpo" -c -o gscope-command.obj `if test -f 'command.c'; then $(CYGPATH_W) 'command.c'; else $(CYGPATH_W) '$(srcdir)/command.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-command.Tpo" "$(DEPDIR)/gscope-command.Po"; else rm -f "$(DEPDIR)/gscope-command.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='command.c' object='gscope-command.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-command.obj `if test -f 'command.c'; then $(CYGPATH_W) 'command.c'; else $(CYGPATH_W) '$(srcdir)/command.c'; fi` + +gscope-compath.o: compath.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-compath.o -MD -MP -MF "$(DEPDIR)/gscope-compath.Tpo" -c -o gscope-compath.o `test -f 'compath.c' || echo '$(srcdir)/'`compath.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-compath.Tpo" "$(DEPDIR)/gscope-compath.Po"; else rm -f "$(DEPDIR)/gscope-compath.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compath.c' object='gscope-compath.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-compath.o `test -f 'compath.c' || echo '$(srcdir)/'`compath.c + +gscope-compath.obj: compath.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-compath.obj -MD -MP -MF "$(DEPDIR)/gscope-compath.Tpo" -c -o gscope-compath.obj `if test -f 'compath.c'; then $(CYGPATH_W) 'compath.c'; else $(CYGPATH_W) '$(srcdir)/compath.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-compath.Tpo" "$(DEPDIR)/gscope-compath.Po"; else rm -f "$(DEPDIR)/gscope-compath.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compath.c' object='gscope-compath.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-compath.obj `if test -f 'compath.c'; then $(CYGPATH_W) 'compath.c'; else $(CYGPATH_W) '$(srcdir)/compath.c'; fi` + +gscope-crossref.o: crossref.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-crossref.o -MD -MP -MF "$(DEPDIR)/gscope-crossref.Tpo" -c -o gscope-crossref.o `test -f 'crossref.c' || echo '$(srcdir)/'`crossref.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-crossref.Tpo" "$(DEPDIR)/gscope-crossref.Po"; else rm -f "$(DEPDIR)/gscope-crossref.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='crossref.c' object='gscope-crossref.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-crossref.o `test -f 'crossref.c' || echo '$(srcdir)/'`crossref.c + +gscope-crossref.obj: crossref.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-crossref.obj -MD -MP -MF "$(DEPDIR)/gscope-crossref.Tpo" -c -o gscope-crossref.obj `if test -f 'crossref.c'; then $(CYGPATH_W) 'crossref.c'; else $(CYGPATH_W) '$(srcdir)/crossref.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-crossref.Tpo" "$(DEPDIR)/gscope-crossref.Po"; else rm -f "$(DEPDIR)/gscope-crossref.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='crossref.c' object='gscope-crossref.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-crossref.obj `if test -f 'crossref.c'; then $(CYGPATH_W) 'crossref.c'; else $(CYGPATH_W) '$(srcdir)/crossref.c'; fi` + +gscope-dir.o: dir.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-dir.o -MD -MP -MF "$(DEPDIR)/gscope-dir.Tpo" -c -o gscope-dir.o `test -f 'dir.c' || echo '$(srcdir)/'`dir.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-dir.Tpo" "$(DEPDIR)/gscope-dir.Po"; else rm -f "$(DEPDIR)/gscope-dir.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dir.c' object='gscope-dir.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-dir.o `test -f 'dir.c' || echo '$(srcdir)/'`dir.c + +gscope-dir.obj: dir.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-dir.obj -MD -MP -MF "$(DEPDIR)/gscope-dir.Tpo" -c -o gscope-dir.obj `if test -f 'dir.c'; then $(CYGPATH_W) 'dir.c'; else $(CYGPATH_W) '$(srcdir)/dir.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-dir.Tpo" "$(DEPDIR)/gscope-dir.Po"; else rm -f "$(DEPDIR)/gscope-dir.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dir.c' object='gscope-dir.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-dir.obj `if test -f 'dir.c'; then $(CYGPATH_W) 'dir.c'; else $(CYGPATH_W) '$(srcdir)/dir.c'; fi` + +gscope-display.o: display.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-display.o -MD -MP -MF "$(DEPDIR)/gscope-display.Tpo" -c -o gscope-display.o `test -f 'display.c' || echo '$(srcdir)/'`display.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-display.Tpo" "$(DEPDIR)/gscope-display.Po"; else rm -f "$(DEPDIR)/gscope-display.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display.c' object='gscope-display.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-display.o `test -f 'display.c' || echo '$(srcdir)/'`display.c + +gscope-display.obj: display.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-display.obj -MD -MP -MF "$(DEPDIR)/gscope-display.Tpo" -c -o gscope-display.obj `if test -f 'display.c'; then $(CYGPATH_W) 'display.c'; else $(CYGPATH_W) '$(srcdir)/display.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-display.Tpo" "$(DEPDIR)/gscope-display.Po"; else rm -f "$(DEPDIR)/gscope-display.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='display.c' object='gscope-display.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-display.obj `if test -f 'display.c'; then $(CYGPATH_W) 'display.c'; else $(CYGPATH_W) '$(srcdir)/display.c'; fi` + +gscope-edit.o: edit.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-edit.o -MD -MP -MF "$(DEPDIR)/gscope-edit.Tpo" -c -o gscope-edit.o `test -f 'edit.c' || echo '$(srcdir)/'`edit.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-edit.Tpo" "$(DEPDIR)/gscope-edit.Po"; else rm -f "$(DEPDIR)/gscope-edit.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edit.c' object='gscope-edit.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-edit.o `test -f 'edit.c' || echo '$(srcdir)/'`edit.c + +gscope-edit.obj: edit.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-edit.obj -MD -MP -MF "$(DEPDIR)/gscope-edit.Tpo" -c -o gscope-edit.obj `if test -f 'edit.c'; then $(CYGPATH_W) 'edit.c'; else $(CYGPATH_W) '$(srcdir)/edit.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-edit.Tpo" "$(DEPDIR)/gscope-edit.Po"; else rm -f "$(DEPDIR)/gscope-edit.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='edit.c' object='gscope-edit.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-edit.obj `if test -f 'edit.c'; then $(CYGPATH_W) 'edit.c'; else $(CYGPATH_W) '$(srcdir)/edit.c'; fi` + +gscope-exec.o: exec.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-exec.o -MD -MP -MF "$(DEPDIR)/gscope-exec.Tpo" -c -o gscope-exec.o `test -f 'exec.c' || echo '$(srcdir)/'`exec.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-exec.Tpo" "$(DEPDIR)/gscope-exec.Po"; else rm -f "$(DEPDIR)/gscope-exec.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='exec.c' object='gscope-exec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-exec.o `test -f 'exec.c' || echo '$(srcdir)/'`exec.c + +gscope-exec.obj: exec.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-exec.obj -MD -MP -MF "$(DEPDIR)/gscope-exec.Tpo" -c -o gscope-exec.obj `if test -f 'exec.c'; then $(CYGPATH_W) 'exec.c'; else $(CYGPATH_W) '$(srcdir)/exec.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-exec.Tpo" "$(DEPDIR)/gscope-exec.Po"; else rm -f "$(DEPDIR)/gscope-exec.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='exec.c' object='gscope-exec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-exec.obj `if test -f 'exec.c'; then $(CYGPATH_W) 'exec.c'; else $(CYGPATH_W) '$(srcdir)/exec.c'; fi` + +gscope-find.o: find.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-find.o -MD -MP -MF "$(DEPDIR)/gscope-find.Tpo" -c -o gscope-find.o `test -f 'find.c' || echo '$(srcdir)/'`find.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-find.Tpo" "$(DEPDIR)/gscope-find.Po"; else rm -f "$(DEPDIR)/gscope-find.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='find.c' object='gscope-find.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-find.o `test -f 'find.c' || echo '$(srcdir)/'`find.c + +gscope-find.obj: find.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-find.obj -MD -MP -MF "$(DEPDIR)/gscope-find.Tpo" -c -o gscope-find.obj `if test -f 'find.c'; then $(CYGPATH_W) 'find.c'; else $(CYGPATH_W) '$(srcdir)/find.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-find.Tpo" "$(DEPDIR)/gscope-find.Po"; else rm -f "$(DEPDIR)/gscope-find.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='find.c' object='gscope-find.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-find.obj `if test -f 'find.c'; then $(CYGPATH_W) 'find.c'; else $(CYGPATH_W) '$(srcdir)/find.c'; fi` + +gscope-help.o: help.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-help.o -MD -MP -MF "$(DEPDIR)/gscope-help.Tpo" -c -o gscope-help.o `test -f 'help.c' || echo '$(srcdir)/'`help.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-help.Tpo" "$(DEPDIR)/gscope-help.Po"; else rm -f "$(DEPDIR)/gscope-help.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='help.c' object='gscope-help.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-help.o `test -f 'help.c' || echo '$(srcdir)/'`help.c + +gscope-help.obj: help.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-help.obj -MD -MP -MF "$(DEPDIR)/gscope-help.Tpo" -c -o gscope-help.obj `if test -f 'help.c'; then $(CYGPATH_W) 'help.c'; else $(CYGPATH_W) '$(srcdir)/help.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-help.Tpo" "$(DEPDIR)/gscope-help.Po"; else rm -f "$(DEPDIR)/gscope-help.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='help.c' object='gscope-help.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-help.obj `if test -f 'help.c'; then $(CYGPATH_W) 'help.c'; else $(CYGPATH_W) '$(srcdir)/help.c'; fi` + +gscope-history.o: history.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-history.o -MD -MP -MF "$(DEPDIR)/gscope-history.Tpo" -c -o gscope-history.o `test -f 'history.c' || echo '$(srcdir)/'`history.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-history.Tpo" "$(DEPDIR)/gscope-history.Po"; else rm -f "$(DEPDIR)/gscope-history.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='gscope-history.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-history.o `test -f 'history.c' || echo '$(srcdir)/'`history.c + +gscope-history.obj: history.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-history.obj -MD -MP -MF "$(DEPDIR)/gscope-history.Tpo" -c -o gscope-history.obj `if test -f 'history.c'; then $(CYGPATH_W) 'history.c'; else $(CYGPATH_W) '$(srcdir)/history.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-history.Tpo" "$(DEPDIR)/gscope-history.Po"; else rm -f "$(DEPDIR)/gscope-history.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='history.c' object='gscope-history.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-history.obj `if test -f 'history.c'; then $(CYGPATH_W) 'history.c'; else $(CYGPATH_W) '$(srcdir)/history.c'; fi` + +gscope-input.o: input.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-input.o -MD -MP -MF "$(DEPDIR)/gscope-input.Tpo" -c -o gscope-input.o `test -f 'input.c' || echo '$(srcdir)/'`input.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-input.Tpo" "$(DEPDIR)/gscope-input.Po"; else rm -f "$(DEPDIR)/gscope-input.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='input.c' object='gscope-input.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-input.o `test -f 'input.c' || echo '$(srcdir)/'`input.c + +gscope-input.obj: input.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-input.obj -MD -MP -MF "$(DEPDIR)/gscope-input.Tpo" -c -o gscope-input.obj `if test -f 'input.c'; then $(CYGPATH_W) 'input.c'; else $(CYGPATH_W) '$(srcdir)/input.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-input.Tpo" "$(DEPDIR)/gscope-input.Po"; else rm -f "$(DEPDIR)/gscope-input.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='input.c' object='gscope-input.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-input.obj `if test -f 'input.c'; then $(CYGPATH_W) 'input.c'; else $(CYGPATH_W) '$(srcdir)/input.c'; fi` + +gscope-invlib.o: invlib.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-invlib.o -MD -MP -MF "$(DEPDIR)/gscope-invlib.Tpo" -c -o gscope-invlib.o `test -f 'invlib.c' || echo '$(srcdir)/'`invlib.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-invlib.Tpo" "$(DEPDIR)/gscope-invlib.Po"; else rm -f "$(DEPDIR)/gscope-invlib.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='invlib.c' object='gscope-invlib.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-invlib.o `test -f 'invlib.c' || echo '$(srcdir)/'`invlib.c + +gscope-invlib.obj: invlib.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-invlib.obj -MD -MP -MF "$(DEPDIR)/gscope-invlib.Tpo" -c -o gscope-invlib.obj `if test -f 'invlib.c'; then $(CYGPATH_W) 'invlib.c'; else $(CYGPATH_W) '$(srcdir)/invlib.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-invlib.Tpo" "$(DEPDIR)/gscope-invlib.Po"; else rm -f "$(DEPDIR)/gscope-invlib.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='invlib.c' object='gscope-invlib.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-invlib.obj `if test -f 'invlib.c'; then $(CYGPATH_W) 'invlib.c'; else $(CYGPATH_W) '$(srcdir)/invlib.c'; fi` + +gscope-logdir.o: logdir.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-logdir.o -MD -MP -MF "$(DEPDIR)/gscope-logdir.Tpo" -c -o gscope-logdir.o `test -f 'logdir.c' || echo '$(srcdir)/'`logdir.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-logdir.Tpo" "$(DEPDIR)/gscope-logdir.Po"; else rm -f "$(DEPDIR)/gscope-logdir.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='logdir.c' object='gscope-logdir.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-logdir.o `test -f 'logdir.c' || echo '$(srcdir)/'`logdir.c + +gscope-logdir.obj: logdir.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-logdir.obj -MD -MP -MF "$(DEPDIR)/gscope-logdir.Tpo" -c -o gscope-logdir.obj `if test -f 'logdir.c'; then $(CYGPATH_W) 'logdir.c'; else $(CYGPATH_W) '$(srcdir)/logdir.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-logdir.Tpo" "$(DEPDIR)/gscope-logdir.Po"; else rm -f "$(DEPDIR)/gscope-logdir.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='logdir.c' object='gscope-logdir.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-logdir.obj `if test -f 'logdir.c'; then $(CYGPATH_W) 'logdir.c'; else $(CYGPATH_W) '$(srcdir)/logdir.c'; fi` + +gscope-lookup.o: lookup.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-lookup.o -MD -MP -MF "$(DEPDIR)/gscope-lookup.Tpo" -c -o gscope-lookup.o `test -f 'lookup.c' || echo '$(srcdir)/'`lookup.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-lookup.Tpo" "$(DEPDIR)/gscope-lookup.Po"; else rm -f "$(DEPDIR)/gscope-lookup.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lookup.c' object='gscope-lookup.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-lookup.o `test -f 'lookup.c' || echo '$(srcdir)/'`lookup.c + +gscope-lookup.obj: lookup.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-lookup.obj -MD -MP -MF "$(DEPDIR)/gscope-lookup.Tpo" -c -o gscope-lookup.obj `if test -f 'lookup.c'; then $(CYGPATH_W) 'lookup.c'; else $(CYGPATH_W) '$(srcdir)/lookup.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-lookup.Tpo" "$(DEPDIR)/gscope-lookup.Po"; else rm -f "$(DEPDIR)/gscope-lookup.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lookup.c' object='gscope-lookup.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-lookup.obj `if test -f 'lookup.c'; then $(CYGPATH_W) 'lookup.c'; else $(CYGPATH_W) '$(srcdir)/lookup.c'; fi` + +gscope-main.o: main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-main.o -MD -MP -MF "$(DEPDIR)/gscope-main.Tpo" -c -o gscope-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-main.Tpo" "$(DEPDIR)/gscope-main.Po"; else rm -f "$(DEPDIR)/gscope-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='gscope-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c + +gscope-main.obj: main.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-main.obj -MD -MP -MF "$(DEPDIR)/gscope-main.Tpo" -c -o gscope-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-main.Tpo" "$(DEPDIR)/gscope-main.Po"; else rm -f "$(DEPDIR)/gscope-main.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='gscope-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` + +gscope-mouse.o: mouse.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mouse.o -MD -MP -MF "$(DEPDIR)/gscope-mouse.Tpo" -c -o gscope-mouse.o `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mouse.Tpo" "$(DEPDIR)/gscope-mouse.Po"; else rm -f "$(DEPDIR)/gscope-mouse.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse.c' object='gscope-mouse.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mouse.o `test -f 'mouse.c' || echo '$(srcdir)/'`mouse.c + +gscope-mouse.obj: mouse.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mouse.obj -MD -MP -MF "$(DEPDIR)/gscope-mouse.Tpo" -c -o gscope-mouse.obj `if test -f 'mouse.c'; then $(CYGPATH_W) 'mouse.c'; else $(CYGPATH_W) '$(srcdir)/mouse.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mouse.Tpo" "$(DEPDIR)/gscope-mouse.Po"; else rm -f "$(DEPDIR)/gscope-mouse.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mouse.c' object='gscope-mouse.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mouse.obj `if test -f 'mouse.c'; then $(CYGPATH_W) 'mouse.c'; else $(CYGPATH_W) '$(srcdir)/mouse.c'; fi` + +gscope-mygetenv.o: mygetenv.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mygetenv.o -MD -MP -MF "$(DEPDIR)/gscope-mygetenv.Tpo" -c -o gscope-mygetenv.o `test -f 'mygetenv.c' || echo '$(srcdir)/'`mygetenv.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mygetenv.Tpo" "$(DEPDIR)/gscope-mygetenv.Po"; else rm -f "$(DEPDIR)/gscope-mygetenv.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mygetenv.c' object='gscope-mygetenv.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mygetenv.o `test -f 'mygetenv.c' || echo '$(srcdir)/'`mygetenv.c + +gscope-mygetenv.obj: mygetenv.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mygetenv.obj -MD -MP -MF "$(DEPDIR)/gscope-mygetenv.Tpo" -c -o gscope-mygetenv.obj `if test -f 'mygetenv.c'; then $(CYGPATH_W) 'mygetenv.c'; else $(CYGPATH_W) '$(srcdir)/mygetenv.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mygetenv.Tpo" "$(DEPDIR)/gscope-mygetenv.Po"; else rm -f "$(DEPDIR)/gscope-mygetenv.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mygetenv.c' object='gscope-mygetenv.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mygetenv.obj `if test -f 'mygetenv.c'; then $(CYGPATH_W) 'mygetenv.c'; else $(CYGPATH_W) '$(srcdir)/mygetenv.c'; fi` + +gscope-mypopen.o: mypopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mypopen.o -MD -MP -MF "$(DEPDIR)/gscope-mypopen.Tpo" -c -o gscope-mypopen.o `test -f 'mypopen.c' || echo '$(srcdir)/'`mypopen.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mypopen.Tpo" "$(DEPDIR)/gscope-mypopen.Po"; else rm -f "$(DEPDIR)/gscope-mypopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mypopen.c' object='gscope-mypopen.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mypopen.o `test -f 'mypopen.c' || echo '$(srcdir)/'`mypopen.c + +gscope-mypopen.obj: mypopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-mypopen.obj -MD -MP -MF "$(DEPDIR)/gscope-mypopen.Tpo" -c -o gscope-mypopen.obj `if test -f 'mypopen.c'; then $(CYGPATH_W) 'mypopen.c'; else $(CYGPATH_W) '$(srcdir)/mypopen.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-mypopen.Tpo" "$(DEPDIR)/gscope-mypopen.Po"; else rm -f "$(DEPDIR)/gscope-mypopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mypopen.c' object='gscope-mypopen.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-mypopen.obj `if test -f 'mypopen.c'; then $(CYGPATH_W) 'mypopen.c'; else $(CYGPATH_W) '$(srcdir)/mypopen.c'; fi` + +gscope-vpaccess.o: vpaccess.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpaccess.o -MD -MP -MF "$(DEPDIR)/gscope-vpaccess.Tpo" -c -o gscope-vpaccess.o `test -f 'vpaccess.c' || echo '$(srcdir)/'`vpaccess.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpaccess.Tpo" "$(DEPDIR)/gscope-vpaccess.Po"; else rm -f "$(DEPDIR)/gscope-vpaccess.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpaccess.c' object='gscope-vpaccess.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpaccess.o `test -f 'vpaccess.c' || echo '$(srcdir)/'`vpaccess.c + +gscope-vpaccess.obj: vpaccess.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpaccess.obj -MD -MP -MF "$(DEPDIR)/gscope-vpaccess.Tpo" -c -o gscope-vpaccess.obj `if test -f 'vpaccess.c'; then $(CYGPATH_W) 'vpaccess.c'; else $(CYGPATH_W) '$(srcdir)/vpaccess.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpaccess.Tpo" "$(DEPDIR)/gscope-vpaccess.Po"; else rm -f "$(DEPDIR)/gscope-vpaccess.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpaccess.c' object='gscope-vpaccess.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpaccess.obj `if test -f 'vpaccess.c'; then $(CYGPATH_W) 'vpaccess.c'; else $(CYGPATH_W) '$(srcdir)/vpaccess.c'; fi` + +gscope-vpfopen.o: vpfopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpfopen.o -MD -MP -MF "$(DEPDIR)/gscope-vpfopen.Tpo" -c -o gscope-vpfopen.o `test -f 'vpfopen.c' || echo '$(srcdir)/'`vpfopen.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpfopen.Tpo" "$(DEPDIR)/gscope-vpfopen.Po"; else rm -f "$(DEPDIR)/gscope-vpfopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpfopen.c' object='gscope-vpfopen.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpfopen.o `test -f 'vpfopen.c' || echo '$(srcdir)/'`vpfopen.c + +gscope-vpfopen.obj: vpfopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpfopen.obj -MD -MP -MF "$(DEPDIR)/gscope-vpfopen.Tpo" -c -o gscope-vpfopen.obj `if test -f 'vpfopen.c'; then $(CYGPATH_W) 'vpfopen.c'; else $(CYGPATH_W) '$(srcdir)/vpfopen.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpfopen.Tpo" "$(DEPDIR)/gscope-vpfopen.Po"; else rm -f "$(DEPDIR)/gscope-vpfopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpfopen.c' object='gscope-vpfopen.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpfopen.obj `if test -f 'vpfopen.c'; then $(CYGPATH_W) 'vpfopen.c'; else $(CYGPATH_W) '$(srcdir)/vpfopen.c'; fi` + +gscope-vpinit.o: vpinit.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpinit.o -MD -MP -MF "$(DEPDIR)/gscope-vpinit.Tpo" -c -o gscope-vpinit.o `test -f 'vpinit.c' || echo '$(srcdir)/'`vpinit.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpinit.Tpo" "$(DEPDIR)/gscope-vpinit.Po"; else rm -f "$(DEPDIR)/gscope-vpinit.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpinit.c' object='gscope-vpinit.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpinit.o `test -f 'vpinit.c' || echo '$(srcdir)/'`vpinit.c + +gscope-vpinit.obj: vpinit.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpinit.obj -MD -MP -MF "$(DEPDIR)/gscope-vpinit.Tpo" -c -o gscope-vpinit.obj `if test -f 'vpinit.c'; then $(CYGPATH_W) 'vpinit.c'; else $(CYGPATH_W) '$(srcdir)/vpinit.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpinit.Tpo" "$(DEPDIR)/gscope-vpinit.Po"; else rm -f "$(DEPDIR)/gscope-vpinit.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpinit.c' object='gscope-vpinit.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpinit.obj `if test -f 'vpinit.c'; then $(CYGPATH_W) 'vpinit.c'; else $(CYGPATH_W) '$(srcdir)/vpinit.c'; fi` + +gscope-vpopen.o: vpopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpopen.o -MD -MP -MF "$(DEPDIR)/gscope-vpopen.Tpo" -c -o gscope-vpopen.o `test -f 'vpopen.c' || echo '$(srcdir)/'`vpopen.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpopen.Tpo" "$(DEPDIR)/gscope-vpopen.Po"; else rm -f "$(DEPDIR)/gscope-vpopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpopen.c' object='gscope-vpopen.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpopen.o `test -f 'vpopen.c' || echo '$(srcdir)/'`vpopen.c + +gscope-vpopen.obj: vpopen.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -MT gscope-vpopen.obj -MD -MP -MF "$(DEPDIR)/gscope-vpopen.Tpo" -c -o gscope-vpopen.obj `if test -f 'vpopen.c'; then $(CYGPATH_W) 'vpopen.c'; else $(CYGPATH_W) '$(srcdir)/vpopen.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/gscope-vpopen.Tpo" "$(DEPDIR)/gscope-vpopen.Po"; else rm -f "$(DEPDIR)/gscope-vpopen.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='vpopen.c' object='gscope-vpopen.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gscope_CFLAGS) $(CFLAGS) -c -o gscope-vpopen.obj `if test -f 'vpopen.c'; then $(CYGPATH_W) 'vpopen.c'; else $(CYGPATH_W) '$(srcdir)/vpopen.c'; fi` + +.l.c: + $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +.y.c: + $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f egrep.c + -rm -f fscanner.c + -rm -f scanner.c +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.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 \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# 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. +.NOEXPORT: diff --git a/src/alloc.c b/src/alloc.c new file mode 100644 index 0000000..add992f --- /dev/null +++ b/src/alloc.c @@ -0,0 +1,95 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* memory allocation functions */ + +#include <stdio.h> +#include <string.h> +#include "alloc.h" + +#include "global.h" /* for postfatal() */ + +static char const rcsid[] = "$Id: alloc.c,v 1.8 2006/07/23 20:59:20 broeker Exp $"; + +static void *alloctest(void *p); + +/* let autoconf find out if <stdlib.h> is available. This test will + * 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 */ + +char * +my_strdup(char *s) +{ + return(strcpy(mymalloc(strlen(s) + 1), s)); +} + + +/* 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); +} diff --git a/src/alloc.h b/src/alloc.h new file mode 100644 index 0000000..297eb71 --- /dev/null +++ b/src/alloc.h @@ -0,0 +1,46 @@ +/*=========================================================================== + 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 */ diff --git a/src/basename.c b/src/basename.c new file mode 100644 index 0000000..7254ae7 --- /dev/null +++ b/src/basename.c @@ -0,0 +1,48 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* get a file's base name from its path name */ + +static char const rcsid[] = "$Id: basename.c,v 1.3 2001/07/05 14:31:00 broeker Exp $"; + +#include "global.h" + +char * +mybasename(char *path) +{ + char *s; + + if ((s = strrchr(path, '/')) != 0) { + return(s + 1); + } + return(path); +} diff --git a/src/build.c b/src/build.c new file mode 100644 index 0000000..ada2ea1 --- /dev/null +++ b/src/build.c @@ -0,0 +1,734 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +/* cscope - interactive C symbol cross-reference + * + * main functions + */ + +#include "build.h" + +#include "global.h" /* FIXME: get rid of this! */ + +#include "library.h" +#include "alloc.h" +#include "scanner.h" +#include "version.h" /* for FILEVERSION */ +#include "vp.h" + +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif + +/* Exported variables: */ + +BOOL buildonly = NO; /* only build the database */ +BOOL unconditional = NO; /* unconditionally build database */ +BOOL fileschanged; /* assume some files changed */ + +/* variable copies of the master strings... */ +char invname_buf[] = INVNAME; +char invpost_buf[] = INVPOST; +char reffile_buf[] = REFFILE; +char *invname = invname_buf; /* inverted index to the database */ +char *invpost = invpost_buf; /* inverted index postings */ +char *reffile = reffile_buf; /* cross-reference file path name */ + +char *newreffile; /* new cross-reference file name */ +FILE *newrefs; /* new cross-reference */ +FILE *postings; /* new inverted index postings */ +int symrefs = -1; /* cross-reference file */ + +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: */ +static void cannotindex(void); +static int compare(const void *s1, const void *s2); +static void copydata(void); +static void copyinverted(void); +static char *getoldfile(void); +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); + + +/* Error handling routine if inverted index creation fails */ +static void +cannotindex(void) +{ + fprintf(stderr, "\ +cscope: cannot create inverted index; ignoring -q option\n"); + invertedindex = NO; + errorsfound = YES; + fprintf(stderr, "\ +cscope: removed files %s and %s\n", + newinvname, newinvpost); + unlink(newinvname); + unlink(newinvpost); +} + + +/* see if the name list is the same in the cross-reference file */ +static BOOL +samelist(FILE *oldrefs, char **names, int count) +{ + char oldname[PATHLEN + 1]; /* name in old cross-reference */ + int oldcount; + int i; + + /* see if the number of names is the same */ + if (fscanf(oldrefs, "%d", &oldcount) != 1 || + oldcount != count) { + return(NO); + } + /* 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); + } + } + return(YES); +} + + +/* create the file name(s) used for a new cross-referene */ + +void setup_build_filenames(char *reffile) +{ + char *path; /* file pathname */ + char *s; /* pointer to basename in path */ + + path = mymalloc(strlen(reffile) + 10); + strcpy(path, reffile); + s = mybasename(path); + *s = '\0'; + strcat(path, "n"); + ++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); +} + +/* open the database */ + +void +opendatabase(void) +{ + if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { + cannotopen(reffile); + myexit(1); + } + blocknumber = -1; /* force next seek to read the first block */ + + /* open any inverted index */ + if (invertedindex == YES && + invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) { + askforreturn(); /* so user sees message */ + invertedindex = NO; + } +} + + +/* rebuild the database */ +void +rebuild(void) +{ + close(symrefs); + if (invertedindex == YES) { + invclose(&invcontrol); + nsrcoffset = 0; + npostings = 0; + } + build(); + opendatabase(); + + /* revert to the initial display */ + if (refsfound != NULL) { + fclose(refsfound); + refsfound = NULL; + } +} + + +/* build the cross-reference */ +void +build(void) +{ + unsigned long i; + FILE *oldrefs; /* old cross-reference file */ + time_t reftime; /* old crossref modification time */ + char *file; /* current file */ + char *oldfile; /* file in old cross-reference */ + char newdir[PATHLEN + 1]; /* directory in new cross-reference */ + char olddir[PATHLEN + 1]; /* directory in old cross-reference */ + char oldname[PATHLEN + 1]; /* name in old cross-reference */ + unsigned long oldnum; /* number in old cross-ref */ + struct stat statstruct; /* file status */ + unsigned long firstfile; /* first source file in pass */ + unsigned long lastfile; /* last source file in pass */ + int built = 0; /* built crossref for these files */ + int copied = 0; /* copied crossref for these files */ + unsigned long fileindex; /* source file name index */ + BOOL interactive = YES; /* output progress messages */ + + /* normalize the current directory relative to the home directory so + the cross-reference is not rebuilt when the user's login is moved */ + strcpy(newdir, currentdir); + if (strcmp(currentdir, home) == 0) { + strcpy(newdir, "$HOME"); + } else if (strncmp(currentdir, home, strlen(home)) == 0) { + sprintf(newdir, "$HOME%s", currentdir + strlen(home)); + } + /* sort the source file names (needed for rebuilding) */ + qsort(srcfiles, nsrcfiles, sizeof(char *), compare); + + /* if there is an old cross-reference and its current directory matches */ + /* or this is an unconditional build */ + 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)) { + /* get the cross-reference file's modification time */ + fstat(fileno(oldrefs), &statstruct); + reftime = statstruct.st_mtime; + if (fileversion >= 8) { + BOOL oldcompress = YES; + BOOL oldinvertedindex = NO; + BOOL oldtruncate = NO; + int c; + + /* see if there are options in the database */ + for (;;) { + while((c = getc(oldrefs)) == ' ') + ; /* do nothing */ + if (c != '-') { + ungetc(c, oldrefs); + break; + } + switch (c = getc(oldrefs)) { + case 'c': /* ASCII characters only */ + oldcompress = NO; + break; + case 'q': /* quick search */ + oldinvertedindex = YES; + fscanf(oldrefs, "%ld", &totalterms); + break; + case 'T': /* truncate symbols to 8 characters */ + oldtruncate = YES; + break; + } + } + /* check the old and new option settings */ + if (oldcompress != compress || oldtruncate != trun_syms) { + posterr("\ +cscope: -c or -T option mismatch between command line and old symbol database\n"); + goto force; + } + if (oldinvertedindex != invertedindex) { + posterr("\ +cscope: -q option mismatch between command line and old symbol database\n"); + if (invertedindex == NO) { + posterr("cscope: removed files %s and %s\n", + invname, invpost); + unlink(invname); + unlink(invpost); + } + goto outofdate; + } + /* seek to the trailer */ + if (fscanf(oldrefs, "%ld", &traileroffset) != 1 || + fseek(oldrefs, traileroffset, SEEK_SET) == -1) { + posterr("cscope: incorrect symbol database file format\n"); + goto force; + } + } + /* if assuming that some files have changed */ + if (fileschanged == YES) { + goto outofdate; + } + /* see if the directory lists are the same */ + if (samelist(oldrefs, srcdirs, nsrcdirs) == NO + || samelist(oldrefs, incdirs, nincdirs) == NO + /* get the old number of files */ + || fscanf(oldrefs, "%lu", &oldnum) != 1 + /* skip the string space size */ + || (fileversion >= 9 && fscanf(oldrefs, "%*s") != 0)) { + goto outofdate; + } + /* see if the list of source files is the same and + 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 || + statstruct.st_mtime > reftime) { + goto outofdate; + } + } + /* 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); + } + fclose(oldrefs); + return; + + outofdate: + /* if the database format has changed, rebuild it all */ + if (fileversion != FILEVERSION) { + fprintf(stderr, "\ +cscope: converting to new symbol database file format\n"); + goto force; + } + /* reopen the old cross-reference file for fast scanning */ + if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) { + postfatal("cscope: cannot open file %s\n", reffile); + /* NOTREACHED */ + } + /* get the first file name in the old cross-reference */ + blocknumber = -1; + read_block(); /* read the first cross-ref block */ + scanpast('\t'); /* skip the header */ + oldfile = getoldfile(); + } else { /* force cross-referencing of all the source files */ + force: reftime = 0; + oldfile = NULL; + } + /* open the new cross-reference file */ + if ((newrefs = myfopen(newreffile, "wb")) == NULL) { + postfatal("cscope: cannot open file %s\n", reffile); + /* NOTREACHED */ + } + if (invertedindex == YES && (postings = myfopen(temp1, "wb")) == NULL) { + cannotwrite(temp1); + cannotindex(); + } + putheader(newdir); + fileversion = FILEVERSION; + if (buildonly == YES && verbosemode != YES && !isatty(0)) { + interactive = NO; + } else { + searchcount = 0; + } + /* output the leading tab expected by crossref() */ + dbputc('\t'); + + /* make passes through the source file list until the last level of + included files is processed */ + firstfile = 0; + lastfile = nsrcfiles; + if (invertedindex == YES) { + srcoffset = mymalloc((nsrcfiles + 1) * sizeof(long)); + } + for (;;) { + progress("Building symbol database", (long)built, + (long)lastfile); + if (linemode == NO) + refresh(); + + /* get the next source file name */ + for (fileindex = firstfile; fileindex < lastfile; ++fileindex) { + + /* display the progress about every three seconds */ + if (interactive == YES && fileindex % 10 == 0) { + progress("Building symbol database", fileindex, lastfile); + } + /* if the old file has been deleted get the next one */ + file = srcfiles[fileindex]; + while (oldfile != NULL && strcmp(file, oldfile) > 0) { + oldfile = getoldfile(); + } + /* if there isn't an old database or this is a new file */ + if (oldfile == NULL || strcmp(file, oldfile) < 0) { + crossref(file); + ++built; + } else if (lstat(file, &statstruct) == 0 + && statstruct.st_mtime > reftime) { + /* if this file was modified */ + crossref(file); + ++built; + + /* skip its old crossref so modifying the last source + * file does not cause all included files to be built. + * Unfortunately a new file that is alphabetically + * last will cause all included files to be build, but + * this is less likely */ + oldfile = getoldfile(); + } else { + /* copy its cross-reference */ + putfilename(file); + if (invertedindex == YES) { + copyinverted(); + } else { + copydata(); + } + ++copied; + oldfile = getoldfile(); + } + } + /* see if any included files were found */ + if (lastfile == nsrcfiles) { + break; + } + firstfile = lastfile; + lastfile = nsrcfiles; + if (invertedindex == YES) { + srcoffset = myrealloc(srcoffset, + (nsrcfiles + 1) * sizeof(long)); + } + /* sort the included file names */ + qsort(&srcfiles[firstfile], (lastfile - firstfile), + sizeof(char *), compare); + } + /* add a null file name to the trailing tab */ + putfilename(""); + dbputc('\n'); + + /* get the file trailer offset */ + traileroffset = dboffset; + + /* output the source and include directory and file lists */ + putlist(srcdirs, nsrcdirs); + putlist(incdirs, nincdirs); + putlist(srcfiles, nsrcfiles); + if (fflush(newrefs) == EOF) { + /* rewind doesn't check for write failure */ + cannotwrite(newreffile); + /* NOTREACHED */ + } + + /* create the inverted index if requested */ + if (invertedindex == YES) { + char sortcommand[PATHLEN + 1]; + + if (fflush(postings) == EOF) { + cannotwrite(temp1); + /* NOTREACHED */ + } + fstat(fileno(postings), &statstruct); + fclose(postings); + sprintf(sortcommand, "env LC_ALL=C sort -T %s %s", tmpdir, temp1); + if ((postings = mypopen(sortcommand, "r")) == NULL) { + fprintf(stderr, "cscope: cannot open pipe to sort command\n"); + cannotindex(); + } else { + if ((totalterms = invmake(newinvname, newinvpost, postings)) > 0) { + movefile(newinvname, invname); + movefile(newinvpost, invpost); + } else { + cannotindex(); + } + mypclose(postings); + } + unlink(temp1); + free(srcoffset); + } + /* rewrite the header with the trailer offset and final option list */ + rewind(newrefs); + putheader(newdir); + fclose(newrefs); + + /* close the old database file */ + if (symrefs >= 0) { + close(symrefs); + } + if (oldrefs != NULL) { + fclose(oldrefs); + } + /* replace it with the new database file */ + movefile(newreffile, reffile); +} + + +/* string comparison function for qsort */ +static int +compare(const void *arg_s1, const void *arg_s2) +{ + const char **s1 = (const char **) arg_s1; + const char **s2 = (const char **) arg_s2; + + return(strcmp(*s1, *s2)); +} + + +/* seek to the trailer, in a given file */ +void +seek_to_trailer(FILE *f) +{ + if (fscanf(f, "%ld", &traileroffset) != 1) { + postfatal("cscope: cannot read trailer offset from file %s\n", reffile); + /* NOTREACHED */ + } + if (fseek(f, traileroffset, SEEK_SET) == -1) { + postfatal("cscope: cannot seek to trailer in file %s\n", reffile); + /* NOTREACHED */ + } +} + + +/* get the next file name in the old cross-reference */ +static char * +getoldfile(void) +{ + static char file[PATHLEN + 1]; /* file name in old crossref */ + + if (blockp != NULL) { + do { + if (*blockp == NEWFILE) { + skiprefchar(); + fetch_string_from_dbase(file, sizeof(file)); + if (file[0] != '\0') { /* if not end-of-crossref */ + return(file); + } + return(NULL); + } + } while (scanpast('\t') != NULL); + } + return(NULL); +} + + +/* Free all storage allocated for filenames: */ +void free_newbuildfiles(void) +{ + free(newinvname); + free(newinvpost); + free(newreffile); +} + + +/* output the cscope version, current directory, database format options, and + the database trailer offset */ +static void +putheader(char *dir) +{ + dboffset = fprintf(newrefs, "cscope %d %s", FILEVERSION, dir); + if (compress == NO) { + dboffset += fprintf(newrefs, " -c"); + } + if (invertedindex == YES) { + dboffset += fprintf(newrefs, " -q %.10ld", totalterms); + } else { + /* leave space so if the header is overwritten without -q + * because writing the inverted index failed, the header + * is the same length */ + dboffset += fprintf(newrefs, " "); + } + if (trun_syms == YES) { + dboffset += fprintf(newrefs, " -T"); + } + + dboffset += fprintf(newrefs, " %.10ld\n", traileroffset); +#ifdef PRINTF_RETVAL_BROKEN + dboffset = ftell(newrefs); +#endif +} + + +/* put the name list into the cross-reference file */ +static void +putlist(char **names, int count) +{ + int i, size = 0; + + fprintf(newrefs, "%d\n", count); + if (names == srcfiles) { + + /* calculate the string space needed */ + for (i = 0; i < count; ++i) { + size += strlen(names[i]) + 1; + } + fprintf(newrefs, "%d\n", size); + } + for (i = 0; i < count; ++i) { + if (fputs(names[i], newrefs) == EOF || + putc('\n', newrefs) == EOF) { + cannotwrite(newreffile); + /* NOTREACHED */ + } + } +} + + +/* copy this file's symbol data */ +static void +copydata(void) +{ + char symbol[PATLEN + 1]; + char *cp; + + setmark('\t'); + cp = blockp; + for (;;) { + /* copy up to the next \t */ + do { /* innermost loop optimized to only one test */ + while (*cp != '\t') { + dbputc(*cp++); + } + } while (*++cp == '\0' && (cp = read_block()) != NULL); + dbputc('\t'); /* copy the tab */ + + /* get the next character */ + if (*(cp + 1) == '\0') { + cp = read_block(); + } + /* exit if at the end of this file's data */ + if (cp == NULL || *cp == NEWFILE) { + break; + } + /* look for an #included file */ + if (*cp == INCLUDE) { + blockp = cp; + fetch_include_from_dbase(symbol, sizeof(symbol)); + writestring(symbol); + setmark('\t'); + cp = blockp; + } + } + blockp = cp; +} + +/* copy this file's symbol data and output the inverted index postings */ + +static void +copyinverted(void) +{ + char *cp; + char c; + int type; /* reference type (mark character) */ + char symbol[PATLEN + 1]; + + /* note: this code was expanded in-line for speed */ + /* while (scanpast('\n') != NULL) { */ + /* other macros were replaced by code using cp instead of blockp */ + cp = blockp; + for (;;) { + setmark('\n'); + do { /* innermost loop optimized to only one test */ + while (*cp != '\n') { + dbputc(*cp++); + } + } while (*++cp == '\0' && (cp = read_block()) != NULL); + dbputc('\n'); /* copy the newline */ + + /* get the next character */ + if (*(cp + 1) == '\0') { + cp = read_block(); + } + /* exit if at the end of this file's data */ + if (cp == NULL) { + break; + } + switch (*cp) { + case '\n': + lineoffset = dboffset + 1; + continue; + case '\t': + dbputc('\t'); + blockp = cp; + type = getrefchar(); + switch (type) { + case NEWFILE: /* file name */ + 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; + } + c = *cp; + if (c & 0200) { /* digraph char? */ + c = dichar1[(c & 0177) / 8]; + } + /* if this is a symbol */ + if (isalpha((unsigned char)c) || c == '_') { + blockp = cp; + fetch_string_from_dbase(symbol, sizeof(symbol)); + type = ' '; + output: + putposting(symbol, type); + writestring(symbol); + if (blockp == NULL) { + return; + } + cp = blockp; + } + } + blockp = cp; +} + + +/* replace the old file with the new file */ +static void +movefile(char *new, char *old) +{ + 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 +fetch_include_from_dbase(char *s, size_t length) +{ + dbputc(INCLUDE); + skiprefchar(); + fetch_string_from_dbase(s, length); + incfile(s + 1, s); +} + diff --git a/src/build.h b/src/build.h new file mode 100644 index 0000000..085d15b --- /dev/null +++ b/src/build.h @@ -0,0 +1,73 @@ +/*=========================================================================== + Copyright (c) 2001, 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: build.h,v 1.1 2001/07/09 14:01:18 broeker Exp $ */ + + +#ifndef CSCOPE_BUILD_H +#define CSCOPE_BUILD_H + +#include "global.h" /* FIXME: temp. only */ +#include "invlib.h" + +/* types and macros of build.c to be used by other modules */ + +/* database output macros that update its offset */ +#define dbputc(c) (++dboffset, (void) putc(c, newrefs)) +#define dbfputs(s) (dboffset += strlen(s), fputs(s, newrefs)) + +/* declarations for globals defined in build.c */ + +extern BOOL buildonly; /* only build the database */ +extern BOOL unconditional; /* unconditionally build database */ +extern BOOL fileschanged; /* assume some files changed */ + +extern char *reffile; /* cross-reference file path name */ +extern char *invname; /* inverted index to the database */ +extern char *invpost; /* inverted index postings */ +extern char *newreffile; /* new cross-reference file name */ +extern FILE *newrefs; /* new cross-reference */ +extern FILE *postings; /* new inverted index postings */ +extern int symrefs; /* cross-reference file */ + +extern INVCONTROL invcontrol; /* inverted file control structure */ + +/* Prototypes of external functions defined by build.c */ + +void build(void); +void free_newbuildfiles(void); +void opendatabase(void); +void rebuild(void); +void setup_build_filenames(char *reffile); +void seek_to_trailer(FILE *f); + +#endif /* CSCOPE_BUILD_H */ diff --git a/src/command.c b/src/command.c new file mode 100644 index 0000000..0974352 --- /dev/null +++ b/src/command.c @@ -0,0 +1,938 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol or text cross-reference + * + * command functions + */ + +#include "global.h" +#include "build.h" /* for rebuild() */ +#include "alloc.h" + +#include <stdlib.h> +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +#include <ctype.h> + +static char const rcsid[] = "$Id: command.c,v 1.32 2006/08/20 15:00:33 broeker Exp $"; + + +int selecting; +unsigned int curdispline = 0; + +BOOL caseless; /* ignore letter case when searching */ +BOOL *change; /* change this line */ +BOOL changing; /* changing text */ +char newpat[PATLEN + 1]; /* new pattern */ +/* HBB 20040430: renamed to avoid lots of clashes with function arguments + * also named 'pattern' */ +char Pattern[PATLEN + 1]; /* symbol or text pattern */ + +/* HBB FIXME 20060419: these should almost certainly be const */ +static char appendprompt[] = "Append to file: "; +static char pipeprompt[] = "Pipe to shell command: "; +static char readprompt[] = "Read from file: "; +static char toprompt[] = "To: "; + + +/* Internal prototypes: */ +static BOOL changestring(void); +static void clearprompt(void); +static void mark(unsigned int i); +static void scrollbar(MOUSE *p); + + +/* execute the command */ +BOOL +command(int commandc) +{ + char filename[PATHLEN + 1]; /* file path name */ + MOUSE *p; /* mouse data */ + int c, i; + FILE *file; + struct cmd *curritem, *item; /* command history */ + char *s; + + switch (commandc) { + case ctrl('C'): /* toggle caseless mode */ + if (caseless == NO) { + caseless = YES; + postmsg2("Caseless mode is now ON"); + } else { + caseless = NO; + postmsg2("Caseless mode is now OFF"); + } + egrepcaseless(caseless); /* turn on/off -i flag */ + return(NO); + + case ctrl('R'): /* rebuild the cross reference */ + if (isuptodate == YES) { + postmsg("The -d option prevents rebuilding the symbol database"); + return(NO); + } + exitcurses(); + freefilelist(); /* remake the source file list */ + makefilelist(); + rebuild(); + if (errorsfound == YES) { + errorsfound = NO; + askforreturn(); + } + entercurses(); + clearmsg(); /* clear any previous message */ + totallines = 0; + disprefs = 0; + topline = nextline = 1; + selecting = 0; + break; + +#if UNIXPC + case ESC: /* possible unixpc mouse selection */ +#endif + case ctrl('X'): /* mouse selection */ + if ((p = getmouseaction(DUMMYCHAR)) == NULL) { + return(NO); /* unknown control sequence */ + } + /* if the button number is a scrollbar tag */ + if (p->button == '0') { + scrollbar(p); + break; + } + /* ignore a sweep */ + if (p->x2 >= 0) { + return(NO); + } + /* if this is a line selection */ + if (p->y1 < FLDLINE) { + + /* find the selected line */ + /* note: the selection is forced into range */ + for (i = disprefs - 1; i > 0; --i) { + if (p->y1 >= displine[i]) { + break; + } + } + /* display it in the file with the editor */ + editref(i); + } else { /* this is an input field selection */ + field = p->y1 - FLDLINE; + /* force it into range */ + if (field >= FIELDS) { + field = FIELDS - 1; + } + setfield(); + resetcmd(); + return(NO); + } + break; + + case '\t': /* go to next input field */ + if (disprefs) { + selecting = !selecting; + if (selecting) { + move(displine[curdispline], 0); + refresh(); + } else { + atfield(); + resetcmd(); + } + } + return(NO); + +#ifdef KEY_ENTER + case KEY_ENTER: +#endif + case '\r': + case '\n': /* go to reference */ + if (selecting) { + editref(curdispline); + return(YES); + } + /* FALLTHROUGH */ + + case ctrl('N'): +#ifdef KEY_DOWN + case KEY_DOWN: +#endif +#ifdef KEY_RIGHT + case KEY_RIGHT: +#endif + if (selecting) { + if ((curdispline + 1) < disprefs) { + move(displine[++curdispline], 0); + refresh(); + } + } else { + field = (field + 1) % FIELDS; + setfield(); + atfield(); + resetcmd(); + } + return(NO); + + case ctrl('P'): /* go to previous input field */ +#ifdef KEY_UP + case KEY_UP: +#endif +#ifdef KEY_LEFT + case KEY_LEFT: +#endif + if (selecting) { + if (curdispline) { + move(displine[--curdispline], 0); + refresh(); + } + } else { + field = (field + (FIELDS - 1)) % FIELDS; + setfield(); + atfield(); + resetcmd(); + } + return(NO); +#ifdef KEY_HOME + case KEY_HOME: /* go to first input field */ + if (selecting) { + curdispline = 0; + move(REFLINE, 0); + refresh(); + } else { + field = 0; + setfield(); + atfield(); + resetcmd(); + } + return(NO); +#endif + +#ifdef KEY_LL + case KEY_LL: /* go to last input field */ + if (selecting) { + move(displine[disprefs - 1], 0); + refresh(); + } else { + field = FIELDS - 1; + setfield(); + atfield(); + resetcmd(); + } + return(NO); +#endif /* def(KEY_LL) */ + + case ' ': /* display next page */ + case '+': + case ctrl('V'): +#ifdef KEY_NPAGE + case KEY_NPAGE: +#endif + /* don't redisplay if there are no lines */ + if (totallines == 0) { + return(NO); + } + /* note: seekline() is not used to move to the next + * page because display() leaves the file pointer at + * the next page to optimize paging forward + */ + curdispline = 0; + break; + + case ctrl('H'): + case '-': /* display previous page */ +#ifdef KEY_PPAGE + case KEY_PPAGE: +#endif + /* don't redisplay if there are no lines */ + if (totallines == 0) { + return(NO); + } + + curdispline = 0; + + /* if there are only two pages, just go to the other one */ + if (totallines <= 2 * mdisprefs) { + break; + } + /* if on first page but not at beginning, go to beginning */ + nextline -= mdisprefs; /* already at next page */ + if (nextline > 1 && nextline <= mdisprefs) { + nextline = 1; + } else { + nextline -= mdisprefs; + if (nextline < 1) { + nextline = totallines - mdisprefs + 1; + if (nextline < 1) { + nextline = 1; + } + } + } + seekline(nextline); + break; + + case '>': /* write or append the lines to a file */ + if (totallines == 0) { + postmsg("There are no lines to write to a file"); + } else { /* get the file name */ + move(PRLINE, 0); + addstr("Write to file: "); + s = "w"; + if ((c = mygetch()) == '>') { + move(PRLINE, 0); + addstr(appendprompt); + c = '\0'; + s = "a"; + } + if (c != '\r' && + mygetline("", newpat, + COLS - sizeof(appendprompt), c, NO) > 0 + ) { + shellpath(filename, sizeof(filename), newpat); + if ((file = myfopen(filename, s)) == NULL) { + cannotopen(filename); + } else { + seekline(1); + while ((c = getc(refsfound)) != EOF) { + putc(c, file); + } + seekline(topline); + fclose(file); + } + } + clearprompt(); + } + return(NO); /* return to the previous field */ + + case '<': /* read lines from a file */ + move(PRLINE, 0); + addstr(readprompt); + if (mygetline("", newpat, COLS - sizeof(readprompt), + '\0', NO) > 0) { + clearprompt(); + shellpath(filename, sizeof(filename), newpat); + if (readrefs(filename) == NO) { + postmsg2("Ignoring an empty file"); + return(NO); + } + return(YES); + } + clearprompt(); + return(NO); + + case '^': /* pipe the lines through a shell command */ + case '|': /* pipe the lines to a shell command */ + if (totallines == 0) { + postmsg("There are no lines to pipe to a shell command"); + return(NO); + } + /* get the shell command */ + move(PRLINE, 0); + addstr(pipeprompt); + if (mygetline("", newpat, COLS - sizeof(pipeprompt), '\0', NO) + == 0) { + clearprompt(); + return(NO); + } + /* if the ^ command, redirect output to a temp file */ + if (commandc == '^') { + strcat(strcat(newpat, " >"), temp2); + /* HBB 20020708: somebody might have even + * their non-interactive default shells + * complain about clobbering + * redirections... --> delete before + * overwriting */ + remove(temp2); + } + exitcurses(); + if ((file = mypopen(newpat, "w")) == NULL) { + fprintf(stderr, "\ +cscope: cannot open pipe to shell command: %s\n", newpat); + } else { + seekline(1); + while ((c = getc(refsfound)) != EOF) { + putc(c, file); + } + seekline(topline); + mypclose(file); + } + if (commandc == '^') { + if (readrefs(temp2) == NO) { + postmsg("Ignoring empty output of ^ command"); + } + } + askforreturn(); + entercurses(); + break; +#if defined(KEY_RESIZE) && !defined(__DJGPP__) + case KEY_RESIZE: + exitcurses(); + initscr(); + entercurses(); +#if TERMINFO + keypad(stdscr, TRUE); /* enable the keypad */ +#ifdef HAVE_FIXKEYPAD + fixkeypad(); /* fix for getch() intermittently returning garbage */ +#endif +#endif +#if UNIXPC + standend(); /* turn off reverse video */ +#endif + dispinit(); /* initialize display parameters */ + setfield(); /* set the initial cursor position */ + postmsg(""); /* clear any build progress message */ + display(); /* display the version number and input fields */ + break; +#endif + case ctrl('L'): /* redraw screen */ +#ifdef KEY_CLEAR + case KEY_CLEAR: +#endif + clearmsg2(); + clearok(curscr, TRUE); + wrefresh(curscr); + drawscrollbar(topline, bottomline); + return(NO); + + case '!': /* shell escape */ + execute(shell, shell, NULL); + seekline(topline); + break; + + case '?': /* help */ + clear(); + help(); + clear(); + seekline(topline); + break; + + case ctrl('E'): /* edit all lines */ + editall(); + break; + + case ctrl('A'): /* HBB 20050428: added alt. keymapping */ + case ctrl('Y'): /* repeat last pattern */ + if (*Pattern != '\0') { + addstr(Pattern); + goto repeat; + } + break; + + case ctrl('B'): /* cmd history back */ + case ctrl('F'): /* cmd history fwd */ + if (selecting) + return(NO); + + curritem = currentcmd(); + item = (commandc == ctrl('F')) ? nextcmd() : prevcmd(); + clearmsg2(); + if (curritem == item) { /* inform user that we're at history end */ + postmsg2("End of input field and search pattern history"); + } + if (item) { + field = item->field; + setfield(); + atfield(); + addstr(item->text); + strcpy(Pattern, item->text); + switch (c = mygetch()) { + case '\r': + case '\n': + goto repeat; + case ctrl('F'): + case ctrl('B'): + myungetch(c); + atfield(); + clrtoeol(); /* clear current field */ + break; + default: + myungetch(c); + if (mygetline(Pattern, newpat, COLS - fldcolumn - 1, '\0', caseless )) { + strcpy (Pattern, newpat); + resetcmd(); + } + goto repeat; + break; + } + } + return(NO); + + case '\\': /* next character is not a command */ + addch('\\'); /* display the quote character */ + + /* get a character from the terminal */ + if ((commandc = mygetch()) == EOF) { + return(NO); /* quit */ + } + addstr("\b \b"); /* erase the quote character */ + goto ispat; + + case '.': + postmsg("The . command has been replaced by ^Y"); + atfield(); /* move back to the input field */ + /* FALLTHROUGH */ + default: + if (selecting && !mouse) { + char *c; + + if ((c = strchr(dispchars, commandc))) + editref(c - dispchars); + + /* if this is the start of a pattern */ + } else if (isprint(commandc)) { + ispat: + if (mygetline("", newpat, COLS - fldcolumn - 1, + commandc, caseless) > 0) { + strcpy(Pattern, newpat); + resetcmd(); /* reset command history */ + repeat: + addcmd(field, Pattern); /* add to command history */ + if (field == CHANGE) { + /* prompt for the new text */ + move(PRLINE, 0); + addstr(toprompt); + mygetline("", newpat, + COLS - sizeof(toprompt), + '\0', NO); + } + /* search for the pattern */ + if (search() == YES) { + curdispline = 0; + ++selecting; + + switch (field) { + case DEFINITION: + case FILENAME: + if (totallines > 1) { + break; + } + topline = 1; + editref(0); + break; + case CHANGE: + return(changestring()); + } + + } else if (field == FILENAME && + access(newpat, READ) == 0) { + /* try to edit the file anyway */ + edit(newpat, "1"); + } + } else { /* no pattern--the input was erased */ + return(NO); + } + } else { /* control character */ + return(NO); + } + } /* switch(commandc) */ + return(YES); +} + +/* clear the prompt line */ + +static void +clearprompt(void) +{ + move(PRLINE, 0); + clrtoeol(); +} + +/* read references from a file */ + +BOOL +readrefs(char *filename) +{ + FILE *file; + int c; + + if ((file = myfopen(filename, "rb")) == NULL) { + cannotopen(filename); + return(NO); + } + if ((c = getc(file)) == EOF) { /* if file is empty */ + return(NO); + } + totallines = 0; + disprefs = 0; + nextline = 1; + if (writerefsfound() == YES) { + putc(c, refsfound); + while ((c = getc(file)) != EOF) { + putc(c, refsfound); + } + fclose(file); + fclose(refsfound); + if ( (refsfound = myfopen(temp1, "rb")) == NULL) { + cannotopen(temp1); + return(NO); + } + countrefs(); + } + return(YES); +} + +/* change one text string to another */ + +static BOOL +changestring(void) +{ + char newfile[PATHLEN + 1]; /* new file name */ + char oldfile[PATHLEN + 1]; /* old file name */ + char linenum[NUMLEN + 1]; /* file line number */ + char msg[MSGLEN + 1]; /* message */ + FILE *script; /* shell script file */ + BOOL anymarked = NO; /* any line marked */ + MOUSE *p; /* mouse data */ + int c; + unsigned int i; + char *s; + + /* open the temporary file */ + if ((script = myfopen(temp2, "w")) == NULL) { + cannotopen(temp2); + return(NO); + } + /* create the line change indicators */ + change = mycalloc(totallines, sizeof(BOOL)); + changing = YES; + mousemenu(); + + /* until the quit command is entered */ + for (;;) { + /* display the current page of lines */ + display(); + same: + atchange(); + + /* get a character from the terminal */ + if ((c = mygetch()) == EOF + || c == ctrl('D') + || c == ctrl('Z')) { + break; /* change lines */ + } + /* see if the input character is a command */ + switch (c) { + case ' ': /* display next page */ + case '+': + case ctrl('V'): +#ifdef KEY_NPAGE + case KEY_NPAGE: +#endif + case '-': /* display previous page */ +#ifdef KEY_PPAGE + case KEY_PPAGE: +#endif + case '!': /* shell escape */ + case '?': /* help */ + command(c); + break; + + case ctrl('L'): /* redraw screen */ +#ifdef KEY_CLEAR + case KEY_CLEAR: +#endif + command(c); + goto same; + + case ESC: /* don't change lines */ +#if UNIXPC + if((p = getmouseaction(DUMMYCHAR)) == NULL) { + goto nochange; /* unknown escape sequence */ + } + break; +#endif + case ctrl('G'): + goto nochange; + + case '*': /* mark/unmark all displayed lines */ + for (i = 0; topline + i < nextline; ++i) { + mark(i); + } + goto same; + + case ctrl('A'): /* mark/unmark all lines */ + for (i = 0; i < totallines; ++i) { + if (change[i] == NO) { + change[i] = YES; + } else { + change[i] = NO; + } + } + /* show that all have been marked */ + seekline(totallines); + break; + + case ctrl('X'): /* mouse selection */ + if ((p = getmouseaction(DUMMYCHAR)) == NULL) { + goto same; /* unknown control sequence */ + } + /* if the button number is a scrollbar tag */ + if (p->button == '0') { + scrollbar(p); + break; + } + /* find the selected line */ + /* note: the selection is forced into range */ + for (i = disprefs - 1; i > 0; --i) { + if (p->y1 >= displine[i]) { + break; + } + } + mark(i); + goto same; + + default: + { + /* if a line was selected */ + char *cc; + + if ((cc = strchr(dispchars, c))) + mark(cc - dispchars); + + goto same; + } /* default case */ + } /* switch(change code character) */ + } /* for(ever) */ + + /* for each line containing the old text */ + fprintf(script, "ed - <<\\!\n"); + *oldfile = '\0'; + 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 */ + if (change[i] == YES) { + anymarked = YES; + + /* if this is a new file */ + if (strcmp(newfile, oldfile) != 0) { + + /* make sure it can be changed */ + if (access(newfile, WRITE) != 0) { + sprintf(msg, "Cannot write to file %s", newfile); + postmsg(msg); + anymarked = NO; + break; + } + /* if there was an old file */ + if (*oldfile != '\0') { + fprintf(script, "w\n"); /* save it */ + } + /* edit the new file */ + strcpy(oldfile, newfile); + fprintf(script, "e %s\n", oldfile); + } + /* output substitute command */ + fprintf(script, "%ss/", linenum); /* change */ + for (s = Pattern; *s != '\0'; ++s) { + /* old text */ + if (strchr("/\\[.^*", *s) != NULL) { + putc('\\', script); + } + if (caseless == YES && isalpha((unsigned char)*s)) { + putc('[', script); + if(islower((unsigned char)*s)) { + putc(toupper((unsigned char)*s), script); + putc(*s, script); + } else { + putc(*s, script); + putc(tolower((unsigned char)*s), script); + } + putc(']', script); + } else + putc(*s, script); + } + putc('/', script); /* to */ + for (s = newpat; *s != '\0'; ++s) { /* new text */ + if (strchr("/\\&", *s) != NULL) { + putc('\\', script); + } + putc(*s, script); + } + fprintf(script, "/gp\n"); /* and print */ + } + } + fprintf(script, "w\nq\n!\n"); /* write and quit */ + fclose(script); + + /* if any line was marked */ + if (anymarked == YES) { + + /* edit the files */ + clearprompt(); + refresh(); + fprintf(stderr, "Changed lines:\n\r"); + execute("sh", "sh", temp2, NULL); + askforreturn(); + seekline(1); + } else { + nochange: + clearprompt(); + } + changing = NO; + mousemenu(); + free(change); + return(anymarked); +} + + +/* mark/unmark this displayed line to be changed */ +static void +mark(unsigned int i) +{ + unsigned int j; + + j = i + topline - 1; + if (j < totallines) { + move(displine[i], 1); + + if (change[j] == NO) { + change[j] = YES; + addch('>'); + } else { + change[j] = NO; + addch(' '); + } + } +} + + +/* scrollbar actions */ +static void +scrollbar(MOUSE *p) +{ + /* reposition list if it makes sense */ + if (totallines == 0) { + return; + } + switch (p->percent) { + + case 101: /* scroll down one page */ + if (nextline + mdisprefs > totallines) { + nextline = totallines - mdisprefs + 1; + } + break; + + case 102: /* scroll up one page */ + nextline = topline - mdisprefs; + if (nextline < 1) { + nextline = 1; + } + break; + + case 103: /* scroll down one line */ + nextline = topline + 1; + break; + + case 104: /* scroll up one line */ + if (topline > 1) { + nextline = topline - 1; + } + break; + default: + nextline = p->percent * totallines / 100; + } + seekline(nextline); +} + + +/* count the references found */ +void +countrefs(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 i; + + /* count the references found and find the length of the file, + function, and line number display fields */ + subsystemlen = 9; /* strlen("Subsystem") */ + booklen = 4; /* strlen("Book") */ + filelen = 4; /* strlen("File") */ + fcnlen = 8; /* strlen("Function") */ + numlen = 0; + while ((i = fscanf(refsfound, "%250s%250s%5s %5000[^\n]", file, + function, linenum, tempstring)) != EOF) { + if (i != 4 || + !isgraph((unsigned char) *file) || + !isgraph((unsigned char) *function) || + !isdigit((unsigned char) *linenum)) { + postmsg("File does not have expected format"); + totallines = 0; + disprefs = 0; + return; + } + if ((i = strlen(pathcomponents(file, dispcomponents))) > filelen) { + filelen = i; + } + if (ogs == YES) { + ogsnames(file, &subsystem, &book); + if ((i = strlen(subsystem)) > subsystemlen) { + subsystemlen = i; + } + if ((i = strlen(book)) > booklen) { + booklen = i; + } + } + if ((i = strlen(function)) > fcnlen) { + fcnlen = i; + } + if ((i = strlen(linenum)) > numlen) { + numlen = i; + } + ++totallines; + } + rewind(refsfound); + + /* 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; + } +} diff --git a/src/compath.c b/src/compath.c new file mode 100644 index 0000000..6726ae1 --- /dev/null +++ b/src/compath.c @@ -0,0 +1,213 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* + * compath(pathname) + * + * This compresses pathnames. All strings of multiple slashes are + * changed to a single slash. All occurrences of "./" are removed. + * Whenever possible, strings of "/.." are removed together with + * the directory names that they follow. + * + * WARNING: since pathname is altered by this function, it should + * be located in a temporary buffer. This avoids the problem + * of accidently changing strings obtained from makefiles + * and stored in global structures. + */ + +static char const rcsid[] = "$Id: compath.c,v 1.3 2001/07/05 14:31:00 broeker Exp $"; + +#include "global.h" + +#ifndef NULL +#define NULL 0 +#endif + +char * +compath(char *pathname) /*FDEF*/ +{ + char *nextchar; + char *lastchar; + char *sofar; + char *pnend; + + int pnlen; + + /* + * do not change the path if it has no "/" + */ + + if (strchr(pathname, '/') == NULL) + return(pathname); + + /* + * find all strings consisting of more than one '/' + */ + + for (lastchar = pathname + 1; *lastchar != '\0'; lastchar++) + if ((*lastchar == '/') && (*(lastchar - 1) == '/')) + { + + /* + * find the character after the last slash + */ + + nextchar = lastchar; + while (*++lastchar == '/') + { + } + + /* + * eliminate the extra slashes by copying + * everything after the slashes over the slashes + */ + + sofar = nextchar; + while ((*nextchar++ = *lastchar++) != '\0') + ; + lastchar = sofar; + } + + /* + * find all strings of "./" + */ + + for (lastchar = pathname + 1; *lastchar != '\0'; lastchar++) + if ((*lastchar == '/') && (*(lastchar - 1) == '.') && + ((lastchar - 1 == pathname) || (*(lastchar - 2) == '/'))) + { + + /* + * copy everything after the "./" over the "./" + */ + + nextchar = lastchar - 1; + sofar = nextchar; + while ((*nextchar++ = *++lastchar) != '\0') + ; + lastchar = sofar; + } + + /* + * find each occurrence of "/.." + */ + + for (lastchar = pathname + 1; *lastchar != '\0'; lastchar++) + if ((lastchar != pathname) && (*lastchar == '/') && + (*(lastchar + 1) == '.') && (*(lastchar + 2) == '.') && + ((*(lastchar + 3) == '/') || (*(lastchar + 3) == '\0'))) + { + + /* + * find the directory name preceding the "/.." + */ + + nextchar = lastchar - 1; + while ((nextchar != pathname) && + (*(nextchar - 1) != '/')) + --nextchar; + + /* + * make sure the preceding directory's name + * is not "." or ".." + */ + + if ((*nextchar == '.') && + ((*(nextchar + 1) == '/') || + ((*(nextchar + 1) == '.') && (*(nextchar + 2) == '/')))) + /* EMPTY */; + else + { + + /* + * prepare to eliminate either + * "dir_name/../" or "dir_name/.." + */ + + if (*(lastchar + 3) == '/') + lastchar += 4; + else + lastchar += 3; + + /* + * copy everything after the "/.." to + * before the preceding directory name + */ + + sofar = nextchar - 1; + while ((*nextchar++ = *lastchar++) != '\0'); + + lastchar = sofar; + + /* + * if the character before what was taken + * out is '/', set up to check if the + * slash is part of "/.." + */ + + if ((sofar + 1 != pathname) && (*sofar == '/')) + --lastchar; + } + } + + /* + * if the string is more than a character long and ends + * in '/', eliminate the '/'. + */ + + pnlen = strlen(pathname); + pnend = strchr(pathname, '\0') - 1; + + if ((pnlen > 1) && (*pnend == '/')) + { + *pnend-- = '\0'; + pnlen--; + } + + /* + * if the string has more than two characters and ends in + * "/.", remove the "/.". + */ + + if ((pnlen > 2) && (*(pnend - 1) == '/') && (*pnend == '.')) + *--pnend = '\0'; + + /* + * if all characters were deleted, return "."; + * otherwise return pathname + */ + + if (*pathname == '\0') + (void) strcpy(pathname, "."); + + return(pathname); +} diff --git a/src/constants.h b/src/constants.h new file mode 100644 index 0000000..7ad8005 --- /dev/null +++ b/src/constants.h @@ -0,0 +1,137 @@ +/*=========================================================================== + 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: constants.h,v 1.15 2006/08/20 15:00:34 broeker Exp $ */ + +/* cscope - interactive C symbol cross-reference + * + * preprocessor macro and constant definitions + */ + +#ifndef CSCOPE_CONSTANTS_H +#define CSCOPE_CONSTANTS_H + +#include "config.h" /* Get OS defines */ + +#define ctrl(x) (x & 037) /* control character macro */ + +/* fast string equality tests (avoids most strcmp() calls) */ +#define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0) +#define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0) + +/* set the mark character for searching the cross-reference file */ +#define setmark(c) (blockmark = c, block[blocklen] = blockmark) + +/* get the next character in the cross-reference */ +/* note that blockp is assumed not to be null */ +#define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \ + (read_block() != NULL ? *blockp : '\0')) + +/* skip the next character in the cross-reference */ +/* note that blockp is assumed not to be null and that + this macro will always be in a statement by itself */ +#define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block() + +#define ESC '\033' /* escape character */ +#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 */ +#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 */ +#define INVNAME "cscope.in.out" /* inverted index to the database */ +#define INVPOST "cscope.po.out" /* inverted index postings */ +#define INVNAME2 "cscope.out.in"/* follows correct naming convention */ +#define INVPOST2 "cscope.out.po"/* follows correct naming convention */ + +#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 */ +#define MSGLINE 0 /* message line */ +#define PRLINE (LINES - 1) /* input prompt line */ +#define REFLINE 3 /* first displayed reference line */ + +/* input fields (value matches field order on screen) */ +#define SYMBOL 0 +#define DEFINITION 1 +#define CALLEDBY 2 +#define CALLING 3 +#define STRING 4 +#define CHANGE 5 +#define REGEXP 6 +#define FILENAME 7 +#define INCLUDES 8 +#define FIELDS 9 + +#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ +# define TERMINFO 0 /* no terminfo curses */ +#else +# define TERMINFO 1 +#endif + + +#if !TERMINFO +# ifndef KEY_BREAK +# define KEY_BREAK 0400 /* easier to define than to add #if around the use */ +# endif +# ifndef KEY_ENTER +# define KEY_ENTER 0401 +# endif +# ifndef KEY_BACKSPACE +# define KEY_BACKSPACE 0402 +# endif + +# if !sun +# define cbreak() crmode() /* name change */ +# endif + +# if UNIXPC +# define erasechar() (_tty.c_cc[VERASE]) /* equivalent */ +# define killchar() (_tty.c_cc[VKILL]) /* equivalent */ +# else +# define erasechar() (_tty.sg_erase) /* equivalent */ +# define killchar() (_tty.sg_kill) /* equivalent */ +# endif /* if UNIXPC */ +#endif /* if !TERMINFO */ + +#endif /* CSCOPE_CONSTANTS_H */ diff --git a/src/crossref.c b/src/crossref.c new file mode 100644 index 0000000..7f639d6 --- /dev/null +++ b/src/crossref.c @@ -0,0 +1,491 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +/* cscope - interactive C symbol cross-reference + * + * build cross-reference file + */ + +#include "global.h" + +#include "build.h" +#include "scanner.h" +#include "alloc.h" + +#include <stdlib.h> +#include <sys/stat.h> + +static char const rcsid[] = "$Id: crossref.c,v 1.14 2006/07/23 20:59:20 broeker Exp $"; + + +/* convert long to a string */ +#define ltobase(value) n = value; \ + s = buf + (sizeof(buf) - 1); \ + *s = '\0'; \ + digits = 1; \ + while (n >= BASE) { \ + ++digits; \ + i = n; \ + n /= BASE; \ + *--s = i - n * BASE + '!'; \ + } \ + *--s = n + '!'; + +#define SYMBOLINC 20 /* symbol list size increment */ + +long dboffset; /* new database offset */ +BOOL errorsfound; /* prompt before clearing messages */ +long lineoffset; /* source line database offset */ +long npostings; /* number of postings */ +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; + +static void putcrossref(void); +static void savesymbol(int token, int num); + +void +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; + } + } +} + +/* save the symbol in the list */ + +static void +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; +} + +/* output the file name */ + +void +putfilename(char *srcfile) +{ + /* check for file system out of space */ + /* note: dbputc is not used to avoid lint complaint */ + if (putc(NEWFILE, newrefs) == EOF) { + cannotwrite(newreffile); + /* NOTREACHED */ + } + ++dboffset; + if (invertedindex == YES) { + srcoffset[nsrcoffset++] = dboffset; + } + dbfputs(srcfile); + fcnoffset = macrooffset = 0; +} + +/* output the symbols and source line */ + +static void +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; +} + +/* HBB 20000421: new function, for avoiding memory leaks */ +/* free the cross reference symbol table */ +void +freecrossref() +{ + if (symbol) + free(symbol); + symbol = NULL; + symbols = 0; +} + +/* output the inverted index posting */ + +void +putposting(char *term, int type) +{ + long i, n; + char *s; + int digits; /* digits output */ + long offset; /* function/macro database offset */ + char buf[11]; /* number buffer */ + + /* get the function or macro name offset */ + offset = fcnoffset; + if (macrooffset != 0) { + offset = macrooffset; + } + /* then update them to avoid negative relative name offset */ + switch (type) { + case DEFINE: + macrooffset = dboffset; + break; + case DEFINEEND: + macrooffset = 0; + return; /* null term */ + case FCNDEF: + fcnoffset = dboffset; + break; + case FCNEND: + fcnoffset = 0; + return; /* null term */ + } + /* ignore a null term caused by a enum/struct/union without a tag */ + if (*term == '\0') { + return; + } + /* skip any #include secondary type char (< or ") */ + if (type == INCLUDE) { + ++term; + } + /* output the posting, which should be as small as possible to reduce + the temp file size and sort time */ + (void) fputs(term, postings); + (void) putc(' ', postings); + + /* the line offset is padded so postings for the same term will sort + in ascending line offset order to order the references as they + appear withing a source file */ + ltobase(lineoffset); + for (i = PRECISION - digits; i > 0; --i) { + (void) putc('!', postings); + } + do { + (void) putc(*s, postings); + } while (*++s != '\0'); + + /* postings are also sorted by type */ + (void) putc(type, postings); + + /* function or macro name offset */ + if (offset > 0) { + (void) putc(' ', postings); + ltobase(offset); + do { + (void) putc(*s, postings); + } while (*++s != '\0'); + } + if (putc('\n', postings) == EOF) { + cannotwrite(temp1); + /* NOTREACHED */ + } + ++npostings; +} + +/* put the string into the new database */ + +void +writestring(char *s) +{ + unsigned char c; + int i; + + if (compress == NO) { + /* Save some I/O overhead by using puts() instead of putc(): */ + dbfputs(s); + return; + } + /* compress digraphs */ + for (i = 0; (c = s[i]) != '\0'; ++i) { + if (/* dicode1[c] && dicode2[(unsigned char) s[i + 1]] */ + IS_A_DICODE(c, s[i + 1])) { + /* c = (0200 - 2) + dicode1[c] + dicode2[(unsigned char) s[i + 1]]; */ + c = DICODE_COMPRESS(c, s[i + 1]); + ++i; + } + dbputc(c); + } +} + +/* print a warning message with the file name and line number */ + +void +warning(char *text) +{ + + (void) fprintf(stderr, "cscope: \"%s\", line %d: warning: %s\n", filename, + myylineno, text); + errorsfound = YES; +} diff --git a/src/dir.c b/src/dir.c new file mode 100644 index 0000000..5773231 --- /dev/null +++ b/src/dir.c @@ -0,0 +1,729 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +/* cscope - interactive C symbol cross-reference + * + * directory searching functions + */ + +#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: dir.c,v 1.28 2006/08/20 15:00:34 broeker Exp $"; + +#define DIRSEPS " ,:" /* directory list separators */ +#define DIRINC 10 /* directory list size increment */ +#define HASHMOD 2003 /* must be a prime number */ +#define SRCINC HASHMOD /* source file list size increment */ + /* largest known database had 22049 files */ + +char currentdir[PATHLEN + 1];/* current directory */ +char **incdirs; /* #include directories */ +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 */ + char *text; + struct listitem *next; +} *srcnames[HASHMOD]; + +/* Internal prototypes: */ +static BOOL issrcfile(char *file); +static void addsrcdir(char *dir); +static void addincdir(char *name, char *path); +static void scan_dir(const char *dirfile, BOOL recurse); +static void makevpsrcdirs(void); + + +/* make the view source directory list */ + +static void +makevpsrcdirs(void) +{ + int i; + + /* return if this function has already been called */ + if (nsrcdirs > 0) { + return; + } + /* 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 */ + vpinit(currentdir); + if (vpndirs > 1) { + nsrcdirs = vpndirs; + } else { + nsrcdirs = 1; + } + /* create the source directory list */ + msrcdirs = nsrcdirs + DIRINC; + srcdirs = mymalloc(msrcdirs * sizeof(char *)); + *srcdirs = "."; /* first source dir is always current dir */ + for (i = 1; i < vpndirs; ++i) { + srcdirs[i] = vpdirs[i]; + } + /* save the number of original source directories in the view path */ + nvpsrcdirs = nsrcdirs; +} + +/* add a source directory to the list for each view path source directory */ + +void +sourcedir(char *dirlist) +{ + char path[PATHLEN + 1]; + char *dir; + unsigned int i; + + makevpsrcdirs(); /* make the view source directory list */ + dirlist = my_strdup(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 */ +} + +/* add a source directory to the list */ + +static void +addsrcdir(char *dir) +{ + struct stat statstruct; + + /* make sure it is a directory */ + if (lstat(compath(dir), &statstruct) == 0 && + S_ISDIR(statstruct.st_mode)) { + + /* note: there already is a source directory list */ + if (nsrcdirs == msrcdirs) { + msrcdirs += DIRINC; + srcdirs = myrealloc(srcdirs, msrcdirs * sizeof(char *)); + } + srcdirs[nsrcdirs++] = my_strdup(dir); + } +} + +/* HBB 20000421: new function, for avoiding leaks */ +/* free list of src directories */ +void +freesrclist() +{ + if (!srcdirs) + return; + while(nsrcdirs>1) + free(srcdirs[--nsrcdirs]); + free(srcdirs); +} + +/* add a #include directory to the list for each view path source directory */ + +void +includedir(char *dirlist) +{ + char path[PATHLEN + 1]; + char *dir; + unsigned int i; + + makevpsrcdirs(); /* make the view source directory list */ + dirlist = my_strdup(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 */ +} + +/* add a #include directory to the list */ + +static void +addincdir(char *name, char *path) +{ + struct stat statstruct; + + /* make sure it is a directory */ + if (lstat(compath(path), &statstruct) == 0 && + S_ISDIR(statstruct.st_mode)) { + if (incdirs == NULL) { + incdirs = mymalloc(mincdirs * sizeof(char *)); + incnames = mymalloc(mincdirs * sizeof(char *)); + } else if (nincdirs == mincdirs) { + mincdirs += DIRINC; + incdirs = myrealloc(incdirs, + mincdirs * sizeof(char *)); + incnames = myrealloc(incnames, + mincdirs * sizeof(char *)); + } + incdirs[nincdirs] = my_strdup(path); + incnames[nincdirs++] = my_strdup(name); + } +} + +/* HBB 2000421: new function, for avoiding memory leaks */ +/* free the list of include files, if wanted */ + +void +freeinclist() +{ + if (!incdirs) + return; + while(nincdirs>0) { + free(incdirs[--nincdirs]); + free(incnames[nincdirs]); + } + free(incdirs); + free(incnames); +} + +/* make the source file list */ + +void +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, "%" PATHLEN_STR "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) { \ + case 'I': /* #include file directory */ \ + if (firstbuild == YES) { \ + /* expand $ and ~ */ \ + shellpath(dir, sizeof(dir), (s)); \ + includedir(dir); \ + } \ + unfinished_option = 0; \ + done = YES; \ + break; \ + 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); \ + } \ + dispcomponents = atoi(s); \ + unfinished_option = 0; \ + done = YES; \ + break; \ + default: \ + done = NO; \ + } /* 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; + +} + +/* scan a directory (recursively?) for source files */ +static void +scan_dir(const char *adir, BOOL recurse_dir) +{ + DIR *dirfile; + int adir_len = strlen(adir); + + /* FIXME: no guards against adir_len > PATHLEN, yet */ + + if ((dirfile = opendir(adir)) != NULL) { + struct dirent *entry; + char path[PATHLEN + 1]; + char *file; + + while ((entry = readdir(dirfile)) != NULL) { + if ((strcmp(".",entry->d_name) != 0) + && (strcmp("..",entry->d_name) != 0)) { + struct stat buf; + + sprintf(path,"%s/%.*s", adir, + PATHLEN - 2 - adir_len, + entry->d_name); + + if (lstat(path,&buf) == 0) { + file = entry->d_name; + if (recurse_dir + && S_ISDIR(buf.st_mode) ) { + scan_dir(path, recurse_dir); + } else if (issrcfile(path) + && infilelist(path) == NO + && access(path, R_OK) == 0) { + addsrcfile(path); + } + } + } + } + closedir(dirfile); + } + return; +} + + +/* see if this is a source file */ +static BOOL +issrcfile(char *path) +{ + struct stat statstruct; + char *file = mybasename(path); + char *s = strrchr(file, '.'); + BOOL looks_like_source = NO; + + /* ensure there is some file suffix */ + if (s == NULL || *++s == '\0') + return NO; + + /* if an SCCS or versioned file */ + if (file[1] == '.' && file + 2 != s) { /* 1 character prefix */ + switch (*file) { + case 's': + case 'S': + return(NO); + } + } + + if (s[1] == '\0') { /* 1 character suffix */ + switch (*s) { + case 'c': + case 'h': + case 'l': + case 'y': + case 'C': + case 'G': + case 'H': + case 'L': + looks_like_source = YES; + } + } else if ((s[2] == '\0') /* 2 char suffix */ + && ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */ + || (s[0] == 'q' + && (s[1] == 'c' || s[1] == 'h')) /* Ingres */ + || (s[0] == 's' && s[1] == 'd') /* SDL */ + || (s[0] == 'c' && s[1] == 'c') /* C++ source */ + || (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */ + looks_like_source = YES; + + } else if((s[3] == '\0') /* 3 char suffix */ + /* C++ template source */ + && ((s[0] == 't' && s[1] == 'c' && s[2] == 'c' ) + /* C++ source: */ + || (s[0] == 'c' && s[1] == 'p' && s[2] == 'p' ) + || (s[0] == 'c' && s[1] == 'x' && s[2] == 'x' )) + ) { + looks_like_source = YES; + } + + if (looks_like_source != YES) + return NO; + + /* make sure it is a file */ + if (lstat(path, &statstruct) == 0 && + S_ISREG(statstruct.st_mode)) { + return(YES); + } + return NO; +} + + +/* 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); +} + +/* search for the file in the view path */ + +char * +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); +} + +/* add a source file to the list */ + +void +addsrcfile(char *path) +{ + struct listitem *p; + int i; + + /* make sure there is room for the file */ + if (nsrcfiles == msrcfiles) { + msrcfiles += SRCINC; + srcfiles = myrealloc(srcfiles, msrcfiles * sizeof(char *)); + } + /* 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]; + srcnames[i] = p; +} + +/* free the memory allocated for the source file list */ + +void +freefilelist(void) +{ + struct listitem *p, *nextp; + int i; + + /* if '-d' option is used a string space block is allocated */ + if (isuptodate == NO) { + while (nsrcfiles > 0) { + free (srcfiles[--nsrcfiles]); + } + } else { + /* for '-d' option free the string space block */ + /* protect against empty list */ + if (nsrcfiles > 0) + free (srcfiles[0]); + nsrcfiles = 0; + } + + free (srcfiles); /* HBB 20000421: avoid leak */ + msrcfiles = 0; + srcfiles=0; + + for (i = 0; i < HASHMOD; ++i) { + for (p = srcnames[i]; p != NULL; p = nextp) { + /* HBB 20000421: avoid memory leak */ + free(p->text); + nextp = p->next; + free(p); + } + srcnames[i] = NULL; + } +} diff --git a/src/display.c b/src/display.c new file mode 100644 index 0000000..7ef03cb --- /dev/null +++ b/src/display.c @@ -0,0 +1,774 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * display functions + */ + +#include "global.h" +#include "build.h" +#include "alloc.h" + +#ifdef CCS +#include "sgs.h" /* ESG_PKG and ESG_REL */ +#else +#include "version.h" /* FILEVERSION and FIXVERSION */ +#endif + +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +#include <setjmp.h> /* jmp_buf */ +#include <stdarg.h> /* va_list stuff */ +#include <time.h> +#include <errno.h> +#include <stdarg.h> + +#ifndef HAVE_SIGSETJMP +# define sigsetjmp(a,b) setjmp(a) +# define siglongjmp(a,b) longjmp(a,b) +typedef jmp_buf sigjmp_buf; +#endif + +static char const rcsid[] = "$Id: display.c,v 1.29 2006/08/20 15:00:34 broeker Exp $"; + +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 */ + +const char dispchars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + +static int fldline; /* input field line */ +static sigjmp_buf env; /* setjmp/longjmp buffer */ +static int lastdispline; /* last displayed reference line */ +static char lastmsg[MSGLEN + 1]; /* last message displayed */ +static char helpstring[] = "Press the ? key for help"; +static char selprompt[] = + "Select lines to change (press the ? key for help): "; + +typedef char * (*FP)(char *); /* pointer to function returning a character pointer */ + +/* HBB 2000/05/05: I removed the casts to function pointer type. It is + * fundamentally unsafe to call a function through a pointer of a + * different type ('undefined behaviour' in the words of the ANSI/ISO + * C standard). Instead, I made all the find...() functions adhere to + * the same function type, by changing argument passing a bit. */ +static struct { /* text of input fields */ + char *text1; + char *text2; + FP findfcn; +} fields[FIELDS + 1] = { /* samuel has a search that is not part of the cscope display */ + {"Find this", "C symbol", findsymbol}, + {"Find this", "global definition", finddef}, + {"Find", "functions called by this function", findcalledby}, + {"Find", "functions calling this function", findcalling}, + {"Find this", "text string", findstring}, + {"Change this", "text string", findstring}, + {"Find this", "egrep pattern", findregexp}, + {"Find this", "file", findfile}, + {"Find", "files #including this file", findinclude}, + {"Find all", "function definitions", findallfcns}, /* samuel only */ +}; + +/* Internal prototypes: */ +static RETSIGTYPE jumpback(int sig); + +/* initialize display parameters */ + +void +dispinit(void) +{ + /* calculate the maximum displayed reference lines */ + lastdispline = FLDLINE - 3; + mdisprefs = lastdispline - REFLINE + 1; + + + if (mdisprefs <= 0) { + postfatal("%s: screen too small\n", argv0); + /* NOTREACHED */ + } + + if (mouse == NO && mdisprefs > strlen(dispchars)) + mdisprefs = strlen(dispchars); + + /* allocate the displayed line array */ + displine = mymalloc(mdisprefs * sizeof(int)); +} + +/* display a page of the references */ + +void +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, "%" PATHLEN_STR "s%" PATHLEN_STR "s%" NUMLEN_STR "s %" TEMPSTRING_LEN_STR "[^\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(); +} + +/* set the cursor position for the field */ +void +setfield(void) +{ + fldline = FLDLINE + field; + fldcolumn = strlen(fields[field].text1) + strlen(fields[field].text2) + 3; +} + +/* move to the current input field */ + +void +atfield(void) +{ + move(fldline, fldcolumn); +} + +/* move to the changing lines prompt */ + +void +atchange(void) +{ + move(PRLINE, (int) sizeof(selprompt) - 1); +} + +/* search for the symbol or text pattern */ + +/*ARGSUSED*/ +static RETSIGTYPE +jumpback(int sig) +{ + /* HBB NEW 20031008: try whether reinstating signal handler + * helps... */ + signal(sig, jumpback); + siglongjmp(env, 1); +} + +BOOL +search(void) +{ + char *findresult = NULL; /* find function output */ + BOOL funcexist = YES; /* find "function" error */ + FINDINIT rc = NOERROR; /* findinit return code */ + sighandler_t savesig; /* old value of signal */ + FP f; /* searching function */ + int c; + + /* open the references found file for writing */ + if (writerefsfound() == NO) { + return(NO); + } + /* find the pattern - stop on an interrupt */ + if (linemode == NO) { + postmsg("Searching"); + } + searchcount = 0; + savesig = signal(SIGINT, jumpback); + if (sigsetjmp(env, 1) == 0) { + f = fields[field].findfcn; + if (f == findregexp || f == findstring) { + findresult = (*f)(Pattern); + } else { + if ((nonglobalrefs = myfopen(temp2, "wb")) == NULL) { + cannotopen(temp2); + return(NO); + } + if ((rc = findinit(Pattern)) == NOERROR) { + (void) dbseek(0L); /* read the first block */ + findresult = (*f)(Pattern); + if (f == findcalledby) + funcexist = (*findresult == 'y'); + findcleanup(); + + /* append the non-global references */ + (void) fclose(nonglobalrefs); + if ((nonglobalrefs = myfopen(temp2, "rb")) + == NULL) { + cannotopen(temp2); + return(NO); + } + while ((c = getc(nonglobalrefs)) != EOF) { + (void) putc(c, refsfound); + } + } + (void) fclose(nonglobalrefs); + } + } + signal(SIGINT, savesig); + + /* rewind the cross-reference file */ + (void) lseek(symrefs, (long) 0, 0); + + /* reopen the references found file for reading */ + (void) fclose(refsfound); + if ((refsfound = myfopen(temp1, "rb")) == NULL) { + cannotopen(temp1); + return(NO); + } + nextline = 1; + totallines = 0; + disprefs = 0; + + /* see if it is empty */ + if ((c = getc(refsfound)) == EOF) { + if (findresult != NULL) { + (void) sprintf(lastmsg, "Egrep %s in this pattern: %s", + findresult, Pattern); + } else if (rc == NOTSYMBOL) { + (void) sprintf(lastmsg, "This is not a C symbol: %s", + Pattern); + } else if (rc == REGCMPERROR) { + (void) sprintf(lastmsg, "Error in this regcomp(3) regular expression: %s", + Pattern); + + } else if (funcexist == NO) { + (void) sprintf(lastmsg, "Function definition does not exist: %s", + Pattern); + } else { + (void) sprintf(lastmsg, "Could not find the %s: %s", + fields[field].text2, Pattern); + } + return(NO); + } + /* put back the character read */ + (void) ungetc(c, refsfound); + + /* HBB 20041027: this used to hold a copy of the code of + * countrefs(), but with the crucial display width adjustments + * missing. Just call the real thing instead! */ + countrefs(); + return(YES); +} + +/* display search progress with default custom format */ + +void +progress(char *what, long current, long max) +{ + static long start; + long now; + char msg[MSGLEN + 1]; + int i; + + /* save the start time */ + if (searchcount == 0) { + start = time(NULL); + } + if ((now = time(NULL)) - start >= 1) + { + if (linemode == NO) + { + move(MSGLINE, 0); + clrtoeol(); + addstr(what); + sprintf(msg, "%ld", current); + move(MSGLINE, (COLS / 2) - (strlen(msg) / 2)); + addstr(msg); + sprintf(msg, "%ld", max); + move(MSGLINE, COLS - strlen(msg)); + addstr(msg); + refresh(); + } + else if (verbosemode == YES) + { + sprintf(msg, "> %s %ld of %ld", what, current, max); + } + + start = now; + if ((linemode == NO) && (incurses == YES)) + { + move(MSGLINE, 0); + i = (float)COLS * (float)current / (float)max; + + standout(); + for (; i > 0; i--) + addch(inch()); + standend(); + refresh(); + } + else + if (linemode == NO || verbosemode == YES) + postmsg(msg); + } + ++searchcount; +} + +/* print error message on system call failure */ + +void +myperror(char *text) +{ + char msg[MSGLEN + 1]; /* message */ + char *s; + + s = "Unknown error"; +#ifdef HAVE_STRERROR + s = strerror(errno); +#else + if (errno < sys_nerr) { + s = sys_errlist[errno]; + } +#endif + (void) sprintf(msg, "%s: %s", text, s); + postmsg(msg); +} + +/* postmsg clears the message line and prints the message */ + +/* VARARGS */ +void +postmsg(char *msg) +{ + if (linemode == YES || incurses == NO) { + (void) printf("%s\n", msg); + fflush(stdout); + } + else { + clearmsg(); + addstr(msg); + refresh(); + } + (void) strncpy(lastmsg, msg, sizeof(lastmsg) - 1); +} + +/* clearmsg clears the first message line */ + +void +clearmsg(void) +{ + if (linemode == NO) { + move(MSGLINE, 0); + clrtoeol(); + } +} + +/* clearmsg2 clears the second message line */ + +void +clearmsg2(void) +{ + if (linemode == NO) { + move(MSGLINE + 1, 0); + clrtoeol(); + } +} + +/* postmsg2 clears the second message line and prints the message */ + +void +postmsg2(char *msg) +{ + if (linemode == YES) { + (void) printf("%s\n", msg); + } + else { + clearmsg2(); + addstr(msg); + refresh(); + } +} + +/* display an error mesg - stdout or on second msg line */ +void +posterr(char *msg, ...) +{ + va_list ap; + char errbuf[MSGLEN]; + + va_start(ap, msg); + if (linemode == YES || incurses == NO) + { + (void) vfprintf(stderr, msg, ap); + (void) fputc('\n', stderr); + } else { +#if HAVE_VSNPRINTF + vsnprintf(errbuf, sizeof(errbuf), msg, ap); +#else + vsprintf(errbuf, msg, ap); +#endif + postmsg2(errbuf); + } +} + +/* display a fatal error mesg -- stderr *after* shutting down curses */ +void +postfatal(const char *msg, ...) +{ + va_list ap; + char errbuf[MSGLEN]; + + va_start(ap, msg); +#if HAVE_VSNPRINTF + vsnprintf(errbuf, sizeof(errbuf), msg, ap); +#else + vsprintf(errbuf, msg, ap); +#endif + /* restore the terminal to its original mode */ + if (incurses == YES) { + exitcurses(); + } + + /* display fatal error messages */ + fprintf(stderr,"%s",errbuf); + + /* shut down */ + myexit(1); +} + +/* position references found file at specified line */ + +void +seekline(unsigned int line) +{ + int c; + + /* verify that there is a references found file */ + if (refsfound == NULL) { + return; + } + /* go to the beginning of the file */ + rewind(refsfound); + + /* find the requested line */ + nextline = 1; + while (nextline < line && (c = getc(refsfound)) != EOF) { + if (c == '\n') { + nextline++; + } + } +} + +/* get the OGS subsystem and book names */ + +void +ogsnames(char *file, char **subsystem, char **book) +{ + static char buf[PATHLEN + 1]; + char *s, *slash; + + *subsystem = *book = ""; + (void) strcpy(buf,file); + s = buf; + if (*s == '/') { + ++s; + } + while ((slash = strchr(s, '/')) != NULL) { + *slash = '\0'; + if ((int)strlen(s) >= 3 && strncmp(slash - 3, ".ss", 3) == 0) { + *subsystem = s; + s = slash + 1; + if ((slash = strchr(s, '/')) != NULL) { + *book = s; + *slash = '\0'; + } + break; + } + s = slash + 1; + } +} + +/* get the requested path components */ + +char * +pathcomponents(char *path, int components) +{ + int i; + char *s; + + s = path + strlen(path) - 1; + for (i = 0; i < components; ++i) { + while (s > path && *--s != '/') { + ; + } + } + if (s > path && *s == '/') { + ++s; + } + return(s); +} + +/* open the references found file for writing */ + +BOOL +writerefsfound(void) +{ + if (refsfound == NULL) { + if ((refsfound = myfopen(temp1, "wb")) == NULL) { + cannotopen(temp1); + return(NO); + } + } else { + (void) fclose(refsfound); + if ( (refsfound = myfopen(temp1, "wb")) == NULL) { + postmsg("Cannot reopen temporary file"); + return(NO); + } + } + return(YES); +} diff --git a/src/edit.c b/src/edit.c new file mode 100644 index 0000000..5d97949 --- /dev/null +++ b/src/edit.c @@ -0,0 +1,139 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * file editing functions + */ + +#include "global.h" +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif + +static char const rcsid[] = "$Id: edit.c,v 1.6 2006/08/20 15:00:34 broeker Exp $"; + +/* edit this displayed reference */ + +void +editref(int i) +{ + char file[PATHLEN + 1]; /* file name */ + char linenum[NUMLEN + 1]; /* line number */ + + /* verify that there is a references found file */ + if (refsfound == NULL) { + return; + } + /* get the selected line */ + seekline(i + topline); + + /* 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 */ + } + seekline(topline); /* restore the line pointer */ +} + +/* edit all references */ + +void +editall(void) +{ + char file[PATHLEN + 1]; /* file name */ + char linenum[NUMLEN + 1]; /* line number */ + int c; + + /* verify that there is a references found file */ + if (refsfound == NULL) { + return; + } + /* get the first line */ + seekline(1); + + /* 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) { + addstr("Type ^D to stop editing all lines, or any other character to continue: "); + if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) { + break; + } + } + } + seekline(topline); +} + +/* call the editor */ + +void +edit(char *file, char *linenum) +{ + char msg[MSGLEN + 1]; /* message */ + char plusnum[NUMLEN + 20]; /* line number option: allow space for wordy line# flag */ + char *s; + + file = filepath(file); + (void) sprintf(msg, "%s +%s %s", mybasename(editor), linenum, file); + postmsg(msg); + (void) sprintf(plusnum, lineflag, linenum); + /* if this is the more or page commands */ + if (strcmp(s = mybasename(editor), "more") == 0 || strcmp(s, "page") == 0) { + + /* get it to pause after displaying a file smaller than the screen + length */ + (void) execute(editor, editor, plusnum, file, "/dev/null", NULL); + } + else if (lineflagafterfile) { + (void) execute(editor, editor, file, plusnum, NULL); + } + else { + (void) execute(editor, editor, plusnum, file, NULL); + } + clear(); /* redisplay screen */ +} + +/* if requested, prepend a path to a relative file name */ + +char * +filepath(char *file) +{ + static char path[PATHLEN + 1]; + + if (prependpath != NULL && *file != '/') { + (void) sprintf(path, "%s/%s", prependpath, file); + file = path; + } + return(file); +} diff --git a/src/egrep.y b/src/egrep.y new file mode 100644 index 0000000..a930803 --- /dev/null +++ b/src/egrep.y @@ -0,0 +1,679 @@ +%{ +/*=========================================================================== + 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: egrep.y,v 1.11 2006/04/21 10:45:48 broeker Exp $ */ + +/* + * egrep -- fine lines containing a regular expression + */ +%} + +%token CHAR DOT CCL NCCL OR CAT STAR PLUS QUEST +%left OR +%left CHAR DOT CCL NCCL '(' +%left CAT +%left STAR PLUS QUEST + +%{ +#include "global.h" +#include <ctype.h> +#include <stdio.h> + +#include <setjmp.h> /* jmp_buf */ + +#define nextch() (*input++) + +#define MAXLIN 350 +#define MAXPOS 4000 +#define NCHARS 256 +#define NSTATES 128 +#define FINAL -1 +static char gotofn[NSTATES][NCHARS]; +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]; +static char chars[MAXLIN]; +static int nxtpos; +static int nxtchar; +static int tmpstat[MAXLIN]; +static int initstat[MAXLIN]; +static int xstate; +static int count; +static int icount; +static char *input; +static long lnum; +static int iflag; +static jmp_buf env; /* setjmp/longjmp buffer */ +static char *message; /* error message */ + +/* Internal prototypes: */ +static void cfoll(int v); +static void cgotofn(void); +static int cstate(int v); +static int member(int symb, int set, int torf); +static int notin(int n); +static void synerror(void); +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); +static int yyerror(char *); +%} + +%% +s: t + { unary(FINAL, $1); + line--; + } + ; +t: b r + { $$ = node(CAT, $1, $2); } + | OR b r OR + { $$ = node(CAT, $2, $3); } + | OR b r + { $$ = node(CAT, $2, $3); } + | b r OR + { $$ = node(CAT, $1, $2); } + ; +b: + { $$ = enter(DOT); + $$ = unary(STAR, $$); } + ; +r: CHAR + { $$ = enter($1); } + | DOT + { $$ = enter(DOT); } + | CCL + { $$ = cclenter(CCL); } + | NCCL + { $$ = cclenter(NCCL); } + ; + +r: r OR r + { $$ = node(OR, $1, $3); } + | r r %prec CAT + { $$ = node(CAT, $1, $2); } + | r STAR + { $$ = unary(STAR, $1); } + | r PLUS + { $$ = unary(PLUS, $1); } + | r QUEST + { $$ = unary(QUEST, $1); } + | '(' r ')' + { $$ = $2; } + | error + ; + +%% +static int +yyerror(char *s) +{ + message = s; + longjmp(env, 1); + return 1; /* silence a warning */ +} + +static int +yylex(void) +{ + int cclcnt, x; + char c, d; + + switch(c = nextch()) { + case '|': + return (OR); + case '*': + return (STAR); + case '+': + return (PLUS); + case '?': + return (QUEST); + case '(': + return (c); + case ')': + return (c); + case '.': + return (DOT); + case '\0': + return (0); + case '\n': + return (OR); + case '[': + x = CCL; + cclcnt = 0; + count = nxtchar++; + if ((c = nextch()) == '^') { + x = NCCL; + c = nextch(); + } + do { + if (c == '\0') + synerror(); + if (c == '-' + && cclcnt > 0 + && chars[nxtchar-1] != 0) { + if ((d = nextch()) != 0) { + c = chars[nxtchar-1]; + while ((unsigned int)c < (unsigned int)d) { + if (nxtchar >= MAXLIN) + overflo(); + chars[nxtchar++] = ++c; + cclcnt++; + } + continue; + } /* if() */ + } /* if() */ + if (nxtchar >= MAXLIN) + overflo(); + chars[nxtchar++] = c; + cclcnt++; + } while ((c = nextch()) != ']'); + chars[count] = cclcnt; + return (x); + case '\\': + if ((c = nextch()) == '\0') + synerror(); + /* not reached */ + case '$': + case '^': + c = '\n'; + /* fall through */ + default: + yylval = c; + return (CHAR); + } +} + +static void +synerror(void) +{ + yyerror("Syntax error"); +} + +static unsigned int +enter(int x) +{ + if(line >= MAXLIN) + overflo(); + name[line] = x; + left[line] = 0; + right[line] = 0; + return(line++); +} + +static unsigned int +cclenter(int x) +{ + unsigned int linno; + + linno = enter(x); + right[linno] = count; + return (linno); +} + +static int +node(int x, int l, int r) +{ + if(line >= MAXLIN) + overflo(); + name[line] = x; + left[line] = l; + right[line] = r; + parent[l] = line; + parent[r] = line; + return(line++); +} + +static int +unary(int x, int d) +{ + if(line >= MAXLIN) + overflo(); + name[line] = x; + left[line] = d; + right[line] = 0; + parent[d] = line; + return(line++); +} + +static void +overflo(void) +{ + yyerror("internal table overflow"); +} + +static void +cfoll(int v) +{ + unsigned int i; + + if (left[v] == 0) { + count = 0; + for (i = 1; i <= line; i++) + tmpstat[i] = 0; + follow(v); + add(foll, v); + } else if (right[v] == 0) + cfoll(left[v]); + else { + cfoll(left[v]); + cfoll(right[v]); + } +} + +static void +cgotofn(void) +{ + unsigned int i, n, s; + int c, k; + char symbol[NCHARS]; + unsigned int j, l, pc, pos; + unsigned int nc; + int curpos; + unsigned int num, number, newpos; + + count = 0; + for (n=3; n<=line; n++) + tmpstat[n] = 0; + if (cstate(line-1)==0) { + tmpstat[line] = 1; + count++; + out[0] = 1; + } + for (n=3; n<=line; n++) + initstat[n] = tmpstat[n]; + count--; /*leave out position 1 */ + icount = count; + tmpstat[1] = 0; + add(state, 0); + n = 0; + for (s = 0; s <= n; s++) { + if (out[s] == 1) + continue; + for (i = 0; i < NCHARS; i++) + symbol[i] = 0; + num = positions[state[s]]; + count = icount; + for (i = 3; i <= line; i++) + tmpstat[i] = initstat[i]; + pos = state[s] + 1; + for (i = 0; i < num; i++) { + curpos = positions[pos]; + if ((c = name[curpos]) >= 0) { + if (c < NCHARS) { + symbol[c] = 1; + } else if (c == DOT) { + for (k = 0; k < NCHARS; k++) + if (k != '\n') + symbol[k] = 1; + } else if (c == CCL) { + nc = chars[right[curpos]]; + pc = right[curpos] + 1; + for (j = 0; j < nc; j++) + symbol[(unsigned char)(chars[pc++])] = 1; + } else if (c == NCCL) { + nc = chars[right[curpos]]; + for (j = 0; j < NCHARS; j++) { + pc = right[curpos] + 1; + for (l = 0; l < nc; l++) + if (j==(unsigned char)(chars[pc++])) + goto cont; + if (j != '\n') + symbol[j] = 1; + cont: + ; + } + } + } + pos++; + } /* for (i) */ + for (c=0; c<NCHARS; c++) { + if (symbol[c] == 1) { + /* nextstate(s,c) */ + count = icount; + for (i=3; i <= line; i++) + tmpstat[i] = initstat[i]; + pos = state[s] + 1; + for (i=0; i<num; i++) { + curpos = positions[pos]; + if ((k = name[curpos]) >= 0) + if ((k == c) + || (k == DOT) + || (k == CCL && member(c, right[curpos], 1)) + || (k == NCCL && member(c, right[curpos], 0)) + ) { + number = positions[foll[curpos]]; + newpos = foll[curpos] + 1; + for (j = 0; j < number; j++) { + if (tmpstat[positions[newpos]] != 1) { + tmpstat[positions[newpos]] = 1; + count++; + } + newpos++; + } + } + pos++; + } /* end nextstate */ + if (notin(n)) { + if (n >= NSTATES) + overflo(); + add(state, ++n); + if (tmpstat[line] == 1) + out[n] = 1; + gotofn[s][c] = n; + } else { + gotofn[s][c] = xstate; + } + } /* if (symbol) */ + } /* for(c) */ + } /* for(s) */ +} + +static int +cstate(int v) +{ + int b; + if (left[v] == 0) { + if (tmpstat[v] != 1) { + tmpstat[v] = 1; + count++; + } + return(1); + } + else if (right[v] == 0) { + if (cstate(left[v]) == 0) return (0); + else if (name[v] == PLUS) return (1); + else return (0); + } + else if (name[v] == CAT) { + if (cstate(left[v]) == 0 && cstate(right[v]) == 0) return (0); + else return (1); + } + else { /* name[v] == OR */ + b = cstate(right[v]); + if (cstate(left[v]) == 0 || b == 0) return (0); + else return (1); + } +} + +static int +member(int symb, int set, int torf) +{ + unsigned int i, num, pos; + + num = chars[set]; + pos = set + 1; + for (i = 0; i < num; i++) + if (symb == (unsigned char)(chars[pos++])) + return (torf); + return (!torf); +} + +static int +notin(int n) +{ + int i, j, pos; + for (i=0; i<=n; i++) { + if (positions[state[i]] == count) { + pos = state[i] + 1; + for (j=0; j < count; j++) + if (tmpstat[positions[pos++]] != 1) goto nxt; + xstate = i; + return (0); + } + nxt: ; + } + return (1); +} + +static void +add(int *array, int n) +{ + unsigned int i; + + if (nxtpos + count > MAXPOS) + overflo(); + array[n] = nxtpos; + positions[nxtpos++] = count; + for (i=3; i <= line; i++) { + if (tmpstat[i] == 1) { + positions[nxtpos++] = i; + } + } +} + +static void +follow(unsigned int v) +{ + unsigned int p; + + if (v == line) + return; + p = parent[v]; + switch(name[p]) { + case STAR: + case PLUS: cstate(v); + follow(p); + return; + + case OR: + case QUEST: follow(p); + return; + + case CAT: + if (v == left[p]) { + if (cstate(right[p]) == 0) { + follow(p); + return; + } + } else + follow(p); + return; + case FINAL: + if (tmpstat[line] != 1) { + tmpstat[line] = 1; + count++; + } + return; + } +} + +char * +egrepinit(char *egreppat) +{ + /* initialize the global data */ + memset(gotofn, 0, sizeof(gotofn)); + memset(state, 0, sizeof(state)); + memset(out, 0, sizeof(out)); + line = 1; + memset(name, 0, sizeof(name)); + memset(left, 0, sizeof(left)); + memset(right, 0, sizeof(right)); + memset(parent, 0, sizeof(parent)); + memset(foll, 0, sizeof(foll)); + memset(positions, 0, sizeof(positions)); + memset(chars, 0, sizeof(chars)); + nxtpos = 0; + nxtchar = 0; + memset(tmpstat, 0, sizeof(tmpstat)); + memset(initstat, 0, sizeof(initstat)); + xstate = 0; + count = 0; + icount = 0; + input = egreppat; + message = NULL; + if (setjmp(env) == 0) { + yyparse(); + cfoll(line-1); + cgotofn(); + } + return(message); +} + +int +egrep(char *file, FILE *output, char *format) +{ + char *p; + unsigned int cstat; + int ccount; + char buf[2*BUFSIZ]; + char *nlp; + unsigned int istat; + int in_line; + FILE *fptr; + + if ((fptr = myfopen(file, "r")) == NULL) + return(-1); + + ccount = 0; + lnum = 1; + in_line = 0; + p = buf; + nlp = p; + if ((ccount = fread(p, sizeof(char), BUFSIZ, fptr)) <= 0) + goto done; + in_line = 1; + istat = cstat = (unsigned int) gotofn[0]['\n']; + if (out[cstat]) + goto found; + for (;;) { + if (!iflag) + cstat = (unsigned int) gotofn[cstat][(unsigned int)*p&0377]; + /* all input chars made positive */ + else + cstat = (unsigned int) gotofn[cstat][tolower((int)*p&0377)]; + /* for -i option*/ + if (out[cstat]) { + found: + for(;;) { + if (*p++ == '\n') { + in_line = 0; + succeed: + fprintf(output, format, file, lnum); + if (p <= nlp) { + while (nlp < &buf[2*BUFSIZ]) + putc(*nlp++, output); + nlp = buf; + } + while (nlp < p) + putc(*nlp++, output); + lnum++; + nlp = p; + if ((out[(cstat=istat)]) == 0) + goto brk2; + } /* if (p++ == \n) */ + cfound: + if (--ccount <= 0) { + if (p <= &buf[BUFSIZ]) { + ccount = fread(p, sizeof(char), BUFSIZ, fptr); + } else if (p == &buf[2*BUFSIZ]) { + p = buf; + ccount = fread(p, sizeof(char), BUFSIZ, fptr); + } else { + ccount = fread(p, sizeof(char), &buf[2*BUFSIZ] - p, + fptr); + } + if (ccount <= 0) { + if (in_line) { + in_line = 0; + goto succeed; + } + goto done; + } + } /* if(ccount <= 0) */ + in_line = 1; + } /* for(ever) */ + } /* if(out[cstat]) */ + + if (*p++ == '\n') { + in_line = 0; + lnum++; + nlp = p; + if (out[(cstat=istat)]) + goto cfound; + } + brk2: + if (--ccount <= 0) { + if (p <= &buf[BUFSIZ]) { + ccount = fread(p, sizeof(char), BUFSIZ, fptr); + } else if (p == &buf[2*BUFSIZ]) { + p = buf; + ccount = fread(p, sizeof(char), BUFSIZ, fptr); + } else { + ccount = fread(p, sizeof(char), &buf[2*BUFSIZ] - p, fptr); + } + if (ccount <= 0) + break; + } + in_line = 1; + } +done: + fclose(fptr); + return(0); +} + +/* FIXME HBB: should export this to a separate file and use + * AC_REPLACE_FUNCS() */ +#if !STDC_HEADERS && !defined(HAVE_MEMSET) && !defined(HAVE_MEMORY_H) +/*LINTLIBRARY*/ +/* + * Set an array of n chars starting at sp to the character c. + * Return sp. + */ +char * +memset(char *sp, char c, int n) +{ + char *sp0 = sp; + + while (--n >= 0) + *sp++ = c; + return (sp0); +} +#endif + +void +egrepcaseless(int i) +{ + iflag = i; /* simulate "egrep -i" */ +} diff --git a/src/emacs.e b/src/emacs.e new file mode 100644 index 0000000..9eff1ce --- /dev/null +++ b/src/emacs.e @@ -0,0 +1,102 @@ +/ ========================================================================= / +/ 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: emacs.e,v 1.1 2000/04/27 16:33:47 petr Exp $ / + + +/ emacs menu for cscope / +((X) cscope (find current word [MACRO]) + (extern symbol-character) + + / if this character is not part of a symbol / + (cond ((not symbol-character) + + / if the previous character is not part of a symbol, go to + the next word / + back + (cond ((not symbol-character) forward-word back-word)) + )) + / get the current symbol (leave cursor at beginning of symbol) / + (while symbol-character forward) / go past last symbol character / + mark / mark this point / + back / back to last symbol character / + (while (cond (symbol-character (return back)))) / back fails at BOF / + (cond ((not symbol-character) forward)) / forward if not at BOF / + pickup-region / get the symbol / + (local-string symbol) + symbol= + + / if arg > 0 then display the menu / + (cond ((> arg 0) (display-menu + (format symbol "5 Find functions calling %l()") + (format symbol "4 Find functions called by %l()") + (format symbol "3 Find global definition of %l") + (format symbol "2 Find symbol %l") + "1 Call cscope" + 5) + )) + / get the selection / + (local selection) + (selection= (read-character "Selection?")) + + / if the selection is in range / + (cond ((&& (>= selection '1') (<= selection '5')) + + / if the selection requests finding the symbol / + (local-string findsymbol) + (findsymbol= "") + (cond ((>= selection '2') + (findsymbol= (format (char-to-string (- selection 2)) symbol "-%l '%l'")))) + + / if arg > 1 or < 0 then don't update the cross-reference database / + (local-string doption) + (doption= "") + (cond ((|| (> arg 1) (< arg 0)) (doption= "-d"))) + + / call cscope with usilent mode off / + (local oldmode) / save old usilent mode / + (oldmode= (set-mode "usilent" 0)) / turn off usilent mode / + (run-command (format doption findsymbol "cscope %l %l")) + (set-mode "usilent" oldmode) / restore usilent mode / + )) +) +/ see if the current character is part of a symbol / +(symbol-character () + (local c) + (c= current-character) + (return (cond ((&& (>= c 'a') (<= c 'z'))) + ((&& (>= c 'A') (<= c 'Z'))) + ((&& (>= c '0') (<= c '9'))) + ((== c '_')) + ) + ) +) diff --git a/src/exec.c b/src/exec.c new file mode 100644 index 0000000..7e4899d --- /dev/null +++ b/src/exec.c @@ -0,0 +1,190 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * process execution functions + */ + +#include <unistd.h> +#include "global.h" +#include <stdarg.h> +#include <sys/wait.h> +#include <sys/types.h> /* pid_t */ +#ifdef __DJGPP__ +#include <process.h> +#endif +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif + +static char const rcsid[] = "$Id: exec.c,v 1.10 2006/04/21 10:45:48 broeker Exp $"; + +static sighandler_t oldsigquit; /* old value of quit signal */ +static sighandler_t oldsighup; /* old value of hangup signal */ +static sighandler_t oldsigtstp; /* old value of SIGTSTP */ + +#ifndef __MSDOS__ /* none of these is needed, there */ +static int join(pid_t p); +static int myexecvp(char *a, char **args); +static pid_t myfork(void); +#endif + +/* execute forks and executes a program or shell script, waits for it to + * finish, and returns its exit code. + */ + +/*VARARGS1*/ +int +execute(char *a, ...) /* note: "exec" is already defined on u370 */ +{ + va_list ap; + int exitcode = -1; /* initialize, to avoid warning */ + char *argv[BUFSIZ]; + pid_t p; + + /* fork and exec the program or shell script */ + endwin(); /* restore the terminal modes */ + mousecleanup(); + fflush(stdout); + va_start(ap, a); + for (p = 0; (argv[p] = va_arg(ap, char *)) != 0; p++) + ; +#ifdef __MSDOS__ + /* HBB 20010313: in MSDOG, everything is completely different. + * No fork()/exec()/wait(), but rather a single libc call: */ + exitcode = spawnvp(P_WAIT, a, argv); +#else + if ((p = myfork()) == 0) { + myexecvp(a, argv); /* child */ + } + else { + exitcode = join(p); /* parent */ + } +#endif /* MSDOS */ + + /* the menu and scrollbar may be changed by the command executed */ +#if UNIXPC || !TERMINFO +# ifndef __DJGPP__ /* leave CRLF handling as is */ + nonl(); +# endif + cbreak(); /* endwin() turns off cbreak mode so restore it */ + noecho(); +#endif + mousemenu(); + drawscrollbar(topline, nextline); + va_end(ap); + return(exitcode); +} + +#ifndef __MSDOS__ /* None of the following functions is used there */ + +/* myexecvp is an interface to the execvp system call to + * modify argv[0] to reference the last component of its path-name. + */ +static int +myexecvp(char *a, char **args) +{ + char msg[MSGLEN + 1]; + + /* modify argv[0] to reference the last component of its path name */ + args[0] = mybasename(args[0]); + + /* execute the program or shell script */ + execvp(a, args); /* returns only on failure */ + sprintf(msg, "\nCannot exec %s", a); + perror(msg); /* display the reason */ + askforreturn(); /* wait until the user sees the message */ + myexit(1); /* exit the child */ + /* NOTREACHED */ +} + +/* myfork acts like fork but also handles signals */ + +static pid_t +myfork(void) +{ + pid_t p; /* process number */ + + p = fork(); + + /* the parent ignores the interrupt, quit, and hangup signals */ + if (p > 0) { + oldsigquit = signal(SIGQUIT, SIG_IGN); + oldsighup = signal(SIGHUP, SIG_IGN); +#ifdef SIGTSTP + oldsigtstp = signal(SIGTSTP, SIG_DFL); +#endif + } + /* so they can be used to stop the child */ + else if (p == 0) { + signal(SIGINT, SIG_DFL); + signal(SIGQUIT, SIG_DFL); + signal(SIGHUP, SIG_DFL); +#ifdef SIGTSTP + signal(SIGTSTP, SIG_DFL); +#endif + } + /* check for fork failure */ + if (p == -1) { + myperror("Cannot fork"); + } + return p; +} + +/* join is the compliment of fork */ + +static int +join(pid_t p) +{ + int status; + pid_t w; + + /* wait for the correct child to exit */ + do { + w = wait(&status); + } while (p != -1 && w != p); + + /* restore signal handling */ + signal(SIGQUIT, oldsigquit); + signal(SIGHUP, oldsighup); +#ifdef SIGTSTP + signal(SIGTSTP, oldsigtstp); +#endif + + /* return the child's exit code */ + return(status >> 8); +} + +#endif /* !MSDOS */ diff --git a/src/find.c b/src/find.c new file mode 100644 index 0000000..f6a6387 --- /dev/null +++ b/src/find.c @@ -0,0 +1,1219 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol or text cross-reference + * + * searching functions + */ + +#include "global.h" + +#include "build.h" +#include "scanner.h" /* for token definitions */ + +#include <assert.h> +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +#include <regex.h> + +static char const rcsid[] = "$Id: find.c,v 1.20 2006/08/20 19:15:54 broeker Exp $"; + +/* most of these functions have been optimized so their innermost loops have + * only one test for the desired character by putting the char and + * an end-of-block marker (\0) at the end of the disk block buffer. + * When the inner loop exits on the char, an outer loop will see if + * the char is followed by a \0. If so, it will read the next block + * and restart the inner loop. + */ + +char *blockp; /* pointer to current char in block */ +char block[BUFSIZ + 2]; /* leave room for end-of-block mark */ +int blocklen; /* length of disk block read */ +char blockmark; /* mark character to be searched for */ +long blocknumber; /* block number */ + +static char global[] = "<global>"; /* dummy global function name */ +static char cpattern[PATLEN + 1]; /* compressed pattern */ +static long lastfcnoffset; /* last function name offset */ +static POSTING *postingp; /* retrieved posting set pointer */ +static long postingsfound; /* retrieved number of postings */ +static regex_t regexp; /* regular expression */ +static BOOL isregexp_valid = NO; /* regular expression status */ + +static BOOL match(void); +static BOOL matchrest(void); +static POSTING *getposting(void); +static char *lcasify(char *s); +static void findcalledbysub(char *file, BOOL macro); +static void findterm(char *pattern); +static void putline(FILE *output); +static void putpostingref(POSTING *p, char *pat); +static void putref(int seemore, char *file, char *func); +static void putsource(int seemore, FILE *output); + +/* find the symbol in the cross-reference */ + +char * +findsymbol(char *pattern) +{ + char file[PATHLEN + 1]; /* source file name */ + char function[PATLEN + 1]; /* function name */ + char macro[PATLEN + 1]; /* macro name */ + char symbol[PATLEN + 1]; /* symbol name */ + char *cp; + char *s; + size_t s_len = 0; + char firstchar; /* first character of a potential symbol */ + BOOL fcndef = NO; + + if (invertedindex == YES) { + long lastline = 0; + POSTING *p; + + findterm(pattern); + while ((p = getposting()) != NULL) { + if (p->type != INCLUDE && p->lineoffset != lastline) { + putpostingref(p, 0); + lastline = p->lineoffset; + } + } + return NULL; + } + + (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 */ + /* note: this code was expanded in-line for speed */ + /* other macros were replaced by code using cp instead of blockp */ + cp = blockp; + for (;;) { + setmark('\n'); + do { /* innermost loop optimized to only one test */ + while (*cp != '\n') { + ++cp; + } + } while (*(cp + 1) == '\0' && (cp = read_block()) != NULL); + + /* skip the found character */ + if (cp != NULL && *(++cp + 1) == '\0') { + cp = read_block(); + } + if (cp == NULL) { + break; + } + /* look for a source file, function, or macro name */ + if (*cp == '\t') { + blockp = cp; + switch (getrefchar()) { + + case NEWFILE: /* file name */ + + /* save the name */ + skiprefchar(); + fetch_string_from_dbase(file, sizeof(file)); + + /* check for the end of the symbols */ + if (*file == '\0') { + return NULL; + } + progress("Search", searchcount, nsrcfiles); + /* FALLTHROUGH */ + + case FCNEND: /* function end */ + (void) strcpy(function, global); + goto notmatched; /* don't match name */ + + case FCNDEF: /* function name */ + fcndef = YES; + s = function; + s_len = sizeof(function); + break; + + case DEFINE: /* macro name */ + if (fileversion >= 10) { + s = macro; + s_len = sizeof(macro); + } else { + s = symbol; + s_len = sizeof(symbol); + } + break; + + case DEFINEEND: /* macro end */ + (void) strcpy(macro, global); + goto notmatched; + + case INCLUDE: /* #include file */ + goto notmatched; /* don't match name */ + + default: /* other symbol */ + s = symbol; + s_len = sizeof(symbol); + } + /* save the name */ + skiprefchar(); + fetch_string_from_dbase(s, s_len); + + /* see if this is a regular expression pattern */ + if (isregexp_valid == YES) { + if (caseless == YES) { + s = lcasify(s); + } + if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { + goto matched; + } + } + /* match the symbol to the text pattern */ + else if (strequal(pattern, s)) { + goto matched; + } + goto notmatched; + } + /* if this is a regular expression pattern */ + if (isregexp_valid == YES) { + + /* if this is a symbol */ + + /************************************************** + * The first character may be a digraph'ed char, so + * unpack it into firstchar, and then test that. + * + * Assume that all digraphed chars have the 8th bit + * set (0200). + **************************************************/ + if (*cp & 0200) { /* digraph char? */ + firstchar = dichar1[(*cp & 0177) / 8]; + } + else { + firstchar = *cp; + } + + 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 */ + } + else { + s = symbol; + } + + /* match the symbol to the regular expression */ + if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) { + goto matched; + } + goto notmatched; + } + } + /* match the character to the text pattern */ + else if (*cp == cpattern[0]) { + blockp = cp; + + /* match the rest of the symbol to the text pattern */ + if (matchrest()) { + s = NULL; + matched: + /* output the file, function or macro, and source line */ + if (strcmp(macro, global) && s != macro) { + putref(0, file, macro); + } + else if (fcndef == YES || s != function) { + fcndef = NO; + putref(0, file, function); + } + else { + putref(0, file, global); + } + if (blockp == NULL) { + return NULL; + } + } + notmatched: + cp = blockp; + } + } + blockp = cp; + + return NULL; +} +/* find the function definition or #define */ + +char * +finddef(char *pattern) +{ + char file[PATHLEN + 1]; /* source file name */ + + if (invertedindex == YES) { + POSTING *p; + + findterm(pattern); + while ((p = getposting()) != NULL) { + switch (p->type) { + case DEFINE:/* could be a macro */ + case FCNDEF: + case CLASSDEF: + case ENUMDEF: + case MEMBERDEF: + case STRUCTDEF: + case TYPEDEF: + case UNIONDEF: + case GLOBALDEF:/* other global definition */ + putpostingref(p, pattern); + } + } + return NULL; + } + + + /* find the next file name or definition */ + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case NEWFILE: + skiprefchar(); /* save file name */ + fetch_string_from_dbase(file, sizeof(file)); + if (*file == '\0') { /* if end of symbols */ + return NULL; + } + progress("Search", searchcount, nsrcfiles); + break; + + case DEFINE: /* could be a macro */ + case FCNDEF: + case CLASSDEF: + case ENUMDEF: + case MEMBERDEF: + case STRUCTDEF: + case TYPEDEF: + case UNIONDEF: + case GLOBALDEF: /* other global definition */ + skiprefchar(); /* match name to pattern */ + if (match()) { + + /* output the file, function and source line */ + putref(0, file, pattern); + } + break; + } + } + + return NULL; +} +/* find all function definitions (used by samuel only) */ + +char * +findallfcns(char *dummy) +{ + char file[PATHLEN + 1]; /* source file name */ + char function[PATLEN + 1]; /* function name */ + + (void) dummy; /* unused argument */ + + /* find the next file name or definition */ + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case NEWFILE: + skiprefchar(); /* save file name */ + fetch_string_from_dbase(file, sizeof(file)); + if (*file == '\0') { /* if end of symbols */ + return NULL; + } + progress("Search", searchcount, nsrcfiles); + /* FALLTHROUGH */ + + case FCNEND: /* function end */ + (void) strcpy(function, global); + break; + + case FCNDEF: + case CLASSDEF: + skiprefchar(); /* save function name */ + fetch_string_from_dbase(function, sizeof(function)); + + /* output the file, function and source line */ + putref(0, file, function); + break; + } + } + return NULL; +} + +/* find the functions calling this function */ + +char * +findcalling(char *pattern) +{ + char file[PATHLEN + 1]; /* source file name */ + char function[PATLEN + 1]; /* function name */ + char tmpfunc[10][PATLEN + 1];/* 10 temporary function names */ + char macro[PATLEN + 1]; /* macro name */ + char *tmpblockp; + int morefuns, i; + + if (invertedindex == YES) { + POSTING *p; + + findterm(pattern); + while ((p = getposting()) != NULL) { + if (p->type == FCNCALL) { + putpostingref(p, 0); + } + } + return NULL; + } + /* find the next file name or function definition */ + *macro = '\0'; /* a macro can be inside a function, but not vice versa */ + tmpblockp = 0; + morefuns = 0; /* one function definition is normal case */ + for (i = 0; i < 10; i++) *(tmpfunc[i]) = '\0'; + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case NEWFILE: /* save file name */ + skiprefchar(); + fetch_string_from_dbase(file, sizeof(file)); + if (*file == '\0') { /* if end of symbols */ + return NULL; + } + progress("Search", searchcount, nsrcfiles); + (void) strcpy(function, global); + break; + + case DEFINE: /* could be a macro */ + if (fileversion >= 10) { + skiprefchar(); + fetch_string_from_dbase(macro, sizeof(macro)); + } + break; + + case DEFINEEND: + *macro = '\0'; + break; + + 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) ) + break; + if (i == morefuns) { + (void) strcpy(tmpfunc[morefuns], function); + if (++morefuns >= 10) morefuns = 9; + } + break; + + case FCNEND: + for (i = 0; i < morefuns; i++) + *(tmpfunc[i]) = '\0'; + morefuns = 0; + break; + + case FCNCALL: /* match function called to pattern */ + skiprefchar(); + if (match()) { + + /* output the file, calling function or macro, and source */ + if (*macro != '\0') { + putref(1, file, macro); + } + else { + tmpblockp = blockp; + for (i = 0; i < morefuns; i++) { + blockp = tmpblockp; + putref(1, file, tmpfunc[i]); + } + } + } + } + } + morefuns = 0; + + return NULL; +} + +/* find the text in the source files */ + +char * +findstring(char *pattern) +{ + char egreppat[2 * PATLEN]; + char *cp, *pp; + + /* translate special characters in the regular expression */ + cp = egreppat; + for (pp = pattern; *pp != '\0'; ++pp) { + if (strchr(".*[\\^$+?|()", *pp) != NULL) { + *cp++ = '\\'; + } + *cp++ = *pp; + } + *cp = '\0'; + + /* search the source files */ + return(findregexp(egreppat)); +} + +/* find this regular expression in the source files */ + +char * +findregexp(char *egreppat) +{ + unsigned int i; + char *egreperror; + + /* compile the pattern */ + if ((egreperror = egrepinit(egreppat)) == NULL) { + + /* search the files */ + for (i = 0; i < nsrcfiles; ++i) { + char *file = filepath(srcfiles[i]); + + progress("Search", searchcount, nsrcfiles); + if (egrep(file, refsfound, "%s <unknown> %ld ") < 0) { + posterr ("Cannot open file %s", file); + } + } + } + return(egreperror); +} + +/* find matching file names */ + +char * +findfile(char *dummy) +{ + unsigned int i; + + (void) dummy; /* unused argument */ + + for (i = 0; i < nsrcfiles; ++i) { + char *s; + + if (caseless == YES) { + s = lcasify(srcfiles[i]); + } else { + s = srcfiles[i]; + } + if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { + (void) fprintf(refsfound, "%s <unknown> 1 <unknown>\n", + srcfiles[i]); + } + } + + return NULL; +} + +/* find files #including this file */ + +char * +findinclude(char *pattern) +{ + char file[PATHLEN + 1]; /* source file name */ + + if (invertedindex == YES) { + POSTING *p; + + findterm(pattern); + while ((p = getposting()) != NULL) { + if (p->type == INCLUDE) { + putpostingref(p, 0); + } + } + return NULL; + } + + /* find the next file name or function definition */ + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case NEWFILE: /* save file name */ + skiprefchar(); + fetch_string_from_dbase(file, sizeof(file)); + if (*file == '\0') { /* if end of symbols */ + return NULL; + } + progress("Search", searchcount, nsrcfiles); + break; + + case INCLUDE: /* match function called to pattern */ + skiprefchar(); + skiprefchar(); /* skip global or local #include marker */ + if (match()) { + + /* output the file and source line */ + putref(0, file, global); + } + } + } + + return NULL; +} + +/* initialize */ + +FINDINIT +findinit(char *pattern) +{ + char buf[PATLEN + 3]; + BOOL isregexp = NO; + int i; + char *s; + unsigned char c; /* HBB 20010427: changed uint to uchar */ + + /* HBB: be nice: free regexp before allocating a new one */ + if(isregexp_valid == YES) + regfree(®exp); + + isregexp_valid = NO; + + /* remove trailing white space */ + for (s = pattern + strlen(pattern) - 1; + isspace((unsigned char)*s); + --s) { + *s = '\0'; + } + + /* HBB 20020620: new: make sure pattern is lowercased. Curses + * mode gets this right all on its own, but at least -L mode + * doesn't */ + if (caseless == YES) { + pattern = lcasify(pattern); + } + + /* allow a partial match for a file name */ + if (field == FILENAME || field == INCLUDES) { + if (regcomp (®exp, pattern, REG_EXTENDED | REG_NOSUB) != 0) { + return(REGCMPERROR); + } else { + isregexp_valid = YES; + } + return(NOERROR); + } + /* see if the pattern is a regular expression */ + if (strpbrk(pattern, "^.[{*+$") != NULL) { + isregexp = YES; + } else { + /* check for a valid C symbol */ + s = pattern; + if (!isalpha((unsigned char)*s) && *s != '_') { + return(NOTSYMBOL); + } + while (*++s != '\0') { + if (!isalnum((unsigned char)*s) && *s != '_') { + return(NOTSYMBOL); + } + } + /* look for use of the -T option (truncate symbol to 8 + characters) on a database not built with -T */ + if (trun_syms == YES && isuptodate == YES && + dbtruncated == NO && s - pattern >= 8) { + (void) strcpy(pattern + 8, ".*"); + isregexp = YES; + } + } + /* if this is a regular expression or letter case is to be ignored */ + /* or there is an inverted index */ + if (isregexp == YES || caseless == YES || invertedindex == YES) { + + /* remove a leading ^ */ + s = pattern; + if (*s == '^') { + (void) strcpy(newpat, s + 1); + (void) strcpy(s, newpat); + } + /* remove a trailing $ */ + i = strlen(s) - 1; + if (s[i] == '$') { + if (i > 0 && s[i-1] == '\\' ) { + s[i-1] = '$'; + } + s[i] = '\0'; + } + /* if requested, try to truncate a C symbol pattern */ + if (trun_syms == YES && strpbrk(s, "[{*+") == NULL) { + s[8] = '\0'; + } + /* must be an exact match */ + /* note: regcomp doesn't recognize ^*keypad$ as a syntax error + unless it is given as a single arg */ + (void) sprintf(buf, "^%s$", s); + if (regcomp (®exp, buf, REG_EXTENDED | REG_NOSUB) != 0) { + return(REGCMPERROR); + } + else + { + isregexp_valid = YES; + } + } + else { + /* if requested, truncate a C symbol pattern */ + if (trun_syms == YES && field <= CALLING) { + pattern[8] = '\0'; + } + /* compress the string pattern for matching */ + s = cpattern; + for (i = 0; (c = pattern[i]) != '\0'; ++i) { + if (IS_A_DICODE(c, pattern[i + 1])) { + c = DICODE_COMPRESS(c, pattern[i + 1]); + ++i; + } + *s++ = c; + } + *s = '\0'; + } + return(NOERROR); +} + +void +findcleanup(void) +{ + /* discard any regular expression */ +} + +/* match the pattern to the string */ + +static BOOL +match(void) +{ + char string[PATLEN + 1]; + + /* see if this is a regular expression pattern */ + if (isregexp_valid == YES) { + fetch_string_from_dbase(string, sizeof(string)); + if (*string == '\0') { + return(NO); + } + if (caseless == YES) { + return (regexec (®exp, lcasify(string), (size_t)0, NULL, 0) ? NO : YES); + } + else { + return (regexec (®exp, string, (size_t)0, NULL, 0) ? NO : YES); + } + } + /* it is a string pattern */ + return((BOOL) (*blockp == cpattern[0] && matchrest())); +} + +/* match the rest of the pattern to the name */ + +static BOOL +matchrest(void) +{ + int i = 1; + + skiprefchar(); + do { + while (*blockp == cpattern[i]) { + ++blockp; + ++i; + } + } while (*(blockp + 1) == '\0' && read_block() != NULL); + + if (*blockp == '\n' && cpattern[i] == '\0') { + return(YES); + } + return(NO); +} + +/* put the reference into the file */ + +static void +putref(int seemore, char *file, char *func) +{ + FILE *output; + + if (strcmp(func, global) == 0) { + output = refsfound; + } + else { + output = nonglobalrefs; + } + (void) fprintf(output, "%s %s ", file, func); + putsource(seemore, output); +} + +/* put the source line into the file */ + +static void +putsource(int seemore, FILE *output) +{ + char *tmpblockp; + char *cp, nextc = '\0'; + BOOL Change = NO, retreat = NO; + + if (fileversion <= 5) { + (void) scanpast(' '); + putline(output); + (void) putc('\n', output); + return; + } + /* scan back to the beginning of the source line */ + cp = tmpblockp = blockp; + while (*cp != '\n' || nextc != '\n') { + nextc = *cp; + if (--cp < block) { + retreat = YES; + /* read the previous block */ + (void) dbseek((blocknumber - 1) * BUFSIZ); + cp = &block[BUFSIZ - 1]; + } + } + blockp = cp; + if (*blockp != '\n' || getrefchar() != '\n' || + (!isdigit(getrefchar()) && fileversion >= 12)) { + postfatal("Internal error: cannot get source line from database"); + /* NOTREACHED */ + } + /* until a double newline is found */ + do { + /* skip a symbol type */ + if (*blockp == '\t') { + /* if retreat == YES, that means tmpblockp and blockp + * point to different blocks. Offset comparison should + * NOT be performed until they point to the same block. + */ + if (seemore && Change == NO && retreat == NO && + blockp > tmpblockp) { + Change = YES; + cp = blockp; + } + skiprefchar(); + skiprefchar(); + } + /* output a piece of the source line */ + putline(output); + if (retreat == YES) retreat = NO; + } while (blockp != NULL && getrefchar() != '\n'); + (void) putc('\n', output); + if (Change == YES) blockp = cp; +} + +/* put the rest of the cross-reference line into the file */ + +static void +putline(FILE *output) +{ + char *cp; + unsigned c; + + setmark('\n'); + cp = blockp; + do { + while ((c = (unsigned)(*cp)) != '\n') { + + /* check for a compressed digraph */ + if (c > '\177') { + c &= 0177; + (void) putc(dichar1[c / 8], output); + (void) putc(dichar2[c & 7], output); + } + /* check for a compressed keyword */ + else if (c < ' ') { + (void) fputs(keyword[c].text, output); + if (keyword[c].delim != '\0') { + (void) putc(' ', output); + } + if (keyword[c].delim == '(') { + (void) putc('(', output); + } + } + else { + (void) putc((int) c, output); + } + ++cp; + } + } while (*(cp + 1) == '\0' && (cp = read_block()) != NULL); + blockp = cp; +} + + +/* 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) +{ + char *cp; + + setmark(c); + cp = blockp; + do { /* innermost loop optimized to only one test */ + while (*cp != c) { + ++cp; + } + } while (*(cp + 1) == '\0' && (cp = read_block()) != NULL); + blockp = cp; + if (cp != NULL) { + skiprefchar(); /* skip the found character */ + } + return(blockp); +} + +/* read a block of the cross-reference */ +/* HBB 20040430: renamed from readblock(), to avoid name clash on QNX */ +char * +read_block(void) +{ + /* read the next block */ + blocklen = read(symrefs, block, BUFSIZ); + blockp = block; + + /* add the search character and end-of-block mark */ + block[blocklen] = blockmark; + block[blocklen + 1] = '\0'; + + /* return NULL on end-of-file */ + if (blocklen == 0) { + blockp = NULL; + } + else { + ++blocknumber; + } + return(blockp); +} + +static char * +lcasify(char *s) +{ + static char ls[PATLEN+1]; /* largest possible match string */ + char *lptr = ls; + + while(*s) { + *lptr = tolower((unsigned char)*s); + lptr++; + s++; + } + *lptr = '\0'; + return(ls); +} + +/* find the functions called by this function */ + +/* HBB 2000/05/05: for consitency of calling interface between the + * different 'find...()' functions, this now returns a char pointer, + * too. Implemented as a pointer to static storage containing 'y' or + * 'n', for the boolean result values YES and NO */ + +char * +findcalledby(char *pattern) +{ + char file[PATHLEN + 1]; /* source file name */ + static char found_caller = 'n'; /* seen calling function? */ + BOOL macro = NO; + + if (invertedindex == YES) { + POSTING *p; + + findterm(pattern); + while ((p = getposting()) != NULL) { + switch (p->type) { + case DEFINE: /* could be a macro */ + case FCNDEF: + if (dbseek(p->lineoffset) != -1 && + scanpast('\t') != NULL) { /* skip def */ + found_caller = 'y'; + findcalledbysub(srcfiles[p->fileindex], macro); + } + } + } + return(&found_caller); + } + /* find the function definition(s) */ + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case NEWFILE: + skiprefchar(); /* save file name */ + fetch_string_from_dbase(file, sizeof(file)); + if (*file == '\0') { /* if end of symbols */ + return(&found_caller); + } + progress("Search", searchcount, nsrcfiles); + break; + + case DEFINE: /* could be a macro */ + if (fileversion < 10) { + break; + } + macro = YES; + /* FALLTHROUGH */ + + case FCNDEF: + skiprefchar(); /* match name to pattern */ + if (match()) { + found_caller = 'y'; + findcalledbysub(file, macro); + } + break; + } + } + + return (&found_caller); +} + +/* find this term, which can be a regular expression */ + +static void +findterm(char *pattern) +{ + char *s; + int len; + char prefix[PATLEN + 1]; + char term[PATLEN + 1]; + + npostings = 0; /* will be non-zero after database built */ + lastfcnoffset = 0; /* clear the last function name found */ + boolclear(); /* clear the posting set */ + + /* get the string prefix (if any) of the regular expression */ + (void) strcpy(prefix, pattern); + if ((s = strpbrk(prefix, ".[{*+")) != NULL) { + *s = '\0'; + } + /* if letter case is to be ignored */ + if (caseless == YES) { + + /* convert the prefix to upper case because it is lexically + less than lower case */ + s = prefix; + while (*s != '\0') { + *s = toupper((unsigned char)*s); + ++s; + } + } + /* find the term lexically >= the prefix */ + (void) invfind(&invcontrol, prefix); + if (caseless == YES) { /* restore lower case */ + (void) strcpy(prefix, lcasify(prefix)); + } + /* a null prefix matches the null term in the inverted index, + so move to the first real term */ + if (*prefix == '\0') { + (void) invforward(&invcontrol); + } + len = strlen(prefix); + do { + (void) invterm(&invcontrol, term); /* get the term */ + s = term; + if (caseless == YES) { + s = lcasify(s); /* make it lower case */ + } + /* if it matches */ + if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) { + + /* add its postings to the set */ + if ((postingp = boolfile(&invcontrol, &npostings, BOOL_OR)) == NULL) { + break; + } + } + /* if there is a prefix */ + else if (len > 0) { + + /* if ignoring letter case and the term is out of the + range of possible matches */ + if (caseless == YES) { + if (strncmp(term, prefix, len) > 0) { + break; /* stop searching */ + } + } + /* if using letter case and the prefix doesn't match */ + else if (strncmp(term, prefix, len) != 0) { + break; /* stop searching */ + } + } + /* display progress about every three seconds */ + if (++searchcount % 50 == 0) { + progress("Symbols matched", searchcount, totalterms); + } + } while (invforward(&invcontrol)); /* while didn't wrap around */ + + /* initialize the progress message for retrieving the references */ + searchcount = 0; + postingsfound = npostings; +} + +/* get the next posting for this term */ + +static POSTING * +getposting(void) +{ + if (npostings-- <= 0) { + return(NULL); + } + /* display progress about every three seconds */ + if (++searchcount % 100 == 0) { + progress("Possible references retrieved", searchcount, + postingsfound); + } + return(postingp++); +} + +/* put the posting reference into the file */ + +static void +putpostingref(POSTING *p, char *pat) +{ + static char function[PATLEN + 1]; /* function name */ + + if (p->fcnoffset == 0) { + if (p->type == FCNDEF) { /* need to find the function name */ + if (dbseek(p->lineoffset) != -1) { + scanpast(FCNDEF); + fetch_string_from_dbase(function, + sizeof(function)); + } + } + else if (p->type != FCNCALL) { + strcpy(function, global); + } + } + else if (p->fcnoffset != lastfcnoffset) { + if (dbseek(p->fcnoffset) != -1) { + fetch_string_from_dbase(function, sizeof(function)); + lastfcnoffset = p->fcnoffset; + } + } + if (dbseek(p->lineoffset) != -1) { + if (pat) + putref(0, srcfiles[p->fileindex], pat); + else + putref(0, srcfiles[p->fileindex], function); + } +} + +/* seek to the database offset */ + +long +dbseek(long offset) +{ + long n; + int rc = 0; + + if ((n = offset / BUFSIZ) != blocknumber) { + if ((rc = lseek(symrefs, n * BUFSIZ, 0)) == -1) { + myperror("Lseek failed"); + (void) sleep(3); + return(rc); + } + (void) read_block(); + blocknumber = n; + } + blockp = block + offset % BUFSIZ; + return(rc); +} + +static void +findcalledbysub(char *file, BOOL macro) +{ + /* find the next function call or the end of this function */ + while (scanpast('\t') != NULL) { + switch (*blockp) { + + case DEFINE: /* #define inside a function */ + if (fileversion >= 10) { /* skip it */ + while (scanpast('\t') != NULL && + *blockp != DEFINEEND) + ; + } + break; + + case FCNCALL: /* function call */ + + /* output the file name */ + (void) fprintf(refsfound, "%s ", file); + + /* output the function name */ + skiprefchar(); + putline(refsfound); + (void) putc(' ', refsfound); + + /* output the source line */ + putsource(1, refsfound); + break; + + case DEFINEEND: /* #define end */ + + if (invertedindex == NO) { + if (macro == YES) { + return; + } + break; /* inside a function */ + } + /* FALLTHROUGH */ + + case FCNDEF: /* function end (pre 9.5) */ + + if (invertedindex == NO) break; + /* FALLTHROUGH */ + + case FCNEND: /* function end */ + case NEWFILE: /* file end */ + return; + } + } +} diff --git a/src/fscanner.l b/src/fscanner.l new file mode 100644 index 0000000..a0e6959 --- /dev/null +++ b/src/fscanner.l @@ -0,0 +1,1052 @@ +%{ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * C symbol scanner + */ +#include "global.h" +#include "alloc.h" +#include "scanner.h" +#include "lookup.h" + +#include <assert.h> + +/* the line counting has been moved from character reading for speed */ +/* comments are discarded */ + +#ifndef FLEX_SCANNER +# error Sorry, this scanner needs flex. It is not usable with AT&T Lex. +#endif + +#define IFLEVELINC 5 /* #if nesting level size increment */ + +static char const rcsid[] = "$Id: fscanner.l,v 1.12 2006/09/30 20:29:14 broeker Exp $"; + +int first; /* buffer index for first char of symbol */ +int last; /* buffer index for last char of symbol */ +int lineno; /* symbol line number */ +int myylineno = 1; + +/* HBB 20001007: new variables, emulating yytext in a way that allows + * the yymore() simulation, my_yymore(), to be used even in the presence of + * yyless(). */ +size_t my_yyleng = 0; +char *my_yytext = NULL; + +static BOOL arraydimension; /* inside array dimension declaration */ +static BOOL bplisting; /* breakpoint listing */ +static int braces; /* unmatched left brace count */ +static BOOL classdef; /* c++ class definition */ +static BOOL elseelif; /* #else or #elif found */ +static BOOL esudef; /* enum/struct/union global definition */ +static BOOL external; /* external definition */ +static int externalbraces; /* external definition outer brace count */ +static BOOL fcndef; /* function definition */ +static BOOL global; /* file global scope (outside functions) */ +static int iflevel; /* #if nesting level */ +static BOOL initializer; /* data initializer */ +static int initializerbraces; /* data initializer outer brace count */ +static BOOL lex; /* lex file */ +static int miflevel = IFLEVELINC; /* maximum #if nesting level */ +static int *maxifbraces; /* maximum brace count within #if */ +static int *preifbraces; /* brace count before #if */ +static int parens; /* unmatched left parenthesis count */ +static BOOL ppdefine; /* preprocessor define statement */ +static BOOL pseudoelif; /* pseudo-#elif */ +static BOOL oldtype; /* next identifier is an old type */ +static BOOL rules; /* lex/yacc rules */ +static BOOL sdl; /* sdl file */ +static BOOL structfield; /* structure field declaration */ +static int tagdef; /* class/enum/struct/union tag definition */ +static BOOL template; /* function template */ +static int templateparens; /* function template outer parentheses count */ +static int typedefbraces = -1; /* initial typedef brace count */ +static int token; /* token found */ +static int ident_start; /* begin of preceding identifier */ + +/* If this is defined to 1, use flex rules rather than the input + * function to discard comments. The scanner gains quite a bit of + * speed this way, because of a large reduction of the number of I/O + * system/library calls. The original skipcomment_input() called + * getc() so often that the call overhead of shared libraries + * vs. static linking, alone, already caused a sizeable performance + * hit (up to 40% gross gain on a cscope -cub of its own source + * dir). */ +#define COMMENTS_BY_FLEX 1 + +#if !COMMENTS_BY_FLEX +static int skipcomment_input(void); +static int comment(void); +static int insidestring_input(int); +#endif + +static void my_yymore(void); + +#if COMMENTS_BY_FLEX +# define skipcomment_input input +#else + +# define YY_INPUT(buf,result,max_size) \ +{ \ + int c = skipcomment_input (); \ + result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ +} + +#endif /* !COMMENTS_BY_FLEX*/ + +%} +identifier [a-zA-Z_$][a-zA-Z_0-9$]* +number \.?[0-9][.0-9a-fA-FlLuUxX]* +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() */ +%option stack +%option noyywrap + +%start SDL +%a 4000 +%o 7000 + +/* exclusive start conditions. not available in AT&T lex -> use flex! */ +%x IN_PREPROC WAS_ENDIF WAS_IDENTIFIER WAS_ESU IN_DQUOTE IN_SQUOTE COMMENT + +%% + +%\{ { /* lex/yacc C declarations/definitions */ + global = YES; + goto more; + /* NOTREACHED */ + } +%\} { + global = NO; + goto more; + /* NOTREACHED */ + } +^%% { /* lex/yacc rules delimiter */ + braces = 0; + if (rules == NO) { + /* this %% starts the section containing the rules */ + rules = YES; + + /* Copy yytext to private buffer, to be able to add further + * content following it: */ + my_yymore(); + + /* simulate a yylex() or yyparse() definition */ + (void) strcat(my_yytext, " /* "); + first = strlen(my_yytext); + if (lex == YES) { + (void) strcat(my_yytext, "yylex"); + } else { + /* yacc: yyparse implicitly calls yylex */ + char *s = " yylex()"; + char *cp = s + strlen(s); + while (--cp >= s) { + unput(*cp); + } + (void) strcat(my_yytext, "yyparse"); + } + last = strlen(my_yytext); + (void) strcat(my_yytext, " */"); + my_yyleng = strlen(my_yytext); + return(FCNDEF); + } else { + /* were in the rules section, now comes the closing one */ + rules = NO; + global = YES; + last = first; + my_yymore(); + return(FCNEND); + /* NOTREACHED */ + } + } + +<SDL>STATE[ \t]+({identifier}|\*) { /* sdl state, treat as function def */ + braces = 1; + fcndef = YES; + token = FCNDEF; + goto findident; + /* NOTREACHED */ + } +<SDL>ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */ + goto endstate; + /* NOTREACHED */ + } + +\{ { /* count unmatched left braces for fcn def detection */ + ++braces; + + /* mark an untagged enum/struct/union so its beginning + can be found */ + if (tagdef) { + if (braces == 1) { + esudef = YES; + } + token = tagdef; + tagdef = '\0'; + last = first; + my_yymore(); + return(token); + } + goto more; + /* NOTREACHED */ + } + +\#{ws}* { /* start a preprocessor line */ + if (rules == NO) /* don't consider CPP for lex/yacc rules */ + BEGIN(IN_PREPROC); + yyleng = 1; /* get rid of the blanks, if any */ + goto more; + /* NOTREACHED */ + } +<IN_PREPROC>endif([^a-zA-Z0-9_$\n].*)? { /* #endif */ + /* delay treatment of #endif depending on whether an + * #if comes right after it, or not */ + /* HBB 20010619: new pattern allows trailing garbage + * after the #endif */ + BEGIN(WAS_ENDIF); + goto more; + /* NOTREACHED */ + } +<WAS_ENDIF>\n{wsnl}*#{ws}*if(ndef|def)?{ws}+ { + /* attempt to correct erroneous brace count caused by: + * + * #if ... + * ... { + * #endif + * #if ... + * ... { + * #endif + */ + /* the current #if must not have an #else or #elif */ + if (elseelif == YES) { + goto endif; + /* NOTREACHED */ + } + pseudoelif = YES; + BEGIN(INITIAL); + yyless(1); /* rescan all but the line ending */ + yy_set_bol(1); + goto eol; + /* NOTREACHED */ + } +<WAS_ENDIF>\n{wsnl}* { /* an #endif with no #if right after it */ + endif: + if (iflevel > 0) { + /* get the maximum brace count for this #if */ + if (braces < maxifbraces[--iflevel]) { + braces = maxifbraces[iflevel]; + } + } + BEGIN(INITIAL); + yyless(1); + yy_set_bol(1); + goto eol; + /* NOTREACHED */ + } + +<IN_PREPROC>ifndef{ws}+ | +<IN_PREPROC>ifdef{ws}+ | +<IN_PREPROC>if{ws}+ { /* #if directive */ + elseelif = NO; + if (pseudoelif == YES) { + pseudoelif = NO; + goto elif; + /* NOTREACHED */ + } + /* make sure there is room for the current brace count */ + if (iflevel == miflevel) { + miflevel += IFLEVELINC; + maxifbraces = myrealloc(maxifbraces, miflevel * sizeof(int)); + preifbraces = myrealloc(preifbraces, miflevel * sizeof(int)); + } + /* push the current brace count */ + preifbraces[iflevel] = braces; + maxifbraces[iflevel++] = 0; + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } +<IN_PREPROC>else({ws}.*)? { /* #else --- eat up whole line */ + elseelif = YES; + if (iflevel > 0) { + + /* save the maximum brace count for this #if */ + if (braces > maxifbraces[iflevel - 1]) { + maxifbraces[iflevel - 1] = braces; + } + /* restore the brace count to before the #if */ + braces = preifbraces[iflevel - 1]; + } + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } +<IN_PREPROC>elif{ws}+ { /* #elif */ + /* elseelif = YES; --- HBB I doubt this is correct */ + elif: + if (iflevel > 0) { + + /* save the maximum brace count for this #if */ + if (braces > maxifbraces[iflevel - 1]) { + maxifbraces[iflevel - 1] = braces; + } + /* restore the brace count to before the #if */ + braces = preifbraces[iflevel - 1]; + } + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } + +<IN_PREPROC>include{ws}*\"[^"\n]+\" | +<IN_PREPROC>include{ws}*<[^>\n]+> { /* #include file */ + char *s; + char remember = yytext[yyleng-1]; + + my_yymore(); + s = strpbrk(my_yytext, "\"<"); + my_yytext[my_yyleng-1] = '\0'; + incfile(s + 1, s); + my_yytext[my_yyleng-1] = remember; + first = s - my_yytext; + last = my_yyleng - 1; + if (compress == YES) { + my_yytext[0] = '\2'; /* compress the keyword */ + } + BEGIN(INITIAL); + return(INCLUDE); + /* NOTREACHED */ + } + +\} { + /* could be the last enum member initializer */ + if (braces == initializerbraces) { + initializerbraces = -1; + initializer = NO; + } + if (--braces <= 0) { + endstate: + braces = 0; + classdef = NO; + } + if (braces == 0 || (braces == 1 && classdef == YES)) { + + /* if the end of an enum/struct/union definition */ + if (esudef == YES) { + esudef = NO; + } + /* if the end of the function */ + else if (fcndef == YES) { + fcndef = NO; + last = first; + my_yymore(); + return(FCNEND); + } + } + goto more; + /* NOTREACHED */ + } + +\( { /* count unmatched left parentheses for function templates */ + ++parens; + goto more; + /* NOTREACHED */ + } +\) { + if (--parens <= 0) { + parens = 0; + } + /* if the end of a function template */ + if (parens == templateparens) { + templateparens = -1; + template = NO; + } + goto more; + /* NOTREACHED */ + } += { /* if a global definition initializer */ + if (global == YES && ppdefine == NO && my_yytext[0] != '#') { + initializerbraces = braces; + initializer = YES; + } + goto more; + /* NOTREACHED */ + } +: { /* a if global structure field */ + if (global == YES && ppdefine == NO && my_yytext[0] != '#') { + structfield = YES; + } + goto more; + /* NOTREACHED */ + } +\, { + if (braces == initializerbraces) { + initializerbraces = -1; + initializer = NO; + } + structfield = NO; + goto more; + /* NOTREACHED */ + } +; { /* if the enum/struct/union was not a definition */ + if (braces == 0) { + esudef = NO; + } + /* if the end of a typedef */ + if (braces == typedefbraces) { + typedefbraces = -1; + } + /* if the end of a external definition */ + if (braces == externalbraces) { + externalbraces = -1; + external = NO; + } + structfield = NO; + initializer = NO; + goto more; + /* NOTREACHED */ + } +<IN_PREPROC>define{ws}+{identifier} { + + /* preprocessor macro or constant definition */ + ppdefine = YES; + token = DEFINE; + if (compress == YES) { + my_yytext[0] = '\1'; /* compress the keyword */ + } + findident: + /* search backwards through yytext[] to find the identifier */ + /* NOTE: this had better be left to flex, by use of + * yet another starting condition */ + my_yymore(); + first = my_yyleng - 1; + while (my_yytext[first] != ' ' && my_yytext[first] != '\t') { + --first; + } + ++first; + last = my_yyleng; + BEGIN(INITIAL); + goto definition; + /* NOTREACHED */ + } +<IN_PREPROC>.|\n | +<IN_PREPROC>{identifier} { /* unknown preprocessor line */ + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } + +class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ { /* class definition */ + classdef = YES; + tagdef = 'c'; + yyless(5); /* eat up 'class', and re-scan */ + yy_set_bol(0); + goto more; + /* NOTREACHED */ + } + +("enum"|"struct"|"union") { + ident_start = first; + BEGIN(WAS_ESU); + goto more; + } +<WAS_ESU>{ +({wsnl}+{identifier}){wsnl}*\{ { /* e/s/u definition */ + tagdef = my_yytext[ident_start]; + BEGIN(WAS_IDENTIFIER); + goto ident; + } +{wsnl}*\{ { /* e/s/u definition without a tag */ + tagdef = my_yytext[ident_start]; + BEGIN(INITIAL); + if (braces == 0) { + esudef = YES; + } + last = first; + yyless(0); /* re-scan all this as normal text */ + tagdef = '\0'; + goto more; + } +({wsnl}+{identifier})?{wsnl}* | +.|\n { /* e/s/u usage */ + BEGIN(WAS_IDENTIFIER); + goto ident; + } +} + +if{wsnl}*\( { /* ignore 'if' */ + yyless(2); + yy_set_bol(0); + goto more; +} + +{identifier} { /* identifier found: do nothing, yet. (!) */ + BEGIN(WAS_IDENTIFIER); + ident_start = first; + goto more; + /* NOTREACHED */ + } + +<WAS_IDENTIFIER>{ +{ws}*\(({wsnl}|{identifier}|{number}|[*&[\]=,.])*\)([()]|{wsnl})*[:a-zA-Z_#{] { + /* a function definition */ + /* note: "#define a (b) {" and "#if defined(a)\n#" + * are not fcn definitions! */ + /* warning: "if (...)" must not overflow yytext, + * so the content of function argument definitions + * is restricted, in particular parentheses are + * not allowed */ + /* FIXME HBB 20001003: the above 'not allowed' may well be the + * reason for the parsing bug concerning function pointer usage, + * I suspect. --- I think my new special-case rule for 'if' + * could be helpful in removing that limitation */ + if ((braces == 0 && ppdefine == NO && my_yytext[0] != '#' && rules == NO) || + (braces == 1 && classdef == YES)) { + fcndef = YES; + token = FCNDEF; + goto fcn; + /* NOTREACHED */ + } + goto fcncal; + /* NOTREACHED */ + } +{ws}*\(([*&[\]=,.]|{identifier}|{number}|{wsnl})* { /* function call */ + fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) { + token = FCNCALL; + goto fcn; + /* NOTREACHED */ + } + if (template == NO) { + templateparens = parens; + template = YES; + } + goto ident; + /* NOTREACHED */ + } +("*"|{wsnl})+{identifier} { /* typedef name or modifier use */ + goto ident; + /* NOTREACHED */ + } +.|\n { /* general identifer usage */ + char *s; + + if (global == YES && ppdefine == NO && my_yytext[0] != '#' && + external == NO && initializer == NO && + arraydimension == NO && structfield == NO && + template == NO && fcndef == NO) { + if (esudef == YES) { + /* if enum/struct/union */ + token = MEMBERDEF; + } else { + token = GLOBALDEF; + } + } else { + ident: + token = IDENT; + } + fcn: + if (YYSTATE == WAS_IDENTIFIER) { + /* Position back to the actual identifier: */ + last = first; + first = ident_start; + yyless(0); + /* HBB 20001008: if the anti-backup-pattern above matched, + * and the matched context ended with a \n, then the scanner + * believes it's at the start of a new line. But the yyless() + * should feeds that \n back into the input, so that's + * wrong. --> force 'beginning-of-line' status off. */ + yy_set_bol(0); + BEGIN(INITIAL); + } else { + my_yymore(); + last = my_yyleng; + } + definition: + + /* if a long line */ + if (yyleng > STMTMAX) { + int c; + + /* skip to the end of the line */ + warning("line too long"); + while ((c = skipcomment_input()) > LEXEOF) { + if (c == '\n') { + unput(c); + break; + } + } + } + /* truncate a long symbol */ + if (yyleng > PATLEN) { + warning("symbol too long"); + my_yyleng = first + PATLEN; + my_yytext[my_yyleng] = '\0'; + } + + /* if found word was a keyword: */ + if ((s = lookup(my_yytext + first)) != NULL) { + first = my_yyleng; + + /* if the start of a typedef */ + if (s == typedeftext) { + typedefbraces = braces; + oldtype = YES; + } + /* if an enum/struct/union */ + /* (needed for "typedef struct tag name;" so + tag isn't marked as the typedef name) */ + else if (s == enumtext || s == structtext || s == uniontext) { + /* do nothing */ + } else if (s == externtext) { + /* if an external definition */ + externalbraces = braces; + external = YES; + } else if (templateparens == parens && template == YES) { + /* keyword doesn't start a function + * template */ + templateparens = -1; + template = NO; + } else { + /* identifier after typedef was a + * keyword */ + oldtype = NO; + } + } else { + /* not a keyword --> found an identifier */ + /* last = yyleng; */ + + /* if a class/enum/struct/union tag definition */ + /* FIXME HBB 20001001: why reject "class"? */ + if (tagdef && strnotequal(my_yytext + first, "class")) { + token = tagdef; + tagdef = '\0'; + if (braces == 0) { + esudef = YES; + } + } else if (braces == typedefbraces && oldtype == NO && + arraydimension == NO) { + /* if a typedef name */ + token = TYPEDEF; + } else { + oldtype = NO; + } + /* my_yymore(); */ + return(token); + /* NOTREACHED */ + } + } +} + +\[ { /* array dimension (don't worry or about subscripts) */ + arraydimension = YES; + goto more; + /* NOTREACHED */ + } +\] { + arraydimension = NO; + goto more; + /* NOTREACHED */ + } +\\\n { /* preprocessor statement is continued on next line */ + /* save the '\\' to the output file, but not the '\n': */ + yyleng = 1; + my_yymore(); + goto eol; + /* NOTREACHED */ + } +\n { /* end of the line */ + if (ppdefine == YES) { /* end of a #define */ + ppdefine = NO; + yyless(yyleng - 1); + last = first; + my_yymore(); + return(DEFINEEND); + } + /* skip the first 8 columns of a breakpoint listing line */ + /* and skip the file path in the page header */ + if (bplisting == YES) { + int c, i; + + /* FIXME HBB 20001007: should call input() instead */ + switch (skipcomment_input()) { /* tab and EOF just fall through */ + case ' ': /* breakpoint number line */ + case '[': + for (i = 1; i < 8 && skipcomment_input() > LEXEOF; ++i) + ; + break; + case '.': /* header line */ + case '/': + /* skip to the end of the line */ + while ((c = skipcomment_input()) > LEXEOF) { + if (c == '\n') { + unput(c); + break; + } + } + break; + case '\n': /* empty line */ + unput('\n'); + break; + } + } + eol: + ++myylineno; + first = 0; + last = 0; + if (symbols > 0) { + /* no my_yymore(): \n doesn't need to be in my_yytext */ + return(NEWLINE); + } + /* line ended --> flush my_yytext */ + if (my_yytext) + *my_yytext = '\0'; + my_yyleng = 0; + lineno = myylineno; + } + +\' { /* character constant */ + if (sdl == NO) + BEGIN(IN_SQUOTE); + goto more; + /* NOTREACHED */ + } +<IN_SQUOTE>\' { + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } +\" { /* string constant */ + BEGIN(IN_DQUOTE); + goto more; + /* NOTREACHED */ + } +<IN_DQUOTE>\" { + BEGIN(INITIAL); + goto more; + /* NOTREACHED */ + } +<IN_DQUOTE,IN_SQUOTE>{ +\n { /* syntax error: unexpected EOL */ + BEGIN(INITIAL); + goto eol; + /* NOTREACHED */ + } +\\. | +. { + goto more; + /* NOTREACHED */ + } +\\\n { /* line continuation inside a string! */ + myylineno++; + goto more; + /* NOTREACHED */ + } +} + +^{ws}+ { /* don't save leading white space */ + } + +{ws}+\n { /* eat whitespace at end of line */ + unput('\n'); + } + +[\t\r\v\f]+ { /* eat non-blank whitespace sequences, replace + * by single blank */ + unput(' '); + } + +{ws}{2,} { /* compress sequential whitespace here, not in putcrossref() */ + unput(' '); + } + +"/*" yy_push_state(COMMENT); +<COMMENT>{ +[^*\n]* | +"*"+[^*/\n]* ; /* do nothing */ +[^*\n]*\n | +"*"+[^*/\n]*\n { + if (ppdefine == NO) { + goto eol; + } else { + ++myylineno; + } + /* NOTREACHED */ + } +"*"+"/" { + /* replace the comment by a single blank */ + unput(' '); + yy_pop_state(); + } +} + +"//".*\n? { + /* C++-style one-line comment */ + goto eol; + /* NOTREACHED */ + } + +{number} | /* number */ +<SDL>STATE[ \t]+ | /* ... and other syntax error catchers... */ +. { /* punctuation and operators */ + more: + my_yymore(); + first = my_yyleng; + } + +%% + +void +initscanner(char *srcfile) +{ + char *s; + + if (maxifbraces == NULL) { + maxifbraces = mymalloc(miflevel * sizeof(int)); + preifbraces = mymalloc(miflevel * sizeof(int)); + } + first = 0; /* buffer index for first char of symbol */ + last = 0; /* buffer index for last char of symbol */ + lineno = 1; /* symbol line number */ + myylineno = 1; /* input line number */ + arraydimension = NO; /* inside array dimension declaration */ + bplisting = NO; /* breakpoint listing */ + braces = 0; /* unmatched left brace count */ + classdef = NO; /* c++ class definition */ + elseelif = NO; /* #else or #elif found */ + esudef = NO; /* enum/struct/union global definition */ + external = NO; /* external definition */ + externalbraces = -1; /* external definition outer brace count */ + fcndef = NO; /* function definition */ + global = YES; /* file global scope (outside functions) */ + iflevel = 0; /* #if nesting level */ + initializer = NO; /* data initializer */ + initializerbraces = -1; /* data initializer outer brace count */ + lex = NO; /* lex file */ + parens = 0; /* unmatched left parenthesis count */ + ppdefine = NO; /* preprocessor define statement */ + pseudoelif = NO; /* pseudo-#elif */ + oldtype = NO; /* next identifier is an old type */ + rules = NO; /* lex/yacc rules */ + sdl = NO; /* sdl file */ + structfield = NO; /* structure field declaration */ + tagdef = '\0'; /* class/enum/struct/union tag definition */ + template = NO; /* function template */ + templateparens = -1; /* function template outer parentheses count */ + typedefbraces = -1; /* initial typedef braces count */ + ident_start = 0; /* start of previously found identifier */ + + if (my_yytext) + *my_yytext = '\0'; + my_yyleng = 0; + + BEGIN(INITIAL); + + /* if this is not a C file */ + if ((s = strrchr(srcfile, '.')) != NULL) { + switch (*++s) { /* this switch saves time on C files */ + case 'b': + if (strcmp(s, "bp") == 0) { /* breakpoint listing */ + bplisting = YES; + } + break; + case 'l': + if (strcmp(s, "l") == 0) { /* lex */ + lex = YES; + global = NO; + } + break; + case 's': + if (strcmp(s, "sd") == 0) { /* sdl */ + sdl = YES; + BEGIN(SDL); + } + break; + case 'y': + if (strcmp(s, "y") == 0) { /* yacc */ + global = NO; + } + break; + } + } +} + +#if !COMMENTS_BY_FLEX + +/* A micro-scanner that serves as the input() function of the + * scanner. It throws away any comments in the input, correctly + * avoiding doing this inside string/character constants, and knows + * about backslash sequences. Now that the main scanner doesn't use + * yymore() any longer, this could be replaced by lex rules. Left for + * trying later. */ + +/* Status variable: If this is non-NUL, it's the character that +* terminates a string we're currently in. */ +static int string_terminator = '\0'; + +/* Helper routine: treat 'c' as a character found inside a + * string. Check if this character might be the end of that + * string. Backslashes have to be taken care of, for the sake of + * "quotes like \"these\" found inside a string". */ +static int +insidestring_input(int c) +{ + static BOOL was_backslash = NO; + + if ((c == '\\') && (was_backslash == NO)) { + /* escape character found --> treat next char specially */ + /* FIXME HBB 20001003: need treatment of backslash in the main + * scanner, too. It'll get false line counts in case of "\\'", + * otherwise --- they can occur as part of a lex pattern */ + was_backslash = YES; + return c; + } + + if (((c == '\t') && (lex == YES)) + /* Note: "\\\n" is removed even inside strings! */ + || ((c == '\n') && (was_backslash == NO)) + || (c == EOF) + || ((c == string_terminator) && (was_backslash == NO)) + ) { + /* Line ended, or end-of-string was found. That is a syntax + * error. To recover, stop treatment as a string constant: */ + string_terminator = '\0'; + } else if (!isprint((unsigned char)c)) { + /* mask unprintable characters */ + c = ' '; + } + + was_backslash = NO; + return c; +} + +/* Helper function: skip over input until end of comment is found (or + * we find that it wasn't really comment, in the first place): */ +static int +comment(void) +{ + int c, lastc; + + /* Coming here, we've just read in the opening '/' of a + * comment. */ + do { + if ((c = getc(yyin)) == '*') { /* C comment */ + lastc = '\0'; + while ((c = getc(yyin)) != EOF + /* fewer '/'s --> test them first! */ + && (c != '/' || lastc != '*') + ) { + if (c == '\n') { + /* keep the line number count */ + /* FIXME HBB 20001008: this is not synchronized + * properly with myylineno changes by the main + * scanner. A strong point in favour of moving + * this to lex-code that is, IMHO */ + ++myylineno; + } + lastc = c; + } + /* return a blank for Reiser cpp token concatenation */ + /* FIXME HBB 20001008: what on earth is 'Reiser cpp'? ANSI + * C defines cpp to explicitly replace any comment by a + * blank. Pre-ANSI cpp's behaved differently, but do we + * really want that? If at all, it should only ever be a + * non-default option (like gcc's "-traditional-cpp") + * */ + if ((c = getc(yyin)) == '_' || isalnum(c)) { + (void) ungetc(c, yyin); + c = ' '; + break; + } + } else if (c == '/') { /* C++ comment */ + while ((c = getc(yyin)) != EOF && c != '\n') { + ; /* do nothing else */ + } + break; + } else { /* not a comment */ + (void) ungetc(c, yyin); + c = '/'; + break; + /* NOTREACHED */ + } + + /* there may be an immediately following comment */ + } while (c == '/'); + return(c); +} + +/* The core of the actual input() function to be used by (f)lex. The + * calling scheme between this and the actual input() redefinition is + * a bit different for lex and flex. See the #ifdef FLEX_SCANNER part + * in the head section. */ +static int +skipcomment_input(void) +{ + int c; + + c = getc (yyin); + if (string_terminator != '\0') { + /* don't look for comments inside strings! */ + return insidestring_input(c); + } else if (c == '/') { + /* swallow everything until end of comment, if this is one */ + return comment (); + } else if (c == '"' || c == '\'') { + /* a string is beginning here, so switch input method */ + string_terminator = c; + } + + return c; +} + +#endif /* !COMMENTS_BY_FLEX */ + +#define MY_YY_ALLOCSTEP 1000 +static void +my_yymore(void) +{ + static size_t yytext_size = 0; + + /* my_yytext is an ever-growing buffer. It will not ever + * shrink, nor will it be freed at end of program, for now */ + while (my_yyleng + yyleng + 1 >= yytext_size) { + my_yytext = myrealloc(my_yytext, + yytext_size += MY_YY_ALLOCSTEP); + } + + strncpy (my_yytext + my_yyleng, yytext, yyleng+1); + my_yyleng += yyleng; +} diff --git a/src/global.h b/src/global.h new file mode 100644 index 0000000..212906d --- /dev/null +++ b/src/global.h @@ -0,0 +1,413 @@ +/*=========================================================================== + 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: global.h,v 1.35 2006/07/23 20:59:20 broeker Exp $ */ + +/* cscope - interactive C symbol cross-reference + * + * global type, data, and function definitions + */ + +#ifndef CSCOPE_GLOBAL_H +#define CSCOPE_GLOBAL_H + +#include "config.h" +#include <unistd.h> +#include <sys/types.h> +#include <ctype.h> /* isalpha, isdigit, etc. */ +#include <signal.h> /* SIGINT and SIGQUIT */ +#include <stdio.h> /* standard I/O package */ +#include <stdlib.h> /* standard library functions */ + +/* A special "magic" header file required by HP/Compaq NSK (Non-Stop + * Kernel) to present a more Unix-ish environment ... */ +#ifdef HAVE_FLOSS_H +# include <floss.h> +#endif + +/* Replace most of the #if BSD stuff. Taken straight from the autoconf + * manual, with an extension for handling memset(). */ +#if STDC_HEADERS +# include <string.h> /* string functions */ +#else +# ifndef HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +# ifndef HAVE_MEMSET +# ifndef HAVE_MEMORY_H +char *memset(); +# else +# include <memory.h> /* memset */ +# endif /*V9*/ +# endif /* HAVE_MEMSET */ +#endif /* STDC_HEADERS */ + +#include "constants.h" /* misc. constants */ +#include "invlib.h" /* inverted index library */ +#include "library.h" /* library function return values */ + +/* Fallback, in case 'configure' failed to do its part of the job */ +#ifndef RETSIGTYPE +#if SVR2 || BSD && !sun +#define RETSIGTYPE int +#else +#define RETSIGTYPE void +#endif +#endif /* RETSIGTYPE */ + +#ifndef HAVE_SIGHANDLER_T +typedef RETSIGTYPE (*sighandler_t)(int); +#endif + +/* FIXME: this testing for platforms is foolish. Stop it! */ +#if BSD +# undef tolower /* BSD toupper and tolower don't test the character */ +# undef toupper +# define tolower(c) (isupper(c) ? (c) - 'A' + 'a' : (c)) +# define toupper(c) (islower(c) ? (c) - 'a' + 'A' : (c)) +# if !sun +# if !__FreeBSD__ +/* in traditional BSD, *printf() doesn't return the number of bytes + * written */ +# define PRINTF_RETVAL_BROKEN 1 +# endif /* !FreeBSD */ +# endif /* !sun */ +#endif + +/* Un-comment this if you're on a filesystem that doesn't support + * filenames longer than 14 characters */ +/* HBB FIXME 20030302: should have an autoconf test for this: */ +/* #define SHORT_NAMES_ONLY */ + +/* Just in case autoconf didn't correctly flag HAVE_FIXKEYPAD */ +#ifndef HAVE_FIXKEYPAD +# if SVR2 && !BSD && !V9 && !u3b2 && !sun +# define HAVE_FIXKEYPAD +# endif +#endif + +/* HBB 20020728: if <fcntl.h> is there, #include it here, since that's + * where the system definitions of O_TEXT should be coming from */ +#ifdef HAVE_FCNTL_H +# include <fcntl.h> +#endif + +/* HBB 20020103: Need to force text or binary mode opens on Cygwins, + * because of their "binary/text mode mount" silliness :-( */ +#ifndef O_TEXT +# ifdef _O_TEXT +# define O_TEXT _O_TEXT +# else +# define O_TEXT 0x00 +# endif +#endif +/* Same for binary mode --- moved here from vp.h */ +#ifndef O_BINARY +# ifdef _O_BINARY +# define O_BINARY _O_BINARY +# else +# define O_BINARY 0x00 +# endif +#endif + +#undef SETMODE +#if O_BINARY || O_TEXT +/* OK, looks like we are on an MSDOS-ish platform ---> define SETMODE + * to actually do something */ +# ifdef HAVE_SETMODE +# define SETMODE(fildes, mode) setmode(fildes,mode) +# else +# ifdef HAVE__SETMODE +# define SETMODE(fildes, mode) _setmode(fildes,mode) +# endif +# endif +#endif + +/* access(2) parameters. Only make assumptions about their values if + * <unistd.h> fails to define them. */ +#ifdef R_OK +# define READ R_OK +#else +# define READ 4 +#endif +#ifdef W_OK +# define WRITE W_OK +#else +# define WRITE 2 +#endif + +/* This can happen on only vaguely Unix-ish platforms... */ +#ifndef HAVE_LSTAT +# define lstat(file,buf) stat(file,buf) +#endif + +typedef enum { /* boolean data type */ + NO, + YES +} BOOL; + +typedef enum { /* findinit return code */ + NOERROR, + NOTSYMBOL, + REGCMPERROR +} FINDINIT; + +typedef struct { /* mouse action */ + int button; + int percent; + int x1; + int y1; + int x2; + int y2; +} MOUSE; + +struct cmd { /* command history struct */ + struct cmd *prev, *next; /* list ptrs */ + int field; /* input field number */ + char *text; /* input field text */ +}; + +/* digraph data for text compression */ +extern char dichar1[]; /* 16 most frequent first chars */ +extern char dichar2[]; /* 8 most frequent second chars + using the above as first chars */ +extern char dicode1[]; /* digraph first character code */ +extern char dicode2[]; /* digraph second character code */ + +/* and some macros to help using dicodes: */ +/* Check if a given pair of chars is compressable as a dicode: */ +#define IS_A_DICODE(inchar1, inchar2) \ + (dicode1[(unsigned char)(inchar1)] && dicode2[(unsigned char)(inchar2)]) +/* Combine the pair into a dicode */ +#define DICODE_COMPRESS(inchar1, inchar2) \ + ((0200 - 2) + dicode1[(unsigned char)(inchar1)] \ + + dicode2[(unsigned char)(inchar2)]) + +/* main.c global data */ +extern char *editor, *home, *shell, *lineflag; /* environment variables */ +extern char *home; /* Home directory */ +extern BOOL lineflagafterfile; +extern char *argv0; /* command name */ +extern BOOL compress; /* compress the characters in the crossref */ +extern BOOL dbtruncated; /* database symbols truncated to 8 chars */ +extern int dispcomponents; /* file path components to display */ +#if CCS +extern BOOL displayversion; /* display the C Compilation System version */ +#endif +extern BOOL editallprompt; /* prompt between editing files */ +extern unsigned int fileargc; /* file argument count */ +extern char **fileargv; /* file argument values */ +extern int fileversion; /* cross-reference file version */ +extern BOOL incurses; /* in curses */ +extern BOOL invertedindex; /* the database has an inverted index */ +extern BOOL isuptodate; /* consider the crossref up-to-date */ +extern BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */ +extern BOOL linemode; /* use line oriented user interface */ +extern BOOL verbosemode; /* print extra information on line mode */ +extern BOOL recurse_dir; /* recurse dirs when searching for src files */ +extern char *namefile; /* file of file names */ +extern BOOL ogs; /* display OGS book and subsystem names */ +extern char *prependpath; /* prepend path to file names */ +extern FILE *refsfound; /* references found file */ +extern char temp1[]; /* temporary file name */ +extern char temp2[]; /* temporary file name */ +extern long totalterms; /* total inverted index terms */ +extern BOOL trun_syms; /* truncate symbols to 8 characters */ +extern char tempstring[8192]; /* global dummy string buffer */ +extern char *tmpdir; /* temporary directory */ + +/* command.c global data */ +extern BOOL caseless; /* ignore letter case when searching */ +extern BOOL *change; /* change this line */ +extern BOOL changing; /* changing text */ +extern int selecting; +extern unsigned int curdispline; +extern char newpat[]; /* new pattern */ +extern char Pattern[]; /* symbol or text pattern */ + +/* crossref.c global data */ +extern long dboffset; /* new database offset */ +extern BOOL errorsfound; /* prompt before clearing error messages */ +extern long lineoffset; /* source line database offset */ +extern long npostings; /* number of postings */ +extern unsigned long symbols; /* number of symbols */ + +/* dir.c global data */ +extern char currentdir[]; /* current directory */ +extern char **incdirs; /* #include directories */ +extern char **srcdirs; /* source directories */ +extern char **srcfiles; /* source files */ +extern unsigned long nincdirs; /* number of #include directories */ +extern unsigned long nsrcdirs; /* number of source directories */ +extern unsigned long nsrcfiles; /* number of source files */ +extern unsigned long msrcfiles; /* maximum number of source files */ + +/* display.c global data */ +extern int booklen; /* OGS book name display field length */ +extern int *displine; /* screen line of displayed reference */ +extern unsigned int disprefs; /* displayed references */ +extern int fcnlen; /* function name display field length */ +extern int field; /* input field */ +extern int filelen; /* file name display field length */ +extern unsigned fldcolumn; /* input field column */ +extern unsigned int mdisprefs; /* maximum displayed references */ +extern unsigned int nextline; /* next line to be shown */ +extern FILE *nonglobalrefs; /* non-global references file */ +extern int numlen; /* line number display field length */ +extern unsigned int topline; /* top line of page */ +extern int bottomline; /* bottom line of page */ +extern long searchcount; /* count of files searched */ +extern int subsystemlen; /* OGS subsystem name display field length */ +extern unsigned int totallines; /* total reference lines */ +extern const char dispchars[]; /* display chars for jumping to lines */ + +/* find.c global data */ +extern char block[]; /* cross-reference file block */ +extern char blockmark; /* mark character to be searched for */ +extern long blocknumber; /* block number */ +extern char *blockp; /* pointer to current character in block */ +extern int blocklen; /* length of disk block read */ + +/* lookup.c global data */ +extern struct keystruct { + char *text; + char delim; + struct keystruct *next; +} keyword[]; + +/* mouse.c global data */ +extern BOOL mouse; /* mouse interface */ + +#if UNIXPC +extern BOOL unixpcmouse; /* UNIX PC mouse interface */ +#endif + +/* cscope functions called from more than one function or between files */ + +char *filepath(char *file); +char *findcalledby(char *pattern); +char *findcalling(char *pattern); +char *findallfcns(char *dummy); +char *finddef(char *pattern); +char *findfile(char *dummy); +char *findinclude(char *pattern); +char *findsymbol(char *pattern); +char *findregexp(char *egreppat); +char *findstring(char *pattern); +char *inviewpath(char *file); +char *lookup(char *ident); +char *pathcomponents(char *path, int components); +char *read_block(void); +char *scanpast(char c); + + +void addcmd(int f, char *s); +void addsrcfile(char *path); +void askforchar(void); +void askforreturn(void); +void atchange(void); +void atfield(void); +void cannotwrite(char *file); +void cannotopen(char *file); +void clearmsg(void); +void clearmsg2(void); +void countrefs(void); +void crossref(char *srcfile); +void dispinit(void); +void display(void); +void drawscrollbar(int top, int bot); +void edit(char *file, char *linenum); +void editall(void); +void editref(int); +void entercurses(void); +void exitcurses(void); +void findcleanup(void); +void freesrclist(void); +void freeinclist(void); +void freecrossref(void); +void freefilelist(void); +void help(void); +void incfile(char *file, char *type); +void includedir(char *_dirname); +void initsymtab(void); +void makefilelist(void); +void mousecleanup(void); +void mousemenu(void); +void mouseinit(void); +void mousereinit(void); +void myexit(int sig); +void myperror(char *text); +void ogsnames(char *file, char **subsystem, char **book); +void progress(char *what, long current, long max); +void putfilename(char *srcfile); +void postmsg(char *msg); +void postmsg2(char *msg); +void posterr(char *msg,...); +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); +void setfield(void); +void shellpath(char *out, int limit, char *in); +void sourcedir(char *dirlist); +void myungetch(int c); +void warning(char *text); +void writestring(char *s); + +BOOL command(int commandc); +BOOL infilelist(char *file); +BOOL readrefs(char *filename); +BOOL search(void); +BOOL writerefsfound(void); + +FINDINIT findinit(char *pattern); +MOUSE *getmouseaction(char leading_char); +struct cmd *currentcmd(void); +struct cmd *prevcmd(void); +struct cmd *nextcmd(void); + +int egrep(char *file, FILE *output, char *format); +int mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless); +int mygetch(void); +int hash(char *ss); +int execute(char *a, ...); +long dbseek(long offset); + + +#endif /* CSCOPE_GLOBAL_H */ diff --git a/src/gmacs.ml b/src/gmacs.ml new file mode 100644 index 0000000..514e542 --- /dev/null +++ b/src/gmacs.ml @@ -0,0 +1,65 @@ + ; =========================================================================== + ; 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: gmacs.ml,v 1.1 2000/04/27 16:33:47 petr Exp $ + + + ; cscope.ml (s.cscope.ml) - 1.4 (2/21/84 14:53:58) + ; + ; Macro to handle invocation of gmacs by cscope from the + ; experimental tools. Cscope invokes gmacs with two arguments: + ; + ; gmacs +line file + ; + ; This macro gobbles the line number, visits the specified file, + ; and moves to the specified line number. + +(progn + args + pluses + (setq pluses 0) + (setq args (argc)) + (if (> args 1) + (progn + (if (= (string-to-char "+") (string-to-char (argv 1))) + (setq pluses 1) + ) + (setq args (- args 1)) + (while (> args pluses) + (visit-file (argv args)) + (setq args (- args 1)) + ) + (if (= (> (argc) 2) (> pluses 0)) + (goto-line (argv 1)) + ) + ) + ) +) diff --git a/src/gscope.c b/src/gscope.c new file mode 100644 index 0000000..59f58bd --- /dev/null +++ b/src/gscope.c @@ -0,0 +1 @@ +/* Place holder file --- replace with actual gscope if you integrate it! */ diff --git a/src/help.c b/src/help.c new file mode 100644 index 0000000..26d1db7 --- /dev/null +++ b/src/help.c @@ -0,0 +1,151 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * display help + * + */ + +#include "global.h" +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +/* + max num of lines of help screen - + this number needs to be increased if more than n help items are needed +*/ +#define MAXHELP 50 /* maximum number of help strings */ + +static char const rcsid[] = "$Id: help.c,v 1.6 2005/04/29 18:44:31 broeker Exp $"; + +void +help(void) +{ + char **ep, *s, **tp, *text[MAXHELP]; + int ln; + + tp = text; + if (changing == NO) { + if (mouse) { + *tp++ = "Point with the mouse and click button 1 to move to the desired input field,\n"; + *tp++ = "type the pattern to search for, and then press the RETURN key. For the first 4\n"; + *tp++ = "and last 2 input fields, the pattern can be a regcomp(3) regular expression.\n"; + *tp++ = "If the search is successful, you can edit the file containing a displayed line\n"; + *tp++ = "by pointing with the mouse and clicking button 1.\n"; + *tp++ = "\nYou can either use the button 2 menu or these single-character commands:\n\n"; + } else { + *tp++ = "Press the RETURN key repeatedly to move to the desired input field, type the\n"; + *tp++ = "pattern to search for, and then press the RETURN key. For the first 4 and\n"; + *tp++ = "last 2 input fields, the pattern can be a regcomp(3) regular expression.\n"; + *tp++ = "If the search is successful, you can use these single-character commands:\n\n"; + *tp++ = "0-9a-zA-Z\tEdit the file containing the displayed line.\n"; + } + *tp++ = "space bar\tDisplay next set of matching lines.\n"; + *tp++ = "+\t\tDisplay next set of matching lines.\n"; + *tp++ = "^V\t\tDisplay next set of matching lines.\n"; + *tp++ = "-\t\tDisplay previous set of matching lines.\n"; + *tp++ = "^E\t\tEdit all lines.\n"; + *tp++ = ">\t\tWrite the list of lines being displayed to a file.\n"; + *tp++ = ">>\t\tAppend the list of lines being displayed to a file.\n"; + *tp++ = "<\t\tRead lines from a file.\n"; + *tp++ = "^\t\tFilter all lines through a shell command.\n"; + *tp++ = "|\t\tPipe all lines to a shell command.\n"; + if (!mouse) { + *tp++ = "\nAt any time you can use these single-character commands:\n\n"; + *tp++ = "TAB\t\tSwap positions between input and output areas.\n"; + *tp++ = "RETURN\t\tMove to the next input field.\n"; + *tp++ = "^N\t\tMove to the next input field.\n"; + *tp++ = "^P\t\tMove to the previous input field.\n"; + } + *tp++ = "^Y / ^A\t\tSearch with the last pattern typed.\n"; + *tp++ = "^B\t\tRecall previous input field and search pattern.\n"; + *tp++ = "^F\t\tRecall next input field and search pattern.\n"; + if(caseless) + *tp++ = "^C\t\tToggle ignore/use letter case when searching (IGNORE).\n"; + else + *tp++ = "^C\t\tToggle ignore/use letter case when searching (USE).\n"; + *tp++ = "^R\t\tRebuild the cross-reference.\n"; + *tp++ = "!\t\tStart an interactive shell (type ^D to return to cscope).\n"; + *tp++ = "^L\t\tRedraw the screen.\n"; + *tp++ = "?\t\tDisplay this list of commands.\n"; + *tp++ = "^D\t\tExit cscope.\n"; + *tp++ = "\nNote: If the first character of the pattern you want to search for matches\n"; + *tp++ = "a command, type a \\ character first.\n"; + *tp++ = "Note: Some ctrl keys may be occupied by your terminal configuration.\n"; + } else { + if (mouse) { + *tp++ = "Point with the mouse and click button 1 to mark or unmark the line to be\n"; + *tp++ = "changed. You can also use the button 2 menu or these single-character\n"; + *tp++ = "commands:\n\n"; + } + else { + *tp++ = "When changing text, you can use these single-character commands:\n\n"; + *tp++ = "0-9a-zA-Z\tMark or unmark the line to be changed.\n"; + } + *tp++ = "*\t\tMark or unmark all displayed lines to be changed.\n"; + *tp++ = "space bar\tDisplay next set of lines.\n"; + *tp++ = "+\t\tDisplay next set of lines.\n"; + *tp++ = "-\t\tDisplay previous set of lines.\n"; + *tp++ = "^A\t\tMark or unmark all lines to be changed.\n"; + *tp++ = "^D\t\tChange the marked lines and exit.\n"; + *tp++ = "ESC\t\tExit without changing the marked lines.\n"; + *tp++ = "!\t\tStart an interactive shell (type ^D to return to cscope).\n"; + *tp++ = "^L\t\tRedraw the screen.\n"; + *tp++ = "?\t\tDisplay this list of commands.\n"; + } + /* print help, a screen at a time */ + ep = tp; + ln = 0; + for (tp = text; tp < ep; ) { + if (ln < LINES - 1) { + for (s = *tp; *s != '\0'; ++s) { + if (*s == '\n') { + ++ln; + } + } + (void) addstr(*tp++); + } + else { + (void) addstr("\n"); + askforchar(); + (void) clear(); + ln = 0; + } + } + if (ln) { + (void) addstr("\n"); + askforchar(); + } +} diff --git a/src/history.c b/src/history.c new file mode 100644 index 0000000..3733c26 --- /dev/null +++ b/src/history.c @@ -0,0 +1,105 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol or text cross-reference + * + * command history + */ + +#include "global.h" + +#include "alloc.h" + +static char const rcsid[] = "$Id: history.c,v 1.3 2006/07/23 20:59:20 broeker Exp $"; + +static struct cmd *tail, *current; + +/* add a cmd to the history list */ +void +addcmd(int f, char *s) /* field number and command text */ +{ + struct cmd *h; + + h = mymalloc(sizeof(struct cmd)); + if( tail) { + tail->next = h; + h->next = 0; + h->prev = tail; + tail = h; + } else { + tail = h; + h->next = h->prev = 0; + } + h->field = f; + h->text = my_strdup( s); + current = 0; +} + +/* return previous history item */ +struct cmd * +prevcmd(void) +{ + if( current) { + if( current->prev) /* stay on first item */ + return current = current->prev; + else + return current; + } else if( tail) + return current = tail; + else + return NULL; +} + +/* return next history item */ +struct cmd * +nextcmd(void) +{ + if( current) { + if( current->next) /* stay on first item */ + return current = current->next; + else + return current; + } else + return NULL; +} +/* reset current to tail */ +void +resetcmd(void) +{ + current = 0; +} + +struct cmd * +currentcmd(void) +{ + return current; +} diff --git a/src/input.c b/src/input.c new file mode 100644 index 0000000..79d7431 --- /dev/null +++ b/src/input.c @@ -0,0 +1,335 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * terminal input functions + */ + +#include "global.h" +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +#include <setjmp.h> /* jmp_buf */ +#include <stdlib.h> +#include <errno.h> +#if HAVE_SYS_TERMIOS_H +#include <sys/termios.h> +#endif + +static char const rcsid[] = "$Id: input.c,v 1.15 2006/08/20 15:00:34 broeker Exp $"; + +static jmp_buf env; /* setjmp/longjmp buffer */ +static int prevchar; /* previous, ungotten character */ + +/* Internal prototypes: */ +static RETSIGTYPE catchint(int sig); + +/* catch the interrupt signal */ + +/*ARGSUSED*/ +static RETSIGTYPE +catchint(int sig) +{ + (void) sig; /* 'use' it, to avoid a warning */ + + signal(SIGINT, catchint); + longjmp(env, 1); +} + +/* unget a character */ +void +myungetch(int c) +{ + prevchar = c; +} + +/* get a character from the terminal */ +int +mygetch(void) +{ + sighandler_t savesig; /* old value of signal */ + int c; + + /* change an interrupt signal to a break key character */ + if (setjmp(env) == 0) { + savesig = signal(SIGINT, catchint); + refresh(); /* update the display */ + mousereinit(); /* curses can change the menu number */ + if(prevchar) { + c = prevchar; + prevchar = 0; + } else { + c = -1; + while (c == -1) { + /* get a character from the terminal */ + c = getch(); + if ((c == -1) && (errno != EINTR)) + break; + } + } + } else { /* longjmp to here from signal handler */ + c = KEY_BREAK; + } + signal(SIGINT, savesig); + return(c); +} + + +/* get a line from the terminal in non-canonical mode */ +int +mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless) +{ + int c; + unsigned int i = 0, j; + char *sright; /* substring to the right of the cursor */ + unsigned int ri = 0; /* position in right-string */ + + /* Inserts and deletes are always performed on the left-string, + * but we'll also have a right-string 'sright' to hold characters + * which are on the right of the cursor [insertion point]. + * + * Think of 'sright' as a stack -- we push chars into it when the cursor + * moves left, and we pop chars off it when the cursor moves right again. + * At the end of the function, we'll pop off any remaining characters + * onto the end of 's' + */ + sright = calloc(sizeof(char), size ); + + strcpy ( s, p); + i += strlen(p); + /* if a character already has been typed */ + if (firstchar != '\0') { + if(iscaseless == YES) { + firstchar = tolower(firstchar); + } + addch(firstchar); /* display it */ + s[i++] = firstchar; /* save it */ + } + /* until the end of the line is reached */ + while ((c = mygetch()) != '\r' && c != '\n' && c != KEY_ENTER) { + if (c == KEY_LEFT || c == ctrl('B')) { /* left */ + if (i > 0) { + addch('\b'); + /* move this char into the second (rhs) string */ + sright[ri++] = s[--i]; + } + } else if (c == KEY_RIGHT || c == ctrl('F')) { /* right */ + if (i < size && ri > 0) { + /* move this char to the left of the cursor */ + s[i++] = sright[--ri]; + addch(s[i-1]); + } + } else if ( +#ifdef KEY_HOME + c == KEY_HOME || +#endif + c == ctrl('A') ) { + while (i > 0) { + sright[ri++] = s[--i]; + addch('\b'); + addch(s[i]); + addch('\b'); + } + } else if ( +#ifdef KEY_END + c == KEY_END || +#endif + c == ctrl('E') ) { + while (ri > 0) { + s[i++] = sright[--ri]; + addch(s[i-1]); + } + } else if (c == erasechar() || c == KEY_BACKSPACE + || c == DEL || c == ctrl('H') ) { + /* erase */ + if (i > 0) { + if (ri == 0) { + addstr("\b \b"); + } else { + addch('\b'); + delch(); + } + s[i] = '\0'; + --i; + } + } else if (c == killchar() || c == KEY_BREAK) { + /* kill */ + for (j = 0; j < i; ++j) { + addch('\b'); + } + for (j = 0; j < i; ++j) { + addch(' '); + } + for (j = 0; j < i; ++j) { + addch('\b'); + } + i = 0; + } else if (isprint(c) || c == '\t') { + /* printable */ + if(iscaseless == YES) { + c = tolower(c); + } + /* if it will fit on the line */ + if (i < size) { + s[i++] = c; /* save it */ + if (ri == 0) { + addch(c); /* display it */ + } else { + insch(c); /* display it */ + addch(c); /* advance cursor */ + } + } +#if UNIXPC + } else if (unixpcmouse == YES && c == ESC) { /* mouse */ + getmouseaction(ESC); /* ignore it */ +#endif + } else if (mouse == YES && c == ctrl('X')) { + getmouseaction(ctrl('X')); /* ignore it */ + } else if (c == EOF) { /* end-of-file */ + break; + } + + /* return on an empty line to allow a command to be entered */ + if (firstchar != '\0' && (i+ri) == 0) { + break; + } + } + + /* move any remaining chars on the rhs of the cursor + * onto the end of our string + */ + while (ri > 0) { + s[i++] = sright[--ri]; + } + free(sright); + + s[i] = '\0'; + return(i); +} + +/* ask user to enter a character after reading the message */ + +void +askforchar(void) +{ + addstr("Type any character to continue: "); + mygetch(); +} + +/* ask user to press the RETURN key after reading the message */ + +void +askforreturn(void) +{ + fprintf(stderr, "Press the RETURN key to continue: "); + getchar(); + /* HBB 20060419: message probably messed up the screen --- redraw */ + if (incurses == YES) { + redrawwin(curscr); + } +} + +/* expand the ~ and $ shell meta characters in a path */ + +void +shellpath(char *out, int limit, char *in) +{ + char *lastchar; + char *s, *v; + + /* skip leading white space */ + while (isspace((unsigned char)*in)) { + ++in; + } + lastchar = out + limit - 1; + + /* a tilde (~) by itself represents $HOME; followed by a name it + represents the $LOGDIR of that login name */ + if (*in == '~') { + *out++ = *in++; /* copy the ~ because it may not be expanded */ + + /* get the login name */ + s = out; + while (s < lastchar && *in != '/' && *in != '\0' && !isspace((unsigned char)*in)) { + *s++ = *in++; + } + *s = '\0'; + + /* if the login name is null, then use $HOME */ + 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); + } + } + /* get the rest of the path */ + while (out < lastchar && *in != '\0' && !isspace((unsigned char)*in)) { + + /* look for an environment variable */ + if (*in == '$') { + *out++ = *in++; /* copy the $ because it may not be expanded */ + + /* get the variable name */ + s = out; + while (s < lastchar && *in != '/' && *in != '\0' && + !isspace((unsigned char)*in)) { + *s++ = *in++; + } + *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); + } + } + else { /* ordinary character */ + *out++ = *in++; + } + } + *out = '\0'; +} diff --git a/src/invlib.c b/src/invlib.c new file mode 100644 index 0000000..c846f16 --- /dev/null +++ b/src/invlib.c @@ -0,0 +1,1180 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#if SHARE +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#define ERR -1 +#endif +#include "invlib.h" +#include "global.h" + +#include <assert.h> + +#define DEBUG 0 /* debugging code and realloc messages */ +#define BLOCKSIZE 2 * BUFSIZ /* logical block size */ +#define POSTINC 10000 /* posting buffer size increment */ +#define SEP ' ' /* sorted posting field separator */ +#define SETINC 100 /* posting set size increment */ +#define STATS 0 /* print statistics */ +#define SUPERINC 10000 /* super index size increment */ +#define TERMMAX 512 /* term max size */ +#define FMTVERSION 1 /* inverted index format version */ +#define ZIPFSIZE 200 /* zipf curve size */ + +static char const rcsid[] = "$Id: invlib.c,v 1.18 2006/09/30 15:38:16 broeker Exp $"; + +#if DEBUG +/* FIXME HBB 20010705: nowhere in the source is `invbreak' ever set to + * a value other than the (silent) initialization to zero. Pretty + * useless, that looks */ +int invbreak; +#endif + +static int boolready(void); +static int invnewterm(void); +static void invstep(INVCONTROL *invcntl); +static void invcannotalloc(unsigned n); +static void invcannotopen(char *file); +static void invcannotwrite(char *file); + +#if STATS +int showzipf; /* show postings per term distribution */ +#endif + +static POSTING *item, *enditem, *item1 = NULL, *item2 = NULL; +static unsigned setsize1, setsize2; +static long numitems, totterm, zerolong; +static char *indexfile, *postingfile; +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; +static char *SUPFING, *supfing; +static char thisterm[TERMMAX]; +typedef union logicalblk { + long invblk[BLOCKSIZE / sizeof(long)]; + char chrblk[BLOCKSIZE]; +} t_logicalblk; +static t_logicalblk logicalblk; + +#if DEBUG || STATS +static long totpost; +#endif + +#if STATS +static int zipf[ZIPFSIZE + 1]; +#endif + +long +invmake(char *invname, char *invpost, FILE *infile) +{ + unsigned char *s; + long num; + int i; + long fileindex = 0; /* initialze, to avoid warning */ + unsigned postsize = POSTINC * sizeof(POSTING); + unsigned long *intptr; + char line[TERMMAX]; + long tlong; + PARAM param; + POSTING posting; + char temp[BLOCKSIZE]; +#if STATS + int j; + unsigned maxtermlen = 0; +#endif + /* output file */ + if ((outfile = vpfopen(invname, "w+b")) == NULL) { + invcannotopen(invname); + return(0); + } + indexfile = invname; + fseek(outfile, BUFSIZ, SEEK_SET); + + /* posting file */ + if ((fpost = vpfopen(invpost, "wb")) == NULL) { + invcannotopen(invpost); + return(0); + } + postingfile = invpost; + nextpost = 0; + /* get space for the postings list */ + if ((POST = malloc(postsize)) == NULL) { + invcannotalloc(postsize); + return(0); + } + postptr = POST; + /* get space for the superfinger (superindex) */ + if ((SUPFING = malloc(supersize)) == NULL) { + invcannotalloc(supersize); + return(0); + } + supfing = SUPFING; + /* FIXME HBB: magic number alert (40) */ + supintsize = supersize / 40; + /* also for the superfinger index */ + if ((SUPINT = malloc(supintsize * sizeof(long))) == NULL) { + invcannotalloc(supintsize * sizeof(long)); + return(0); + } + supint = SUPINT; + supint++; /* leave first term open for a count */ + /* initialize using an empty term */ + strcpy(thisterm, ""); + *supint++ = 0; + *supfing++ = ' '; + *supfing++ = '\0'; + nextsupfing = 2; +#if DEBUG || STATS + totpost = 0L; +#endif + totterm = 0L; + numpost = 1; + + /* set up as though a block had come and gone, i.e., set up for new block */ + /* FIXME HBB: magic number alert (16) */ + amtused = 16; /* leave no space - init 3 words + one for luck */ + numinvitems = 0; + numlogblk = 0; + lastinblk = sizeof(t_logicalblk); + + /* now loop as long as more to read (till eof) */ + while (fgets(line, TERMMAX, infile) != NULL) { +#if DEBUG || STATS + ++totpost; +#endif + s = strchr(line, SEP); + if (s != NULL) { + *s = '\0'; + } + else { + continue; + } +#if STATS + if ((i = strlen(line)) > maxtermlen) { + maxtermlen = i; + } +#endif +#if DEBUG + printf("%ld: %s ", totpost, line); + fflush(stdout); +#endif + if (strcmp(thisterm, line) == 0) { + if (postptr + 10 > POST + postsize / sizeof(POSTING)) { + i = postptr - POST; + postsize += POSTINC * sizeof(POSTING); + if ((POST = realloc(POST, postsize)) == NULL) { + invcannotalloc(postsize); + return(0); + } + postptr = i + POST; +#if DEBUG + printf("reallocated post space to %u, totpost=%ld\n", + postsize, totpost); +#endif + } + numpost++; + } else { + /* have a new term */ + if (!invnewterm()) { + return(0); + } + strcpy(thisterm, line); + numpost = 1; + postptr = POST; + fileindex = 0; + } + /* get the new posting */ + num = *++s - '!'; + i = 1; + do { + num = BASE * num + *++s - '!'; + } while (++i < PRECISION); + posting.lineoffset = num; + while (++fileindex < nsrcoffset && num > srcoffset[fileindex]) { + ; + } + posting.fileindex = --fileindex; + posting.type = *++s; + num = *++s - '!'; + if (*s != '\n') { + num = *++s - '!'; + while (*++s != '\n') { + num = BASE * num + *s - '!'; + } + posting.fcnoffset = num; + } + else { + posting.fcnoffset = 0; + } + *postptr++ = posting; +#if DEBUG + printf("%ld %ld %ld %ld\n", posting.fileindex, + posting.fcnoffset, posting.lineoffset, posting.type); + fflush(stdout); +#endif + } + if (!invnewterm()) { + return(0); + } + /* now clean up final block */ + logicalblk.invblk[0] = numinvitems; + /* loops pointer around to start */ + logicalblk.invblk[1] = 0; + logicalblk.invblk[2] = numlogblk - 1; + if (fwrite(&logicalblk, sizeof(t_logicalblk), 1, outfile) == 0) { + goto cannotwrite; + } + numlogblk++; + /* write out block to save space. what in it doesn't matter */ + if (fwrite(&logicalblk, sizeof(t_logicalblk), 1, outfile) == 0) { + goto cannotwrite; + } + /* finish up the super finger */ + *SUPINT = numlogblk; + /* add to the offsets the size of the offset pointers */ + intptr = (SUPINT + 1); + i = (char *)supint - (char *)SUPINT; + while (intptr < supint) + *intptr++ += i; + /* write out the offsets (1 for the N at start) and the super finger */ + if (fwrite(SUPINT, sizeof(*SUPINT), numlogblk + 1, outfile) == 0 || + fwrite(SUPFING, 1, supfing - SUPFING, outfile) == 0) { + goto cannotwrite; + } + /* save the size for reference later */ + nextsupfing = sizeof(long) + sizeof(long) * numlogblk + (supfing - SUPFING); + /* make sure the file ends at a logical block boundary. This is + necessary for invinsert to correctly create extended blocks + */ + i = nextsupfing % sizeof(t_logicalblk); + /* write out junk to fill log blk */ + if (fwrite(temp, sizeof(t_logicalblk) - i, 1, outfile) == 0 || + fflush(outfile) == EOF) { /* rewind doesn't check for write failure */ + goto cannotwrite; + } + /* write the control area */ + rewind(outfile); + param.version = FMTVERSION; + param.filestat = 0; + param.sizeblk = sizeof(t_logicalblk); + param.startbyte = (numlogblk + 1) * sizeof(t_logicalblk) + BUFSIZ;; + param.supsize = nextsupfing; + param.cntlsize = BUFSIZ; + param.share = 0; + if (fwrite(¶m, sizeof(param), 1, outfile) == 0) { + goto cannotwrite; + } + for (i = 0; i < 10; i++) /* for future use */ + if (fwrite(&zerolong, sizeof(zerolong), 1, outfile) == 0) { + goto cannotwrite; + } + + /* make first block loop backwards to last block */ + if (fflush(outfile) == EOF) { /* fseek doesn't check for write failure */ + goto cannotwrite; + } + /* get to second word first block */ + fseek(outfile, BUFSIZ + 2 * sizeof(long), SEEK_SET); + tlong = numlogblk - 1; + if (fwrite(&tlong, sizeof(tlong), 1, outfile) == 0 || + fclose(outfile) == EOF) { + cannotwrite: + invcannotwrite(invname); + return(0); + } + if (fclose(fpost) == EOF) { + invcannotwrite(postingfile); + return(0); + } + --totterm; /* don't count null term */ +#if STATS + printf("logical blocks = %d, postings = %ld, terms = %ld, max term length = %d\n", + numlogblk, totpost, totterm, maxtermlen); + if (showzipf) { + printf("\n************* ZIPF curve ****************\n"); + for (j = ZIPFSIZE; j > 1; j--) + if (zipf[j]) + break; + for (i = 1; i < j; ++i) { + printf("%3d -%6d ", i, zipf[i]); + if (i % 6 == 0) putchar('\n'); + } + printf(">%d-%6d\n", ZIPFSIZE, zipf[0]); + } +#endif + /* free all malloc'd memory */ + free(POST); + free(SUPFING); + free(SUPINT); + return(totterm); +} + +/* add a term to the data base */ + +static int +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-- > 1) { + 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); +} + +/* + * If 'invname' ends with the 'from' substring, it is replaced inline with the + * 'to' substring (which must be of the exact same length), and the function + * returns 0. Otherwise, returns -1. + */ + +static int +invflipname(char * invname, const char *from, const char *to) +{ + char *temp, *i = NULL; + + assert(strlen(from) == strlen(to)); + + temp = invname - 1; + while( (temp = strstr(temp + 1, from))) + i = temp; + if (!i || i[strlen(from)] != '\0') + return -1; + while(*to) + *i++ = *to++; + return 0; +} + +int +invopen(INVCONTROL *invcntl, char *invname, char *invpost, int stat) +{ + int read_index; + + if ((invcntl->invfile = vpfopen(invname, ((stat == 0) ? "rb" : "r+b"))) == NULL) { + /* If db created without '-f', but now invoked with '-f cscope.out', + * we need to check for 'cscope.in.out', rather than 'cscope.out.in': + * I.e, hack around our own violation of the inverse db naming convention */ + if (!invflipname(invname, INVNAME2, INVNAME)) { + if ((invcntl->invfile = vpfopen(invname, ((stat == 0) ? "rb" : "r+b")))) + goto openedinvname; + invflipname(invname, INVNAME, INVNAME2); /* change back for err msg */ + } + /* more silliness: if you create the db with '-f cscope', then try to open + * it without '-f cscope', you'll fail unless we check for 'cscope.out.in' + * here. */ + else if (!invflipname(invname, INVNAME, INVNAME2)) { + if ((invcntl->invfile = vpfopen(invname, ((stat == 0) ? "rb" : "r+b")))) + goto openedinvname; + invflipname(invname, INVNAME2, INVNAME); /* change back for err msg */ + } + invcannotopen(invname); + return(-1); + } +openedinvname: + if (fread(&invcntl->param, sizeof(invcntl->param), 1, invcntl->invfile) == 0) { + fprintf(stderr, "%s: empty inverted file\n", argv0); + goto closeinv; + } + if (invcntl->param.version != FMTVERSION) { + fprintf(stderr, "%s: cannot read old index format; use -U option to force database to rebuild\n", argv0); + goto closeinv; + } + assert(invcntl->param.sizeblk == sizeof(t_logicalblk)); + + if (stat == 0 && invcntl->param.filestat == INVALONE) { + fprintf(stderr, "%s: inverted file is locked\n", argv0); + goto closeinv; + } + if ((invcntl->postfile = vpfopen(invpost, ((stat == 0) ? "rb" : "r+b"))) == NULL) { + /* exact same naming convention hacks as above for invname */ + if (!invflipname(invpost, INVPOST2, INVPOST)) { + if ((invcntl->postfile = vpfopen(invpost, ((stat == 0) ? "rb" : "r+b")))) + goto openedinvpost; + invflipname(invpost, INVPOST, INVPOST2); /* change back for err msg */ + } else if (!invflipname(invpost, INVPOST, INVPOST2)) { + if ((invcntl->postfile = vpfopen(invpost,((stat == 0)?"rb":"r+b")))) + goto openedinvpost; + invflipname(invpost, INVPOST2, INVPOST); /* change back for err msg */ + } + invcannotopen(invpost); + goto closeinv; + } +openedinvpost: + /* allocate core for a logical block */ + if ((invcntl->logblk = malloc((unsigned) invcntl->param.sizeblk)) == NULL) { + invcannotalloc((unsigned) invcntl->param.sizeblk); + goto closeboth; + } + /* allocate for and read in superfinger */ + read_index = 1; + invcntl->iindex = NULL; +#if SHARE + if (invcntl->param.share == 1) { + key_t shm_key; + struct shmid_ds shm_buf; + int shm_id; + + /* see if the shared segment exists */ + shm_key = ftok(invname, 2); + shm_id = shmget(shm_key, 0, 0); + /* Failure simply means (hopefully) that segment doesn't exists */ + if (shm_id == -1) { + /* Have to give general write permission due to AMdahl not having protected segments */ + shm_id = shmget(shm_key, invcntl->param.supsize + sizeof(long), IPC_CREAT | 0666); + if (shm_id == -1) + perror("Could not create shared memory segment"); + } else + read_index = 0; + + if (shm_id != -1) { + invcntl->iindex = shmat(shm_id, 0, ((read_index) ? 0 : SHM_RDONLY)); + if (invcntl->iindex == (char *)ERR) { + fprintf(stderr, "%s: shared memory link failed\n", argv0); + invcntl->iindex = NULL; + read_index = 1; + } + } + } +#endif + if (invcntl->iindex == NULL) + /* FIXME HBB: magic number alert (4) */ + invcntl->iindex = malloc((unsigned) invcntl->param.supsize + + 4 *sizeof(long)); + if (invcntl->iindex == NULL) { + invcannotalloc((unsigned) invcntl->param.supsize); + free(invcntl->logblk); + goto closeboth; + } + if (read_index) { + fseek(invcntl->invfile, invcntl->param.startbyte, SEEK_SET); + fread(invcntl->iindex, (int) invcntl->param.supsize, 1, + invcntl->invfile); + } + invcntl->numblk = -1; + if (boolready() == -1) { + closeboth: + fclose(invcntl->postfile); + closeinv: + fclose(invcntl->invfile); + return(-1); + } + /* write back out the control block if anything changed */ + invcntl->param.filestat = stat; + if (stat > invcntl->param.filestat ) { + rewind(invcntl->invfile); + fwrite(&invcntl->param, sizeof(invcntl->param), 1, invcntl->invfile); + } + return(1); +} + +/** invclose must be called to wrap things up and deallocate core **/ +void +invclose(INVCONTROL *invcntl) +{ + /* write out the control block in case anything changed */ + if (invcntl->param.filestat > 0) { + invcntl->param.filestat = 0; + rewind(invcntl->invfile); + fwrite(&invcntl->param, 1, + sizeof(invcntl->param), invcntl->invfile); + } + if (invcntl->param.filestat == INVALONE) { + /* write out the super finger */ + fseek(invcntl->invfile, invcntl->param.startbyte, SEEK_SET); + fwrite(invcntl->iindex, 1, + (int) invcntl->param.supsize, invcntl->invfile); + } + fclose(invcntl->invfile); + fclose(invcntl->postfile); +#if SHARE + if (invcntl->param.share > 0) { + shmdt(invcntl->iindex); + invcntl->iindex = NULL; + } +#endif + if (invcntl->iindex != NULL) + free(invcntl->iindex); + free(invcntl->logblk); +} + +/** invstep steps the inverted file forward one item **/ +static void +invstep(INVCONTROL *invcntl) +{ + if (invcntl->keypnt < (invcntl->logblk->invblk[0] - 1)) { + invcntl->keypnt++; + return; + } + + /* move forward a block else wrap */ + invcntl->numblk = invcntl->logblk->invblk[1]; /* was: *(int *)(invcntl->logblk + sizeof(long))*/ + + /* now read in the block */ + fseek(invcntl->invfile, + invcntl->numblk*invcntl->param.sizeblk + invcntl->param.cntlsize, + SEEK_SET); + fread(invcntl->logblk, (int) invcntl->param.sizeblk, 1, + invcntl->invfile); + invcntl->keypnt = 0; +} + +/** invforward moves forward one term in the inverted file **/ +int +invforward(INVCONTROL *invcntl) +{ + invstep(invcntl); + /* skip things with 0 postings */ + /* FIXME HBB: magic number alert! (3) */ + while (((ENTRY * )(invcntl->logblk->invblk + 3) + invcntl->keypnt)->post == 0) { + invstep(invcntl); + } + /* Check for having wrapped - reached start of inverted file! */ + if ((invcntl->numblk == 0) && (invcntl->keypnt == 0)) + return(0); + return(1); +} + +/** invterm gets the present term from the present logical block **/ +long +invterm(INVCONTROL *invcntl, char *term) +{ + ENTRY * entryptr; + + /* FIXME HBB: magic number alert! (3) */ + entryptr = (ENTRY *)(invcntl->logblk->invblk + 3) + invcntl->keypnt; + strncpy(term, invcntl->logblk->chrblk + entryptr->offset, + (int) entryptr->size); + *(term + entryptr->size) = '\0'; + return(entryptr->post); +} + +/** invfind searches for an individual item in the inverted file **/ +long +invfind(INVCONTROL *invcntl, char *searchterm) /* term being searched for */ +{ + int imid, ilow, ihigh; + long num; + int i; + unsigned long *intptr, *intptr2; + ENTRY *entryptr; + + /* make sure it is initialized via invready */ + if (invcntl->invfile == 0) + return(-1L); + + /* now search for the appropriate finger block */ + intptr = (unsigned long *)invcntl->iindex; + + ilow = 0; + ihigh = *intptr++ - 1; + while (ilow <= ihigh) { + imid = (ilow + ihigh) / 2; + intptr2 = intptr + imid; + i = strcmp(searchterm, (invcntl->iindex + *intptr2)); + if (i < 0) + ihigh = imid - 1; + else if (i > 0) + ilow = ++imid; + else { + ilow = imid + 1; + break; + } + } + /* be careful about case where searchterm is after last in this block */ + imid = (ilow) ? ilow - 1 : 0; + + /* fetch the appropriate logical block if not in core */ + /* note always fetch it if the file is busy */ + if ((imid != invcntl->numblk) || (invcntl->param.filestat >= INVBUSY)) { + fseek(invcntl->invfile, + (imid*invcntl->param.sizeblk) + invcntl->param.cntlsize, + SEEK_SET); + invcntl->numblk = imid; + fread(invcntl->logblk, (int)invcntl->param.sizeblk, 1, + invcntl->invfile); + } + +srch_ext: + /* now find the term in this block. tricky this */ + intptr = (unsigned long *) invcntl->logblk->invblk; + + ilow = 0; + ihigh = *intptr - 1; + intptr += 3; + num = 0; + while (ilow <= ihigh) { + imid = (ilow + ihigh) / 2; + entryptr = (ENTRY *)intptr + imid; + i = strncmp(searchterm, invcntl->logblk->chrblk + entryptr->offset, + (int) entryptr->size ); + if (i == 0) + i = strlen(searchterm) - entryptr->size; + if (i < 0) + ihigh = imid - 1; + else if (i > 0) + ilow = ++imid; + else { + num = entryptr->post; + break; + } + } + /* be careful about case where searchterm is after last in this block */ + if (imid >= invcntl->logblk->invblk[0]) { + invcntl->keypnt = invcntl->logblk->invblk[0]; + invstep(invcntl); + /* note if this happens the term could be in extended block */ + if (invcntl->param.startbyte < invcntl->numblk * invcntl->param.sizeblk) + goto srch_ext; + } else + invcntl->keypnt = imid; + return(num); +} + +#if DEBUG + +/** invdump dumps the block the term parameter is in **/ +void +invdump(INVCONTROL *invcntl, char *term) +{ + long i, j, n, *longptr; + ENTRY * entryptr; + char temp[512], *ptr; + + /* dump superindex if term is "-" */ + if (*term == '-') { + j = atoi(term + 1); + longptr = (long *)invcntl->iindex; + n = *longptr++; + printf("Superindex dump, num blocks=%ld\n", n); + longptr += j; + while ((longptr <= ((long *)invcntl->iindex) + n) && invbreak == 0) { + printf("%2ld %6ld %s\n", j++, *longptr, invcntl->iindex + *longptr); + longptr++; + } + return; + } else if (*term == '#') { + j = atoi(term + 1); + /* fetch the appropriate logical block */ + invcntl->numblk = j; + fseek(invcntl->invfile, + (j * invcntl->param.sizeblk) + invcntl->param.cntlsize, + SEEK_SET); + fread(invcntl->logblk, (int) invcntl->param.sizeblk, 1, + invcntl->invfile); + } else + i = abs((int) invfind(invcntl, term)); + longptr = invcntl->logblk->invblk; + n = *longptr++; + printf("Entry term to invdump=%s, postings=%ld, forwrd ptr=%ld, back ptr=%ld\n" + , term, i, *(longptr), *(longptr + 1)); + /* FIXME HBB: magic number alert! (3) */ + entryptr = (ENTRY *) (invcntl->logblk->invblk + 3); + printf("%ld terms in this block, block=%ld\n", n, invcntl->numblk); + printf("\tterm\t\t\tposts\tsize\toffset\tspace\t1st word\n"); + for (j = 0; j < n && invbreak == 0; j++) { + ptr = invcntl->logblk->chrblk + entryptr->offset; + strncpy(temp, ptr, (int) entryptr->size); + temp[entryptr->size] = '\0'; + ptr += (sizeof(long) * (long)((entryptr->size + (sizeof(long) - 1)) / sizeof(long))); + printf("%2ld %-24s\t%5ld\t%3d\t%d\t%d\t%ld\n", j, temp, entryptr->post, + entryptr->size, entryptr->offset, entryptr->space, + *(long *)ptr); + entryptr++; + } +} +#endif + +static int +boolready(void) +{ + numitems = 0; + if (item1 != NULL) + free(item1); + setsize1 = SETINC; + if ((item1 = malloc(SETINC * sizeof(POSTING))) == NULL) { + invcannotalloc(SETINC); + return(-1); + } + if (item2 != NULL) + free(item2); + setsize2 = SETINC; + if ((item2 = malloc(SETINC * sizeof(POSTING))) == NULL) { + invcannotalloc(SETINC); + return(-1); + } + item = item1; + enditem = item; + return(0); +} + +void +boolclear(void) +{ + numitems = 0; + item = item1; + enditem = item; +} + +POSTING * +boolfile(INVCONTROL *invcntl, long *num, int boolarg) +{ + ENTRY *entryptr; + FILE *file; + void *ptr; + unsigned long *ptr2; + POSTING *newitem = NULL; /* initialize, to avoid warning */ + POSTING posting; + unsigned u; + POSTING *newsetp = NULL, *set1p; + long newsetc, set1c, set2c; + + /* FIXME HBB: magic number alert! (3) */ + entryptr = (ENTRY *) (invcntl->logblk->invblk + 3) + invcntl->keypnt; + ptr = invcntl->logblk->chrblk + entryptr->offset; + ptr2 = ((unsigned long *) ptr) + (entryptr->size + (sizeof(long) - 1)) / sizeof(long); + *num = entryptr->post; + switch (boolarg) { + case BOOL_OR: + case NOT: + if (*num == 0) { + *num = numitems; + return(item); + } + } + /* make room for the new set */ + u = 0; + switch (boolarg) { + case AND: + case NOT: + newsetp = set1p = item; + break; + + case BOOL_OR: + u = enditem - item; + /* FALLTHROUGH */ + case REVERSENOT: + u += *num; + if (item == item2) { + if (u > setsize1) { + u += SETINC; + if ((item1 = realloc( + item1, u * sizeof(POSTING))) == NULL) { + goto cannotalloc; + } + setsize1 = u; + } + newitem = item1; + } + else { + if (u > setsize2) { + u += SETINC; + if ((item2 = realloc( + item2, u * sizeof(POSTING))) == NULL) { + cannotalloc: + invcannotalloc(u * sizeof(POSTING)); + boolready(); + *num = -1; + return(NULL); + } + setsize2 = u; + } + newitem = item2; + } + set1p = item; + newsetp = newitem; + } + file = invcntl->postfile; + fseek(file, *ptr2, SEEK_SET); + fread(&posting, sizeof(posting), 1, file); + newsetc = 0; + switch (boolarg) { + case BOOL_OR: + /* while something in both sets */ + set1p = item; + newsetp = newitem; + for (set1c = 0, set2c = 0; + set1c < numitems && set2c < *num; newsetc++) { + if (set1p->lineoffset < posting.lineoffset) { + *newsetp++ = *set1p++; + set1c++; + } + else if (set1p->lineoffset > posting.lineoffset) { + *newsetp++ = posting; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else if (set1p->type < posting.type) { + *newsetp++ = *set1p++; + set1c++; + } + else if (set1p->type > posting.type) { + *newsetp++ = posting; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else { /* identical postings */ + *newsetp++ = *set1p++; + set1c++; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + } + /* find out what ran out and move the rest in */ + if (set1c < numitems) { + newsetc += numitems - set1c; + while (set1c++ < numitems) { + *newsetp++ = *set1p++; + } + } else { + while (set2c++ < *num) { + *newsetp++ = posting; + newsetc++; + fread(&posting, (int) sizeof(posting), 1, file); + } + } + item = newitem; + break; /* end of BOOL_OR */ +#if 0 + case AND: + for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) { + if (set1p->lineoffset < posting.lineoffset) { + set1p++; + set1c++; + } + else if (set1p->lineoffset > posting.lineoffset) { + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else if (set1p->type < posting.type) { + *set1p++; + set1c++; + } + else if (set1p->type > posting.type) { + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else { /* identical postings */ + *newsetp++ = *set1p++; + newsetc++; + set1c++; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + } + break; /* end of AND */ + + case NOT: + for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) { + if (set1p->lineoffset < posting.lineoffset) { + *newsetp++ = *set1p++; + newsetc++; + set1c++; + } + else if (set1p->lineoffset > posting.lineoffset) { + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else if (set1p->type < posting.type) { + *newsetp++ = *set1p++; + newsetc++; + set1c++; + } + else if (set1p->type > posting.type) { + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else { /* identical postings */ + set1c++; + set1p++; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + } + newsetc += numitems - set1c; + while (set1c++ < numitems) { + *newsetp++ = *set1p++; + } + break; /* end of NOT */ + + case REVERSENOT: /* core NOT incoming set */ + for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) { + if (set1p->lineoffset < posting.lineoffset) { + set1p++; + set1c++; + } + else if (set1p->lineoffset > posting.lineoffset) { + *newsetp++ = posting; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else if (set1p->type < posting.type) { + set1p++; + set1c++; + } + else if (set1p->type > posting.type) { + *newsetp++ = posting; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + else { /* identical postings */ + set1c++; + set1p++; + fread(&posting, (int) sizeof(posting), 1, file); + set2c++; + } + } + while (set2c++ < *num) { + *newsetp++ = posting; + newsetc++; + fread(&posting, (int) sizeof(posting), 1, file); + } + item = newitem; + break; /* end of REVERSENOT */ +#endif + } + numitems = newsetc; + *num = newsetc; + enditem = (POSTING *) newsetp; + return((POSTING *) item); +} + +#if 0 +POSTING * +boolsave(int clear) /* flag about whether to clear core */ +{ + int i; + POSTING *ptr; + POSTING *oldstuff, *newstuff; + + if (numitems == 0) { + if (clear) + boolclear(); + return(NULL); + } + /* if clear then give them what we have and use boolready to realloc */ + if (clear) { + ptr = item; + /* free up the space we didn't give them */ + if (item == item1) + item1 = NULL; + else + item2 = NULL; + boolready(); + return(ptr); + } + i = (enditem - item) * sizeof(POSTING) + 100; + if ((ptr = malloc(i))r == NULL) { + invcannotalloc(i); + return(ptr); + } + /* move present set into place */ + oldstuff = item; + newstuff = ptr; + while (oldstuff < enditem) + *newstuff++ = *oldstuff++; + return(ptr); +} +#endif + +static void +invcannotalloc(unsigned n) +{ + fprintf(stderr, "%s: cannot allocate %u bytes\n", argv0, n); +} + +static void +invcannotopen(char *file) +{ + fprintf(stderr, "%s: cannot open file %s\n", argv0, file); +} + +static void +invcannotwrite(char *file) +{ + perror(argv0); /* must be first to preserve errno */ + fprintf(stderr, "%s: write to file %s failed\n", argv0, file); +} diff --git a/src/invlib.h b/src/invlib.h new file mode 100644 index 0000000..d394835 --- /dev/null +++ b/src/invlib.h @@ -0,0 +1,118 @@ +/*=========================================================================== + 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: invlib.h,v 1.7 2004/02/12 18:14:05 broeker Exp $ */ + + +#ifndef CSCOPE_INVLIB_H +#define CSCOPE_INVLIB_H + +#include <stdio.h> /* need definition of FILE* */ +#include <limits.h> + +/* inverted index definitions */ + +/* postings temporary file long number coding into characters */ +/* FIXME HBB: where would these definitions come from ? */ +#if CHAR_MAX==255 +# define BASE 223 /* 255 - ' ' */ +# define PRECISION 4 /* maximum digits after converting a long */ +#else +# if CHAR_MAX==127 /* assume sign-extension of a char when converted to an int */ +# define BASE 95 /* 127 - ' ' */ +# define PRECISION 5 /* maximum digits after converting a long */ +# else + #error Need a platform with 8 bits in a char value +# endif +#endif + +/* inverted index access parameters */ +#define INVAVAIL 0 +#define INVBUSY 1 +#define INVALONE 2 + +/* boolean set operations */ +#define BOOL_OR 3 +#define AND 4 +#define NOT 5 +#define REVERSENOT 6 + +/* note that the entire first block is for parameters */ +typedef struct { + long version; /* inverted index format version */ + long filestat; /* file status word */ + long sizeblk; /* size of logical block in bytes */ + long startbyte; /* first byte of superfinger */ + long supsize; /* size of superfinger in bytes */ + long cntlsize; /* size of max cntl space (should be a multiple of BUFSIZ) */ + long share; /* flag whether to use shared memory */ +} PARAM; + +typedef struct { + FILE *invfile; /* the inverted file ptr */ + FILE *postfile; /* posting file ptr */ + PARAM param; /* control parameters for the file */ + char *iindex; /* ptr to space for superindex */ + union logicalblk *logblk; /* ptr to space for a logical block */ + long numblk; /* number of block presently at *logblk */ + long keypnt; /* number item in present block found */ +} INVCONTROL; + +typedef struct { + short offset; /* offset in this logical block */ + unsigned char size; /* size of term */ + unsigned char space; /* number of longs of growth space */ + long post; /* number of postings for this entry */ +} ENTRY; + +typedef struct { + long lineoffset; /* source line database offset */ + long fcnoffset; /* function name database offset */ + long fileindex : 24; /* source file name index */ + long type : 8; /* reference type (mark character) */ +} POSTING; + +extern long *srcoffset; /* source file name database offsets */ +extern int nsrcoffset; /* number of file name database offsets */ + + +void boolclear(void); +POSTING *boolfile(INVCONTROL *invcntl, long *num, int boolarg); +void invclose(INVCONTROL *invcntl); +void invdump(INVCONTROL *invcntl, char *term); +long invfind(INVCONTROL *invcntl, char *searchterm); +int invforward(INVCONTROL *invcntl); +int invopen(INVCONTROL *invcntl, char *invname, char *invpost, int status); +long invmake(char *invname, char *invpost, FILE *infile); +long invterm(INVCONTROL *invcntl, char *term); + +#endif /* CSCOPE_INVLIB_H */ diff --git a/src/library.h b/src/library.h new file mode 100644 index 0000000..af5a5ed --- /dev/null +++ b/src/library.h @@ -0,0 +1,53 @@ +/*=========================================================================== + 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: library.h,v 1.11 2006/07/23 20:59:20 broeker Exp $ */ + +#ifndef CSCOPE_LIBRARY_H +#define CSCOPE_LIBRARY_H + +#include <stdio.h> /* need FILE* type def. */ + +/* private library */ +char *compath(char *pathname); +char *egrepinit(char *egreppat); +char *logdir(char *name); +char *mybasename(char *path); +FILE *myfopen(char *path, char *mode); +char *mygetenv(char *variable, char *deflt); +int myopen(char *path, int flag, int mode); +FILE *mypopen(char *cmd, char *mode); +int mypclose(FILE *ptr); +FILE *vpfopen(char *filename, char *type); +void egrepcaseless(int i); + +#endif /* CSCOPE_LIBRARY_H */ diff --git a/src/logdir.c b/src/logdir.c new file mode 100644 index 0000000..8ed4b40 --- /dev/null +++ b/src/logdir.c @@ -0,0 +1,102 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* + * logdir() + * + * This routine does not use the getpwent(3) library routine + * because the latter uses the stdio package. The allocation of + * storage in this package destroys the integrity of the shell's + * storage allocation. + */ + +#include <unistd.h> +#include <string.h> +#include "global.h" + +#define OURBUFSIZ 160 /* renamed: avoid conflict with <stdio.h> */ + +static char const rcsid[] = "$Id: logdir.c,v 1.5 2002/07/28 15:40:07 broeker Exp $"; + +static char line[OURBUFSIZ+1]; + +/* Internal prototypes: */ +static char *nextfield(char *p); + + +static char * +nextfield(char *p) +{ + while (*p && *p != ':') + ++p; + if (*p) *p++ = 0; + return(p); +} + +char * +logdir(char *name) +{ + char *p; + int i, j; + int pwf; + + /* attempt to open the password file */ + if ((pwf = myopen("/etc/passwd", 0, 0)) == -1) + return(0); + + /* find the matching password entry */ + do { + /* get the next line in the password file */ + i = read(pwf, line, OURBUFSIZ); + for (j = 0; j < i; j++) + if (line[j] == '\n') + break; + /* return a null pointer if the whole file has been read */ + if (j >= i) + return(0); + line[++j] = 0; /* terminate the line */ + (void) lseek(pwf, (long) (j - i), 1); /* point at the next line */ + p = nextfield(line); /* get the logname */ + } while (*name != *line || /* fast pretest */ + strcmp(name, line) != 0); + (void) close(pwf); + + /* skip the intervening fields */ + p = nextfield(p); + p = nextfield(p); + p = nextfield(p); + p = nextfield(p); + + /* return the login directory */ + (void) nextfield(p); + return(p); +} diff --git a/src/lookup.c b/src/lookup.c new file mode 100644 index 0000000..809dff9 --- /dev/null +++ b/src/lookup.c @@ -0,0 +1,151 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * keyword look-up routine for the C symbol scanner + */ + +#include "global.h" +#include "lookup.h" + +static char const rcsid[] = "$Id: lookup.c,v 1.4 2006/04/21 10:45:48 broeker Exp $"; + +/* keyword text for fast testing of keywords in the scanner */ +char enumtext[] = "enum"; +char externtext[] = "extern"; +char structtext[] = "struct"; +char typedeftext[] = "typedef"; +char uniontext[] = "union"; + +/* This keyword table is also used for keyword text compression. Keywords + * with an index less than the numeric value of a space are replaced with the + * control character corresponding to the index, so they cannot be moved + * without changing the database file version and adding compatibility code + * for old databases. + */ +struct keystruct keyword[] = { + {"", '\0', NULL}, /* dummy entry */ + {"#define", ' ', NULL}, /* must be table entry 1 */ + {"#include", ' ', NULL}, /* must be table entry 2 */ + {"break", '\0', NULL}, /* rarely in cross-reference */ + {"case", ' ', NULL}, + {"char", ' ', NULL}, + {"continue", '\0', NULL}, /* rarely in cross-reference */ + {"default", '\0', NULL}, /* rarely in cross-reference */ + {"double", ' ', NULL}, + {"\t", '\0', NULL}, /* must be the table entry 9 */ + {"\n", '\0', NULL}, /* must be the table entry 10 */ + {"else", ' ', NULL}, + {enumtext, ' ', NULL}, + {externtext, ' ', NULL}, + {"float", ' ', NULL}, + {"for", '(', NULL}, + {"goto", ' ', NULL}, + {"if", '(', NULL}, + {"int", ' ', NULL}, + {"long", ' ', NULL}, + {"register", ' ', NULL}, + {"return", '\0', NULL}, + {"short", ' ', NULL}, + {"sizeof", '\0', NULL}, + {"static", ' ', NULL}, + {structtext, ' ', NULL}, + {"switch", '(', NULL}, + {typedeftext, ' ', NULL}, + {uniontext, ' ', NULL}, + {"unsigned", ' ', NULL}, + {"void", ' ', NULL}, + {"while", '(', NULL}, + + /* these keywords are not compressed */ + {"do", '\0', NULL}, + {"auto", ' ', NULL}, + {"fortran", ' ', NULL}, + {"const", ' ', NULL}, + {"signed", ' ', NULL}, + {"volatile", ' ', NULL}, +}; +#define KEYWORDS (sizeof(keyword) / sizeof(struct keystruct)) + +#define HASHMOD (KEYWORDS * 2 + 1) + +static struct keystruct *hashtab[HASHMOD]; /* pointer table */ + +/* put the keywords into the symbol table */ + +void +initsymtab(void) +{ + unsigned int i, j; + struct keystruct *p; + + for (i = 1; i < KEYWORDS; ++i) { + p = keyword + i; + j = hash(p->text) % HASHMOD; + p->next = hashtab[j]; + hashtab[j] = p; + } +} + +/* see if this identifier is a keyword */ + +char * +lookup(char *ident) +{ + struct keystruct *p; + int c; + + /* look up the identifier in the keyword table */ + for (p = hashtab[hash(ident) % HASHMOD]; p != NULL; p = p->next) { + if (strequal(ident, p->text)) { + if (compress == YES && (c = p - keyword) < ' ') { + ident[0] = c; /* compress the keyword */ + } + return(p->text); + } + } + /* this is an identifier */ + return(NULL); +} + +/* form hash value for string */ +int +hash(char *ss) +{ + int i; + unsigned char *s = (unsigned char *)ss; + + for (i = 0; *s != '\0'; ) + i += *s++; /* += is faster than <<= for cscope */ + return(i); +} diff --git a/src/lookup.h b/src/lookup.h new file mode 100644 index 0000000..8c7770f --- /dev/null +++ b/src/lookup.h @@ -0,0 +1,48 @@ +/*=========================================================================== + Copyright (c) 2001, 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: lookup.h,v 1.1 2001/06/01 12:43:24 broeker Exp $ */ + + +#ifndef CSCOPE_LOOKUP_H +#define CSCOPE_LOOKUP_H + +/* declarations for objects defined in lookup.c */ + +/* keyword text for fast testing of keywords in the scanner */ +extern char enumtext[]; +extern char externtext[]; +extern char structtext[]; +extern char typedeftext[]; +extern char uniontext[]; + +#endif /* CSCOPE_LOOKUP_H */ diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..ca90ea9 --- /dev/null +++ b/src/main.c @@ -0,0 +1,906 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +/* cscope - interactive C symbol cross-reference + * + * main functions + */ + +#include "global.h" + +#include "build.h" +#include "vp.h" +#include "version.h" /* FILEVERSION and FIXVERSION */ +#include "scanner.h" +#include "alloc.h" + +#include <stdlib.h> /* atoi */ +#if defined(USE_NCURSES) && !defined(RENAMED_NCURSES) +#include <ncurses.h> +#else +#include <curses.h> +#endif +#include <sys/types.h> /* needed by stat.h */ +#include <sys/stat.h> /* stat */ +#include <signal.h> + +/* defaults for unset environment variables */ +#define EDITOR "vi" +#define HOME "/" /* no $HOME --> use root directory */ +#define SHELL "sh" +#define LINEFLAG "+%s" /* default: used by vi and emacs */ +#define TMPDIR "/tmp" +#ifndef DFLT_INCDIR +#define DFLT_INCDIR "/usr/include" +#endif + +static char const rcsid[] = "$Id: main.c,v 1.41 2006/08/20 15:00:34 broeker Exp $"; + +/* note: these digraph character frequencies were calculated from possible + printable digraphs in the cross-reference for the C compiler */ +char dichar1[] = " teisaprnl(of)=c"; /* 16 most frequent first chars */ +char dichar2[] = " tnerpla"; /* 8 most frequent second chars + using the above as first chars */ +char dicode1[256]; /* digraph first character code */ +char dicode2[256]; /* digraph second character code */ + +char *editor, *shell, *lineflag; /* environment variables */ +char *home; /* Home directory */ +BOOL lineflagafterfile; +char *argv0; /* command name */ +BOOL compress = YES; /* compress the characters in the crossref */ +BOOL dbtruncated; /* database symbols are truncated to 8 chars */ +int dispcomponents = 1; /* file path components to display */ +#if CCS +BOOL displayversion; /* display the C Compilation System version */ +#endif +BOOL editallprompt = YES; /* prompt between editing files */ +unsigned int fileargc; /* file argument count */ +char **fileargv; /* file argument values */ +int fileversion; /* cross-reference file version */ +BOOL incurses = NO; /* in curses */ +BOOL invertedindex; /* the database has an inverted index */ +BOOL isuptodate; /* consider the crossref up-to-date */ +BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */ +BOOL linemode = NO; /* use line oriented user interface */ +BOOL verbosemode = NO; /* print extra information on line mode */ +BOOL recurse_dir = NO; /* recurse dirs when searching for src files */ +char *namefile; /* file of file names */ +BOOL ogs; /* display OGS book and subsystem names */ +char *prependpath; /* prepend path to file names */ +FILE *refsfound; /* references found file */ +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 */ + +static BOOL onesearch; /* one search only in line mode */ +static char *reflines; /* symbol reference lines file */ + +/* Internal prototypes: */ +static void initcompress(void); +static void longusage(void); +static void skiplist(FILE *oldrefs); +static void usage(void); + +#ifdef HAVE_FIXKEYPAD +void fixkeypad(); +#endif + +#if defined(KEY_RESIZE) && !defined(__DJGPP__) +void +sigwinch_handler(int sig, siginfo_t *info, void *unused) +{ + (void) sig; + (void) info; + (void) unused; + ungetch(KEY_RESIZE); +} +#endif + +int +main(int argc, char **argv) +{ + FILE *names; /* name file pointer */ + int oldnum; /* number in old cross-ref */ + char path[PATHLEN + 1]; /* file path */ + FILE *oldrefs; /* old cross-reference file */ + char *s; + int c; + unsigned int i; + pid_t pid; + struct stat stat_buf; +#if defined(KEY_RESIZE) && !defined(__DJGPP__) + struct sigaction winch_action; +#endif + mode_t orig_umask; + + yyin = stdin; + yyout = stdout; + /* save the command name for messages */ + argv0 = argv[0]; +#if defined(KEY_RESIZE) && !defined(__DJGPP__) + winch_action.sa_sigaction = sigwinch_handler; + sigemptyset(&winch_action.sa_mask); + winch_action.sa_flags = SA_SIGINFO; + sigaction(SIGWINCH,&winch_action,NULL); +#endif + /* set the options */ + while (--argc > 0 && (*++argv)[0] == '-') { + /* HBB 20030814: add GNU-style --help and --version options */ + if (strequal(argv[0], "--help") + || strequal(argv[0], "-h")) { + longusage(); + myexit(0); + } + if (strequal(argv[0], "--version") + || strequal(argv[0], "-V")) { +#if CCS + displayversion = YES; +#else + fprintf(stderr, "%s: version %d%s\n", argv0, + FILEVERSION, FIXVERSION); + myexit(0); +#endif + } + + for (s = argv[0] + 1; *s != '\0'; s++) { + + /* look for an input field number */ + if (isdigit((unsigned char) *s)) { + field = *s - '0'; + if (field > 8) { + field = 8; + } + if (*++s == '\0' && --argc > 0) { + s = *++argv; + } + if (strlen(s) > PATLEN) { + postfatal("\ +cscope: pattern too long, cannot be > %d characters\n", PATLEN); + /* NOTREACHED */ + } + strcpy(Pattern, s); + goto nextarg; + } + switch (*s) { + case '-': /* end of options */ + --argc; + ++argv; + goto lastarg; + case 'b': /* only build the cross-reference */ + buildonly = YES; + linemode = YES; + break; + case 'c': /* ASCII characters only in crossref */ + compress = NO; + break; + case 'C': /* turn on caseless mode for symbol searches */ + caseless = YES; + egrepcaseless(caseless); /* simulate egrep -i flag */ + break; + case 'd': /* consider crossref up-to-date */ + isuptodate = YES; + break; + case 'e': /* suppress ^E prompt between files */ + editallprompt = NO; + break; + case 'k': /* ignore DFLT_INCDIR */ + kernelmode = YES; + break; + case 'L': + onesearch = YES; + /* FALLTHROUGH */ + case 'l': + linemode = YES; + break; + case 'v': + verbosemode = YES; + break; + case 'o': /* display OGS book and subsystem names */ + ogs = YES; + break; + case 'q': /* quick search */ + invertedindex = YES; + break; + case 'T': /* truncate symbols to 8 characters */ + trun_syms = YES; + break; + case 'u': /* unconditionally build the cross-reference */ + unconditional = YES; + break; + case 'U': /* assume some files have changed */ + fileschanged = YES; + break; + case 'R': + recurse_dir = YES; + break; + case 'f': /* alternate cross-reference file */ + case 'F': /* symbol reference lines file */ + case 'i': /* file containing file names */ + case 'I': /* #include file directory */ + case 'p': /* file path components to display */ + case 'P': /* prepend path to file names */ + case 's': /* additional source file directory */ + case 'S': + c = *s; + if (*++s == '\0' && --argc > 0) { + s = *++argv; + } + if (*s == '\0') { + fprintf(stderr, "%s: -%c option: missing or empty value\n", + argv0, c); + goto usage; + } + switch (c) { + 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 + /* System V has a 14 character limit */ + s = mybasename(path); + if (strlen(s) > 11) { + s[11] = '\0'; + } +#endif + 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 */ + reflines = s; + break; + case 'i': /* file containing file names */ + namefile = s; + break; + case 'I': /* #include file directory */ + includedir(s); + break; + case 'p': /* file path components to display */ + if (*s < '0' || *s > '9' ) { + fprintf(stderr, "\ +%s: -p option: missing or invalid numeric value\n", + argv0); + goto usage; + } + dispcomponents = atoi(s); + break; + case 'P': /* prepend path to file names */ + prependpath = s; + break; + case 's': /* additional source directory */ + case 'S': + sourcedir(s); + break; + } + goto nextarg; + default: + fprintf(stderr, "%s: unknown option: -%c\n", argv0, + *s); + usage: + usage(); + fprintf(stderr, "Try the -h option for more information.\n"); + myexit(1); + } /* switch(option letter) */ + } /* for(option) */ + nextarg: + ; + } /* while(argv) */ + + lastarg: + /* read the environment */ + editor = mygetenv("EDITOR", EDITOR); + editor = mygetenv("VIEWER", editor); /* use viewer if set */ + editor = mygetenv("CSCOPE_EDITOR", editor); /* has last word */ + home = mygetenv("HOME", HOME); + shell = mygetenv("SHELL", SHELL); + lineflag = mygetenv("CSCOPE_LINEFLAG", LINEFLAG); + lineflagafterfile = getenv("CSCOPE_LINEFLAG_AFTER_FILE") ? 1 : 0; + tmpdir = mygetenv("TMPDIR", TMPDIR); + + /* XXX remove if/when clearerr() in dir.c does the right thing. */ + if (namefile && strcmp(namefile, "-") == 0 && !buildonly) { + postfatal("cscope: Must use -b if file list comes from stdin\n"); + /* NOTREACHED */ + } + + /* make sure that tmpdir exists */ + if (lstat (tmpdir, &stat_buf)) { + fprintf (stderr, "\ +cscope: Temporary directory %s does not exist or cannot be accessed\n", + tmpdir); + fprintf (stderr, "\ +cscope: Please create the directory or set the environment variable\n\ +cscope: TMPDIR to a valid directory\n"); + myexit(1); + } + + /* create the temporary file names */ + orig_umask = umask(S_IRWXG|S_IRWXO); + pid = getpid(); + sprintf(tempdirpv, "%s/cscope.%d", tmpdir, pid); + if(mkdir(tempdirpv,S_IRWXU)) { + fprintf(stderr, "\ +cscope: Could not create private temp dir %s\n", + tempdirpv); + myexit(1); + } + umask(orig_umask); + + sprintf(temp1, "%s/cscope.1", tempdirpv); + sprintf(temp2, "%s/cscope.2", tempdirpv); + + /* if running in the foreground */ + if (signal(SIGINT, SIG_IGN) != SIG_IGN) { + /* cleanup on the interrupt and quit signals */ + signal(SIGINT, myexit); + signal(SIGQUIT, myexit); + } + /* cleanup on the hangup signal */ + signal(SIGHUP, myexit); + + /* if the database path is relative and it can't be created */ + if (reffile[0] != '/' && access(".", WRITE) != 0) { + + /* put it in the home directory if the database may not be + * up-to-date or doesn't exist in the relative directory, + * so a database in the current directory will be + * used instead of failing to open a non-existant database in + * the home directory + */ + 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); + } + } + + if (linemode == NO) { + signal(SIGINT, SIG_IGN); /* ignore interrupts */ + signal(SIGPIPE, SIG_IGN);/* | command can cause pipe signal */ + + /* initialize the curses display package */ + initscr(); /* initialize the screen */ + entercurses(); +#if TERMINFO + keypad(stdscr, TRUE); /* enable the keypad */ +# ifdef HAVE_FIXKEYPAD + fixkeypad(); /* fix for getch() intermittently returning garbage */ +# endif +#endif /* TERMINFO */ +#if UNIXPC + standend(); /* turn off reverse video */ +#endif + dispinit(); /* initialize display parameters */ + setfield(); /* set the initial cursor position */ + clearmsg(); /* clear any build progress message */ + display(); /* display the version number and input fields */ + } + + + /* if the cross-reference is to be considered up-to-date */ + if (isuptodate == YES) { + if ((oldrefs = vpfopen(reffile, "rb")) == NULL) { + postfatal("cscope: cannot open file %s\n", reffile); + /* NOTREACHED */ + } + /* get the crossref file version but skip the current directory */ + if (fscanf(oldrefs, "cscope %d %*s", &fileversion) != 1) { + postfatal("cscope: cannot read file version from file %s\n", + reffile); + /* NOTREACHED */ + } + if (fileversion >= 8) { + + /* override these command line options */ + compress = YES; + invertedindex = NO; + + /* see if there are options in the database */ + for (;;) { + getc(oldrefs); /* skip the blank */ + if ((c = getc(oldrefs)) != '-') { + ungetc(c, oldrefs); + break; + } + switch (c = getc(oldrefs)) { + case 'c': /* ASCII characters only */ + compress = NO; + break; + case 'q': /* quick search */ + invertedindex = YES; + fscanf(oldrefs, "%ld", &totalterms); + break; + case 'T': /* truncate symbols to 8 characters */ + dbtruncated = YES; + trun_syms = YES; + break; + } + } + initcompress(); + seek_to_trailer(oldrefs); + } + /* skip the source and include directory lists */ + skiplist(oldrefs); + skiplist(oldrefs); + + /* get the number of source files */ + if (fscanf(oldrefs, "%lu", &nsrcfiles) != 1) { + postfatal("\ +cscope: cannot read source file size from file %s\n", reffile); + /* NOTREACHED */ + } + /* get the source file list */ + srcfiles = mymalloc(nsrcfiles * sizeof(char *)); + if (fileversion >= 9) { + + /* allocate the string space */ + if (fscanf(oldrefs, "%d", &oldnum) != 1) { + postfatal("\ +cscope: cannot read string space size from file %s\n", reffile); + /* NOTREACHED */ + } + s = mymalloc(oldnum); + getc(oldrefs); /* skip the newline */ + + /* read the strings */ + if (fread(s, oldnum, 1, oldrefs) != 1) { + postfatal("\ +cscope: cannot read source file names from file %s\n", reffile); + /* NOTREACHED */ + } + /* change newlines to nulls */ + for (i = 0; i < nsrcfiles; ++i) { + srcfiles[i] = s; + for (++s; *s != '\n'; ++s) { + ; + } + *s = '\0'; + ++s; + } + /* if there is a file of source file names */ + if ((namefile != NULL && (names = vpfopen(namefile, "r")) != NULL) + || (names = vpfopen(NAMEFILE, "r")) != NULL) { + + /* 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; + } + switch (i) { + case 'p': /* file path components to display */ + if (*s < '0' || *s > '9') { + posterr("cscope: -p option in file %s: missing or invalid numeric value\n", namefile); + + } + dispcomponents = atoi(s); + } + } + fclose(names); + } + } else { + for (i = 0; i < nsrcfiles; ++i) { + if (!fgets(path, sizeof(path), oldrefs) ) { + postfatal("\ +cscope: cannot read source file name from file %s\n", + reffile); + /* NOTREACHED */ + } + srcfiles[i] = my_strdup(path); + } + } + fclose(oldrefs); + } else { + /* save the file arguments */ + fileargc = argc; + fileargv = argv; + + /* get source directories from the environment */ + if ((s = getenv("SOURCEDIRS")) != NULL) { + sourcedir(s); + } + /* make the source file list */ + srcfiles = mymalloc(msrcfiles * sizeof(char *)); + makefilelist(); + if (nsrcfiles == 0) { + postfatal("cscope: no source files found\n"); + /* NOTREACHED */ + } + /* get include directories from the environment */ + if ((s = getenv("INCLUDEDIRS")) != NULL) { + includedir(s); + } + /* add /usr/include to the #include directory list, + but not in kernelmode... kernels tend not to use it. */ + if (kernelmode == NO) { + includedir(DFLT_INCDIR); + } + + /* initialize the C keyword table */ + initsymtab(); + + /* Tell build.c about the filenames to create: */ + setup_build_filenames(reffile); + + /* build the cross-reference */ + initcompress(); + if (linemode == NO || verbosemode == YES) /* display if verbose as well */ + postmsg("Building cross-reference..."); + build(); + if (linemode == NO ) + clearmsg(); /* clear any build progress message */ + if (buildonly == YES) { + myexit(0); + } + } + opendatabase(); + + /* if using the line oriented user interface so cscope can be a + subprocess to emacs or samuel */ + if (linemode == YES) { + if (*Pattern != '\0') { /* do any optional search */ + if (search() == YES) { + /* print the total number of lines in + * verbose mode */ + if (verbosemode == YES) + printf("cscope: %d lines\n", + totallines); + + while ((c = getc(refsfound)) != EOF) + putchar(c); + } + } + if (onesearch == YES) + myexit(0); + + for (;;) { + char buf[PATLEN + 2]; + + printf(">> "); + fflush(stdout); + if (fgets(buf, sizeof(buf), stdin) == NULL) { + myexit(0); + } + /* remove any trailing newline character */ + if (*(s = buf + strlen(buf) - 1) == '\n') { + *s = '\0'; + } + switch (*buf) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': /* samuel only */ + field = *buf - '0'; + strcpy(Pattern, buf + 1); + search(); + printf("cscope: %d lines\n", totallines); + while ((c = getc(refsfound)) != EOF) { + putchar(c); + } + break; + + case 'c': /* toggle caseless mode */ + case ctrl('C'): + if (caseless == NO) { + caseless = YES; + } else { + caseless = NO; + } + egrepcaseless(caseless); + break; + + case 'r': /* rebuild database cscope style */ + case ctrl('R'): + freefilelist(); + makefilelist(); + /* FALLTHROUGH */ + + case 'R': /* rebuild database samuel style */ + rebuild(); + putchar('\n'); + break; + + case 'C': /* clear file names */ + freefilelist(); + putchar('\n'); + break; + + case 'F': /* add a file name */ + strcpy(path, buf + 1); + if (infilelist(path) == NO && + (s = inviewpath(path)) != NULL) { + addsrcfile(s); + } + putchar('\n'); + break; + + case 'q': /* quit */ + case ctrl('D'): + case ctrl('Z'): + myexit(0); + + default: + fprintf(stderr, "cscope: unknown command '%s'\n", buf); + break; + } + } + /* NOTREACHED */ + } + /* pause before clearing the screen if there have been error messages */ + if (errorsfound == YES) { + errorsfound = NO; + askforreturn(); + } + /* do any optional search */ + if (*Pattern != '\0') { + atfield(); /* move to the input field */ + command(ctrl('Y')); /* search */ + } else if (reflines != NULL) { + /* read any symbol reference lines file */ + readrefs(reflines); + } + display(); /* update the display */ + + for (;;) { + if (!selecting) + atfield(); /* move to the input field */ + + /* exit if the quit command is entered */ + if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) { + break; + } + /* execute the commmand, updating the display if necessary */ + if (command(c) == YES) { + display(); + } + + if (selecting) { + move(displine[curdispline], 0); + refresh(); + } + } + /* cleanup and exit */ + myexit(0); + /* NOTREACHED */ + return 0; /* avoid warning... */ +} + +void +cannotopen(char *file) +{ + posterr("Cannot open file %s", file); +} + +/* FIXME MTE - should use postfatal here */ +void +cannotwrite(char *file) +{ +#if HAVE_SNPRINTF + char msg[MSGLEN + 1]; + + snprintf(msg, sizeof(msg), "Removed file %s because write failed", file); +#else + char *msg = mymalloc(50 + strlen(file)); + + sprintf(msg, "Removed file %s because write failed", file); +#endif + + myperror(msg); /* display the reason */ + +#if !HAVE_SNPRINTF + free(msg); +#endif + + unlink(file); + myexit(1); /* calls exit(2), which closes files */ +} + + +/* set up the digraph character tables for text compression */ +static void +initcompress(void) +{ + int i; + + if (compress == YES) { + for (i = 0; i < 16; ++i) { + dicode1[(unsigned char) (dichar1[i])] = i * 8 + 1; + } + for (i = 0; i < 8; ++i) { + dicode2[(unsigned char) (dichar2[i])] = i + 1; + } + } +} + +/* skip the list in the cross-reference file */ + +static void +skiplist(FILE *oldrefs) +{ + int i; + + if (fscanf(oldrefs, "%d", &i) != 1) { + postfatal("cscope: cannot read list size from file %s\n", reffile); + /* NOTREACHED */ + } + while (--i >= 0) { + if (fscanf(oldrefs, "%*s") != 0) { + postfatal("cscope: cannot read list name from file %s\n", reffile); + /* NOTREACHED */ + } + } +} + + +/* enter curses mode */ +void +entercurses(void) +{ + incurses = YES; +#ifndef __MSDOS__ /* HBB 20010313 */ + nonl(); /* don't translate an output \n to \n\r */ +#endif + cbreak(); /* single character input */ + noecho(); /* don't echo input characters */ + clear(); /* clear the screen */ + mouseinit(); /* initialize any mouse interface */ + drawscrollbar(topline, nextline); +} + + +/* exit curses mode */ +void +exitcurses(void) +{ + /* clear the bottom line */ + move(LINES - 1, 0); + clrtoeol(); + refresh(); + + /* exit curses and restore the terminal modes */ + endwin(); + incurses = NO; + + /* restore the mouse */ + mousecleanup(); + fflush(stdout); +} + + +/* normal usage message */ +static void +usage(void) +{ + fprintf(stderr, "Usage: cscope [-bcCdehklLqRTuUvV] [-f file] [-F file] [-i file] [-I dir] [-s dir]\n"); + fprintf(stderr, " [-p number] [-P path] [-[0-8] pattern] [source files]\n"); +} + + +/* long usage message */ +static void +longusage(void) +{ + usage(); + fprintf(stderr, "\ +\n\ +-b Build the cross-reference only.\n\ +-C Ignore letter case when searching.\n\ +-c Use only ASCII characters in the cross-ref file (don't compress).\n\ +-d Do not update the cross-reference.\n\ +-e Suppress the <Ctrl>-e command prompt between files.\n\ +-F symfile Read symbol reference lines from symfile.\n\ +-f reffile Use reffile as cross-ref file name instead of %s.\n", + REFFILE); + fprintf(stderr, "\ +-h This help screen.\n\ +-I incdir Look in incdir for any #include files.\n\ +-i namefile Browse through files listed in namefile, instead of %s\n", + NAMEFILE); + fprintf(stderr, "\ +-k Kernel Mode - don't use %s for #include files.\n", + DFLT_INCDIR); + fputs("\ +-L Do a single search with line-oriented output.\n\ +-l Line-oriented interface.\n\ +-num pattern Go to input field num (counting from 0) and find pattern.\n\ +-P path Prepend path to relative file names in pre-built cross-ref file.\n\ +-p n Display the last n file path components.\n\ +-q Build an inverted index for quick symbol searching.\n\ +-R Recurse directories for files.\n\ +-s dir Look in dir for additional source files.\n\ +-T Use only the first eight characters to match against C symbols.\n\ +-U Check file time stamps.\n\ +-u Unconditionally build the cross-reference file.\n\ +-v Be more verbose in line mode.\n\ +-V Print the version number.\n\ +\n\ +Please see the manpage for more information.\n", + stderr); +} + +/* cleanup and exit */ + +void +myexit(int sig) +{ + /* HBB 20010313; close file before unlinking it. Unix may not care + * about that, but DOS absolutely needs it */ + if (refsfound != NULL) + fclose(refsfound); + + /* remove any temporary files */ + if (temp1[0] != '\0') { + unlink(temp1); + unlink(temp2); + rmdir(tempdirpv); + } + /* restore the terminal to its original mode */ + if (incurses == YES) { + exitcurses(); + } + /* dump core for debugging on the quit signal */ + if (sig == SIGQUIT) { + abort(); + } + /* HBB 20000421: be nice: free allocated data */ + freefilelist(); + freeinclist(); + freesrclist(); + freecrossref(); + free_newbuildfiles(); + + exit(sig); +} diff --git a/src/mouse.c b/src/mouse.c new file mode 100644 index 0000000..69b85c0 --- /dev/null +++ b/src/mouse.c @@ -0,0 +1,433 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * mouse functions + */ + +#include "global.h" + +BOOL mouse = NO; /* mouse interface */ + +#ifdef UNIXPC /* build command requires #ifdef instead of #if */ +#include <sys/window.h> +BOOL unixpcmouse = NO; /* running with a mouse on the Unix PC? */ +static int uw_hs, uw_vs; /* character height and width */ +#endif + +static char const rcsid[] = "$Id: mouse.c,v 1.4 2001/07/05 14:31:00 broeker Exp $"; + +typedef struct { /* menu */ + char *text; + char *value; +} MENU; + +static MENU mainmenu[] = { /* main menu */ + {"Send", "##\033s##\r"}, + {"Repeat", "\031"}, + {"Edit All", "\05"}, + {"Rebuild", "\022"}, + {"Shell", "!"}, + {"Redraw", "\f"}, + {"Help", "?"}, + {"Exit", "\04"}, + {NULL, NULL} +}; + +static MENU changemenu[] = { /* change mode menu */ + {"Mark Screen", "*"}, + {"Mark All", "a"}, + {"Change", "\04"}, + {"No Change", "\033"}, + {"Shell", "!"}, + {"Redraw", "\f"}, + {"Help", "?"}, + {NULL, NULL} +}; + +static MENU *loaded; /* menu loaded */ +static BOOL emacsviterm = NO; /* terminal type */ + +static void loadmenu(MENU *menu); +static int getcoordinate(void); +static int getpercent(void); + +/* see if there is a mouse interface */ + +void +mouseinit(void) +{ + char *term; + + /* see if this is emacsterm or viterm */ + term = mygetenv("TERM", ""); + if (strcmp(term, "emacsterm") == 0 || + strcmp(term, "viterm") == 0) { + emacsviterm = YES; + mouse = YES; + } + /* the MOUSE enviroment variable is for 5620 terminal programs that have + mouse support but the TERM environment variable is the same as a + terminal without a mouse, such as myx */ + else if (strcmp(mygetenv("MOUSE", ""), "myx") == 0) { + mouse = YES; + } +#if UNIXPC + else if (strcmp(term,"s4") == 0 || + strcmp(term,"s120") == 0 || + strcmp(term,"s90") == 0) { + int retval; + struct uwdata uwd; /* Window data structure */ + struct umdata umd; /* Mouse data structure */ + + /* Ask for character size info */ + + retval = ioctl(1,WIOCGETD,&uwd); + if(retval || uwd.uw_hs <= 0 || uwd.uw_vs <= 0) { + /************************************************** + * something wrong with the kernel, so fake it... + **************************************************/ + if(!strcmp(term,"s4")) { + uw_hs = 9; + uw_vs = 12; + } + else { + uw_hs = 6; + uw_vs = 10; + } + } + else { + /* Kernel is working and knows about this font */ + uw_hs = uwd.uw_hs; + uw_vs = uwd.uw_vs; + } + + /************************************************** + * Now turn on mouse reporting so we can actually + * make use of all this stuff. + **************************************************/ + if((retval = ioctl(1,WIOCGETMOUSE,&umd)) != -1) { + umd.um_flags= MSDOWN+MSUP; + ioctl(1,WIOCSETMOUSE,&umd); + } + unixpcmouse = YES; + } +#endif + if (mouse == YES) { + loadmenu(mainmenu); + } +} + +/* load the correct mouse menu */ + +void +mousemenu(void) +{ + if (mouse == YES) { + if (changing == YES) { + loadmenu(changemenu); + } + else { + loadmenu(mainmenu); + } + } +} + +/* download a menu */ + +static void +loadmenu(MENU *menu) +{ + int i; + + if (emacsviterm == YES) { + mousereinit(); + (void) printf("\033V1"); /* display the scrollbar */ + (void) printf("\033M0@%s@%s@", menu[0].text, menu[0].value); + for (i = 1; menu[i].text != NULL; ++i) { + (void) printf("\033M@%s@%s@", menu[i].text, menu[i].value); + } + } + else { /* myx */ + int len; + + mousecleanup(); + (void) printf("\033[6;1X\033[9;1X"); + for (i = 0; menu[i].text != NULL; ++i) { + len = strlen(menu[i].text); + (void) printf("\033[%d;%dx%s%s", len, + (int) (len + strlen(menu[i].value)), + menu[i].text, menu[i].value); + } + loaded = menu; + } + (void) fflush(stdout); +} + +/* reinitialize the mouse in case curses changed the attributes */ + +void +mousereinit(void) +{ + if (emacsviterm == YES) { + + /* enable the mouse click and sweep coordinate control sequence */ + /* and switch to menu 2 */ + (void) printf("\033{2\033#2"); + (void) fflush(stdout); + } +} + +/* restore the mouse attributes */ + +void +mousecleanup(void) +{ + int i; + + if (loaded != NULL) { /* only true for myx */ + + /* remove the mouse menu */ + (void) printf("\033[6;0X\033[9;0X"); + for (i = 0; loaded[i].text != NULL; ++i) { + (void) printf("\033[0;0x"); + } + loaded = NULL; + } +} + +/* draw the scrollbar */ + +void +drawscrollbar(int top, int bot) +{ + int p1, p2; + + if (emacsviterm == YES) { + if (bot > top) { + p1 = 16 + (top - 1) * 100 / totallines; + p2 = 16 + (bot - 1) * 100 / totallines; + if (p2 > 116) { + p2 = 116; + } + if (p1 < 16) { + p1 = 16; + } + /* don't send ^S or ^Q because it will hang a layer using cu(1) */ + if (p1 == ctrl('Q') || p1 == ctrl('S')) { + ++p1; + } + if (p2 == ctrl('Q') || p2 == ctrl('S')) { + ++p2; + } + } + else { + p1 = p2 = 16; + } + (void) printf("\033W%c%c", p1, p2); + } +} + +/* get the mouse information */ + +MOUSE * +getmouseaction(char leading_char) +{ + static MOUSE m; + +#if UNIXPC + + if(unixpcmouse == YES && leading_char == ESC) { + + /* Called if cscope received an ESC character. See if it is + * a mouse report and if so, decipher it. A mouse report + * looks like: "<ESC>[?xx;yy;b;rM" + */ + int x = 0, y = 0, button = 0, reason = 0; + int i; + + /* Get a mouse report. The form is: XX;YY;B;RM where + * XX is 1,2, or 3 decimal digits with the X pixel position. + * Similarly for YY. B is a single decimal digit with the + * button number (4 for one, 2 for two, and 1 for three). + * R is the reason for the mouse report. + * + * In general, the input is read until the mouse report has + * been completely read in or we have discovered that this + * escape sequence is NOT a mouse report. In the latter case + * return the last character read to the input stream with + * myungetch(). + */ + + /* Check for "[?" being next 2 chars */ + if(((i = mygetch()) != '[') || ((i = mygetch()) != '?')) { + myungetch(i); + return(NULL); + } + + /* Grab the X position (in pixels) */ + while(isdigit(i = mygetch())) { + x = (x*10) + (i - '0'); + } + if(i != ';') { + myungetch(i); + return(NULL); /* not a mouse report after all */ + } + + /* Grab the Y position (in pixels) */ + while(isdigit(i = mygetch())) { + y = (y*10) + (i - '0'); + } + if(i != ';') { + myungetch(i); + return(NULL); + } + + /* Get which button */ + if((button = mygetch()) > '4') { + myungetch(button); + return(NULL); + } + if((i = mygetch()) != ';') { + myungetch(i); + return(NULL); + } + + /* Get the reason for this mouse report */ + if((reason = mygetch()) > '8') { + myungetch(reason); + return(NULL); + } + + /* sequence should terminate with an 'M' */ + if((i = mygetch()) != 'M') { + myungetch(i); + return(NULL); + } + + + /* OK. We get a mouse report whenever a button is depressed + * or released. Let's ignore the report whenever the button + * is depressed until when I am ready to implement sweeping. + */ + if(reason != '2') { + return(NULL); /* '2' means button is released */ + } + + /************************************************************ + * Always indicate button 1 irregardless of which button was + * really pushed. + ************************************************************/ + m.button = 1; + + /************************************************************ + * Convert pixel coordinates to line and column coords. + * The height and width are obtained using an ioctl() call + * in mouseinit(). This assumes that variable width chars + * are not being used ('though it would probably work anyway). + ************************************************************/ + + m.x1 = x/uw_hs; /* pixel/horizontal_spacing */ + m.y1 = y/uw_vs; /* pixel/vertical_spacing */ + + /* "null" out the other fields */ + m.percent = m.x2 = m.y2 = -1; + } + else +#endif /* not UNIXPC */ + + if (mouse == YES && leading_char == ctrl('X')) { + + switch (mygetch()) { + case ctrl('_'): /* click */ + if ((m.button = mygetch()) == '0') { /* if scrollbar */ + m.percent = getpercent(); + } + else { + m.x1 = getcoordinate(); + m.y1 = getcoordinate(); + m.x2 = m.y2 = -1; + } + break; + + case ctrl(']'): /* sweep */ + m.button = mygetch(); + m.x1 = getcoordinate(); + m.y1 = getcoordinate(); + m.x2 = getcoordinate(); + m.y2 = getcoordinate(); + break; + default: + return(NULL); + } + } + else return(NULL); + + return(&m); +} + +/* get a row or column coordinate from a mouse button click or sweep */ + +static int +getcoordinate(void) +{ + int c, next; + + c = mygetch(); + next = 0; + if (c == ctrl('A')) { + next = 95; + c = mygetch(); + } + if (c < ' ') { + return (0); + } + return (next + c - ' '); +} + +/* get a percentage */ + +static int +getpercent(void) +{ + int c; + + c = mygetch(); + if (c < 16) { + return(0); + } + if (c > 120) { + return(100); + } + return(c - 16); +} diff --git a/src/mygetenv.c b/src/mygetenv.c new file mode 100644 index 0000000..24ae35e --- /dev/null +++ b/src/mygetenv.c @@ -0,0 +1,51 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +static char const rcsid[] = "$Id: mygetenv.c,v 1.3 2001/07/05 16:47:04 broeker Exp $"; + +#include "library.h" + +#include <stdlib.h> + +/* return the non-null environment value or the default argument */ + +char * +mygetenv(char *variable, char *deflt) +{ + char *value; + + value = getenv(variable); + if (value == NULL || *value == '\0') { + return(deflt); + } + return(value); +} diff --git a/src/mypopen.c b/src/mypopen.c new file mode 100644 index 0000000..87db2fa --- /dev/null +++ b/src/mypopen.c @@ -0,0 +1,207 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +#include <stdio.h> +#include <signal.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> +#include "global.h" /* pid_t, RETSIGTYPE, shell, and mybasename() */ + +#define tst(a,b) (*mode == 'r'? (b) : (a)) +#define RDR 0 +#define WTR 1 + +/* HBB 20010312: make this a bit safer --- don't blindly assume it's 1 */ +#ifdef FD_CLOEXEC +# define CLOSE_ON_EXEC FD_CLOEXEC +#else +# define CLOSE_ON_EXEC 1 +#endif + +#ifdef HAVE_IO_H +# include <io.h> /* for setmode() */ +#endif + +static char const rcsid[] = "$Id: mypopen.c,v 1.14 2006/04/21 10:40:29 broeker Exp $"; + +static pid_t popen_pid[20]; +static RETSIGTYPE (*tstat)(int); + +int +myopen(char *path, int flag, int mode) +{ + /* opens a file descriptor and then sets close-on-exec for the file */ + int fd; + + /* 20020103: if file is not explicitly in Binary mode, make + * sure we override silly Cygwin behaviour of automatic binary + * mode for files in "binary mounted" paths */ +#if O_BINARY != O_TEXT + if (! (flag | O_BINARY)) + flag |= O_TEXT; +#endif + if(mode) + fd = open(path, flag, mode); + else + fd = open(path, flag); + +#ifdef __DJGPP__ /* FIXME: test feature, not platform */ + /* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it + * always fails this call. Have to skip that step */ + if(fd != -1) + return(fd); +#endif + if(fd != -1 && (fcntl(fd, F_SETFD, CLOSE_ON_EXEC) != -1)) + return(fd); + + else + { + /* Ensure that if the fcntl fails and fd is valid, then + the file is closed properly. In general this should + not happen. */ + if (fd != -1) + { + close (fd); + } + + return(-1); + } +} + +FILE * +myfopen(char *path, char *mode) +{ + /* opens a file pointer and then sets close-on-exec for the file */ + FILE *fp; + + fp = fopen(path, mode); + +#ifdef SETMODE + if (fp && ! strchr(mode, 'b')) { + SETMODE(fileno(fp), O_TEXT); + } +#endif /* SETMODE */ + +#ifdef __DJGPP__ /* FIXME: test feature, not platform */ + /* HBB 20010312: DOS GCC doesn't have FD_CLOEXEC (yet), so it + * always fails this call. Have to skip that step */ + if(fp) +#else + if(fp && (fcntl(fileno(fp), F_SETFD, CLOSE_ON_EXEC) != -1)) +#endif + return(fp); + + else + return(NULL); +} + +FILE * +mypopen(char *cmd, char *mode) +{ +#ifdef __DJGPP__ + /* HBB 20010312: Has its own implementation of popen(), which + * is better suited to the platform than cscope's */ + return (popen)(cmd, mode); +#else + int p[2]; + pid_t *poptr; + int myside, yourside; + pid_t pid; + + if(pipe(p) < 0) + return(NULL); + myside = tst(p[WTR], p[RDR]); + yourside = tst(p[RDR], p[WTR]); + if((pid = fork()) == 0) { + /* myside and yourside reverse roles in child */ + int stdio; + + /* close all pipes from other popen's */ + for (poptr = popen_pid; poptr < popen_pid+20; poptr++) { + if(*poptr) + (void) close(poptr - popen_pid); + } + stdio = tst(0, 1); + close(myside); + close(stdio); +#if V9 + dup2(yourside, stdio); +#else + fcntl(yourside, F_DUPFD, stdio); +#endif + close(yourside); + execlp(shell, mybasename(shell), "-c", cmd, (void *)0); + _exit(1); + } else if (pid > 0) + tstat = signal(SIGTSTP, SIG_DFL); + if(pid == -1) + return(NULL); + popen_pid[myside] = pid; + (void) close(yourside); + return(fdopen(myside, mode)); +#endif /* DJGPP */ +} + +/* HBB 20010705: renamed from 'pclose', which would collide with + * system-supplied function of same name */ +int +mypclose(FILE *ptr) +{ + int f; + pid_t r; + int status; + sighandler_t hstat, istat, qstat; + +#ifdef __DJGPP__ + /* HBB 20010705: This system has its own pclose(), which we + * don't want to replace */ + return (pclose)(ptr); +#else + f = fileno(ptr); + (void) fclose(ptr); + istat = signal(SIGINT, SIG_IGN); + qstat = signal(SIGQUIT, SIG_IGN); + hstat = signal(SIGHUP, SIG_IGN); + while((r = wait(&status)) != popen_pid[f] && r != -1) + ; + if(r == -1) + status = -1; + (void) signal(SIGINT, istat); + (void) signal(SIGQUIT, qstat); + (void) signal(SIGHUP, hstat); + (void) signal(SIGTSTP, tstat); + /* mark this pipe closed */ + popen_pid[f] = 0; + return(status); +#endif /* DJGPP */ +} diff --git a/src/scanner.h b/src/scanner.h new file mode 100644 index 0000000..7b5dc00 --- /dev/null +++ b/src/scanner.h @@ -0,0 +1,96 @@ +/*=========================================================================== + Copyright (c) 2001, 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: scanner.h,v 1.4 2005/01/31 16:50:33 broeker Exp $ */ + + +#ifndef CSCOPE_SCANNER_H +#define CSCOPE_SCANNER_H + +#include <stdio.h> + +#undef YYLMAX +#define YYLMAX STMTMAX + PATLEN + 1 /* scanner line buffer size */ + +/* cross-reference database mark characters (when new ones are added, + * update the cscope.out format description in cscope.1) + */ +#define CLASSDEF 'c' +#define DEFINE '#' +#define DEFINEEND ')' +#define ENUMDEF 'e' +#define FCNCALL '`' +#define FCNDEF '$' +#define FCNEND '}' +#define GLOBALDEF 'g' +#define INCLUDE '~' +#define MEMBERDEF 'm' +#define NEWFILE '@' +#define STRUCTDEF 's' +#define TYPEDEF 't' +#define UNIONDEF 'u' + +/* other scanner token types */ +#define LEXEOF 0 +#define IDENT 1 +#define NEWLINE 2 + +/* scanner.l global data */ +extern int first; /* buffer index for first char of symbol */ +extern int last; /* buffer index for last char of symbol */ +extern int lineno; /* symbol line number */ +extern FILE *yyin; /* input file descriptor */ +extern FILE *yyout; /* output file */ +extern int myylineno; /* input line number */ + +#ifdef USING_LEX +/* HBB 20010430: if lex is used instead of flex, have to simulate the + * private copies of yytext and yytext for the world outside scanner.l: */ +/* FIXME: there should be a feature test for this! */ +#if defined(__OSF1__) || defined(__sun) || defined(_AIX) +extern char yytext[]; +#else +extern unsigned char yytext[]; +#endif +extern int yyleng; +# define my_yytext yytext +# define my_yyleng yyleng +#else +extern char *my_yytext; /* private copy of input line */ +extern size_t my_yyleng; /* ... and current length of it */ +#endif + +/* The master function exported by scanner.l */ +int yylex(void); +void initscanner(char *srcfile); + +#endif /* CSCOPE_SCANNER_H ends */ diff --git a/src/scanner.l b/src/scanner.l new file mode 100644 index 0000000..ef32a41 --- /dev/null +++ b/src/scanner.l @@ -0,0 +1,786 @@ +%{ +/*=========================================================================== + 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. + =========================================================================*/ + +/* cscope - interactive C symbol cross-reference + * + * C symbol scanner + */ +#include "global.h" +#include "scanner.h" +#include "lookup.h" + +/* the line counting has been moved from character reading for speed */ +/* comments are discarded */ + +#define IFLEVELINC 5 /* #if nesting level size increment */ + +static char const rcsid[] = "$Id: scanner.l,v 1.7 2004/01/08 14:07:20 broeker Exp $"; + +int first; /* buffer index for first char of symbol */ +int last; /* buffer index for last char of symbol */ +int lineno; /* symbol line number */ +int myylineno = 1; + +static BOOL arraydimension; /* inside array dimension declaration */ +static BOOL bplisting; /* breakpoint listing */ +static int braces; /* unmatched left brace count */ +static BOOL classdef; /* c++ class definition */ +static BOOL elseelif; /* #else or #elif found */ +static BOOL esudef; /* enum/struct/union global definition */ +static BOOL external; /* external definition */ +static int externalbraces; /* external definition outer brace count */ +static BOOL fcndef; /* function definition */ +static BOOL global; /* file global scope (outside functions) */ +static int iflevel; /* #if nesting level */ +static BOOL initializer; /* data initializer */ +static int initializerbraces; /* data initializer outer brace count */ +static BOOL lex; /* lex file */ +static int miflevel = IFLEVELINC; /* maximum #if nesting level */ +static int *maxifbraces; /* maximum brace count within #if */ +static int *preifbraces; /* brace count before #if */ +static int parens; /* unmatched left parenthesis count */ +static BOOL ppdefine; /* preprocessor define statement */ +static BOOL pseudoelif; /* pseudo-#elif */ +static BOOL oldtype; /* next identifier is an old type */ +static BOOL rules; /* lex/yacc rules */ +static BOOL sdl; /* sdl file */ +static BOOL structfield; /* structure field declaration */ +static int tagdef; /* class/enum/struct/union tag definition */ +static BOOL template; /* function template */ +static int templateparens; /* function template outer parentheses count */ +static int typedefbraces = -1; /* initial typedef brace count */ +static int token; /* token found */ + + +void multicharconstant(char terminator); +int skipcomment_input(void); +int comment(void); + +#ifdef FLEX_SCANNER +#define YY_INPUT(buf,result,max_size) \ + {\ + int c = skipcomment_input (); \ + result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \ + } +#else +/* Assume this is the AT&T/SCO style lex */ +#undef input +#define input() ((yytchar=(yytchar=yysptr>yysbuf?*(unsigned char *)--yysptr:getc(yyin))=='/'?comment():yytchar)==EOF?0:yytchar) +#define noncommentinput() ((yytchar=yysptr>yysbuf?*--yysptr:getc(yyin))==EOF?0:yytchar) +#undef unput +#define unput(c) (*yysptr++=(c)) + +#endif + +%} + +ws [ \t\r\v\f] +wsnl [ \t\r\v\f\n] +identifier [a-zA-Z_$][a-zA-Z_0-9$]* +number \.?[0-9][.0-9a-fA-FlLuUxX]* + +%start SDL +%a 12000 +%o 7000 +%% +%\{ { /* lex/yacc C declarations/definitions */ + global = YES; + goto more; + /* NOTREACHED */ + } +%\} { + global = NO; + goto more; + /* NOTREACHED */ + } +^%% { /* lex/yacc rules delimiter */ + braces = 0; + if (rules == NO) { + rules = YES; + + /* simulate a yylex() or yyparse() definition */ + (void) strcat(yytext, " /* "); + first = strlen(yytext); + if (lex == YES) { + (void) strcat(yytext, "yylex"); + } + else { /* yacc: yyparse implicitly calls yylex */ + char *s = " yylex()"; + char *cp = s + strlen(s); + while (--cp >= s) { + unput(*cp); + } + (void) strcat(yytext, "yyparse"); + } + last = strlen(yytext); + (void) strcat(yytext, " */"); + yyleng = strlen(yytext); + yymore(); + return(FCNDEF); + } + else { + rules = NO; + global = YES; + last = first; + yymore(); + return(FCNEND); + /* NOTREACHED */ + } + } +<SDL>STATE{ws}+({identifier}|\*) { /* sdl state, treat as function def */ + braces = 1; + fcndef = YES; + token = FCNDEF; + goto findident; + /* NOTREACHED */ + } +<SDL>ENDSTATE{ws} { /* end of an sdl state, treat as end of a function */ + goto endstate; + /* NOTREACHED */ + } +\{ { /* count unmatched left braces for fcn def detection */ + ++braces; + + /* mark an untagged enum/struct/union so its beginning + can be found */ + if (tagdef) { + if (braces == 1) { + esudef = YES; + } + token = tagdef; + tagdef = '\0'; + last = first; + yymore(); + return(token); + } + goto more; + /* NOTREACHED */ + } +\#{ws}*endif/.*\n{wsnl}*#{ws}*if { + /* attempt to correct erroneous brace count caused by: + * + * #if ... + * ... { + * #endif + * #if ... + * ... { + * #endif + */ + /* the current #if must not have an #else or #elif */ + if (elseelif == YES) { + goto endif; + /* NOTREACHED */ + } + pseudoelif = YES; + goto more; + /* NOTREACHED */ + } +\#{ws}*ifn?(def)? { /* #if, #ifdef or #ifndef */ + elseelif = NO; + if (pseudoelif == YES) { + pseudoelif = NO; + goto elif; + /* NOTREACHED */ + } + /* make sure there is room for the current brace count */ + if (iflevel == miflevel) { + miflevel += IFLEVELINC; + maxifbraces = myrealloc(maxifbraces, miflevel * sizeof(int)); + preifbraces = myrealloc(preifbraces, miflevel * sizeof(int)); + } + /* push the current brace count */ + preifbraces[iflevel] = braces; + maxifbraces[iflevel++] = 0; + goto more; + /* NOTREACHED */ + } +\#{ws}*el(se|if) { /* #elif or #else */ + elseelif = YES; + elif: + if (iflevel > 0) { + + /* save the maximum brace count for this #if */ + if (braces > maxifbraces[iflevel - 1]) { + maxifbraces[iflevel - 1] = braces; + } + /* restore the brace count to before the #if */ + braces = preifbraces[iflevel - 1]; + } + goto more; + /* NOTREACHED */ + } +\#{ws}*endif { /* #endif */ + endif: + if (iflevel > 0) { + + /* get the maximum brace count for this #if */ + if (braces < maxifbraces[--iflevel]) { + braces = maxifbraces[iflevel]; + } + } + goto more; + /* NOTREACHED */ + } +\} { + /* could be the last enum member initializer */ + if (braces == initializerbraces) { + initializerbraces = -1; + initializer = NO; + } + if (--braces <= 0) { + endstate: + braces = 0; + classdef = NO; + } + if (braces == 0 || (braces == 1 && classdef == YES)) { + + /* if the end of an enum/struct/union definition */ + if (esudef == YES) { + esudef = NO; + } + /* if the end of the function */ + else if (fcndef == YES) { + fcndef = NO; + last = first; + yymore(); + return(FCNEND); + } + } + goto more; + /* NOTREACHED */ + } +\( { /* count unmatched left parentheses for function templates */ + ++parens; + goto more; + /* NOTREACHED */ + } +\) { + if (--parens <= 0) { + parens = 0; + } + /* if the end of a function template */ + if (parens == templateparens) { + templateparens = -1; + template = NO; + } + goto more; + /* NOTREACHED */ + } += { /* if a global definition initializer */ + if (global == YES && ppdefine == NO && yytext[0] != '#') { + initializerbraces = braces; + initializer = YES; + } + goto more; + /* NOTREACHED */ + } +: { /* a if global structure field */ + if (global == YES && ppdefine == NO && yytext[0] != '#') { + structfield = YES; + } + goto more; + /* NOTREACHED */ + } +\, { + if (braces == initializerbraces) { + initializerbraces = -1; + initializer = NO; + } + structfield = NO; + goto more; + /* NOTREACHED */ + } +; { /* if the enum/struct/union was not a definition */ + if (braces == 0) { + esudef = NO; + } + /* if the end of a typedef */ + if (braces == typedefbraces) { + typedefbraces = -1; + } + /* if the end of a external definition */ + if (braces == externalbraces) { + externalbraces = -1; + external = NO; + } + structfield = NO; + initializer = NO; + goto more; + /* NOTREACHED */ + } +\#{ws}*define{ws}+{identifier} { + + /* preprocessor macro or constant definition */ + ppdefine = YES; + token = DEFINE; + if (compress == YES) { + yytext[0] = '\1'; /* compress the keyword */ + } + findident: + first = yyleng - 1; + while (yytext[first] != ' ' && yytext[first] != '\t') { + --first; + } + ++first; + goto fcn; + /* NOTREACHED */ + } +class{ws}+{identifier}({wsnl}|[a-zA-Z0-9_():])*\{ { /* class definition */ + classdef = YES; + tagdef = 'c'; + REJECT; + /* NOTREACHED */ + } +(enum|struct|union)/({wsnl}+{identifier}){wsnl}*\{ { /* enum/struct/union definition */ + tagdef = *(yytext + first); + goto ident; + /* NOTREACHED */ + } +(enum|struct|union)/{wsnl}*\{ { /* tag-less e/s/u definition */ + tagdef = yytext[first]; + if (braces == 0) { + esudef = YES; + } + last = first; + tagdef = '\0'; + goto more; + } +{identifier}/{ws}*\(({wsnl}|a-zA-Z0-9_*&[\]=,.])*\)({wsnl}|[()])*[:a-zA-Z_#{] { + + /* warning: "if (...)" must not overflow yytext, so the content + of function argument definitions is restricted, in particular + parentheses are not allowed */ + + /* if a function definition */ + /* note: "#define a (b) {" and "#if defined(a)\n#" are not */ + if ((braces == 0 && ppdefine == NO && yytext[0] != '#' && rules == NO) || + (braces == 1 && classdef == YES)) { + fcndef = YES; + token = FCNDEF; + goto fcn; + /* NOTREACHED */ + } + goto fcncal; + /* NOTREACHED */ + } +{identifier}/{ws}*\( { /* if a function call */ + fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) { + token = FCNCALL; + goto fcn; + /* NOTREACHED */ + } + if (template == NO) { + templateparens = parens; + template = YES; + } + goto ident; + /* NOTREACHED */ + } +{identifier}/([*]|{wsnl})+[a-zA-Z0-9_] { /* typedef name use */ + goto ident; + /* NOTREACHED */ + } +{identifier} { + char *s; + + if (global == YES && ppdefine == NO && yytext[0] != '#' && + external == NO && initializer == NO && + arraydimension == NO && structfield == NO && + template == NO && fcndef == NO) { + if (esudef == YES) { /* if enum/struct/union */ + token = MEMBERDEF; + } + else { + token = GLOBALDEF; + } + } + else { + ident: token = IDENT; + } + fcn: + /* if a long line */ + if (yyleng > STMTMAX) { + int c; + + /* skip to the end of the line */ + warning("line too long"); + while ((c = skipcomment_input()) != LEXEOF) { + if (c == '\n') { + unput(c); + break; + } + } + } + /* truncate a long symbol */ + if (yyleng - first > PATLEN) { + warning("symbol too long"); + yyleng = first + PATLEN; + yytext[yyleng] = '\0'; + } + /* if a keyword */ + yymore(); + if ((s = lookup(yytext + first)) != NULL) { + first = yyleng; + + /* if the start of a typedef */ + if (s == typedeftext) { + typedefbraces = braces; + oldtype = YES; + } + /* if an enum/struct/union */ + /* (needed for "typedef struct tag name;" so + tag isn't marked as the typedef name) */ + else if (s == enumtext || s == structtext || s == uniontext) { + } + /* if an external definition */ + else if (s == externtext) { + externalbraces = braces; + external = YES; + } + /* keyword doesn't start a function template */ + else if (templateparens == parens && template == YES) { + templateparens = -1; + template = NO; + } + else { /* next identifier after typedef was a keyword */ + oldtype = NO; + } + } + else { /* identifier */ + last = yyleng; + + /* if a class/enum/struct/union tag definition */ + if (tagdef && strnotequal(yytext + first, "class")) { + token = tagdef; + tagdef = '\0'; + if (braces == 0) { + esudef = YES; + } + } + /* if a typedef name */ + else if (braces == typedefbraces && oldtype == NO && + arraydimension == NO) { + token = TYPEDEF; + } + else { + oldtype = NO; + } + return(token); + /* NOTREACHED */ + } + } +\[ { /* array dimension (don't worry or about subscripts) */ + arraydimension = YES; + goto more; + /* NOTREACHED */ + } +\] { + arraydimension = NO; + goto more; + /* NOTREACHED */ + } +\\\n { /* preprocessor statement is continued on next line */ + goto eol; + /* NOTREACHED */ + } +\n { /* end of the line */ + if (ppdefine == YES) { /* end of a #define */ + ppdefine = NO; + yyless(yyleng - 1); /* rescan \n */ + last = first; + yymore(); + return(DEFINEEND); + } + /* skip the first 8 columns of a breakpoint listing line */ + /* and skip the file path in the page header */ + if (bplisting == YES) { + int c, i; + + switch (skipcomment_input()) { /* tab and EOF just fall through */ + case ' ': /* breakpoint number line */ + case '[': + for (i = 1; i < 8 && skipcomment_input() != LEXEOF; ++i) + ; + break; + case '.': /* header line */ + case '/': + /* skip to the end of the line */ + while ((c = skipcomment_input()) != LEXEOF) { + if (c == '\n') { + unput(c); + break; + } + } + break; + case '\n': /* empty line */ + unput('\n'); + break; + } + } + eol: + ++myylineno; + first = 0; + last = 0; + if (symbols > 0) { + return(NEWLINE); + } + lineno = myylineno; + } +\' { /* character constant */ + if (sdl == NO) { + multicharconstant('\''); + } + goto more; + /* NOTREACHED */ + } +\" { /* string constant */ + multicharconstant('"'); + goto more; + /* NOTREACHED */ + } +^{ws}+ { /* don't save leading white space */ + } +\#{ws}*include{ws}*["<][^"> \t\n]+ { /* #include file */ + char *s; + + s = strpbrk(yytext, "\"<"); + incfile(s + 1, s); + /* HBB: avoid pointer mismatch if yytext is + * unsigned, or a pointer */ + first = s - (char *)&(yytext[0]); + last = yyleng; + if (compress == YES) { + yytext[0] = '\2'; /* compress the keyword */ + } + yymore(); + return(INCLUDE); + /* NOTREACHED */ + } +\#{ws}*{identifier} | /* preprocessor keyword */ +{number} | /* number */ +. { /* punctuation and operators */ + more: first = yyleng; + yymore(); + } +%% + +void +initscanner(char *srcfile) +{ + char *s; + + if (maxifbraces == NULL) { + maxifbraces = mymalloc(miflevel * sizeof(int)); + preifbraces = mymalloc(miflevel * sizeof(int)); + } + first = 0; /* buffer index for first char of symbol */ + last = 0; /* buffer index for last char of symbol */ + lineno = 1; /* symbol line number */ + myylineno = 1; /* input line number */ + arraydimension = NO; /* inside array dimension declaration */ + bplisting = NO; /* breakpoint listing */ + braces = 0; /* unmatched left brace count */ + classdef = NO; /* c++ class definition */ + elseelif = NO; /* #else or #elif found */ + esudef = NO; /* enum/struct/union global definition */ + external = NO; /* external definition */ + externalbraces = -1; /* external definition outer brace count */ + fcndef = NO; /* function definition */ + global = YES; /* file global scope (outside functions) */ + iflevel = 0; /* #if nesting level */ + initializer = NO; /* data initializer */ + initializerbraces = -1; /* data initializer outer brace count */ + lex = NO; /* lex file */ + parens = 0; /* unmatched left parenthesis count */ + ppdefine = NO; /* preprocessor define statement */ + pseudoelif = NO; /* pseudo-#elif */ + oldtype = NO; /* next identifier is an old type */ + rules = NO; /* lex/yacc rules */ + sdl = NO; /* sdl file */ + structfield = NO; /* structure field declaration */ + tagdef = '\0'; /* class/enum/struct/union tag definition */ + template = NO; /* function template */ + templateparens = -1; /* function template outer parentheses count */ + typedefbraces = -1; /* initial typedef braces count */ + + BEGIN 0; + + /* if this is not a C file */ + if ((s = strrchr(srcfile, '.')) != NULL) { + switch (*++s) { /* this switch saves time on C files */ + case 'b': + if (strcmp(s, "bp") == 0) { /* breakpoint listing */ + bplisting = YES; + } + break; + case 'l': + if (strcmp(s, "l") == 0) { /* lex */ + lex = YES; + global = NO; + } + break; + case 's': + if (strcmp(s, "sd") == 0) { /* sdl */ + sdl = YES; + BEGIN SDL; + } + break; + case 'y': + if (strcmp(s, "y") == 0) { /* yacc */ + global = NO; + } + break; + } + } +} + +int +skipcomment_input(void) +{ + int c; + + if ((c = getc (yyin)) == '/') { + return comment (); + } + else { + return c; + } + +} + +int +comment_input(void) +{ + int c; + + c = getc (yyin); + + return c; +} + +int +comment(void) +{ + int c, lastc; + + do { + if ((c = getc(yyin)) == '*') { /* C comment */ + lastc = '\0'; + while ((c = getc(yyin)) != EOF && + (c != '/' || lastc != '*')) { /* fewer '/'s */ + if (c == '\n') { + ++myylineno; + } + lastc = c; + } + /* return a blank for Reiser cpp token concatenation */ + if ((c = getc(yyin)) == '_' || isalnum(c)) { + (void) ungetc(c, yyin); + c = ' '; + break; + } + } + else if (c == '/') { /* C++ comment */ + while ((c = getc(yyin)) != EOF && c != '\n') { + ; + } + break; + } + else { /* not a comment */ + (void) ungetc(c, yyin); + c = '/'; + break; + /* NOTREACHED */ + } + + /* there may be an immediately following comment */ + } while (c == '/'); + return(c); +} + +void +multicharconstant(char terminator) +{ + char c; + + /* scan until the terminator is found */ + while ((c = yytext[yyleng++] = comment_input()) != terminator) { + switch (c) { + case '\\': /* escape character */ + if ((yytext[yyleng++] = comment_input()) == '\n') { + ++myylineno; + } + break; + case '\t': /* tab character */ + + /* if not a lex program, continue */ + if (lex == NO) { + break; + } + /* fall through */ + + case '\n': /* illegal character */ + + /* assume the terminator is missing, so put + this character back */ + unput(c); + yytext[--yyleng] = '\0'; + /* fall through */ + + case LEXEOF: /* end of file */ + return; + + default: + /* change a control character to a blank */ + if (!isprint((unsigned char)c)) { + yytext[yyleng - 1] = ' '; + } + } + /* if this token will overflow the line buffer */ + /* note: '\\' may cause yyleng to be > STMTMAX */ + if (yyleng >= STMTMAX) { + + /* truncate the token */ + while ((c = comment_input()) != LEXEOF) { + if (c == terminator) { + unput(c); + break; + } + else if (c == '\n') { + ++myylineno; + } + } + } + } + yytext[yyleng] = '\0'; +} diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..686cfe5 --- /dev/null +++ b/src/version.h @@ -0,0 +1,47 @@ +/*=========================================================================== + 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: version.h,v 1.8 2001/07/05 14:31:00 broeker Exp $ */ + +/* cscope - interactive C symbol cross-reference + * + * Changing the cross-reference file part of the program version + * forces rebuilding of the cross-reference. + */ + +#ifndef CSCOPE_VERSION_H +#define CSCOPE_VERSION_H + +#define FILEVERSION 15 /* Initial Open Source and Linux Port */ +#define FIXVERSION ".6" /* feature and bug fix version */ + +#endif /* CSCOPE_VERSION_H */ diff --git a/src/vp.h b/src/vp.h new file mode 100644 index 0000000..0642191 --- /dev/null +++ b/src/vp.h @@ -0,0 +1,72 @@ +/*=========================================================================== + 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: vp.h,v 1.7 2004/04/30 15:31:43 broeker Exp $ */ + +/* + * VPATH assumptions: + * VPATH is the environment variable containing the view path + * where each path name is followed by ':', '\n', or '\0'. + * Embedded blanks are considered part of the path. + */ + +#ifndef CSCOPE_VP_H +#define CSCOPE_VP_H + +#define MAXPATH 200 /* max length for entire name */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# define HAVE_FCNTL_H 1 /* in case of doubt, assume it's there */ +#endif +#ifdef HAVE_FCNTL_H +# include <fcntl.h> /* needed for O_... open flags */ +#endif + +#include <sys/types.h> +#include <sys/stat.h> + +#if !NOMALLOC +extern char **vpdirs; /* directories (including current) in view path */ +#else +#define MAXDIR 25 /* same as libVP */ +#define DIRLEN 80 /* same as libVP */ +extern char vpdirs[MAXDIR][DIRLEN + 1]; +#endif +extern int vpndirs; /* number of directories in view path */ + +void vpinit(char *current_dir); +int vpopen(char *path, int oflag); +int vpaccess(char *path, mode_t amode); + +#endif /* CSCOPE_VP_H */ diff --git a/src/vpaccess.c b/src/vpaccess.c new file mode 100644 index 0000000..cb56730 --- /dev/null +++ b/src/vpaccess.c @@ -0,0 +1,59 @@ +/*=========================================================================== + 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: vpaccess.c,v 1.2 2000/05/03 22:02:10 petr Exp $ */ + +/* vpaccess - view path version of the access system call */ + +#include <stdio.h> +#include <unistd.h> +#include "vp.h" +#include <sys/types.h> + +int +vpaccess(char *path, mode_t amode) +{ + char buf[MAXPATH + 1]; + int returncode; + int i; + + if ((returncode = access(path, amode)) == -1 && path[0] != '/') { + vpinit(NULL); + for (i = 1; i < vpndirs; i++) { + (void) sprintf(buf, "%s/%s", vpdirs[i], path); + if ((returncode = access(buf, amode)) != -1) { + break; + } + } + } + return(returncode); +} diff --git a/src/vpfopen.c b/src/vpfopen.c new file mode 100644 index 0000000..bffbc20 --- /dev/null +++ b/src/vpfopen.c @@ -0,0 +1,64 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* vpfopen - view path version of the fopen library function */ + +#include <stdio.h> +#include <string.h> +#include "vp.h" +#include "global.h" + +static char const rcsid[] = "$Id: vpfopen.c,v 1.3 2001/03/27 14:09:19 broeker Exp $"; + +FILE * +vpfopen(char *filename, char *type) +{ + char buf[MAXPATH + 1]; + FILE *returncode; + int i; + + if ((returncode = myfopen(filename, type)) == NULL + && filename[0] != '/' + /* && strcmp(type, "r") == 0 */ /* HBB: this breaks if type=="rb" */ + && type[0] == 'r' + ) { + vpinit(NULL); + for (i = 1; i < vpndirs; i++) { + (void) sprintf(buf, "%s/%s", vpdirs[i], filename); + if ((returncode = myfopen(buf, type)) != NULL) { + break; + } + + } + } + return(returncode); +} diff --git a/src/vpinit.c b/src/vpinit.c new file mode 100644 index 0000000..15f90a0 --- /dev/null +++ b/src/vpinit.c @@ -0,0 +1,171 @@ +/*=========================================================================== + 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. + =========================================================================*/ + +/* vpinit - initialize vpdirs or update vpdirs based on currentdir */ + +#include <stdio.h> /* stderr */ +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include "vp.h" +#include "alloc.h" +#include "library.h" +#include "global.h" +#include "constants.h" + +static char const rcsid[] = "$Id: vpinit.c,v 1.8 2006/07/23 20:59:20 broeker Exp $"; + +#if !NOMALLOC +char **vpdirs; /* directories (including current) in view path */ +#else +char vpdirs[MAXDIR][DIRLEN + 1]; +#define MAXVPATH (MAXDIR * (DIRLEN + 1)) +#endif +int vpndirs; /* number of directories in view path */ + +void +vpinit(char *current_dir) +{ + char *suffix; /* path from view path node */ + char *vpath; /* VPATH environment variable value */ + char buf[MAXPATH + 1]; + int i; + char *s; +#if NOMALLOC + char *node; /* view path node */ + char vpathbuf[MAXVPATH + 1]; +#endif + + /* if an existing directory list is to be updated, free it */ + if (current_dir != NULL && vpndirs > 0) { +#if !NOMALLOC + for (i = 0; i < vpndirs; ++i) { + free(vpdirs[i]); + } + free(vpdirs); +#endif + vpndirs = 0; + } + /* return if the directory list has been computed */ + /* or there isn't a view path environment variable */ + if (vpndirs > 0 || (vpath = getenv("VPATH")) == NULL || + *vpath == '\0') { + return; + } + /* if not given, get the current directory name */ + if (current_dir == NULL && (current_dir = getcwd(buf, MAXPATH)) == NULL) { + (void) fprintf(stderr, "%s: cannot get current directory name\n", argv0); + return; + } + /* see if this directory is in the first view path node */ + for (i = 0; vpath[i] == current_dir[i] && vpath[i] != '\0'; ++i) { + ; + } + if ((vpath[i] != ':' && vpath[i] != '\0') || + (current_dir[i] != '/' && current_dir[i] != '\0')) { + return; + } + suffix = ¤t_dir[i]; +#if !NOMALLOC + + /* count the nodes in the view path */ + vpndirs = 1; + for (i = 0; vpath[i] != '\0'; ++i) { + if (vpath[i] == ':' && vpath[i + 1]) { + ++vpndirs; + } + } + /* create the source directory list */ + vpdirs = mymalloc(vpndirs * sizeof(char *)); + + /* don't change VPATH in the environment */ + vpath = my_strdup(vpath); + + /* split the view path into nodes */ + for (i = 0, s = vpath; *s != '\0'; ++i) { + vpdirs[i] = s; + while (*s != '\0' && *++s != ':') { + if (*s == '\n') { + *s = '\0'; + } + } + if (*s != '\0') { + *s++ = '\0'; + } + } + /* convert the view path nodes to directories */ + for (i = 0; i < vpndirs; ++i) { + s = mymalloc((strlen(vpdirs[i]) + strlen(suffix) + 1)); + (void) strcpy(s, vpdirs[i]); + (void) strcat(s, suffix); + vpdirs[i] = s; + } + free(vpath); +#else + /* don't change VPATH in the environment */ + if (strlen(vpath) > MAXVPATH) { + (void) fprintf(stderr, "%s: VPATH is longer than %d characters: %s\n", argv0, MAXVPATH, vpath); + return; + } + (void) strcpy(vpathbuf, vpath); + s = vpathbuf; + + /* convert the view path nodes to directories */ + while (*s != '\0') { + + /* get the next node */ + node = s; + while (*s != '\0' && *++s != ':') { + if (*s == '\n') { + *s = '\0'; + } + } + if (*s != '\0') { + *s++ = '\0'; + } + /* ignore a directory that is too long */ + if (strlen(node) + strlen(suffix) > DIRLEN) { + (void) fprintf(stderr, "%s: VPATH directory is longer than %d characters: %s%s\n", argv0, DIRLEN, node, suffix); + } + else if (vpndirs >= MAXDIR) { + (void) fprintf(stderr, "%s: VPATH has more than %d nodes\n", argv0, vpndirs); + return; + } + else { + /* create the view path directory */ + (void) strcpy(vpdirs[vpndirs], node); + (void) strcat(vpdirs[vpndirs], suffix); + ++vpndirs; + } + } +#endif +} diff --git a/src/vpopen.c b/src/vpopen.c new file mode 100644 index 0000000..777f168 --- /dev/null +++ b/src/vpopen.c @@ -0,0 +1,62 @@ +/*=========================================================================== + 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. + =========================================================================*/ + + +/* vpopen - view path version of the open system call */ + +#include <stdio.h> +#include "global.h" +#include "vp.h" + +#define OPENFLAG_READ 0 + +static char const rcsid[] = "$Id: vpopen.c,v 1.4 2002/07/28 15:40:07 broeker Exp $"; + +int +vpopen(char *path, int oflag) +{ + char buf[MAXPATH + 1]; + int returncode; + int i; + + if ((returncode = myopen(path, oflag, 0666)) == -1 && path[0] != '/' && + oflag == OPENFLAG_READ) { + vpinit(NULL); + for (i = 1; i < vpndirs; i++) { + (void) sprintf(buf, "%s/%s", vpdirs[i], path); + if ((returncode = myopen(buf, oflag, 0666)) != -1) { + break; + } + } + } + return(returncode); +} @@ -0,0 +1,160 @@ +#! /bin/sh +# ylwrap - wrapper for lex/yacc invocations. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002 Free Software +# Foundation, Inc. +# +# Written by Tom Tromey <tromey@cygnus.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Usage: +# ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]... +# * INPUT is the input file +# * OUTPUT is file PROG generates +# * DESIRED is file we actually want +# * PROGRAM is program to run +# * ARGS are passed to PROG +# Any number of OUTPUT,DESIRED pairs may be used. + +# The input. +input="$1" +shift +case "$input" in + [\\/]* | ?:[\\/]*) + # Absolute path; do nothing. + ;; + *) + # Relative path. Make it absolute. + input="`pwd`/$input" + ;; +esac + +pairlist= +while test "$#" -ne 0; do + if test "$1" = "--"; then + shift + break + fi + pairlist="$pairlist $1" + shift +done + +# The program to run. +prog="$1" +shift +# Make any relative path in $prog absolute. +case "$prog" in + [\\/]* | ?:[\\/]*) ;; + *[\\/]*) prog="`pwd`/$prog" ;; +esac + +# FIXME: add hostname here for parallel makes that run commands on +# other machines. But that might take us over the 14-char limit. +dirname=ylwrap$$ +trap "cd `pwd`; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +mkdir $dirname || exit 1 + +cd $dirname + +case $# in + 0) $prog "$input" ;; + *) $prog "$@" "$input" ;; +esac +status=$? + +if test $status -eq 0; then + set X $pairlist + shift + first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + + # The directory holding the input. + input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'` + # Quote $INPUT_DIR so we can use it in a regexp. + # FIXME: really we should care about more than `.' and `\'. + input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'` + + while test "$#" -ne 0; do + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then + # If $2 is an absolute path name, then just use that, + # otherwise prepend `../'. + case "$2" in + [\\/]* | ?:[\\/]*) target="$2";; + *) target="../$2";; + esac + + # Edit out `#line' or `#' directives. + # + # We don't want the resulting debug information to point at + # an absolute srcdir; it is better for it to just mention the + # .y file with no path. + # + # We want to use the real output file name, not yy.lex.c for + # instance. + # + # We want the include guards to be adjusted too. + FROM=`echo "$from" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + TARGET=`echo "$2" | sed \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\ + -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'` + sed "/^#/{s,$input_rx,,;s,$from,$2,;s,$FORM,$TO,;}" "$from" >"$target" || + status=$? + else + # A missing file is only an error for the first file. This + # is a blatant hack to let us support using "yacc -d". If -d + # is not specified, we don't want an error when the header + # file is "missing". + if test $first = yes; then + status=1 + fi + fi + shift + shift + first=no + done +else + status=$? +fi + +# Remove the directory. +cd .. +rm -rf $dirname + +exit $status |