shtool-2.0.8/AUTHORS 644 0 0 113610774764051 131260ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool This is a list of authors who have written or edited parts of the GNU shtool sources. o GNU shtool (as a whole) Written by: Ralf S. Engelschall Edited by: Ralf S. Engelschall o sh.mkdir: Written by: Noah Friedman, Ralf S. Engelschall Edited by: Ralf S. Engelschall o sh.mdate: Written by: Ulrich Drepper, Ralf S. Engelschall Edited by: Ralf S. Engelschall shtool-2.0.8/COPYING 644 0 0 3560710774764051 131430ustar gnushtool 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 shtool-2.0.8/ChangeLog 644 0 0 10452411040046351 136540ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool ____________________________________________________________________ ChangeLog Changes between 2.0.7 and 2.0.8 (19-May-2007 to 18-Jul-2008): *) Upgrade build environment to GNU autoconf 2.62 [Ralf S. Engelschall] *) Fix argument handling in "shtool mkln" command. [Christoph Schug] *) Adjust copyright for year 2008. [Ralf S. Engelschall] *) Detect Windows/Cygwin [Ralf S. Engelschall] *) Detect DragonFly BSD [Ralf S. Engelschall] *) Improved AIX hardware detection [Ralf S. Engelschall] *) Detect CentOS as a RHEL clone instead of a RHL clone. [Ralf S. Engelschall] *) Improved Mac OS X detection in "shtool plaform". [Ralf S. Engelschall] Changes between 2.0.6 and 2.0.7 (19-Apr-2006 to 19-May-2007): *) Upgrade build environment to GNU autoconf 2.61 [Ralf S. Engelschall] *) Fix "shtool mkln" by fixing the determination whether relative source paths can be used or not. [Ralf S. Engelschall] *) Make "shtool install" more robust by quoting arguments. [Ralf S. Engelschall] *) Fix and enhance "shtool echo -e" command by adding a missing line-continuation and adding support for MacOS X via nidump(8) and NIS+ support via niscat(8) and nismatch(8). [Ralf S. Engelschall] *) Adjust copyright for year 2007. [Ralf S. Engelschall] Changes between 2.0.5 and 2.0.6 (07-Feb-2006 to 19-Apr-2006): *) Add support for Sun Niagara (sun4v) architecture to GNU shtool "platform" command. [Christoph Schug] *) Add correct detection of Sun Solaris on AMD64 to GNU shtool "platform" command. [Ralf S. Engelschall] Changes between 2.0.4 and 2.0.5 (04-Feb-2006 to 07-Feb-2006): *) Fix "shtool version" command which got broken after recent util_{lower,upper} usage. [Ralf S. Engelschall] Changes between 2.0.3 and 2.0.4 (02-Oct-2005 to 04-Feb-2006): *) Remove obsolete LANG/LC_TIME/LC_ALL adjustments in sh.mdate. [Mike Frysinger ] *) Add ".svn" to the default ignore list of "shtool tarball". [Ralf S. Engelschall] *) Add missing documentation for "shtool tarball" option "-d". [Ralf S. Engelschall, Sakagami Hiroki ] *) Enhance portability even more by maximizing Bourne Shell compatibility under ZSH and BASH and avoiding NLS dependencies. [R. N. de Arenas Coronado ] *) Use internal util_{lower,upper} functions in "shtool version". [Ralf S. Engelschall] *) Adjust copyright for year 2006. [Ralf S. Engelschall] Changes between 2.0.2 and 2.0.3 (15-Jun-2005 to 02-Oct-2005): *) "shtool mdate" needs to (un|re)set TIME_STYLE, as GNU coreutils' "ls" changes its time format in response to the TIME_STYLE variable. [James Rowe ] *) Use "env -i sort" for Linux detections in "shtool platform" to circumvent LC_COLLATE and LANG environment problems. [Ralf S. Engelschall] *) Fixed "shtool version -l perl" by replacing "my" with "our" to allow the generated file to be really useful when loaded with the Perl "require" directive. [Ralf S. Engelschall] *) Improved FreeBSD/amd64 on iX86/EM64T detection within "shtool platform" by treating this as a native AMD64 platform similar to what the underlying OS does. [Ralf S. Engelschall] Changes between 2.0.1 and 2.0.2 (11-Aug-2004 to 15-Jun-2005): *) Fix insecure temporary file handling (CAN-2005-1751, CAN-2005-1759). [Eric Romang , Ralf S. Engelschall] *) Add Mandriva Linux and Ubuntu Linux support to "shtool platform". [Ralf S. Engelschall] *) Add IBM OS/400 PASE support to "shtool platform". [Henri Gomez ] *) Adjust copyright for year 2005. [Ralf S. Engelschall] Changes between 2.0.0 and 2.0.1 (02-Jul-2004 to 11-Aug-2004): *) Added M4 language output to "shtool version". [James Rowe ] *) Fixed AC_PROG_SHTOOL definition in shtool.m4. [James Rowe ] Changes between 2.0b4 and 2.0.0 (08-May-2004 to 02-Jul-2004): *) Add -w/--warning option to "shtool subst" command which shows warnings on substitution operation resulting in no content change on every file. The new default is now to show a warning on substitution operations resulted in no content change on all files only. [Ralf S. Engelschall, Thomas Lotterer] *) Fix platform id generation under NetBSD. [Ralf S. Engelschall] *) Fix concise platform id generation under HP-UX. [Ralf S. Engelschall] Changes between 2.0b2 and 2.0b3 (07-Apr-2004 to 08-May-2004): *) Add option "-q" to "shtool subst" for suppressing a new warning on substitution operation resulting in no content change. [Ralf S. Engelschall] *) Port "sh.platform" to full POSIX 1003.1-2001 (SUSv3) compliance by replacing "head -1" with "sed -e 'q'" and "tail -1" with "sed -n -e '$p'". [Ralf S. Engelschall] Changes between 2.0b1 and 2.0b2 (17-Feb-2004 to 07-Apr-2004): *) Replace "tr 'x-' 'x_'" with "sed -e 's/-/_/g'" constructs because some tr(1) (at least Solaris' /usr/ucb/tr) go into endless loops on (incorrectly assumed) range constructs with no ends. [Armin Wolfermann ] Changes between 1.6.2 and 2.0b1 (02-Nov-2002 to 17-Feb-2004): *) Fix typos in various files. [Thomas Lotterer ] *) Embedded the command documentation from shtool.pod into the individual sh.xxxx scripts and this way split the large shtool(1) manual page into individual manual pages shtool-xxxx(1). [Ralf S. Engelschall, Thomas Lotterer ] *) Upgraded to GNU Autoconf 2.59 environment. [Ralf S. Engelschall] *) Bumped copyright year for 2004. [Ralf S. Engelschall] *) Replaced old and inflexible "shtool guessos" command with a completely new command "shtool platform" command. It distinguishes a Unix platform according to its hardware architecture and operating system. For both there is a class, product and technology identification. For each of those six identifications, there is a verbose, regular and concise version. [Ralf S. Engelschall] *) Upgraded to GNU Autoconf 2.58 environment. [Ralf S. Engelschall] *) Replace "[ x -o/-a x ]" constructs with "[ x ] ||/&& [ x ]" and "egrep"/"fgrep" constructs with compatible "grep" or "case" constructs. This way GNU shtool is now more POSIX 1003.1-2001 compliant. [Paul Eggert ] *) Make sure "shtool install -e ..." does not fail with "permission denied" on the internally created temporary files if the source file is not writeable to the current user. This occurs because cp(1) does not in all cases honor umask(2) (even without option -p) -- mainly if the source file is already owned by the current user (then the permissions are always copied). Hence an explicit "chmod u+w" is required if the "shtool install" substitution feature (option -e) is used. [Thomas Lotterer , Ralf S. Engelschall ] *) When patching a file with "shtool subst" try to make it writeable first in case it has permissions set differently. [Ralf S. Engelschall ] *) Fix calculation of effective source path in "shtool mkln" command for destination paths containing "/./" sequence and for source paths consisting of no directory parts at all. [Ralf S. Engelschall , Michael Schloh v. Bennewitz ] *) Use "env -i /bin/ls" construct in "shtool rotate" and "shtool slo" commands to make sure we have a consistent output not adjusted by some environment variables like LANG, LS_COLORS, LS_OPTIONS, etc. [Ralf S. Engelschall , Manuel Hendel ] *) Make sure "shtool rotate" does still correctly determine the size of a file if its filename contains whitespaces. [Ralf S. Engelschall , Bill Campbell ] *) Consistently use "/bin/ls" instead of "ls" internally to avoid problems with other "ls" in PATH while still not becoming unportable (because "/bin/ls" is really on every reasonable Unix-style platform the "ls" command). [Ralf S. Engelschall ] *) Enhance %u, %U, %g and %G expansions of "shtool echo -e" by also trying the Solaris/Linux "getent" command. [Ralf S. Engelschall , Christoph Schug ] *) Enhance %u, %U, %g and %G expansions of "shtool echo -e" by first trying to resolve via POSIX "id" command. [Ralf S. Engelschall , Bill Campbell ] *) Bump year in copyright messages to cover new year 2003. [Ralf S. Engelschall ] *) Fixed error exit in all commands by introducing an "shtool_exit" function (which correctly cleans up temporary files) and replacing all "exit" calls with "shtool_exit". THIS THE FIRST TIME INTRODUCED THE USAGE OF A SHELL FUNCTION TO THE SHTOOL CODE. This is known to break on _very_ anchient and broken Bourne-Shell implementations and is considered to be no longer a real problem in the year 2003. Especially there is no alternative way anyway. [Ralf S. Engelschall ] *) Fixed description of "shtool install -C" operation in manual page. [Stefan Seefeld ] *) Changed "shtool fixperm" to no longer set group writeability. [Ralf S. Engelschall, Michael van Elst ] Changes between 1.6.1 and 1.6.2 (12-Jul-2002 to 02-Nov-2002): *) Map "shtool install -d [...]" internally to "shtool mkdir -f -p -m 755 [...]" in order to support the BSD-style "install -d" variant. [Ralf S. Engelschall, Alan Eldridge ] *) Add -o|--owner and -g|--group options to "shtool mkdir". [Ralf S. Engelschall] *) Fixed 'shtool scpp -f ...'. The arguments to option -f were not evaluated correctly. [Ralf S. Engelschall] *) Support bold font on 'cygwin' terminals. [Marcus Boerger ] *) Try the terminal 'init' sequence before 'reset' for bold mode restoring in order to make sure the terminal is not cleared. Additionally, fallback to a consistent no-bold mode. [Mirko Liss ] Changes between 1.6.0 and 1.6.1 (01-Feb-2002 to 12-Jul-2002): *) Removed not-existing --min-size option from the usage of "shtool rotate". The name is just --size. [Thomas Linden ] *) Port to POSIX 1003.1-2001 (SUSv3) standard: sh.echo, sh.version: "head -1" -> "sed -e 'q'" sh.path: "sort -u | tail -1" -> "sort -r -u | sed -e q" sh.subst: diff -u1 -> diff -U1 [Paul Eggert ] *) Fixed various typos in shtool.pod. [Ralf S. Engelschall, Liones ] Changes between 1.5.4 and 1.6.0 (14-Jun-2001 to 01-Feb-2002): *) Upgraded to GNU Autoconf 2.52 environment. [Ralf S. Engelschall] *) Fixed contained RPM specification (shtool.spec) [Ralf S. Engelschall] *) Added new command `shtool rotate [-v|--verbose] [-t|--trace] [-f|--force] [-n|--num-files ] [-s|--min-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 ] [ ...]'. This is a sophisticated command for rotating logfiles of daemons. [Ralf S. Engelschall] *) Added GNU long-option support (`--xxxx'). [Ralf S. Engelschall] *) Cleaned up temporary file handling in `shtool path'. [Ralf S. Engelschall] *) Added NEWS file to source tree to comply to GNU standards. [Ralf S. Engelschall] *) Add new `shtool subst [-v] [-t] [-n] [-s] [-i] [-b] [-e] [-f] [] [...]' command. This is a useful wrapper around sed(1). [Ralf S. Engelschall] Changes between 1.5.3 and 1.5.4 (19-Apr-2001 to 14-Jun-2001): *) Removed numerious trailing whitespaces from source files. [Ralf S. Engelschall] *) Updated shtool.spec file: DESTDIR support, indentation cleanups, etc. [Ralf S. Engelschall] *) Fixed typos in README. [Ralf S. Engelschall] *) Add missing entry for `tarball' to shtoolize.pod list. [Ralf S. Engelschall] *) Added %g (current group name) and %G (current group id) constructs to `shtool echo -e' command. [Ralf S. Engelschall] *) Fixed example of `shtool move' in shtool.pod [Ralf S. Engelschall] *) Fixed a bug in `shtool echo -e %d' [Ralf S. Engelschall, Christoph Schug ] *) Adjusted "make test" to also work under Cygwin environment. [Joerg Freudenberger ] Changes between 1.5.2 and 1.5.3 (29-Feb-2001 to 19-Apr-2001): *) Added support for three usage lines to shtoolize.sh. [Ralf S. Engelschall] *) Fixed a few whitespace inconsistencies in shtool.pod and the usage line of `shtool tarball'. [Ralf S. Engelschall] *) Fix `shtool mkdir': option -m was only applied if option -p was present. [Ralf S. Engelschall] Changes between 1.5.1 and 1.5.2 (06-Jul-2000 to 29-Feb-2001): *) Fixed IFS usage in `shtool slo': `OIFS="$IFS" IFS="..."' is not portable, because some brain-dead Bourne-Shells (for instance /bin/sh under Solaris 2.8) evaluate from right-to-left instead of the usual and expected left-to-right. Fixed by adding a semicolon. [Christoph Schug , Ralf S. Engelschall] *) Created a new `-e ' option for `shtool install' which can be used one or multiple times to apply one or more sed(1) commands on-the-fly to installed files. [Ralf S. Engelschall] *) Kicked out the `-e ' option of `shtool install', because it was a left-over from ancient days on non-POSIX systems and no longer is (or should be) of any use. [Ralf S. Engelschall] *) Adjusted copyright messages to cover year 2001, too. [Ralf S. Engelschall] *) Adjusted the shtool.spec a little bit. [Ralf S. Engelschall] *) Be extra paranoid and create temporary files with permissions of 0600. [Ralf S. Engelschall] *) Replaced a few too conservative `if [..] && [..]' with the faster but still portable `if [.. -a ..]'. Only make sure that `-a' and `-o' are not mixed in a single test (because this is unportable). [Ralf S. Engelschall] *) Fixed `shtool install': the default for option -m is 0755 in order to be consistent with the semantics of original BSD and GNU install commands. [Evgeny Stambulchik ] *) Added support to Makefile.in for DESTDIR variable. This allows easier rolling of installation tarballs (for instance from within RPM or similar facilities) by using "make install DESTDIR=/tmp/shtool". [Brad Smith ] *) Actually use the determined `find' command instead of the hard-coded one in `shtool tarball'. [Denis Barbier ] Changes between 1.5.0 and 1.5.1 (01-Jul-2000 to 06-Jul-2000): *) Fixed hex value generation `shtool version': the `%X' printf format is not understood by all AWK flavors. So use the more portable `%x' instead and pass the result trough a `tr' filter. [Ralf S. Engelschall, Joe Meadows , Todd R. Stroup , Keith Minkler ] *) Typo in shtool.pod [Ralf S. Engelschall] *) Add Python support to `shtool version'. [Benjamin Saller ] Changes between 1.4.9 and 1.5.0 (16-Apr-2000 to 01-Jul-2000): *) Added global -r/--recreate option for generated shtool scripts which can be used to easily upgrade a script (the trick is that -r knows the list of modules which have to specified on the shtoolize command line). [Ralf S. Engelschall] *) Completely rewritten `shtool version': - new option -e for editing the new version interactively - unclean -i[sabpP] option variants are now gone - the calculated hex values (-dhex) are now really hex values - better calculated libtool values (-dlibtool) - the C and Perl version files are now using a structure instead of various single variables. - many other minor changes [Ralf S. Engelschall] *) Don't print `failed: 0/17' after a successful `make test' because it confused people too often. [Ralf S. Engelschall] *) In shtool.m4 check for shtool also in $ac_aux_dir. [Ralf S. Engelschall] *) Rewrote the `shtool path -m perl' handling, i.e., the way how to find the most reasonable Perl on a system. It now supports Perl 5.6.0 because we no longer parse `perl -v' output. Instead we base our assumptions on Perl's internal $] variable. Additionally the $PATH position and the executable name is now taken into account, too. [Ralf S. Engelschall] *) Fixed shtool.pod: `shtool path -m perl5 perl' is bogus, it has to be just `shtool path -m perl' because the "perl" argument is magic. [Ralf S. Engelschall] *) Fixed `here-document' handling in shtoolize: the whitespaces were incorrectly determined and so newlines were lost. [Ralf S. Engelschall] *) Allow `shtool install file [file ...] dir', i.e., multiple source files if target is a directory. This is especially useful for mass-installing files by using shell wildcards for the source. [Ralf S. Engelschall] *) Be compatible with SUSv2 and let `shtool mkdir -p' not complain if directory already exists. [Sascha Schumann ] Changes between 1.4.8 and 1.4.9 (12-Mar-2000 to 16-Apr-2000): *) Added an `-f ' option to `shtool scpp' which can be used to pre-filter all input files with one or more sed-expressions . [Ralf S. Engelschall] *) Try also `uname -x' in addition to `uname -m' in `shtool guessos' for backward compatibility to SVR4 platforms. Additionally changed the fallback vendor string from `whatever' to `unknown'. [Ralf S. Engelschall] *) Added `-p' option to `shtool slo' to allow one to change the default variable prefix `SLO_' to . [Ralf S. Engelschall] *) Speeded up `shtool echo -e "..%B..%b.."' by trying tput and tcout only if terminal is not a vt100, vt200 or an xterm (because for these three we have the escape sequences hard-coded). [Ralf S. Engelschall] *) Fixed various typos in the scripts. [Ralf S. Engelschall] *) Replaced old and ugly test for `test -x' in sh.fixperm, sh.path and sh.tarball with a faster, shorter and still sufficient test. [Ralf S. Engelschall] *) Added a RPM spec file shtool.spec which allows one to build RPM packages directly from the Shtool distribution tarball through a simple `rpm -tb shtool-1.X.Y.tar.gz' call. [Daniel Richard G. ] Changes between 1.4.7 and 1.4.8 (24-Dec-1999 to 12-Mar-2000): *) Greatly speeded up option processing by moving option defaults directly into the sh.* scripts and by using a few faster parsing constructs. [Ralf S. Engelschall] *) Fixed a syntax error in the option parsing (there was a trailing quote character '"' in an 'eval' command). It fortunately and surprisingly never harmed the operation on any platforms. Additionally we now use sed instead of awk here. [Ralf S. Engelschall] *) Made shtool's command line related error messages more clear by distinguishing between options and commands. [Denis Barbier ] *) Updated all copyright messages for year 2000. [Ralf S. Engelschall] Changes between 1.4.6 and 1.4.7 (05-Sep-1999 to 24-Dec-1999): *) Replaced the too generic (and this way slowed down processing) bang `!' mode in option parsing with a per-script local setup. [Denis Barbier ] *) Fixed mkshadow command: it calculated the reverse path incorrectly if the destination path contained `../' elements. [Ralf S. Engelschall, Gil ?? ] *) Ignore `_.SYMDEF' symbols in arx command. [Ralf S. Engelschall] *) Fixed `shtool echo' command for arguments containing whitespaces. [Denis Barbier ] Changes between 1.4.5 and 1.4.6 (28-Jul-1999 to 05-Sep-1999): *) Fixed manual page sections in Makefile.in. [Denis Barbier ] *) Accept `tarcust' in addition to `tardy' in sh.tarball. [Ralf S. Engelschall] *) Added hint to `shtoolize' to INSTALL document. [Denis Barbier ] *) Added support for AmigaOS to sh.guessos [Ralf S. Engelschall] *) Replace bars (`|') by slashes (`/') in sh.guessos' fallback result string to avoid problems in GNU libtool. [Kriton Kyrimis ] Changes between 1.4.4 and 1.4.5 (17-Jul-1999 to 28-Jul-1999): *) Added a shtool.m4 which provides an AC_PROG_SHTOOL macro to GNU Autoconf. This is installed in $datadir/aclocal/ so it can be picked up by Autoconf's aclocal command. [Ralf S. Engelschall] *) Added `uninstall' target to Makefile.in [Ralf S. Engelschall] *) Source tree adjustments to comply more to the GNU standards: Added AUTHORS file; renamed CHANGES to ChangeLog and CREDITS to THANKS. [Ralf S. Engelschall] *) Added `make check' as an alias for `make test' [Ralf S. Engelschall] Changes between 1.4.3 and 1.4.4 (11-Jul-1999 to 17-Jul-1999): *) Added a new `shtool tarball' command for rolling nice distribution tarballs. [Ralf S. Engelschall] *) Fixed usage message of shtoolize. [Ralf S. Engelschall] *) Adjusted IRIX detection in sh.guessos. [Ralf S. Engelschall] *) Allow shtool to recognize symlinks to itself with the name of the shtool command like in `ln -s shtool install'. This is useful for emulation situations. [Paolo Bonzini , Ralf S. Engelschall] Changes between 1.4.2 and 1.4.3 (09-Jul-1999 to 11-Jul-1999): *) Fix the `a _directory_ named perl5 exists in $PATH' problem also for `shtool path -m perl'. [Justin Leonard Tripp ] *) Mention in the manual page that the order of documentation follows the order of the modules in the generated script and that this order is sorted by _topic_. [Ralf S. Engelschall] Changes between 1.4.1 and 1.4.2 (07-Jul-1999 to 09-Jul-1999): *) Removed residual shebang lines on sh.* scripts. [Gopal Narayanan ] *) Enhanced sh.guessos for more granular GNU/Linux detection. This especially fixes problems when using the guessed id with libtool. [Ralf S. Engelschall] *) Enhanced `shtool scpp': The generated function prototypes now no longer contain the argument names to avoid namespace conflicts [Ralf S. Engelschall] *) Fixed shtoolize.in: The chown() has to use $opt_o [Denis Barbier ] Changes between 1.4.0 and 1.4.1 (02-Jul-1999 to 07-Jul-1999): *) Cleaned up usage messages. [Ralf S. Engelschall, Denis Barbier ] *) Updated and cleaned up shtool.pod [Ralf S. Engelschall] *) Added shtool -d for enabling shell trace information. [Ralf S. Engelschall] *) Renamed shtool.gen to shtoolize.in and enhanced it to become the new build frontend which now is also installed and can be used by developers to build individual shtool scripts (which contain only a subset of the functionality in case the developer doesn't need all functionality in his source tree). [Denis Barbier , Ralf S. Engelschall] *) Made sh.scpp more robust on brain-dead platforms where their `awk' is to weak for the used Awk script. Instead we now search for gawk, then nawk and finally for awk before using it. [Ralf S. Engelschall, Martin Kraemer ] *) Be more friendly to developers and require only Autoconf 2.12 [Denis Barbier ] *) Fixed typos related to `separate'. [Martin Kraemer ] Changes between 1.3.3 and 1.4.0 (01-Jul-1999 to 02-Jul-1999): *) Fixed `shtool arx' command: it expected one argument too much, shifted one argument too much and wasn't aware of `arx x lib.a'. [Ralf S. Engelschall] *) Fixed `shtool echo -n' variant: Now Awk is only used as a fallback, because it complains about some \xx sequences and there is no $seo for Awk :-( [Ralf S. Engelschall] *) Added the first cut for a shtool test suite under `make test'. [Ralf S. Engelschall] *) Additionally try `tput sgr0' to reset bold mode in sh.echo [Denis Barbier ] *) Fix initializations for `bptype' variable in sh.version [Denis Barbier ] *) Globally cleaned up -v (verbose), -d (debug) and -t (trace) options: - Added -v (verbose) and -t (trace) options to "shtool move" - Added -v (verbose) and -t (trace) options to "shtool install" - Added -t (trace) option to "shtool mkdir" - Renamed -v option to -t (trace) option for "shtool mkln" - Renamed -d option to -t (trace) option for "shtool mkshadow" - Added -t (trace) option to "shtool fixperm" - Renamed -v option to -t (trace) option for "shtool arx" [Ralf S. Engelschall] *) Fixed a path construction bug in "shtool install" and added more error escapes [Ralf S. Engelschall] *) Removed remaining trailing whitespaces from scripts [Ralf S. Engelschall] Changes between 1.3.2 and 1.3.3 (28-Jun-1999 to 01-Jul-1999): *) Cleaned up usage of IFS and removed explicit default IFS [Ralf S. Engelschall] *) Removed trailing whitespaces from all scripts [Ralf S. Engelschall, Markus F.X.J. Oberhumer ] *) Fixed error status handling in sh.move [Markus F.X.J. Oberhumer ] Changes between 1.3.1 and 1.3.2 (28-Jun-1999 to 28-Jun-1999): *) Fixed a portability problem under SysV shells inside the source tree: the sh.xxxx scripts have to include sh.common via ``. ./sh.common'' instead of just ``. sh.common'' in order to find sh.common in the source tree while bootstrapping. [Ralf S. Engelschall, Lars Hecking ] Changes between 1.3.0 and 1.3.1 (25-Jun-1999 to 28-Jun-1999): *) Fixed directory checks in mkshadow command [Ralf S. Engelschall, Evgeny Stambulchik ] *) Added -d (debug) and -a (symlink all) options to mkshadow command. [Ralf S. Engelschall] Changes between 1.2.9 and 1.3.0 (02-Jun-1999 to 25-Jun-1999): *) Fixed handling of 'date +%y' fallback in sh.echo and sh.version [Ralf S. Engelschall] *) Enhanced sh.echo's bold terminal sequence determination [Ralf S. Engelschall] *) Written a completely new and more sophisticated option parsing code which can be shared by all tools (sh.common). [Ralf S. Engelschall] *) Completely overhauled all scripts and this way fixed a few bugs. But especially all scripts now use the new option parsing code. [Ralf S. Engelschall] *) Changed distribution license from BSD-style to GPL, but with an important exception which is similar to libtool. This way all advertisement clauses are gone and shtool is protected better. Nevertheless the resulting shtool script can be used in _ANY_ software package source tree. [Ralf S. Engelschall] *) Added a new "shtool mdate" command for finding out and pretty-printing the last modification date of a file or dir. [Ralf S. Engelschall] *) Cleaned up usage descriptions [Ralf S. Engelschall] *) Moved to the new official state of a GNU program, renamed LICENSE to COPYING, etc. [Ralf S. Engelschall] *) Fixed problems with brain-dead Awks in sh.echo [Ralf S. Engelschall] *) Fixed problems with sed commands in sh.echo [Ralf S. Engelschall] Changes between 1.2.8 and 1.2.9 (28-May-1999 to 02-Jun-1999): *) Fixed sh.echo (awk needs EOF on stdin) [Ralf S. Engelschall] *) Fixed "tr"-stuff again in sh.version [Ralf S. Engelschall] *) Added even more background details to shtool.pod [Ralf S. Engelschall] *) Added INSTALL document [Ralf S. Engelschall] Changes between 1.2.7 and 1.2.8 (14-May-1999 to 28-May-1999): *) Added a nifty sh.scpp for supporting library writing [Ralf S. Engelschall] *) Fixed AIX determination in sh.guessos [Ralf S. Engelschall] *) Optimized sh.echo's bold stuff [Ralf S. Engelschall] Changes between 1.2.6 and 1.2.7 (13-May-1999 to 14-May-1999): *) Enhanced sh.guessos: Include release/version information for NetBSD, OSF/1 and IRIX. Additionally extracted the shorter machine id for AIX. [Ralf S. Engelschall] Changes between 1.2.5 and 1.2.6 (12-May-1999 to 13-May-1999): *) Added leading underscores in AS_HEADER and defines used in the generated file of sh.version [Ralf S. Engelschall] *) Fixed shtool message "Run ... -h" [Ralf S. Engelschall] *) Added -s (silent) option to sh.fixperm and made it's test -x portable as in sh.path [Ralf S. Engelschall] *) Kicked out Apache-hack for Solaris detection in sh.guessos [Ralf S. Engelschall] *) Merge into sh.guessos the BSDI 3.x and MacOS X support from AG [Ralf S. Engelschall] Changes between 1.2.4 and 1.2.5 (11-May-1999 to 12-May-1999): *) Removed Apache relicts in sh.mkshadow: apaci, etc. [Ralf S. Engelschall] *) Cleanups to Makefile.in [Denis Barbier move -e [Ralf S. Engelschall] *) Replaced \$ (an escaped dollar as text) in sh.version with $/ (an dollar for "ident" and a harmless variable expansion for Perl itself), because RCS' ident dislikes \$. [Denis Barbier ] *) Make sure `shtool path' doesn't create paths with doubled slashes [Ralf S. Engelschall] *) Started a CREDITS file for keeping track of the contributors. [Ralf S. Engelschall] *) Added -e (expand) feature to `shtool move' (similar to mmv) [Ralf S. Engelschall] *) Require the preserved mode of `shtool move' to have option -p [Ralf S. Engelschall] Changes between 1.2.1 and 1.2.2 (29-Apr-1999 to 05-May-1999): *) Added "-e " to sh.install [Ralf S. Engelschall, Yitzchak Scott-Thoennes ] *) Fixed shtool generation: comments for version output was wrong [Ralf S. Engelschall] *) Cleaned up sh.path "-x" test: no need for shebang and absolute /bin/sh [Ralf S. Engelschall] *) Finally renamed "shtool version -v" to "shtool version -s" (s = set) [Ralf S. Engelschall] Changes between 1.2.0 and 1.2.1 (29-Apr-1999 to 29-Apr-1999): *) Extended the shtool.pod manual page to cover additional details [Ralf S. Engelschall] *) Cleaned up shtool.gen script [Ralf S. Engelschall] *) Updated README and changed official name to "Portable Shell Tool" [Ralf S. Engelschall] *) Inserted shtool into a CVS repository [Ralf S. Engelschall] Changes between 1.1.0 and 1.2.0 (26-Apr-1999 to 29-Apr-1999): *) Added new ``arx'' tool for archiving libs in libs [Ralf S. Engelschall] *) Added new ``mkln'' tool for creating relative symlinks [Ralf S. Engelschall] *) The script order of the shtool ingredients is now preserved [Ralf S. Engelschall] *) Changed "VERSION" to "shtool" in `shtool version' headers [Ralf S. Engelschall] Changes between 1.0.0 and 1.1.0 (22-Apr-1999 to 26-Apr-1999): *) Cleaned up the usage page of shtool [Ralf S. Engelschall] *) Written a complete documentation as a Unix manual page shtool(1) [Ralf S. Engelschall] *) Renamed sh.ppl to sh.table and sh.newvers to sh.version [Ralf S. Engelschall] *) Created a new sh.move tool [Ralf S. Engelschall] *) Merged sh.info into sh.echo [Ralf S. Engelschall] *) Merged sh.findprg, sh.findperl, sh.findcpp and sh.fp2rp into a new sh.path tool. Additionally sh.path now contains the functionality of dirname(1) and basename(1). [Ralf S. Engelschall] *) Added Makefile.in for building shtool & shtool.1 and installing it [Ralf S. Engelschall] *) Renamed *.sh to sh.* [Ralf S. Engelschall] *) Added GNU Autoconf environment for perl and pod2man [Ralf S. Engelschall] Changes between *GENESIS* and 1.0.0 (22-Apr-1999): *) Added Apache's GuessOS as sh.guessos [Ralf S. Engelschall] *) Created the first shtool package by collecting all scripts I've written over the last years for various Open Source packages. [Ralf S. Engelschall] shtool-2.0.8/INSTALL 644 0 0 305310774764051 131070ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool ____________________________________________________________________ INSTALLATION Usually you want to use shtool inside the source tree of your own free software package (say it stays under /path/to/mypkg). For this you first have compile the `shtool' script and then just copy it over to your own source tree. To achieve this run in your shell: $ ./configure $ make $ make test $ cp shtool /path/to/mypkg/shtool Additionally you can use `shtoolize' to first assemble a custom `shtool' script (here with the modules `install', `mkdir' and `tarball': $ ./configure $ make $ make test $ shtoolize install mkdir tarball $ cp shtool /path/to/mypkg/shtool Also please notice the license terms which apply to the generated shtool program. You can find them at the top of the generated shtool program file. Alternatively you can also install shtool in a system wide location (for easier upgrading from there or to make shtool available for users from within the shell). To install shtool into /path/to/shtool/{bin,man}/ perform the following steps in your shell: $ ./configure --prefix=/path/to/shtool $ make $ make test $ make install Please keep in mind that although the building of `shtool' requires Perl 5 the generated `shtool' script does _NOT_ require Perl under runtime, of course. shtool-2.0.8/Makefile.in 644 0 0 1111710774764051 141430ustar gnushtool 0 0## ## Makefile for GNU shtool ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## @SET_MAKE@ TOP = . prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ datarootdir = @datarootdir@ datadir = @datadir@ aclocaldir = $(datadir)/aclocal pkgdatadir = $(datadir)/shtool DESTDIR = SHELL = /bin/sh PERL = @PERL@ POD2MAN = @POD2MAN@ RM = rm -f RMDIR = rmdir TRUE = true CP = cp LS = ls SCRIPTS = \ sh.echo \ sh.mdate \ sh.table \ sh.prop \ sh.move \ sh.install \ sh.mkdir \ sh.mkln \ sh.mkshadow \ sh.fixperm \ sh.rotate \ sh.tarball \ sh.subst \ sh.platform \ sh.arx \ sh.slo \ sh.scpp \ sh.version \ sh.path all: shtool manpages shtool: $(SCRIPTS) sh.common shtoolize @$(SHELL) sh.echo -e "%Bbuilding program shtool%b" ./shtoolize -o shtool all manpages: .timestamp .timestamp: shtoolize.pod shtool.pod $(SCRIPTS) -@V1=`$(SHELL) sh.version -l txt -d short VERSION`; \ V2=`$(SHELL) sh.version -l txt -d long VERSION`; \ D=`$(SHELL) sh.version -l txt -d long VERSION | sed -e 's;.*(;;' -e 's;).*;;'`; \ for ifile in shtoolize.pod shtool.pod $(SCRIPTS); do \ tfile=`echo "$$ifile" | sed -e 's/\.pod$$/.tmp/' -e 's/^sh\.\(.*\)$$/shtool-\1.tmp/'`; \ ofile=`echo "$$ifile" | sed -e 's/\.pod$$/.1/' -e 's/^sh\.\(.*\)$$/shtool-\1.1/'`; \ cp $$ifile $$tfile; \ $(SHELL) sh.echo -e "%Bbuilding manpage $$ofile%b"; \ $(POD2MAN) --section=1 --center="GNU Portable Shell Tool" \ --release="$$D" --date="shtool $$V1" $$tfile |\ sed -e "s;SHTOOL_VERSION_STR;$$V2;" >$$ofile; \ rm -f $$tfile; \ done; \ touch .timestamp check: test test: all @$(SHELL) sh.echo -e "%BRunning test suite:%b" @$(SHELL) test.sh install: all ./shtool mkdir -f -p -m 755 $(DESTDIR)$(prefix) ./shtool mkdir -f -p -m 755 $(DESTDIR)$(bindir) ./shtool mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man1 ./shtool mkdir -f -p -m 755 $(DESTDIR)$(aclocaldir) ./shtool mkdir -f -p -m 755 $(DESTDIR)$(pkgdatadir) ./shtool install -c -m 755 shtool $(DESTDIR)$(bindir)/shtool ./shtool install -c -m 755 shtoolize $(DESTDIR)$(bindir)/shtoolize -@for ifile in shtoolize.pod shtool.pod $(SCRIPTS); do \ ofile=`echo "$$ifile" | sed -e 's/\.pod$$/.1/' -e 's/^sh\.\(.*\)$$/shtool-\1.1/'`; \ echo "./shtool install -c -m 644 $$ofile $(DESTDIR)$(mandir)/man1/$$ofile"; \ ./shtool install -c -m 644 $$ofile $(DESTDIR)$(mandir)/man1/$$ofile; \ done ./shtool install -c -m 644 shtool.m4 $(DESTDIR)$(aclocaldir)/shtool.m4 @for script in sh.common $(SCRIPTS); do \ echo "./shtool install -c -m 644 $$script $(DESTDIR)$(pkgdatadir)/$$script"; \ ./shtool install -c -m 644 $$script $(DESTDIR)$(pkgdatadir)/$$script; \ done uninstall: @for script in sh.common $(SCRIPTS); do \ echo "$(RM) $(DESTDIR)$(pkgdatadir)/$$script"; \ $(RM) $(DESTDIR)$(pkgdatadir)/$$script; \ done $(RM) $(DESTDIR)$(aclocaldir)/shtool.m4 -@for ifile in shtoolize.pod shtool.pod $(SCRIPTS); do \ ofile=`echo "$$ifile" | sed -e 's/\.pod$$/.1/' -e 's/^sh\.\(.*\)$$/shtool-\1.1/'`; \ echo "$(RM) $(DESTDIR)$(mandir)/man1/$$ofile"; \ $(RM) $(DESTDIR)$(mandir)/man1/$$ofile; \ done $(RM) $(DESTDIR)$(bindir)/shtoolize $(RM) $(DESTDIR)$(bindir)/shtool $(RMDIR) $(DESTDIR)$(aclocaldir) >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(pkgdatadir) >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(datadir) >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(mandir)/man1 >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(mandir) >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(bindir) >/dev/null 2>&1 || $(TRUE) $(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE) clean: $(RM) shtool $(RM) *.1 distclean: clean $(RM) Makefile shtoolize $(RM) config.cache config.status config.log $(RM) .timestamp shtool-2.0.8/NEWS 644 0 0 307510774764051 125610ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool This is a list of user-visible and/or major changes to GNU shtool. For more details please have a look at the ChangeLog file. Changes between 1.6 and 2.0 (02-Nov-2002 to 02-Jul-2004) *) Added substitution warnings to `shtool subst' *) Replaced old `shtool guessos' with a new `shtool platform' command *) Even more POSIX 1003.1-2001 compliancy and portability. *) Many workarounds and fixed for permission related problems *) Fixed error exit in all commands by introducing an "shtool_exit" *) Split shtool(1) into multiple manual pages and extended content. *) Upgraded build environment to GNU Autoconf 2.59 Changes between 1.5 and 1.6 (14-Jun-2001 to 02-Nov-2002) *) Added `shtool install -d' variant. *) Added `shtool mkdir [-o] [-g]' variant. *) Added new `shtool subst' command. *) Added new `shtool rotate' command. *) Added GNU long-option support (`--xxxx'). Changes between 1.4 and 1.5 (16-Apr-2000 to 14-Jun-2001) *) Added %g/%G to `shtool echo -e' *) Added `-e ' option to `shtool install' *) Removed `-e ' option from `shtool install' *) DESTDIR support for `make install' *) Added Python support to `shtool version' *) Added global -r/--recreate option for regeneration *) Completely rewritten `shtool version' *) Rewritten `shtool path -m perl' handling *) Numerous bugfixes and cleanups shtool-2.0.8/RATIONAL 644 0 0 1476510774764051 132460ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool RATIONAL ======== The Context For the configuration, build and installation environment of modern free software packages one nowadays uses GNU autoconf, GNU automake and GNU libtool. GNU autoconf covers the configuration, GNU automake covers the generation of the build environment and GNU libtool covers most of a libraries build process. But at least when it comes to the installa- tion step one usually have to use a few auxiliary scripts like "mkdir.sh", "install.sh", etc. These scripts are replacements for sys- tem tools and are required mainly for portability reasons. The result is usually an "etc/" subdirectory in the source tree where over time a lot shell scripts accumulate. Maintainance Problem The problem with those "etc/" shell scripts starts if one has to main- tain lots of free software packages as it's the case for the author of shtool. Then over time all "etc/" directories diverge and with every day it gets more and more nasty to always keep them in sync. Especially if some scripts were locally adjusted because no centralized main- tainance location exists, of course. For autoconf no such problem exists, because the resulting "configure" script is generated on-the-fly. The same applies to automake and the various "Makefile.in" files. Only for libtool one always has to grab the latest copy. But because it's just two files ("ltmain.sh" and "ltconfig"), keeping a source trees in sync is not too complicated (especially not if using the handy "libtoolize" program). But the "etc/" shell script mess is nasty, espe- cially because there is no master version on the net. Additionally everytime one starts a new project, one has to establish a new source tree. For a GNU hacker it's immediately clear that autoconf and friends are part of the game. But which "etc/" shell scripts are needed this time? And from which existing source tree to copy them from? Hmmm... the same procedure as last year?! The Aesthetic Problem When a free software package has a large source tree (say, more than 50 files and especially with one or more subdirectories) it's usually no problem to have an additional "etc/" subdirectory with some scripts. They then totally go down. But for smaller packages, especially those living in a single source directory (a degenerated tree), some people (like the author of shtool) have aesthetic problems. Because it looks strange to them that 20% of the files in the source tree are just aux- iliary scripts. Sure, the actual amount of script code even shtool can- not reduce, but shtool merges them together into a single file and this way they optically totally disappear from the source tree. This is a pure aesthetical issue, of course. But keep in mind that hacking is a piece of art. And a well layouted source tree is a piece of art for real hackers, too. Oh, and for those who really insist on a technical reason: it's also easier to upgrade a single file than multi- ple files ;) Filling the gap So, wouldn't it be nice to have a fourth package (beside autoconf, automake and libtool) which fills the gap, i.e. which provides the functionality of the old files in "etc/", is maintained at a central- ized location and even consists of just a single (perhaps large) script one can threat as a black box the same way one already does this for libtool? The author thought this would be actually very useful and the result is the current GNU shtool package which at least successfully solved the above problems of the author. The goals in detail To better understand the intentions behind shtool and to avoid confu- sion, here are the original goals of the shtool script: 1. It has to be self-contained and reside in a single file This was achieved by compiling the resulting shtool script out of the ingredient source scripts. The advantage is that shtool is still easily maintainable, because one can test each script separately. But the final functionality then resides in an all-in-one script which can be easily spread over multiple source trees. 2. It has to cover all functionality of the old scripts This was achieved by (re)implementing really all functionality which experience showed is important in source trees of typical free soft- ware packages. 3. It has to be maximum portable over all Unix flavors This was achieved by basing the ingredient shell scripts only on well-proven code which already survived practice in other projects over more than a few months. Especially this means that a lot of complicated emulations are done to avoid the use of unportable Unix programs (like "fmt", "tr", etc) or unportable features of well- known Unix programs (like shell functions, special "sed" features, etc. pp). That's why shtool's code sometimes looks crazy and like overkill to you. Don't think this is because of the authors crazy- ness. Instead it's most of the time mainly for portability reasons. 4. It has to be clean and fully documented This was achieved by reimplementing too ugly functionality from scratch and cleaning up old shell script code plus writing a com- plete set of manual pages. 5. It has to stay under a reasonable and common license This was achieved by placing the shtool package under the GNU Gen- eral Public License (GPL). This way the shtool package itself is well protected and is guarrantied to be kept free software, but the resulting shtool script can be nevertheless used in all types of source trees. Notice here: given that one includes GNU shtool verba- tim into an own source tree, one is justified in saying that it remains separate from the own package, and that this way one is sim- ply just using shtool. So, in this situation, there is no require- ment that the package itself is licensed under the GNU General Pub- lic License in order to take advantage of shtool. Keep this in mind ;) 6. It has to be modularized for flexibility reasons This was achieved by using an auxiliary tool shtoolize(1) which can be used to build individual "shtool" scripts out of the ingredient shell scripts. This way if one don't need all the available func- tionality one can assemble together an individual "shtool" script. shtool-2.0.8/README 644 0 0 622111040046410 127110ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool Copyright (c) 1994-2008 Ralf S. Engelschall http://www.gnu.org/software/shtool/ ftp://ftp.gnu.org/gnu/shtool/ Version 2.0.8 (18-Jul-2008) The GNU shtool program is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients were in successful use over many years in various free software projects. The compiled shtool program is intended to be used inside the source tree of free software packages. There it can take over various (usually non-portable) tasks related to the building and installation of such packages. It currently contains the following tools: 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 simultan 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 fixperm Fix file permissions inside a source tree rotate Rotate logfiles 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 Generate and maintain a version information file path Deal with program paths 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 GNU shtool 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. The documentation and latest release can be found on http://www.gnu.org/software/shtool/ ftp://ftp.gnu.org/gnu/shtool/ Ralf S. Engelschall rse@engelschall.com www.engelschall.com shtool-2.0.8/THANKS 644 0 0 421011022224466 127510ustar gnushtool 0 0 _ _ _ ___| |__ | |_ ___ ___ | | / __| '_ \| __/ _ \ / _ \| | \__ \ | | | || (_) | (_) | | |___/_| |_|\__\___/ \___/|_| GNU shtool -- The GNU Portable Shell Tool ____________________________________________________________________ THANKS Credit has to be given to the following people who contributed ideas, stuff, bugfixes, hints etc. (in alphabetical order): o Denis Barbier o Marcus Boerger o Bill Campbell o R. N. de Arenas Coronado o Paul Eggert o Alan Eldridge o Michael van Elst o Scott R. Every o Mike Frysinger o Daniel Richard G. o Dean Gaudet o Henri Gomez o Lars Hecking o Manuel Hendel o Sakagami Hiroki o Jim Jagielski o Martin Kraemer o Thomas Linden o Mirko Liss o Liones o Thomas Lotterer o Markus F.X.J. Oberhumer o James Rowe o Benjamin Saller o Michael Schloh o Christoph Schug o Sascha Schumann o Yitzchak Scott-Thoennes o Stefan Seefeld o Peter Simons o Evgeny Stambulchik o Gopal Narayanan o Miles Egan ...and all other shtool users who gave me feedback but I've forgot. shtool-2.0.8/VERSION 644 0 0 25511040046410 130620ustar gnushtool 0 0 VERSION -- Version Information for GNU shtool (syntax: Text) [automatically generated and maintained by GNU shtool] This is GNU shtool, Version 2.0.8 (18-Jul-2008) shtool-2.0.8/configure 755 0 0 23670011040046643 140170ustar gnushtool 0 0#! /bin/sh # From configure.ac 1.0. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.62 (OpenPKG-CURRENT). # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 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=: # Pre-4.2 versions of Zsh do 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 as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } 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.) 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 $as_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. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # 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 || $as_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=: # Pre-4.2 versions of Zsh do 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=: # Pre-4.2 versions of Zsh do 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 bug-autoconf@gnu.org about your system, echo including any error possibly output before this message. echo This can help us improve future autoconf versions. echo Configuration will now proceed without shell functions. } 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" || { $as_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 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then 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 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 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 SHTOOL_VERSION_STR SET_MAKE PERL POD2MAN LIBOBJS LTLIBOBJS' ac_subst_files='' ac_user_opts=' enable_option_checking ' ac_precious_vars='build_alias host_alias target_alias' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # 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_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=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_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=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 ;; -*) { $as_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 && { $as_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. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_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'` { $as_echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. 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 # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { $as_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 $as_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 .` || { $as_echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_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 -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | 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 .." { $as_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" || { $as_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 _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" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && 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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_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 $as_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.62 (OpenPKG-CURRENT) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 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.62 (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=. $as_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=`$as_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_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 $as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $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=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_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=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_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 && $as_echo "$as_me: caught signal $ac_signal" $as_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 an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_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 { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_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,) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_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 # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_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 { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 $as_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_VERSION_STR="`sh sh.version -l txt -d long VERSION`" sh sh.echo -e "Configuring %BGNU shtool%b (Portable Shell Tool), version %B${SHTOOL_VERSION_STR}%b" echo "Copyright (c) 1994-2008 Ralf S. Engelschall " { $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_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 $as_echo_n "(cached) " >&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 { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi { $as_echo "$as_me:$LINENO: checking for perl interpreter" >&5 $as_echo_n "checking for perl interpreter... " >&6; } PERL=`sh sh.path -m perl` { $as_echo "$as_me:$LINENO: result: $PERL" >&5 $as_echo "$PERL" >&6; } if test ".$PERL" = .; then echo "$0:Error: no perl interpreter found" 1>&2 exit 1 fi { $as_echo "$as_me:$LINENO: checking for pod2man conversion tool" >&5 $as_echo_n "checking for pod2man conversion tool... " >&6; } perldir=`sh sh.path -d $PERL` POD2MAN=`sh sh.path -m -p "${perldir}:${PATH}" pod2man` { $as_echo "$as_me:$LINENO: result: $POD2MAN" >&5 $as_echo "$POD2MAN" >&6; } if test ".$POD2MAN" = .; then echo "$0:Error: no pod2man tool found" 1>&2 exit 1 fi ac_config_files="$ac_config_files Makefile shtoolize" ac_config_commands="$ac_config_commands adjustment" 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_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 $as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $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" && { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_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}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.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=`$as_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_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $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 || ac_write_fail=1 ## --------------------- ## ## 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=: # Pre-4.2 versions of Zsh do 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 as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } 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.) 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 $as_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. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # 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 || $as_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" || { $as_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 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then 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 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.62 (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 || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 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 Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.62 (OpenPKG-CURRENT), with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 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' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. 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 ) $as_echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_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. -*) { $as_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 || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "shtoolize") CONFIG_FILES="$CONFIG_FILES shtoolize" ;; "adjustment") CONFIG_COMMANDS="$CONFIG_COMMANDS adjustment" ;; *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 $as_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_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason 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") } || { $as_echo "$as_me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 $as_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 rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 $as_echo "$as_me: error: could not setup config files machinery" >&2;} { (exit 1); exit 1; }; } _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 || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 $as_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 || { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 $as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; 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 '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; 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 || $as_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=`$as_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 || $as_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" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 $as_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=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_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 || ac_write_fail=1 # 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= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 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 || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;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 " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } 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"; } && { $as_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 $as_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 \ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 $as_echo "$as_me: error: could not create $ac_file" >&2;} { (exit 1); exit 1; }; } ;; :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "adjustment":C) chmod a+x shtoolize ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 $as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } # 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 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} fi shtool-2.0.8/configure.ac 644 0 0 360310774764051 143450ustar gnushtool 0 0dnl ## dnl ## configure.ac -- Autoconf source for GNU shtool dnl ## Copyright (c) 1999-2008 Ralf S. Engelschall dnl ## dnl ## This file is part of shtool and free software; you can redistribute dnl ## it and/or modify it under the terms of the GNU General Public dnl ## License as published by the Free Software Foundation; either version dnl ## 2 of the License, or (at your option) any later version. dnl ## dnl ## This file is distributed in the hope that it will be useful, dnl ## but WITHOUT ANY WARRANTY; without even the implied warranty of dnl ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU dnl ## General Public License for more details. dnl ## dnl ## You should have received a copy of the GNU General Public License dnl ## along with this program; if not, write to the Free Software dnl ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, dnl ## USA, or contact Ralf S. Engelschall . dnl ## AC_PREREQ(2.53) AC_REVISION($1.0$) AC_INIT(README) SHTOOL_VERSION_STR="`sh sh.version -l txt -d long VERSION`" sh sh.echo -e "Configuring %BGNU shtool%b (Portable Shell Tool), version %B${SHTOOL_VERSION_STR}%b" echo "Copyright (c) 1994-2008 Ralf S. Engelschall " AC_SUBST(SHTOOL_VERSION_STR) AC_PREFIX_DEFAULT(/usr/local) AC_SET_MAKE AC_MSG_CHECKING(for perl interpreter) PERL=`sh sh.path -m perl` AC_SUBST(PERL) AC_MSG_RESULT($PERL) if test ".$PERL" = .; then echo "$0:Error: no perl interpreter found" 1>&2 exit 1 fi AC_MSG_CHECKING(for pod2man conversion tool) perldir=`sh sh.path -d $PERL` POD2MAN=`sh sh.path -m -p "${perldir}:${PATH}" pod2man` AC_SUBST(POD2MAN) AC_MSG_RESULT($POD2MAN) if test ".$POD2MAN" = .; then echo "$0:Error: no pod2man tool found" 1>&2 exit 1 fi AC_CONFIG_FILES(Makefile shtoolize) AC_CONFIG_COMMANDS([adjustment], [chmod a+x shtoolize]) AC_OUTPUT shtool-2.0.8/sh.arx 644 0 0 1151210774764051 132230ustar gnushtool 0 0## ## arx -- Extended archive command ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B ar(1) extensional command =head1 SYNOPSIS B [B<-t>|B<--trace>] [B<-C>|B<--command> I] I I I [I ...] =head1 DESCRIPTION B is a wrapper around the archiving tool ar(1). It provides the ability to create archives out of existing archives, i.e., if one of I matches "C<*.a>", the archive member files of I are used instead of I itself. The trick of this command is the automatic handling of archive members which is especially interesting if one wants to construct a (usually top-level) library archive out of pre-built sub-library archives (usually staying inside subdirs) in a large source tree. For B based projects, a similar functionality is provided by B internally, too. =head1 OPTIONS The following command line options are available. =over 4 =item B<-t>, B<--trace> Shows the actually involved shell commands. =item B<-C>, B<--command> I Set the used ar(1) command to I instead of just "ar" (searched in C<$PATH>). =back =head1 EXAMPLE # Makefile AR=ar RANLIB=ranlib : OBJS=foo.o bar.o LIBS=baz/libbaz.a quux/libquux.a : libfoo.a: $(OBJS) $(LIBS) shtool arx -C $(AR) rc libfoo.a $(OBJS) $(LIBS) $(RANLIB) libfoo.a =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1999 for B. It was prompted by need to build libraries out of sub-libraries inside the B project. =head1 SEE ALSO shtool(1), ar(1). =cut shtool-2.0.8/sh.common 644 0 0 1373010774764051 137250ustar gnushtool 0 0## ## This file is part of shtool and 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 file 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 . ## ## ## 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 } shtool-2.0.8/sh.echo 644 0 0 3476310774764051 133640ustar gnushtool 0 0## ## echo -- Print string with optional construct expansion ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B echo(1) extensional command =head1 SYNOPSIS B [B<-n>|B<--newline>] [B<-e>|B<--expand>] I =head1 DESCRIPTION B is an echo(1) style command which prints I to F and optionally provides special expansion constructs (terminal bold mode, environment details, date, etc) and newline control. The trick of this command is that it provides a portable B<-n> option and hides the gory details needed to find out the environment details under option B<-e>. =head1 OPTIONS The following command line options are available. =over 4 =item B<-n>, B<--newline> By default, output is written to F followed by a "newline" (ASCII character 0x0a). If option B<-n> is used, this newline character is omitted. =item B<-e>, B<--expand> If option B<-e> is used, I can contain special "B<%>I" constructs which are expanded before the output is written. Currently the following constructs are recognized: =over 4 =item B<%B> switch terminal mode to bold display mode. =item B<%b> switch terminal mode back to normal display mode. =item B<%u> the current user name. =item B<%U> the current user id (numerical). =item B<%g> the current group name. =item B<%G> the current group id (numerical). =item B<%h> the current hostname (without any domain extension). =item B<%d> the current domain name. =item B<%D> the current day of the month. =item B<%M> the current month (numerical). =item B<%m> the current month name. =item B<%Y> the current year. =back =back =head1 EXAMPLE # shell script shtool echo -n -e "Enter your name [%B%u%b]: "; read name shtool echo -e "Your Email address might be %u@%h%d" shtool echo -e "The current date is %D-%m-%Y" =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for I (WML) under the name B. It was later taken over into B. =head1 SEE ALSO shtool(1), echo(1). =cut shtool-2.0.8/sh.fixperm 644 0 0 701610774764051 140670ustar gnushtool 0 0## ## fixperm -- Fix file permissions inside a source tree ## Copyright (c) 1996-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B file permission fixing command =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] I [I ...] =head1 DESCRIPTION B fixes file permissions inside a source tree under I by cleaning up the permission bits. It determines the cleaned up permission from the already set bits. It is intended to be run before a tarball is rolled (usually with B) out of a source tree. The trick is that this is more convenient than having to set the permissions manually or by using a large file list. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =back =head1 EXAMPLE # Makefile.in dist: shtool fixperm -v * ... =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1996 for I. It was later taken over into B. =head1 SEE ALSO shtool(1), chmod(1). =cut shtool-2.0.8/sh.install 644 0 0 2065310774764051 141050ustar gnushtool 0 0## ## install -- Install a program, script or datafile ## Copyright (c) 1997-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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="" . ./sh.common # 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 ## ## manual page ## =pod =head1 NAME B - B install(1) command =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-d>|B<--mkdir>] [B<-c>|B<--copy>] [B<-C>|B<--compare-copy>] [B<-s>|B<--strip>] [B<-m>|B<--mode> I] [B<-o>|B<--owner> I] [B<-g>|B<--group> I] [B<-e>|B<--exec> I] I [I ...] I =head1 DESCRIPTION This command installs a one or more Is to a given target I providing all important options of the BSD install(1) command. The trick is that the functionality is provided in a portable way. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-d>, B<--mkdir> To maximize BSD compatiblity, the BSD "B C" usage is internally mapped to the "B C" command. =item B<-c>, B<--copy> Copy the I to the target I. Default is to move. =item B<-C>, B<--compare-copy> Same as B<-c> except if the destination file already exists and is identical to the source file, no installation is done and the target remains untouched. =item B<-s>, B<--strip> This option strips program executables during the installation, see strip(1). Default is to install verbatim. =item B<-m>, B<--mode> I The file mode applied to the target, see chmod(1). Setting mode to "C<->" skips this step and leaves the operating system default which is usually based on umask(1). Some file modes require superuser privileges to be set. Default is 0755. =item B<-o>, B<--owner> I The file owner name or id applied to the target, see chown(1). This option requires superuser privileges to execute. Default is to skip this step and leave the operating system default which is usually based on the executing uid or the parent setuid directory. =item B<-g>, B<--group> I The file group name or id applied to the target, see chgrp(1). This option requires superuser privileges to execute to the fullest extend, otherwise the choice of I is limited on most operating systems. Default is to skip this step and leave the operating system default which is usually based on the executing gid or the parent setgid directory. =item B<-e>, B<--exec> I This option can be used one or multiple times to apply one or more sed(1) commands to the file contents during installation. =back =head1 EXAMPLE # Makefile install: : shtool install -c -s -m 4755 foo $(bindir)/ shtool install -c -m 644 foo.man $(mandir)/man1/foo.1 shtool install -c -m 644 -e "s/@p@/$prefix/g" foo.conf $(etcdir)/ =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1997 for B. It was prompted by portability issues in the installation procedures of B libraries. =head1 SEE ALSO shtool(1), umask(1), chmod(1), chown(1), chgrp(1), strip(1), sed(1). =cut shtool-2.0.8/sh.mdate 644 0 0 1463310774764051 135320ustar gnushtool 0 0## ## mdate -- Pretty-print modification time of a file or dir ## Copyright (c) 1995-1997 Free Software Foundation, Inc. ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B pretty-print last modification time =head1 SYNOPSIS B [B<-n>|B<--newline>] [B<-z>|B<--zero>] [B<-s>|B<--shorten>] [B<-d>|B<--digits>] [B<-f>|B<--field-sep> I] [B<-o>|B<--order> I] I =head1 DESCRIPTION This command pretty-prints the last modification time of a given file or directory I, while still allowing one to specify the format of the date to display. =head1 OPTIONS The following command line options are available. =over 4 =item B<-n>, B<--newline> By default, output is written to F followed by a "newline" (ASCII character 0x0a). If option B<-n> is used, this newline character is omitted. =item B<-z>, B<--zero> Pads numeric day and numeric month with a leading zero. Default is to have variable width. =item B<-s>, B<--shorten> Shortens the name of the month to a english three character abbreviation. Default is full english name. This option is silently ignored when combined with B<-d>. =item B<-d>, B<--digits> Use digits for month. Default is to use a english name. =item B<-f>, B<--field-sep> I Field separator string between the day month year tripple. Default is a single space character. =item B<-o>, B<--order> I Specifies order of the day month year elements within the tripple. Each element represented as a single character out of ``C'', ``C'' and ``C''. The default for I is ``C''. =head1 EXAMPLE # shell script shtool mdate -n / shtool mdate -f '/' -z -d -o ymd foo.txt shtool mdate -f '-' -s foo.txt =head1 HISTORY The B B command was originally written by Ulrich Drepper in 1995 and revised by Ralf S. Engelschall Erse@engelschall.comE in 1998 for inclusion into B. =head1 SEE ALSO shtool(1), date(1), ls(1). =cut shtool-2.0.8/sh.mkdir 644 0 0 1400210774764051 135340ustar gnushtool 0 0## ## mkdir -- Make one or more directories ## Copyright (c) 1996-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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="" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B mkdir(1) style command =head1 SYNOPSIS B [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-p>|B<--parents>] [B<-m>|B<--mode> I] [B<-o>|B<--owner> I] [B<-g>|B<--group> I] I [I ...] =head1 DESCRIPTION This is a mkdir(1) style command with additional options and the ability to be smart if the directory already exists which is important for installation procedures. =head1 OPTIONS The following command line options are available. =over 4 =item B<-t>, B<--trace> Shows the actually involved shell commands. =item B<-f>, B<--force> Forced continuation and no complaints if directory already exists. Default is to terminate with error. =item B<-p>, B<--parents> Automatic parent directory creation. Default is to only create the last directory in the path and fail if parents are missing. =item B<-m>, B<--mode> I The directory mode applied to the directory, see chmod(1). Omitting mode skips this step and leaves the operating system default which is usually based on umask(1). Some directory modes require superuser privileges to be set. Default is to stick with operating system defaults. =item B<-o>, B<--owner> I The directory owner name or id applied to the directory, see chown(1). This option requires superuser privileges to execute. Default is to skip this step and leave the operating system default which is usually based on the executing uid or the parent setuid directory. =item B<-g>, B<--group> I The directory group name or id applied to the directory, see chgrp(1). This option requires superuser privileges to execute to the fullest extend, otherwise the choice of I is limited on most operating systems. Default is to skip this step and leave the operating system default which is usually based on the executing gid or the parent setgid directory. =head1 EXAMPLE # Makefile install: shtool mkdir -f -p -m 755 $(bindir) shtool mkdir -f -p -m 755 $(mandir)/man1 : =head1 HISTORY The B B command was originally written for Public Domain by Noah Friedman and later revised by Ralf S. Engelschall Erse@engelschall.comE in 1999 for inclusion into B. =head1 SEE ALSO shtool(1), mkdir(1). =cut shtool-2.0.8/sh.mkln 644 0 0 1473411022224377 133700ustar gnushtool 0 0## ## mkln -- Make link with calculation of relative paths ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common # 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 ## ## manual page ## =pod =head1 NAME B - B enhanced ln(1) replacement =head1 SYNOPSIS B [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-s>|B<--symbolic>] I [I ...] I =head1 DESCRIPTION This is a ln(1) style command. It is enhanced to provide automatic calculation and usage of relative links with the shortest possible path, if possible. Usually if I and I are not absolute paths or at least they share a common prefix except the root directory (``C''). When more than one I is specified, all of them are linked into I. =head1 OPTIONS The following command line options are available. =over 4 =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-f>, B<--force> Force the creation of the link even if it exists. Default is to fail with error. =item B<-s>, B<--symbolic> Create a symbolic link instead of a hard-link. =back =head1 EXAMPLE # shell script shtool mkln -s foo/bar baz/quux =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for I. =head1 SEE ALSO shtool(1), ln(1). =cut shtool-2.0.8/sh.mkshadow 644 0 0 1301010774764051 142410ustar gnushtool 0 0## ## mkshadow -- Make a shadow tree through symbolic links ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common # 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 ## ## manual page ## =pod =head1 NAME B - B create shadow tree using symlinks =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-a>|B<--all>] I I =head1 DESCRIPTION This command creates a shadow tree of I under I by recreating the directory hierarchy of I under I and by creating the files of I by linking them into the corresponding directories under I via symbolic links. When I can be reached via relative paths from I, relative symbolic links are used, too. This high-level functionality is originally designed for developers to create copies of source trees. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-a>, B<--all> Really shadow all files and directories in I. Default is to skip CVS related files and directories, backup files, object files, etc. =head1 EXAMPLE # shell script shtool mkshadow -v -a . /tmp/shadow =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for B. It was later revised and taken over into B. =head1 SEE ALSO shtool(1), ln(1). =cut shtool-2.0.8/sh.move 644 0 0 1203310774764051 133760ustar gnushtool 0 0## ## move -- Move files with simultaneous substitution ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B enhanced mv(1) replacement =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-e>|B<--expand>] [B<-p>|B<--preserve>] I I =head1 DESCRIPTION This is a mv(1) style command enhanced with the ability to rename multiple files in a single operation and the ability to detect and not touch existing equal destinations files, thus preserving timestamps. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-e>, B<--expand> Expand asterisk in I to be used as "C<%>I" (where I is C<1>,C<2>,...) in I. This is useful for renaming multiple files at once. =item B<-p>, B<--preserve> Detect I and I having equal content and not touch existing destination files, thus perserving timestamps. This is useful for applications that monitor timestamps, i.e. suppress make(1L) repeating actions for unchanged files. =back =head1 EXAMPLE # shell script shtool move -v -e '*.txt' %1.asc # Makefile scanner.c: scanner.l lex scanner.l shtool move -t -p lex.yy.c scanner.c =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1999 for B. =head1 SEE ALSO shtool(1), mv(1), make(1). =cut shtool-2.0.8/sh.path 644 0 0 1462210774764051 133720ustar gnushtool 0 0## ## path -- Deal with program paths ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B command dealing with shell path variables =head1 SYNOPSIS B [B<-s>|B<--suppress>] [B<-r>|B<--reverse>] [B<-d>|B<--dirname>] [B<-b>|B<--basename>] [B<-m>|B<--magic>] [B<-p>|B<--path> I] I [I ...] =head1 DESCRIPTION This command deals with shell C<$PATH> variables. It can find a program through one or more filenames given by one or more I arguments. It prints the absolute filesystem path to the program displayed on C plus an exit code of 0 if it was really found. =head1 OPTIONS The following command line options are available. =over 4 =item B<-s>, B<--suppress> Supress output. Useful to only test whether a program exists with the help of the return code. =item B<-r>, B<--reverse> Transform a forward path to a subdirectory into a reverse path. =item B<-d>, B<--dirname> Output the directory name of I. =item B<-b>, B<--basename> Output the base name of I. =item B<-m>, B<--magic> Enable advanced magic search for "C" and "C". =item B<-p>, B<--path> I Search in I. Default is to search in $PATH. =back =head1 EXAMPLE # shell script awk=`shtool path -p "${PATH}:." gawk nawk awk` perl=`shtool path -m perl` cpp=`shtool path -m cpp` revpath=`shtool path -r path/to/subdir` =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for B. It was later taken over into B. =head1 SEE ALSO shtool(1), which(1). =cut shtool-2.0.8/sh.platform 644 0 0 7303310774764051 142630ustar gnushtool 0 0## ## platform -- Platform Identification Utility ## Copyright (c) 2003-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common # 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" ;; # DragonFly BSD *:DragonFly:* ) # 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="DragonFly ${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 [ ".`egrep '(Red Hat Enterprise Linux|CentOS)' /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="[Novell ]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:* ) # determine architecture 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=PPC fi elif [ -d /QOpenSys ]; then # IBM i5/OS (aka OS/400) with PASE (Portable Application Solutions Environment) cpu_arch=PPC 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}" # determine system ST="[IBM ]${os_level}" SP="${ST}" case "${os_level}" in [12]* ) SC="SVR2" ;; * ) SC="SVR4" ;; esac ;; # Apple Mac OS X (Darwin) *:Darwin:* ) # determine architecture AT="`uname -p`" case "${AT}" in powerpc ) AT="PPC" ;; esac AP="${AT}" case "${AP}" in i?86 ) AP="iX86" ;; esac AC="${AP}" # determine system unset v1; unset v2; unset v3 eval `echo "${UNAME_RELEASE}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` ST="[Apple ]<${UNAME_SYSTEM} ${v1}>${v2+.$v2}${v3+[.$v3]}" SP="$ST" v="`(sw_vers) 2>/dev/null | grep 'ProductVersion:' | sed -e 's/^ProductVersion:[^0-9]*\([0-9][0-9.]*\).*$/\1/'`" if [ ".$v" = . ]; then for name in System Server; do if [ -f /System/Library/CoreServices/${name}Version.plist ]; then v=`(defaults read "/System/Library/CoreServices/${name}Version" "ProductVersion") 2>/dev/null` [ ".$v" != . ] && break fi done fi if [ ".$v" != . ]; then unset v1; unset v2; unset v3 eval `echo "${v}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` SP="[Apple ]Mac OS X ${v1}${v2+.$v2}${v3+[.$v3]}" fi SC="4.4BSD/Mach3.0" ;; # Windows/Cygwin *:CYGWIN*:* ) # determine architecture AT="`uname -m`" AP="${AT}" case "${AP}" in i?86 ) AP="iX86" ;; esac AC="${AP}" # determine system unset v1; unset v2; unset v3 eval `echo "${UNAME_RELEASE}" |\ sed -e 's/^/#/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"; v3="\3"/' \ -e 's/^#\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$/v1="\1"; v2="\2"/' \ -e 's/^#\([0-9][0-9]*\).*$/v1="\1"/' \ -e 's/^#.*$/v1="0"/'` ST="Cygwin ${v1}${v2+.$v2}${v3+[.$v3]}" SP="$ST" SC="Windows" v=`echo "${UNAME_SYSTEM}" | sed -e 's/^CYGWIN_NT-//' |\ sed -e 's/^/#/' -e 's/^#\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/' -e 's/^#.*$//'` case "$v" in 4.0 ) SC="$SC[ NT]" ;; 5.0 ) SC="$SC[ 2000]" ;; 5.1 ) SC="$SC[ XP]" ;; 6.0 ) SC="$SC[ Vista]" ;; esac ;; # 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 ## ## manual page ## =pod =head1 NAME B - B Unix platform identification =head1 SYNOPSIS B [B<-F>|B<--format> I] [B<-S>|B<--sep> I] [B<-C>|B<--conc> I] [B<-L>|B<--lower>] [B<-U>|B<--upper>] [B<-v>|B<--verbose>] [B<-c>|B<--concise>] [B<-n>|B<--newline>] [B<-d>|B<--debug>] [B<-t>|B<--type> I] [B<-n>|B<--newline>] [B<-d>|B<--debug>] =head1 DESCRIPTION B is a flexible Unix platform identification program. It distinguishes a platform according to its I and I. For both there is a I, I and I identification. For each of those six identifications, there is a I, I and I version. This leads to eighteen (2x3x3) available identification strings for each platform, from which usually 2 are chosen in a particular situation. This is done by assembling the platform identification string using a I string containing one or more identification constructs of the forms "C<%[xx]>" (verbose), "C<%{xx}>" (regular) and "C<%ExxE>" (concise). =head1 OPTIONS The following command line options are available. =over 4 =item B<-F>, B<--format> I This option controls the output formatting of this program. It is a plain-text string with the "C<%>I" constructs which expand to the various platform information strings. "C<%{>IC<}>" is the canonical regular version of the information. "C<%[>IC<]>" is the verbose version of the information. "C<%E>IC>" is the concise version of the information. In total, the following constructs are available for expansion: %[ac] verbose hardware architecture class %{ac} regular hardware architecture class % concise hardware architecture class %[ap] verbose hardware architecture product %{ap} regular hardware architecture product % concise hardware architecture product %[at] verbose hardware architecture technology %{at} regular hardware architecture technology % concise hardware architecture technology %[sc] verbose operating system class %{sc} regular operating system class % concise operating system class %[sp] verbose operating system product %{sp} regular operating system product % concise operating system product %[st] verbose operating system technology %{st} regular operating system technology % concise operating system technology The default I string is "C<%{sp} (%{ap})>", providing the regular operating system and hardware architecture product information. =item B<-S>, B<--sep> I This option sets the word I string for the platform information strings. By default it is "C< >" (whitespace). It is especially used for separating the operating system name and the operating system version. =item B<-C>, B<--conc> I This option sets the word I string for the platform information strings. By default it is "C". It is especially used to concatenate multiple parts in operating system name and version parts. =item B<-L>, B<--lower> This options enforces conversion of the output to all I case. =item B<-U>, B<--upper> This options enforces conversion of the output to all I case. =item B<-v>, B<--verbose> This option enforces verbose versions of all expansion constructs in I string of option B<-F>. It is equal to specifying all expansion constructs as "C<%[>IC<]>". =item B<-c>, B<--concise> This option enforces concise versions of all expansion constructs in I string of option B<-F>. It is equal to specifying all expansion constructs as "C<%E>IC>". =item B<-n>, B<--no-newline> This option omits the usual trailing newline character in the output. =item B<-t>, B<--type> I This option is a meta option which internally sets options B<-F>, B<-S>, B<-C>, B<-L>, B<-U>, B<-v> or B<-c> according to I. It can be used to easily specify various commonly known outputs. The following Is are available: =over 4 =item B Binary Package Id (OpenPKG RPM). This is equal to "C<-F '%-%' -L -S '' -C '+'>" and results in outputs like "C" and "C". =item B Build-Time Checking (OpenPKG RPM). This is equal to "C<-F '%-%' -L -S '' -C '+'>" and results in outputs like "C" and "C". =item B GNU F Style Id. This is similar to B and is equal to "C<-F '"%-unknown-%' -L -S '' -C '+'>" and results in outputs like "C" and "C". =item B HTTP Server Header Id. This is equal to "C<-F '"%-%' -S '/' -C '+'>" and results in outputs like "C" and "C". =item B Human Readable Verbose Summary Information. This is equal to "C<-F 'Class: %[sc] (%[ac])\nProduct: %[sp] (%[ap])\nTechnology: %[st] (%[at])' -S ' ' -C '/'>" and results in outputs like: Class: 4.4BSD (iX86) Product: FreeBSD 4.9-RC (iX86) Technology: FreeBSD 4.9-RC (i686) and Class: LSB (iX86) Product: Debian GNU/Linux 3.0 (iX86) Technology: GNU/Linux 2.2/2.4 (i686) =item B All-In-One Full-Table Information. This just outputs really all 2x2x3 identification strings as a table. =back =item B<-d>, B<--debug> This option enables some internal debugging messages. =item B<-V>, B<--version> This option outputs the version information of B only. =item B<-h>, B<--help> This option outputs the usage information of B only. =back =head1 EXAMPLE The following real-life use cases are known: =over 4 =item B build-time decisions $ platform -c -L -S "" -C "+" -F "%at-%st" $ platform -c -L -S "" -C "+" -F "%ac-%sc" =item B binary RPM packages $ platform -c -L -S "" -C "+" -F "%ap-%sp" =item F files $ platform -v -F "%sp (%ap)" $ platform -v -F "%sc (%ac)" =item Debugging $ platform --type=all-in-one =back =head1 SUPPORT B currently knows the following particular Unix platforms in detail: FreeBSD, NetBSD, OpenBSD, Linux, Sun Solaris, SCO UnixWare, QNX Neutrino, SGI IRIX, HP HP-UX, HP Tru64, IBM AIX and Apple Mac OS X Darwin. All other Unix platforms are recognized through generic uname(1) information and so usually can be identified sufficiently, although the identification might be not as precise as possible. =head1 HISTORY B was implemented in September 2003 by I for use in the B and B projects. It was prompted by the need in B to have both product (for RPM filenames) and technology (for build-time decisions) identifiers for the Unix platforms, OpenPKG packages are maintained for. It was inspired by the B F and the old B F command. The major difference to B F is that B does not use a I identification (cannot be determined most of the time and is not used at all in all projects I've ever seen) and is a lot more flexible (class, product and technology identifications combined with verbose, regular and concise outputs). The drawback of B is that it (still) knows less particular platforms, although the generic platform identification is sufficient enough most of the time. =head1 SEE ALSO uname(3), GNU F. =cut shtool-2.0.8/sh.prop 644 0 0 577010774764051 134020ustar gnushtool 0 0## ## prop -- Display progress with a running propeller ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## str_tool="prop" str_usage="[-p|--prefix ]" arg_spec="0=" opt_spec="p:" opt_alias="p:prefix" opt_p="" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B propeller processing indication =head1 SYNOPSIS B [B<-p>|B<--prefix> I] =head1 DESCRIPTION This command displays a processing indication though a running propeller. It is intended to be run at the end of a pipe ("C<|>") sequence where on C logging/processing informations found. For every line on C the propeller advances one step clock-wise. =head1 OPTIONS The following command line options are available. =over 4 =item B<-p>, B<--prefix> I Set a particular prefix I which is displayed in front of the propeller. The default is no prefix string. =back =head1 EXAMPLE # shell script configure 2>&1 |\ tee logfile |\ shtool prop -p "Configuring sources" =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for B. It was later taken over into B. =head1 SEE ALSO shtool(1). =cut shtool-2.0.8/sh.rotate 644 0 0 4677410774764051 137510ustar gnushtool 0 0## ## rotate -- Logfile rotation ## Copyright (c) 2001-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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="" . ./sh.common # 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 ## ## manual page ## =pod =head1 NAME B - B log file rotation =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-n>|B<--num-files> I] [B<-s>|B<--size> I] [B<-c>|B<--copy>] [B<-r>|B<--remove>] [B<-a>|B<--archive-dir> I] [B<-z>|B<--compress> [I:]I] [B<-b>|B<--background>] [B<-d>|B<--delay>] [B<-p>|B<--pad> I] [B<-m>|B<--mode> I] [B<-o>|B<--owner> I] [B<-g>|B<--group> I] [B<-M>|B<--migrate> I] [B<-P>|B<--prolog> I] [B<-E>|B<--epilog> I] I [I ...] =head1 DESCRIPTION This command rotates a logfile I by subsequently creating up to I (optionally compressed) archive files of it. Archive files are named "I.I[I" where I is the version number, 0 being the newest and "I-1" the oldest. A rotation step consists of the following steps 1. remove last archive file 2. shift archive file numbers 3. create archive file 0 from I 4. truncate/recreate I =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-f>, B<--force> Force silent creation of archive directory if it does not exists. Also skip missing intermediate logfiles in the rotation step. Default is to exit with error in both cases. FIXME =item B<-n>, B<--num-files> I Create I archive files. Default is 10. =item B<-s>, B<--size> I Only rotate if logfile exceeds I. The argument I can be specified also with the trailing units C (kilo), C (mega) or C (giga). The "prolog" and "epilog" are only executed if rotation actually takes place. =item B<-c>, B<--copy> Copy I to archive then truncate original. The default is to move I to archive. Unless an application reopens its logfile it will continue to write to the same file. In the default move case the application will write to the archive which it had previously opened as I. In the copy case the application will write to the original I. The drawback of the copy approach is that logfile entries are lost when they are written to I between the execution of the copy and the truncation operation. The drawback of the move approach is that the application needs to detect the move or must be triggered to reopen its log (i.e. through epilog). =item B<-r>, B<--remove> Removes I after rotation instead of providing a new empty file. =item B<-a>, B<--archive-dir> I Specify the archive directory. Default is to create archives in the same directory as I is located. =item B<-z>, B<--compress> [I:]I Enables compression of archive files with compression level I By default, the tools bzip2(1), gzip(1) and compress(1) are searched for in C<$PATH>, but one also can override this by prefixing the compression level with one of the three particular tool names. =item B<-b>, B<--background> Enable background compression. =item B<-d>, B<--delay> Delays the compression of archive file number 0. This is useful if ``B<-c>'' is not used, because an application might continue to write to archive file 0 through an already open file handle. =item B<-p>, B<--pad> I Enables padding with leading zeros in the I part of the filename "I.II". The default padding I is 1. This is interesting if more than 10 archive files are used, because it leads to still sorted directory listings. =item B<-m>, B<--mode> I The file mode applied to the created files, see chmod(1). Setting mode to C<-> skips this step and leaves the operating system default which is usually based on umask(1). Some file modes require superuser privileges to be set. Default is 0755. =item B<-o>, B<--owner> I The file owner name or id applied to the created files, see chown(1). This option requires superuser privileges to execute. Default is to skip this step and leave the operating system default which is usually based on the executing uid or the parent setuid directory. =item B<-g>, B<--group> I The file group name or id applied to the created files, see chgrp(1). This option requires superuser privileges to execute to the fullest extend, otherwise the choice of I is limited on most operating systems. Default is to skip this step and leave the operating system default which is usually based on the executing gid or the parent setgid directory. =item B<-M>, B<--migrate> I Execute a "migration" command just before the archive file number I-1 is removed from the filesystem. The specified I receives the archive filename as command line argument. =item B<-P>, B<--prolog> I Execute a "prolog" command before the rotation step. Useful in conjunction with B<-s>. =item B<-E>, B<--epilog> I Execute a "epilog" command after the rotation step. Useful in conjunction with B<-s>. =back =head1 EXAMPLE # shell script shtool rotate -n10 -s1M -zbzip2:9 -d -r /var/log/ap.access.log shtool rotate -n5 -s128K -zbzip2:9 -d -r /var/log/ap.error.log apachectl graceful =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 2001 for B. Its development was prompted by the need to have a flexible logfile rotation facility in the B project. =head1 SEE ALSO shtool(1), BSD newsyslog(8). =cut shtool-2.0.8/sh.scpp 644 0 0 2617610774764051 134120ustar gnushtool 0 0## ## scpp -- Sharing C Pre-Processor ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B C source file pre-processor =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-p>|B<--preserve>] [B<-f>|B<--filter> I] [B<-o>|B<--output> I] [B<-t>|B<--template> I] [B<-M>|B<--mark> I] [B<-D>|B<--define> I] [B<-C>|B<--class> I] I [I ...] =head1 DESCRIPTION This command is an additional ANSI C source file pre-processor for sharing cpp(1) code segments, internal variables and internal functions. The intention for this comes from writing libraries in ANSI C. Here a common shared internal header file is usually used for sharing information between the library source files. The operation is to parse special constructs in Is, generate a few things out of these constructs and insert them at position I in I by writing the output to I. Additionally the Is are never touched or modified. Instead the constructs are removed later by the cpp(1) phase of the build process. The only prerequisite is that every I has a ``C<#include ">IC<">'' at the top. This command provides the following features: First it avoids namespace pollution and reduces prototyping efforts for internal symbols by recognizing functions and variables which are defined with the storage class identifier ``I''. For instance if I is ``intern'', a function ``C'' in one of the Is is translated into both a ``C<#define foobar __foobar>'' and a ``C'' in I. Additionally a global ``C<#define> I C'' is also created in I to let the compiler silently ignore this additional storage class identifier. Second, the library source files usually want to share Cs, C<#define>s, etc. over the source file boundaries. To achieve this one can either place this stuff manually into I or use the second feature of B: All code in Is encapsulated with ``C<#if >I ... C<#endif>'' is automatically copied to I. Additionally a global ``C<#define> I C<0>'' is also created in I to let the compiler silently skip this parts (because it was already found in the header). =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-p>, B<--preserve> Preserves I independent of the generated ``#line'' lines. This is useful for Makefiles if the real contents of I will not change, just line numbers. Default is to overwrite. =item B<-f>, B<--filter> I Apply one or more pre-processing sed(1) I commands (usually of type ``C'') to each input file before their input is parsed. This option can occur multiple times. =item B<-o>, B<--output> I Output file name. Default is C. =item B<-t>, B<--template> I Template file name. Default is C. =item B<-M>, B<--mark> I Mark to be replaced by generated constructs. Default is C<%%MARK%%>. =item B<-D>, B<--define> I FIXME. Default is C. =item B<-C>, B<--class> I FIXME. Default is C. =back =head1 EXAMPLE # Makefile SRCS=foo_bar.c foo_quux.c foo_p.h: foo_p.h.in shtool scpp -o foo_p.h -t foo_p.h.in \ -M %%MARK%% -D cpp -C intern $(SRCS) /* foo_p.h.in */ #ifndef FOO_P_H #define FOO_P_H %%MARK%% #endif /* FOO_P_H */ /* foo_bar.c */ #include "foo_p.h" #if cpp #define OURS_INIT 4711 #endif intern int ours; static int myone = 0815; intern int bar(void) { ours += myone; } /* foo_quux.c */ #include "foo_p.h" int main(int argc, char *argv[]) { int i; ours = OURS_INIT for (i = 0; i < 10; i++) { bar(); printf("ours now %d\n", ours); } return 0; } =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1999 for B. Its was prompted by the need to have a pre-processing facility in the B project. =head1 SEE ALSO shtool(1), cpp(1). =cut shtool-2.0.8/sh.slo 644 0 0 1606110774764051 132320ustar gnushtool 0 0## ## slo -- Separate linker options by library class ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## str_tool="slo" str_usage="[-p|--prefix ] -- -L -l [-L -l ...]" arg_spec="1+" opt_spec="p:" opt_alias="p:prefix" opt_p="SLO_" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B separate linker options by library class =head1 SYNOPSIS B [B<-p>|B<--prefix> I] -- B<-L>I B<-l>I [B<-L>I B<-l>I ...] =head1 DESCRIPTION This command separates the linker options ``B<-L>'' and ``B<-l>'' by library class. It's argument line can actually be an arbitrary command line where those options are contained. B parses these two options only and ignores the remaining contents. The result is a trivial shell script on C which defines six variables containing the ``B<-L>'' and ``B<-l>'' options sorted by class: ``C'' and ``C'' contains the ``B<-L>'' and ``B<-l>'' options of static libraries, ``C'' and ``C'' contains the ``B<-L>'' and ``B<-l>'' options of static libraries containing PIC ("Position Independent Code") and ``C'' and ``C'' contains the ``B<-L>'' and ``B<-l>'' options of shared libraries. The B<-p> option can be used to change the default variable prefix from "C" to I. The intent of this separation is to provide a way between static and shared libraries which is important if one wants to link custom DSOs against libraries, because not all platforms all one to link these DSOs against shared libraries. So one first has to separate out the shared libraries and link the DSO only against the static libraries. One can use this command also to just sort the options. =head1 OPTIONS The following command line options are available. =over 4 =item B<-p>, B<--prefix> I FIXME =item B<-L>I Directory where libraries are searched in. =item B<-l>I Library to search for. =back =head1 EXAMPLE # configure.in LINK_STD="$LDFLAGS $LIBS" eval `shtool slo $LINK_STD` LINK_DSO="$SLO_DIRS_OBJ $SLO_LIBS_OBJ $SLO_DIRS_PIC $SLO_LIBS_PIC" : =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1998 for B. It was later taken over into B. =head1 SEE ALSO shtool(1), ld(1). =cut shtool-2.0.8/sh.subst 644 0 0 2053210774764051 135730ustar gnushtool 0 0## ## subst -- Apply sed(1) substitution operations ## Copyright (c) 2001-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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="" . ./sh.common # 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 ## ## manual page ## =pod =head1 NAME B - B sed(1) substitution operations =head1 SYNOPSIS B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-n>|B<--nop>] [B<-w>|B<--warning>] [B<-q>|B<--quiet>] [B<-s>|B<--stealth>] [B<-i>|B<--interactive>] [B<-b>|B<--backup> I] [B<-e>|B<--exec> I] [B<-f>|B<--file> I] [I] [I ...] =head1 DESCRIPTION This command applies one or more sed(1) substitution operations to F or any number of files. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-n>, B<--nop> No operation mode. Actual execution of the essential shell commands which would be executed is suppressed. =item B<-w>, B<--warning> Show warning on substitution operation resulting in no content change on I file. The default is to show a warning on substitution operations resulted in no content change on I files. =item B<-q>, B<--quiet> Suppress warning on substitution operation resulting in no content change. =item B<-s>, B<--stealth> Stealth operation. Preserve timestamp on I. =item B<-i>, B<--interactive> Enter interactive mode where the user has to approve each operation. =item B<-b>, B<--backup> I Preserve backup of original file using file name extension I. Default is to overwrite the original file. =item B<-e>, B<--exec> I Specify sed(1) command directly. =item B<-f>, B<--file> I Read sed(1) command from I. =back =head1 EXAMPLE # shell script shtool subst -i -e 's;(c) \([0-9]*\)-2000;(c) \1-2001;' *.[ch] # RPM spec-file %install shtool subst -v -n \ -e 's;^\(prefix=\).*;\1 $RPM_BUILD_ROOT%{_prefix};g' \ -e 's;^\(sysconfdir=\).*;\1 $RPM_BUILD_ROOT%{_prefix}/etc;g' \ `find . -name Makefile -print` make install =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 2001 for B. It was prompted by the need to have a uniform and convenient patching frontend to sed(1) operations in the B package specifications. =head1 SEE ALSO shtool(1), sed(1). =cut shtool-2.0.8/sh.table 644 0 0 740210774764051 135030ustar gnushtool 0 0## ## table -- Pretty-print a field-separated list as a table ## Copyright (c) 1998-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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 . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B pretty-print a field-separated list =head1 SYNOPSIS B [B<-F>|B<--field-sep> I] [B<-w>|B<--width> I] [B<-c>|B<--columns> I] [B<-s>|B<--strip> I] IBI... =head1 DESCRIPTION This pretty-prints a list of strings as a table. =head1 OPTIONS The following command line options are available. =over 4 =item B<-F>, B<--field-sep> I Separate columns using I. Default is C<:>. =item B<-w>, B<--width> I Width of each column. Default is 15 characters. =item B<-c>, B<--columns> I Number of columns. Default is C<3>. =item B<-s>, B<--strip> I Strip off any characters past I. Default is C<79>. =back =head1 EXAMPLE # shell script shtool table -F , -w 5 -c 4 "1,2,3,4,5,6,7,8,9,10,11,12" =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1999 for B. =head1 SEE ALSO shtool(1), tr(1), fmt(1), sh(1), awk(1), sed(1). =cut shtool-2.0.8/sh.tarball 644 0 0 2044510774764051 140570ustar gnushtool 0 0## ## tarball -- Roll distribution tarballs ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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]\$" . ./sh.common 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 ## ## manual page ## =pod =head1 NAME B - B command for rolling standardized tarballs =head1 SYNOPSIS B [B<-t>|B<--trace>] [B<-v>|B<--verbose>] [B<-o>|B<--output> I] [B<-c>|B<--compress> I] [B<-d>|B<--directory> I] [B<-u>|B<--user> I] [B<-g>|B<--group> I] [B<-e>|B<--exclude> I] I [I ...] =head1 DESCRIPTION This command is for rolling input files under I into a distribution tarballs which can be extracted by tar(1). The four important aspects of good open source software tarballs are: (1) unpack into a single top-level directory, (2) top-level directory corresponds to the tarball filename, (3) tarball files should be sorted and (4) arbitrary names for file owner and group. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Display some processing information. =item B<-t>, B<--trace> Enable the output of the essential shell commands which are executed. =item B<-o>, B<--output> I Output tarball to file I. =item B<-c>, B<--compress> I Pipe resulting tarball through compression program I. =item B<-d>, B<--directory> I Sets the top-level directory into which the tarball unpacks. By default it is I without the trailing C<.tar.*> extension. =item B<-u>, B<--user> I The user (owner) of files and directories in the tarball to I. =item B<-g>, B<--group> I The group of files and directories in the tarball to I. =item B<-e>, B<--exclude> I Exclude files and directories matching comma-separated list of regex I from the tarball. Directories are expanded before the filtering takes place. The default filter pattern is "C". =back =head1 EXAMPLE # Makefile.in dist: ... V=`shtool version -d short ...`; \ shtool tarball -o foobar-$$V.tar.gz -c 'gzip -9' \ -u bar -g gnu -e 'CVS,\.cvsignore' . =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1999 for B. =head1 SEE ALSO shtool(1), tar(1), compress(1). =cut shtool-2.0.8/sh.version 644 0 0 3302510774764051 141210ustar gnushtool 0 0## ## version -- Maintain a version information file ## Copyright (c) 1994-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## 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" . ./sh.common file="$1" # determine prefix and name name="$opt_n" prefix="$opt_p" # determine current version triple="$opt_s" if [ ".$triple" != . ]; then # use given triple if [ ".`echo $triple | grep '[0-9]*.[0-9]*[sabp.][0-9]*'`" = . ]; then echo "$msgprefix:Error: invalid argument to option \`-s': \`$opt_s'" 1>&2 shtool_exit 1 fi eval `echo $triple |\ sed -e 's%\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\).*%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc elif [ -r $file ]; then # determine triple from given file eval `grep 'Version [0-9]*.[0-9]*[sabp.][0-9]* ([0-9]*-[a-zA-Z]*-[0-9]*)' $file |\ sed -e 's%.*Version \([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\) (\([0-9]*-[a-zA-Z]*-[0-9]*\)).*%\ ver="\1";rev="\2";typ="\3";lev="\4";tim="\5"%' -e 'q'` else # intialise to first version ver=0 rev=1 typ=. lev=0 tim=calc fi # determine new version in batch if [ ".$opt_i" != . ]; then case $opt_i in v ) ver=`expr $ver + 1` rev=0 lev=0 ;; r ) rev=`expr $rev + 1` lev=0 ;; l ) lev=`expr $lev + 1` ;; * ) echo "$msgprefix:Error: invalid argument to option \`-i': \`$opt_i'" 1>&2 shtool_exit 1 ;; esac tim=calc fi # determine new version interactively if [ ".$opt_e" = .yes ]; then echo "old version: ${ver}.${rev}${typ}${lev}" while [ 1 ]; do echo dummy | awk '{ printf("new version: "); }' read triple case $triple in [0-9]*.[0-9]*[sabp.][0-9]* ) ;; * ) echo "$msgprefix:Error: invalid version string entered: \`$triple'" 1>&2 continue ;; esac break done eval `echo $triple |\ sed -e 's%^\([0-9]*\)\.\([0-9]*\)\([sabp.]\)\([0-9]*\)$%\ ver="\1";rev="\2";typ="\3";lev="\4"%'` tim=calc fi # determine hexadecimal and libtool value of version case $typ in a ) typnum=0; levnum=$lev ;; b ) typnum=1; levnum=$lev ;; p | . ) typnum=2; levnum=$lev ;; s ) typnum=15; levnum=255 ;; # snapshots are special esac hex=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("0x%x%02x%1x%02x", $1, $2, $3, $4); }' |\ tr 'abcdef' 'ABCDEF'` ltv=`echo "$ver:$rev:$typnum:$levnum" |\ awk -F: '{ printf("%d:%d", $1*10 + $2, $3*10 + $4); }'` # determine date if [ ".$tim" = .calc ]; then day=`date '+%d'` month=`date '+%m'` year=`date '+%Y' 2>/dev/null` if [ ".$time_year" = . ]; then year=`date '+%y'` case $year in [5-9][0-9]) year="19$year" ;; [0-4][0-9]) year="20$year" ;; esac fi case $month in 1|01) month='Jan' ;; 2|02) month='Feb' ;; 3|03) month='Mar' ;; 4|04) month='Apr' ;; 5|05) month='May' ;; 6|06) month='Jun' ;; 7|07) month='Jul' ;; 8|08) month='Aug' ;; 9|09) month='Sep' ;; 10) month='Oct' ;; 11) month='Nov' ;; 12) month='Dec' ;; esac tim="${day}-${month}-${year}" fi # perform result actions mode=show if [ ".$opt_i" != . ]; then mode=edit elif [ ".$opt_e" = .yes ]; then mode=edit elif [ ".$opt_s" != . ]; then mode=edit fi if [ ".$mode" = .show ]; then # just display the current version case $opt_d in short ) echo "${ver}.${rev}${typ}${lev}" ;; long ) echo "${ver}.${rev}${typ}${lev} ($tim)" ;; libtool ) echo "${ltv}" ;; hex ) echo "${hex}" ;; * ) echo "$msgprefix:Error: invalid argument to option \`-d': \`$opt_d'" 1>&2 shtool_exit 1 ;; esac else # update the version file # pre-generate various strings triple="${ver}.${rev}${typ}${lev}" vHex="$hex" vShort="${triple}" vLong="${triple} (${tim})" vTeX="This is ${name}, Version ${triple} (${tim})" vGNU="${name} ${triple} (${tim})" vWeb="${name}/${triple}" vSCCS="@(#)${name} ${triple} (${tim})" vRCS="\$Id: ${name} ${triple} (${tim}) \$" # determine string out of filename # (do NOT try to optimize this in any way because of portability) filestr=`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 ## ## manual page ## =pod =head1 NAME B - B maintain version information file =head1 SYNOPSIS B [B<-l>|B<--language> I] [B<-n>|B<--name> I] [B<-p>|B<--prefix> I] [B<-s>|B<--set> I] [B<-e>|B<--edit>] [B<-i>|B<--increase> I] [B<-d>|B<--display> I] I =head1 DESCRIPTION This command displays and maintains version information in I. The version is always described with a triple EI,I,IE and is represented by a string which always matches the regular expression "C<[0-9]+\.[0-9]+[sabp.][0-9]+>". The hexadecimal format for a version C is C where C and C directly correspond to C and C, C encodes the level type as C<9>, C<2>, C<1>, C<0> (representing C, C

