Index: ossp-pkg/iselect/.configure RCS File: /v/ossp/cvs/ossp-pkg/iselect/.configure,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/.configure,v' | diff -u /dev/null - -L'ossp-pkg/iselect/.configure' 2>/dev/null --- ossp-pkg/iselect/.configure +++ - 2024-04-25 08:53:01.894352974 +0200 @@ -0,0 +1,7 @@ +#!/bin/sh +CC=cc \ +sh ./configure \ + --prefix=/tmp/iselect \ + --with-incdir=/usr/opkg/include \ + --with-libdir=/usr/opkg/lib \ + "$@" Index: ossp-pkg/iselect/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/iselect/ChangeLog,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/iselect/ChangeLog,v' | diff -u /dev/null - -L'ossp-pkg/iselect/ChangeLog' 2>/dev/null --- ossp-pkg/iselect/ChangeLog +++ - 2024-04-25 08:53:01.896989553 +0200 @@ -0,0 +1,69 @@ + + C h a n g e L o g o f i S e l e c t + ___________________________________________________________________________ + + Changes between 1.2.0 and 1.3.0 + ------------------------------- + 040911 o upgraded GNU shtool from 1.6.2 to 2.0.1 + o upgraded build environment to GNU autoconf 2.59 + 200404 o upgraded GNU shtool from 1.6.0 to 1.6.2 + o fixed years in copyright + 2002xx o upgraded GNU shtool from 1.5.0 to 1.6.0 + o fixed years in copyright + 2000xx o upgraded GNU shtool from 1.3.0 to 1.5.0 + o fixed years in copyright + 990530 o fixed iselect.pod: %s[ -> %[ + 990622 o fixed type conversion [Mark A. Hershberger ] + + Changes between 1.1.0 and 1.2.0 + ------------------------------- + 990331 o fixed timestamps to avoid asc2c runs for endusers + o adjusted year range and license hints in copyright messages + o added shtool and kicked out old scripts + + Changes between 1.0.4 and 1.1.0 + ------------------------------- + 980405 o added -k and -K options to provide + additional RETURN keys + o upgraded etc/newvers + o added -d option for setting the tag delimiters + and changed the default from "%%"/"%%" to "<"/">" + o added support for bold tag .. ala HTML + o added support query inputs via %[text]s and %[text]S + 980419 o release cleanups + + Changes between 1.0.3 and 1.0.4 + ------------------------------- + 971210 o added GotoURL frontend in contrib/gotourl/ + o renamed contrib/ to example/ + 971229 o enhanced example/melm/melm + 980102 o added 1998 to copyright messages and removed "all + rights reserved" because this conflicts with GNU GPL. + o now exit() on CTRL-C instead of just doing an endwin(). + 980103 o fixed the iselect.pod manpage a little bit + + Changes between 1.0.2 and 1.0.3 + ------------------------------- + 971202 o documented the program a little bit more + + Changes between 1.0.1 and 1.0.2 + ------------------------------- + 971123 o added support for S-Slang Curses + o fixed RETURN key handling + o slightly adjusted INSTALL file + o ported to major platforms (see PORTING file) + + Changes between 1.0.0 and 1.0.1 + ------------------------------- + 971030 o slightly adjusted the README and iselect_readme.txt + files for better description abstract. + o added PORTING file + o adjusted VERSIONS file + o cleanup and made -Wall quiet + o added support for both SVr4 and NCurses curses + o made a better dot.ilogin file + + *GENESIS* 1.0.0 + --------------- + 9709xx ... + Index: ossp-pkg/iselect/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/iselect/Makefile.in,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/iselect/Makefile.in,v' 2>/dev/null --- Makefile.in 2000/07/25 11:53:24 1.2 +++ Makefile.in 2004/09/11 15:18:49 1.3 @@ -16,10 +16,6 @@ # installation tools SHTOOL = @SHTOOL@ -NEWVERS = $(SHTOOL) version -INSTALL = $(SHTOOL) install -MKDIR = $(SHTOOL) mkdir -FIXPERM = $(SHTOOL) fixperm # installation paths prefix = @prefix@ @@ -39,12 +35,12 @@ config: configure config_ac.h.in -configure: configure.in aclocal.m4 acconfig.h +configure: configure.in aclocal.m4 rm -f configure autoconf configure.in >configure chmod 770 configure -config_ac.h.in: configure.in acconfig.h +config_ac.h.in: configure.in rm -f config_ac.h.in autoheader configure.in >config_ac.h.in @@ -52,64 +48,40 @@ # THE RELEASE STUFF # ------------------------------------------------ -_GETDISTINFO = \ - _version=`$(NEWVERS) -lc -dshort iselect_version.c`; \ - _date=`date '+%y%m%d_%H%M'` - -_BUILDDIST = \ - echo "Creating tarball..."; \ - tar cvf - * |\ - tardy --user_number=1000 --user_name=rse \ - --group_number=1000 --group_name=en \ - --prefix=$${_distname} - |\ - gzip >$${_tarball}; \ - echo "Done"; \ - ls -l $${_tarball} - -_NEWVERS = \ - $(NEWVERS) -lc -piSelect $$OPT iselect_version.c; \ - V=`$(NEWVERS) -lc -dlong iselect_version.c`;\ - sed -e "s/Version .*(.*)/Version $$V/g" README.n && mv README.n README; \ - sed -e "s/Version .*(.*)/Version $$V/g" iselect_readme.txt.n && mv iselect_readme.txt.n iselect_readme.txt; +_VERSION_FILE = \ + iselect_version.c -_UPDATEVERS = \ - V=`$(NEWVERS) -lc -dshort iselect_version.c`;\ - $(NEWVERS) -lc -piSelect -s $$V iselect_version.c; \ - V=`$(NEWVERS) -lc -dlong iselect_version.c`;\ +_VERSION = \ + echo "updating package version"; \ + $(SHTOOL) version -lc -n 'iSelect' -p iselect_ $$OPT $(_VERSION_FILE); \ + V=`$(SHTOOL) version -lc -dlong $(_VERSION_FILE)`; \ sed -e "s/Version .*(.*)/Version $$V/g" README.n && mv README.n README; \ - sed -e "s/Version .*(.*)/Version $$V/g" iselect_readme.txt.n && mv iselect_readme.txt.n iselect_readme.txt; - -release: distclean fixperm - @$(_GETDISTINFO) \ - _distname="iselect-$${_version}"; \ - _tarball="/tmp/$${_distname}.tar.gz"; \ - echo "Release Distribution: iSelect Version $$_version"; \ - $(_BUILDDIST); \ - mv /tmp/$${_distname}.tar.gz $${_distname}.tar.gz; \ + sed -e "s/Version .*(.*)/Version $$V/g" iselect_readme.txt.n && mv iselect_readme.txt.n iselect_readme.txt +_TARBALL = \ + $(SHTOOL) tarball -o $${NAME}.tar.gz -d $${NAME} -u rse -g en \ + -e 'CVS,\.cvsignore,\.configure,\.\#.*,\.[ao]$$' -c 'gzip --best' . + +dist: distclean fixperm + @V=`$(SHTOOL) version -l c -d short $(_VERSION_FILE)`; NAME="iselect-$$V"; \ + $(ECHO) "Rolling RELEASE tarball $$NAME.tar.gz"; $(_TARBALL) snap: distclean fixperm - @$(_GETDISTINFO) \ - _distname="iselect-$${_version}-SNAP-$$_date"; \ - _tarball="/tmp/$${_distname}.tar.gz"; \ - echo "Snap of whole source tree: iSelect Version $$_version as of $$_date"; \ - $(_BUILDDIST); \ - mv /tmp/$${_distname}.tar.gz $${_distname}.tar.gz + @V=`$(SHTOOL) version -l c -d short $(_VERSION_FILE)`; NAME="iselect-$$V-SNAP"; \ + $(ECHO) "Rolling SNAPSHOT tarball $$NAME.tar.gz"; $(_TARBALL) new-version: - OPT="-iv"; $(_NEWVERS) -new-revision: - OPT="-ir"; $(_NEWVERS) -new-betalevel: - OPT="-ib"; $(_NEWVERS) -new-patchlevel: - OPT="-iP"; $(_NEWVERS) -new-release: - OPT="-s$(R)"; $(_NEWVERS) + @V="$(VERSION)"; \ + if [ ".$$V" != . ]; then \ + OPT="-s$$V"; \ + else \ + OPT="-e"; \ + fi; \ + $(_VERSION) update-version: - $(_UPDATEVERS) + @OPT="-s`$(SHTOOL) version -lc -dshort $(_VERSION_FILE)`" && $(_VERSION) fixperm: - $(FIXPERM) * + $(SHTOOL) fixperm * # ------------------------------------------------ # THE PROGRAM @@ -137,14 +109,14 @@ $(CC) $(CFLAGS) -o iselect_help.o -c iselect_help.c iselect_help.c: iselect_help.txt iselect_version.c - V=`$(NEWVERS) -l c -d long iselect_version.c`; \ + V=`$(SHTOOL) version -l c -d long iselect_version.c`; \ ./etc/asc2c iselect_help.txt iselect_help iSelect_Help "$$V" iselect_readme.o: iselect_readme.c $(CC) $(CFLAGS) -o iselect_readme.o -c iselect_readme.c iselect_readme.c: iselect_readme.txt iselect_version.c - V=`$(NEWVERS) -l c -d long iselect_version.c`; \ + V=`$(SHTOOL) version -l c -d long iselect_version.c`; \ ./etc/asc2c iselect_readme.txt iselect_readme iSelect_README "$$V" # ------------------------------------------------ @@ -152,7 +124,7 @@ # ------------------------------------------------ iselect.1: iselect.pod iselect_version.c - V=`$(NEWVERS) -l c -d long iselect_version.c`; \ + V=`$(SHTOOL) version -l c -d long iselect_version.c`; \ sed -e "s|\@V\@|$$V|g" \ /tmp/iselect.pod; \ pod2man --section=1 \ @@ -166,10 +138,10 @@ # ------------------------------------------------ install: all - $(MKDIR) $(bindir) - $(MKDIR) $(mandir)/man1 - $(INSTALL) -c -m 755 -s iselect $(bindir)/iselect - $(INSTALL) -c -m 644 iselect.1 $(mandir)/man1/iselect.1 + $(SHTOOL) mkdir -f -p -m 755 $(bindir) + $(SHTOOL) mkdir -f -p -m 755 $(mandir)/man1 + $(SHTOOL) install -c -m 755 -s iselect $(bindir)/iselect + $(SHTOOL) install -c -m 644 iselect.1 $(mandir)/man1/iselect.1 # ------------------------------------------------ # CLEANUP Index: ossp-pkg/iselect/README RCS File: /v/ossp/cvs/ossp-pkg/iselect/README,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/README,v' | diff -u /dev/null - -L'ossp-pkg/iselect/README' 2>/dev/null --- ossp-pkg/iselect/README +++ - 2024-04-25 08:53:01.903746433 +0200 @@ -0,0 +1,34 @@ + _ ____ _ _ + (_) ___| ___| | ___ ___| |_ + / /\___ \ / _ \ |/ _ \/ __| __| + / / ___) | __/ | __/ (__| |_ + (_( |____/ \___|_|\___|\___|\__| + + iSelect -- Interactive Selection Tool + + iSelect is an interactive line selection tool for ASCII files, operating + via a full-screen Curses-based terminal session. It can be used either as + an user interface frontend controlled by a Bourne-Shell/Perl/Tcl backend + as its control script or in batch mode as a pipeline filter (usually + between grep and the final executing command). + + Version 1.3.0 (11-Sep-2004) + + The latest release can be found on + http://www.engelschall.com/sw/iselect/ + + Copyright (c) 1997-2004 Ralf S. Engelschall + + This program is free software; it may be redistributed and/or modified only + under the terms of the GNU General Public License, which may be found in the + iSelect source distribution. Look at the file COPYING for details. + + 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 the GNU General Public License + for more details. + + Ralf S. Engelschall + rse@engelschall.com + www.engelschall.com + Index: ossp-pkg/iselect/VERSIONS RCS File: /v/ossp/cvs/ossp-pkg/iselect/VERSIONS,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/VERSIONS,v' | diff -u /dev/null - -L'ossp-pkg/iselect/VERSIONS' 2>/dev/null --- ossp-pkg/iselect/VERSIONS +++ - 2024-04-25 08:53:01.906328741 +0200 @@ -0,0 +1,13 @@ + + V E R S I O N S + _______________ + + 1.0.0 19971011 + 1.0.1 19971030 + 1.0.2 19971123 + 1.0.3 19971202 + 1.0.4 19980103 + 1.1.0 19980419 + 1.2.0 19990331 + 1.3.0 20040406 + Index: ossp-pkg/iselect/acconfig.h RCS File: /v/ossp/cvs/ossp-pkg/iselect/Attic/acconfig.h,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/Attic/acconfig.h,v' | diff -u /dev/null - -L'ossp-pkg/iselect/acconfig.h' 2>/dev/null --- ossp-pkg/iselect/acconfig.h +++ - 2024-04-25 08:53:01.908871089 +0200 @@ -0,0 +1,12 @@ +#ifndef CONFIG_AC_H +#define CONFIG_AC_H +/* +** config_ac.h -- AUTO configuration header file +** Copyright (c) Ralf S. Engelschall, +*/ + +@TOP@ + +@BOTTOM@ + +#endif /* CONFIG_AC_H */ Index: ossp-pkg/iselect/aclocal.m4 RCS File: /v/ossp/cvs/ossp-pkg/iselect/aclocal.m4,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/aclocal.m4,v' | diff -u /dev/null - -L'ossp-pkg/iselect/aclocal.m4' 2>/dev/null --- ossp-pkg/iselect/aclocal.m4 +++ - 2024-04-25 08:53:01.911384001 +0200 @@ -0,0 +1,378 @@ +dnl # +dnl # aclocal.m4 -- Local M4 functions for GNU autoconf +dnl # Copyright (c) Ralf S. Engelschall, +dnl # +dnl # NOTICE: +dnl # all defined macros are named AC_* +dnl # all defined and used variables are named acl-* +dnl # +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## support for User Variables +dnl ## +dnl ########################################################## +dnl +define(AC_UVAR_CODE,[dnl +if test .[$]ac_with_uvar = .yes; then +$1 +fi +]) +dnl +define(AC_UVAR_ANTICODE,[dnl +if test .[$]ac_with_uvar = .no; then +$1 +fi +]) +dnl +dnl +dnl ----------- +dnl +dnl +define(AC_UVAR_INIT,[dnl +AC_ARG_WITH(uvar,dnl +[ --with-uvar support for Runtime User Variable Setup], +ac_with_uvar=yes, +ac_with_uvar=no +)dnl +dnl +dnl # because since autoconf 2.3 the following two lines +dnl # are at AC_OUTPUT which is to late for us :-( +test "x$prefix" = xNONE && prefix=$ac_default_prefix +test "x$exec_prefix" = xNONE && exec_prefix="${prefix}" +dnl +AC_UVAR_CODE(dnl +ac_uvar_editfile=/tmp/usrvar.tmp +rm -f $ac_uvar_editfile +echo "##" >>$ac_uvar_editfile +echo "## RunTime User Variable Setup" >>$ac_uvar_editfile +echo -n "## GNU autoconf Version " >>$ac_uvar_editfile +echo "AC_ACVERSION" >>$ac_uvar_editfile +echo "## created: `date`" >>$ac_uvar_editfile +echo "##" >>$ac_uvar_editfile +echo "" >>$ac_uvar_editfile +)dnl +])dnl +dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_VERB,[dnl +AC_UVAR_CODE(dnl +cat >>$ac_uvar_editfile <<'EOF' +$1dnl +EOF +)dnl +])dnl +dnl +dnl ----------- +dnl +define(AC_SET,[dnl +$1="$2" +AC_SUBST($1) dnl +])dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_SET,[dnl +AC_SET($1, $2) dnl +AC_UVAR_CODE(dnl + echo '$1="$2"' >>$ac_uvar_editfile +)dnl +])dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_SETQUOTE,[dnl +AC_SET($1, $2) dnl +AC_UVAR_CODE(dnl + echo -n '$1="' >>$ac_uvar_editfile + echo -n "$2" >>$ac_uvar_editfile + echo '"' >>$ac_uvar_editfile +)dnl +])dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_SETCHK,[dnl +if test -z "[$]$1"; then +AC_UVAR_SET($1, $2) dnl +else +if test .[$]$1 = .NONE; then +AC_UVAR_SET($1, $2) dnl +else +AC_SUBST($1)dnl +AC_UVAR_CODE(dnl + echo -n '$1="' >>$ac_uvar_editfile + echo -n "[$]$1" >>$ac_uvar_editfile + echo '"' >>$ac_uvar_editfile +)dnl +fi +fi +])dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_SETCHKQUOTE,[dnl +if test -z "[$]$1"; then +AC_UVAR_SET($1, $2) dnl +else +if test .[$]$1 = .NONE; then +AC_UVAR_SET($1, $2) dnl +else +AC_SUBST($1)dnl +AC_UVAR_CODE(dnl + echo -n '$1="' >>$ac_uvar_editfile + echo -n "$2" >>$ac_uvar_editfile + echo '"' >>$ac_uvar_editfile +)dnl +fi +fi +])dnl +dnl +dnl ----------- +dnl +define(AC_UVAR_OUTPUT,[dnl +AC_UVAR_CODE(dnl +cat >>$ac_uvar_editfile <<'EOF' + +##EOF## +EOF +if test x$withval = xyes ; then + ${EDITOR-vi} $ac_uvar_editfile + . $ac_uvar_editfile +else + if test -r $withval ; then + cp $withval $ac_uvar_editfile + ${EDITOR-vi} $ac_uvar_editfile + . $ac_uvar_editfile + cp $ac_uvar_editfile $withval + else + ${EDITOR-vi} $ac_uvar_editfile + . $ac_uvar_editfile + cp $ac_uvar_editfile $withval + fi +fi +rm -f $ac_uvar_editfile +)dnl +])dnl +dnl +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## check for existence of HAVE_SYSEXISTS definitions +dnl ## +dnl ########################################################## +dnl +dnl +define(AC_EXRC,[dnl +dnl -> HAVE_EXRC +])dnl +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## check for supported system type +dnl ## +dnl ########################################################## +dnl +dnl +AC_DEFUN(AC_SUPPORTED_CANONICAL_SYSTEM,[dnl +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl + +ac_config_sup=$ac_aux_dir/config.sup + +AC_MSG_CHECKING(for supported host system type) +host=`$ac_config_sup $host_alias` +host_cpu=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +AC_MSG_RESULT($host) + +AC_MSG_CHECKING(for supported target system type) +target=`$ac_config_sup $target_alias` +target_cpu=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +AC_MSG_RESULT($target) + +AC_MSG_CHECKING(for supported build system type) +build=`$ac_config_sup $build_alias` +build_cpu=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` +AC_MSG_RESULT($build) + +ac_config_hc_dir=config + +if test -r ${ac_config_hc_dir}/cpu-${host_cpu}.h; then + host_cpu_H=1 +else + host_cpu_H=0 +fi +if test -r ${ac_config_hc_dir}/cpu-${host_cpu}.c; then + host_cpu_C=1 +else + host_cpu_C=0 +fi + +if test -r ${ac_config_hc_dir}/vendor-${host_vendor}.h; then + host_vendor_H=1 +else + host_vendor_H=0 +fi +if test -r ${ac_config_hc_dir}/vendor-${host_vendor}.c; then + host_vendor_C=1 +else + host_vendor_C=0 +fi + +if test -r ${ac_config_hc_dir}/os-${host_os}.h; then + host_os_H=1 +else + host_os_H=0 +fi +if test -r ${ac_config_hc_dir}/os-${host_os}.c; then + host_os_C=1 +else + host_os_C=0 +fi +AC_SUBST(host_cpu_H) +AC_SUBST(host_cpu_C) +AC_SUBST(host_vendor_H) +AC_SUBST(host_vendor_C) +AC_SUBST(host_os_H) +AC_SUBST(host_os_C) +])dnl +dnl +dnl +dnl +define(AC_CONFIG_PARAMS,[dnl + +AC_MSG_CHECKING(for name of user) +confuser="$LOGNAME" +AC_MSG_RESULT($confuser) +AC_SUBST(confuser) + +AC_MSG_CHECKING(for name of host) +confhost="`uname -n`" +AC_MSG_RESULT($confhost) +AC_SUBST(confhost) + +AC_MSG_CHECKING(for current date) +confdate="`date`" +AC_MSG_RESULT($confdate) +AC_SUBST(confdate) + +])dnl +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## check for fixed distribution tree and fix it if needed +dnl ## +dnl ########################################################## +dnl +dnl +AC_DEFUN(AC_FIX_DIST_TREE,[dnl +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl + +ac_fixdist=$ac_aux_dir/fixdist + +AC_MSG_CHECKING(for fixed distribution) +# Make sure we can run fixdist +if $ac_fixdist -t >/dev/null 2>&1; then + AC_MSG_RESULT(already fixed tree) +else + AC_MSG_RESULT(vanilla tree => fixing...) + $ac_fixdist +fi +])dnl +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## check for generation mode: production or debug +dnl ## +dnl ########################################################## +dnl +dnl +define(AC_GENMODE,[dnl +AC_MSG_CHECKING(genmode) +AC_ARG_ENABLE(production,dnl +[ --enable-production to enable procution code and disable debug], +GENMODE=production +CFLAGS="-O" +CXXFLAGS="-O" +LDFLAGS="-O" +LDXXFLAGS="-O" +if test X$GCC = Xyes; then + CFLAGS="$CFLAGS -pipe" + CXXFLAGS="$CXXFLAGS -pipe" +fi +, +GENMODE=debug +CFLAGS="-DDEBUG -g" +CXXFLAGS="-DDEBUG -g" +LDFLAGS="-g" +LDXXFLAGS="-g" +if test X$GCC = Xyes; then + CFLAGS="$CFLAGS -ggdb3 -pipe" + CXXFLAGS="$CXXFLAGS -ggdb3 -pipe" + LDFLAGS="$LDFLAGS -ggdb3" + LDXXFLAGS="$LDXXFLAGS -ggdb3" +fi +)dnl +AC_SUBST(CFLAGS) +AC_SUBST(CXXFLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(LDXXFLAGS) +AC_SUBST(GENMODE) +AC_MSG_RESULT($GENMODE) +])dnl +dnl +dnl +dnl ########################################################## +dnl ## +dnl ## Startup Message +dnl ## +dnl ########################################################## +dnl +define(AC_STARTUP_MSG,[dnl +X=`cat Laby/Src/Config/Version.c | sed -e '1,/GNUVersion/d' | head -1 | sed -e 's/^ *"//' | sed -e 's/"; *$//'` +AC_MSG_RESULT(Configuring $X) +])dnl +dnl +define(AC_CONFIGURE_PART,[dnl +AC_MSG_RESULT() +AC_MSG_RESULT(${T_MD}$1${T_ME}) +])dnl +dnl +dnl ########################################################## +dnl ## +dnl ## GNU Make detection +dnl ## +dnl ########################################################## +dnl +define(AC_IS_GNU_MAKE,[dnl +AC_MSG_CHECKING([whether your default make program is GNU make]) +if test ".`make -v 2>/dev/null | grep 'GNU Make'`" = . ; then + IS_GNU_MAKE=0 + STATIC_MFLAGS="" + AC_MSG_RESULT([no, but that's ok]) +else + IS_GNU_MAKE=1 + STATIC_MFLAGS="--no-print-directory" + AC_MSG_RESULT([yes, fine but overkill]) +fi +AC_SUBST(IS_GNU_MAKE) +AC_SUBST(STATIC_MFLAGS) +])dnl +dnl +dnl ####### +define(AC_INIT_BINSH, +[#! /bin/sh +# AAA +]) Index: ossp-pkg/iselect/config_ac.h.in RCS File: /v/ossp/cvs/ossp-pkg/iselect/config_ac.h.in,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/config_ac.h.in,v' | diff -u /dev/null - -L'ossp-pkg/iselect/config_ac.h.in' 2>/dev/null --- ossp-pkg/iselect/config_ac.h.in +++ - 2024-04-25 08:53:01.914004120 +0200 @@ -0,0 +1,64 @@ +/* config_ac.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* 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 to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* use plain Curses */ +#undef USE_CURSES + +/* use NCurses */ +#undef USE_NCURSES + +/* use SLcurses */ +#undef USE_SLCURSES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const Index: ossp-pkg/iselect/configure RCS File: /v/ossp/cvs/ossp-pkg/iselect/configure,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/iselect/configure,v' 2>/dev/null --- configure 2000/07/25 11:53:24 1.2 +++ configure 2004/09/11 15:18:49 1.3 @@ -1,43 +1,327 @@ #! /bin/sh +# From configure.in 1.0. +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 (OpenPKG-CURRENT). +# +# 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 -# From configure.in Revision: 1.12 -SHTOOL="./etc/shtool" -T_MD=`$SHTOOL echo -e %B 2>/dev/null` -T_ME=`$SHTOOL echo -e %b 2>/dev/null` -echo "${T_MD}Configuring for iSelect `./etc/shtool version -lc -dlong iselect_version.c`${T_ME}" -echo "Copyright (c) 1996-1999 Ralf S. Engelschall, All Rights Reserved." +# 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'" -# Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.14 -# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -# Defaults: -ac_help= +# 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 -# Any additions from configure.in: +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= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="README" ac_default_prefix=/usr/local -ac_help="$ac_help - --enable-debug to enable the debugging options for compilation" -ac_help="$ac_help - --with-incdir=DIR add DIR to the include path" -ac_help="$ac_help - --with-libdir=DIR add DIR to the library path" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP debug SET_MAKE SHTOOL EGREP 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. -build=NONE -cache_file=./config.cache +cache_file=/dev/null exec_prefix=NONE -host=NONE no_create= -nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE @@ -46,10 +330,15 @@ silent= site= srcdir= -target=NONE 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' @@ -63,17 +352,9 @@ infodir='${prefix}/info' mandir='${prefix}/man' -# Initialize some other variables. -subdirs= -MFLAGS= MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} -# Maximum number of lines to put in a shell here document. -ac_max_here_lines=12 - 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" @@ -81,59 +362,59 @@ continue fi - case "$ac_option" in - -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; - esac + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. - case "$ac_option" in + case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; + bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) - ac_prev=build ;; + ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build="$ac_optarg" ;; + 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" ;; + 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" ;; + datadir=$ac_optarg ;; -disable-* | --disable-*) - ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - eval "enable_${ac_feature}=no" ;; + 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=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } - fi - ac_feature=`echo $ac_feature| sed 's/-/_/g'` - case "$ac_option" in - *=*) ;; + 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'" ;; + eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -142,95 +423,47 @@ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; + exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; - -help | --help | --hel | --he) - # 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 << EOF -Usage: configure [options] [host] -Options: [defaults in brackets after descriptions] -Configuration: - --cache-file=FILE cache test results in FILE - --help print this message - --no-create do not create output files - --quiet, --silent do not print \`checking...' messages - --version print the version of autoconf that created configure -Directory and file names: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [same as prefix] - --bindir=DIR user executables in DIR [EPREFIX/bin] - --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] - --libexecdir=DIR program executables in DIR [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data in DIR - [PREFIX/share] - --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data in DIR - [PREFIX/com] - --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] - --libdir=DIR object code libraries in DIR [EPREFIX/lib] - --includedir=DIR C header files in DIR [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] - --infodir=DIR info documentation in DIR [PREFIX/info] - --mandir=DIR man documentation in DIR [PREFIX/man] - --srcdir=DIR find the sources in DIR [configure dir or ..] - --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 -EOF - cat << EOF -Host type: - --build=BUILD configure for building on BUILD [BUILD=HOST] - --host=HOST configure for HOST [guessed] - --target=TARGET configure for TARGET [TARGET=HOST] -Features and packages: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --x-includes=DIR X include files are in DIR - --x-libraries=DIR X library files are in DIR -EOF - if test -n "$ac_help"; then - echo "--enable and --with options recognized:$ac_help" - fi - exit 0 ;; + -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 ;; + ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) - host="$ac_optarg" ;; + 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" ;; + includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; + infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; + 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" ;; + libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ @@ -239,19 +472,19 @@ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; + localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; + 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) + | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ @@ -265,26 +498,26 @@ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir="$ac_optarg" ;; + oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; + 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_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_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ @@ -301,7 +534,7 @@ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name="$ac_optarg" ;; + program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) @@ -311,7 +544,7 @@ ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; + sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ @@ -322,58 +555,57 @@ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; + sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) - site="$ac_optarg" ;; + site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir="$ac_optarg" ;; + 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" ;; + sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; + ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target="$ac_optarg" ;; + target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; - -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.14" - exit 0 ;; + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; -with-* | --with-*) - ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi + 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 - *=*) ;; + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac - eval "with_${ac_package}='$ac_optarg'" ;; + eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) - ac_package=`echo $ac_option|sed -e 's/-*without-//'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then - { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } - fi - ac_package=`echo $ac_package| sed 's/-/_/g'` - eval "with_${ac_package}=no" ;; + 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. @@ -384,99 +616,110 @@ 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_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" ;; + x_libraries=$ac_optarg ;; - -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + -*) { 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 ;; + *) - if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then - echo "configure: warning: $ac_option: invalid host type" 1>&2 - fi - if test "x$nonopt" != xNONE; then - { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } - fi - nonopt="$ac_option" + # 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 - { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - -# File descriptor usage: -# 0 standard input -# 1 file creation -# 2 errors and warnings -# 3 some systems may open it to /dev/tty -# 4 used on the Kubota Titan -# 6 checking for... messages and results -# 5 compiler messages saved in config.log -if test "$silent" = yes; then - exec 6>/dev/null -else - exec 6>&1 -fi -exec 5>./config.log - -echo "\ -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. -" 1>&5 +# 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 -# Strip out --no-create and --no-recursion so they do not pile up. -# Also quote any args containing shell metacharacters. -ac_configure_args= -for ac_arg +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir do - case "$ac_arg" in - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c) ;; - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) - ac_configure_args="$ac_configure_args '$ac_arg'" ;; - *) ac_configure_args="$ac_configure_args $ac_arg" ;; + 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 -# NLS nuisances. -# Only set these to C if already set. These must not be set unconditionally -# because not all systems understand e.g. LANG=C (notably SCO). -# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! -# Non-C LC_CTYPE values break the ctype check. -if test "${LANG+set}" = set; then LANG=C; export LANG; fi -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi -if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +# 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 -# 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 +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null -# A filename unique to this package, relative to the directory that -# configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=README # 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_prog=$0 - ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` - test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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=.. @@ -486,13 +729,465 @@ fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then - { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } else - { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi fi -srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +(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 this package 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 +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-debug to enable the debugging options for compilation + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-incdir=DIR add DIR to the include path + --with-libdir=DIR add DIR to the library path + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + 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 + +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 $as_me, which was +generated by GNU Autoconf 2.59 (OpenPKG-CURRENT). 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 @@ -503,255 +1198,773 @@ fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - echo "loading site script $ac_site_file" + { 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 - echo "loading cache $cache_file" - . $cache_file + # 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 "creating cache $cache_file" - > $cache_file + { 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 -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross +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 + + + + -ac_exeext= -ac_objext=o -if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then - # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. - if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then - ac_n= ac_c=' -' ac_t=' ' - else - ac_n=-n ac_c= ac_t= - fi -else - ac_n= ac_c='\c' ac_t= -fi -echo "$ac_t""" 1>&6 -echo "$ac_t""${T_MD}CHECK: Build Environment${T_ME}" 1>&6 -# Extract the first word of "gcc", so it can be a program name with args. + + + + + + + + +SHTOOL="./etc/shtool" +T_MD=`$SHTOOL echo -e %B 2>/dev/null` +T_ME=`$SHTOOL echo -e %b 2>/dev/null` +echo "${T_MD}Configuring for iSelect `./etc/shtool version -lc -dlong iselect_version.c`${T_ME}" +echo "Copyright (c) 1997-2004 Ralf S. Engelschall " + + ac_config_headers="$ac_config_headers config_ac.h" + + +echo "$as_me:$LINENO: result: " >&5 +echo "${ECHO_T}" >&6 +echo "$as_me:$LINENO: result: ${T_MD}CHECK: Build Environment${T_ME}" >&5 +echo "${ECHO_T}${T_MD}CHECK: Build Environment${T_ME}" >&6 + + +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:551: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="gcc" - break - fi - done - IFS="$ac_save_ifs" +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" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + 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 - echo "$ac_t""no" 1>&6 + 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:581: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - break - fi - done - IFS="$ac_save_ifs" +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 $# -gt 0; then + 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 - set dummy "$ac_dir/$ac_word" "$@" - shift - ac_cv_prog_CC="$@" + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi -CC="$ac_cv_prog_CC" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - if test -z "$CC"; then - case "`uname -s`" in - *win32* | *WIN32*) - # Extract the first word of "cl", so it can be a program name with args. -set dummy cl; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:632: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" - ac_dummy="$PATH" - for ac_dir in $ac_dummy; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="cl" - break - fi - done - IFS="$ac_save_ifs" +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" +CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi - ;; - esac + + 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 - test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +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 -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:664: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + test -n "$ac_ct_CC" && break +done -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross + CC=$ac_ct_CC +fi -cat > conftest.$ac_ext << EOF +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 &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &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 () +{ -#line 675 "configure" -#include "confdefs.h" + ; + 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 -main(){return(0);} -EOF -if { (eval echo configure:680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - ac_cv_prog_cc_works=yes - # If we can't run a trivial program, we are probably using a cross compiler. - if (./conftest; exit) 2>/dev/null; then - ac_cv_prog_cc_cross=no +{ { 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 - ac_cv_prog_cc_cross=yes + 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 -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_prog_cc_works=no -fi -rm -fr conftest* -ac_ext=c -# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. -ac_cpp='$CPP $CPPFLAGS' -ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' -cross_compiling=$ac_cv_prog_cc_cross - -echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 -if test $ac_cv_prog_cc_works = no; then - { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } -fi -echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:706: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 -echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 -cross_compiling=$ac_cv_prog_cc_cross - -echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:711: checking whether we are using GNU C" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then - ac_cv_prog_gcc=yes -else - ac_cv_prog_gcc=no -fi fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 -echo "$ac_t""$ac_cv_prog_gcc" 1>&6 - -if test $ac_cv_prog_gcc = yes; then - GCC=yes +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 - GCC= -fi + { { 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 () +{ -ac_test_CFLAGS="${CFLAGS+set}" -ac_save_CFLAGS="$CFLAGS" -CFLAGS= -echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:739: checking whether ${CC-cc} accepts -g" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + ; + 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 'void f(){}' > conftest.c -if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + 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 - ac_cv_prog_cc_g=no -fi -rm -f conftest* + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no fi - -echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +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" + CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" @@ -765,96 +1978,513 @@ 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 +#include +#include +#include +/* 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 +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 -echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:771: checking how to run the C preprocessor" >&5 +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 + +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 eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - # This must be in double quotes, not single quotes, because CPP may get - # substituted into the Makefile and "${CC-cc}" will confuse make. - CPP="${CC-cc} -E" + # 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 to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + # 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 +#else +# include +#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 - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -E -traditional-cpp" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then : else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP="${CC-cc} -nologo -E" - cat > conftest.$ac_ext < -Syntax Error -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - : + 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 +_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 - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - CPP=/lib/cpp + ac_cpp_err=yes fi -rm -f conftest* +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* +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 -rm -f conftest* - ac_cv_prog_CPP="$CPP" + + 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 to if __STDC__ is defined, since + # 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 +#else +# include +#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 +_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 - CPP="$ac_cv_prog_CPP" +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue else - ac_cv_prog_CPP="$CPP" + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break fi -echo "$ac_t""$CPP" 1>&6 +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 -echo $ac_n "checking for compilation debug mode""... $ac_c" 1>&6 -echo "configure:852: checking for compilation debug mode" >&5 +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 compilation debug mode" >&5 +echo $ECHO_N "checking for compilation debug mode... $ECHO_C" >&6 # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" x="enabled" -CFLAGS="-Wall -g -ggdb3" -LDFLAGS="-g -ggdb3" +CFLAGS="-Wall -g" +LDFLAGS="-g" debug=on else @@ -863,45 +2493,50 @@ LDFLAGS="" debug=off -fi - -echo "$ac_t""$x" 1>&6 - -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:872: checking whether ${MAKE-make} sets \${MAKE}" >&5 -set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +fi; +echo "$as_me:$LINENO: result: $x" >&5 +echo "${ECHO_T}$x" >&6 + +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 > conftestmake <<\EOF + cat >conftest.make <<\_ACEOF all: - @echo 'ac_maketemp="${MAKE}"' -EOF + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. -eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +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 conftestmake +rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$ac_t""yes" 1>&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$ac_t""no" 1>&6 + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi -echo "$ac_t""" 1>&6 -echo "$ac_t""${T_MD}CHECK: Curses Environment${T_ME}" 1>&6 +echo "$as_me:$LINENO: result: " >&5 +echo "${ECHO_T}" >&6 +echo "$as_me:$LINENO: result: ${T_MD}CHECK: Curses Environment${T_ME}" >&5 +echo "${ECHO_T}${T_MD}CHECK: Curses Environment${T_ME}" >&6 + +echo "$as_me:$LINENO: checking for additional include dir" >&5 +echo $ECHO_N "checking for additional include dir... $ECHO_C" >&6 -echo $ac_n "checking for additional include dir""... $ac_c" 1>&6 -echo "configure:905: checking for additional include dir" >&5 # Check whether --with-incdir or --without-incdir was given. if test "${with_incdir+set}" = set; then withval="$with_incdir" @@ -912,10 +2547,11 @@ else x="none particular" -fi -echo "$ac_t""$x" 1>&6 -echo $ac_n "checking for additional library dir""... $ac_c" 1>&6 -echo "configure:919: checking for additional library dir" >&5 +fi; echo "$as_me:$LINENO: result: $x" >&5 +echo "${ECHO_T}$x" >&6 +echo "$as_me:$LINENO: checking for additional library dir" >&5 +echo $ECHO_N "checking for additional library dir... $ECHO_C" >&6 + # Check whether --with-libdir or --without-libdir was given. if test "${with_libdir+set}" = set; then withval="$with_libdir" @@ -925,314 +2561,917 @@ else x="none particular" +fi; echo "$as_me:$LINENO: result: $x" >&5 +echo "${ECHO_T}$x" >&6 + + + +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 + + +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 +#include +#include +#include + +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 -echo "$ac_t""$x" 1>&6 +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 -ac_safe=`echo "ncurses.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for ncurses.h""... $ac_c" 1>&6 -echo "configure:934: checking for ncurses.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:944: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +_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 eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - HAVE_NCURSES_HEADER=YES + +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 + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : else - echo "$ac_t""no" 1>&6 -HAVE_NCURSES_HEADER=NO + ac_cv_header_stdc=no +fi +rm -f conftest* + fi -echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6 -echo "configure:967: checking for initscr in -lncurses" >&5 -ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +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 - ac_save_LIBS="$LIBS" -LIBS="-lncurses $LIBS" -cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#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 -int main() { -initscr() -; return 0; } -EOF -if { (eval echo configure:986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -f conftest* -LIBS="$ac_save_LIBS" +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_ncurses_ncurses_h+set}" = set; then + echo "$as_me:$LINENO: checking for ncurses/ncurses.h" >&5 +echo $ECHO_N "checking for ncurses/ncurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_ncurses_ncurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_ncurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_ncurses_ncurses_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking ncurses/ncurses.h usability" >&5 +echo $ECHO_N "checking ncurses/ncurses.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 +_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 ncurses/ncurses.h presence" >&5 +echo $ECHO_N "checking ncurses/ncurses.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 +_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: ncurses/ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: ncurses/ncurses.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: ncurses/ncurses.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for ncurses/ncurses.h" >&5 +echo $ECHO_N "checking for ncurses/ncurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_ncurses_ncurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_ncurses_ncurses_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_ncurses_ncurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_ncurses_ncurses_h" >&6 fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 +if test $ac_cv_header_ncurses_ncurses_h = yes; then + HAVE_NCURSES_HEADER=YES +else + HAVE_NCURSES_HEADER=NO +fi + + +echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5 +echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6 +if test "${ac_cv_lib_ncurses_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $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 initscr (); +int +main () +{ +initscr (); + ; + 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_ncurses_initscr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ncurses_initscr=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_ncurses_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6 +if test $ac_cv_lib_ncurses_initscr = yes; then HAVE_NCURSES_LIB=YES else - echo "$ac_t""no" 1>&6 -HAVE_NCURSES_LIB=NO + HAVE_NCURSES_LIB=NO fi -ac_safe=`echo "slcurses.h" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for slcurses.h""... $ac_c" 1>&6 -echo "configure:1009: checking for slcurses.h" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking for slcurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_slcurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_slcurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_slcurses_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking slcurses.h usability" >&5 +echo $ECHO_N "checking slcurses.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 -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" +_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 slcurses.h presence" >&5 +echo $ECHO_N "checking slcurses.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 +_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 -rm -f conftest* +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: slcurses.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: slcurses.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: slcurses.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: slcurses.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: slcurses.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: slcurses.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: slcurses.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: slcurses.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: slcurses.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: slcurses.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: slcurses.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for slcurses.h" >&5 +echo $ECHO_N "checking for slcurses.h... $ECHO_C" >&6 +if test "${ac_cv_header_slcurses_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_slcurses_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_slcurses_h" >&5 +echo "${ECHO_T}$ac_cv_header_slcurses_h" >&6 + fi -if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 +if test $ac_cv_header_slcurses_h = yes; then HAVE_SLCURSES_HEADER=YES else - echo "$ac_t""no" 1>&6 -HAVE_SLCURSES_HEADER=NO + HAVE_SLCURSES_HEADER=NO fi + OLIBS=$LIBS LIBS="$LIBS -ltermcap" -echo $ac_n "checking for SLcurses_initscr in -lslang""... $ac_c" 1>&6 -echo "configure:1044: checking for SLcurses_initscr in -lslang" >&5 -ac_lib_var=`echo slang'_'SLcurses_initscr | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 +echo "$as_me:$LINENO: checking for SLcurses_initscr in -lslang" >&5 +echo $ECHO_N "checking for SLcurses_initscr in -lslang... $ECHO_C" >&6 +if test "${ac_cv_lib_slang_SLcurses_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_save_LIBS="$LIBS" + ac_check_lib_save_LIBS=$LIBS LIBS="-lslang $LIBS" -cat > conftest.$ac_ext <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 SLcurses_initscr(); - -int main() { -SLcurses_initscr() -; return 0; } -EOF -if { (eval echo configure:1063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 + builtin and then its argument prototype would still apply. */ +char SLcurses_initscr (); +int +main () +{ +SLcurses_initscr (); + ; + 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_slang_SLcurses_initscr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_slang_SLcurses_initscr=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_slang_SLcurses_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_slang_SLcurses_initscr" >&6 +if test $ac_cv_lib_slang_SLcurses_initscr = yes; then HAVE_SLCURSES_LIB=YES else - echo "$ac_t""no" 1>&6 -HAVE_SLCURSES_LIB=NO + HAVE_SLCURSES_LIB=NO fi LIBS=$OLIBS if test ".$HAVE_NCURSES_HEADER.$HAVE_NCURSES_LIB." = .YES.YES.; then USE_NCURSES=YES - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_NCURSES 1 -EOF +_ACEOF LIBS="$LIBS -lncurses" - echo $ac_n "checking which Curses to use""... $ac_c" 1>&6 -echo "configure:1093: checking which Curses to use" >&5 - echo "$ac_t""GNU NCurses" 1>&6 + echo "$as_me:$LINENO: checking which Curses to use" >&5 +echo $ECHO_N "checking which Curses to use... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: GNU NCurses" >&5 +echo "${ECHO_T}GNU NCurses" >&6 else if test ".$HAVE_SLCURSES_HEADER.$HAVE_SLCURSES_LIB." = .YES.YES.; then USE_SLCURSES=YES - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_SLCURSES 1 -EOF +_ACEOF LIBS="$LIBS -lslang -ltermcap" - echo $ac_n "checking which Curses to use""... $ac_c" 1>&6 -echo "configure:1104: checking which Curses to use" >&5 - echo "$ac_t""S-Lang Curses" 1>&6 + echo "$as_me:$LINENO: checking which Curses to use" >&5 +echo $ECHO_N "checking which Curses to use... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: S-Lang Curses" >&5 +echo "${ECHO_T}S-Lang Curses" >&6 else USE_CURSES=YES - cat >> confdefs.h <<\EOF + +cat >>confdefs.h <<\_ACEOF #define USE_CURSES 1 -EOF +_ACEOF LIBS="$LIBS -lcurses" - echo $ac_n "checking which Curses to use""... $ac_c" 1>&6 -echo "configure:1114: checking which Curses to use" >&5 - echo "$ac_t""Vendor Curses" 1>&6 + echo "$as_me:$LINENO: checking which Curses to use" >&5 +echo $ECHO_N "checking which Curses to use... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: Vendor Curses" >&5 +echo "${ECHO_T}Vendor Curses" >&6 fi fi -echo "$ac_t""" 1>&6 -echo "$ac_t""${T_MD}CHECK: System Ingredients${T_ME}" 1>&6 +echo "$as_me:$LINENO: result: " >&5 +echo "${ECHO_T}" >&6 +echo "$as_me:$LINENO: result: ${T_MD}CHECK: System Ingredients${T_ME}" >&5 +echo "${ECHO_T}${T_MD}CHECK: System Ingredients${T_ME}" >&6 + +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 -echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1123: checking for working const" >&5 -if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <j = 5; -} -{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; -} - -; return 0; } -EOF -if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* + ; + 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 "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_c_const=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no fi -rm -f conftest* +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - -echo "$ac_t""$ac_cv_c_const" 1>&6 +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 <<\EOF -#define const -EOF + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF fi -echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1198: checking for ANSI C header files" >&5 -if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext <&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 #include #include #include -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* + +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 "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - ac_cv_header_stdc=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no fi -rm -f conftest* +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 <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "memchr" >/dev/null 2>&1; then + $EGREP "memchr" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1241,16 +3480,19 @@ 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 <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -EOF + +_ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - egrep "free" >/dev/null 2>&1; then + $EGREP "free" >/dev/null 2>&1; then : else - rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* @@ -1259,438 +3501,1344 @@ 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 + if test "$cross_compiling" = yes; then : else - cat > conftest.$ac_ext <conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#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); } - -EOF -if { (eval echo configure:1278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null -then +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 "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -fr conftest* - ac_cv_header_stdc=no + 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 -fr conftest* +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi - -echo "$ac_t""$ac_cv_header_stdc" 1>&6 +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 <<\EOF + +cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 -EOF +_ACEOF fi -for ac_hdr in stdio.h stddef.h string.h strings.h stdlib.h + + + + + +for ac_header in stdio.h stddef.h string.h strings.h stdlib.h do -ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` -echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1305: checking for $ac_hdr" >&5 -if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - cat > conftest.$ac_ext < -EOF -ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1315: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` -if test -z "$ac_err"; then - rm -rf conftest* - eval "ac_cv_header_$ac_safe=yes" -else - echo "$ac_err" >&5 - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_header_$ac_safe=no" -fi -rm -f conftest* +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 eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - echo "$ac_t""yes" 1>&6 - ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` - cat >> confdefs.h <&6 + 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 AC_PACKAGE_NAME 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 "$ac_t""" 1>&6 -echo "$ac_t""${T_MD}RESULT: Sourcefile Substitution${T_ME}" 1>&6 +echo "$as_me:$LINENO: result: " >&5 +echo "${ECHO_T}" >&6 +echo "$as_me:$LINENO: result: ${T_MD}RESULT: Sourcefile Substitution${T_ME}" >&5 +echo "${ECHO_T}${T_MD}RESULT: Sourcefile Substitution${T_ME}" >&6 -trap '' 1 2 15 -cat > confcache <<\EOF + ac_config_files="$ac_config_files Makefile config_sc.h" +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. It is not useful on other systems. -# If it contains results you don't want to keep, you may remove or edit it. +# 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. # -# By default, configure uses ./config.cache as the cache file, -# creating it if it does not exist already. You can give configure -# the --cache-file=FILE option to use a different cache file; that is -# what configure does when it calls configure scripts in -# subdirectories, so they share the cache. -# Giving --cache-file=/dev/null disables caching, for debugging configure. -# config.status only pays attention to the cache file if you give it the -# --recheck option to rerun configure. +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. # -EOF +# `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 \ - -e "s/'/'\\\\''/g" \ - -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' - ;; - esac >> confcache -if cmp -s $cache_file confcache; then - : -else +{ + (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 - echo "updating cache $cache_file" - cat confcache > $cache_file + 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 -trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 - test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# Any assignment to VPATH causes Sun make to only execute -# the first set of double-colon rules, so remove it if not needed. -# If there is a colon in the path, we need to keep it. +# 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[ ]*=[^:]*$/d' + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' fi -trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 - DEFS=-DHAVE_CONFIG_H -# Without the "./", some shells look in PATH for config.status. -: ${CONFIG_STATUS=./config.status} +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 -echo creating $CONFIG_STATUS -rm -f $CONFIG_STATUS -cat > $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. -# This directory was configured as follows, -# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# -# $0 $ac_configure_args -# # Compiler output produced by configure, useful for debugging -# configure, is in ./config.log if it exists. +# configure, is in config.log if it exists. -ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" -for ac_option +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 $as_me, which was +generated by GNU Autoconf 2.59 (OpenPKG-CURRENT). 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 + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59 (OpenPKG-CURRENT), + 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 +_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 "\$ac_option" in + 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) - echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" - exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; - -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.14" - exit 0 ;; - -help | --help | --hel | --he | --h) - echo "\$ac_cs_usage"; exit 0 ;; - *) echo "\$ac_cs_usage"; exit 1 ;; + 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_given_srcdir=$srcdir +ac_configure_extra_args= -trap 'rm -fr `echo "Makefile config_sc.h config_ac.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 -EOF -cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF -$ac_vpsub -$extrasub -s%@SHELL@%$SHELL%g -s%@CFLAGS@%$CFLAGS%g -s%@CPPFLAGS@%$CPPFLAGS%g -s%@CXXFLAGS@%$CXXFLAGS%g -s%@FFLAGS@%$FFLAGS%g -s%@DEFS@%$DEFS%g -s%@LDFLAGS@%$LDFLAGS%g -s%@LIBS@%$LIBS%g -s%@exec_prefix@%$exec_prefix%g -s%@prefix@%$prefix%g -s%@program_transform_name@%$program_transform_name%g -s%@bindir@%$bindir%g -s%@sbindir@%$sbindir%g -s%@libexecdir@%$libexecdir%g -s%@datadir@%$datadir%g -s%@sysconfdir@%$sysconfdir%g -s%@sharedstatedir@%$sharedstatedir%g -s%@localstatedir@%$localstatedir%g -s%@libdir@%$libdir%g -s%@includedir@%$includedir%g -s%@oldincludedir@%$oldincludedir%g -s%@infodir@%$infodir%g -s%@mandir@%$mandir%g -s%@CC@%$CC%g -s%@CPP@%$CPP%g -s%@debug@%$debug%g -s%@SET_MAKE@%$SET_MAKE%g -s%@SHTOOL@%$SHTOOL%g +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 +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config_sc.h" ) CONFIG_FILES="$CONFIG_FILES config_sc.h" ;; + "config_ac.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config_ac.h" ;; + *) { { 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 +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,@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,@CPP@,$CPP,;t t +s,@debug@,$debug,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@SHTOOL@,$SHTOOL,;t t +s,@EGREP@,$EGREP,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF -EOF -cat >> $CONFIG_STATUS <<\EOF +_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_cmds=90 # Maximum number of lines to put in a sed script. -ac_file=1 # Number of current file. -ac_beg=1 # First line for current file. -ac_end=$ac_max_sed_cmds # 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" conftest.subs > conftest.s$ac_file - else - sed "${ac_end}q" conftest.subs > conftest.s$ac_file - fi - if test ! -s conftest.s$ac_file; then - ac_more_lines=false - rm -f conftest.s$ac_file - else - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f conftest.s$ac_file" + 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 - ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + # 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 - ac_file=`expr $ac_file + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_cmds` + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat fi -done -if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat -fi -EOF - -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +_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 - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.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 - # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" - # A "../" for each directory in $ac_dir_suffix. - ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` - else - ac_dir_suffix= ac_dots= - fi - - case "$ac_given_srcdir" in - .) srcdir=. - if test -z "$ac_dots"; then top_srcdir=. - else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; - /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + # 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. - srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" - top_srcdir="$ac_dots$ac_given_srcdir" ;; - esac + 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 creating "$ac_file" - rm -f "$ac_file" - configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." - case "$ac_file" in - *Makefile*) ac_comsub="1i\\ -# $configure_input" ;; - *) ac_comsub= ;; - esac - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - sed -e "$ac_comsub -s%@configure_input@%$configure_input%g -s%@srcdir@%$srcdir%g -s%@top_srcdir@%$top_srcdir%g -" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file -fi; done -rm -f conftest.s* + 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 +" $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='\3' -ac_dD='%g' -# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". -ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='\([ ]\)%\1#\2define\3' +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='\4%g' -# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_eB='$%\1#\2define\3' -ac_eC=' ' -ac_eD='%g' - -if test "${CONFIG_HEADERS+set}" != set; then -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF -fi -for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +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 - *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` - ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; - *) ac_file_in="${ac_file}.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 - echo creating $ac_file + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} - rm -f conftest.frag conftest.in conftest.out - ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` - cat $ac_file_inputs > conftest.in - -EOF - -# Transform confdefs.h into a sed script conftest.vals that substitutes -# the proper values into config.h.in to produce config.h. 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.vals -cat > conftest.hdr <<\EOF -s/[\\&%]/\\&/g -s%[\\$`]%\\&%g -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp -s%ac_d%ac_u%gp -s%ac_u%ac_e%gp -EOF -sed -n -f conftest.hdr confdefs.h > conftest.vals -rm -f conftest.hdr + # 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.vals <<\EOF -s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% -EOF - -# Break up conftest.vals because some shells have a limit on -# the size of here documents, and old seds have small limits too. - +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 : +while grep . conftest.defines >/dev/null do - ac_lines=`grep -c . conftest.vals` - # grep -c gives empty output for an empty file on some AIX systems. - if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi - # Write a limited-size here document to conftest.frag. - echo ' cat > conftest.frag <> $CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$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 conftest.frag conftest.in > conftest.out - rm -f conftest.in - mv conftest.out conftest.in -' >> $CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail - rm -f conftest.vals - mv conftest.tail conftest.vals -done -rm -f conftest.vals - -cat >> $CONFIG_STATUS <<\EOF - rm -f conftest.frag conftest.h - echo "/* $ac_file. Generated automatically by configure. */" > conftest.h - cat conftest.in >> conftest.h - rm -f conftest.in - if cmp -s $ac_file conftest.h 2>/dev/null; then - echo "$ac_file is unchanged" - rm -f conftest.h - else - # Remove last slash and all that follows it. Not all systems have dirname. - ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` - if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - # The file is in a subdirectory. - test ! -d "$ac_dir" && mkdir "$ac_dir" - fi - rm -f $ac_file - mv conftest.h $ac_file + 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 <>$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 -fi; done + 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; }; }; } -EOF -cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +cat >>$CONFIG_STATUS <<\_ACEOF -exit 0 -EOF +{ (exit 0); exit 0; } +_ACEOF chmod +x $CONFIG_STATUS -rm -fr confdefs* $ac_clean_files -test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +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 echo "" echo "Now please type 'make' to compile. Good luck." Index: ossp-pkg/iselect/configure.in RCS File: /v/ossp/cvs/ossp-pkg/iselect/configure.in,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/iselect/configure.in,v' 2>/dev/null --- configure.in 2000/07/25 11:53:24 1.2 +++ configure.in 2004/09/11 15:18:49 1.3 @@ -1,17 +1,17 @@ -nl ## +dnl ## dnl ## configure.in -- GNU autoconf configuration spec -dnl ## Copyright (c) Ralf S. Engelschall, +dnl ## Copyright (c) Ralf S. Engelschall dnl ## -AC_PREREQ(2.10)dnl -AC_REVISION($Revision$) +AC_PREREQ(2.50)dnl +AC_REVISION(1.0)dnl +AC_INIT(README) SHTOOL="./etc/shtool" T_MD=`$SHTOOL echo -e %B 2>/dev/null` T_ME=`$SHTOOL echo -e %b 2>/dev/null` echo "${T_MD}Configuring for iSelect `./etc/shtool version -lc -dlong iselect_version.c`${T_ME}" -echo "Copyright (c) 1996-1999 Ralf S. Engelschall, All Rights Reserved." +echo "Copyright (c) 1997-2004 Ralf S. Engelschall " -AC_INIT(README) AC_CONFIG_HEADER(config_ac.h)dnl AC_PREFIX_DEFAULT(/usr/local) @@ -24,8 +24,8 @@ AC_ARG_ENABLE(debug,dnl [ --enable-debug to enable the debugging options for compilation], x="enabled" -CFLAGS="-Wall -g -ggdb3" -LDFLAGS="-g -ggdb3" +CFLAGS="-Wall -g" +LDFLAGS="-g" debug=on , x=disabled @@ -61,7 +61,7 @@ )dnl AC_MSG_RESULT([$x]) -AC_CHECK_HEADER(ncurses.h, HAVE_NCURSES_HEADER=YES, HAVE_NCURSES_HEADER=NO) +AC_CHECK_HEADER(ncurses/ncurses.h, HAVE_NCURSES_HEADER=YES, HAVE_NCURSES_HEADER=NO) AC_CHECK_LIB(ncurses, initscr, HAVE_NCURSES_LIB=YES, HAVE_NCURSES_LIB=NO) AC_CHECK_HEADER(slcurses.h, HAVE_SLCURSES_HEADER=YES, HAVE_SLCURSES_HEADER=NO) OLIBS=$LIBS @@ -70,20 +70,20 @@ LIBS=$OLIBS if test ".$HAVE_NCURSES_HEADER.$HAVE_NCURSES_LIB." = .YES.YES.; then USE_NCURSES=YES - AC_DEFINE(USE_NCURSES) + AC_DEFINE(USE_NCURSES, 1, [use NCurses]) LIBS="$LIBS -lncurses" AC_MSG_CHECKING([which Curses to use]) AC_MSG_RESULT([GNU NCurses]) else if test ".$HAVE_SLCURSES_HEADER.$HAVE_SLCURSES_LIB." = .YES.YES.; then USE_SLCURSES=YES - AC_DEFINE(USE_SLCURSES) + AC_DEFINE(USE_SLCURSES, 1, [use SLcurses]) LIBS="$LIBS -lslang -ltermcap" AC_MSG_CHECKING([which Curses to use]) AC_MSG_RESULT([S-Lang Curses]) else USE_CURSES=YES - AC_DEFINE(USE_CURSES) + AC_DEFINE(USE_CURSES, 1, [use plain Curses]) LIBS="$LIBS -lcurses" AC_MSG_CHECKING([which Curses to use]) AC_MSG_RESULT([Vendor Curses]) @@ -106,4 +106,3 @@ echo "Now please type 'make' to compile. Good luck." echo "" -dnl ##EOF## Index: ossp-pkg/iselect/etc/asc2c RCS File: /v/ossp/cvs/ossp-pkg/iselect/etc/asc2c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/etc/asc2c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/etc/asc2c' 2>/dev/null --- ossp-pkg/iselect/etc/asc2c +++ - 2024-04-25 08:53:01.933076602 +0200 @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +## +## asc2c -- convert an ASCII file into a statically initialised +## C array of characters +## +## Copyright (c) Ralf S. Engelschall, All Rights Reserved. +## + +$filein = $ARGV[0]; +$fileout = $ARGV[1]; +$name = $ARGV[2]; +$version = $ARGV[3]; + +if ($#ARGV ne 3) { + printf(STDERR "Usage: $0 ascii-file c-file buffer-name version\n"); + exit(1); +} + +open(IN, "<$filein"); +open(OUTC, ">$fileout.c"); + +print OUTC "/* $fileout.c -- automatically generated by asc2c */\n"; +print OUTC "\n"; +print OUTC "#include \n"; +print OUTC "\n"; +print OUTC "char *$name\[\] = {\\\n"; + +while () { + s|\n$||; + s|\\|\\\\|g; + s|\"|\\\"|g; + s|\@V\@|$version|g; + printf(OUTC "\"%s\",\n", $_); +} + +print OUTC "NULL };\n"; +print OUTC "\n"; +print OUTC "/*EOF*/\n"; + +$filename = "$fileout.h"; +$filename =~ tr|a-z.|A-Z_|; + +close(IN); +close(OUTC); + +##EOF## Index: ossp-pkg/iselect/etc/shtool RCS File: /v/ossp/cvs/ossp-pkg/iselect/etc/shtool,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/etc/shtool,v' | diff -u /dev/null - -L'ossp-pkg/iselect/etc/shtool' 2>/dev/null --- ossp-pkg/iselect/etc/shtool +++ - 2024-04-25 08:53:01.935629271 +0200 @@ -0,0 +1,3945 @@ +#!/bin/sh +## +## GNU shtool -- The GNU Portable Shell Tool +## Copyright (c) 1994-2004 Ralf S. Engelschall +## +## See http://www.gnu.org/software/shtool/ for more information. +## See ftp://ftp.gnu.org/gnu/shtool/ for latest version. +## +## Version: 2.0.1 (11-Aug-2004) +## Contents: all available modules +## + +## +## 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, or contact Ralf S. Engelschall . +## +## NOTICE: Given that you include this file verbatim into your own +## source tree, you are justified in saying that it remains separate +## from your package, and that this way you are simply just using GNU +## shtool. So, in this situation, there is no requirement that your +## package itself is licensed under the GNU General Public License in +## order to take advantage of GNU shtool. +## + +## +## Usage: shtool [] [ [] []] +## +## Available commands: +## echo Print string with optional construct expansion +## mdate Pretty-print modification time of a file or dir +## table Pretty-print a field-separated list as a table +## prop Display progress with a running propeller +## move Move files with simultaneous substitution +## install Install a program, script or datafile +## mkdir Make one or more directories +## mkln Make link with calculation of relative paths +## mkshadow Make a shadow tree through symbolic links +## fixperm Fix file permissions inside a source tree +## rotate Logfile rotation +## tarball Roll distribution tarballs +## subst Apply sed(1) substitution operations +## platform Platform Identification Utility +## arx Extended archive command +## slo Separate linker options by library class +## scpp Sharing C Pre-Processor +## version Maintain a version information file +## path Deal with program paths +## + +if [ $# -eq 0 ]; then + echo "$0:Error: invalid command line" 1>&2 + echo "$0:Hint: run \`$0 -h' for usage" 1>&2 + exit 1 +fi +if [ ".$1" = ".-h" ] || [ ".$1" = ".--help" ]; then + echo "This is GNU shtool, version 2.0.1 (11-Aug-2004)" + echo "Copyright (c) 1994-2004 Ralf S. Engelschall " + echo "Report bugs to " + echo '' + echo "Usage: shtool [] [ [] []]" + echo '' + echo 'Available global :' + echo ' -v, --version display shtool version information' + echo ' -h, --help display shtool usage help page (this one)' + echo ' -d, --debug display shell trace information' + echo ' -r, --recreate recreate this shtool script via shtoolize' + echo '' + echo 'Available [] []:' + echo ' echo [-n|--newline] [-e|--expand] [ ...]' + echo ' mdate [-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits]' + echo ' [-f|--field-sep ] [-o|--order ] ' + echo ' table [-F|--field-sep ] [-w|--width ] [-c|--columns' + echo ' ] [-s|--strip ] ...' + echo ' prop [-p|--prefix ]' + echo ' move [-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve]' + echo ' ' + echo ' install [-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy]' + echo ' [-C|--compare-copy] [-s|--strip] [-m|--mode ]' + echo ' [-o|--owner ] [-g|--group ] [-e|--exec' + echo ' ] [ ...] ' + echo ' mkdir [-t|--trace] [-f|--force] [-p|--parents] [-m|--mode' + echo ' ] [-o|--owner ] [-g|--group ] ' + echo ' [ ...]' + echo ' mkln [-t|--trace] [-f|--force] [-s|--symbolic] ' + echo ' [ ...] ' + echo ' mkshadow [-v|--verbose] [-t|--trace] [-a|--all] ' + echo ' fixperm [-v|--verbose] [-t|--trace] [ ...]' + echo ' rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files' + echo ' ] [-s|--size ] [-c|--copy] [-r|--remove]' + echo ' [-a|--archive-dir ] [-z|--compress [:]]' + echo ' [-b|--background] [-d|--delay] [-p|--pad ] [-m|--mode' + echo ' ] [-o|--owner ] [-g|--group ] [-M|--migrate' + echo ' ] [-P|--prolog ] [-E|--epilog ] [...]' + echo ' tarball [-t|--trace] [-v|--verbose] [-o|--output ]' + echo ' [-c|--compress ] [-d|--directory ] [-u|--user' + echo ' ] [-g|--group ] [-e|--exclude ]' + echo ' [ ...]' + echo ' subst [-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning]' + echo ' [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup' + echo ' ] [-e|--exec ] [-f|--file ] []' + echo ' [...]' + echo ' platform [-F|--format ] [-S|--sep ] [-C|--conc' + echo ' ] [-L|--lower] [-U|--upper] [-v|--verbose]' + echo ' [-c|--concise] [-n|--no-newline] [-t|--type ]' + echo ' [-V|--version] [-h|--help]' + echo ' arx [-t|--trace] [-C|--command ] [' + echo ' ...]' + echo ' slo [-p|--prefix ] -- -L -l [-L -l' + echo ' ...]' + echo ' scpp [-v|--verbose] [-p|--preserve] [-f|--filter ]' + echo ' [-o|--output ] [-t|--template ] [-M|--mark' + echo ' ] [-D|--define ] [-C|--class ]' + echo ' [ ...]' + echo ' version [-l|--language ] [-n|--name ] [-p|--prefix' + echo ' ] [-s|--set ] [-e|--edit] [-i|--increase' + echo ' ] [-d|--display ] ' + echo ' path [-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename]' + echo ' [-m|--magic] [-p|--path ] [ ...]' + echo '' + exit 0 +fi +if [ ".$1" = ".-v" ] || [ ".$1" = ".--version" ]; then + echo "GNU shtool 2.0.1 (11-Aug-2004)" + exit 0 +fi +if [ ".$1" = ".-r" ] || [ ".$1" = ".--recreate" ]; then + shtoolize -oshtool all + exit 0 +fi +if [ ".$1" = ".-d" ] || [ ".$1" = ".--debug" ]; then + shift + set -x +fi +name=`echo "$0" | sed -e 's;.*/\([^/]*\)$;\1;' -e 's;-sh$;;' -e 's;\.sh$;;'` +case "$name" in + echo|mdate|table|prop|move|install|mkdir|mkln|mkshadow|fixperm|rotate|tarball|subst|platform|arx|slo|scpp|version|path ) + # implicit tool command selection + tool="$name" + ;; + * ) + # explicit tool command selection + tool="$1" + shift + ;; +esac +arg_spec="" +opt_spec="" +gen_tmpfile=no + +## +## DISPATCH INTO SCRIPT PROLOG +## + +case $tool in + echo ) + str_tool="echo" + str_usage="[-n|--newline] [-e|--expand] [ ...]" + arg_spec="0+" + opt_spec="n.e." + opt_alias="n:newline,e:expand" + opt_n=no + opt_e=no + ;; + mdate ) + str_tool="mdate" + str_usage="[-n|--newline] [-z|--zero] [-s|--shorten] [-d|--digits] [-f|--field-sep ] [-o|--order ] " + arg_spec="1=" + opt_spec="n.z.s.d.f:o:" + opt_alias="n:newline,z:zero,s:shorten,d:digits,f:field-sep,o:order" + opt_n=no + opt_z=no + opt_s=no + opt_d=no + opt_f=" " + opt_o="dmy" + ;; + table ) + str_tool="table" + str_usage="[-F|--field-sep ] [-w|--width ] [-c|--columns ] [-s|--strip ] ..." + arg_spec="1+" + opt_spec="F:w:c:s:" + opt_alias="F:field-sep,w:width,c:columns,s:strip" + opt_F=":" + opt_w=15 + opt_c=3 + opt_s=79 + ;; + prop ) + str_tool="prop" + str_usage="[-p|--prefix ]" + arg_spec="0=" + opt_spec="p:" + opt_alias="p:prefix" + opt_p="" + ;; + move ) + str_tool="move" + str_usage="[-v|--verbose] [-t|--trace] [-e|--expand] [-p|--preserve] " + arg_spec="2=" + opt_spec="v.t.e.p." + opt_alias="v:verbose,t:trace,e:expand,p:preserve" + opt_v=no + opt_t=no + opt_e=no + opt_p=no + ;; + install ) + str_tool="install" + str_usage="[-v|--verbose] [-t|--trace] [-d|--mkdir] [-c|--copy] [-C|--compare-copy] [-s|--strip] [-m|--mode ] [-o|--owner ] [-g|--group ] [-e|--exec ] [ ...] " + arg_spec="1+" + opt_spec="v.t.d.c.C.s.m:o:g:e+" + opt_alias="v:verbose,t:trace,d:mkdir,c:copy,C:compare-copy,s:strip,m:mode,o:owner,g:group,e:exec" + opt_v=no + opt_t=no + opt_d=no + opt_c=no + opt_C=no + opt_s=no + opt_m="0755" + opt_o="" + opt_g="" + opt_e="" + ;; + mkdir ) + str_tool="mkdir" + str_usage="[-t|--trace] [-f|--force] [-p|--parents] [-m|--mode ] [-o|--owner ] [-g|--group ] [ ...]" + arg_spec="1+" + opt_spec="t.f.p.m:o:g:" + opt_alias="t:trace,f:force,p:parents,m:mode,o:owner,g:group" + opt_t=no + opt_f=no + opt_p=no + opt_m="" + opt_o="" + opt_g="" + ;; + mkln ) + str_tool="mkln" + str_usage="[-t|--trace] [-f|--force] [-s|--symbolic] [ ...] " + arg_spec="2+" + opt_spec="t.f.s." + opt_alias="t:trace,f:force,s:symbolic" + opt_t=no + opt_f=no + opt_s=no + ;; + mkshadow ) + str_tool="mkshadow" + str_usage="[-v|--verbose] [-t|--trace] [-a|--all] " + arg_spec="2=" + opt_spec="v.t.a." + opt_alias="v:verbose,t:trace,a:all" + opt_v=no + opt_t=no + opt_a=no + ;; + fixperm ) + str_tool="fixperm" + str_usage="[-v|--verbose] [-t|--trace] [ ...]" + arg_spec="1+" + opt_spec="v.t." + opt_alias="v:verbose,t:trace" + opt_v=no + opt_t=no + ;; + rotate ) + str_tool="rotate" + str_usage="[-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files ] [-s|--size ] [-c|--copy] [-r|--remove] [-a|--archive-dir ] [-z|--compress [:]] [-b|--background] [-d|--delay] [-p|--pad ] [-m|--mode ] [-o|--owner ] [-g|--group ] [-M|--migrate ] [-P|--prolog ] [-E|--epilog ] [...]" + arg_spec="1+" + opt_spec="v.t.f.n:s:c.r.a:z:b.d.p:o:g:m:M:P:E:" + opt_alias="v:verbose,t:trace,f:force,n:num-files,s:size,c:copy,r:remove,a:archive-dir,z:compress,b:background,d:delay,p:pad,o:owner,g:group,m:mode,M:migrate,P:prolog,E:epilog" + opt_v=no + opt_t=no + opt_f=no + opt_n=10 + opt_s="" + opt_c=no + opt_r=no + opt_a="" + opt_z="" + opt_b=no + opt_d=no + opt_p=1 + opt_o="" + opt_g="" + opt_m="" + opt_M="" + opt_P="" + opt_E="" + ;; + tarball ) + str_tool="tarball" + str_usage="[-t|--trace] [-v|--verbose] [-o|--output ] [-c|--compress ] [-d|--directory ] [-u|--user ] [-g|--group ] [-e|--exclude ] [ ...]" + gen_tmpfile=yes + arg_spec="1+" + opt_spec="t.v.o:c:d:u:g:e:" + opt_alias="t:trace,v:verbose,o:output,c:compress,d:directory,u:user,g:group,e:exclude" + opt_t=no + opt_v=no + opt_o="" + opt_c="" + opt_d="" + opt_u="" + opt_g="" + opt_e="CVS,\\.cvsignore,\\.[oa]\$" + ;; + subst ) + str_tool="subst" + str_usage="[-v|--verbose] [-t|--trace] [-n|--nop] [-w|--warning] [-q|--quiet] [-s|--stealth] [-i|--interactive] [-b|--backup ] [-e|--exec ] [-f|--file ] [] [...]" + gen_tmpfile=yes + arg_spec="0+" + opt_spec="v.t.n.w.q.s.i.b:e+f:" + opt_alias="v:verbose,t:trace,n:nop,w:warning,q:quiet,s:stealth,i:interactive,b:backup,e:exec,f:file" + opt_v=no + opt_t=no + opt_n=no + opt_w=no + opt_q=no + opt_s=no + opt_i=no + opt_b="" + opt_e="" + opt_f="" + ;; + platform ) + str_tool="platform" + str_usage="[-F|--format ] [-S|--sep ] [-C|--conc ] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--no-newline] [-t|--type ] [-V|--version] [-h|--help]" + arg_spec="0=" + opt_spec="F:S:C:L.U.v.c.n.t:d.V.h." + opt_alias="F:format,S:sep,C:conc,L:lower,U:upper,v:verbose,c:consise,t:type,n:no-newline,V:version,h:help" + opt_F="%{sp} (%{ap})" + opt_S=" " + opt_C="/" + opt_L=no + opt_U=no + opt_t="" + opt_v=no + opt_c=no + opt_n=no + opt_V=no + opt_h=no + ;; + arx ) + str_tool="arx" + str_usage="[-t|--trace] [-C|--command ] [ ...]" + arg_spec="2+" + opt_spec="t.C:" + opt_alias="t:trace,C:command" + opt_t=no + opt_C="ar" + ;; + slo ) + str_tool="slo" + str_usage="[-p|--prefix ] -- -L -l [-L -l ...]" + arg_spec="1+" + opt_spec="p:" + opt_alias="p:prefix" + opt_p="SLO_" + ;; + scpp ) + str_tool="scpp" + str_usage="[-v|--verbose] [-p|--preserve] [-f|--filter ] [-o|--output ] [-t|--template ] [-M|--mark ] [-D|--define ] [-C|--class ] [ ...]" + gen_tmpfile=yes + arg_spec="1+" + opt_spec="v.p.f+o:t:M:D:C:" + opt_alias="v:verbose,p:preserve,f:filter,o:output,t:template,M:mark,D:define,C:class" + opt_v=no + opt_p=no + opt_f="" + opt_o="lib.h" + opt_t="lib.h.in" + opt_M="%%MARK%%" + opt_D="cpp" + opt_C="intern" + ;; + version ) + str_tool="version" + str_usage="[-l|--language ] [-n|--name ] [-p|--prefix ] [-s|--set ] [-e|--edit] [-i|--increase ] [-d|--display ] " + arg_spec="1=" + opt_spec="l:n:p:s:i:e.d:" + opt_alias="l:language,n:name,p:prefix,s:set,e:edit,i:increase,d:display" + opt_l="txt" + opt_n="unknown" + opt_p="" + opt_s="" + opt_e="no" + opt_i="" + opt_d="short" + ;; + path ) + str_tool="path" + str_usage="[-s|--suppress] [-r|--reverse] [-d|--dirname] [-b|--basename] [-m|--magic] [-p|--path ] [ ...]" + gen_tmpfile=yes + arg_spec="1+" + opt_spec="s.r.d.b.m.p:" + opt_alias="s:suppress,r:reverse,d:dirname,b:basename,m:magic,p:path" + opt_s=no + opt_r=no + opt_d=no + opt_b=no + opt_m=no + opt_p="$PATH" + ;; + -* ) + echo "$0:Error: unknown option \`$tool'" 2>&1 + echo "$0:Hint: run \`$0 -h' for usage" 2>&1 + exit 1 + ;; + * ) + echo "$0:Error: unknown command \`$tool'" 2>&1 + echo "$0:Hint: run \`$0 -h' for usage" 2>&1 + exit 1 + ;; +esac + +## +## COMMON UTILITY CODE +## + +# commonly used ASCII values +ASC_TAB=" " +ASC_NL=" +" + +# determine name of tool +if [ ".$tool" != . ]; then + # used inside shtool script + toolcmd="$0 $tool" + toolcmdhelp="shtool $tool" + msgprefix="shtool:$tool" +else + # used as standalone script + toolcmd="$0" + toolcmdhelp="sh $0" + msgprefix="$str_tool" +fi + +# parse argument specification string +eval `echo $arg_spec |\ + sed -e 's/^\([0-9]*\)\([+=]\)/arg_NUMS=\1; arg_MODE=\2/'` + +# parse option specification string +eval `echo h.$opt_spec |\ + sed -e 's/\([a-zA-Z0-9]\)\([.:+]\)/opt_MODE_\1=\2;/g'` + +# parse option alias string +eval `echo h:help,$opt_alias |\ + sed -e 's/-/_/g' -e 's/\([a-zA-Z0-9]\):\([^,]*\),*/opt_ALIAS_\2=\1;/g'` + +# interate over argument line +opt_PREV='' +while [ $# -gt 0 ]; do + # special option stops processing + if [ ".$1" = ".--" ]; then + shift + break + fi + + # determine option and argument + opt_ARG_OK=no + if [ ".$opt_PREV" != . ]; then + # merge previous seen option with argument + opt_OPT="$opt_PREV" + opt_ARG="$1" + opt_ARG_OK=yes + opt_PREV='' + else + # split argument into option and argument + case "$1" in + --[a-zA-Z0-9]*=*) + eval `echo "x$1" |\ + sed -e 's/^x--\([a-zA-Z0-9-]*\)=\(.*\)$/opt_OPT="\1";opt_ARG="\2"/'` + opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'` + eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" + ;; + --[a-zA-Z0-9]*) + opt_OPT=`echo "x$1" | cut -c4-` + opt_STR=`echo $opt_OPT | sed -e 's/-/_/g'` + eval "opt_OPT=\${opt_ALIAS_${opt_STR}-${opt_OPT}}" + opt_ARG='' + ;; + -[a-zA-Z0-9]*) + eval `echo "x$1" |\ + sed -e 's/^x-\([a-zA-Z0-9]\)/opt_OPT="\1";/' \ + -e 's/";\(.*\)$/"; opt_ARG="\1"/'` + ;; + -[a-zA-Z0-9]) + opt_OPT=`echo "x$1" | cut -c3-` + opt_ARG='' + ;; + *) + break + ;; + esac + fi + + # eat up option + shift + + # determine whether option needs an argument + eval "opt_MODE=\$opt_MODE_${opt_OPT}" + if [ ".$opt_ARG" = . ] && [ ".$opt_ARG_OK" != .yes ]; then + if [ ".$opt_MODE" = ".:" ] || [ ".$opt_MODE" = ".+" ]; then + opt_PREV="$opt_OPT" + continue + fi + fi + + # process option + case $opt_MODE in + '.' ) + # boolean option + eval "opt_${opt_OPT}=yes" + ;; + ':' ) + # option with argument (multiple occurances override) + eval "opt_${opt_OPT}=\"\$opt_ARG\"" + ;; + '+' ) + # option with argument (multiple occurances append) + eval "opt_${opt_OPT}=\"\$opt_${opt_OPT}\${ASC_NL}\$opt_ARG\"" + ;; + * ) + echo "$msgprefix:Error: unknown option: \`$opt_OPT'" 1>&2 + echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 + exit 1 + ;; + esac +done +if [ ".$opt_PREV" != . ]; then + echo "$msgprefix:Error: missing argument to option \`$opt_PREV'" 1>&2 + echo "$msgprefix:Hint: run \`$toolcmdhelp -h' or \`man shtool' for details" 1>&2 + exit 1 +fi + +# process help option +if [ ".$opt_h" = .yes ]; then + echo "Usage: $toolcmdhelp $str_usage" + exit 0 +fi + +# complain about incorrect number of arguments +case $arg_MODE in + '=' ) + if [ $# -ne $arg_NUMS ]; then + echo "$msgprefix:Error: invalid number of arguments (exactly $arg_NUMS expected)" 1>&2 + echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 + exit 1 + fi + ;; + '+' ) + if [ $# -lt $arg_NUMS ]; then + echo "$msgprefix:Error: invalid number of arguments (at least $arg_NUMS expected)" 1>&2 + echo "$msgprefix:Hint: run \`$toolcmd -h' or \`man shtool' for details" 1>&2 + exit 1 + fi + ;; +esac + +# establish a temporary file on request +if [ ".$gen_tmpfile" = .yes ]; then + if [ ".$TMPDIR" != . ]; then + tmpdir="$TMPDIR" + elif [ ".$TEMPDIR" != . ]; then + tmpdir="$TEMPDIR" + else + tmpdir="/tmp" + fi + tmpfile="$tmpdir/.shtool.$$" + rm -f $tmpfile >/dev/null 2>&1 + touch $tmpfile + chmod 600 $tmpfile +fi + +# utility function: map string to lower case +util_lower () { + echo "$1" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' +} + +# utility function: map string to upper case +util_upper () { + echo "$1" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +} + +# cleanup procedure +shtool_exit () { + rc="$1" + if [ ".$gen_tmpfile" = .yes ]; then + rm -f $tmpfile >/dev/null 2>&1 || true + fi + exit $rc +} + +## +## DISPATCH INTO SCRIPT BODY +## + +case $tool in + +echo ) + ## + ## echo -- Print string with optional construct expansion + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + text="$*" + + # check for broken escape sequence expansion + seo='' + bytes=`echo '\1' | wc -c | awk '{ printf("%s", $1); }'` + if [ ".$bytes" != .3 ]; then + bytes=`echo -E '\1' | wc -c | awk '{ printf("%s", $1); }'` + if [ ".$bytes" = .3 ]; then + seo='-E' + fi + fi + + # check for existing -n option (to suppress newline) + minusn='' + bytes=`echo -n 123 2>/dev/null | wc -c | awk '{ printf("%s", $1); }'` + if [ ".$bytes" = .3 ]; then + minusn='-n' + fi + + # determine terminal bold sequence + term_bold='' + term_norm='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[Bb]'`" != . ]; then + case $TERM in + # for the most important terminal types we directly know the sequences + xterm|xterm*|vt220|vt220*) + term_bold=`awk 'BEGIN { printf("%c%c%c%c", 27, 91, 49, 109); }' /dev/null` + term_norm=`awk 'BEGIN { printf("%c%c%c", 27, 91, 109); }' /dev/null` + ;; + vt100|vt100*|cygwin) + term_bold=`awk 'BEGIN { printf("%c%c%c%c%c%c", 27, 91, 49, 109, 0, 0); }' /dev/null` + term_norm=`awk 'BEGIN { printf("%c%c%c%c%c", 27, 91, 109, 0, 0); }' /dev/null` + ;; + # for all others, we try to use a possibly existing `tput' or `tcout' utility + * ) + paths=`echo $PATH | sed -e 's/:/ /g'` + for tool in tput tcout; do + for dir in $paths; do + if [ -r "$dir/$tool" ]; then + for seq in bold md smso; do # 'smso' is last + bold="`$dir/$tool $seq 2>/dev/null`" + if [ ".$bold" != . ]; then + term_bold="$bold" + break + fi + done + if [ ".$term_bold" != . ]; then + for seq in sgr0 me rmso init reset; do # 'reset' is last + norm="`$dir/$tool $seq 2>/dev/null`" + if [ ".$norm" != . ]; then + term_norm="$norm" + break + fi + done + fi + break + fi + done + if [ ".$term_bold" != . ] && [ ".$term_norm" != . ]; then + break; + fi + done + ;; + esac + if [ ".$term_bold" = . ] || [ ".$term_norm" = . ]; then + echo "$msgprefix:Warning: unable to determine terminal sequence for bold mode" 1>&2 + term_bold='' + term_norm='' + fi + fi + + # determine user name + username='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[uUgG]'`" != . ]; then + username="`(id -un) 2>/dev/null`" + if [ ".$username" = . ]; then + str="`(id) 2>/dev/null`" + if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then + username=`echo $str | sed -e 's/^uid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'` + fi + if [ ".$username" = . ]; then + username="$LOGNAME" + if [ ".$username" = . ]; then + username="$USER" + if [ ".$username" = . ]; then + username="`(whoami) 2>/dev/null |\ + awk '{ printf("%s", $1); }'`" + if [ ".$username" = . ]; then + username="`(who am i) 2>/dev/null |\ + awk '{ printf("%s", $1); }'`" + if [ ".$username" = . ]; then + username='unknown' + fi + fi + fi + fi + fi + fi + fi + + # determine user id + userid='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%U'`" != . ]; then + userid="`(id -u) 2>/dev/null`" + if [ ".$userid" = . ]; then + userid="`(id -u ${username}) 2>/dev/null`" + if [ ".$userid" = . ]; then + str="`(id) 2>/dev/null`" + if [ ".`echo $str | grep '^uid[ ]*=[ ]*[0-9]*('`" != . ]; then + userid=`echo $str | sed -e 's/^uid[ ]*=[ ]*//' -e 's/(.*$//'` + fi + if [ ".$userid" = . ]; then + userid=`(getent passwd ${username}) 2>/dev/null | \ + sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$userid" = . ]; then + userid=`grep "^${username}:" /etc/passwd 2>/dev/null | \ + sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$userid" = . ]; then + userid=`(ypcat passwd) 2>/dev/null | + grep "^${username}:" | \ + sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$userid" = . ]; then + userid='?' + fi + fi + fi + fi + fi + fi + fi + + # determine (primary) group id + groupid='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[gG]'`" != . ]; then + groupid="`(id -g ${username}) 2>/dev/null`" + if [ ".$groupid" = . ]; then + str="`(id) 2>/dev/null`" + if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then + groupid=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*//' -e 's/(.*$//'` + fi + if [ ".$groupid" = . ]; then + groupid=`(getent passwd ${username}) 2>/dev/null | \ + sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$groupid" = . ]; then + groupid=`grep "^${username}:" /etc/passwd 2>/dev/null | \ + sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$groupid" = . ]; then + groupid=`(ypcat passwd) 2>/dev/null | grep "^${username}:" | \ + sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` + if [ ".$groupid" = . ]; then + groupid='?' + fi + fi + fi + fi + fi + fi + + # determine (primary) group name + groupname='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%g'`" != . ]; then + groupname="`(id -gn ${username}) 2>/dev/null`" + if [ ".$groupname" = . ]; then + str="`(id) 2>/dev/null`" + if [ ".`echo $str | grep 'gid[ ]*=[ ]*[0-9]*('`" != . ]; then + groupname=`echo $str | sed -e 's/^.*gid[ ]*=[ ]*[0-9]*(//' -e 's/).*$//'` + fi + if [ ".$groupname" = . ]; then + groupname=`(getent group) 2>/dev/null | \ + grep "^[^:]*:[^:]*:${groupid}:" | \ + sed -e 's/:.*$//'` + if [ ".$groupname" = . ]; then + groupname=`grep "^[^:]*:[^:]*:${groupid}:" /etc/group 2>/dev/null | \ + sed -e 's/:.*$//'` + if [ ".$groupname" = . ]; then + groupname=`(ypcat group) 2>/dev/null | \ + grep "^[^:]*:[^:]*:${groupid}:" | \ + sed -e 's/:.*$//'` + if [ ".$groupname" = . ]; then + groupname='?' + fi + fi + fi + fi + fi + fi + + # determine host and domain name + hostname='' + domainname='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%h'`" != . ]; then + hostname="`(uname -n) 2>/dev/null |\ + awk '{ printf("%s", $1); }'`" + if [ ".$hostname" = . ]; then + hostname="`(hostname) 2>/dev/null |\ + awk '{ printf("%s", $1); }'`" + if [ ".$hostname" = . ]; then + hostname='unknown' + fi + fi + case $hostname in + *.* ) + domainname=".`echo $hostname | cut -d. -f2-`" + hostname="`echo $hostname | cut -d. -f1`" + ;; + esac + fi + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%d'`" != . ]; then + if [ ".$domainname" = . ]; then + if [ -f /etc/resolv.conf ]; then + domainname="`grep '^[ ]*domain' /etc/resolv.conf | sed -e 'q' |\ + sed -e 's/.*domain//' \ + -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ + -e 's/^\.//' -e 's/^/./' |\ + awk '{ printf("%s", $1); }'`" + if [ ".$domainname" = . ]; then + domainname="`grep '^[ ]*search' /etc/resolv.conf | sed -e 'q' |\ + sed -e 's/.*search//' \ + -e 's/^[ ]*//' -e 's/^ *//' -e 's/^ *//' \ + -e 's/ .*//' -e 's/ .*//' \ + -e 's/^\.//' -e 's/^/./' |\ + awk '{ printf("%s", $1); }'`" + fi + fi + fi + fi + + # determine current time + time_day='' + time_month='' + time_year='' + time_monthname='' + if [ ".$opt_e" = .yes ] && [ ".`echo $text | grep '%[DMYm]'`" != . ]; then + time_day=`date '+%d'` + time_month=`date '+%m'` + time_year=`date '+%Y' 2>/dev/null` + if [ ".$time_year" = . ]; then + time_year=`date '+%y'` + case $time_year in + [5-9][0-9]) time_year="19$time_year" ;; + [0-4][0-9]) time_year="20$time_year" ;; + esac + fi + case $time_month in + 1|01) time_monthname='Jan' ;; + 2|02) time_monthname='Feb' ;; + 3|03) time_monthname='Mar' ;; + 4|04) time_monthname='Apr' ;; + 5|05) time_monthname='May' ;; + 6|06) time_monthname='Jun' ;; + 7|07) time_monthname='Jul' ;; + 8|08) time_monthname='Aug' ;; + 9|09) time_monthname='Sep' ;; + 10) time_monthname='Oct' ;; + 11) time_monthname='Nov' ;; + 12) time_monthname='Dec' ;; + esac + fi + + # expand special ``%x'' constructs + if [ ".$opt_e" = .yes ]; then + text=`echo $seo "$text" |\ + sed -e "s/%B/${term_bold}/g" \ + -e "s/%b/${term_norm}/g" \ + -e "s/%u/${username}/g" \ + -e "s/%U/${userid}/g" \ + -e "s/%g/${groupname}/g" \ + -e "s/%G/${groupid}/g" \ + -e "s/%h/${hostname}/g" \ + -e "s/%d/${domainname}/g" \ + -e "s/%D/${time_day}/g" \ + -e "s/%M/${time_month}/g" \ + -e "s/%Y/${time_year}/g" \ + -e "s/%m/${time_monthname}/g" 2>/dev/null` + fi + + # create output + if [ .$opt_n = .no ]; then + echo $seo "$text" + else + # the harder part: echo -n is best, because + # awk may complain about some \xx sequences. + if [ ".$minusn" != . ]; then + echo $seo $minusn "$text" + else + echo dummy | awk '{ printf("%s", TEXT); }' TEXT="$text" + fi + fi + + shtool_exit 0 + ;; + +mdate ) + ## + ## mdate -- Pretty-print modification time of a file or dir + ## Copyright (c) 1995-1997 Free Software Foundation, Inc. + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + fod="$1" + case "$opt_o" in + [dmy][dmy][dmy] ) + ;; + * ) echo "$msgprefix:Error: invalid argument to option \`-o': $opt_o" 1>&2 + shtool_exit 1 + ;; + esac + if [ ! -r "$fod" ]; then + echo "$msgprefix:Error: file or directory not found: $fod" 1>&2 + shtool_exit 1 + fi + + # prevent "date" giving response in another language + LANG=C; export LANG + LC_ALL=C; export LC_ALL + LC_TIME=C; export LC_TIME + + # get the extended ls output of the file or directory. + if /bin/ls -L /dev/null >/dev/null 2>&1; then + set - x`/bin/ls -L -l -d $fod` + else + set - x`/bin/ls -l -d $fod` + fi + + # The month is at least the fourth argument + # (3 shifts here, the next inside the loop). + shift; shift; shift + + # Find the month. Next argument is day, followed by the year or time. + month="" + while [ ".$month" = . ]; do + shift + case $1 in + Jan) month=January; nummonth=1 ;; + Feb) month=February; nummonth=2 ;; + Mar) month=March; nummonth=3 ;; + Apr) month=April; nummonth=4 ;; + May) month=May; nummonth=5 ;; + Jun) month=June; nummonth=6 ;; + Jul) month=July; nummonth=7 ;; + Aug) month=August; nummonth=8 ;; + Sep) month=September; nummonth=9 ;; + Oct) month=October; nummonth=10 ;; + Nov) month=November; nummonth=11 ;; + Dec) month=December; nummonth=12 ;; + esac + done + day="$2" + year="$3" + + # We finally have to deal with the problem that the "ls" output + # gives either the time of the day or the year. + case $year in + *:*) + this_year=`date '+%Y' 2>/dev/null` + if [ ".$this_year" = . ]; then + this_year=`date '+%y'` + case $this_year in + [5-9][0-9]) this_year="19$this_year" ;; + [0-4][0-9]) this_year="20$this_year" ;; + esac + fi + # for the following months of the last year the time notation + # is usually also used for files modified in the last year. + this_month=`date '+%m'` + if (expr $nummonth \> $this_month) >/dev/null; then + this_year=`expr $this_year - 1` + fi + year="$this_year" + ;; + esac + + # Optionally fill day and month with leeding zeros + if [ ".$opt_z" = .yes ]; then + case $day in + [0-9][0-9] ) ;; + [0-9] ) day="0$day" ;; + esac + case $nummonth in + [0-9][0-9] ) ;; + [0-9] ) nummonth="0$nummonth" ;; + esac + fi + + # Optionally use digits for month + if [ ".$opt_d" = .yes ]; then + month="$nummonth" + fi + + # Optionally shorten the month name to three characters + if [ ".$opt_s" = .yes ]; then + month=`echo $month | cut -c1-3` + fi + + # Output the resulting date string + echo dummy | awk '{ + for (i = 0; i < 3; i++) { + now = substr(order, 1, 1); + order = substr(order, 2); + if (now == "d") + out = day; + else if (now == "m") + out = month; + else if (now == "y") + out = year; + if (i < 2) + printf("%s%s", out, field); + else + printf("%s", out); + } + if (newline != "yes") + printf("\n"); + }' "day=$day" "month=$month" "year=$year" \ + "field=$opt_f" "order=$opt_o" "newline=$opt_n" + + shtool_exit 0 + ;; + +table ) + ## + ## table -- Pretty-print a field-separated list as a table + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + if [ $opt_c -gt 4 ]; then + echo "$msgprefix:Error: Invalid number of colums (1..4 allowed only)" 1>&2 + shtool_exit 1 + fi + case "x$opt_F" in + x? ) ;; + * ) echo "$msgprefix:Error: Invalid separator (one char allowed only)" 1>&2; shtool_exit 1 ;; + esac + + # split the list into a table + list=` + IFS="$opt_F" + for entry in $*; do + if [ ".$entry" != . ]; then + echo "$entry" + fi + done |\ + awk " + BEGIN { list = \"\"; n = 0; } + { + list = list \\$1; + n = n + 1; + if (n < $opt_c) { + list = list \":\"; + } + if (n == $opt_c) { + list = list \"\\n\"; + n = 0; + } + } + END { print list; } + " + ` + + # format table cells and make sure table + # doesn't exceed maximum width + OIFS="$IFS" + IFS=' +' + for entry in $list; do + case $opt_c in + 1 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s\\n\", \$1); }'" ;; + 2 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s\\n\", \$1, \$2); }'" ;; + 3 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3); }'" ;; + 4 ) eval "echo \"\${entry}\" | awk -F: '{ printf(\"%-${opt_w}s %-${opt_w}s %-${opt_w}s %-${opt_w}s\\n\", \$1, \$2, \$3, \$4); }'" ;; + esac + done |\ + awk "{ + if (length(\$0) > $opt_s) { + printf(\"%s\\n\", substr(\$0, 0, $opt_s-1)); + } else { + print \$0; + } + }" + IFS="$OIFS" + + shtool_exit 0 + ;; + +prop ) + ## + ## prop -- Display progress with a running propeller + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + perl='' + for dir in `echo $PATH | sed -e 's/:/ /g'` .; do + if [ -f "$dir/perl" ]; then + perl="$dir/perl" + break + fi + done + if [ ".$perl" != . ]; then + # Perl is preferred because writing to STDERR in + # Perl really writes immediately as one would expect + $perl -e ' + @p = ("|","/","-","\\"); + $i = 0; + while () { + printf(STDERR "\r%s...%s\b", $ARGV[0], $p[$i++]); + $i = 0 if ($i > 3); + } + printf(STDERR "\r%s \n", $ARGV[0]); + ' "$opt_p" + else + # But if Perl doesn't exists we use Awk even + # some Awk's buffer even the /dev/stderr writing :-( + awk ' + BEGIN { + split("|#/#-#\\", p, "#"); + i = 1; + } + { + printf("\r%s%c\b", prefix, p[i++]) > "/dev/stderr"; + if (i > 4) { i = 1; } + } + END { + printf("\r%s \n", prefix) > "/dev/stderr"; + } + ' "prefix=$opt_p" + fi + + shtool_exit 0 + ;; + +move ) + ## + ## move -- Move files with simultaneous substitution + ## Copyright (c) 1999-2004 Ralf S. Engelschall + ## + + src="$1" + dst="$2" + + # consistency checks + if [ ".$src" = . ] || [ ".$dst" = . ]; then + echo "$msgprefix:Error: Invalid arguments" 1>&2 + shtool_exit 1 + fi + if [ ".$src" = ".$dst" ]; then + echo "$msgprefix:Error: Source and destination files are the same" 1>&2 + shtool_exit 1 + fi + expsrc="$src" + if [ ".$opt_e" = .yes ]; then + expsrc="`echo $expsrc`" + fi + if [ ".$opt_e" = .yes ]; then + if [ ".`echo "$src" | sed -e 's;^.*\\*.*$;;'`" = ".$src" ]; then + echo "$msgprefix:Error: Source doesn't contain wildcard ('*'): $dst" 1>&2 + shtool_exit 1 + fi + if [ ".`echo "$dst" | sed -e 's;^.*%[1-9].*$;;'`" = ".$dst" ]; then + echo "$msgprefix:Error: Destination doesn't contain substitution ('%N'): $dst" 1>&2 + shtool_exit 1 + fi + if [ ".$expsrc" = ".$src" ]; then + echo "$msgprefix:Error: Sources not found or no asterisk : $src" 1>&2 + shtool_exit 1 + fi + else + if [ ! -r "$src" ]; then + echo "$msgprefix:Error: Source not found: $src" 1>&2 + shtool_exit 1 + fi + fi + + # determine substitution patterns + if [ ".$opt_e" = .yes ]; then + srcpat=`echo "$src" | sed -e 's/\\./\\\\./g' -e 's/;/\\;/g' -e 's;\\*;\\\\(.*\\\\);g'` + dstpat=`echo "$dst" | sed -e 's;%\([1-9]\);\\\\\1;g'` + fi + + # iterate over source(s) + for onesrc in $expsrc; do + if [ .$opt_e = .yes ]; then + onedst=`echo $onesrc | sed -e "s;$srcpat;$dstpat;"` + else + onedst="$dst" + fi + errorstatus=0 + if [ ".$opt_v" = .yes ]; then + echo "$onesrc -> $onedst" + fi + if [ ".$opt_p" = .yes ]; then + if [ -r $onedst ]; then + if cmp -s $onesrc $onedst; then + if [ ".$opt_t" = .yes ]; then + echo "rm -f $onesrc" 1>&2 + fi + rm -f $onesrc || errorstatus=$? + else + if [ ".$opt_t" = .yes ]; then + echo "mv -f $onesrc $onedst" 1>&2 + fi + mv -f $onesrc $onedst || errorstatus=$? + fi + else + if [ ".$opt_t" = .yes ]; then + echo "mv -f $onesrc $onedst" 1>&2 + fi + mv -f $onesrc $onedst || errorstatus=$? + fi + else + if [ ".$opt_t" = .yes ]; then + echo "mv -f $onesrc $onedst" 1>&2 + fi + mv -f $onesrc $onedst || errorstatus=$? + fi + if [ $errorstatus -ne 0 ]; then + break; + fi + done + + shtool_exit $errorstatus + ;; + +install ) + ## + ## install -- Install a program, script or datafile + ## Copyright (c) 1997-2004 Ralf S. Engelschall + ## + + # special case: "shtool install -d [...]" internally + # maps to "shtool mkdir -f -p -m 755 [...]" + if [ "$opt_d" = yes ]; then + cmd="$0 mkdir -f -p -m 755" + if [ ".$opt_o" != . ]; then + cmd="$cmd -o '$opt_o'" + fi + if [ ".$opt_g" != . ]; then + cmd="$cmd -g '$opt_g'" + fi + if [ ".$opt_v" = .yes ]; then + cmd="$cmd -v" + fi + if [ ".$opt_t" = .yes ]; then + cmd="$cmd -t" + fi + for dir in "$@"; do + eval "$cmd $dir" || shtool_exit $? + done + shtool_exit 0 + fi + + # determine source(s) and destination + argc=$# + srcs="" + while [ $# -gt 1 ]; do + srcs="$srcs $1" + shift + done + dstpath="$1" + + # type check for destination + dstisdir=0 + if [ -d $dstpath ]; then + dstpath=`echo "$dstpath" | sed -e 's:/$::'` + dstisdir=1 + fi + + # consistency check for destination + if [ $argc -gt 2 ] && [ $dstisdir = 0 ]; then + echo "$msgprefix:Error: multiple sources require destination to be directory" 1>&2 + shtool_exit 1 + fi + + # iterate over all source(s) + for src in $srcs; do + dst=$dstpath + + # if destination is a directory, append the input filename + if [ $dstisdir = 1 ]; then + dstfile=`echo "$src" | sed -e 's;.*/\([^/]*\)$;\1;'` + dst="$dst/$dstfile" + fi + + # check for correct arguments + if [ ".$src" = ".$dst" ]; then + echo "$msgprefix:Warning: source and destination are the same - skipped" 1>&2 + continue + fi + if [ -d "$src" ]; then + echo "$msgprefix:Warning: source \`$src' is a directory - skipped" 1>&2 + continue + fi + + # make a temp file name in the destination directory + dsttmp=`echo $dst |\ + sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;' \ + -e "s;\$;/#INST@$$#;"` + + # verbosity + if [ ".$opt_v" = .yes ]; then + echo "$src -> $dst" 1>&2 + fi + + # copy or move the file name to the temp name + # (because we might be not allowed to change the source) + if [ ".$opt_C" = .yes ]; then + opt_c=yes + fi + if [ ".$opt_c" = .yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "cp $src $dsttmp" 1>&2 + fi + cp $src $dsttmp || shtool_exit $? + else + if [ ".$opt_t" = .yes ]; then + echo "mv $src $dsttmp" 1>&2 + fi + mv $src $dsttmp || shtool_exit $? + fi + + # adjust the target file + if [ ".$opt_e" != . ]; then + sed='sed' + OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" + for e + do + sed="$sed -e '$e'" + done + cp $dsttmp $dsttmp.old + chmod u+w $dsttmp + eval "$sed <$dsttmp.old >$dsttmp" || shtool_exit $? + rm -f $dsttmp.old + fi + if [ ".$opt_s" = .yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "strip $dsttmp" 1>&2 + fi + strip $dsttmp || shtool_exit $? + fi + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o $dsttmp" 1>&2 + fi + chown $opt_o $dsttmp || shtool_exit $? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g $dsttmp" 1>&2 + fi + chgrp $opt_g $dsttmp || shtool_exit $? + fi + if [ ".$opt_m" != ".-" ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m $dsttmp" 1>&2 + fi + chmod $opt_m $dsttmp || shtool_exit $? + fi + + # determine whether to do a quick install + # (has to be done _after_ the strip was already done) + quick=no + if [ ".$opt_C" = .yes ]; then + if [ -r $dst ]; then + if cmp -s $src $dst; then + quick=yes + fi + fi + fi + + # finally, install the file to the real destination + if [ $quick = yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "rm -f $dsttmp" 1>&2 + fi + rm -f $dsttmp + else + if [ ".$opt_t" = .yes ]; then + echo "rm -f $dst && mv $dsttmp $dst" 1>&2 + fi + rm -f $dst && mv $dsttmp $dst + fi + done + + shtool_exit 0 + ;; + +mkdir ) + ## + ## mkdir -- Make one or more directories + ## Copyright (c) 1996-2004 Ralf S. Engelschall + ## + + errstatus=0 + for p in ${1+"$@"}; do + # if the directory already exists... + if [ -d "$p" ]; then + if [ ".$opt_f" = .no ] && [ ".$opt_p" = .no ]; then + echo "$msgprefix:Error: directory already exists: $p" 1>&2 + errstatus=1 + break + else + continue + fi + fi + # if the directory has to be created... + if [ ".$opt_p" = .no ]; then + if [ ".$opt_t" = .yes ]; then + echo "mkdir $p" 1>&2 + fi + mkdir $p || errstatus=$? + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o $p" 1>&2 + fi + chown $opt_o $p || errstatus=$? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g $p" 1>&2 + fi + chgrp $opt_g $p || errstatus=$? + fi + if [ ".$opt_m" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m $p" 1>&2 + fi + chmod $opt_m $p || errstatus=$? + fi + else + # the smart situation + set fnord `echo ":$p" |\ + sed -e 's/^:\//%/' \ + -e 's/^://' \ + -e 's/\// /g' \ + -e 's/^%/\//'` + shift + pathcomp='' + for d in ${1+"$@"}; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp="./$pathcomp" ;; + esac + if [ ! -d "$pathcomp" ]; then + if [ ".$opt_t" = .yes ]; then + echo "mkdir $pathcomp" 1>&2 + fi + mkdir $pathcomp || errstatus=$? + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o $pathcomp" 1>&2 + fi + chown $opt_o $pathcomp || errstatus=$? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g $pathcomp" 1>&2 + fi + chgrp $opt_g $pathcomp || errstatus=$? + fi + if [ ".$opt_m" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m $pathcomp" 1>&2 + fi + chmod $opt_m $pathcomp || errstatus=$? + fi + fi + pathcomp="$pathcomp/" + done + fi + done + + shtool_exit $errstatus + ;; + +mkln ) + ## + ## mkln -- Make link with calculation of relative paths + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + # determine source(s) and destination + args=$? + srcs="" + while [ $# -gt 1 ]; do + srcs="$srcs $1" + shift + done + dst="$1" + if [ ! -d $dst ]; then + if [ $args -gt 2 ]; then + echo "$msgprefix:Error: multiple sources not allowed when target isn't a directory" 1>&2 + shtool_exit 1 + fi + fi + + # determine link options + lnopt="" + if [ ".$opt_f" = .yes ]; then + lnopt="$lnopt -f" + fi + if [ ".$opt_s" = .yes ]; then + lnopt="$lnopt -s" + fi + + # iterate over sources + for src in $srcs; do + # determine if one of the paths is an absolute path, + # because then we _have_ to use an absolute symlink + oneisabs=0 + srcisabs=0 + dstisabs=0 + case $src in + /* ) oneisabs=1; srcisabs=1 ;; + esac + case $dst in + /* ) oneisabs=1; dstisabs=1 ;; + esac + + # split source and destination into dir and base name + if [ -d $src ]; then + srcdir=`echo $src | sed -e 's;/*$;;'` + srcbase="" + else + srcdir=`echo $src | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` + srcbase=`echo $src | sed -e 's;.*/\([^/]*\)$;\1;'` + fi + if [ -d $dst ]; then + dstdir=`echo $dst | sed -e 's;/*$;;'` + dstbase="" + else + dstdir=`echo $dst | sed -e 's;^[^/]*$;;' -e 's;^\(.*/\)[^/]*$;\1;' -e 's;\(.\)/$;\1;'` + dstbase=`echo $dst | sed -e 's;.*/\([^/]*\)$;\1;'` + fi + + # consistency check + if [ ".$dstdir" != . ]; then + if [ ! -d $dstdir ]; then + echo "$msgprefix:Error: destination directory not found: $dstdir" 1>&2 + shtool_exit 1 + fi + fi + + # make sure the source is reachable from the destination + if [ $dstisabs = 1 ]; then + if [ $srcisabs = 0 ]; then + if [ ".$srcdir" = . ]; then + srcdir="`pwd | sed -e 's;/*$;;'`" + srcisabs=1 + oneisabs=1 + elif [ -d $srcdir ]; then + srcdir="`cd $srcdir; pwd | sed -e 's;/*$;;'`" + srcisabs=1 + oneisabs=1 + fi + fi + fi + + # split away a common prefix + prefix="" + if [ ".$srcdir" = ".$dstdir" ] && [ ".$srcdir" != . ]; then + prefix="$srcdir/" + srcdir="" + dstdir="" + else + while [ ".$srcdir" != . ] && [ ".$dstdir" != . ]; do + presrc=`echo $srcdir | sed -e 's;^\([^/]*\)/.*;\1;'` + predst=`echo $dstdir | sed -e 's;^\([^/]*\)/.*;\1;'` + if [ ".$presrc" != ".$predst" ]; then + break + fi + prefix="$prefix$presrc/" + srcdir=`echo $srcdir | sed -e 's;^[^/]*/*;;'` + dstdir=`echo $dstdir | sed -e 's;^[^/]*/*;;'` + done + fi + + # destination prefix is just the common prefix + dstpre="$prefix" + + # determine source prefix which is the reverse directory + # step-up corresponding to the destination directory + srcpre="" + + isroot=0 + if [ ".$prefix" = . ] || [ ".$prefix" = ./ ]; then + isroot=1 + fi + if [ $oneisabs = 0 ] || [ $isroot = 0 ]; then + pl="$dstdir/" + OIFS="$IFS"; IFS='/' + for pe in $pl; do + [ ".$pe" = . ] && continue + [ ".$pe" = .. ] && continue + srcpre="../$srcpre" + done + IFS="$OIFS" + else + if [ $srcisabs = 1 ]; then + srcpre="$prefix" + fi + fi + + # determine destination symlink name + if [ ".$dstbase" = . ]; then + if [ ".$srcbase" != . ]; then + dstbase="$srcbase" + else + dstbase=`echo "$prefix$srcdir" | sed -e 's;/*$;;' -e 's;.*/\([^/]*\)$;\1;'` + fi + fi + + # now finalize source and destination directory paths + srcdir=`echo $srcdir | sed -e 's;\([^/]\)$;\1/;'` + dstdir=`echo $dstdir | sed -e 's;\([^/]\)$;\1/;'` + + # run the final link command + if [ ".$opt_t" = .yes ]; then + echo "ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase" + fi + eval ln$lnopt $srcpre$srcdir$srcbase $dstpre$dstdir$dstbase + done + + shtool_exit 0 + ;; + +mkshadow ) + ## + ## mkshadow -- Make a shadow tree through symbolic links + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + # source and destination directory + src=`echo "$1" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'` + dst=`echo "$2" | sed -e 's:/$::' -e 's:^\./\(.\):\1:'` + + # check whether source exists + if [ ! -d $src ]; then + echo "$msgprefix:Error: source directory not found: \`$src'" 1>&2 + shtool_exit 1 + fi + + # determine if one of the paths is an absolute path, + # because then we have to use an absolute symlink + oneisabs=0 + case $src in + /* ) oneisabs=1 ;; + esac + case $dst in + /* ) oneisabs=1 ;; + esac + + # determine reverse directory for destination directory + dstrevdir='' + if [ $oneisabs = 0 ]; then + # derive reverse path from forward path + pwd=`pwd` + OIFS="$IFS"; IFS='/' + for pe in $dst; do + if [ "x$pe" = "x.." ]; then + OIFS2="$IFS"; IFS="$DIFS" + eval `echo "$pwd" |\ + sed -e 's:\([^/]*\)$:; dir="\1":' \ + -e 's:^\(.*\)/[^/]*;:pwd="\1";:'\ + -e 's:^;:pwd="";:'` + dstrevdir="$dir/$dstrevdir" + IFS="$OIFS2" + else + dstrevdir="../$dstrevdir" + fi + done + IFS="$OIFS" + else + src="`cd $src; pwd`"; + fi + + # create directory tree at destination + if [ ! -d $dst ]; then + if [ ".$opt_t" = .yes ]; then + echo "mkdir $dst" 1>&2 + fi + mkdir $dst + fi + if [ ".$opt_a" = .yes ]; then + DIRS=`cd $src; find . -type d -print |\ + sed -e '/^\.$/d' -e 's:^\./::'` + else + DIRS=`cd $src; find . -type d -print |\ + sed -e '/\/CVS/d' -e '/^\.$/d' -e 's:^\./::'` + fi + for dir in $DIRS; do + if [ ".$opt_t" = .yes ]; then + echo "mkdir $dst/$dir" 1>&2 + fi + mkdir $dst/$dir + done + + # fill directory tree with symlinks to files + if [ ".$opt_a" = .yes ]; then + FILES="`cd $src; find . -depth -print |\ + sed -e 's/^\.\///'`" + else + FILES="`cd $src; find . -depth -print |\ + sed -e '/\.o$/d' -e '/\.a$/d' -e '/\.so$/d' \ + -e '/\.cvsignore$/d' -e '/\/CVS/d' \ + -e '/\/\.#/d' -e '/\.orig$/d' \ + -e 's/^\.\///'`" + fi + for file in $FILES; do + # don't use `-type f' above for find because of symlinks + if [ -d "$src/$file" ]; then + continue + fi + basename=`echo $file | sed -e 's:^.*/::'` + dir=`echo $file | sed -e 's:[^/]*$::' -e 's:/$::' -e 's:$:/:' -e 's:^/$::'` + from=`echo "$src/$file" | sed -e 's/^\.\///'` + to="$dst/$dir$basename" + if [ $oneisabs = 0 ]; then + if [ ".$dir" != . ]; then + subdir=`echo $dir | sed -e 's:/$::'` + # derive reverse path from forward path + revdir='' + OIFS="$IFS"; IFS='/' + for pe in $subdir; do + revdir="../$revdir" + done + IFS="$OIFS" + # finalize from + from="$revdir$from" + fi + from="$dstrevdir$from" + fi + if [ ".$opt_v" = .yes ]; then + echo " $to" 1>&2 + fi + if [ ".$opt_t" = .yes ]; then + echo "ln -s $from $to" 1>&2 + fi + ln -s $from $to + done + + shtool_exit 0 + ;; + +fixperm ) + ## + ## fixperm -- Fix file permissions inside a source tree + ## Copyright (c) 1996-2004 Ralf S. Engelschall + ## + + paths="$*" + + # check whether the test command supports the -x option + if [ -x /bin/sh ] 2>/dev/null; then + minusx="-x" + else + minusx="-r" + fi + + # iterate over paths + for p in $paths; do + for file in `find $p -depth -print`; do + if [ -f $file ]; then + if [ $minusx $file ]; then + if [ ".$opt_v" = .yes ]; then + echo "-rwxr-xr-x $file" 2>&1 + fi + if [ ".$opt_t" = .yes ]; then + echo "chmod 755 $file" 2>&1 + fi + chmod 755 $file + else + if [ ".$opt_v" = .yes ]; then + echo "-rw-r--r-- $file" 2>&1 + fi + if [ ".$opt_t" = .yes ]; then + echo "chmod 644 $file" 2>&1 + fi + chmod 644 $file + fi + continue + fi + if [ -d $file ]; then + if [ ".$opt_v" = .yes ]; then + echo "drwxr-xr-x $file" 2>&1 + fi + if [ ".$opt_t" = .yes ]; then + echo "chmod 755 $file" 2>&1 + fi + chmod 755 $file + continue + fi + if [ ".$opt_v" = .yes ]; then + echo "?????????? $file" 2>&1 + fi + done + done + + shtool_exit 0 + ;; + +rotate ) + ## + ## rotate -- Logfile rotation + ## Copyright (c) 2001-2004 Ralf S. Engelschall + ## + + # make sure we have at least one file to rotate + if [ ".$opt_n" = .0 ]; then + echo "$msgprefix:Error: invalid argument \`$opt_n' to option -n." 1>&2 + shtool_exit 1 + fi + + # canonicalize -s option argument + if [ ".$opt_s" != . ]; then + if [ ".`expr $opt_s : '[0-9]*$'`" != .0 ]; then + : + elif [ ".`expr $opt_s : '[0-9]*[Kk]$'`" != .0 ]; then + opt_s=`expr $opt_s : '\([0-9]*\)[Kk]$'` + opt_s=`expr $opt_s \* 1024` + elif [ ".`expr $opt_s : '[0-9]*[Mm]$'`" != .0 ]; then + opt_s=`expr $opt_s : '\([0-9]*\)[Mm]$'` + opt_s=`expr $opt_s \* 1048576` # 1024*1024 + elif [ ".`expr $opt_s : '[0-9]*[Gg]$'`" != .0 ]; then + opt_s=`expr $opt_s : '\([0-9]*\)[Gg]$'` + opt_s=`expr $opt_s \* 1073741824` # 1024*1024*1024 + else + echo "$msgprefix:Error: invalid argument \`$opt_s' to option -s." 1>&2 + shtool_exit 1 + fi + fi + + # option -d/-z consistency + if [ ".$opt_d" = .yes ] && [ ".$opt_z" = . ]; then + echo "$msgprefix:Error: option -d requires option -z." 1>&2 + shtool_exit 1 + fi + + # make sure target directory exists + if [ ".$opt_a" != . ]; then + if [ ! -d $opt_a ]; then + if [ ".$opt_f" = .no ]; then + echo "$msgprefix:Error: archive directory \`$opt_a' does not exist." 1>&2 + shtool_exit 1 + fi + mkdir $opt_a || shtool_exit $? + chmod 755 $opt_a + fi + if [ ! -w $opt_a ]; then + echo "$msgprefix:Error: archive directory \`$opt_a' not writable." 1>&2 + shtool_exit 1 + fi + fi + + # determine compression approach + if [ ".$opt_z" != . ]; then + comp_lvl="$opt_z" + comp_prg="" + case $comp_lvl in + *:* ) eval `echo $comp_lvl |\ + sed -e 's%^\(.*\):\(.*\)$%comp_prg="\1"; comp_lvl="\2"%'` ;; + esac + + # compression level consistency + case $comp_lvl in + [0-9] ) + ;; + * ) echo "$msgprefix:Error: invalid compression level \`$comp_lvl'" 1>&2 + shtool_exit 1 + ;; + esac + + # determine a suitable compression tool + if [ ".$comp_prg" = . ]; then + # check whether the test command supports the -x option + if [ -x /bin/sh ] 2>/dev/null; then + minusx="-x" + else + minusx="-r" + fi + # search for tools in $PATH + paths="`echo $PATH |\ + sed -e 's%/*:%:%g' -e 's%/*$%%' \ + -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ + -e 's/:/ /g'`" + for prg in bzip2 gzip compress; do + for path in $paths; do + if [ $minusx "$path/$prg" ] && [ ! -d "$path/$prg" ]; then + comp_prg="$prg" + break + fi + done + if [ ".$comp_prg" != . ]; then + break + fi + done + if [ ".$comp_prg" = . ]; then + echo "$msgprefix:Error: no suitable compression tool found in \$PATH" 1>&2 + shtool_exit 1 + fi + fi + + # determine standard compression extension + # and make sure it is a known tool + case $comp_prg in + */bzip2 | bzip2 ) comp_ext="bz2" comp_lvl="-$comp_lvl" ;; + */gzip | gzip ) comp_ext="gz" comp_lvl="-$comp_lvl" ;; + */compress | compress ) comp_ext="Z"; comp_lvl="" ;; + * ) echo "$msgprefix:Error: tool \`$comp_prg' is not a known compression tool" 1>&2 + shtool_exit 1 + ;; + esac + comp_suf=".$comp_ext" + fi + + # iterate over all given logfile arguments + for file in $*; do + # make sure the logfile exists + if [ ! -f $file ]; then + if [ ".$opt_f" = .yes ]; then + continue + fi + echo "$msgprefix:Error: logfile \`$file' not found" 1>&2 + shtool_exit 1 + fi + + # determine log directory (where original logfile is placed) + ldir="." + case $file in + */* ) eval `echo $file | sed -e 's%^\(.*\)/\([^/]*\)$%ldir="\1"; file="\2";%'` ;; + esac + + # determine archive directory (where rotated logfiles are placed) + adir="$ldir" + if [ ".$opt_a" != . ]; then + case "$opt_a" in + /* | ./* ) adir="$opt_a" ;; + * ) adir="$ldir/$opt_a" ;; + esac + fi + + # optionally take logfile size into account + if [ ".$opt_s" != . ]; then + # determine size of logfile + set -- `env -i /bin/ls -l "$ldir/$file" | sed -e "s;$ldir/$file;;" |\ + sed -e 's; -> .*$;;' -e 's;[ ][ ]*; ;g'` + n=`expr $# - 3` + eval "size=\`echo \${$n}\`" + + # skip logfile if size is still too small + if [ $size -lt $opt_s ]; then + if [ ".$opt_v" = .yes ]; then + echo "$ldir/$file: still too small in size -- skipping" + fi + continue + fi + fi + + # verbosity + if [ ".$opt_v" = .yes ]; then + echo "rotating $ldir/$file" + fi + + # execute prolog + if [ ".$opt_P" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "$opt_P" + fi + eval $opt_P + [ $? -ne 0 ] && shtool_exit $? + fi + + # kick away out-rotated logfile + n=`expr $opt_n - 1` + n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n` + if [ -f "${adir}/${file}.${n}${comp_suf}" ]; then + # optionally migrate away the out-rotated logfile + if [ ".$opt_M" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "$opt_M ${adir}/${file}.${n}${comp_suf}" + fi + eval "$opt_M ${adir}/${file}.${n}${comp_suf}" + [ $? -ne 0 ] && shtool_exit $? + fi + # finally get rid of the out-rotated logfile + if [ ".$opt_t" = .yes ]; then + echo "rm -f ${adir}/${file}.${n}${comp_suf}" + fi + rm -f ${adir}/${file}.${n}${comp_suf} || shtool_exit $? + fi + + # rotate already archived logfiles + while [ $n -gt 0 ]; do + m=$n + n=`expr $n - 1` + n=`echo dummy | awk "{ printf(\"%0${opt_p}d\", n); }" n=$n` + if [ $n -eq 0 ] && [ ".$opt_d" = .yes ]; then + # special case: first rotation file under delayed compression situation + if [ ! -f "${adir}/${file}.${n}" ]; then + continue + fi + + # compress file (delayed) + if [ ".$opt_b" = .yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "mv ${adir}/${file}.${n} ${adir}/${file}.${m}" + fi + mv ${adir}/${file}.${n} ${adir}/${file}.${m} || shtool_exit $? + if [ ".$opt_t" = .yes ]; then + echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${m} >${adir}/${file}.${m}${comp_suf}; rm -f ${adir}/${file}.${m}) &" + fi + ( ${comp_prg} ${comp_lvl} \ + <${adir}/${file}.${m} \ + >${adir}/${file}.${m}${comp_suf} || shtool_exit $? + rm -f ${adir}/${file}.${m} || shtool_exit $? + ) /dev/null 2>&1 & + else + if [ ".$opt_t" = .yes ]; then + echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${m}${comp_suf}" + fi + ${comp_prg} ${comp_lvl} \ + <${adir}/${file}.${n} \ + >${adir}/${file}.${m}${comp_suf} || shtool_exit $? + if [ ".$opt_t" = .yes ]; then + echo "rm -f ${adir}/${file}.${n}" + fi + rm -f ${adir}/${file}.${n} || shtool_exit $? + fi + + # fix file attributes + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o ${adir}/${file}.${m}${comp_suf}" + fi + chown $opt_o ${adir}/${file}.${m}${comp_suf} || shtool_exit $? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g ${adir}/${file}.${m}${comp_suf}" + fi + chgrp $opt_g ${adir}/${file}.${m}${comp_suf} || shtool_exit $? + fi + if [ ".$opt_m" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m ${adir}/${file}.${m}${comp_suf}" + fi + chmod $opt_m ${adir}/${file}.${m}${comp_suf} || shtool_exit $? + fi + else + # standard case: second and following rotation file + if [ ! -f "${adir}/${file}.${n}${comp_suf}" ]; then + continue + fi + if [ ".$opt_t" = .yes ]; then + echo "mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf}" + fi + mv ${adir}/${file}.${n}${comp_suf} ${adir}/${file}.${m}${comp_suf} || shtool_exit $? + fi + done + + # move away current logfile + if [ ".$opt_c" = .yes ]; then + # approach: copy[+truncate] + if [ ".$opt_t" = .yes ]; then + echo "cp -p ${ldir}/${file} ${adir}/${file}.${n}" + fi + cp -p ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? + if [ ".$opt_r" = .no ]; then + if [ ".$opt_t" = .yes ]; then + echo "cp /dev/null ${ldir}/${file}" + fi + cp /dev/null ${ldir}/${file} || shtool_exit $? + fi + else + # approach: move[+touch] + if [ ".$opt_t" = .yes ]; then + echo "mv ${ldir}/${file} ${adir}/${file}.${n}" + fi + mv ${ldir}/${file} ${adir}/${file}.${n} || shtool_exit $? + if [ ".$opt_r" = .no ]; then + if [ ".$opt_t" = .yes ]; then + echo "touch ${ldir}/${file}" + fi + touch ${ldir}/${file} || shtool_exit $? + # fix file attributes + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o ${ldir}/${file}" + fi + chown $opt_o ${ldir}/${file} || shtool_exit $? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g ${ldir}/${file}" + fi + chgrp $opt_g ${ldir}/${file} || shtool_exit $? + fi + if [ ".$opt_m" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m ${ldir}/${file}" + fi + chmod $opt_m ${ldir}/${file} || shtool_exit $? + fi + fi + fi + + # regular compression step + if [ ".$opt_z" != . ] && [ ".$opt_d" = .no ]; then + # compress file + if [ ".$opt_b" = .yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "(${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}; rm -f ${adir}/${file}.${n}) &" + fi + ( ${comp_prg} ${comp_lvl} \ + <${adir}/${file}.${n} \ + >${adir}/${file}.${n}${comp_suf} || shtool_exit $? + rm -f ${adir}/${file}.${n} || shtool_exit $? + ) /dev/null 2>&1 & + else + if [ ".$opt_t" = .yes ]; then + echo "${comp_prg} ${comp_lvl} <${adir}/${file}.${n} >${adir}/${file}.${n}${comp_suf}" + fi + ${comp_prg} ${comp_lvl} \ + <${adir}/${file}.${n} \ + >${adir}/${file}.${n}${comp_suf} || shtool_exit $? + if [ ".$opt_t" = .yes ]; then + echo "rm -f ${opt_a}${file}.${n}" + fi + rm -f ${adir}/${file}.${n} || shtool_exit $? + fi + + # fix file attributes + if [ ".$opt_o" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown $opt_o ${adir}/${file}.${n}${comp_suf}" + fi + chown $opt_o ${adir}/${file}.${n}${comp_suf} || shtool_exit $? + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp $opt_g ${adir}/${file}.${n}${comp_suf}" + fi + chgrp $opt_g ${adir}/${file}.${n}${comp_suf} || shtool_exit $? + fi + if [ ".$opt_m" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chmod $opt_m ${adir}/${file}.${n}${comp_suf}" + fi + chmod $opt_m ${adir}/${file}.${n}${comp_suf} || shtool_exit $? + fi + fi + + # execute epilog + if [ ".$opt_E" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "$opt_E" + fi + eval $opt_E + [ $? -ne 0 ] && shtool_exit $? + fi + done + + shtool_exit 0 + ;; + +tarball ) + ## + ## tarball -- Roll distribution tarballs + ## Copyright (c) 1999-2004 Ralf S. Engelschall + ## + + srcs="$*" + + # check whether the test command supports the -x option + if [ -x /bin/sh ] 2>/dev/null; then + minusx="-x" + else + minusx="-r" + fi + + # find the tools + paths="`echo $PATH |\ + sed -e 's%/*:%:%g' -e 's%/*$%%' \ + -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ + -e 's/:/ /g'`" + for spec in find:gfind,find tar:gtar,tar tardy:tardy,tarcust; do + prg=`echo $spec | sed -e 's/:.*$//'` + tools=`echo $spec | sed -e 's/^.*://'` + eval "prg_${prg}=''" + # iterate over tools + for tool in `echo $tools | sed -e 's/,/ /g'`; do + # iterate over paths + for path in $paths; do + if [ $minusx "$path/$tool" ] && [ ! -d "$path/$tool" ]; then + eval "prg_${prg}=\"$path/$tool\"" + break + fi + done + eval "val=\$prg_${prg}" + if [ ".$val" != . ]; then + break + fi + done + done + + # expand source paths + exclude='' + for pat in `echo $opt_e | sed 's/,/ /g'`; do + exclude="$exclude | grep -v '$pat'" + done + if [ ".$opt_t" = .yes ]; then + echo "cp /dev/null $tmpfile.lst" 1>&2 + fi + cp /dev/null $tmpfile.lst + for src in $srcs; do + if [ -d $src ]; then + if [ ".$opt_t" = .yes ]; then + echo "(cd $src && $prg_find . -type f -depth -print) | sed -e 's:^\\.\$::' -e 's:^\\./::' | cat $exclude >>$tmpfile.lst" 1>&2 + fi + (cd $src && $prg_find . -type f -depth -print) |\ + sed -e 's:^\.$::' -e 's:^\./::' | eval cat $exclude >>$tmpfile.lst + else + if [ ".$opt_t" = .yes ]; then + echo "echo $src >>$tmpfile.lst" 1>&2 + fi + echo $src >>$tmpfile.lst + fi + done + sort <$tmpfile.lst >$tmpfile.lst.n + mv $tmpfile.lst.n $tmpfile.lst + if [ ".$opt_v" = .yes ]; then + cat $tmpfile.lst | sed -e 's/^/ /' 1>&2 + fi + + # determine tarball file and directory name + if [ ".$opt_o" != . ]; then + tarfile="$opt_o" + if [ ".$opt_d" != . ]; then + tarname="$opt_d" + else + tarname=`echo $tarfile | sed -e 's/\.tar.*$//' -e 's;.*/\([^/]*\)$;\1;'` + fi + else + if [ ".$opt_d" != . ]; then + tarname="$opt_d" + elif [ -d "$from" ]; then + tarname=`echo $from | sed -e 's;.*/\([^/]*\)$;\1;'` + else + tarname="out" + fi + tarfile="$tarname.tar" + fi + + # roll the tarball + compress='' + if [ ".$opt_c" != . ]; then + compress="| $opt_c" + fi + if [ ".$prg_tardy" != . ]; then + # the elegant hackers way + tardy_opt="--prefix=$tarname" + tardy_opt="$tardy_opt --user_number=0 --group_number=0" # security! + if [ ".$opt_u" != . ]; then + tardy_opt="$tardy_opt --user_name=$opt_u" + fi + if [ ".$opt_g" != . ]; then + tardy_opt="$tardy_opt --group_name=$opt_g" + fi + if [ ".$opt_t" = .yes ]; then + echo "cat $tmpfile.lst | xargs $prg_tar cf - | $prg_tardy $tardy_opt | cat $compress >$tmpfile.out" 1>&2 + fi + cat $tmpfile.lst |\ + xargs $prg_tar cf - |\ + $prg_tardy $tardy_opt |\ + eval cat $compress >$tmpfile.out + if [ ".$opt_t" = .yes ]; then + echo "cp $tmpfile.out $tarfile" 1>&2 + fi + cp $tmpfile.out $tarfile + else + # the portable standard way + if [ ".$opt_t" = .yes ]; then + echo "mkdir $tmpdir/$tarname" 1>&2 + fi + mkdir $tmpdir/$tarname || shtool_exit 1 + if [ ".$opt_t" = .yes ]; then + echo "cat $tmpfile.lst | xargs $prg_tar cf - | (cd $tmpdir/$tarname && $prg_tar xf -)" 1>&2 + fi + cat $tmpfile.lst |\ + xargs $prg_tar cf - |\ + (cd $tmpdir/$tarname && $prg_tar xf -) + if [ ".$opt_u" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1" 2>&1 + fi + chown -R $opt_u $tmpdir/$tarname >/dev/null 2>&1 ||\ + echo "$msgprefix:Warning: cannot set user name \`$opt_u' (would require root privileges)" + fi + if [ ".$opt_g" != . ]; then + if [ ".$opt_t" = .yes ]; then + echo "chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1" 2>&1 + fi + chgrp -R $opt_g $tmpdir/$tarname >/dev/null 2>&1 ||\ + echo "$msgprefix:Warning: cannot set group name \`$opt_g' (would require root privileges)" + fi + if [ ".$opt_t" = .yes ]; then + echo "(cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) | cat $compress >$tmpfile.out" 1>&2 + fi + (cd $tmpdir && $prg_find $tarname -type f -depth -print | sort | xargs $prg_tar cf -) |\ + eval cat $compress >$tmpfile.out + if [ ".$opt_t" = .yes ]; then + echo "cp $tmpfile.out $tarfile" 1>&2 + fi + cp $tmpfile.out $tarfile + if [ ".$opt_t" = .yes ]; then + echo "rm -rf $tmpdir/$tarname" 1>&2 + fi + rm -rf $tmpdir/$tarname + fi + + # cleanup + if [ ".$opt_t" = .yes ]; then + echo "rm -f $tmpfile.lst $tmpfile.out" 1>&2 + fi + rm -f $tmpfile.lst $tmpfile.out + + shtool_exit 0 + ;; + +subst ) + ## + ## subst -- Apply sed(1) substitution operations + ## Copyright (c) 2001-2004 Ralf S. Engelschall + ## + + # remember optional list of file(s) + files="$*" + files_num="$#" + + # parameter consistency check + if [ $# -eq 0 ] && [ ".$opt_b" != . ]; then + echo "$msgprefix:Error: option -b cannot be applied to stdin" 1>&2 + shtool_exit 1 + fi + if [ $# -eq 0 ] && [ ".$opt_s" = .yes ]; then + echo "$msgprefix:Error: option -s cannot be applied to stdin" 1>&2 + shtool_exit 1 + fi + + # build underlying sed(1) command + sedcmd='sed' + if [ ".$opt_e" != . ]; then + OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" + for e + do + sedcmd="$sedcmd -e '$e'" + done + elif [ ".$opt_f" != . ]; then + if [ ! -f $opt_f ]; then + echo "$msgprefix:Error: command file \`$opt_f' not found or not a regular file" 1>&2 + shtool_exit 1 + fi + sedcmd="$sedcmd -f '$opt_f'" + else + echo "$msgprefix:Error: either -e option(s) or -f option required" 1>&2 + shtool_exit 1 + fi + + # determine extension for original file + orig=".orig" + if [ ".$opt_b" != . ]; then + orig="$opt_b" + fi + + # apply sed(1) operation(s) + if [ ".$files" != . ]; then + # apply operation(s) to files + substdone=no + for file in $files; do + test ".$file" = . && continue + if [ ! -f $file ]; then + echo "$msgprefix:Warning: file \`$file' not found or not a regular file" 1>&2 + continue + fi + + # handle interactive mode + if [ ".$opt_i" = .yes ]; then + eval "$sedcmd <$file >$file.new" + skip=no + if cmp $file $file.new >/dev/null 2>&1; then + rm -f $file.new + skip=yes + else + (diff -U1 $file $file.new >$tmpfile) 2>/dev/null + if [ ".`cat $tmpfile`" = . ]; then + (diff -C1 $file $file.new >$tmpfile) 2>/dev/null + if [ ".`cat $tmpfile`" = . ]; then + echo "$msgprefix:Warning: unable to show difference for file \`$file'" 1>&2 + cp /dev/null $tmpfile + fi + fi + rm -f $file.new + cat $tmpfile + echo dummy | awk '{ printf("%s", TEXT); }' TEXT=">>> Apply [Y/n]: " + read input + if [ ".$input" != .Y ] &&\ + [ ".$input" != .y ] &&\ + [ ".$input" != . ]; then + skip=yes + fi + fi + if [ ".$skip" = .yes ]; then + if [ ".$opt_v" = .yes ]; then + echo "file \`$file' -- skipped" 1>&2 + fi + continue + fi + fi + + # apply sed(1) operation(s) + if [ ".$opt_v" = .yes ]; then + echo "patching \`$file'" 1>&2 + fi + if [ ".$opt_t" = .yes ]; then + echo "\$ cp -p $file $file$orig" + echo "\$ chmod u+w $file" + echo "\$ $sedcmd <$file$orig >$file" + fi + if [ ".$opt_n" = .no ]; then + cp -p $file $file$orig + chmod u+w $file >/dev/null 2>&1 || true + eval "$sedcmd <$file$orig >$file" + fi + + # optionally fix timestamp + if [ ".$opt_s" = .yes ]; then + if [ ".$opt_t" = .yes ]; then + echo "\$ touch -r $file$orig $file" + fi + if [ ".$opt_n" = .no ]; then + touch -r $file$orig $file + fi + fi + + # optionally check whether any content change actually occurred + if [ ".$opt_q" = .no ]; then + if cmp $file$orig $file >/dev/null 2>&1; then + if [ ".$opt_w" = .yes ]; then + echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 + fi + else + substdone=yes + fi + fi + + # optionally remove preserved original file + if [ ".$opt_b" = . ]; then + if [ ".$opt_t" = .yes ]; then + echo "\$ rm -f $file$orig" + fi + if [ ".$opt_n" = .no ]; then + rm -f $file$orig + fi + fi + done + if [ ".$opt_q" = .no ] && [ ".$opt_w" = .no ]; then + if [ ".$substdone" = .no ]; then + if [ ".$files_num" = .1 ]; then + echo "$msgprefix:Warning: substitution resulted in no content change on file \"$file\"" 1>&2 + else + echo "$msgprefix:Warning: substitution resulted in no content change on any file" 1>&2 + fi + fi + fi + else + # apply operation(s) to stdin/stdout + if [ ".$opt_v" = .yes ]; then + echo "patching " 1>&2 + fi + if [ ".$opt_t" = .yes ]; then + echo "\$ $sedcmd" + fi + if [ ".$opt_n" = .no ]; then + eval "$sedcmd" + fi + fi + + shtool_exit 0 + ;; + +platform ) + ## + ## platform -- Platform Identification Utility + ## Copyright (c) 2003-2004 Ralf S. Engelschall + ## + + # option post-processing + if [ ".$opt_t" != . ]; then + case "$opt_t" in + binary ) + # binary package id (OpenPKG RPM) + opt_F="%-%" + opt_L=yes + opt_S="" + opt_C="+" + ;; + build ) + # build time checking (OpenPKG RPM) + opt_F="%-%" + opt_L=yes + opt_S="" + opt_C="+" + ;; + gnu ) + # GNU config.guess style -- + opt_F="%-unknown-%" + opt_L=yes + opt_S="" + opt_C="+" + ;; + web ) + # non-whitespace HTTP Server-header id + opt_F="%-%" + opt_S="/" + opt_C="+" + ;; + summary) + # human readable verbose summary information + opt_F="Class: %[sc] (%[ac])\\nProduct: %[sp] (%[ap])\\nTechnology: %[st] (%[at])" + opt_S=" " + opt_C="/" + ;; + all-in-one ) + # full-table all-in-one information + opt_F="" + opt_F="${opt_F}concise architecture class: %\\n" + opt_F="${opt_F}regular architecture class: %{ac}\\n" + opt_F="${opt_F}verbose architecture class: %[ac]\\n" + opt_F="${opt_F}concise architecture product: %\\n" + opt_F="${opt_F}regular architecture product: %{ap}\\n" + opt_F="${opt_F}verbose architecture product: %[ap]\\n" + opt_F="${opt_F}concise architecture technology: %\\n" + opt_F="${opt_F}regular architecture technology: %{at}\\n" + opt_F="${opt_F}verbose architecture technology: %[at]\\n" + opt_F="${opt_F}concise system class: %\\n" + opt_F="${opt_F}regular system class: %{sc}\\n" + opt_F="${opt_F}verbose system class: %[sc]\\n" + opt_F="${opt_F}concise system product: %\\n" + opt_F="${opt_F}regular system product: %{sp}\\n" + opt_F="${opt_F}verbose system product: %[sp]\\n" + opt_F="${opt_F}concise system technology: %\\n" + opt_F="${opt_F}regular system technology: %{st}\\n" + opt_F="${opt_F}verbose system technology: %[st]" + ;; + * ) + echo "$msgprefix:Error: invalid type \`$opt_t'" 1>&2 + exit 1 + ;; + esac + fi + + # assemble initial platform information + UNAME_MACHINE=`(uname -m) 2>/dev/null` ||\ + UNAME_MACHINE=`(uname -p) 2>/dev/null` ||\ + UNAME_MACHINE='unknown' + UNAME_SYSTEM=`(uname -s) 2>/dev/null` ||\ + UNAME_SYSTEM='unknown' + UNAME_RELEASE=`(uname -r) 2>/dev/null` ||\ + UNAME_RELEASE=`(uname -v) 2>/dev/null` ||\ + UNAME_RELEASE='unknown' + + UNAME="${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}" + + AC=""; AP=""; AT="" + SC=""; SP=""; ST="" + + # dispatch into platform specific sections + case "${UNAME}" in + + # FreeBSD + *:FreeBSD:* ) + # determine architecture + AC="${UNAME_MACHINE}" + case "${AC}" in + i386 ) AC="iX86" ;; + esac + AP="${AC}" + AT=`(/sbin/sysctl -n hw.model) 2>&1` + case "${AT}" in + *"Xeon"* | *"Pentium Pro"* | *"Cyrix 6x86MX"* | *"Pentium II"* | *"Pentium III"* | *"Pentium 4"* | *"Celeron"* ) AT="i686" ;; + *"Pentium"* ) AT="i586" ;; *"i486[SD]X"* | *"Cyrix 486"* | *"Cyrix [56]x86"* | *"Blue Lightning" | *"Cyrix 486S/DX" ) AT="i486" ;; + *"i386[SD]X"* | *"NexGen 586"* ) AT="i386" ;; + * ) AT="${AP}" ;; + esac + # determine system + r=`echo "${UNAME_RELEASE}" |\ + sed -e 's;[()];;' -e 's/\(-.*\)$/[\1]/'` + ST="FreeBSD ${r}" + SP="${ST}" + case "${r}" in + 1.* ) SC="4.3BSD" ;; + * ) SC="4.4BSD" ;; + esac + ;; + + # NetBSD + *:NetBSD:* ) + # determine architecture + AT="${UNAME_MACHINE}" + AP="${AT}" + case "${AP}" in + i[3-6]86 ) AP="iX86" ;; + esac + AC="${AP}" + # determine system + r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'` + ST="NetBSD ${r}" + SP="${ST}" + case "${r}" in + 0.* ) SC="4.3BSD" ;; + * ) SC="4.4BSD" ;; + esac + ;; + + # OpenBSD + *:OpenBSD:* ) + # determine architecture + AT="${UNAME_MACHINE}" + AP="${AT}" + case "${AP}" in + i[3-6]86 ) AP="iX86" ;; + esac + AC="${AP}" + # determine system + r=`echo "${UNAME_RELEASE}" | sed -e 's/\([-_].*\)$/[\1]/'` + ST="OpenBSD ${r}" + SP="${ST}" + SC="4.4BSD" + ;; + + # GNU/Linux + *:Linux:* ) + # determine architecture + AT="${UNAME_MACHINE}" + case "${AT}" in + ia64 ) AT="IA64" ;; + x86_64 ) AT='AMD64' ;; + parisc ) AT="HPPA32" ;; + parisc64 ) AT="HPPA64" ;; + esac + AP="${AT}" + case "${AP}" in + i[3-6]86 ) AP='iX86' ;; + esac + AC="${AP}" + # determine system + v_kern=`echo "${UNAME_RELEASE}" |\ + sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'` + v_libc=`(strings /lib/libc.so.* | grep '^GLIBC_' | sed -e 's/^GLIBC_//' |\ + sort -n | sed -n -e '$p' | sed -e 's/^\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/') 2>/dev/null` + ST="GNU/${v_libc}/<${v_kern}>" + if [ -f /etc/lsb-release ]; then + eval `( . /etc/lsb-release + echo "SC=\"LSB${LSB_VERSION}\"" + if [ ".${DISTRIB_ID}" != . -a ".${DISTRIB_RELEASE}" != . ]; then + echo "SP=\"${DISTRIB_ID} ${DISTRIB_RELEASE}\"" + fi + ) 2>/dev/null` + fi + if [ ".$SP" = . ]; then + for tagfile in x \ + `cd /etc && \ + /bin/ls *[_-]release *[_-]version 2>/dev/null | \ + sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \ + echo redhat-release lsb-release` + do + [ ".${tagfile}" = .x ] && continue + [ ! -f "/etc/${tagfile}" ] && continue + n=`echo ${tagfile} | sed -e 's/[_-]release$//' -e 's/[_-]version$//'` + v=`(grep VERSION /etc/${tagfile}; cat /etc/${tagfile}) | grep '[0-9]' | sed -e 'q' |\ + sed -e 's/^/#/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ + -e 's/^#.*$//'` + case "`util_lower ${n}`" in + redhat ) + if [ ".`grep 'Red Hat Enterprise Linux' /etc/${tagfile}`" != . ]; then + n="ed at nterprise inux" + else + n="ed at inux" + fi + ;; + debian ) n="Debian[ GNU/Linux]" ;; + fedora ) n=" Core[ GNU/Linux]" ;; + suse ) n="SuSE[ Linux]" ;; + mandrake ) n="Mandrake[ Linux]" ;; + gentoo ) n="Gentoo[ GNU/Linux]" ;; + slackware ) n="Slackware[ Linux]" ;; + turbolinux ) n="TurboLinux" ;; + unitedlinux ) n="UnitedLinux" ;; + * ) n="${n}[ GNU/Linux]" ;; + esac + case "$n" in + *"<"*">"* ) SP="$n <$v>" ;; + * ) SP="$n $v" ;; + esac + break + done + fi + [ ".$SP" = . ] && SP="${ST}" + [ ".$SC" = . ] && SC="LSB" + ;; + + # Sun Solaris + *:SunOS:* ) + # determine architecture + AT="${UNAME_MACHINE}" + case "${AT}" in + i86pc ) AT="iX86" ;; + esac + AP="${AT}" + case "${AP}" in + sun4[cdm] ) AP="SPARC32" ;; + sun4u ) AP="SPARC64" ;; + sun4* ) AP="SPARC" ;; + esac + AC="${AP}" + case "${AC}" in + SPARC* ) AC="SPARC" ;; + esac + # determine system + ST="[Sun ]SunOS ${UNAME_RELEASE}" + v=`echo "${UNAME_RELEASE}" |\ + sed -e 's;^4\.;1.;' \ + -e 's;^5\.\([0-6]\)[^0-9]*$;2.\1;' \ + -e 's;^5\.\([0-9][0-9]*\).*;\1;'` + SP="[Sun ]Solaris $v" + case "${UNAME_RELEASE}" in + 4.* ) SC="4.3BSD" ;; + 5.* ) SC="SVR4" ;; + esac + ;; + + # SCO UnixWare + *:UnixWare:* ) + # determine architecture + AT="${UNAME_MACHINE}" + case "${AT}" in + i[3-6]86 | ix86at ) AT="iX86" ;; + esac + AP="${AT}" + # determine system + v=`/sbin/uname -v` + ST="[SCO ]UnixWare ${v}" + SP="${ST}" + SC="SVR${UNAME_RELEASE}" + ;; + + # QNX + *:QNX:* ) + # determine architecture + AT="${UNAME_MACHINE}" + case "${AT}" in + x86pc ) AT="iX86" ;; + esac + AP="${AT}" + # determine system + v="${UNAME_RELEASE}" + ST="QNX[ Neutrino RTOS] ${v}" + v=`echo "${v}" | sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\).*$;\1;'` + SP="QNX[ Neutrino RTOS] ${v}" + SC="QNX" + ;; + + # SGI IRIX + *:IRIX*:* ) + # determine architecture + AT="${UNAME_MACHINE}" + AP="${AT}" + case "${AP}:${UNAME_SYSTEM}" in + IP*:IRIX64 ) AP="MIPS64" ;; + IP*:* ) AP="MIPS" ;; + esac + AC="${AP}" + # determine system + v=`(/bin/uname -R || /bin/uname -r) 2>/dev/null | sed -e 's;[0-9.]* ;;'` + ST="[SGI ]IRIX ${v}" + v="${UNAME_RELEASE}" + SP="[SGI ]IRIX ${v}" + SC="4.2BSD/SVR3" + ;; + + # HP HP-UX + *:HP-UX:* ) + # determine architecture + AT="${UNAME_MACHINE}" + case "${AT}" in + ia64 ) AT="IA64" ;; + 9000/[34]?? ) AT=M68K ;; + 9000/[678][0-9][0-9]) + 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 ) AT="HPPA1.0" ;; + 528 ) AT="HPPA1.1" ;; + 532 ) AT="HPPA2.0" + case "${sc_kernel_bits}" in + 32 ) AT="${AT}n" ;; + 64 ) AT="${AT}w" ;; + esac + ;; + esac + ;; + esac + AP="${AT}" + case "${AP}" in + HPPA* ) AP="HPPA" ;; + esac + AC="${AP}" + # determine system + v=`echo "${UNAME_RELEASE}" | sed -e 's;^[^0-9]*;;'` + ST="[HP ]-" + SP="${ST}" + case "${v}" in + 10.* ) SC="SVR4.2" ;; + [7-9]* ) SC="SVR4" ;; + esac + ;; + + # HP Tru64 (OSF1) + *:OSF1:* ) + # determine architecture + AP="${UNAME_MACHINE}" + case "${AP}" in + alpha ) AP="Alpha" ;; + esac + alpha_type=`(/usr/sbin/psrinfo -v) 2>/dev/null |\ + sed -n -e 's/^.*The alpha \([^ ][^ ]*\).*processor.*$/\1/p' | sed -e 'q'` + AT="${AP}${alpha_type}" + AC="${AP}" + # determine system + v=`echo "${UNAME_RELEASE}" | sed -e 's;^[VTX];;'` + ST="[HP ]Tru64 ${v}" + SP="${ST}" + SC="OSF1" + ;; + + # IBM AIX + *:AIX:* ) + cpu_arch=rs6000 + if [ -x /usr/sbin/lsdev -a -x /usr/sbin/lsattr ]; then + cpu_id=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if [ ".`/usr/sbin/lsattr -El ${cpu_id} | grep -i powerpc`" != . ]; then + cpu_arch=powerpc + fi + fi + if [ -x /usr/bin/oslevel ]; then + os_level=`/usr/bin/oslevel` + else + os_level="`uname -r`.`uname -v`" + fi + os_level=`echo "${os_level}" |\ + sed -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(\.[0-9][0-9]*\)\(.*\)$;<\1>\2[\3];' \ + -e 's;^\([0-9][0-9]*\.[0-9][0-9]*\)\(.*\)$;<\1>\2;'` + AT="${cpu_arch}" + AP="${AT}" + AC="${AP}" + ST="[IBM ]AIX ${os_level}" + SP="${ST}" + case "${os_level}" in + [12]* ) SC="SVR2" ;; + * ) SC="SVR4" ;; + esac + ;; + + # Apple MacOS X Darwin + *:Darwin:* ) + AT=`uname -p` + case "${AT}" in + powerpc ) AT="PPC" ;; + esac + AP="${AT}" + AC="${AP}" + case "${AC}" in + i?86 ) AC="iX86" ;; + esac + ST="[Apple ]${UNAME_SYSTEM} ${UNAME_RELEASE}" + SP="${ST}" + SC="4.4BSD/Mach3" + ;; + + # TODO ...ADD YOUR NEW PLATFORM CHECK HERE... TODO + # *:XXX:* ) + # ... + # ;; + + # ...A STILL UNKNOWN PLATFORM... + * ) + AT=`echo "${UNAME_MACHINE}" | sed -e "s; ;${opt_C};g"` + AP="${AT}" + AC="${AP}" + v=`echo "${UNAME_RELEASE}" |\ + sed -e 's/^/#/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' \ + -e 's/^#[^0-9]*\([0-9][0-9]*\).*$/\1/' \ + -e 's/^#.*$/?/'` + ST="${UNAME_SYSTEM} ${v}" + SP="${ST}" + SC="${SP}" + ;; + + esac + + # provide fallback values + [ ".$AT" = . ] && AT="${AP:-${AC}}" + [ ".$AP" = . ] && AP="${AT:-${AC}}" + [ ".$AC" = . ] && AC="${AP:-${AT}}" + [ ".$ST" = . ] && ST="${SP:-${SC}}" + [ ".$SP" = . ] && SP="${ST:-${SC}}" + [ ".$SC" = . ] && SC="${SP:-${ST}}" + + # support explicit enforced verbose/concise output + if [ ".$opt_v" = .yes ]; then + opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%[\1]/g'` + elif [ ".$opt_c" = .yes ]; then + opt_F=`echo ":$opt_F" | sed -e 's/^://' -e 's/%\([as][cpt]\)/%<\1>/g'` + fi + + # provide verbose and concise variants + AC_V=""; AC_N=""; AC_C="" + AP_V=""; AP_N=""; AP_C="" + AT_V=""; AT_N=""; AT_C="" + SC_V=""; SC_N=""; SC_C="" + SP_V=""; SP_N=""; SP_C="" + ST_V=""; ST_N=""; ST_C="" + for var_lc in at ap ac st sp sc; do + case "$opt_F" in + *"%[${val_lc}]"* | *"%{${val_lc}}"* | *"%${val_lc}"* | *"%<${val_lc}>"* ) + var_uc=`util_upper "$var_lc"` + eval "val=\"\$${var_uc}\"" + val_V=""; val_N=""; val_C="" + case "$opt_F" in + *"%[${var_lc}]"* ) + val_V=`echo ":$val" | \ + sed -e 's/^://' \ + -e 's;\[\([^]]*\)\];\1;g' \ + -e 's;<\([^>]*\)>;\1;g' \ + -e "s; ;§§;g" \ + -e "s;/;%%;g" \ + -e "s;§§;${opt_S};g" \ + -e "s;%%;${opt_C};g"` + eval "${var_uc}_V=\"\${val_V}\"" + ;; + esac + case "$opt_F" in + *"%{${var_lc}}"* | *"%${var_lc}"* ) + val_N=`echo ":$val" | \ + sed -e 's/^://' \ + -e 's;\[\([^]]*\)\];;g' \ + -e 's;<\([^>]*\)>;\1;g' \ + -e "s; ;§§;g" \ + -e "s;/;%%;g" \ + -e "s;§§;${opt_S};g" \ + -e "s;%%;${opt_C};g"` + eval "${var_uc}_N=\"\${val_N}\"" + ;; + esac + case "$opt_F" in + *"%<${var_lc}>"* ) + val_C=`echo ":$val" | \ + sed -e 's/^://' \ + -e 's;\[\([^]]*\)\];;g' \ + -e 's;[^<]*<\([^>]*\)>[^<]*;\1;g' \ + -e "s; ;§§;g" \ + -e "s;/;%%;g" \ + -e "s;§§;${opt_S};g" \ + -e "s;%%;${opt_C};g"` + eval "${var_uc}_C=\"\${val_C}\"" + ;; + esac + ;; + esac + done + + # create output string + output=`echo ":$opt_F" |\ + sed -e "s/^://" \ + -e "s;%\\[ac\\];${AC_V};g" \ + -e "s;%{ac};${AC_N};g" \ + -e "s;%ac;${AC_N};g" \ + -e "s;%;${AC_C};g" \ + -e "s;%\\[ap\\];${AP_V};g" \ + -e "s;%{ap};${AP_N};g" \ + -e "s;%ap;${AP_N};g" \ + -e "s;%;${AP_C};g" \ + -e "s;%\\[at\\];${AT_V};g" \ + -e "s;%{at};${AT_N};g" \ + -e "s;%at;${AT_N};g" \ + -e "s;%;${AT_C};g" \ + -e "s;%\\[sc\\];${SC_V};g" \ + -e "s;%{sc};${SC_N};g" \ + -e "s;%sc;${SC_N};g" \ + -e "s;%;${SC_C};g" \ + -e "s;%\\[sp\\];${SP_V};g" \ + -e "s;%{sp};${SP_N};g" \ + -e "s;%sp;${SP_N};g" \ + -e "s;%;${SP_C};g" \ + -e "s;%\\[st\\];${ST_V};g" \ + -e "s;%{st};${ST_N};g" \ + -e "s;%st;${ST_N};g" \ + -e "s;%;${ST_C};g" \ + -e 's/\\\\n/^/g' |\ + tr '^' '\012'` + + # support lower/upper-case mapping + if [ ".$opt_L" = .yes ]; then + output=`util_lower "$output"` + elif [ ".$opt_U" = .yes ]; then + output=`util_upper "$output"` + fi + + # display output string + if [ ".$opt_n" = .yes ]; then + echo . | awk '{ printf("%s", output); }' output="$output" + else + echo "$output" + fi + + shtool_exit 0 + ;; + +arx ) + ## + ## arx -- Extended archive command + ## Copyright (c) 1999-2004 Ralf S. Engelschall + ## + + ar_prg="$opt_C" + ar_cmd="$1"; shift + archive="$1"; shift + files="$*" + + # walk through the file list and expand archives members + tmpdir=`echo $archive | sed -e 's;[^/]*$;.arx;'` + nfiles='' + if [ ".$files" != . ]; then + for file in $files; do + if [ ! -f $file ]; then + echo "$msgprefix:Error: input file not found: $file" 1>&2 + shtool_exit 1 + fi + case $file in + *.a ) + if [ ! -d $tmpdir ]; then + if [ ".$opt_t" = .yes ]; then + echo "mkdir $tmpdir" 1>&2 + fi + mkdir $tmpdir + fi + case $tmpdir in + .arx ) + from="../$file" + ;; + * ) + dir=`echo $file | sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' -e 's;^$;.;'` + base=`echo $file | sed -e 's;.*/\([^/]*\)$;\1;'` + from="`cd $dir; pwd`/$base" + ;; + esac + if [ ".$opt_t" = .yes ]; then + echo "(cd $tmpdir && $ar_prg x $from)" 1>&2 + fi + (cd $tmpdir && eval $ar_prg x $from) + if [ $? -ne 0 ]; then + echo "$msgprefix:Error: member extraction failed for archive: $file" 1>&2 + shtool_exit 1 + fi + for member in - `eval $ar_prg t $file | sed -e '/_\.SYMDEF/d'`; do + [ ".$member" = .- ] && continue + nfiles="$nfiles $tmpdir/$member" + done + ;; + * ) + nfiles="$nfiles $file" + ;; + esac + done + fi + + # run the final archive command + if [ ".$opt_t" = .yes ]; then + echo "$ar_prg $ar_cmd $archive $nfiles" 1>&2 + fi + eval $ar_prg $ar_cmd $archive $nfiles + if [ $? -ne 0 ]; then + echo "$msgprefix:Error: archive command failed" 1>&2 + shtool_exit $? + fi + + # cleanup and die gracefully + if [ -d $tmpdir ]; then + if [ ".$opt_t" = .yes ]; then + echo "rm -rf $tmpdir" 1>&2 + fi + rm -rf $tmpdir + fi + + shtool_exit 0 + ;; + +slo ) + ## + ## slo -- Separate linker options by library class + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + DIFS="$IFS" + + # parse out -L and -l options from command line + DIRS='' + LIBS='' + ARGV='' + optprev='' + for opt + do + # concatenate with previous option if exists + if [ ".$optprev" != . ]; then + opt="${optprev}${opt}"; + optprev='' + fi + # remember options for arg if used stand-alone + if [ ".$opt" = ".-L" ] || [ ".$opt" = ".-l" ]; then + optprev="$opt" + continue; + fi + # split argument into option plus option argument + arg="`echo $opt | cut -c3-`" + opt="`echo $opt | cut -c1-2`" + # store into containers + case $opt in + -L) DIRS="$DIRS:$arg" ;; + -l) LIBS="$LIBS:$arg" ;; + *) ARGV="$ARGV $opt" ;; + esac + done + + # set linker default directories + DIRS_DEFAULT='/lib:/usr/lib' + if [ ".$LD_LIBRARY_PATH" != . ]; then + DIRS_DEFAULT="$DIRS_DEFAULT:$LD_LIBRARY_PATH" + fi + + # sort options by class + DIRS_OBJ='' + LIBS_OBJ='' + DIRS_PIC='' + LIBS_PIC='' + DIRS_DSO='' + LIBS_DSO='' + + # for each library... + OIFS="$IFS"; IFS=':' + for lib in $LIBS; do + [ ".$lib" = . ] && continue + + found='no' + found_indefdir='no' + found_type='' + found_dir='' + + # for each directory... + OIFS2="$IFS"; IFS=":$DIFS" + for dir in ${DIRS} switch-to-defdirs ${DIRS_DEFAULT}; do + [ ".$dir" = . ] && continue + [ ".$dir" = .switch-to-defdirs ] && found_indefdir=yes + [ ! -d $dir ] && continue + + # search the file + OIFS3="$IFS"; IFS="$DIFS" + for file in '' `cd $dir && env -i /bin/ls lib${lib}.* 2>/dev/null`; do + [ ".$file" = . ] && continue + case $file in + *.so|*.so.[0-9]*|*.sl|*.sl.[0-9]* ) + found=yes; + found_type=DSO; + break + ;; + *.lo|*.la ) + found=yes; + found_type=PIC + ;; + *.a ) + if [ ".$found_type" = . ]; then + found=yes + found_type=OBJ + fi + ;; + esac + done + IFS="$OIFS3" + if [ ".$found" = .yes ]; then + found_dir="$dir" + break + fi + done + IFS="$OIFS2" + + if [ ".$found" = .yes ]; then + if [ ".$found_indefdir" != .yes ]; then + eval "dirlist=\"\${DIRS_${found_type}}:\"" + case "$dirlist" in + *:$found_dir:* ) ;; + * ) eval "DIRS_${found_type}=\"\$DIRS_${found_type}:${found_dir}\"" ;; + esac + eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" + else + eval "LIBS_${found_type}=\"\$LIBS_${found_type}:$lib\"" + fi + else + LIBS_OBJ="$LIBS_OBJ:$lib" + #dirlist="`echo $DIRS $DIRS_DEFAULT | sed -e 's/:/ /g'`" + #echo "slo:Warning: library \"$lib\" not found in any of the following dirs:" 2>&1 + #echo "slo:Warning: $dirlist" 1>&1 + fi + done + IFS="$OIFS" + + # also pass-through unused dirs even if it's useless + OIFS="$IFS"; IFS=':' + for dir in $DIRS; do + dirlist="${DIRS_OBJ}:${DIRS_PIC}:${DIRS_DSO}:" + case "$dirlist" in + *:$dir:* ) ;; + * ) DIRS_OBJ="$DIRS_OBJ:$dir" ;; + esac + done + IFS="$OIFS" + + # reassemble the options but separated by type + for type in OBJ PIC DSO; do + OIFS="$IFS"; IFS=':' + eval "libs=\"\$LIBS_${type}\"" + opts='' + for lib in $libs; do + [ ".$lib" = . ] && continue + opts="$opts -l$lib" + done + eval "LIBS_${type}=\"$opts\"" + + eval "dirs=\"\$DIRS_${type}\"" + opts='' + for dir in $dirs; do + [ ".$dir" = . ] && continue + opts="$opts -L$dir" + done + eval "DIRS_${type}=\"$opts\"" + IFS="$OIFS" + done + + # give back results + for var in ARGV DIRS_OBJ LIBS_OBJ DIRS_PIC LIBS_PIC DIRS_DSO LIBS_DSO; do + eval "val=\"\$${var}\"" + val="`echo $val | sed -e 's/^ *//'`" + echo "${opt_p}${var}=\"${val}\"" + done + + shtool_exit 0 + ;; + +scpp ) + ## + ## scpp -- Sharing C Pre-Processor + ## Copyright (c) 1999-2004 Ralf S. Engelschall + ## + + srcs="$*" + output="${opt_o}.n" + + # find a reasonable Awk + awk='' + paths=`echo $PATH |\ + sed -e 's%/*:%:%g' -e 's%/$%%' \ + -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ + -e 's/:/ /g'` + for name in gawk nawk awk; do + for path in $paths; do + if [ -r "$path/$name" ]; then + awk="$path/$name" + break + fi + done + if [ ".$awk" != . ]; then + break + fi + done + if [ ".$awk" = . ]; then + echo "$msgprefix:Error: cannot find a reasonable Awk" 1>&2 + shtool_exit 1 + fi + + # parse source file(s) + if [ ".$opt_v" = .yes ]; then + echo "Parsing:" | $awk '{ printf("%s", $0); }' 1>&2 + fi + for src in $srcs; do + if [ ".$opt_v" = .yes ]; then + echo $src | $awk '{ printf(" %s", $0); }' 1>&2 + fi + if [ ".$opt_f" != . ]; then + inputcmd="sed" + OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_f; IFS="$OIFS" + for e + do + inputcmd="$inputcmd -e '$e'" + done + inputcmd="$inputcmd '$src'" + else + inputcmd="cat '$src'" + fi + eval $inputcmd |\ + $awk ' + BEGIN { + ln = 0; + fln = 0; + level = 0; + mode = ""; + store = ""; + } + { + ln++; + } + /^#if.*/ { + level++; + } + /^#if [a-zA-Z_][a-zA-Z0-9_]* *$/ { + if ($2 == define) { + mode = "D"; + printf("D:#line %d \"%s\"\n", ln, src); + next; + } + } + /^#endif.*/ { + level--; + if (mode == "D" && level == 0) { + mode = ""; + next; + } + } + /^[a-zA-Z_][a-zA-Z0-9_].*;.*/ { + if ($1 == class) { + printf("V:#line %d \"%s\"\n", ln, src); + printf("V:%s\n", $0); + printf("J:%s\n", $0); + next; + } + } + /^[a-zA-Z_][a-zA-Z0-9_].*=.*/ { + if ($1 == class) { + printf("V:#line %d \"%s\"\n", ln, src); + printf("V:%s\n", $0); + printf("J:%s\n", $0); + next; + } + } + /^[a-zA-Z_][a-zA-Z0-9_]*/ { + if ($1 == class) { + fln = ln; + store = $0; + mode = "F"; + next; + } + } + /^\{ *$/ { + if (mode == "F") { + printf("F:#line %d \"%s\"\n", fln, src); + printf("F:%s;\n", store); + printf("I:%s;\n", store); + store = ""; + mode = ""; + next; + } + } + { + if (mode == "D") + printf("D:%s\n", $0); + else if (mode == "F") + store = store " " $0; + } + ' "src=$src" "define=$opt_D" "class=$opt_C" >>$tmpfile + done + if [ ".$opt_v" = .yes ]; then + echo "" 1>&2 + fi + + # start generating output header + echo "/* $opt_o -- autogenerated from $opt_t, DO NOT EDIT! */" >$output + echo "#line 1 \"$opt_t\"" >>$output + sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd' |\ + sed -e "/^${opt_M} *\$/d" >>$output + + # merge in the define blocks + grep '^D:' $tmpfile | sed -e 's/^D://' >>$output + + # generate standard prolog + echo "#line 1 \"_ON_THE_FLY_\"" >>$output + echo "" >>$output + echo "/* make sure the scpp source extensions are skipped */" >>$output + echo "#define $opt_D 0" >>$output + echo "#define $opt_C /**/" >>$output + + # generate namespace hiding for variables + echo "" >>$output + echo "/* move intern variables to hidden namespace */" >>$output + grep '^J:' $tmpfile | sed >>$output \ + -e 's/^J://' \ + -e 's/ */ /g' \ + -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\];.*$/#define \1 __\1/' \ + -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\)\[\] =.*$/#define \1 __\1/' \ + -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\);.*$/#define \1 __\1/' \ + -e 's/^[^=;]*[ *]\([a-zA-Z0-9_]*\) =.*$/#define \1 __\1/' + + # generate namespace hiding for functions + echo "" >>$output + echo "/* move intern functions to hidden namespace */" >>$output + grep '^I:' $tmpfile | sed >>$output \ + -e 's/^I://' \ + -e 's/\([ (]\) */\1/g' \ + -e 's/ *\([),]\)/\1/g' \ + -e 's/^[^(]*[ *]\([a-zA-Z0-9_]*\)(.*$/#define \1 __\1/' + + # generate prototypes for variables + echo "" >>$output + echo "/* prototypes for intern variables */" >>$output + grep '^V:' $tmpfile | sed >>$output \ + -e 's/^V://' \ + -e 's/ */ /g' \ + -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\);.*$/\1;/' \ + -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\[\]\) =.*$/\1;/' \ + -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\);.*$/\1;/' \ + -e 's/^\([^=;]*[ *][a-zA-Z0-9_]*\) =.*$/\1;/' \ + -e 's/ ;/;/g' \ + -e "s/^$opt_C /extern /" + + # generate prototypes for functions + echo "" >>$output + echo "/* prototypes for intern functions */" >>$output + grep '^F:' $tmpfile | sed >>$output \ + -e 's/^F://' \ + -e 's/\([ (]\) */\1/g' \ + -e 's/ *\([),]\)/\1/g' \ + -e 's/\([* ]\)[a-zA-Z0-9_]*,/\1,/g' \ + -e 's/\([* ]\)[a-zA-Z0-9_]*);/\1);/g' \ + -e 's/(\*[a-zA-Z0-9_]*)(/(*)(/g' \ + -e 's/\([ (]\) */\1/g' \ + -e 's/ *\([),]\)/\1/g' \ + -e "s/^$opt_C /extern /" + + # finish generating output header + n=`(echo ''; sed <$opt_t -e "1,/^${opt_M} *\$/p" -e 'd') |\ + wc -l | sed -e 's;^ *\([0-9]*\) *$;\1;'` + echo "#line $n \"$opt_t\"" >>$output + sed <$opt_t -e "/^${opt_M} *\$/,\$p" -e 'd' |\ + sed -e "/^${opt_M} *\$/d" >>$output + + # create final output file + if [ -f $opt_o ]; then + if [ ".$opt_p" = .yes ]; then + grep -v '^#line' $opt_o >$tmpfile.o + grep -v '^#line' $output >$tmpfile.n + out_old="$tmpfile.o" + out_new="$tmpfile.n" + else + out_old="$opt_o" + out_new="$output" + fi + if cmp -s $out_old $out_new; then + : + else + cp $output $opt_o + fi + else + cp $output $opt_o + fi + rm -f $output + rm -f $tmpfile $tmpfile.* >/dev/null 2>&1 + + shtool_exit 0 + ;; + +version ) + ## + ## version -- Maintain a version information file + ## Copyright (c) 1994-2004 Ralf S. Engelschall + ## + + file="$1" + + # determine prefix and name + name="$opt_n" + prefix="$opt_p" + + # determine current version + triple="$opt_s" + if [ ".$triple" != . ]; then + # use given triple + if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then + echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2 + shtool_exit 1 + fi + eval `echo $triple |\ + sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\ + ver="\1";rev="\2";typ="\3";lev="\4"%'` + tim=calc + elif [ -r $file ]; then + # determine triple from given file + eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\ + sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\ + ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%' -e 'q'` + else + # intialise to first version + ver=0 + rev=1 + typ=. + lev=0 + tim=calc + fi + + # determine new version in batch + if [ ".$opt_i" != . ]; then + case $opt_i in + v ) ver=`expr $ver + 1` + rev=0 + lev=0 + ;; + r ) rev=`expr $rev + 1` + lev=0 + ;; + l ) lev=`expr $lev + 1` + ;; + * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2 + shtool_exit 1 + ;; + esac + tim=calc + fi + + # determine new version interactively + if [ ".$opt_e" = .yes ]; then + echo "old version: ${ver}.${rev}${typ}${lev}" + while [ 1 ]; do + echo dummy | awk '{ printf("new version: "); }' + read triple + case $triple in + [0-9]*.[0-9]*[sabp.][0-9]* ) + ;; + * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2 + continue + ;; + esac + break + done + eval `echo $triple |\ + sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\ + ver="\1";rev="\2";typ="\3";lev="\4"%'` + tim=calc + fi + + # determine hexadecimal and libtool value of version + case $typ in + a ) typnum=0; levnum=$lev ;; + b ) typnum=1; levnum=$lev ;; + p | . ) typnum=2; levnum=$lev ;; + s ) typnum=15; levnum=255 ;; # snapshots are special + esac + hex=`echo "$ver:$rev:$typnum:$levnum" |\ + awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\ + tr 'abcdef' 'ABCDEF'` + ltv=`echo "$ver:$rev:$typnum:$levnum" |\ + awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'` + + # determine date + if [ ".$tim" = .calc ]; then + day=`date '+%d'` + month=`date '+%m'` + year=`date '+%Y' 2>/dev/null` + if [ ".$time_year" = . ]; then + year=`date '+%y'` + case $year in + [5-9][0-9]) year="19$year" ;; + [0-4][0-9]) year="20$year" ;; + esac + fi + case $month in + 1|01) month='Jan' ;; + 2|02) month='Feb' ;; + 3|03) month='Mar' ;; + 4|04) month='Apr' ;; + 5|05) month='May' ;; + 6|06) month='Jun' ;; + 7|07) month='Jul' ;; + 8|08) month='Aug' ;; + 9|09) month='Sep' ;; + 10) month='Oct' ;; + 11) month='Nov' ;; + 12) month='Dec' ;; + esac + tim="${day}-${month}-${year}" + fi + + # perform result actions + mode=show + if [ ".$opt_i" != . ]; then + mode=edit + elif [ ".$opt_e" = .yes ]; then + mode=edit + elif [ ".$opt_s" != . ]; then + mode=edit + fi + if [ ".$mode" = .show ]; then + # just display the current version + case $opt_d in + short ) + echo "${ver}.${rev}${typ}${lev}" + ;; + long ) + echo "${ver}.${rev}${typ}${lev} ($tim)" + ;; + libtool ) + echo "${ltv}" + ;; + hex ) + echo "${hex}" + ;; + * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2 + shtool_exit 1 + ;; + esac + else + # update the version file + + # pre-generate various strings + triple="${ver}.${rev}${typ}${lev}" + vHex="$hex" + vShort="${triple}" + vLong="${triple} (${tim})" + vTeX="This is ${name}, Version ${triple} (${tim})" + vGNU="${name} ${triple} (${tim})" + vWeb="${name}/${triple}" + vSCCS="@(#)${name} ${triple} (${tim})" + vRCS="\$Id${name} ${triple} (${tim}) \$" + + # determine string out of filename + # (do NOT try to optimize this in any way because of portability) + filestr=`echo $file |\ + tr 'abcdefghijklmnopqrstuvwxyz./%+' \ + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ____' | sed -e 's/-/_/g'` + + # generate uppercase prefix + prefixupper=`echo $prefix |\ + tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + + # create the version file according the the selected language + echo "new version: ${vLong}" + + cp /dev/null $file + case $opt_l in + txt ) + echo >>$file "" + echo >>$file " ${file} -- Version Information for ${name} (syntax: Text)" + echo >>$file " [automatically generated and maintained by GNU shtool]" + echo >>$file "" + echo >>$file " $vTeX" + echo >>$file "" + ;; + c ) + echo >>$file "/*" + echo >>$file "** ${file} -- Version Information for ${name} (syntax: C/C++)" + echo >>$file "** [automatically generated and maintained by GNU shtool]" + echo >>$file "*/" + echo >>$file "" + echo >>$file "#ifdef _${filestr}_AS_HEADER_" + echo >>$file "" + echo >>$file "#ifndef _${filestr}_" + echo >>$file "#define _${filestr}_" + echo >>$file "" + echo >>$file "#define ${prefixupper}VERSION ${vHex}" + echo >>$file "" + echo >>$file "typedef struct {" + echo >>$file " const int v_hex;" + echo >>$file " const char *v_short;" + echo >>$file " const char *v_long;" + echo >>$file " const char *v_tex;" + echo >>$file " const char *v_gnu;" + echo >>$file " const char *v_web;" + echo >>$file " const char *v_sccs;" + echo >>$file " const char *v_rcs;" + echo >>$file "} ${prefix}version_t;" + echo >>$file "" + echo >>$file "extern ${prefix}version_t ${prefix}version;" + echo >>$file "" + echo >>$file "#endif /* _${filestr}_ */" + echo >>$file "" + echo >>$file "#else /* _${filestr}_AS_HEADER_ */" + echo >>$file "" + echo >>$file "#define _${filestr}_AS_HEADER_" + echo >>$file "#include \"${file}\"" + echo >>$file "#undef _${filestr}_AS_HEADER_" + echo >>$file "" + echo >>$file "${prefix}version_t ${prefix}version = {" + echo >>$file " ${vHex}," + echo >>$file " \"${vShort}\"," + echo >>$file " \"${vLong}\"," + echo >>$file " \"${vTeX}\"," + echo >>$file " \"${vGNU}\"," + echo >>$file " \"${vWeb}\"," + echo >>$file " \"${vSCCS}\"," + echo >>$file " \"${vRCS}\"" + echo >>$file "};" + echo >>$file "" + echo >>$file "#endif /* _${filestr}_AS_HEADER_ */" + echo >>$file "" + ;; + m4 ) + echo >>$file "##" + echo >>$file "## ${file} -- Version Information for ${name} (syntax: M4)" + echo >>$file "## [automatically generated and maintained by GNU shtool]" + echo >>$file "##" + echo >>$file "" + echo >>$file "m4_define([v_hex], [${vHex}])" + echo >>$file "m4_define([v_short], [${vShort}])" + echo >>$file "m4_define([v_long], [${vLong}])" + echo >>$file "m4_define([v_tex], [${vTeX}])" + echo >>$file "m4_define([v_gnu], [${vGNU}])" + echo >>$file "m4_define([v_web], [${vWeb}])" + echo >>$file "m4_define([v_sccs], [${vSCCS}])" + echo >>$file "m4_define([v_rcs], [${vRCS}])" + echo >>$file "" + ;; + perl ) + echo >>$file "##" + echo >>$file "## ${file} -- Version Information for ${name} (syntax: Perl)" + echo >>$file "## [automatically generated and maintained by GNU shtool]" + echo >>$file "##" + echo >>$file "" + echo >>$file "my \$${prefix}version = {" + echo >>$file " 'v_hex' => ${vHex}," + echo >>$file " 'v_short' => \"${vShort}\"," + echo >>$file " 'v_long' => \"${vLong}\"," + echo >>$file " 'v_tex' => \"${vTeX}\"," + echo >>$file " 'v_gnu' => \"${vGNU}\"," + echo >>$file " 'v_web' => \"${vWeb}\"," + echo >>$file " 'v_sccs' => \"${vSCCS}\"," + echo >>$file " 'v_rcs' => \"\\${vRCS}/\"" + echo >>$file "};" + echo >>$file "" + echo >>$file "1;" + echo >>$file "" + ;; + python ) + echo >>$file "##" + echo >>$file "## ${file} -- Version Information for ${name} (syntax: Python)" + echo >>$file "## [automatically generated and maintained by GNU shtool]" + echo >>$file "##" + echo >>$file "" + echo >>$file "class ${prefix}version:" + echo >>$file " v_hex = ${vHex}" + echo >>$file " v_short = \"${vShort}\"" + echo >>$file " v_long = \"${vLong}\"" + echo >>$file " v_tex = \"${vTeX}\"" + echo >>$file " v_gnu = \"${vGNU}\"" + echo >>$file " v_web = \"${vWeb}\"" + echo >>$file " v_sccs = \"${vSCCS}\"" + echo >>$file " v_rcs = \"${vRCS}\"" + echo >>$file "" + ;; + * ) echo "$msgprefix:Error: invalid argument to option \`-l': \`$opt_l'" 1>&2 + shtool_exit 1 + ;; + esac + fi + + shtool_exit 0 + ;; + +path ) + ## + ## path -- Deal with program paths + ## Copyright (c) 1998-2004 Ralf S. Engelschall + ## + + namelist="$*" + + # check whether the test command supports the -x option + if [ -x /bin/sh ] 2>/dev/null; then + minusx="-x" + else + minusx="-r" + fi + + # split path string + paths="`echo $opt_p |\ + sed -e 's/^:/.:/' \ + -e 's/::/:.:/g' \ + -e 's/:$/:./' \ + -e 's/:/ /g'`" + + # SPECIAL REQUEST + # translate forward to reverse path + if [ ".$opt_r" = .yes ]; then + if [ "x$namelist" = "x." ]; then + rp='.' + else + rp='' + for pe in `IFS="$IFS/"; echo $namelist`; do + rp="../$rp" + done + fi + echo $rp | sed -e 's:/$::' + shtool_exit 0 + fi + + # SPECIAL REQUEST + # strip out directory or base name + if [ ".$opt_d" = .yes ]; then + echo "$namelist" |\ + sed -e 's;[^/]*$;;' -e 's;\(.\)/$;\1;' + shtool_exit 0 + fi + if [ ".$opt_b" = .yes ]; then + echo "$namelist" |\ + sed -e 's;.*/\([^/]*\)$;\1;' + shtool_exit 0 + fi + + # MAGIC SITUATION + # Perl Interpreter (perl) + if [ ".$opt_m" = .yes ] && [ ".$namelist" = .perl ]; then + rm -f $tmpfile >/dev/null 2>&1 + touch $tmpfile + found=0 + pc=99 + for dir in $paths; do + dir=`echo $dir | sed -e 's;/*$;;'` + nc=99 + for name in perl perl5 miniperl; do + if [ $minusx "$dir/$name" ] && [ ! -d "$dir/$name" ]; then + perl="$dir/$name" + pv=`$perl -e 'printf("%.3f", $]);'` + echo "$pv:$pc:$nc:$perl" >>$tmpfile + found=1 + fi + nc=`expr $nc - 1` + done + pc=`expr $pc - 1` + done + if [ $found = 1 ]; then + perl="`cat $tmpfile | sort -r -u | sed -e 'q' | cut -d: -f4`" + rm -f $tmpfile >/dev/null 2>&1 + echo "$perl" + shtool_exit 0 + fi + rm -f $tmpfile >/dev/null 2>&1 + shtool_exit 1 + fi + + # MAGIC SITUATION + # C pre-processor (cpp) + if [ ".$opt_m" = .yes ] && [ ".$namelist" = .cpp ]; then + echo >$tmpfile.c "#include " + echo >>$tmpfile.c "Syntax Error" + # 1. try the standard cc -E approach + cpp="${CC-cc} -E" + (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out + my_error=`grep -v '^ *+' $tmpfile.out` + if [ ".$my_error" != . ]; then + # 2. try the cc -E approach and GCC's -traditional-ccp option + cpp="${CC-cc} -E -traditional-cpp" + (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out + my_error=`grep -v '^ *+' $tmpfile.out` + if [ ".$my_error" != . ]; then + # 3. try a standalone cpp command in path and lib dirs + for path in $paths /lib /usr/lib /usr/local/lib; do + path=`echo $path | sed -e 's;/*$;;'` + if [ $minusx "$path/cpp" ] && [ ! -d "$path/cpp" ]; then + cpp="$path/cpp" + break + fi + done + if [ ".$cpp" != . ]; then + (eval "$cpp $tmpfile.c >/dev/null") 2>$tmpfile.out + my_error=`grep -v '^ *+' $tmpfile.out` + if [ ".$my_error" != . ]; then + # ok, we gave up... + cpp='' + fi + fi + fi + fi + rm -f $tmpfile >/dev/null 2>&1 + rm -f $tmpfile.c $tmpfile.out >/dev/null 2>&1 + if [ ".$cpp" != . ]; then + echo "$cpp" + shtool_exit 0 + fi + shtool_exit 1 + fi + + # STANDARD SITUATION + # iterate over names + for name in $namelist; do + # iterate over paths + for path in $paths; do + path=`echo $path | sed -e 's;/*$;;'` + if [ $minusx "$path/$name" ] && [ ! -d "$path/$name" ]; then + if [ ".$opt_s" != .yes ]; then + echo "$path/$name" + fi + shtool_exit 0 + fi + done + done + + shtool_exit 1 + ;; + +esac + +shtool_exit 0 + Index: ossp-pkg/iselect/iselect.1 RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect.1,v rcsdiff -q -kk '-r1.2' '-r1.3' -u '/v/ossp/cvs/ossp-pkg/iselect/iselect.1,v' 2>/dev/null --- iselect.1 2000/07/25 11:53:24 1.2 +++ iselect.1 2004/09/11 15:18:49 1.3 @@ -1,12 +1,8 @@ -.rn '' }` -''' $RCSfile$$Revision$$Date$ -''' -''' $Log$ -''' Revision 1.2 2000/07/25 11:53:24 rse -''' Merge in pending changes -''' -''' -.de Sh +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading .br .if t .Sp .ne 5 @@ -14,150 +10,98 @@ \fB\\$1\fR .PP .. -.de Sp +.de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. -.de Ip -.br -.ie \\n(.$>=3 .ne \\$3 -.el .ne 3 -.IP "\\$1" \\$2 -.. -.de Vb +.de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. -.de Ve +.de Ve \" End verbatim text .ft R - .fi .. -''' -''' -''' Set up \*(-- to give an unbreakable dash; -''' string Tr holds user defined translation string. -''' Bell System Logo is used as a dummy character. -''' +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. .tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ -.ds -- \(*W- -.ds PI pi -.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch -.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch -.ds L" "" -.ds R" "" -''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of -''' \*(L" and \*(R", except that they are used on ".xx" lines, -''' such as .IP and .SH, which do another additional levels of -''' double-quote interpretation -.ds M" """ -.ds S" """ -.ds N" """"" -.ds T" """"" -.ds L' ' -.ds R' ' -.ds M' ' -.ds S' ' -.ds N' ' -.ds T' ' +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" 'br\} .el\{\ -.ds -- \(em\| -.tr \*(Tr -.ds L" `` -.ds R" '' -.ds M" `` -.ds S" '' -.ds N" `` -.ds T" '' -.ds L' ` -.ds R' ' -.ds M' ` -.ds S' ' -.ds N' ` -.ds T' ' -.ds PI \(*p +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' 'br\} -.\" If the F register is turned on, we'll generate -.\" index entries out stderr for the following things: -.\" TH Title -.\" SH Header -.\" Sh Subsection -.\" Ip Item -.\" X<> Xref (embedded -.\" Of course, you have to process the output yourself -.\" in some meaninful fashion. -.if \nF \{ -.de IX -.tm Index:\\$1\t\\n%\t"\\$2" +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" .. -.nr % 0 -.rr F +. nr % 0 +. rr F .\} -.TH ISELECT 1 "EN" "22/Jun/1999" "Ralf S. Engelschall" -.UC -.if n .hy 0 +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 .if n .na -.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' -.de CQ \" put $1 in typewriter font -.ft CW -'if n "\c -'if t \\&\\$1\c -'if n \\&\\$1\c -'if n \&" -\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 -'.ft R -.. -.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 -. \" AM - accent mark definitions -.bd B 3 -. \" fudge factors for nroff and troff +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff .if n \{\ -. ds #H 0 -. ds #V .8m -. ds #F .3m -. ds #[ \f1 -. ds #] \fP +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP .\} .if t \{\ -. ds #H ((1u-(\\\\n(.fu%2u))*.13m) -. ds #V .6m -. ds #F 0 -. ds #[ \& -. ds #] \& +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& .\} -. \" simple accents for nroff and troff +. \" simple accents for nroff and troff .if n \{\ -. ds ' \& -. ds ` \& -. ds ^ \& -. ds , \& -. ds ~ ~ -. ds ? ? -. ds ! ! -. ds / -. ds q +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / .\} .if t \{\ -. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" -. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' -. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' -. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' -. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' -. ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' -. ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' -. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' -. ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} -. \" troff and (daisy-wheel) nroff accents +. \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' -.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] -.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' -.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' -.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' @@ -165,64 +109,65 @@ .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E -.ds oe o\h'-(\w'o'u*4/10)'e -.ds Oe O\h'-(\w'O'u*4/10)'E -. \" corrections for vroff +. \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' -. \" for low resolution devices (crt and lpr) +. \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ -. ds : e -. ds 8 ss -. ds v \h'-1'\o'\(aa\(ga' -. ds _ \h'-1'^ -. ds . \h'-1'. -. ds 3 3 -. ds o a -. ds d- d\h'-1'\(ga -. ds D- D\h'-1'\(hy -. ds th \o'bp' -. ds Th \o'LP' -. ds ae ae -. ds Ae AE -. ds oe oe -. ds Oe OE +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE .\} .rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "ISELECT 1" +.TH ISELECT 1 "2004-09-11" "EN" "Ralf S. Engelschall" .SH "NAME" -iSelect -- Interactive Selection Tool +iSelect \-\- Interactive Selection Tool .SH "SYNOPSIS" -\fBiselect\fR -[\fB\-d\fR \fISTR\fR,\fISTR\fR] +.IX Header "SYNOPSIS" +\&\fBiselect\fR +[\fB\-d\fR \fI\s-1STR\s0\fR,\fI\s-1STR\s0\fR] [\fB\-c\fR] [\fB\-f\fR] [\fB\-a\fR] [\fB\-e\fR] -[\fB\-p\fR \fINUM\fR] -[\fB\-k\fR \fIKEY\fR[:\fIOKEY\fR]] +[\fB\-p\fR \fI\s-1NUM\s0\fR] +[\fB\-k\fR \fI\s-1KEY\s0\fR[:\fI\s-1OKEY\s0\fR]] [\fB\-m\fR] -[\fB\-n\fR \fISTR\fR] -[\fB\-t\fR \fISTR\fR] +[\fB\-n\fR \fI\s-1STR\s0\fR] +[\fB\-t\fR \fI\s-1STR\s0\fR] [\fB\-S\fR] [\fB\-K\fR] [\fB\-P\fR] -[\fB\-Q\fR \fISTR\fR] +[\fB\-Q\fR \fI\s-1STR\s0\fR] [\fIline1\fR \fIline2\fR ...] .PP -\fBiselect\fR +\&\fBiselect\fR [\fB\-V\fR] .SH "VERSION" -1.2.0 (31-Mar-1999) +.IX Header "VERSION" +1.2.1 (25\-Jul\-2000) .SH "DESCRIPTION" +.IX Header "DESCRIPTION" .Sh "Intend" +.IX Subsection "Intend" iSelect is an interactive line selection tool for \s-1ASCII\s0 files, operating via a full-screen Curses-based terminal session. It can be used either as an user -interface frontend controlled by a Bourne-Shell, Perl or other type of script +interface frontend controlled by a Bourne\-Shell, Perl or other type of script backend as its wrapper or in batch as a pipe filter (usually between \fIgrep\fR and the final executing command). In other words: iSelect was designed to be used for any types of interactice line-based selections. .Sh "Input Data" +.IX Subsection "Input Data" Input is read either from the command line (\fIline1\fR \fIline2\fR ...) where each argument corresponds to one buffer line or from \fIstdin\fR (when no arguments are given) where the buffer lines are determined according to the newline @@ -230,87 +175,111 @@ .PP You can additionally let substrings displayed in Bold mode for non-selectable lines (because the selectable lines are always displayed bold) by using the -construct ``\f(CW\fR...\f(CW\fR'\*(R' as in \s-1HTML\s0. +construct ``\f(CW\*(C`\*(C'\fR...\f(CW\*(C`\*(C'\fR'' as in \s-1HTML\s0. .Sh "Selections" +.IX Subsection "Selections" The selection is either just a single line (default) or multiple lines (option -\fB\-m\fR). Per default no lines are selectable. If a line contains the string -``\f(CW\fR'\*(R' (or a string with different delimiters configured via +\&\fB\-m\fR). Per default no lines are selectable. If a line contains the string +``\f(CW\*(C`\*(C'\fR'' (or a string with different delimiters configured via option \fB\-d\fR) at any position this string is stripped and the line is selectable. Its result (printed to \fIstdout\fR) is the line contents itself (but -without the ``\f(CW\fR'\*(R' string of course). If option \fB\-a\fR is used all +without the ``\f(CW\*(C`\*(C'\fR'' string of course). If option \fB\-a\fR is used all lines are selectable and their result is again the line itself, i.e. using -option \fB\-a\fR is the same as adding ``\f(CW\fR'\*(R' to every line of the +option \fB\-a\fR is the same as adding ``\f(CW\*(C`\*(C'\fR'' to every line of the input data. When you want a specific result (i.e. not just the line contents -itself), you have to use the special variant ``\f(CW\fR'\*(R' -which results in the output ``\f(CWresult text\fR'\*(R' when the corresponding line is +itself), you have to use the special variant ``\f(CW\*(C`\*(C'\fR'' +which results in the output ``\f(CW\*(C`result text\*(C'\fR'' when the corresponding line is selected. .PP -When you use a specific result via ``\f(CW\fR'\*(R' the \fIresult -text\fR can contain ``\f(CW%[query text]s\fR'\*(R' and ``\f(CW%[query text]S\fR'\*(R' +When you use a specific result via ``\f(CW\*(C`\*(C'\fR'' the \fIresult +text\fR can contain ``\f(CW\*(C`%[query text]s\*(C'\fR'' and ``\f(CW\*(C`%[query text]S\*(C'\fR'' constructs. For every such construct an interactive query is done and the -result replaces the construct. The ``\f(CW%[query text]S\fR'\*(R' construct is like -``\f(CW%[query text]s\fR'\*(R' except that the empty string as the query result is not +result replaces the construct. The ``\f(CW\*(C`%[query text]S\*(C'\fR'' construct is like +``\f(CW\*(C`%[query text]s\*(C'\fR'' except that the empty string as the query result is not accepted on input. .PP The Curses-based full-screen selection is always done via \fI/dev/tty\fR, because the \fIstdin\fR and \fIstdout\fR filehandles are usually tied to the input and output data streams. .Sh "Output Data" -The output is the line itself or the string given with ``\f(CW\fR'\*(R'. When multiple line selection mode (option \fB\-m\fR) is used the +.IX Subsection "Output Data" +The output is the line itself or the string given with ``\f(CW\*(C`\*(C'\fR''. When multiple line selection mode (option \fB\-m\fR) is used the output is all selected lines theirself or their configured result strings. Output always is written to \fIstdout\fR. .SH "OPTIONS" +.IX Header "OPTIONS" .Sh "Input Options" +.IX Subsection "Input Options" These options control how \fIiSelect\fR parses its input. -.Ip "\fB\-d\fR \fI\s-1STR\s0\fR, \fB--delimiter=\fR\fI\s-1STR\s0\fR" 4 -Sets the delimiters for the selection tags. The default is `\f(CW<,>\fR\*(R', -i.e. the selection tags have to read ``\f(CW\fR'\*(R' and ``\f(CW\fR'\*(R' -.Ip "\fB\-c\fR, \fB--strip-comments\fR" 4 +.IP "\fB\-d\fR \fI\s-1STR\s0\fR, \fB\-\-delimiter=\fR\fI\s-1STR\s0\fR" 4 +.IX Item "-d STR, --delimiter=STR" +Sets the delimiters for the selection tags. The default is `\f(CW\*(C`<,>\*(C'\fR', +i.e. the selection tags have to read ``\f(CW\*(C`\*(C'\fR'' and ``\f(CW\*(C`\*(C'\fR'' +.IP "\fB\-c\fR, \fB\-\-strip\-comments\fR" 4 +.IX Item "-c, --strip-comments" Strips all sharp comment lines from the input buffer before parsing. -.Ip "\fB\-f\fR, \fB--force-browse\fR" 4 +.IP "\fB\-f\fR, \fB\-\-force\-browse\fR" 4 +.IX Item "-f, --force-browse" Browse always, i.e. even when the input buffer contains no or only one line. -.Ip "\fB\-a\fR, \fB--all-select\fR" 4 +.IP "\fB\-a\fR, \fB\-\-all\-select\fR" 4 +.IX Item "-a, --all-select" Force all lines to be selectable. -.Ip "\fB\-e\fR, \fB--exit-no-select\fR" 4 +.IP "\fB\-e\fR, \fB\-\-exit\-no\-select\fR" 4 +.IX Item "-e, --exit-no-select" Exit immediately if no lines are selectable. In this case not even the Curses screen is initialized. .Sh "Display Options" -.Ip "\fB\-p\fR \fI\s-1NUM\s0\fR, \fB--position=\fR\fI\s-1NUM\s0\fR" 4 +.IX Subsection "Display Options" +.IP "\fB\-p\fR \fI\s-1NUM\s0\fR, \fB\-\-position=\fR\fI\s-1NUM\s0\fR" 4 +.IX Item "-p NUM, --position=NUM" Sets the cursor position to line \fI\s-1NUM\s0\fR. -.Ip "\fB\-k\fR \fI\s-1KEY\s0\fR[:\fI\s-1OKEY\s0\fR], \fB--key=\fR\fI\s-1KEY\s0[:\fI\s-1OKEY\s0\fR]\fR" 4 -Defines an additional input key. Per default \fI\s-1OKEY\s0\fR is \f(CWRETURN\fR, i.e. for -instance \fB\-kf\fR defines another selection key `\f(CWf\fR\*(R'. -.Ip "\fB\-m\fR, \fB--multi-line\fR" 4 +.IP "\fB\-k\fR \fI\s-1KEY\s0\fR[:\fI\s-1OKEY\s0\fR], \fB\-\-key=\fR\fIKEY[:\fI\s-1OKEY\s0\fI]\fR" 4 +.IX Item "-k KEY[:OKEY], --key=KEY[:OKEY]" +Defines an additional input key. Per default \fI\s-1OKEY\s0\fR is \f(CW\*(C`RETURN\*(C'\fR, i.e. for +instance \fB\-kf\fR defines another selection key `\f(CW\*(C`f\*(C'\fR'. +.IP "\fB\-m\fR, \fB\-\-multi\-line\fR" 4 +.IX Item "-m, --multi-line" Enable multi-line selection where you can select more then one line via \s-1SPACE\s0 key. -.Ip "\fB\-n\fR \fI\s-1STR\s0\fR, \fB--name=\fR\fI\s-1STR\s0\fR" 4 +.IP "\fB\-n\fR \fI\s-1STR\s0\fR, \fB\-\-name=\fR\fI\s-1STR\s0\fR" 4 +.IX Item "-n STR, --name=STR" Sets the name string, displayed flush left at the bottom of the browser window. -.Ip "\fB\-t\fR \fI\s-1STR\s0\fR, \fB--title=\fR\fI\s-1STR\s0\fR" 4 +.IP "\fB\-t\fR \fI\s-1STR\s0\fR, \fB\-\-title=\fR\fI\s-1STR\s0\fR" 4 +.IX Item "-t STR, --title=STR" Sets the title bar string, displayed centered at the bottom of the browser window. .Sh "Output Options" -.Ip "\fB\-S\fR, \fB--strip-result\fR" 4 +.IX Subsection "Output Options" +.IP "\fB\-S\fR, \fB\-\-strip\-result\fR" 4 +.IX Item "-S, --strip-result" Strip all leading and trailing whitespaces from the result string. -.Ip "\fB\-K\fR, \fB--key-result\fR" 4 +.IP "\fB\-K\fR, \fB\-\-key\-result\fR" 4 +.IX Item "-K, --key-result" Prefix the result string (given on \fIstdout\fR) with the corresponding selection -key which was used. This usually is \f(CWRETURN\fR or \f(CWKEY_RIGHT\fR but can be any +key which was used. This usually is \f(CW\*(C`RETURN\*(C'\fR or \f(CW\*(C`KEY_RIGHT\*(C'\fR but can be any of the additional keys defined by option \fB\-k\fR. When you use \fB\-kf\fR and -select a line \f(CWFoo Bar\fR with key `\f(CWf\fR\*(R' the result string is ``\f(CWf:Foo -Bar\fR'\*(R'. -.Ip "\fB\-P\fR, \fB--position-result\fR" 4 +select a line \f(CW\*(C`Foo Bar\*(C'\fR with key `\f(CW\*(C`f\*(C'\fR' the result string is ``\f(CW\*(C`f:Foo +Bar\*(C'\fR''. +.IP "\fB\-P\fR, \fB\-\-position\-result\fR" 4 +.IX Item "-P, --position-result" Prefix the result string (given on \fIstdout\fR) with the corresponding cursor position followed by a colon. When you selected line \fIN\fR and this line has -the result \f(CWFoo Bar\fR configured the result string is ``\f(CWN:Foo Bar\fR'\*(R'. -.Ip "\fB\-Q\fR \fI\s-1STR\s0\fR, \fB--quit-result=\fR\fI\s-1STR\s0\fR" 4 +the result \f(CW\*(C`Foo Bar\*(C'\fR configured the result string is ``\f(CW\*(C`N:Foo Bar\*(C'\fR''. +.IP "\fB\-Q\fR \fI\s-1STR\s0\fR, \fB\-\-quit\-result=\fR\fI\s-1STR\s0\fR" 4 +.IX Item "-Q STR, --quit-result=STR" Sets the result string on quit. Default is the empty string. .Sh "Giving Feedback" -.Ip "\fB\-V\fR, \fB--version\fR" 4 +.IX Subsection "Giving Feedback" +.IP "\fB\-V\fR, \fB\-\-version\fR" 4 +.IX Item "-V, --version" Displays version identification string. .SH "KEYSTROKES" +.IX Header "KEYSTROKES" .Sh "Cursor Movement" +.IX Subsection "Cursor Movement" Use these to browse through the selection list. .PP .Vb 6 @@ -322,6 +291,7 @@ \& G ............. Goto last line .Ve .Sh "Line Selection" +.IX Subsection "Line Selection" Use these to select one line and exit in standard mode or one or more lines in multi-line mode. .PP @@ -331,6 +301,7 @@ \& SPACE ......... Select line and stay (multi-line mode only) .Ve .Sh "Others" +.IX Subsection "Others" Use these to quit iSelect or to show its help and version page. .PP @@ -341,9 +312,10 @@ \& v ............. Version Page .Ve .SH "EXAMPLE" +.IX Header "EXAMPLE" As an example we present a real-life situation where iSelect can enhance an existing functionality. We define two Bash functions (for your -\fI$HOME/.bashrc\fR file) which enhance the built-in `\fIcd\fR\*(R' command of the +\&\fI$HOME/.bashrc\fR file) which enhance the built-in `\fIcd\fR' command of the shell. .PP .Vb 7 @@ -355,6 +327,7 @@ \& sort -u >$HOME/.cdpaths ) & \& } .Ve +.PP .Vb 11 \& # definition of the enhanced cd command \& cd () { @@ -368,104 +341,30 @@ \& PS1="\eu@\eh:$PWD\en:> " \& } .Ve -This new `\fIcd\fR\*(R' command is compatible with Bashs built-in variant for the case +.PP +This new `\fIcd\fR' command is compatible with Bashs built-in variant for the case where the specified directory actually exists. When it doesn't, the original -`\fIcd\fR\*(R' would immediately give an error (assuming we have no \fICDPATH\fR +`\fIcd\fR' would immediately give an error (assuming we have no \fI\s-1CDPATH\s0\fR variable defined). Here this enhanced version tries harder. First it searches for such a directory in a previously built (via \fIcds\fR) \fI$HOME/.cdpaths\fR files. When no line was found, iSelect just returns the given directory as the -default result and `\fIcd\fR\*(R' then fails as usual with an error message. When +default result and `\fIcd\fR' then fails as usual with an error message. When only one directory was found, iSelect directly results this particular line to -`\fIcd\fR\*(R'. And only when more then one directory was found, iSelect opens its +`\fIcd\fR'. And only when more then one directory was found, iSelect opens its Curses-based selection screen and lets the user choose interactively between -those directories. The chosen directory is then finally given to `\fIcd\fR\*(R'. +those directories. The chosen directory is then finally given to `\fIcd\fR'. .PP For more useful examples on how to use iSelect, see the \fIcontrib/\fR directory of the iSelect distribution tarball. .SH "AUTHOR" -.PP +.IX Header "AUTHOR" .Vb 3 \& Ralf S. Engelschall \& rse@engelschall.com \& www.engelschall.com .Ve .SH "SEE ALSO" -.PP +.IX Header "SEE ALSO" .Vb 1 \& iSelect Home: http://www.engelschall.com/sw/iselect/ .Ve - -.rn }` '' -.IX Title "ISELECT 1" -.IX Name "iSelect - Interactive Selection Tool" - -.IX Header "NAME" - -.IX Header "SYNOPSIS" - -.IX Header "VERSION" - -.IX Header "DESCRIPTION" - -.IX Subsection "Intend" - -.IX Subsection "Input Data" - -.IX Subsection "Selections" - -.IX Subsection "Output Data" - -.IX Header "OPTIONS" - -.IX Subsection "Input Options" - -.IX Item "\fB\-d\fR \fI\s-1STR\s0\fR, \fB--delimiter=\fR\fI\s-1STR\s0\fR" - -.IX Item "\fB\-c\fR, \fB--strip-comments\fR" - -.IX Item "\fB\-f\fR, \fB--force-browse\fR" - -.IX Item "\fB\-a\fR, \fB--all-select\fR" - -.IX Item "\fB\-e\fR, \fB--exit-no-select\fR" - -.IX Subsection "Display Options" - -.IX Item "\fB\-p\fR \fI\s-1NUM\s0\fR, \fB--position=\fR\fI\s-1NUM\s0\fR" - -.IX Item "\fB\-k\fR \fI\s-1KEY\s0\fR[:\fI\s-1OKEY\s0\fR], \fB--key=\fR\fI\s-1KEY\s0[:\fI\s-1OKEY\s0\fR]\fR" - -.IX Item "\fB\-m\fR, \fB--multi-line\fR" - -.IX Item "\fB\-n\fR \fI\s-1STR\s0\fR, \fB--name=\fR\fI\s-1STR\s0\fR" - -.IX Item "\fB\-t\fR \fI\s-1STR\s0\fR, \fB--title=\fR\fI\s-1STR\s0\fR" - -.IX Subsection "Output Options" - -.IX Item "\fB\-S\fR, \fB--strip-result\fR" - -.IX Item "\fB\-K\fR, \fB--key-result\fR" - -.IX Item "\fB\-P\fR, \fB--position-result\fR" - -.IX Item "\fB\-Q\fR \fI\s-1STR\s0\fR, \fB--quit-result=\fR\fI\s-1STR\s0\fR" - -.IX Subsection "Giving Feedback" - -.IX Item "\fB\-V\fR, \fB--version\fR" - -.IX Header "KEYSTROKES" - -.IX Subsection "Cursor Movement" - -.IX Subsection "Line Selection" - -.IX Subsection "Others" - -.IX Header "EXAMPLE" - -.IX Header "AUTHOR" - -.IX Header "SEE ALSO" - Index: ossp-pkg/iselect/iselect.pod RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect.pod,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/iselect/iselect.pod,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect.pod' 2>/dev/null --- ossp-pkg/iselect/iselect.pod +++ - 2024-04-25 08:53:01.945604666 +0200 @@ -0,0 +1,303 @@ +## _ ____ _ _ +## (_) ___| ___| | ___ ___| |_ +## / /\___ \ / _ \ |/ _ \/ __| __| +## / / ___) | __/ | __/ (__| |_ +## (_( |____/ \___|_|\___|\___|\__| +## +## iSelect -- Interactive Selection Tool +## +## iSelect is a Curses-based tool for interactive line selection +## in an ASCII file via a full-screen terminal session. +## +## ====================================================================== +## +## Copyright (c) 1997-2004 Ralf S. Engelschall. +## +## This program is free software; it may be redistributed and/or +## modified only under the terms of the GNU General Public License, +## which may be found in the iSelect source distribution. +## Look at the file COPYING for details. +## +## 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 the GNU General Public License for more details. +## +## ====================================================================== +## +## iselect.pod -- manual page +## + +=head1 NAME + +iSelect -- Interactive Selection Tool + +=head1 SYNOPSIS + +B +[B<-d> I,I] +[B<-c>] +[B<-f>] +[B<-a>] +[B<-e>] +[B<-p> I] +[B<-k> I[:I]] +[B<-m>] +[B<-n> I] +[B<-t> I] +[B<-S>] +[B<-K>] +[B<-P>] +[B<-Q> I] +[I I ...] + +B +[B<-V>] + +=head1 VERSION + +@V@ + +=head1 DESCRIPTION + +=head2 Intend + +iSelect is an interactive line selection tool for ASCII files, operating via a +full-screen Curses-based terminal session. It can be used either as an user +interface frontend controlled by a Bourne-Shell, Perl or other type of script +backend as its wrapper or in batch as a pipe filter (usually between F +and the final executing command). In other words: iSelect was designed to be +used for any types of interactice line-based selections. + +=head2 Input Data + +Input is read either from the command line (I I ...) where each +argument corresponds to one buffer line or from F (when no arguments +are given) where the buffer lines are determined according to the newline +characters. + +You can additionally let substrings displayed in Bold mode for non-selectable +lines (because the selectable lines are always displayed bold) by using the +construct ``CbE>...C/bE>'' as in HTML. + +=head2 Selections + +The selection is either just a single line (default) or multiple lines (option +B<-m>). Per default no lines are selectable. If a line contains the string +``CsE>'' (or a string with different delimiters configured via +option B<-d>) at any position this string is stripped and the line is +selectable. Its result (printed to F) is the line contents itself (but +without the ``CsE>'' string of course). If option B<-a> is used all +lines are selectable and their result is again the line itself, i.e. using +option B<-a> is the same as adding ``CsE>'' to every line of the +input data. When you want a specific result (i.e. not just the line contents +itself), you have to use the special variant ``Cs:result textE>'' +which results in the output ``C'' when the corresponding line is +selected. + +When you use a specific result via ``Cs:result textE>'' the I can contain ``C<%[query text]s>'' and ``C<%[query text]S>'' +constructs. For every such construct an interactive query is done and the +result replaces the construct. The ``C<%[query text]S>'' construct is like +``C<%[query text]s>'' except that the empty string as the query result is not +accepted on input. + +The Curses-based full-screen selection is always done via F, because +the F and F filehandles are usually tied to the input and +output data streams. + +=head2 Output Data + +The output is the line itself or the string given with ``Cs:result +textE>''. When multiple line selection mode (option B<-m>) is used the +output is all selected lines theirself or their configured result strings. +Output always is written to F. + +=head1 OPTIONS + +=head2 Input Options + +These options control how I parses its input. + +=over 4 + +=item B<-d> I, B<--delimiter=>I + +Sets the delimiters for the selection tags. The default is `C,E>', +i.e. the selection tags have to read ``CsE>'' and ``Cs:result +textE>'' + +=item B<-c>, B<--strip-comments> + +Strips all sharp comment lines from the input buffer before parsing. + +=item B<-f>, B<--force-browse> + +Browse always, i.e. even when the input buffer contains no or only one line. + +=item B<-a>, B<--all-select> + +Force all lines to be selectable. + +=item B<-e>, B<--exit-no-select> + +Exit immediately if no lines are selectable. In this case not even the Curses +screen is initialized. + +=back + +=head2 Display Options + +=over 4 + +=item B<-p> I, B<--position=>I + +Sets the cursor position to line I. + +=item B<-k> I[:I], B<--key=>I]> + +Defines an additional input key. Per default I is C, i.e. for +instance B<-kf> defines another selection key `C'. + +=item B<-m>, B<--multi-line> + +Enable multi-line selection where you can select more then one line via SPACE +key. + +=item B<-n> I, B<--name=>I + +Sets the name string, displayed flush left at the bottom of the +browser window. + +=item B<-t> I, B<--title=>I + +Sets the title bar string, displayed centered at the bottom of the +browser window. + +=back + +=head2 Output Options + +=over 4 + +=item B<-S>, B<--strip-result> + +Strip all leading and trailing whitespaces from the result string. + +=item B<-K>, B<--key-result> + +Prefix the result string (given on F) with the corresponding selection +key which was used. This usually is C or C but can be any +of the additional keys defined by option B<-k>. When you use B<-kf> and +select a line C with key `C' the result string is ``C''. + +=item B<-P>, B<--position-result> + +Prefix the result string (given on F) with the corresponding cursor +position followed by a colon. When you selected line I and this line has +the result C configured the result string is ``C''. + +=item B<-Q> I, B<--quit-result=>I + +Sets the result string on quit. Default is the empty string. + +=back + +=head2 Giving Feedback + +=over 4 + +=item B<-V>, B<--version> + +Displays version identification string. + +=back + +=head1 KEYSTROKES + +=head2 Cursor Movement + +Use these to browse through the selection list. + + CURSOR-UP ..... Move cursor one line up + CURSOR-DOWN ... Move cursor one line down + PAGE-UP ....... Move cursor one page up + PAGE-DOWN ..... Move cursor one page down + g ............. Goto first line + G ............. Goto last line + +=head2 Line Selection + +Use these to select one line and exit in standard mode or one or more lines in +multi-line mode. + + RETURN ........ Select line and exit + CURSOR-RIGHT .. Select line and exit + SPACE ......... Select line and stay (multi-line mode only) + +=head2 Others + +Use these to quit iSelect or to show its help and +version page. + + q ............. Quit (exit without selection) + CURSOR-LEFT ... Quit (exit without selection) + h ............. Help Page + v ............. Version Page + +=head1 EXAMPLE + +As an example we present a real-life situation where iSelect can enhance an +existing functionality. We define two Bash functions (for your +F<$HOME/.bashrc> file) which enhance the built-in `F' command of the +shell. + + # database scan for enhanced cd command + cds () { + (cd $HOME; + find . -type d -print |\ + sed -e "s;^\.;$HOME;" |\ + sort -u >$HOME/.cdpaths ) & + } + + # definition of the enhanced cd command + cd () { + if [ -d $1 ]; then + builtin cd $1 + else + builtin cd `egrep "/$1[^/]*$" $HOME/.cdpaths |\ + iselect -a -Q $1 -n "chdir" \ + -t "Change Directory to..."` + fi + PS1="\u@\h:$PWD\n:> " + } + +This new `F' command is compatible with Bashs built-in variant for the case +where the specified directory actually exists. When it doesn't, the original +`F' would immediately give an error (assuming we have no F +variable defined). Here this enhanced version tries harder. First it searches +for such a directory in a previously built (via F) F<$HOME/.cdpaths> +files. When no line was found, iSelect just returns the given directory as the +default result and `F' then fails as usual with an error message. When +only one directory was found, iSelect directly results this particular line to +`F'. And only when more then one directory was found, iSelect opens its +Curses-based selection screen and lets the user choose interactively between +those directories. The chosen directory is then finally given to `F'. + +For more useful examples on how to use iSelect, see the F directory +of the iSelect distribution tarball. + +=head1 AUTHOR + + Ralf S. Engelschall + rse@engelschall.com + www.engelschall.com + +=head1 SEE ALSO + + iSelect Home: http://www.engelschall.com/sw/iselect/ + +=cut + +##EOF## Index: ossp-pkg/iselect/iselect_browse.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_browse.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_browse.c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_browse.c' 2>/dev/null --- ossp-pkg/iselect/iselect_browse.c +++ - 2024-04-25 08:53:01.948335991 +0200 @@ -0,0 +1,935 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_browse.c -- Curses-based file browser +*/ + +#include "config_ac.h" +#include "config_sc.h" + +#include +#include +#include +#include +#ifdef USE_NCURSES +#include +#endif +#ifdef USE_SLCURSES +#include +#endif +#ifdef USE_CURSES +#include +#endif + +#include "iselect_global.h" +#include "iselect_browse.h" +#include "iselect_keys.h" + +extern char *iSelect_Help[]; +extern char *iSelect_README[]; + +void strip(char *string); +void diehard(void); +void diesoft(void); +void setup(void); +char *iSelect_InputField(int wYSize, int wXSize, int wYPos, int wXPos, int bAllowEmpty); +void iSelect_Draw(WINDOW *wField, + int wYSize, int wXSize, int wYPos, int wXPos, + int nAbsFirstLine, int nAbsLastLine, + int nRelMarked, + int nRelFirstDraw, int nRelLastDraw, + int nLines, + WINDOW *sField, char *title, char *name, + WINDOW *mField, char *msg, char *tagbegin, char *tagend); +int iSelect_Browser(int wYSize, int wXSize, int wYPos, int wXPos, int selectpos, int multiselect, + int sYSize, int sXSize, int sYPos, int sXPos, char *title, char *name, + int mYSize, int mXSize, int mYPos, int mXPos, + char **keystr, char *tagbegin, char *tagend); +int iSelect(char *caBuf, int pos, char *title, char *name, + char *tagbegin, char *tagend, int stripco, int stripws, + int browsealways, int allselectable, + int multiselect, int exitnoselect, + char **keystr); + +/* + * GLOBALS + */ +struct Line *spaLines[MAXLINES]; /* filled by iSelect() */ +int nLines; + + +/* + * Strip leading and trailing blanks + * from a string buffer + */ +void strip(char *string) +{ + char *cps; + char *cp; + + if (string != NULL) { + /* strip leading blanks */ + cps = string; + cp = string; + for (; (*cp == ' ' || *cp == '\t') && *cp != NUL; ) + cp++; + if (cp > cps) { + for (; *cp != NUL; ) + *cps++ = *cp++; + *cps = NUL; + } + /* strip trailing blanks */ + cp = string+strlen(string); + for (; cp > string && (*(cp-1) == ' ' || *(cp-1) == '\t'); ) + *(--cp) = NUL; + } + return; +} + +/* + * Die gracefully... + */ +void diehard(void) +{ + signal(SIGINT, SIG_IGN); /* ignore all further interrupts */ + signal(SIGTERM, SIG_IGN); /* ignore all further interrupts */ +#ifndef USE_SLCURSES + mvcur(0, COLS-1, LINES-1, 0); /* move curser to lower left corner */ +#endif + endwin(); /* make terminal the way it was */ + exit(0); +} + +void diesoft(void) +{ +#ifndef USE_SLCURSES + mvcur(0, COLS-1, LINES-1, 0); /* move curser to lower left corner */ +#endif + endwin(); /* make terminal the way it was */ +} + +/* + * Startup with trapping of interrupt signal + */ +void setup(void) +{ + signal(SIGINT, (void (*))diehard); /* die gracefully on interrupt signal */ + signal(SIGTERM, (void (*))diehard); /* die gracefully on terminate signal */ + initscr(); /* initialize Curses package */ + return; +} + +/* + * Function to query an input string + */ +char *iSelect_InputField(int wYSize, int wXSize, int wYPos, int wXPos, int bAllowEmpty) +{ + WINDOW *wField; + int c; + int nBufEnd; + int nBufCurPos; + int nScrCurPos; + int bEOI; + char caBuf[1024]; + char *cpBuf; + int i; + + cpBuf = caBuf; + + wField = newwin(wYSize, wXSize, wYPos, wXPos); + keypad(wField, TRUE); + scrollok(wField, FALSE); + + nScrCurPos = 0; + nBufCurPos = 0; + nBufEnd = 0; + bEOI = FALSE; + + wmove(wField, 0, nScrCurPos); + while (bEOI == FALSE) { + c = wgetch(wField); + if (c >= KEY_MIN && c <= KEY_MAX) { + /* NOP */ + } + else { + c = c & 0xff; /* strip down to 8bit */ + if (c < 32 || c > 126) { + /* + * a control code + */ + if (c == '\n') { /* RETURN */ + if (nBufEnd == 0 && !bAllowEmpty) + continue; + cpBuf[nBufEnd] = '\0'; + bEOI = TRUE; + } + else if (c == 0x1b) { /* ESCAPE */ + strcpy(caBuf, "ESC"); + bEOI = TRUE; + } + else if (c == 0x04) { /* DELETE */ + waddch(wField, '?'); + wrefresh(wField); + } + else if (c == 0x7f) { /* BACKSPACE */ + if (nBufCurPos != 0) { + for (i = nBufCurPos; i < nBufEnd; i++) { + cpBuf[i-1] = cpBuf[i]; + } + cpBuf[i] = '\0'; + nBufEnd--; + nBufCurPos--; + + if (nScrCurPos == (wXSize-1) && nBufEnd >= (wXSize-1)) { + wmove(wField, 0, 0); + for (i = nBufEnd-(wXSize-1); i < nBufEnd; i++) { + waddch(wField, cpBuf[i]); + } + } + else { + nScrCurPos--; + wmove(wField, 0, nScrCurPos); + waddch(wField, ' '); + wmove(wField, 0, nScrCurPos); + } + wrefresh(wField); + } + } + } + if (c >= 32 && c <= 126) { + /* + * a printable character + */ + if (nScrCurPos == (wXSize-1)) { + wmove(wField, 0, 0); + for (i = nBufEnd-(wXSize-1)+1; i < nBufEnd; i++) { + waddch(wField, cpBuf[i]); + } + nScrCurPos--; /* neutralize following increment */ + } + cpBuf[nBufEnd++] = c; + nBufCurPos++; + nScrCurPos++; + waddch(wField, c); + wrefresh(wField); + } + } + } + + fflush(stdin); + delwin(wField); + + return strdup(caBuf); +} + +/* + * Function to draw a complete screen + */ +void iSelect_Draw(WINDOW *wField, + int wYSize, int wXSize, int wYPos, int wXPos, + int nAbsFirstLine, int nAbsLastLine, + int nRelMarked, + int nRelFirstDraw, int nRelLastDraw, + int nLines, + WINDOW *sField, char *title, char *name, + WINDOW *mField, char *msg, char *tagbegin, char *tagend) +{ + int i, j, k, mode; + int percent; + char ca[80]; + char boldbegin[1024]; + int nboldbegin; + char boldend[1024]; + int nboldend; + + /* + * create actual bold tags + */ + sprintf(boldbegin, "%sb%s", tagbegin, tagend); + nboldbegin = strlen(boldbegin); + sprintf(boldend, "%s/b%s", tagbegin, tagend); + nboldend = strlen(boldend); + + /* + * draw browser window + */ + for (i = nRelFirstDraw; i <= nRelLastDraw; i++) { + wmove(wField, i, 0); + wclrtoeol(wField); + mode = A_NORMAL; + if (spaLines[nAbsFirstLine+nRelFirstDraw+i]->fSelectable) + mode = mode | A_BOLD; + if (i == nRelMarked) +#ifdef USE_SLCURSES + mode = A_REVERSE; +#else + mode = mode | A_REVERSE; +#endif + wattrset(wField, mode); + if (spaLines[nAbsFirstLine+nRelFirstDraw+i]->fSelected) + waddstr(wField, "*"); + else + waddstr(wField, " "); /* cursor pos == first blank */ + for (j = k = 0; spaLines[nAbsFirstLine+nRelFirstDraw+i]->cpLine[j] != NUL && j <= (wXSize-1)-2;) { + if (strniEQ(&spaLines[nAbsFirstLine+nRelFirstDraw+i]->cpLine[j], boldbegin, nboldbegin)) { + mode = mode | A_BOLD; + wattrset(wField, mode); + j += nboldbegin; + continue; + } + if (strniEQ(&spaLines[nAbsFirstLine+nRelFirstDraw+i]->cpLine[j], boldend, nboldend)) { + mode = mode & ~A_BOLD; + wattrset(wField, mode); + j += nboldend; + continue; + } + waddch(wField, spaLines[nAbsFirstLine+nRelFirstDraw+i]->cpLine[j]); + j++; + k++; + } + for ( ; k <= (wXSize-1)-2; k++) + waddch(wField, ' '); + wattrset(wField, A_NORMAL); + } + wmove(wField, nRelMarked, (wXSize-1)-1); + + /* + * draw status bar + */ + werase(sField); + wattrset(sField, A_REVERSE); + wmove(sField, 0, 0); + for (i = 0; i < COLS; i++) { + waddch(sField, ' '); + } + + wmove(sField, 0, 1); + waddstr(sField, name); + + wmove(sField, 0, COLS-10); + percent = (int)(((nAbsFirstLine+nRelMarked)*100)/nLines); + if (1+nAbsFirstLine+nRelMarked == nLines) + percent = 100; + sprintf(ca, "%4d,%3d%%", 1+nAbsFirstLine+nRelMarked, percent); + waddstr(sField, ca); + + i = (COLS-1)/2-(strlen(title)/2); + wmove(sField, 0, i); + waddstr(sField, title); + + wattrset(sField, A_NORMAL); + wrefresh(sField); + + /* + * draw message field + */ + werase(mField); + wmove(mField, 0, 0); + waddstr(mField, msg); + wrefresh(mField); + + return; +} + +/* + * Function to do a complete selection screen + */ +int iSelect_Browser(int wYSize, int wXSize, int wYPos, int wXPos, int selectpos, int multiselect, + int sYSize, int sXSize, int sYPos, int sXPos, char *title, char *name, + int mYSize, int mXSize, int mYPos, int mXPos, + char **keystr, char *tagbegin, char *tagend) +{ + WINDOW *wField; + WINDOW *sField; + WINDOW *mField; + WINDOW *hField; + int i; + int nFirstLine, nLastLine; /* first & last line in buffer */ + int nAbsFirstLine, nAbsLastLine; /* first & last line of output buffer */ + int nRelMarked; /* relative line inside output buffer of marked line */ + int nRelFirstDraw, nRelLastDraw; /* relative first & last line inside output buffer */ + int c; + int bEOI; + int bQuit = FALSE; + int y; + int x; + char msg[1024]; + char ca[1024]; + char ca3[1024]; + char *cp; + char *cp2; + char *cp3; + char **cpp; + int ok; + int bAllowEmpty; + + /* + * Browser field + */ + wField = newwin(wYSize, wXSize, wYPos, wXPos); + werase(wField); + crmode(); + noecho(); + keypad(wField, TRUE); + scrollok(wField, FALSE); + + /* + * Status field + */ + sField = newwin(sYSize, sXSize, sYPos, sXPos); + werase(sField); + strcpy(msg, ""); + + /* + * Message field + */ + mField = newwin(mYSize, mXSize, mYPos, mXPos); + werase(mField); + + /* dimension of file */ + nFirstLine = 0; + nLastLine = nLines-1; + + /* determine curses select position */ + if (selectpos < -1) + selectpos = -1; + if (selectpos > nLastLine) + selectpos = nLastLine; + if (selectpos == -1) { + selectpos = 0; + /* search for first selectable line */ + for (i = nFirstLine; i < nLastLine; i++) { + if (spaLines[i]->fSelectable) { + selectpos = i; + break; + } + } + } + + /* calculate browser view borders */ + if (nLastLine < (wYSize-1)) { + /* buffer has fewer lines then our browser window */ + + nAbsFirstLine = nFirstLine; + nAbsLastLine = nLastLine; + nRelFirstDraw = 0; + nRelLastDraw = nLastLine-nFirstLine; + nRelMarked = selectpos; + } + else { + /* browser window is smaller then file */ + + /* find top view position, so adjust the + cursor into the middle of the browser window */ + y = selectpos - (int)((wYSize-1)/2); + if (y <= 0) + y = 0; + if (y+(wYSize-1) > nLastLine) + y = nLastLine-(wYSize-1); + + nAbsFirstLine = y; + nAbsLastLine = y+(wYSize-1); + nRelFirstDraw = 0; + nRelLastDraw = (wYSize-1); + nRelMarked = selectpos-y; + } + + + ok = FALSE; + for (i = nFirstLine; i < nLastLine; i++) { + if (spaLines[i]->fSelectable) { + ok = TRUE; + break; + } + } + if (!ok) + strcpy(msg, "WARNING! No lines selectable."); + + + bEOI = FALSE; + while (bEOI == FALSE) { + iSelect_Draw(wField, + wYSize, wXSize, wYPos, wXPos, + nAbsFirstLine, nAbsLastLine, + nRelMarked, + nRelFirstDraw, nRelLastDraw, + nLines, + sField, title, name, + mField, msg, + tagbegin, tagend); + wrefresh(wField); + strcpy(msg, ""); + c = wgetch(wField); + *keystr = key2asc(c); + c = do_custom_key(c); + if (c == KEY_LEFT) + c = 'q'; + if (c == KEY_RIGHT) + c = '\n'; + if (c >= KEY_MIN && c <= KEY_MAX) { + /* + * a curses special function key + */ + if (c == KEY_DOWN) { + if (nAbsFirstLine+nRelMarked < nAbsLastLine) { + nRelMarked++; + /* nRelFirstDraw=nRelMarked-1; !!OPTIMIZE!! */ + /* nRelLastDraw=nRelMarked; !!OPTIMIZE!! */ + } + else { + if (nAbsLastLine < nLastLine) { + wscrl(wField, 1); + nAbsFirstLine++; + nAbsLastLine++; + /* nRelFirstDraw=(wYSize-1); !!OPTIMIZE!! */ + /* nRelLastDraw=(wYSize-1); !!OPTIMIZE!!*/ + } + else { + strcpy(msg, "Already at End."); + } + } + } + else if (c == KEY_UP) { + if (nRelMarked > 0) { + nRelMarked--; + /* nRelLastDraw=nRelMarked; !!OPTIMIZE!! */ + /* nRelFirstDraw=nRelMarked+1; !!OPTIMIZE!! */ + } + else { + if (nAbsFirstLine > nFirstLine) { + wscrl(wField, -1); + nAbsFirstLine--; + nAbsLastLine--; + /* nRelFirstDraw=0 !!OPTIMIZE!! */ + /* nRelLastDraw=0; !!OPTIMIZE!! */ + } + else { + strcpy(msg, "Already at Begin."); + } + } + } + else if (c == KEY_NPAGE) { + if (nAbsFirstLine+nRelMarked == nLastLine) { + strcpy(msg, "Already at End."); + } + else { + for (i = 0; i < (wYSize-1); i++) { + if (nAbsFirstLine+nRelMarked < nAbsLastLine) + nRelMarked++; + else { + if (nAbsLastLine < nLastLine) { + wscrl(wField, 1); + nAbsFirstLine++; + nAbsLastLine++; + } + } + } + } + } + else if (c == KEY_PPAGE) { + if (nAbsFirstLine+nRelMarked == nFirstLine) { + strcpy(msg, "Already at Begin."); + } + else { + for (i = 0; i < (wYSize-1); i++) { + if (nRelMarked > 0) + nRelMarked--; + else { + if (nAbsFirstLine > nFirstLine) { + wscrl(wField, -1); + nAbsFirstLine--; + nAbsLastLine--; + } + } + } + } + } + else { + strcpy(msg, "Invalid special key. Press 'h' for Help Page!"); + } + } + else { + c = c & 0xff; /* strip down to 8bit */ + if (c < 32 || c > 126) { + /* + * a control code + */ + if (c == '\n' || c == '\r') { /* RETURN */ + if (spaLines[nAbsFirstLine+nRelMarked]->fSelectable) { + spaLines[nAbsFirstLine+nRelMarked]->fSelected = TRUE; + bEOI = TRUE; + } + else { + if (multiselect) { + for (i = 0; i < nLines; i++) { + if (spaLines[i]->fSelected) { + bEOI = TRUE; + break; + } + } + if (!bEOI) + strcpy(msg, "Line not selectable and still no others selected."); + } + else { + strcpy(msg, "Line not selectable."); + } + } + + /* additionally ask for query strings */ + if (bEOI == TRUE) { + cp = spaLines[nAbsFirstLine+nRelMarked]->cpResult; + cp2 = ca; + while (bEOI == TRUE && *cp != NUL) { + if (strnEQ(cp, "%[", 2)) { + cp += 2; + for (cp3 = cp; !strniEQ(cp3, "]s", 2); cp3++) + ; + strncpy(ca3, cp, cp3-cp); + ca3[cp3-cp] = NUL; + cp = cp3+1; + if (*cp == 's') + bAllowEmpty = TRUE; + else + bAllowEmpty = FALSE; + cp++; + + sprintf(msg, "%s: ", ca3); + iSelect_Draw(wField, wYSize, wXSize, wYPos, wXPos, nAbsFirstLine, nAbsLastLine, -1, nRelFirstDraw, nRelLastDraw, nLines, sField, title, name, mField, msg, tagbegin, tagend); + wrefresh(wField); + cp3 = iSelect_InputField(mYSize, mXSize-strlen(msg), mYPos, mXPos+strlen(msg), bAllowEmpty); + if (strEQ(cp3, "ESC")) { + bEOI = FALSE; + spaLines[nAbsFirstLine+nRelMarked]->fSelected = FALSE; + strcpy(msg, "Selection cancelled."); + continue; + } + strcpy(msg, ""); + strcpy(cp2, cp3); + cp2 += strlen(cp3); + } + else { + *cp2++ = *cp++; + } + } + if (bEOI == TRUE) { + *cp2 = NUL; + if (strNE(spaLines[nAbsFirstLine+nRelMarked]->cpResult, ca)) + spaLines[nAbsFirstLine+nRelMarked]->cpResult = strdup(ca); + } + } + } + } + if (c >= 32 && c <= 126) { + /* + * a printable character + */ + if (c == ' ') { + if (multiselect) { + if (spaLines[nAbsFirstLine+nRelMarked]->fSelectable) { + if (spaLines[nAbsFirstLine+nRelMarked]->fSelected == FALSE) + spaLines[nAbsFirstLine+nRelMarked]->fSelected = TRUE; + else + spaLines[nAbsFirstLine+nRelMarked]->fSelected = FALSE; + } + else { + strcpy(msg, "Line not selectable."); + } + } + else { + strcpy(msg, "No multi-line selection allowed."); + } + } + else if (c == 'q') { + bEOI = TRUE; + bQuit = TRUE; + } + else if (c == 'g') { + if (nAbsFirstLine+nRelMarked == nFirstLine) { + strcpy(msg, "Already at Begin."); + } + else { + if (nLastLine < (wYSize-1)) { + nAbsFirstLine = nFirstLine; + nAbsLastLine = nLastLine; + nRelFirstDraw = 0; + nRelLastDraw = nLastLine-nFirstLine; + nRelMarked = 0; + } + else { + nAbsFirstLine = nFirstLine; + nAbsLastLine = nFirstLine+(wYSize-1); + nRelFirstDraw = 0; + nRelLastDraw = (wYSize-1); + nRelMarked = 0; + } + } + } + else if (c == 'G') { + if (nAbsFirstLine+nRelMarked == nLastLine) { + strcpy(msg, "Already at End."); + } + else { + if (nLastLine < (wYSize-1)) { + nAbsFirstLine = nFirstLine; + nAbsLastLine = nLastLine; + nRelFirstDraw = 0; + nRelLastDraw = nLastLine-nFirstLine; + nRelMarked = nLastLine-nFirstLine; + } + else { + nAbsFirstLine = nLastLine-(wYSize-1); + nAbsLastLine = nLastLine; + nRelFirstDraw = 0; + nRelLastDraw = (wYSize-1); + nRelMarked = (wYSize-1); + } + } + } + else if (c == 'h' || c == 'v') { + if (c == 'h') + strcpy(msg, "Help Page: Press 'q' to exit"); + else + strcpy(msg, "Version Page: Press 'q' to exit"); + iSelect_Draw(wField, wYSize, wXSize, wYPos, wXPos, nAbsFirstLine, nAbsLastLine, nRelMarked, nRelFirstDraw, nRelLastDraw, nLines, sField, title, name, mField, msg, tagbegin, tagend); + wrefresh(wField); + + hField = newwin(wYSize, wXSize, wYPos, wXPos); + werase(hField); + if (c == 'h') + cpp = iSelect_Help; + else + cpp = iSelect_README; + for (y = 0; y < wYSize && cpp[y] != NULL; y++) { + sprintf(ca, cpp[y]); + cp = ca; + x = 0; + while (1) { + if ((cp2 = strstr(cp, "")) != NULL) { + *cp2 = NUL; + wmove(hField, y, x); waddstr(hField, cp); x += strlen(cp); + wattrset(hField, A_NORMAL|A_BOLD); + cp = cp2+3; + cp2 = strstr(cp, ""); + *cp2 = NUL; + wmove(hField, y, x); waddstr(hField, cp); x += strlen(cp); + wattrset(hField, A_NORMAL); + cp = cp2+4; + } + else { + wmove(hField, y, x); waddstr(hField, cp); + break; + } + } + } + wrefresh(hField); + while (1) { + c = wgetch(wField); + c = c & 0xff; /* strip down to 8bit */ + if (c == 'q') + break; + } + delwin(hField); + + nRelFirstDraw = 0; + nRelLastDraw = nAbsLastLine-nAbsFirstLine; + strcpy(msg, ""); + iSelect_Draw(wField, wYSize, wXSize, wYPos, wXPos, nAbsFirstLine, nAbsLastLine, nRelMarked, nRelFirstDraw, nRelLastDraw, nLines, sField, title, name, mField, msg, tagbegin, tagend); +#ifndef USE_SLCURSES + redrawwin(wField); +#endif + wrefresh(wField); + } + else { + strcpy(msg, "Invalid key. Press 'h' for Help Page!"); + } + } + } + } + + fflush(stdin); + echo(); +#ifndef USE_SLCURSES + nocrmode(); +#endif + delwin(wField); + + if (bQuit) + return(-1); + else + return(nAbsFirstLine+nRelMarked); +} + +/* + * The iSelect function... + */ +int iSelect(char *caBuf, int pos, char *title, char *name, + char *tagbegin, char *tagend, int stripco, int stripws, + int browsealways, int allselectable, + int multiselect, int exitnoselect, + char **keystr) +{ + WINDOW *wMain; + int i, j, k; + char ca[MAXLINELEN], ca2[MAXLINELEN]; + char ca3[MAXLINELEN]; + char *cp, *cps, *cpe; + struct Line *spLine; + int rc; + int ok; + + /* + * convert input buffer caBuf into + * spaLines array of browsable strings + */ + j = 0; + nLines = 0; + for (i = 0; caBuf[i] != NUL; i++) { + if (caBuf[i] != NL) { + /* line accumulation */ + ca[j++] = caBuf[i]; + } + else { + /* end of line accumulation reached, now convert it */ + ca[j++] = NUL; + j = 0; + + /* skip comment lines */ + if (stripco) { + if (strnEQ(ca, "#", 1)) + continue; + } + + spLine = (struct Line *)malloc(sizeof(struct Line)); + + sprintf(ca2, "%ss", tagbegin); + sprintf(ca3, "%sS", tagbegin); + if ( (cp = strstr(ca, ca2)) != NULL + || (cp = strstr(ca, ca3)) != NULL) { + /* is a selectable line */ + cps = cp; + cp += strlen(tagbegin)+1; + if (strnEQ(cp, ":", 1)) { + cp++; + for (k = 0; !strnEQ(cp, tagend, strlen(tagend)); k++) + ca2[k] = *cp++; + ca2[k] = NUL; + cpe = cp+strlen(tagend); + for (; *cpe != NUL; ) + *cps++ = *cpe++; + *cps = NUL; + } + else if (strnEQ(cp, tagend, strlen(tagend))) { + cpe = cp+strlen(tagend); + for (; *cpe != NUL; ) + *cps++ = *cpe++; + *cps = NUL; + strcpy(ca2, ca); + } + else { + CU(EX_FAIL); + } + spLine->cpLine = strdup(ca); + spLine->fSelectable = TRUE; + spLine->cpResult = strdup(ca2); + } + else { + /* is normal plain text line */ + spLine->cpLine = strdup(ca); + if (allselectable) + spLine->fSelectable = TRUE; + else + spLine->fSelectable = FALSE; + spLine->cpResult = strdup(ca); + } + + spLine->fSelected = FALSE; + if (stripws) + strip(spLine->cpResult); + spaLines[nLines++] = spLine; + } + } +#ifdef DEBUG + for (i = 0; i < nLines; i++) { + printf("spaLines[%d] = {\n", i); + printf(" cpLine = \"%s\"\n", spaLines[i]->cpLine); + printf(" fSelectable = %d\n", spaLines[i]->fSelectable); + printf(" cpResult = \"%s\"\n", spaLines[i]->cpResult); + printf("}\n"); + } +#endif + + if (!browsealways && nLines == 0) + CU(-1); + if (!browsealways && nLines == 1) { + spaLines[0]->fSelected = TRUE; + CU(0); + } + + if (exitnoselect) { + ok = FALSE; + for (i = 0; i < nLines; i++) { + if (spaLines[i]->fSelectable) { + ok = TRUE; + break; + } + } + if (!ok) + CU(-1); + } + + /* + * setup Curses package and + * open our own first window which holds the complete screen + */ + setup(); + wMain = newwin(LINES, COLS, 0, 0); + werase(wMain); + wrefresh(wMain); + + /* + * Now run the browser... + */ + rc = iSelect_Browser(/* Browser: */ LINES-2, COLS-2, 0, 1, pos, multiselect, + /* Status: */ 1, COLS, LINES-2, 0, title, name, + /* Message: */ 1, COLS-1, LINES-1, 0, + /* Result: */ keystr, + /* Tags: */ tagbegin, tagend); + + /* + * delete the main window and + * close Curses package + */ + werase(wMain); + wrefresh(wMain); + delwin(wMain); + diesoft(); + + CUS: + return rc; +} + +/*EOF*/ Index: ossp-pkg/iselect/iselect_browse.h RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_browse.h,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_browse.h,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_browse.h' 2>/dev/null --- ossp-pkg/iselect/iselect_browse.h +++ - 2024-04-25 08:53:01.951701892 +0200 @@ -0,0 +1,57 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_browse.h -- Curses-based file browser header +*/ + +/* + * The Structure of our screen lines + */ +struct Line { + char *cpLine; /* the input line */ + int fSelectable; /* whether selectable or not */ + int fSelected; /* whether already selected or not */ + char *cpResult; /* the result string */ +} Line; + +#define MAXLINELEN 1024 +#define MAXLINES 1024 +#define MAXBUF MAXLINELEN*MAXLINES + +extern struct Line *spaLines[MAXLINES]; +extern int nLines; + +/* + * Prototypes + */ +extern int iSelect(char *caBuf, int pos, char *title, char *name, + char *tagbegin, char *tagend, int stripco, int stripws, + int browsealways, int allselectable, + int multiselect, int exitnoselect, + char **keystr); + +/*EOF*/ Index: ossp-pkg/iselect/iselect_getopt.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_getopt.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_getopt.c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_getopt.c' 2>/dev/null --- ossp-pkg/iselect/iselect_getopt.c +++ - 2024-04-25 08:53:01.955055343 +0200 @@ -0,0 +1,1086 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_getopt.c -- GNU getopt() function +*/ + +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97 + Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in . + Ditto for AIX 3.2 and . */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#include "iselect_getopt.h" + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include +#include +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include +#include +#endif /* GNU C library. */ + +#ifdef VMS +#include +#if HAVE_STRING_H - 0 +#include +#endif +#endif + +#if defined (WIN32) && !defined (__CYGWIN32__) +/* It's not Unix, really. See? Capital letters. */ +#include +#define getpid() GetCurrentProcessId() +#endif + +#ifndef _ +/* This is for other GNU distributions with internationalized messages. + When compiling libc, the _ macro is predefined. */ +#ifdef HAVE_LIBINTL_H +# include +# define _(msgid) gettext (msgid) +#else +# define _(msgid) (msgid) +#endif +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* 1003.2 says this must be 1 before any call. */ +int optind = 1; + +/* Formerly, initialization of getopt depended on optind==0, which + causes problems with re-calling getopt as programs generally don't + know that. */ + +int __getopt_initialized = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return -1 with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +#ifdef _LIBC +/* Bash 2.0 gives us an environment variable containing flags + indicating ARGV elements that should not be considered arguments. */ + +/* Defined in getopt_init.c */ +extern char *__getopt_nonoption_flags; + +static int nonoption_flags_max_len; +static int nonoption_flags_len; + +static int original_argc; +static char *const *original_argv; + +extern pid_t __libc_pid; + +/* Make sure the environment variable bash 2.0 puts in the environment + is valid for the getopt call we must make sure that the ARGV passed + to getopt is that one passed to the process. */ +static void +__attribute__ ((unused)) +store_args_and_env (int argc, char *const *argv) +{ + /* XXX This is no good solution. We should rather copy the args so + that we can compare them later. But we must not use malloc(3). */ + original_argc = argc; + original_argv = argv; +} +text_set_element (__libc_subinit, store_args_and_env); + +# define SWAP_FLAGS(ch1, ch2) \ + if (nonoption_flags_len > 0) \ + { \ + char __tmp = __getopt_nonoption_flags[ch1]; \ + __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ + __getopt_nonoption_flags[ch2] = __tmp; \ + } +#else /* !_LIBC */ +# define SWAP_FLAGS(ch1, ch2) +#endif /* _LIBC */ + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +#if defined (__STDC__) && __STDC__ +static void exchange (char **); +#endif + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + +#ifdef _LIBC + /* First make sure the handling of the `__getopt_nonoption_flags' + string can work normally. Our top argument must be in the range + of the string. */ + if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) + { + /* We must extend the array. The user plays games with us and + presents new arguments. */ + char *new_str = malloc (top + 1); + if (new_str == NULL) + nonoption_flags_len = nonoption_flags_max_len = 0; + else + { + memcpy (new_str, __getopt_nonoption_flags, nonoption_flags_max_len); + memset (&new_str[nonoption_flags_max_len], '\0', + top + 1 - nonoption_flags_max_len); + nonoption_flags_max_len = top + 1; + __getopt_nonoption_flags = new_str; + } + } +#endif + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + SWAP_FLAGS (bottom + i, middle + i); + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +#if defined (__STDC__) && __STDC__ +static const char *_getopt_initialize (int, char *const *, const char *); +#endif +static const char * +_getopt_initialize (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + +#ifdef _LIBC + if (posixly_correct == NULL + && argc == original_argc && argv == original_argv) + { + if (nonoption_flags_max_len == 0) + { + if (__getopt_nonoption_flags == NULL + || __getopt_nonoption_flags[0] == '\0') + nonoption_flags_max_len = -1; + else + { + const char *orig_str = __getopt_nonoption_flags; + int len = nonoption_flags_max_len = strlen (orig_str); + if (nonoption_flags_max_len < argc) + nonoption_flags_max_len = argc; + __getopt_nonoption_flags = + (char *) malloc (nonoption_flags_max_len); + if (__getopt_nonoption_flags == NULL) + nonoption_flags_max_len = -1; + else + { + memcpy (__getopt_nonoption_flags, orig_str, len); + memset (&__getopt_nonoption_flags[len], '\0', + nonoption_flags_max_len - len); + } + } + } + nonoption_flags_len = nonoption_flags_max_len; + } + else + nonoption_flags_len = 0; +#endif + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns -1. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0 || !__getopt_initialized) + { + if (optind == 0) + optind = 1; /* Don't scan ARGV[0], the program name. */ + optstring = _getopt_initialize (argc, argv, optstring); + __getopt_initialized = 1; + } + + /* Test whether ARGV[optind] points to a non-option argument. + Either it does not have option syntax, or there is an environment flag + from the shell indicating it is not an option. The later information + is only used when the used in the GNU libc. */ +#ifdef _LIBC +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ + || (optind < nonoption_flags_len \ + && __getopt_nonoption_flags[optind] == '1')) +#else +#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') +#endif + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been + moved back by the user (who may also have changed the arguments). */ + if (last_nonopt > optind) + last_nonopt = optind; + if (first_nonopt > optind) + first_nonopt = optind; + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc && NONOPTION_P) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return -1; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if (NONOPTION_P) + { + if (ordering == REQUIRE_ORDER) + return -1; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = -1; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) + == (unsigned int) strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + optopt = 0; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) { + if (argv[optind - 1][1] == '-') { + /* --option */ + fprintf (stderr, + _("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + } + else { + /* +option or -option */ + fprintf (stderr, + _("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + } + } + + nextchar += strlen (nextchar); + + optopt = pfound->val; + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + optopt = pfound->val; + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, _("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + optopt = 0; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, _("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + /* Convenience. Treat POSIX -W foo same as long option --foo */ + if (temp[0] == 'W' && temp[1] == ';') + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound = 0; + int option_index; + + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + return c; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + + /* optarg is now the argument, see if it's in the + table of longopts. */ + + for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + if (pfound != NULL) + { + option_index = indfound; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + fprintf (stderr, _("\ +%s: option `-W %s' doesn't allow an argument\n"), + argv[0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + _("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + nextchar = NULL; + return 'W'; /* Let the application handle it. */ + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + _("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* Not ELIDE_CODE. */ + + +/* XX getopt1.c XX */ +/* XX getopt1.c XX */ +/* XX getopt1.c XX */ + + + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#define GETOPT_INTERFACE_VERSION 2 +#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2 +#include +#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION +#define ELIDE_CODE +#endif +#endif + +#ifndef ELIDE_CODE + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + +#endif /* Not ELIDE_CODE. */ + +/*EOF*/ Index: ossp-pkg/iselect/iselect_getopt.h RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_getopt.h,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_getopt.h,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_getopt.h' 2>/dev/null --- ossp-pkg/iselect/iselect_getopt.h +++ - 2024-04-25 08:53:01.958236720 +0200 @@ -0,0 +1,161 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_getopt.c -- GNU getopt() function headers +*/ + +/* Declarations for getopt. + Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns -1, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ Index: ossp-pkg/iselect/iselect_global.h RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_global.h,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_global.h,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_global.h' 2>/dev/null --- ossp-pkg/iselect/iselect_global.h +++ - 2024-04-25 08:53:01.960880495 +0200 @@ -0,0 +1,193 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_global.c -- global header +*/ + +#define EX__BASE 64 /* base value for error messages */ +#define EX_USAGE 64 /* command line usage error */ +#define EX_DATAERR 65 /* data format error */ +#define EX_NOINPUT 66 /* cannot open input */ +#define EX_NOUSER 67 /* addressee unknown */ +#define EX_NOHOST 68 /* host name unknown */ +#define EX_UNAVAILABLE 69 /* service unavailable */ +#define EX_SOFTWARE 70 /* internal software error */ +#define EX_OSERR 71 /* system error (e.g., can't fork) */ +#define EX_OSFILE 72 /* critical OS file missing */ +#define EX_CANTCREAT 73 /* can't create (user) output file */ +#define EX_IOERR 74 /* input/output error */ +#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +#define EX_PROTOCOL 76 /* remote error in protocol */ +#define EX_NOPERM 77 /* permission denied */ +#define EX_CONFIG 78 /* configuration error */ +#define EX__MAX 78 /* maximum listed value */ + +/* OK and FAIL exits should ALLWAYS exists */ +#ifndef EX_OK +#define EX_OK 0 +#endif +#ifndef EX_FAIL +#define EX_FAIL 1 +#endif + +#if __STDC__ +#define VOID void +#else +#define VOID char +#endif + +/* + * CU() -- CleanUp Makro + * implemented in a safety way + */ +#define DECL_EXRC int rc +#define ZERO 0 +#define STMT(stuff) do { stuff } while (ZERO) +#define CU(returncode) STMT( rc = returncode; goto CUS; ) +#define RETURN_EXRC return (rc) + +/* + * Yeah, here it comes...all ASCII control codes. + * Defined as their correct acronyms. + */ +#define ASC_NUL '\x00' +#define ASC_SOH '\x01' +#define ASC_STX '\x02' +#define ASC_ETX '\x03' +#define ASC_EOT '\x04' +#define ASC_ENQ '\x05' +#define ASC_ACK '\x06' +#define ASC_BEL '\x07' +#define ASC_BS '\x08' +#define ASC_HT '\x09' +#define ASC_LF '\x0a' +#define ASC_VT '\x0b' +#define ASC_FF '\x0c' +#define ASC_CR '\x0d' +#define ASC_SO '\x0e' +#define ASC_SI '\x0f' +#define ASC_DLE '\x10' +#define ASC_DC1 '\x11' +#define ASC_DC2 '\x12' +#define ASC_DC3 '\x13' +#define ASC_DC4 '\x14' +#define ASC_NAK '\x15' +#define ASC_SYN '\x16' +#define ASC_ETB '\x17' +#define ASC_CAN '\x18' +#define ASC_EM '\x19' +#define ASC_SUB '\x1a' +#define ASC_ESC '\x1b' +#define ASC_FS '\x1c' +#define ASC_GS '\x1d' +#define ASC_RS '\x1e' +#define ASC_US '\x1f' +#define ASC_SP '\x20' +#define ASC_DEL '\x7f' +#define NUL ASC_NUL + +#define ASC_QUOTE '\x22' +#define ASC_NL ASC_LF +#define NL ASC_NL + +/* define the boolean values in a general and + * portable way. + */ +#undef TRUE +#define TRUE (0 || !(0)) +#undef FALSE +#define FALSE (!(TRUE)) +/* typedef enum { false = FALSE, true = TRUE } bool; */ + +/* some other names for true and false */ +#define YES TRUE +#define NO FALSE + +#define GOOD TRUE +#define WRONG FALSE + +#undef OK +#define OK TRUE +#define BAD FALSE + +#define SOME TRUE +#define NONE FALSE + +/* + * define NULL if not already defined + */ +#ifndef NULL +#define NULL (void *)0 +#endif + + +/* define some handy str* functions + */ +#define strNE(s1, s2) (strcmp(s1, s2)) +#define strEQ(s1, s2) (!strcmp(s1, s2)) +#define strnNE(s1, s2, l) (strncmp(s1, s2, l)) +#define strnEQ(s1, s2, l) (!strncmp(s1, s2, l)) +#define strniNE(s1, s2, l) (strncasecmp(s1, s2, l)) +#define strniEQ(s1, s2, l) (!strncasecmp(s1, s2, l)) + + +/* message routines -- taken from the kpathsea 2.4 library lib.h file */ + +/* This should be called only after a system call fails. Don't exit + with status `errno', because that might be 256, which would mean + success (exit statuses are truncated to eight bits). */ +#define FATAL_PERROR(s) do { perror (s); exit (EX_FAIL); } while (0) + +#define START_FATAL() do { fputs ("fatal: ", stderr) +#define END_FATAL() fputs (".\n", stderr); exit (1); } while (0) +#define FATAL(str) \ + START_FATAL (); fputs (str, stderr); END_FATAL () +#define FATAL1(str, e1) \ + START_FATAL (); fprintf (stderr, str, e1); END_FATAL () +#define FATAL2(str, e1, e2) \ + START_FATAL (); fprintf (stderr, str, e1, e2); END_FATAL () +#define FATAL3(str, e1, e2, e3) \ + START_FATAL (); fprintf (stderr, str, e1, e2, e3); END_FATAL () +#define FATAL4(str, e1, e2, e3, e4) \ + START_FATAL (); fprintf (stderr, str, e1, e2, e3, e4); END_FATAL () +#define FATAL6(str, e1, e2, e3, e4, e5, e6) \ + START_FATAL (); fprintf (stderr, str, e1, e2, e3, e4, e5, e6); END_FATAL () + +#define START_WARNING() do { fputs ("warning: ", stderr) +#define END_WARNING() fputs (".\n", stderr); fflush (stderr); } while (0) +#define WARNING(str) \ + START_WARNING (); fputs (str, stderr); END_WARNING () +#define WARNING1(str, e1) \ + START_WARNING (); fprintf (stderr, str, e1); END_WARNING () +#define WARNING2(str, e1, e2) \ + START_WARNING (); fprintf (stderr, str, e1, e2); END_WARNING () +#define WARNING3(str, e1, e2, e3) \ + START_WARNING (); fprintf (stderr, str, e1, e2, e3); END_WARNING () +#define WARNING4(str, e1, e2, e3, e4) \ + START_WARNING (); fprintf (stderr, str, e1, e2, e3, e4); END_WARNING () + +/*EOF*/ Index: ossp-pkg/iselect/iselect_keys.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_keys.c,v co -q -kk -p'1.3' '/v/ossp/cvs/ossp-pkg/iselect/iselect_keys.c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_keys.c' 2>/dev/null --- ossp-pkg/iselect/iselect_keys.c +++ - 2024-04-25 08:53:01.963469233 +0200 @@ -0,0 +1,146 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_keys.c -- custom Curses Key definition +*/ + +#include "config_ac.h" +#include "config_sc.h" + +#include +#include +#include +#include +#ifdef USE_NCURSES +#include +#endif +#ifdef USE_SLCURSES +#include +#endif +#ifdef USE_CURSES +#include +#endif + +#include "iselect_global.h" +#include "iselect_keys.h" + +CustomKey *KeyList[1024] = { NULL }; + +typedef struct keydef { + char *str; + int key; +} keydef; + +keydef KeyDef[] = { + { "SPACE", ' ' }, + { "RETURN", '\n' }, + { "KEY_LEFT", KEY_LEFT }, + { "KEY_RIGHT", KEY_RIGHT }, + { "KEY_UP", KEY_UP }, + { "KEY_DOWN", KEY_DOWN }, + { "KEY_NPAGE", KEY_NPAGE }, + { "KEY_PPAGE", KEY_PPAGE }, + { NULL, 0 } +}; + +char *key2asc(int key) +{ + char ca[1024]; + int i; + + if (key >= 32 && key <= 126) { + ca[0] = (char)(key); + ca[1] = NUL; + return strdup(ca); + } + else { + for (i = 0; KeyDef[i].str != NULL; i++) { + if (KeyDef[i].key == key) + return strdup(KeyDef[i].str); + } + } + return "UNKNOWN"; +} + +int asc2key(char *str) +{ + int i; + + if (strlen(str) == 1 && (str[0] >= 32 && str[0] <= 126)) + return (int)(str[0]); + else { + for (i = 0; KeyDef[i].str != NULL; i++) { + if (strcmp(KeyDef[i].str, str) == 0) + return KeyDef[i].key; + } + fprintf(stderr, "ERROR\n"); + exit(1); + } +} + +void configure_custom_key(char *config) +{ + char out[1024]; + char in[1024]; + char *cp; + CustomKey *kc; + int i; + + if ((cp = strchr(config, ':')) != NULL) { + strncpy(in, config, cp-config); + in[cp-config] = NUL; + strcpy(out, cp+1); + } + else { + strcpy(in, config); + strcpy(out, "RETURN"); + } + + kc = (CustomKey *)malloc(sizeof(CustomKey)); + kc->in = asc2key(in); + kc->out = asc2key(out); + + for (i = 0; KeyList[i] != NULL; i++) + ; + KeyList[i++] = kc; + KeyList[i++] = NULL; + + return; +} + +int do_custom_key(int key) +{ + int i; + + for (i = 0; KeyList[i] != NULL; i++) { + if (KeyList[i]->in == key) + key = KeyList[i]->out; + } + return key; +} + +/*EOF*/ Index: ossp-pkg/iselect/iselect_keys.h RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_keys.h,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_keys.h,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_keys.h' 2>/dev/null --- ossp-pkg/iselect/iselect_keys.h +++ - 2024-04-25 08:53:01.966056595 +0200 @@ -0,0 +1,41 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_keys.h -- custom Curses keys +*/ + +typedef struct CustomKey { + int in; + int out; +} CustomKey; + +extern void configure_custom_key(char *config); +extern int do_custom_key(int key); +extern char *key2asc(int key); +extern int asc2key(char *key); + +/*EOF*/ Index: ossp-pkg/iselect/iselect_main.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_main.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_main.c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_main.c' 2>/dev/null --- ossp-pkg/iselect/iselect_main.c +++ - 2024-04-25 08:53:01.968605586 +0200 @@ -0,0 +1,297 @@ +/* _ ____ _ _ +** (_) ___| ___| | ___ ___| |_ +** / /\___ \ / _ \ |/ _ \/ __| __| +** / / ___) | __/ | __/ (__| |_ +** (_( |____/ \___|_|\___|\___|\__| +** +** iSelect -- Interactive Selection Tool +** +** iSelect is a Curses-based tool for interactive line selection +** in an ASCII file via a full-screen terminal session. +** +** ====================================================================== +** +** Copyright (c) 1997-2004 Ralf S. Engelschall. +** +** This program is free software; it may be redistributed and/or +** modified only under the terms of the GNU General Public License, +** which may be found in the iSelect source distribution. +** Look at the file COPYING for details. +** +** 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 the GNU General Public License for more details. +** +** ====================================================================== +** +** iselect_main.c -- main program +*/ + + +#include +#include +#include +#include +#include + +#include "iselect_global.h" +#include "iselect_getopt.h" +#include "iselect_browse.h" +#include "iselect_keys.h" + +#define _ISELECT_VERSION_C_AS_HEADER_ +#include "iselect_version.c" +#undef _ISELECT_VERSION_C_AS_HEADER_ + +void give_version(char *name); +void give_usage(char *name); + +void give_version(char *name) +{ + fprintf(stderr, "%s\n", iselect_version.v_tex); + fprintf(stdout, "Copyright (c) 1997-2000 Ralf S. Engelschall \n"); + fprintf(stdout, "\n"); + fprintf(stdout, "This program is distributed in the hope that it will be useful,\n"); + fprintf(stdout, "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"); + fprintf(stdout, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); + fprintf(stdout, "GNU General Public License for more details.\n"); + fprintf(stdout, "\n"); +} + +void give_usage(char *name) +{ + fprintf(stderr, "Usage: %s [options] [line1 line2 ...]\n", name); + fprintf(stderr, "\n"); + fprintf(stderr, " Input Options:\n"); + fprintf(stderr, " -d, --delimiter=STR,STR selection tag delimiters\n"); + fprintf(stderr, " -c, --strip-comments strip sharp-comments in input buffer\n"); + fprintf(stderr, " -f, --force-browse browse even if input has 0 or only 1 line\n"); + fprintf(stderr, " -a, --all-select force all lines to be selectable\n"); + fprintf(stderr, " -e, --exit-no-select exit immediately if no lines are selectable\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " Display Options:\n"); + fprintf(stderr, " -p, --position=NUM initial line position of cursor\n"); + fprintf(stderr, " -k, --key=KEY[:OKEY] enable an additional input key\n"); + fprintf(stderr, " -m, --multi-line allow multiple lines to be selected\n"); + fprintf(stderr, " -n, --name=STR program name shown flush-left on status bar\n"); + fprintf(stderr, " -t, --title=STR title string shown centered on status bar\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " Output Options:\n"); + fprintf(stderr, " -S, --strip-result strip whitespaces in result string\n"); + fprintf(stderr, " -P, --position-result prefix result string with `N:' (N=line number)\n"); + fprintf(stderr, " -K, --key-result prefix result string with `K:' (K=select key)\n"); + fprintf(stderr, " -Q, --quit-result=STR result string on quit (default='')\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " Giving Feedback:\n"); + fprintf(stderr, " -V, --version display version string\n"); + fprintf(stderr, " -h, --help display this page\n"); + fprintf(stderr, "\n"); +} + +struct option options[] = { + { "strip-comments", FALSE, NULL, 'c' }, + { "force-browse", FALSE, NULL, 'f' }, + { "all-select", FALSE, NULL, 'a' }, + { "exit-no-select", FALSE, NULL, 'e' }, + { "position", TRUE, NULL, 'p' }, + { "key", TRUE, NULL, 'k' }, + { "multi-line", FALSE, NULL, 'm' }, + { "name", TRUE, NULL, 'n' }, + { "title", TRUE, NULL, 't' }, + { "strip-result", FALSE, NULL, 'S' }, + { "position-result", FALSE, NULL, 'P' }, + { "key-result", FALSE, NULL, 'K' }, + { "quit-result", TRUE, NULL, 'Q' }, + { "version", FALSE, NULL, 'V' }, + { "help", FALSE, NULL, 'h' }, + { NULL, FALSE, NULL, '\0' }, +}; + +char caBuf[MAXBUF]; + +int main(int argc, char **argv) +{ + int fpStdout; + int fpStdin; + char *cp; + char c; + int pos = -1; + char *progname; + int nBuf, p; + char ca[1024]; + char *title = ""; + char *name = "iSelect"; + int stripco = FALSE; + int stripws = FALSE; + int resultline = FALSE; + int keyresultline = FALSE; + int browsealways = FALSE; + int allselectable = FALSE; + int multiselect = FALSE; + int exitnoselect = FALSE; + int i; + char *keystr; + char *abortstr = NULL; + char *tagbegin = "<"; + char *tagend = ">"; + + /* + * argument handling + */ + + /* canonicalize program name */ + if ((cp = strrchr(argv[0], '/')) != NULL) + progname = cp+1; + else + progname = argv[0]; + argv[0] = progname; + + /* parse the option arguments */ + opterr = 0; + while ((c = getopt_long(argc, argv, "d:cfaep:k:mn:t:SPKQ:Vh", options, NULL)) != (char)(-1)) { + if (optarg == NULL) + optarg = "(null)"; + switch (c) { + case 'd': + tagbegin = strdup(optarg); + if ((cp = strchr(tagbegin, ',')) == NULL) { + fprintf(stderr, "iSelect: bad argument to option '%c'\n", optopt); + fprintf(stderr, "Try `%s --help' for more information.\n", progname); + exit(EX_USAGE); + } + *cp++ = NUL; + tagend = cp; + break; + case 'c': + stripco = TRUE; + break; + case 'f': + browsealways = TRUE; + break; + case 'a': + allselectable = TRUE; + break; + case 'e': + exitnoselect = TRUE; + break; + case 'p': + pos = atoi(optarg); + break; + case 'k': + configure_custom_key(optarg); + break; + case 'm': + multiselect = TRUE; + break; + case 'n': + name = strdup(optarg); + break; + case 't': + title = strdup(optarg); + break; + case 'S': + stripws = TRUE; + break; + case 'P': + resultline = TRUE; + break; + case 'K': + keyresultline = TRUE; + break; + case 'Q': + abortstr = strdup(optarg); + break; + case 'V': + give_version(progname); + exit(EX_OK); + case 'h': + give_usage(progname); + exit(EX_OK); + case '?': + fprintf(stderr, "iSelect: invalid option: '%c'\n", optopt); + fprintf(stderr, "Try `%s --help' for more information.\n", progname); + exit(EX_USAGE); + case ':': + fprintf(stderr, "iSelect: missing argument to option '%c'\n", optopt); + fprintf(stderr, "Try `%s --help' for more information.\n", progname); + exit(EX_USAGE); + } + } + + /* + * read input + */ + + if (optind < argc) { + /* browsing text is given as arguments */ + nBuf = 0; + for (; optind < argc; ++optind) { + cp = (argv[optind] == NULL ? "" : argv[optind]); + sprintf(caBuf+nBuf, "%s\n", cp); + nBuf += strlen(cp)+1; + } + caBuf[nBuf++] = NUL; + } + else if (optind == argc && !feof(stdin)) { + /* browsing text is given on stdin */ + nBuf = 0; + while ((c = fgetc(stdin)) != (char)(EOF)) { + caBuf[nBuf++] = c; + } + caBuf[nBuf++] = NUL; + + /* save stdin filehandle and reconnect it to tty */ + fpStdin = dup(0); + close(0); + open("/dev/tty", O_RDONLY); + } + else { + give_usage(progname); + exit(EX_USAGE); + } + + /* + * preserve stdout filehandle for result string, i.e. + * use the terminal directly for output + */ + fpStdout = dup(1); + close(1); + open("/dev/tty", O_RDWR); + + pos = (pos < 1 ? 1 : pos); + + p = iSelect(caBuf, pos-1, title, name, + tagbegin, tagend, stripco, stripws, + browsealways, allselectable, multiselect, exitnoselect, &keystr); + + /* + * give back the result string to the user via + * the stdout file handle + */ + if (p != -1) { + for (i = 0; i < nLines; i++) { + if (spaLines[i]->fSelected) { + if (resultline) { + sprintf(ca, "%d:", i+1); + write(fpStdout, ca, strlen(ca)); + } + if (keyresultline) { + sprintf(ca, "%s:", keystr); + write(fpStdout, ca, strlen(ca)); + } + write(fpStdout, spaLines[i]->cpResult, strlen(spaLines[i]->cpResult)); + sprintf(ca, "\n"); + write(fpStdout, ca, strlen(ca)); + } + } + } + else { + if (abortstr != NULL) + write(fpStdout, abortstr, strlen(abortstr)); + } + exit(0); +} + + +/*EOF*/ Index: ossp-pkg/iselect/iselect_readme.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_readme.c,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_readme.c,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_readme.c' 2>/dev/null --- ossp-pkg/iselect/iselect_readme.c +++ - 2024-04-25 08:53:01.971290854 +0200 @@ -0,0 +1,42 @@ +/* iselect_readme.c -- automatically generated by asc2c */ + +#include + +char *iSelect_README[] = {\ +" _ ____ _ _ ", +" (_) ___| ___| | ___ ___| |_ ", +" / /\\___ \\ / _ \\ |/ _ \\/ __| __|", +" / / ___) | __/ | __/ (__| |_ ", +" (_( |____/ \\___|_|\\___|\\___|\\__|", +"", +" iSelect -- Interactive Selection Tool", +"", +" iSelect is an interactive line selection tool for ASCII files, operating", +" via a full-screen Curses-based terminal session. It can be used either as", +" an user interface frontend controlled by a Bourne-Shell/Perl/Tcl backend", +" as its control script or in batch mode as a pipeline filter (usually", +" between grep and the final executing command). ", +" ", +" Version 1.2.1 (25-Jul-2000)", +"", +" The latest release can be found on", +" http://www.ossp.org/pkg/tool/iselect/", +"", +" Copyright (c) 1997-2004 Ralf S. Engelschall ", +"", +" This program is free software; it may be redistributed and/or modified ", +" only under the terms of the GNU General Public License, which may be found ", +" in the iSelect source distribution. Look at the file COPYING for details. ", +"", +" 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 the GNU General Public ", +" License for more details.", +"", +" Ralf S. Engelschall", +" rse@engelschall.com", +" www.engelschall.com", +"", +NULL }; + +/*EOF*/ Index: ossp-pkg/iselect/iselect_readme.txt RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_readme.txt,v co -q -kk -p'1.2' '/v/ossp/cvs/ossp-pkg/iselect/iselect_readme.txt,v' | diff -u /dev/null - -L'ossp-pkg/iselect/iselect_readme.txt' 2>/dev/null --- ossp-pkg/iselect/iselect_readme.txt +++ - 2024-04-25 08:53:01.973805210 +0200 @@ -0,0 +1,34 @@ + _ ____ _ _ + (_) ___| ___| | ___ ___| |_ + / /\___ \ / _ \ |/ _ \/ __| __| + / / ___) | __/ | __/ (__| |_ + (_( |____/ \___|_|\___|\___|\__| + + iSelect -- Interactive Selection Tool + + iSelect is an interactive line selection tool for ASCII files, operating + via a full-screen Curses-based terminal session. It can be used either as + an user interface frontend controlled by a Bourne-Shell/Perl/Tcl backend + as its control script or in batch mode as a pipeline filter (usually + between grep and the final executing command). + + Version 1.3.0 (11-Sep-2004) + + The latest release can be found on + http://www.ossp.org/pkg/tool/iselect/ + + Copyright (c) 1997-2004 Ralf S. Engelschall + + This program is free software; it may be redistributed and/or modified + only under the terms of the GNU General Public License, which may be found + in the iSelect source distribution. Look at the file COPYING for details. + + 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 the GNU General Public + License for more details. + + Ralf S. Engelschall + rse@engelschall.com + www.engelschall.com + Index: ossp-pkg/iselect/iselect_version.c RCS File: /v/ossp/cvs/ossp-pkg/iselect/iselect_version.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/iselect/iselect_version.c,v' 2>/dev/null --- iselect_version.c 2000/07/25 11:53:25 1.3 +++ iselect_version.c 2004/09/11 15:18:49 1.4 @@ -1,31 +1,46 @@ /* -** iselect_version.c -- Version File (automatically generated and maintained by NEWVERS) +** iselect_version.c -- Version Information for iSelect (syntax: C/C++) +** [automatically generated and maintained by GNU shtool] */ -#ifdef AS_HEADER +#ifdef _ISELECT_VERSION_C_AS_HEADER_ -#ifndef ISELECT_VERSION_C -#define ISELECT_VERSION_C -#define iSelect_VERSION 0x102200 -extern const int iSelect_Version; -extern const char iSelect_VersionStr[]; -extern const char iSelect_Hello[]; -extern const char iSelect_GNUVersion[]; -extern const char iSelect_WhatID[]; -extern const char iSelect_RCSIdentID[]; -extern const char iSelect_WebID[]; -extern const char iSelect_PlainID[]; -#endif - -#else - -const int iSelect_Version = 0x102200; -const char iSelect_VersionStr[] = "1.2.0 (31-Mar-1999)"; -const char iSelect_Hello[] = "This is iSelect Version 1.2.0 (31-Mar-1999)"; -const char iSelect_GNUVersion[] = "iSelect Version 1.2.0"; -const char iSelect_WhatID[] = "@(#)iSelect Version 1.2.0 (31-Mar-1999)"; -const char iSelect_RCSIdentID[] = "$Id$"; -const char iSelect_WebID[] = "iSelect/1.2.0"; -const char iSelect_PlainID[] = "1.2.0"; +#ifndef _ISELECT_VERSION_C_ +#define _ISELECT_VERSION_C_ + +#define ISELECT_VERSION 0x103200 + +typedef struct { + const int v_hex; + const char *v_short; + const char *v_long; + const char *v_tex; + const char *v_gnu; + const char *v_web; + const char *v_sccs; + const char *v_rcs; +} iselect_version_t; + +extern iselect_version_t iselect_version; + +#endif /* _ISELECT_VERSION_C_ */ + +#else /* _ISELECT_VERSION_C_AS_HEADER_ */ + +#define _ISELECT_VERSION_C_AS_HEADER_ +#include "iselect_version.c" +#undef _ISELECT_VERSION_C_AS_HEADER_ + +iselect_version_t iselect_version = { + 0x103200, + "1.3.0", + "1.3.0 (11-Sep-2004)", + "This is iSelect, Version 1.3.0 (11-Sep-2004)", + "iSelect 1.3.0 (11-Sep-2004)", + "iSelect/1.3.0", + "@(#)iSelect 1.3.0 (11-Sep-2004)", + "$Id$" +}; + +#endif /* _ISELECT_VERSION_C_AS_HEADER_ */ -#endif