iselect-1.4.0/COPYING 644 0 0 4312710321014375 135460ustar osspiselect 0 0 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. iselect-1.4.0/ChangeLog 644 0 0 573510644127134 142560ustar osspiselect 0 0 C h a n g e L o g o f i S e l e c t ___________________________________________________________________________ Changes between 1.3.1 and 1.4.0 ------------------------------- 070708 o upgraded GNU shtool from 2.0.3 to 2.0.7 o adjusted year range in copyright messages o upgraded build environment to GNU autoconf 2.61 Changes between 1.3.0 and 1.3.1 ------------------------------- 051005 o upgraded GNU shtool from 2.0.1 to 2.0.3 o adjusted year range in copyright messages 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 ... iselect-1.4.0/INSTALL 644 0 0 232710321014375 135210ustar osspiselect 0 0 I N S T A L L A T I O N ======================= 1. Requirements Make sure you have a SVr4 compatible Curses library installed. If your vendor's Curses library is not of this type, then you have to install one of these free variants: - GNU NCurses, Version 4.2 or later ftp://ftp.clark.net/pub/dickey/ncurses/ (works best, so this is recommended to use) - S-Lang, Version 1.0.2 or later ftp://space.mit.edu/pub/davis/slang/ (works, but display is a little bit restricted) ATTENTION! The standard `old' BSD Curses library does _not_ work. So, under SunOS, HP-UX and other BSD-bases systems you really need GNU NCurses or S-Lang Curses installed. The modern BSD-variants like FreeBSD already have NCurses, of course. 2. Configuring the source $ ./configure --prefix=/path/to/iselect [--with-incdir=/path/to/{ncurses,slang}/include] [--with-libdir=/path/to/{ncurses,slang}/lib] 3. Build the program $ make 4. Install the program and manpage as /path/to/iselect/bin/iselect /path/to/iselect/man/man1/iselect.1 $ make install 5. Cleanup $ make distclean iselect-1.4.0/Makefile.in 644 0 0 1120710321014375 145520ustar osspiselect 0 0## ## Makefile -- iSelect Makefile ## @SET_MAKE@ # ------------------------------------------------ # DEFINITIONS # ------------------------------------------------ # compiler tools CC = @CC@ CFLAGS = @CFLAGS@ -I. LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ debug = @debug@ # installation tools SHTOOL = @SHTOOL@ # installation paths prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = ${exec_prefix}/man # ------------------------------------------------ # THE DEFAULT TARGETS # ------------------------------------------------ all: config iselect iselect.1 # ------------------------------------------------ # THE CONFIGURATION SUPPORT # ------------------------------------------------ config: configure config_ac.h.in configure: configure.in aclocal.m4 rm -f configure autoconf configure.in >configure chmod 770 configure config_ac.h.in: configure.in rm -f config_ac.h.in autoheader configure.in >config_ac.h.in # ------------------------------------------------ # THE RELEASE STUFF # ------------------------------------------------ _VERSION_FILE = \ 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 _TARBALL = \ $(SHTOOL) tarball -o $${NAME}.tar.gz -d $${NAME} -u ossp -g iselect \ -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 @V=`$(SHTOOL) version -l c -d short $(_VERSION_FILE)`; NAME="iselect-$$V-SNAP"; \ $(ECHO) "Rolling SNAPSHOT tarball $$NAME.tar.gz"; $(_TARBALL) new-version: @V="$(VERSION)"; \ if [ ".$$V" != . ]; then \ OPT="-s$$V"; \ else \ OPT="-e"; \ fi; \ $(_VERSION) update-version: @OPT="-s`$(SHTOOL) version -lc -dshort $(_VERSION_FILE)`" && $(_VERSION) fixperm: $(SHTOOL) fixperm * # ------------------------------------------------ # THE PROGRAM # ------------------------------------------------ iselect: iselect_main.o iselect_browse.o iselect_keys.o iselect_getopt.o iselect_version.o iselect_help.o iselect_readme.o $(CC) $(LDFLAGS) -o iselect iselect_main.o iselect_browse.o iselect_keys.o iselect_getopt.o iselect_version.o iselect_help.o iselect_readme.o @LIBS@ iselect_main.o: iselect_main.c $(CC) $(CFLAGS) -o iselect_main.o -c iselect_main.c iselect_browse.o: iselect_browse.c $(CC) $(CFLAGS) -o iselect_browse.o -c iselect_browse.c iselect_keys.o: iselect_keys.c $(CC) $(CFLAGS) -o iselect_keys.o -c iselect_keys.c iselect_getopt.o: iselect_getopt.c $(CC) $(CFLAGS) -o iselect_getopt.o -c iselect_getopt.c iselect_version.o: iselect_version.c $(CC) $(CFLAGS) -o iselect_version.o -c iselect_version.c iselect_help.o: iselect_help.c $(CC) $(CFLAGS) -o iselect_help.o -c iselect_help.c iselect_help.c: iselect_help.txt 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=`$(SHTOOL) version -l c -d long iselect_version.c`; \ ./etc/asc2c iselect_readme.txt iselect_readme iSelect_README "$$V" # ------------------------------------------------ # THE DOCUMENTATION # ------------------------------------------------ iselect.1: iselect.pod 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 \ --center="Ralf S. Engelschall" \ --release="EN" \ /tmp/iselect.pod >iselect.1 && \ rm -f /tmp/iselect.pod # ------------------------------------------------ # INSTALLATION # ------------------------------------------------ install: all $(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 # ------------------------------------------------ clean: -rm -f *.o -rm -f iselect -rm -f core *.core distclean: clean -rm -f config_ac.h config_sc.h -rm -f config.status config.cache config.log -rm -f Makefile ##EOF## iselect-1.4.0/PORTING 644 0 0 360610321014375 135360ustar osspiselect 0 0 P O R T I N G iSelect was written with portability in mind. Additionally to overcome the system dependend characteristics iSelect uses a GNU autoconf based configuration scheme which tries hard to determine the information. So iSelect already compiles out-of-the-box on a lot of systems. At least the following Unix/Compiler/Curses variants were sucessfully tested by the author in the past: System Platform Curses Compiler Testhost Time Vers. ------------- ---------- --------------- -------------- ---------- -------- ----- FreeBSD 2.1.5 i586/166 NCurses 4.0 GNU cc 2.7.2.3 en1 03.01.98 1.0.4 FreeBSD 2.1.5 i586/166 S-Lang 0.99-38 GNU cc 2.7.2.3 en1 03.01.98 1.0.4 FreeBSD 2.2.1 i586/90 NCurses 1.8.6 GNU cc 2.7.2p en3 23.11.97 1.0.2 FreeBSD 2.2.5 i586/90 NCurses 1.8.6 GNU cc 2.7.2.1 bsdti2 23.11.97 1.0.2 SunOS 4.1.3 SS20/61 NCurses 1.9.9e GNU cc 2.7.2 sunfi1 23.11.97 1.0.2 Solaris 2.5.1 SS10/41 SVr4.0 1.58 GNU cc 2.7.2.1 sunti5 23.11.97 1.0.2 AIX 4.1.4 RS6000/42T SVr4.0 1.60.2.8 GNU cc 2.7.2 rcs7 23.11.97 1.0.2 HP-UX 10.20 A9000/780 S-Lang 0.99-38 GNU cc 2.7.2.1 hpeickel15 23.11.97 1.0.2 IRIX 6.2 IP20 SVr4.0 1.58 GNU cc 2.7.2.1 sgihalle13 23.11.97 1.0.2 DU/OSF1 4.0 Alpha SV 4.2.9.14 GNU cc 2.7.2.1 rcs12 23.11.97 1.0.2 Linux 2.0.32 i586/90 NCurses 1.9.9e GNU cc 2.7.2.1 gw1 23.11.97 1.0.2 If your Unix derivate is not on this list, don't panic. As we said, iSelect tries to determine the information itself, so there is a good chance that iSelect finds alternatives even for your system. If it still fails to compile or run, first try to see where the problem resides. Usually problems can occur when you are using a brain-dead compiler or Curses version. Try to upgrade or use better variants. iselect-1.4.0/README 644 0 0 254310644126763 133650ustar osspiselect 0 0 _ ____ _ _ (_) ___| ___| | ___ ___| |_ / /\___ \ / _ \ |/ _ \/ __| __| / / ___) | __/ | __/ (__| |_ (_( |____/ \___|_|\___|\___|\__| 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.4.0 (08-Jul-2007) The latest release can be found on http://www.ossp.org/pkg/tool/iselect/ Copyright (c) 1997-2007 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 iselect-1.4.0/VERSIONS 644 0 0 33310644127247 136510ustar osspiselect 0 0 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 1.3.1 20051005 1.4.0 20070708 iselect-1.4.0/aclocal.m4 644 0 0 1774710321014375 143640ustar osspiselect 0 0dnl # 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 ]) iselect-1.4.0/config_ac.h.in 644 0 0 314710644127324 151660ustar osspiselect 0 0/* 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 iselect-1.4.0/config_sc.h.in 644 0 0 30010321014375 151450ustar osspiselect 0 0#ifndef SC_H #define SC_H /* ** ** sc.h -- STATIC configuration header file ** Copyright (c) Ralf S. Engelschall, ** */ #define prefix "@prefix@" #endif /* SC_H */ iselect-1.4.0/configure 755 0 0 44554710644127125 144640ustar osspiselect 0 0#! /bin/sh # From configure.in 1.0. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 (OpenPKG-CURRENT). # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 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 more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. 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 IFS=$as_save_IFS ;; 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_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= 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=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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 after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, 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 # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\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 sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' 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$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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'" exec 7<&0 &1 # 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` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="README" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef 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 datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP debug SET_MAKE SHTOOL GREP EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # 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 the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # 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 \`..'] 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] --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] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _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 LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective 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 ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested 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 else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.61 (OpenPKG-CURRENT) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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 fi cat >config.log <<_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.61 (OpenPKG-CURRENT). Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { 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` /usr/bin/hostinfo = `(/usr/bin/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 IFS=$as_save_IFS } >&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_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_arg'" ;; 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: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. 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, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r 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 -f -r conftest* 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 -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu 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-2007 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS 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 if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS 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 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 () { ; 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[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that 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' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that 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 { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 { 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 ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=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 -std 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 -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 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 for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac 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 test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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 nonexistent 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for compilation debug mode" >&5 echo $ECHO_N "checking for compilation debug mode... $ECHO_C" >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then enableval=$enable_debug; x="enabled" CFLAGS="-Wall -g" LDFLAGS="-g" debug=on else x=disabled CFLAGS="-O2" LDFLAGS="" debug=off 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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi { 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; } # Check whether --with-incdir was given. if test "${with_incdir+set}" = set; then withval=$with_incdir; CFLAGS="$CFLAGS -I$with_incdir" CPPFLAGS="$CPPFLAGS -I$with_incdir" x="$with_incdir" else x="none particular" 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 was given. if test "${with_libdir+set}" = set; then withval=$with_libdir; LDFLAGS="$LDFLAGS -L$with_libdir" x="$with_libdir" else x="none particular" fi { echo "$as_me:$LINENO: result: $x" >&5 echo "${ECHO_T}$x" >&6; } { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_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_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core 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 _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #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)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* 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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ;; 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 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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char initscr (); int main () { return initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 HAVE_NCURSES_LIB=NO fi if test "${ac_cv_header_slcurses_h+set}" = set; then { 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 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 _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.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;} ;; 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 test $ac_cv_header_slcurses_h = yes; then HAVE_SLCURSES_HEADER=YES else HAVE_SLCURSES_HEADER=NO fi OLIBS=$LIBS LIBS="$LIBS -ltermcap" { 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_check_lib_save_LIBS=$LIBS LIBS="-lslang $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 GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SLcurses_initscr (); int main () { return SLcurses_initscr (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 HAVE_SLCURSES_LIB=NO fi LIBS=$OLIBS if test ".$HAVE_NCURSES_HEADER.$HAVE_NCURSES_LIB." = .YES.YES.; then USE_NCURSES=YES cat >>confdefs.h <<\_ACEOF #define USE_NCURSES 1 _ACEOF LIBS="$LIBS -lncurses" { 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 <<\_ACEOF #define USE_SLCURSES 1 _ACEOF LIBS="$LIBS -lslang -ltermcap" { 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 <<\_ACEOF #define USE_CURSES 1 _ACEOF LIBS="$LIBS -lcurses" { 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 "$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 cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* 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"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 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; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { echo "$as_me:$LINENO: checking for 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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core 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 _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #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)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi for ac_header in stdio.h stddef.h string.h strings.h stdlib.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ;; esac { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: 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; } 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, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # 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. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # 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 # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. 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 IFS=$as_save_IFS ;; 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_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done 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) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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 after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, 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 # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\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 sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' 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$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # 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'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.61 (OpenPKG-CURRENT). Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF 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 and configuration settings, 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.61 (OpenPKG-CURRENT), with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' 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 $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 ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --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;; --he | --h) # Conflict between --help and --header { 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 ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { 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" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config_ac.h") CONFIG_HEADERS="$CONFIG_HEADERS config_ac.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "config_sc.h") CONFIG_FILES="$CONFIG_FILES config_sc.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 against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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 "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for 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 _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim CPP!$CPP$ac_delim debug!$debug$ac_delim SET_MAKE!$SET_MAKE$ac_delim SHTOOL!$SHTOOL$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 52; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # 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. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $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'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $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'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? 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&@top_builddir@&$ac_top_builddir_sub&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # Transform confdefs.h into a sed script `conftest.defines', that # substitutes the proper values into config.h.in to produce config.h. rm -f conftest.defines conftest.tail # First, append a space to every undef/define line, to ease matching. echo 's/$/ /' >conftest.defines # Then, protect against being on the right side of a sed subst, or in # an unquoted here document, in config.status. If some macros were # called several times there might be several #defines for the same # symbol, which is useless. But do not sort them, since the last # AC_DEFINE must be honored. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* # These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where # NAME is the cpp macro being defined, VALUE is the value it is being given. # PARAMS is the parameter list in the macro definition--in most cases, it's # just an empty string. ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' ac_dB='\\)[ (].*,\\1define\\2' ac_dC=' ' ac_dD=' ,' uniq confdefs.h | sed -n ' t rset :rset s/^[ ]*#[ ]*define[ ][ ]*// t ok d :ok s/[\\&,]/\\&/g s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p ' >>conftest.defines # Remove the space that was appended to ease matching. # Then replace #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. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # Break up conftest.defines: ac_max_sed_lines=50 # First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" # Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" # Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" # et cetera. ac_in='$ac_file_inputs' ac_out='"$tmp/out1"' ac_nxt='"$tmp/out2"' while : do # Write a here document: cat >>$CONFIG_STATUS <<_ACEOF # First, check the format of the line: cat >"\$tmp/defines.sed" <<\\CEOF /^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def /^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def b :def _ACEOF sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then echo "/* $configure_input */" >"$tmp/config.h" cat "$ac_result" >>"$tmp/config.h" 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 rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi iselect-1.4.0/configure.in 644 0 0 532010644127116 150030ustar osspiselect 0 0dnl ## dnl ## configure.in -- GNU autoconf configuration spec dnl ## Copyright (c) Ralf S. Engelschall dnl ## AC_PREREQ(2.61)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) 1997-2007 Ralf S. Engelschall " AC_CONFIG_HEADER(config_ac.h)dnl AC_PREFIX_DEFAULT(/usr/local) AC_CONFIGURE_PART(CHECK: Build Environment) AC_PROG_CC AC_PROG_CPP AC_MSG_CHECKING(for compilation debug mode) AC_ARG_ENABLE(debug,dnl [ --enable-debug to enable the debugging options for compilation], x="enabled" CFLAGS="-Wall -g" LDFLAGS="-g" debug=on , x=disabled CFLAGS="-O2" LDFLAGS="" debug=off )dnl AC_SUBST(debug) AC_MSG_RESULT([$x]) AC_SET_MAKE AC_SUBST(SHTOOL) AC_CONFIGURE_PART(CHECK: Curses Environment) AC_MSG_CHECKING(for additional include dir) AC_ARG_WITH(incdir,dnl [ --with-incdir=DIR add DIR to the include path], CFLAGS="$CFLAGS -I$with_incdir" CPPFLAGS="$CPPFLAGS -I$with_incdir" x="$with_incdir" , x="none particular" )dnl AC_MSG_RESULT([$x]) AC_MSG_CHECKING(for additional library dir) AC_ARG_WITH(libdir,dnl [ --with-libdir=DIR add DIR to the library path], LDFLAGS="$LDFLAGS -L$with_libdir" x="$with_libdir" , x="none particular" )dnl AC_MSG_RESULT([$x]) 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 LIBS="$LIBS -ltermcap" AC_CHECK_LIB(slang, SLcurses_initscr, HAVE_SLCURSES_LIB=YES, HAVE_SLCURSES_LIB=NO) LIBS=$OLIBS if test ".$HAVE_NCURSES_HEADER.$HAVE_NCURSES_LIB." = .YES.YES.; then USE_NCURSES=YES 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, 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, 1, [use plain Curses]) LIBS="$LIBS -lcurses" AC_MSG_CHECKING([which Curses to use]) AC_MSG_RESULT([Vendor Curses]) fi fi AC_CONFIGURE_PART(CHECK: System Ingredients) AC_CONST AC_STDC_HEADERS AC_HAVE_HEADERS(stdio.h stddef.h string.h strings.h stdlib.h) AC_CONFIGURE_PART(RESULT: Sourcefile Substitution) AC_OUTPUT(dnl Makefile dnl config_sc.h dnl ,dnl )dnl iselect-1.4.0/etc/asc2c 755 0 0 157010120613141 141540ustar osspiselect 0 0#!/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## iselect-1.4.0/etc/shtool 755 0 0 41665110644126611 145570ustar osspiselect 0 0#!/bin/sh ## ## GNU shtool -- The GNU Portable Shell Tool ## Copyright (c) 1994-2007 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.7 (19-May-2007) ## 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 ## # maximum Bourne-Shell compatibility if [ ".$ZSH_VERSION" != . ] && (emulate sh) >/dev/null 2>&1; then # reconfigure zsh(1) emulate sh NULLCMD=: alias -g '${1+"$@"}'='"$@"' elif [ ".$BASH_VERSION" != . ] && (set -o posix) >/dev/null 2>&1; then # reconfigure bash(1) set -o posix fi # maximum independence of NLS nuisances for 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 $var=C; export $var) 2>&1`"); then eval $var=C; export $var else unset $var fi done # initial command line handling 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.7 (19-May-2007)" echo 'Copyright (c) 1994-2007 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.7 (19-May-2007)" 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,\\.svn,\\.[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 # create (explicitly) secure temporary directory if [ ".$TMPDIR" != . ]; then tmpdir="$TMPDIR" elif [ ".$TEMPDIR" != . ]; then tmpdir="$TEMPDIR" else tmpdir="/tmp" fi tmpdir="$tmpdir/.shtool.$$" ( umask 077 rm -rf "$tmpdir" >/dev/null 2>&1 || true mkdir "$tmpdir" >/dev/null 2>&1 if [ $? -ne 0 ]; then echo "$msgprefix:Error: failed to create temporary directory \`$tmpdir'" 1>&2 exit 1 fi ) # create (implicitly) secure temporary file tmpfile="$tmpdir/shtool.tmp" touch "$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 -rf "$tmpdir" >/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-2007 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=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \ sed -e 'q' | sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \ sed -e 's/[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$userid" = . ]; then userid='?' fi 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=`(ypmatch "${username}" passwd; nismatch "${username}" passwd) 2>/dev/null | \ sed -e 'q' | sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid=`(nidump passwd . | grep "^${username}:") 2>/dev/null | \ sed -e 's/[^:]*:[^:]*:[^:]*://' -e 's/:.*$//'` if [ ".$groupid" = . ]; then groupid='?' fi 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; niscat group) 2>/dev/null | \ sed -e 'q' | grep "^[^:]*:[^:]*:${groupid}:" | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname=`(nidump group .) 2>/dev/null | \ grep "^[^:]*:[^:]*:${groupid}:" | \ sed -e 's/:.*$//'` if [ ".$groupname" = . ]; then groupname='?' fi 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-2007 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 # GNU ls changes its time format in response to the TIME_STYLE # variable. Since we cannot assume "unset" works, revert this # variable to its documented default. if [ ".$TIME_STYLE" != . ]; then TIME_STYLE=posix-long-iso export TIME_STYLE fi # 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-2007 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-2007 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-2007 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-2007 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-2007 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-2007 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="" allow_relative_srcpre=no if [ ".$prefix" != . ] && [ ".$prefix" != ./ ]; then allow_relative_srcpre=yes fi if [ $oneisabs = 0 ]; then allow_relative_srcpre=yes fi if [ ".$opt_s" != .yes ]; then allow_relative_srcpre=no fi if [ ".$allow_relative_srcpre" = .yes ]; 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-2007 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-2007 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-2007 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-2007 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-2007 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-2007 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="${AP}" if [ ".${AT}" = ".iX86" ]; then case "`(/sbin/sysctl -n hw.model) 2>&1`" 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" ;; esac fi # 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_//' |\ env -i 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 | env -i sort | \ 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]" ;; ubuntu ) n="Ubuntu[ GNU/Linux]" ;; fedora ) n=" Core[ GNU/Linux]" ;; suse ) n="SuSE[ Linux]" ;; mandrake*|mandriva ) n="Mandriva[ 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" case "`(/bin/isainfo -k) 2>&1`" in amd64 ) AT="AMD64" ;; esac ;; esac AP="${AT}" case "${AP}" in sun4[cdm] ) AP="SPARC32" ;; sun4[uv] ) 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 elif [ -d /QOpenSys ]; then # IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment) cpu_arch=powerpc fi if [ -x /usr/bin/oslevel ]; then os_level=`/usr/bin/oslevel` else os_level="`uname -v`.`uname -r`" 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 ]${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-2007 Ralf S. Engelschall ## ar_prg="$opt_C" ar_cmd="$1"; shift archive="$1"; shift files="$*" # walk through the file list and expand archives members ar_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 $ar_tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "mkdir $ar_tmpdir" 1>&2 fi mkdir $ar_tmpdir fi case $ar_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 $ar_tmpdir && $ar_prg x $from)" 1>&2 fi (cd $ar_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 $ar_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 $ar_tmpdir ]; then if [ ".$opt_t" = .yes ]; then echo "rm -rf $ar_tmpdir" 1>&2 fi rm -rf $ar_tmpdir fi shtool_exit 0 ;; slo ) ## ## slo -- Separate linker options by library class ## Copyright (c) 1998-2007 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-2007 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-2007 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: shtool,v 1.4 2007/07/08 09:25:29 rse Exp ${name} ${triple} (${tim}) \$" # determine string out of filename # (do NOT try to optimize this in any way because of portability) filestr=`util_upper "$file" | tr './%+' '____' | sed -e 's/-/_/g'` # generate uppercase prefix prefixupper=`util_upper "$prefix"` # 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 "our \$${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-2007 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 iselect-1.4.0/example/README 644 0 0 452 6443523730 147520ustar osspiselect 0 0 Here you can find some tools which are based on iSelect. chdir ........ Interactive ``cd'' for Bash melm ......... MetaELM, an ELM frontend mtin ......... MetaTIN, a TIN frontend scvs ......... Switch CVS Repository ilogin ....... Interactive Login gotourl ...... Goto URL for VIM iselect-1.4.0/example/chdir/README 644 0 0 134 6416417577 160530ustar osspiselect 0 0 This is a snippet for Bash's .bashrc file which provides a iSelect-based chdir command. iselect-1.4.0/example/chdir/dot.bashrc 644 0 0 1263 6416435202 171520ustar osspiselect 0 0## ## .bashrc snippet for iSelect-based 'cd' command ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## # database scan cds () { (cd $HOME; find . -type d -print |\ sed -e "s;^\.;$HOME;" |\ sort -u >$HOME/.dirs ) & } # enhanced cd command cd () { if [ -d $1 ]; then builtin cd $1 else builtin cd `egrep "/$1[^/]*$" $HOME/.dirs |\ iselect -a -Q $1 -n "chdir" -t "Change Directory to..."` fi PS1="\u@\h:$PWD\n:> " } # make sure we stay at $HOME and # that prompt gets initialized cd # change to parent dir alias -- -='cd ..' # change to last dir alias .='cd $OLDPWD' ##EOF## iselect-1.4.0/example/gotourl/dot.gotourlrc 644 0 0 400 6443523366 203130ustar osspiselect 0 0## ## ~/.gotourlrc -- GotoURL RC File ## ^ftp://.+/$ cftp %U ^ftp://.+[^/]$ lftp %U ^(http|ftp)://.+ /usr/local/bin/lynx %U ^(http|ftp)://.+ /usr/local/bin/netscape -remote 'openURL(%U)' ^(http|ftp)://.+[^/]$ fetch %U ##EOF## iselect-1.4.0/example/gotourl/dot.vimrc 644 0 0 72 6443523454 173760ustar osspiselect 0 0 " Goto URL under Cursor map u yE:!gotourl """ iselect-1.4.0/example/gotourl/gotourl 755 0 0 2154 6511731470 172250ustar osspiselect 0 0#!/sw/bin/perl ## ## GotoURL -- go to a particular URL ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## $url = $ARGV[0]; $tmpfile = "/tmp/tmp.gotourl.cf"; @RC = (); open(RC, "<$ENV{'HOME'}/.gotourlrc"); while () { next if (m|^\s*#.*|); next if (m|^\s*$|); if (m|^(\S+)\s+(.+)$|) { push(@RC, { PAT => $1, CMD => $2 }); } } close(RC); unlink($tmpfile); open(FP, ">$tmpfile"); print FP "\n"; print FP "URL: $url\n"; print FP "\n"; print FP "Available clients for this URL type:\n"; print FP "\n"; foreach $rc (@RC) { if ($url =~ m|$rc->{PAT}|) { $cmd = $rc->{CMD}; $cmd =~ s|%U|$url|g; $txt = $rc->{CMD}; $txt =~ s|%U|...|g; print FP sprintf("%s \n", $txt, $cmd); } } print FP <<'EOT'; _____________________________________________________ Help: , .......... browse client list , ..... select client q, ............. quit EOT close(FP); $client = `iselect -n 'GotoURL 1.0' -t 'Select Client...' -p6 <$tmpfile`; unlink($tmpfile); if ($client ne '') { system("$client"); } ##EOF## iselect-1.4.0/example/ilogin/README 644 0 0 67 6417646343 162240ustar osspiselect 0 0 This is iLogin, a interactive login selection tool. iselect-1.4.0/example/ilogin/dot.bashrc 644 0 0 157 6454177240 173320ustar osspiselect 0 0 l () { cmd=`ilogin`; if [ ".$cmd" != . ]; then echo "\$ $cmd"; eval $cmd; fi } iselect-1.4.0/example/ilogin/dot.ilogin 644 0 0 1315 6426056075 173670ustar osspiselect 0 0## ## ~/.ilogin -- iLogin configuratiion ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## @CFG = ( { AREA => "FOO", HOSTS => [ { NAME => 'bar@baz.quux.com', INFO => 'Quux', TYPE => 'ssh', OPT => '-l bar baz.quux.com' }, { NAME => 'bar@baz.quux.com', INFO => 'Quux', TYPE => 'rlogin', OPT => '-K -l root baz.quux.com' }, { NAME => 'bar@baz.quux.com', INFO => 'Quux', TYPE => 'expect', OPT => [ 'eval spawn telnet baz.quux.com', 'expect ogin:', 'send "bar\r"', 'expect sword:', 'send XXXXXXX\r"', 'interact' ] }, ] } ); ##EOF## iselect-1.4.0/example/ilogin/ilogin 755 0 0 3335 6511731711 166010ustar osspiselect 0 0#!/sw/bin/perl ## ## iLogin -- interactive login ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## require "$ENV{HOME}/.ilogin"; $tmpfile = "/tmp/tmp.ilogin.$$"; unlink($tmpfile); open(FP, ">$tmpfile"); %LOGINCMD = (); %FTPCMD = (); foreach $l (@CFG) { $area = $l->{AREA}; $hosts = $l->{HOSTS}; print FP "\n"; print FP "$area:\n"; foreach $h (@{$hosts}) { $name = $h->{NAME}; $info = $h->{INFO}; $os = $h->{OS}; $type = $h->{TYPE}; $opt = $h->{OPT}; $passwd = $h->{PASSWD} || "$ENV{'LOGIN'}"; $home = $h->{HOME} || "/"; if ($type eq 'ssh') { $cmd = "ssh $opt"; } elsif ($type eq 'rlogin') { $cmd = "rlogin $opt"; } elsif ($type eq 'expect') { $cmd = "expect -c 'set timeout 30'"; foreach $c (@{$opt}) { $cmd .= " -c '".$c."'"; } } $LOGINCMD{$name} = $cmd; ($login, $host) = ($name =~ m|^(.+)@(.+)$|); if ($login eq 'ftp' or $login eq 'anonymous') { $user = ''; } else { $user = "$login:$passwd\@"; } $FTPCMD{$name} = "cftp ftp://$user$host$home"; print FP sprintf("%-33s %-15s %-20s %6s \n", $name, $info, $os, $type, $name); } } close(FP); $rc = `iselect -n iLogin -t 'Select Remote Host...' -p3 -K -kf:RETURN <$tmpfile`; if ($rc ne '') { $rc =~ m|^(.+?):(.*)|; ($key, $name) = ($1, $2); if ($key eq 'RETURN' or $key eq 'KEY_RIGHT') { # Terminal Session print $LOGINCMD{$name}; } elsif ($key eq 'f') { # FTP Session print $FTPCMD{$name}; } } unlink($tmpfile); ##EOF## iselect-1.4.0/example/melm/README 644 0 0 377 6416420034 157030ustar osspiselect 0 0 This is MetaELM, an ELM frontend which lets one choose between different mail folders. When selecting a folder ELM itself is started on it. The ``xmelm'' command is just a X11 wrapper script to run melm in a huge X window with a ISO Latin 1 font. iselect-1.4.0/example/melm/melm 755 0 0 4414 6511731535 157260ustar osspiselect 0 0#!/sw/bin/perl ## ## MetaELM -- ELM frontend ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## require 5.003; use Date::Parse; use Date::Format; # # configuration # $melmrc = "$ENV{'HOME'}/.melmrc"; # # read rc-file # if (not -f $melmrc) { print STDERR "** mElm:Error: no ``$melmrc'' found. Please create one first.\n"; exit(1); } @MAILFOLDER = (); open(RC, "<$melmrc") || die; while () { next if (m|^\s*$|); next if (m|^\s*#.*$|); if (m|^\s*(/\S+)\s+(.+?)\s*$|) { push(@MAILFOLDER, { FOLDER => $1, NAME => $2 }); } else { print STDERR "** mElm:Error: bad RC-file entry:\n"; print STDERR "** mElm:Error: $_"; exit(1); } } close(RC); # # determine informations # foreach $entry (@MAILFOLDER) { ($name, $folder) = ($entry->{NAME}, $entry->{FOLDER}); @F = `from -f $folder`; $time = $F[$#F]; $time =~ s|^From\s+\S+\s+(.+)\s*|$1|; $time = str2time($time); $entry->{TIME} = $time; $entry->{MAILS} = $#F+1; } # # processing loop # $pos = 4; while (1) { $L = '"" ' . '"Available Folders: '. sprintf("%d", $#MAILFOLDER + 1) .'" ' . '"" '; $n = 1; foreach $entry (@MAILFOLDER) { ($name, $folder, $time, $mails) = ($entry->{NAME}, $entry->{FOLDER}, $entry->{TIME}, $entry->{MAILS}); $L .= sprintf("\"%2d %-20s (%3d) %s %2d \" ", $n++, $name, $mails, time2str("%a", $time), time2str("%d", $time)); } $L .= "'' "; $L .= "'_____________________________________________________' "; $L .= "'' "; $L .= "'Help: , .......... browse folder list' "; $L .= "' , ..... select folder (run ELM)' "; $L .= "' q, ............. quit' "; $rc=`iselect -n "MetaELM 1.0.0" -t "Electronic Mail Folders" -p$pos -P $L`; if ($rc eq '') { print "**Exit\n"; last; } $rc =~ m|^(\d+):(.*)|; ($pos, $cmd) = ($1, $2); system($cmd); # update entry $entry = $MAILFOLDER[$pos-4]; $folder = $entry->{FOLDER}; @F = `from -f $folder`; $time = $F[$#F]; $time =~ s|^From\s+\S+\s+(.+)\s*|$1|; $time = str2time($time); $entry->{TIME} = $time; $entry->{MAILS} = $#F+1; } # die gracefully exit(0); ##EOF## iselect-1.4.0/example/melm/xmelm 755 0 0 613 6416417632 160760ustar osspiselect 0 0#!/bin/sh ## ## xmelm -- X11 frontend for MELM ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## xterm=`which color_xterm` if [ ".$xterm" = . ]; then xterm="xterm"; fi exec $xterm \ -fn '-adobe-courier-medium-r-normal-*-*-140-*-iso8859-1' \ -geometry 105x45+20+20 -cr darkblue -bg lightsteelblue -fg black \ -T "Electronic Mail (MetaELM)" \ -e melm ##EOF## iselect-1.4.0/example/mtin/README 644 0 0 405 6416420110 157030ustar osspiselect 0 0 This is MetaTIN, a TIN frontend which lets one choose between different newsgroup clusters. When selecting a cluster TIN itself is started on it. The ``xmtin'' command is just a X11 wrapper script to run mtin in a huge X window with a ISO Latin 1 font. iselect-1.4.0/example/mtin/mtin 755 0 0 12170 6511731571 157760ustar osspiselect 0 0#!/sw/bin/perl ## ## MetaTIN -- a TIN frontend for better USENET NetNews reading ## Copyright (c) 1996-1997 Ralf S. Engelschall, All Rights Reserved. ## use IO::Socket; sub existsgroup { local ($host, $group) = @_; local ($NNTP); $NNTP = new IO::Socket::INET( 'PeerAddr' => $host, 'PeerPort' => 'nntp', 'Proto' => 'tcp', 'Timeout' => 120 ); $NNTP->autoflush(1); $NNTP->getline(); # greating $NNTP->print("mode reader\r\n"); $NNTP->getline(); # greating $NNTP->print("group $group\r\n"); $rc = $NNTP->getline(); # greating $rc =~ m|^(\d+) .+|; $rc = $1; $NNTP->print("quit\r\n"); $NNTP->close(); return ($rc == 211 ? 1 : 0); } # determine homedir of caller $HOME = $ENV{'HOME'}; # the files we operate on $newsrc = "$HOME/.mtinrc"; $newsrcwork = "$HOME/.newsrc"; # function to get the topics out of the annotated newsrc sub NEWSRC_GetTopics { local (%NewsgroupTopic) = (); $cnt = 1; open(FP, "<$newsrc"); while () { next if m|^[ \t]*#.*$|; next if m|^[ \t]*$|; if (m|^%%T[ \t]+(.*)$|) { $topic_tag = $1; $topic_name = ""; $newsgroups_sub = 0; $newsgroups_unsub = 0; next; } if (m|^%%N[ \t]+(.*)$|) { $topic_name = $1; next; } if (m|^[a-zA-Z0-9-.]+!.*$|) { $newsgroups_unsub++; next; } if (m|^[a-zA-Z0-9-.]+:.*$|) { $newsgroups_sub++; next; } if (m|^%%E[ \t]*$|) { $key = sprintf("%02d-%s", $cnt, $topic_tag); $NewsgroupTopic{$key} = "$topic_name%%$newsgroups_sub%%$newsgroups_unsub"; $cnt++; } } close(FP); return (%NewsgroupTopic); } sub NEWSRC_GetTopicPart { local($tag) = @_[0]; local($buffer); local($save); open(FP, "<$newsrc"); $save = 0; while () { next if m|^[ \t]*#.*$|; next if m|^[ \t]*$|; if (m|^%%T[ \t]+(.+)[ \t]*$|) { if ("$1" eq "$tag") { $save = 1; } } if (m|^%%E.*$|) { $save = 0; } if ($save) { next if m|^%%.*|; $buffer .= $_; } } close(FP); return($buffer); } sub NEWSRC_SetTopicPart { local($tag, $buffer) = @_; local($save); open(FPI, "<$newsrc"); open(FPO, ">${newsrc}.n"); $set = 0; $ignore = 0; while () { if (m|^%%N.*$|) { print FPO $_; next; } if (m|^%%T[ \t]+(.+)[ \t]*$|) { if ("$1" eq "$tag") { $set = 1; $ignore = 0; print FPO $_; next; } } if (m|^%%E.*$|) { $set = 0; $ignore = 0; print FPO $_; next; } if ($set) { if ($ignore == 0) { print FPO "$buffer"; $ignore = 1; } } else { print FPO "$_"; } } close(FPI); close(FPO); system("mv $newsrc ${newsrc}.bak"); system("mv ${newsrc}.n $newsrc"); } %NewsgroupTopic = &NEWSRC_GetTopics(); $clusters = 0; foreach $key (sort(keys(%NewsgroupTopic))) { $clusters++; } $itemlist = "'' "; $itemlist .= "'Available Clusters: $clusters, Newsserver: $ENV{NNTPSERVER}' "; $itemlist .= "'' "; $n = 1; foreach $key (sort(keys(%NewsgroupTopic))) { $NewsgroupTopic{$key} =~ m|^(.+)%%(.+)%%(.+)$|; ($name, $countsub, $countunsub) = ($1, $2, $3); $key =~ s|^\d+-||; $itemlist .= sprintf("'%2d %3d %-15s %-50s ' ", $n, $countsub, $key, $name, $key); $n++; } $itemlist .= "'' "; $itemlist .= "'_____________________________________________________' "; $itemlist .= "'' "; $itemlist .= "'Help: , .......... browse cluster list' "; $itemlist .= "' , ..... select cluster (run TIN)' "; $itemlist .= "' q, ............. quit' "; $result = "/tmp/mtin.$$.tmp"; $quit = 0; $pos = 4; while ($quit ne 1) { # run the fullscreen menu via iSelect $rc = system("iselect -p$pos -P -n 'MetaTIN 1.0.0' -t 'USENET Newsgroup Clusters' $itemlist >$result"); $tag = `cat $result`; if ($tag eq '') { $quit = 1; next; } $tag =~ s|\n$||; $tag =~ m|^(\d+):(.*)|; ($pos, $tag) = ($1, $2); # copy topic from .mtinrc to newsrc $buffer = &NEWSRC_GetTopicPart($tag); open(FP, ">$newsrcwork"); print FP $buffer; close(FP); # run TIN on the newsrc system("clear"); system("tin -r -q -f $newsrcwork"); # copy changed topic back to .mtinrc $buffer = ""; open(FP, "<$newsrcwork"); while () { #if (m|^([^ \t:!\n]+)|) { # if (not &existsgroup("$ENV{'NNTPSERVER'}", "$1")) { # print STDERR "WARNING! group $1 not exists - REMOVED\n"; # next; # } #} $buffer .= $_; } close(FP); &NEWSRC_SetTopicPart($tag, $buffer); } unlink($result); ##EOF## iselect-1.4.0/example/mtin/xmtin 755 0 0 612 6416420047 161210ustar osspiselect 0 0#!/bin/sh ## ## xmtin -- X11 frontend for MTIN ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## xterm=`which color_xterm` if [ ".$xterm" = . ]; then xterm="xterm"; fi exec $xterm \ -fn '-adobe-courier-medium-r-normal-*-*-140-*-iso8859-1' \ -geometry 105x45+20+20 -cr darkblue -bg lightsteelblue -fg black \ -T "USENET NetNews (MetaTIN)" \ -e mtin ##EOF## iselect-1.4.0/example/scvs/README 644 0 0 217 6416435333 157300ustar osspiselect 0 0 This is sCVS, a tool to switch the CVS repository for a checked out CVS tree. The selection of the new repository is done via iSelect. iselect-1.4.0/example/scvs/dot.scvsrc 644 0 0 364 6423326574 170720ustar osspiselect 0 0## ## .scvsrc -- SCVS config for Apache CVS trees ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## dev.apache.org:/export/home/cvs (Apache Original, USA) /e/apache/REPOS (Apache CVSup Copy, LOCAL) ##EOF## iselect-1.4.0/example/scvs/scvs 755 0 0 7771 6511731631 160040ustar osspiselect 0 0#!/sw/bin/perl ## ## sCVS -- Switch CVS Repository ## Copyright (c) 1997 Ralf S. Engelschall, All Rights Reserved. ## require 5.004; use Term::Cap; use File::PathConvert; use IO::File 1.06; use Cwd; ## ## 1. Determine terminal capabilities ## $term = Tgetent Term::Cap { TERM => undef, OSPEED => 9600 }; $bold = $term->Tputs('md', 1, undef); $norm = $term->Tputs('me', 1, undef); ## ## 2. Find .scvsrc files and read contents into %CVSROOTS hash ## %CVSROOTS = (); # determine canonical path sub canonical_path { my ($path) = @_; my ($pathL); $pathL = ''; while ($path ne $pathL) { $pathL = $path; $path =~ s|//|/|g; $path =~ s|/\./|/|g; $path =~ s|/\.$|/|g; $path =~ s|^./||g; $path =~ s|([^/.][^/.]*)/\.\.||; } return $path; } # create list of dirs back to root ($cwd = Cwd::cwd) =~ s|/$||; $cwdT = $cwd; while ($cwdT) { push(@DIR, $cwdT); $cwdT =~ s|/[^/]+$||; } # search for .scvsrc files foreach $dir (reverse(@DIR)) { if (-f "$dir/.scvsrc") { $reldir = &canonical_path(File::PathConvert::abs2rel($dir)); $subdir = &canonical_path(File::PathConvert::abs2rel($cwd, $dir)); $rcfile = &canonical_path("$reldir/.scvsrc"); &process_rcfile($rcfile, $cwd, $reldir, $subdir); } } # process a particular .scvsrc file sub process_rcfile { my ($rcfile, $cwd, $reldir, $subdir) = @_; my ($rc, @E, $e); $rc = new IO::File; $rc->open("<$rcfile"); while (<$rc>) { next if (m|^\s*#|); next if (m|^\s*$|); if (m|^\s*(\S+)\s*$|) { $CVSROOTS{$1} = ''; } elsif (m|^\s*(\S+)\s+\(\s*(.+?)\s*\)\s*$|) { $CVSROOTS{$1} = $2; } else { print STDERR "sCVS:Error: $rcfile, invalid line: `$_'\n"; exit(1); } } $rc->close(); } ## ## 3. Check for correct location to be called and ## determine current configured CVS repository location ## if (not -d "./CVS") { print STDERR "sCVS:Error: must stay inside a checked-out CVS tree.\n"; exit(1); } $root = new IO::File; $root->open("; $locC =~ s|\n$||; $root->close(); ## ## 4. Create iSelect page with list of available CVS repositories ## and fire up iSelect with it ## $pos = 0; $list = ''; $n = 1; foreach $loc (keys(%CVSROOTS)) { $name = $CVSROOTS{$loc}; if ($loc eq $locC) { $pos = $n; $act = '*'; } else { $act = ''; } $list .= ' "'.sprintf("%1s %-30s %s", $act, $name, $loc, $loc).'"'; $n++; } if ($pos == 0) { $list .= ' "'.sprintf("%1s %-30s %s", '*', 'UNKNOWN', $locC, $locC).'"'; $pos = $n+1; } $pos += 3; $cmd = "iselect -n 'sCVS' -t 'Switch CVS Repository'" . " -p$pos -P" . " ' '" . " 'Available Repositories:'" . " ' '" . " $list" . " ' '" . " 'Use CURSOR keys and RETURN to select or \'q\' to quit.'"; $rc = `$cmd`; ($pos, $locN) = ($rc =~ m|^(\d+):(.*)|); if ($locN eq '') { print STDERR "sCVS: Aborted\n"; exit(1); } elsif ($locN eq $locC) { print STDERR "Repository unchanged\n"; exit(0); } ## ## 5. Time to switch! ## $prefixN = $locN; $prefixN =~ s|^[^/]+||; foreach $dir (split(/\n/, `find . -name CVS -type d -depth -print`)) { $dir =~ s|^\./||; $dirname = $dir; if (length($dirname) > 60) { $dirname = '..'.substr($dirname, length($dirname)-60, 60); } $dirname = sprintf("%-60s", $dirname); print STDERR "Processing: ${bold}$dirname$norm\r"; open(FP, "<$dir/Root"); $locO = ; $locO =~ s|\n$||; close(FP); open(FP, ">$dir/Root"); print FP "$locN\n"; close(FP); $prefixO = $locO; $prefixO =~ s|^[^/]+||; open(FP, "<$dir/Repository"); $subdir = ; $subdir =~ s|\n$||; close(FP); $subdir =~ s|^$prefixO|$prefixN|; open(FP, ">$dir/Repository"); print FP "$subdir\n"; close(FP); } printf STDERR "%-78s\n", "Repository switched `$locN'"; ##EOF## iselect-1.4.0/iselect.1 644 0 0 3260210644127324 142300ustar osspiselect 0 0.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" 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" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" 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 .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" 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 .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . 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 / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" 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 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' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .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 . \" 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) .if \n(.H>23 .if \n(.V>19 \ \{\ . 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 "2007-07-08" "EN" "Ralf S. Engelschall" .SH "NAME" iSelect \-\- Interactive Selection Tool .SH "SYNOPSIS" .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 \fI\s-1NUM\s0\fR] [\fB\-k\fR \fI\s-1KEY\s0\fR[:\fI\s-1OKEY\s0\fR]] [\fB\-m\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 \fI\s-1STR\s0\fR] [\fIline1\fR \fIline2\fR ...] .PP \&\fBiselect\fR [\fB\-V\fR] .SH "VERSION" .IX Header "VERSION" 1.4.0 (08\-Jul\-2007) .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 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 characters. .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\*(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\*(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\*(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\*(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\*(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\*(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\*(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" .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 .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 .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 .IX Item "-a, --all-select" Force all lines to be selectable. .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" .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\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 .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 .IX Item "-t STR, --title=STR" Sets the title bar string, displayed centered at the bottom of the browser window. .Sh "Output Options" .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 .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(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(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(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" .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 \& 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 .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 .Vb 3 \& RETURN ........ Select line and exit \& CURSOR-RIGHT .. Select line and exit \& 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 .Vb 4 \& q ............. Quit (exit without selection) \& CURSOR-LEFT ... Quit (exit without selection) \& h ............. Help Page \& 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' command of the shell. .PP .Vb 7 \& # database scan for enhanced cd command \& cds () { \& (cd $HOME; \& find . -type d -print |\e \& sed -e "s;^\e.;$HOME;" |\e \& sort -u >$HOME/.cdpaths ) & \& } .Ve .PP .Vb 11 \& # definition of the enhanced cd command \& cd () { \& if [ -d $1 ]; then \& builtin cd $1 \& else \& builtin cd `egrep "/$1[^/]*$" $HOME/.cdpaths |\e \& iselect -a -Q $1 -n "chdir" \e \& -t "Change Directory to..."` \& fi \& PS1="\eu@\eh:$PWD\en:> " \& } .Ve .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' 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' then fails as usual with an error message. When only one directory was found, iSelect directly results this particular line to `\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'. .PP For more useful examples on how to use iSelect, see the \fIcontrib/\fR directory of the iSelect distribution tarball. .SH "AUTHOR" .IX Header "AUTHOR" .Vb 3 \& Ralf S. Engelschall \& rse@engelschall.com \& www.engelschall.com .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" .Vb 1 \& iSelect Home: http://www.ossp.org/pkg/tool/iselect/ .Ve iselect-1.4.0/iselect.pod 644 0 0 2167110644126765 146660ustar osspiselect 0 0## _ ____ _ _ ## (_) ___| ___| | ___ ___| |_ ## / /\___ \ / _ \ |/ _ \/ __| __| ## / / ___) | __/ | __/ (__| |_ ## (_( |____/ \___|_|\___|\___|\__| ## ## 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-2007 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.ossp.org/pkg/tool/iselect/ =cut ##EOF## iselect-1.4.0/iselect_browse.c 644 0 0 7452310644126766 157140ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_browse.h 644 0 0 354410644126766 156740ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_getopt.c 644 0 0 10630110644126767 157240ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_getopt.h 644 0 0 1323510644126767 157140ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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 */ iselect-1.4.0/iselect_global.h 644 0 0 1430310644126770 156410ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_help.c 644 0 0 227510644127324 153050ustar osspiselect 0 0/* iselect_help.c -- automatically generated by asc2c */ #include char *iSelect_Help[] = {\ " _ ____ _ _ ", " (_) ___| ___| | ___ ___| |_ ", " / /\\___ \\ / _ \\ |/ _ \\/ __| __|", " / / ___) | __/ | __/ (__| |_ ", " (_( |____/ \\___|_|\\___|\\___|\\__|", "", " iSelect -- Interactive Selection Tool", "", " Cursor Movement:", " 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", "", " Line Selection:", " RETURN ........ Select line and exit", " CURSOR-RIGHT .. Select line and exit", " SPACE ......... Select line and stay (multi-line mode only)", "", " Others:", " q ............. Quit (exit without selection)", " CURSOR-LEFT ... Quit (exit without selection)", " h ............. Help Page (this page)", " v ............. Version Page", "", NULL }; /*EOF*/ iselect-1.4.0/iselect_help.txt 644 0 0 175310321014375 156730ustar osspiselect 0 0 _ ____ _ _ (_) ___| ___| | ___ ___| |_ / /\___ \ / _ \ |/ _ \/ __| __| / / ___) | __/ | __/ (__| |_ (_( |____/ \___|_|\___|\___|\__| iSelect -- Interactive Selection Tool Cursor Movement: 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 Line Selection: RETURN ........ Select line and exit CURSOR-RIGHT .. Select line and exit SPACE ......... Select line and stay (multi-line mode only) Others: q ............. Quit (exit without selection) CURSOR-LEFT ... Quit (exit without selection) h ............. Help Page (this page) v ............. Version Page iselect-1.4.0/iselect_keys.c 644 0 0 640510644126771 153340ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_keys.h 644 0 0 250210644126771 153330ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_main.c 644 0 0 2311110644126772 153170ustar osspiselect 0 0/* _ ____ _ _ ** (_) ___| ___| | ___ ___| |_ ** / /\___ \ / _ \ |/ _ \/ __| __| ** / / ___) | __/ | __/ (__| |_ ** (_( |____/ \___|_|\___|\___|\__| ** ** 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-2007 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*/ iselect-1.4.0/iselect_readme.c 644 0 0 317410644127324 156110ustar osspiselect 0 0/* 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.4.0 (08-Jul-2007)", "", " The latest release can be found on", " http://www.ossp.org/pkg/tool/iselect/", "", " Copyright (c) 1997-2007 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*/ iselect-1.4.0/iselect_readme.txt 644 0 0 262110644126773 162110ustar osspiselect 0 0 _ ____ _ _ (_) ___| ___| | ___ ___| |_ / /\___ \ / _ \ |/ _ \/ __| __| / / ___) | __/ | __/ (__| |_ (_( |____/ \___|_|\___|\___|\__| 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.4.0 (08-Jul-2007) The latest release can be found on http://www.ossp.org/pkg/tool/iselect/ Copyright (c) 1997-2007 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 iselect-1.4.0/iselect_version.c 644 0 0 206110644127053 160320ustar osspiselect 0 0/* ** iselect_version.c -- Version Information for iSelect (syntax: C/C++) ** [automatically generated and maintained by GNU shtool] */ #ifdef _ISELECT_VERSION_C_AS_HEADER_ #ifndef _ISELECT_VERSION_C_ #define _ISELECT_VERSION_C_ #define ISELECT_VERSION 0x104200 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 = { 0x104200, "1.4.0", "1.4.0 (08-Jul-2007)", "This is iSelect, Version 1.4.0 (08-Jul-2007)", "iSelect 1.4.0 (08-Jul-2007)", "iSelect/1.4.0", "@(#)iSelect 1.4.0 (08-Jul-2007)", "$Id: iselect_version.c,v 1.6 2007/07/08 09:28:11 rse Exp $" }; #endif /* _ISELECT_VERSION_C_AS_HEADER_ */