/C<.>, C, C in this order) and C is either directly corresponding to C or set to C<99> if level type is C. =head1 OPTIONS The following command line options are available. =over 4 =item B<-v>, B<--verbose> Print verbose information during processing. =item B<-l>, B<--language> I Choose format of version file I. I="C", ANSI C (I="c"), M4 (I="m4"), Perl (I="perl") or Python (I="python"). Default is C. =item B<-n>, B<--name> I Name the program the version is maintained for. Default is C. =item B<-p>, B<--prefix> I =item B<-s>, B<--set> I Set the version to I. =item B<-e>, B<--edit> Interactively enter a new version. =item B<-i>, B<--increase> I When option ``B<-i>'' is used, the current version in I is updated by increasing one element of the version where I can be one of the following: ``C'' for increasing the version by 1 (and resetting revision and level to 0), ``C'' for increasing the revision by 1 (and resetting level to 0) or ``C'' for increasing the level by 1. =item B<-d>, B<--display> I Control the display type: "C" for a short version display, "C" for a longer version display, "C" for a hexadecimal display of the version and "C" for a format suitable for use with GNU libtool. =back =head1 EXAMPLE # shell script shtool version -l c -n FooBar -p foobar -s 1.2b3 version.c # configure.in V=`shtool version -l c -d long version.c` echo "Configuring FooBar, Version $V" =head1 HISTORY The B B command was originally written by Ralf S. Engelschall Erse@engelschall.comE in 1994 for B. It was later rewritten from scratch for inclusion into B. =head1 SEE ALSO shtool(1). =cut shtool-2.0.8/shtool.m4 644 0 0 405710774764051 136350ustar gnushtool 0 0## ## shtool.m4 -- GNU shtool Autoconf macros ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## ## ## the standard macro for finding GNU shtool: ## AC_PROG_SHTOOL ## AC_DEFUN([AC_PROG_SHTOOL],[dnl AC_PREREQ(2.13)dnl AC_MSG_CHECKING([for GNU shtool]) AC_CACHE_VAL(ac_cv_shtool,[dnl # canonicalize and split path string ac_paths="`echo .:$ac_aux_dir:$PATH |\ sed -e 's%/*:%:%g' -e 's%/*$%%' \ -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \ -e 's/:/ /g'`" # iterate over $PATH but prefer CWD ac_cv_shtool="" for ac_path in $ac_paths; do if test -f "$ac_path/shtool" && test ! -d "$ac_path/shtool"; then ac_cv_shtool="$ac_path/shtool" break fi done # check for existance if test ".$ac_cv_shtool" = .; then AC_MSG_ERROR([no shtool found in .:$PATH]) fi # check deeper ac_rc=`($ac_cv_shtool --version) /dev/null | grep 'GNU shtool'` if test ".$ac_rc" = .; then ac_cv_shtool="${CONFIG_SHELL-/bin/sh} $ac_cv_shtool" ac_rc=`($ac_cv_shtool --version) /dev/null | grep 'GNU shtool'` if test ".$ac_rc" = .; then AC_MSG_ERROR([$ac_cv_shtool seems not to be GNU shtool]) fi fi ])dnl AC_MSG_RESULT([$ac_cv_shtool]) SHTOOL="$ac_cv_shtool" AC_SUBST(SHTOOL) ]) shtool-2.0.8/shtool.pod 644 0 0 1265710774764051 141240ustar gnushtool 0 0## ## shtool.pod -- Manual Page for shtool in POD format ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## =pod =head1 NAME B - The GNU Portable Shell Tool =head1 VERSION GNU shtool SHTOOL_VERSION_STR =head1 SYNOPSIS B [ I ] I [ I ] [ I ] =head1 DESCRIPTION B is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients were in successful use over many years in various free software projects. The compiled B script is intended to be used inside the source tree of those free software packages. There it can take over various (usually non-portable) tasks related to the building and installation of such packages. =head1 GLOBAL OPTIONS The following I are available for B. Any Is are ignored if one of them is present on the B command line. =over 4 =item B<-h>, B<--help> Displays a short help page describing the usage of B and it's ingredient Is in a compact way. =item B<-v>, B<--version> Displays the version number of B. =item B<-d>, B<--debug> Displays shell trace messages for debugging purposes. =item B<-r>, B<--recreate> Recreate the B script with its own individual shtoolize(1) call. =back =head1 COMMANDS The following Is are provided by B. They are all called via "C I". Any command options I and arguments I are specific to the particular I and are described in the corresponding manual page BI(1). The commands are listed here sorted by topic, i.e., related commands are listed side-by-side. =over 16 =item B echo(1) style print command providing special expansion constructs (terminal bold mode, environment details, date) and newline control. =item B Pretty-printing of the last modification time of a file or directory. =item B

Pretty-printing a field-separated list as a two-dimensional table. =item B Displaying of a processing indication though a running terminal character propeller. =item B mv(1) style command for renaming/moving multiple files at once and allowing source files just to be deleted if contents did not change. =item B install(1) style command for installing a program, script or data file in a portable way. =item B mkdir(1) style command providing support for automatical parent directory creation, directory permission control and smart skipping if directory already exists. =item B ln(1) style command providing automatic calculation and usage of relative links if possible. =item B Creation of a shadow filesystem tree by the help of symbolic links. =item B Fixing of file permissions in a source tree by cleaning up the permission bits. =item B Rotate a logfile. =item B Roll standardized distribution tarballs. =item B Apply sed(1) substitution operations. =item B Determines platform identification information. =item B Extended archive command which can even put existing archives into an archive. =item B Separate linker options by library class. =item B An additional C source file pre-processor for sharing cpp(1) code, internal variables and internal functions. =item B Maintain a version information file in either Text, C/C++, Perl or Python. format. =item B Deal with shell path variables. =back =head1 SEE ALSO shtoolize(1), shtool-arx(1), shtool-echo(1), shtool-fixperm(1), shtool-install(1), shtool-mdate(1), shtool-mkdir(1), shtool-mkln(1), shtool-mkshadow(1), shtool-move(1), shtool-path(1), shtool-platform(1), shtool-prop(1), shtool-rotate(1), shtool-scpp(1), shtool-slo(1), shtool-subst(1), shtool-table(1), shtool-tarball(1), shtool-version(1). =head1 HISTORY Some scripts contained in GNU B were already written in 1994 by I for use inside some private source trees. Then they evolved into more elaborated versions over the years and were used in various free software projects like ePerl, WML, iSelect, gFONT, etc. They were complemented with other scripts from the author which he wrote in March 1998 for the ``Apache Autoconf-style Interface'' (APACI) for Apache 1.3. In April 1999 the B package was created out of the accumulated master versions of the scripts and in June 1999 it entered the status of an official GNU program and this way finally joined the group of GNU B, GNU B and GNU B. =head1 AUTHOR Ralf S. Engelschall rse@engelschall.com www.engelschall.com =cut shtool-2.0.8/shtool.spec 644 0 0 523311040046410 142170ustar gnushtool 0 0## ## shtool.spec -- RPM specification for shtool package ## Copyright (c) 2000-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## # This is a specification file for the RedHat Package Manager (RPM). # It is part of the shtool source tree and this way directly included # in shtool distribution tarballs. This way one can use a simple "rpm # -tb shtool-1.X.Y.tar.gz" command to build binary RPM packages from a # original shtool distribution tarball. %ifdef %{_prefix} %define prefix %{_prefix} %else %define prefix /usr/local %endif %define ver 2.0.8 %define rel 0 Name: shtool Version: %{ver} Release: %{rel} Group: Development/Tools License: GPL URL: http://www.gnu.org/software/shtool/ Summary: GNU shtool, The GNU Portable Shell Tool Source: ftp://ftp.gnu.org/gnu/shtool/shtool-%{ver}.tar.gz BuildArch: noarch BuildRoot: /tmp/shtool-%{ver}-root %description GNU shtool is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients were in successful use over many years in various free software projects. The compiled shtool program is intended to be used inside the source tree of other free software packages. There it can overtake various (usually non-portable) tasks related to the building and installation of such a package. It especially can replace the old mkdir.sh, install.sh and related scripts. %prep %setup %build ./configure --prefix=%{prefix} make make test %install rm -rf $RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %doc AUTHORS COPYING ChangeLog INSTALL README THANKS %{prefix}/bin/shtool %{prefix}/bin/shtoolize %{prefix}/man/man1/shtool.1 %{prefix}/man/man1/shtoolize.1 %{prefix}/share/aclocal/shtool.m4 %{prefix}/share/shtool/ shtool-2.0.8/shtoolize.in 644 0 0 3623010774764051 144510ustar gnushtool 0 0#!@PERL@ ## ## shtoolize -- Build shtool script out of ingredient scripts ## Copyright (c) 1999-2008 Ralf S. Engelschall ## ## This file is part of shtool and 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 file 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 . ## require 5.000; use strict; ## ## CONFIGURATION ## # General configuration my $version = "@SHTOOL_VERSION_STR@"; my $prefix = "@prefix@"; my $datarootdir = "@datarootdir@"; my $datadir = "@datadir@"; my $scriptdir = "$datadir/shtool"; # Available modules my @available = qw( echo mdate table prop move install mkdir mkln mkshadow fixperm rotate tarball subst platform arx slo scpp version path ); ## ## COMMAND LINE HANDLING ## my $opt_h = 0; my $opt_v = 0; my $opt_q = 0; my $opt_o = 'shtool'; # this subroutine is derived from Perl's getopts.pl with the enhancement of # the "+" metacharater at the format string to allow a list to be build by # subsequent occurance of the same option. We use it here as a local copy # to be maximum independent. sub mygetopt { my ($progname, $argumentative, @ARGV) = @_; my (@args, $first, $rest, $pos); my ($errs) = 0; local ($_); local ($[) = 0; @args = split( / */, $argumentative); while(@ARGV && ($_ = $ARGV[0]) =~ /^-(.)(.*)/) { ($first, $rest) = ($1,$2); if ($_ =~ m|^--$|) { shift(@ARGV); last; } $pos = index($argumentative,$first); if($pos >= $[) { if($args[$pos+1] eq ':') { shift(@ARGV); if($rest eq '') { unless (@ARGV) { print STDERR "$progname:Error: incomplete option: `$first' (needs an argument)\n"; ++$errs; } $rest = shift(@ARGV); } eval "\$opt_$first = \$rest;"; } elsif ($args[$pos+1] eq '+') { shift(@ARGV); if($rest eq '') { unless (@ARGV) { print STDERR "$progname:Error: incomplete option: `$first' (needs an argument)\n"; ++$errs; } $rest = shift(@ARGV); } eval "push(\@opt_$first, \$rest);"; } else { eval "\$opt_$first = 1"; if($rest eq '') { shift(@ARGV); } else { $ARGV[0] = "-$rest"; } } } else { print STDERR "$progname:Error: unknown option: `$first'\n"; ++$errs; if($rest ne '') { $ARGV[0] = "-$rest"; } else { shift(@ARGV); } } } return ($errs == 0, @ARGV); } sub usage { my ($progname, $cmdline, $rc) = @_; print STDERR "Usage: shtoolize [-h] [-v] [-q] [-o