Index: ossp-pkg/shtool/.cvsignore RCS File: /v/ossp/cvs/ossp-pkg/shtool/.cvsignore,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/shtool/.cvsignore,v' 2>/dev/null --- .cvsignore 2002/02/01 14:58:04 1.4 +++ .cvsignore 2004/02/12 16:06:26 1.5 @@ -4,6 +4,6 @@ config.status configure shtool -shtool.1 shtoolize -shtoolize.1 +*.1 +.timestamp Index: ossp-pkg/shtool/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v rcsdiff -q -kk '-r1.194' '-r1.195' -u '/v/ossp/cvs/ossp-pkg/shtool/ChangeLog,v' 2>/dev/null --- ChangeLog 2004/01/01 16:56:33 1.194 +++ ChangeLog 2004/02/12 16:06:26 1.195 @@ -9,7 +9,12 @@ ChangeLog - Changes between 1.6.2 and 2.0.0 (02-Nov-2002 to xx-Jan-2004): + Changes between 1.6.2 and 2.0.0 (02-Nov-2002 to xx-Feb-2004): + + *) 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] Index: ossp-pkg/shtool/Makefile.in RCS File: /v/ossp/cvs/ossp-pkg/shtool/Makefile.in,v rcsdiff -q -kk '-r1.49' '-r1.50' -u '/v/ossp/cvs/ossp-pkg/shtool/Makefile.in,v' 2>/dev/null --- Makefile.in 2004/01/01 16:54:20 1.49 +++ Makefile.in 2004/02/12 16:06:26 1.50 @@ -61,29 +61,28 @@ sh.version \ sh.path -all: shtool shtool.1 shtoolize.1 +all: shtool manpages shtool: $(SCRIPTS) sh.common shtoolize - @$(SHELL) sh.echo -e "%BBuilding shtool program:%b" + @$(SHELL) sh.echo -e "%Bbuilding program shtool%b" ./shtoolize -o shtool all -shtool.1: shtool.pod - @$(SHELL) sh.echo -e "%BBuilding shtool.1 manual page:%b" - V1=`$(SHELL) sh.version -l txt -d short VERSION`; \ +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;).*;;'`; \ - $(POD2MAN) --section=1 --center="GNU Portable Shell Tool" \ - --release="$$D" --date="shtool $$V1" shtool.pod |\ - sed -e "s;SHTOOL_VERSION_STR;$$V2;" >shtool.1 - -shtoolize.1: shtoolize.pod - @$(SHELL) sh.echo -e "%BBuilding shtoolize.1 manual page:%b" - 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;).*;;'`; \ - $(POD2MAN) --section=1 --center="GNU Portable Shell Tool" \ - --release="$$D" --date="shtool $$V1" shtoolize.pod |\ - sed -e "s;SHTOOL_VERSION_STR;$$V2;" >shtoolize.1 + 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 @@ -98,8 +97,11 @@ ./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 - ./shtool install -c -m 644 shtool.1 $(DESTDIR)$(mandir)/man1/shtool.1 - ./shtool install -c -m 644 shtoolize.1 $(DESTDIR)$(mandir)/man1/shtoolize.1 + -@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"; \ @@ -112,8 +114,11 @@ $(RM) $(DESTDIR)$(pkgdatadir)/$$script; \ done $(RM) $(DESTDIR)$(aclocaldir)/shtool.m4 - $(RM) $(DESTDIR)$(mandir)/man1/shtoolize.1 - $(RM) $(DESTDIR)$(mandir)/man1/shtool.1 + -@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) @@ -125,9 +130,11 @@ $(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE) clean: - $(RM) shtool shtool.1 shtoolize.1 + $(RM) shtool + $(RM) *.1 distclean: clean $(RM) Makefile shtoolize $(RM) config.cache config.status config.log + $(RM) .timestamp Index: ossp-pkg/shtool/RATIONAL RCS File: /v/ossp/cvs/ossp-pkg/shtool/RATIONAL,v co -q -kk -p'1.1' '/v/ossp/cvs/ossp-pkg/shtool/RATIONAL,v' | diff -u /dev/null - -L'ossp-pkg/shtool/RATIONAL' 2>/dev/null --- ossp-pkg/shtool/RATIONAL +++ - 2024-05-10 14:44:04.928388633 +0200 @@ -0,0 +1,129 @@ + _ _ _ + ___| |__ | |_ ___ ___ | | + / __| '_ \| __/ _ \ / _ \| | + \__ \ | | | || (_) | (_) | | + |___/_| |_|\__\___/ \___/|_| + + 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. + Index: ossp-pkg/shtool/README RCS File: /v/ossp/cvs/ossp-pkg/shtool/README,v rcsdiff -q -kk '-r1.100' '-r1.101' -u '/v/ossp/cvs/ossp-pkg/shtool/README,v' 2>/dev/null --- README 2004/01/01 16:56:33 1.100 +++ README 2004/02/12 16:06:26 1.101 @@ -10,7 +10,7 @@ http://www.gnu.org/software/shtool/ ftp://ftp.gnu.org/gnu/shtool/ - Version 2.0b0 (01-Jan-2004) + Version 2.0b0 (12-Feb-2004) The GNU shtool program is a compilation of small but very stable and portable shell scripts into a single shell tool. All ingredients Index: ossp-pkg/shtool/THANKS RCS File: /v/ossp/cvs/ossp-pkg/shtool/THANKS,v rcsdiff -q -kk '-r1.31' '-r1.32' -u '/v/ossp/cvs/ossp-pkg/shtool/THANKS,v' 2>/dev/null --- THANKS 2003/08/13 14:20:34 1.31 +++ THANKS 2004/02/12 16:06:26 1.32 @@ -28,6 +28,7 @@ o Thomas Linden o Mirko Liss o Liones + o Thomas Lotterer o Markus F.X.J. Oberhumer o Benjamin Saller o Michael Schloh Index: ossp-pkg/shtool/VERSION RCS File: /v/ossp/cvs/ossp-pkg/shtool/VERSION,v rcsdiff -q -kk '-r1.75' '-r1.76' -u '/v/ossp/cvs/ossp-pkg/shtool/VERSION,v' 2>/dev/null --- VERSION 2004/01/01 16:56:33 1.75 +++ VERSION 2004/02/12 16:06:26 1.76 @@ -2,5 +2,5 @@ VERSION -- Version Information for GNU shtool (syntax: Text) [automatically generated and maintained by GNU shtool] - This is GNU shtool, Version 2.0b0 (01-Jan-2004) + This is GNU shtool, Version 2.0b0 (12-Feb-2004) Index: ossp-pkg/shtool/sh.arx RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.arx,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.arx,v' 2>/dev/null --- sh.arx 2004/01/01 16:54:20 1.20 +++ sh.arx 2004/02/12 16:06:26 1.21 @@ -1,7 +1,6 @@ ## ## arx -- Extended archive command ## Copyright (c) 1999-2004 Ralf S. Engelschall -## Originally written for shtool ## ## 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 @@ -99,3 +98,80 @@ rm -rf $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 + Index: ossp-pkg/shtool/sh.echo RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.echo,v rcsdiff -q -kk '-r1.37' '-r1.38' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.echo,v' 2>/dev/null --- sh.echo 2004/01/01 16:54:20 1.37 +++ sh.echo 2004/02/12 16:06:26 1.38 @@ -1,7 +1,6 @@ ## ## echo -- Print string with optional construct expansion ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for WML as buildinfo ## ## 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 @@ -20,7 +19,7 @@ ## str_tool="echo" -str_usage="[-n|--newline] [-e|--expand] [ ...]" +str_usage="[-n|--newline] [-e|--expand] [ ...]" arg_spec="0+" opt_spec="n.e." opt_alias="n:newline,e:expand" @@ -318,3 +317,123 @@ 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 + Index: ossp-pkg/shtool/sh.fixperm RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.fixperm,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.fixperm,v' 2>/dev/null --- sh.fixperm 2004/01/01 16:54:20 1.17 +++ sh.fixperm 2004/02/12 16:06:26 1.18 @@ -1,7 +1,6 @@ ## ## fixperm -- Fix file permissions inside a source tree ## Copyright (c) 1996-2004 Ralf S. Engelschall -## Originally written for ePerl ## ## 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 @@ -77,3 +76,67 @@ 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 + Index: ossp-pkg/shtool/sh.install RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.install,v rcsdiff -q -kk '-r1.30' '-r1.31' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.install,v' 2>/dev/null --- sh.install 2004/01/01 16:54:20 1.30 +++ sh.install 2004/02/12 16:06:26 1.31 @@ -1,7 +1,6 @@ ## ## install -- Install a program, script or datafile ## Copyright (c) 1997-2004 Ralf S. Engelschall -## Originally written for shtool ## ## 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 @@ -191,3 +190,123 @@ 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 + Index: ossp-pkg/shtool/sh.mdate RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mdate,v rcsdiff -q -kk '-r1.13' '-r1.14' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mdate,v' 2>/dev/null --- sh.mdate 2003/04/04 16:36:01 1.13 +++ sh.mdate 2004/02/12 16:06:26 1.14 @@ -1,8 +1,7 @@ ## ## mdate -- Pretty-print modification time of a file or dir ## Copyright (c) 1995-1997 Free Software Foundation, Inc. -## Originally idea and basis code by Ulrich Drepper -## Enhanced by Ralf S. Engelschall for shtool +## Copyright (c) 1998-2004 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 @@ -150,3 +149,89 @@ }' "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 + Index: ossp-pkg/shtool/sh.mkdir RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkdir,v' 2>/dev/null --- sh.mkdir 2004/01/01 16:54:20 1.23 +++ sh.mkdir 2004/02/12 16:06:27 1.24 @@ -1,8 +1,6 @@ ## ## mkdir -- Make one or more directories ## Copyright (c) 1996-2004 Ralf S. Engelschall -## Originally written for public domain by Noah Friedman -## Cleaned up and enhanced for shtool ## ## 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 @@ -112,5 +110,96 @@ 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 + Index: ossp-pkg/shtool/sh.mkln RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkln,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkln,v' 2>/dev/null --- sh.mkln 2004/01/01 16:54:20 1.17 +++ sh.mkln 2004/02/12 16:06:27 1.18 @@ -1,7 +1,6 @@ ## ## mkln -- Make link with calculation of relative paths -## Copyright (c) 1999-2004 Ralf S. Engelschall -## Originally written for shtool +## Copyright (c) 1998-2004 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 @@ -172,3 +171,70 @@ 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 + Index: ossp-pkg/shtool/sh.mkshadow RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.mkshadow,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.mkshadow,v' 2>/dev/null --- sh.mkshadow 2004/01/01 16:54:20 1.23 +++ sh.mkshadow 2004/02/12 16:06:27 1.24 @@ -1,7 +1,6 @@ ## ## mkshadow -- Make a shadow tree through symbolic links ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for Apache ## ## 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 @@ -139,3 +138,70 @@ 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 + Index: ossp-pkg/shtool/sh.move RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.move,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.move,v' 2>/dev/null --- sh.move 2004/01/01 16:54:20 1.19 +++ sh.move 2004/02/12 16:06:27 1.20 @@ -1,7 +1,6 @@ ## ## move -- Move files with simultaneous substitution ## Copyright (c) 1999-2004 Ralf S. Engelschall -## Originally written for shtool ## ## 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 @@ -113,5 +112,82 @@ 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 + Index: ossp-pkg/shtool/sh.path RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.path,v rcsdiff -q -kk '-r1.26' '-r1.27' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.path,v' 2>/dev/null --- sh.path 2004/01/01 16:54:20 1.26 +++ sh.path 2004/02/12 16:06:27 1.27 @@ -1,7 +1,6 @@ ## ## path -- Deal with program paths ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for Apache ## ## 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 @@ -165,5 +164,87 @@ 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 + Index: ossp-pkg/shtool/sh.platform RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.platform,v rcsdiff -q -kk '-r1.4' '-r1.5' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.platform,v' 2>/dev/null --- sh.platform 2004/01/21 20:40:51 1.4 +++ sh.platform 2004/02/12 16:06:27 1.5 @@ -1,7 +1,6 @@ ## ## platform -- Platform Identification Utility ## Copyright (c) 2003-2004 Ralf S. Engelschall -## Originally written for use in OpenPKG ## ## 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 @@ -20,7 +19,7 @@ ## str_tool="platform" -str_usage="[-F|--format FORMAT] [-S|--sep STRING] [-C|--conc STRING] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--no-newline] [-t|--type TYPE] [-V|--version] [-h|--help]" +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" @@ -572,3 +571,257 @@ 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 MacOS 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 + Index: ossp-pkg/shtool/sh.prop RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.prop,v rcsdiff -q -kk '-r1.17' '-r1.18' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.prop,v' 2>/dev/null --- sh.prop 2004/01/01 16:54:20 1.17 +++ sh.prop 2004/02/12 16:06:27 1.18 @@ -1,7 +1,6 @@ ## ## prop -- Display progress with a running propeller ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for mod_ssl ## ## 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 @@ -65,3 +64,59 @@ ' "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 + Index: ossp-pkg/shtool/sh.scpp RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.scpp,v rcsdiff -q -kk '-r1.25' '-r1.26' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.scpp,v' 2>/dev/null --- sh.scpp 2004/01/01 16:54:20 1.25 +++ sh.scpp 2004/02/12 16:06:27 1.26 @@ -1,7 +1,6 @@ ## ## scpp -- Sharing C Pre-Processor ## Copyright (c) 1999-2004 Ralf S. Engelschall -## Originally written for GNU Pth ## ## 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 @@ -247,3 +246,157 @@ 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 + Index: ossp-pkg/shtool/sh.slo RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.slo,v rcsdiff -q -kk '-r1.23' '-r1.24' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.slo,v' 2>/dev/null --- sh.slo 2004/01/01 16:54:20 1.23 +++ sh.slo 2004/02/12 16:06:27 1.24 @@ -1,7 +1,6 @@ ## ## slo -- Separate linker options by library class ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for Apache ## ## 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 @@ -178,3 +177,88 @@ 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 + Index: ossp-pkg/shtool/sh.subst RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.subst,v rcsdiff -q -kk '-r1.10' '-r1.11' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.subst,v' 2>/dev/null --- sh.subst 2004/01/01 16:54:20 1.10 +++ sh.subst 2004/02/12 16:06:27 1.11 @@ -1,7 +1,6 @@ ## ## subst -- Apply sed(1) substitution operations ## Copyright (c) 2001-2004 Ralf S. Engelschall -## Originally written for OpenPKG's rpmtool ## ## 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 @@ -55,7 +54,7 @@ OIFS="$IFS"; IFS="$ASC_NL"; set -- $opt_e; IFS="$OIFS" for e do - sedcmd="$sedcmd -e '$e'" + sedcmd="$sedcmd -e '$e'" done elif [ ".$opt_f" != . ]; then if [ ! -f $opt_f ]; then @@ -166,3 +165,101 @@ 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<-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<-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 convinient patching +frontend to sed(1) operations in the B package specifications. + +=head1 SEE ALSO + +shtool(1), sed(1). + +=cut + Index: ossp-pkg/shtool/sh.table RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.table,v rcsdiff -q -kk '-r1.19' '-r1.20' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.table,v' 2>/dev/null --- sh.table 2004/01/01 16:54:20 1.19 +++ sh.table 2004/02/12 16:06:27 1.20 @@ -1,7 +1,6 @@ ## ## table -- Pretty-print a field-separated list as a table ## Copyright (c) 1998-2004 Ralf S. Engelschall -## Originally written for Apache ## ## 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 @@ -87,3 +86,68 @@ }" 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 + Index: ossp-pkg/shtool/sh.tarball RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.tarball,v rcsdiff -q -kk '-r1.20' '-r1.21' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.tarball,v' 2>/dev/null --- sh.tarball 2004/01/01 16:54:20 1.20 +++ sh.tarball 2004/02/12 16:06:27 1.21 @@ -1,7 +1,6 @@ ## ## tarball -- Roll distribution tarballs ## Copyright (c) 1999-2004 Ralf S. Engelschall -## Originally written for shtool ## ## 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 @@ -191,3 +190,96 @@ 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<-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 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<-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 + Index: ossp-pkg/shtool/sh.version RCS File: /v/ossp/cvs/ossp-pkg/shtool/sh.version,v rcsdiff -q -kk '-r1.35' '-r1.36' -u '/v/ossp/cvs/ossp-pkg/shtool/sh.version,v' 2>/dev/null --- sh.version 2004/01/01 16:54:20 1.35 +++ sh.version 2004/02/12 16:06:27 1.36 @@ -1,7 +1,6 @@ ## ## version -- Maintain a version information file ## Copyright (c) 1994-2004 Ralf S. Engelschall -## Originally written for ePerl, rewritten from scratch for shtool ## ## 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 @@ -304,3 +303,109 @@ 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"), 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 + Index: ossp-pkg/shtool/shtool.pod RCS File: /v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v rcsdiff -q -kk '-r1.65' '-r1.66' -u '/v/ossp/cvs/ossp-pkg/shtool/shtool.pod,v' 2>/dev/null --- shtool.pod 2004/01/01 16:54:20 1.65 +++ shtool.pod 2004/02/12 16:06:27 1.66 @@ -45,128 +45,6 @@ There it can take over various (usually non-portable) tasks related to the building and installation of such packages. -=head2 Context Background - -For the configuration, build and installation environment of modern free -software packages one nowadays uses GNU B and friends (i.e. -usually B, B and B). B covers the -configuration, B covers the generation of the build environment and -B covers most of a libraries build process. But at least when it -comes to the installation step one usually have to use a few auxiliary scripts -like C, C, etc. These scripts are usually replacements -for system tools and are required mainly for portability reasons. The result -is usually an C subdirectory in the source tree where over time a -lot shell scripts accumulate. - -=head2 Maintainance Problem - -The problem with those C shell scripts starts if one has to maintain -I of free software packages as it's the case for the author of B. -Then over time all C 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 maintainance location exists, of -course. For B no such problem exists, because the resulting -C script is generated on-the-fly. The same applies to B -and the various C files. - -Only for B one always has to grab the latest copy. But because it's -just two files (C and C), keeping a source trees in sync -is not too complicated (especially not if using the handy C -program). But the C shell script mess is nasty, especially 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 B and friends are part of the game. But which -C shell scripts are needed this time? And from which existing source -tree to copy them from? Hmmm... the same procedure as last year?! - -=head2 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 C 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 B) -have aesthetic problems. Because it looks strange to them that 20% of the -files in the source tree are just auxiliary scripts. Sure, the actual amount -of script code even B cannot reduce, but B 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 multiple files ;) - -=head2 Filling the gap - -So, wouldn't it be nice to have a fourth package (beside B, -B and B) which fills the gap, i.e. which provides the -functionality of the old files in C, is maintained at a centralized -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 B? The -author thought this I be actually very useful and the result is the -current GNU B package which at least successfully solved the above -problems of the author. - -=head2 The goals in detail - -To better understand the intentions behind B and to avoid confusion, -here are the original goals of the B script: - -=over 3 - -=item B<1. It has to be self-contained and reside in a single file> - -This was achieved by compiling the resulting B script out of the -ingredient source scripts. The advantage is that B 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. - -=item B<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 software -packages. - -=item B<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 C, C

, etc) or -unportable features of well-known Unix programs (like shell functions, special -C features, etc. pp). That's why B's code sometimes looks crazy -and like overkill to you. Don't think this is because of the authors -crazyness. Instead it's most of the time mainly for portability reasons. - -=item B<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 this complete manual page. - -=item B<5. It has to stay under a reasonable and common license> - -This was achieved by placing the B package under the GNU General -Public License (GPL). This way the B package itself is well protected -and is guarrantied to be kept free software, but the resulting B -script can be nevertheless I in I types of source trees. Notice -here: given that one includes GNU B verbatim into an own source tree, -one is justified in saying that it remains separate from the own package, and -that this way one is simply just I B. So, in this situation, -there is no requirement that the package itself is licensed under the GNU -General Public License in order to take advantage of B. Keep this in -mind ;) - -=item B<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 C scripts out of the ingredient shell scripts. This -way if one don't need all the available functionality one can assemble -together an individual C script. - -=back - =head1 GLOBAL OPTIONS The following I are available for B. Any Is @@ -195,12 +73,14 @@ =head1 COMMANDS -The following Is are provided by B. They are all called via -``C I''. Any trailing I are specific to the -particular I. They are listed (here and also below) sorted by topic, -i.e. related commands are listed side-by-side. +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 12 +=over 16 =item B @@ -209,30 +89,32 @@ =item B -Pretty-prints the last modification time of a file or directory. +Pretty-printing of the last modification time of a file or directory. =item B
-Pretty-prints a field-separately list as a table. +Pretty-printing a field-separated list as a two-dimensional table. =item B -Display a processing indication though a running propeller. +Displaying of a processing indication though a running terminal +character propeller. =item B -mv(1) style command, but can rename/move multiple files at once and allows -source files just to be deleted if contents didn't change. +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 a program, script or datafile in a portable way. +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 auto-parent-dir creation, -directory permission control and smart skipping if directory already -exists. +mkdir(1) style command providing support for automatical parent +directory creation, directory permission control and smart skipping if +directory already exists. =item B @@ -241,11 +123,12 @@ =item B -Create a shadow source tree by the help of symbolic links. +Creation of a shadow filesystem tree by the help of symbolic links. =item B -Fix file permissions inside a source tree by cleaning up the permission bits. +Fixing of file permissions in a source tree by cleaning up the +permission bits. =item B @@ -287,722 +170,6 @@ =back -=head1 COMMAND DESCRIPTION - -In the following the available I and their corresponding -I are described in detail. - -=over 4 - -=item B [B<-n>|B<--newline>] [B<-e>|B<--expand>] I - -This is an echo(1) style print command which provides special expansion -constructs (terminal bold mode, environment details, date) and newline -control. Per default I is written to I followed by a newline -character (``C<\n>''). When option ``B<-n>'' is used this newline character is -left out. - -The I can contain special ``B<%>I'' constructs which which -are expanded before the output is written if option ``B<-e>'' is -used. Currently the following constructs are recognized: ``B<%B>'' -for switching to terminal bold mode, ``B<%b>'' for switching terminal -mode back to normal display mode, ``B<%u>'' for the current user name, -``B<%U>'' for the current user id (numerical), ``B<%g>'' for the current -group name, ``B<%G>'' for the current group id (numerical), ``B<%h>'' -for the current hostname, ``B<%d>'' for the current domain name, -``B<%D>'' for the current day of the month, ``B<%M>'' for the current -month (numerical), ``B<%m>'' for the current month name and ``B<%Y>'' -for the current year. - -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. - -Examples: - - # 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" - -=item 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 - -This command pretty-prints the last modification time of a file or directory -I. Option ``B<-n>'' suppresses the output of a trailing newline -character, option ``B<-z>'' pads numeric day (and optionally month) with a -leading zero, option ``B<-s>'' shortens the months name to an abbreviation of -three characters, option ``B<-d>'' replaces the month name with the -corresponding digits, option ``B<-f>'' uses I as the field separator -(default is a single space character) and option ``B<-o>'' specified the order -in which the fields are printed. - -The default for I is ``C'' which means an output of `` -''. Any combination of the chars ``C'', ``C'' and ``C'' or -allowed for I. - -The trick of this command is that it provides a portable way to find out the -date of a file or directory while still allowing one to specify the format of -the date display. - -Examples: - - # shell script - shtool mdate -n / - shtool mdate -f '/' -z -d -o ymd foo.txt - shtool mdate -f '-' -s foo.txt - -=item B
[B<-F>|B<--field-sep> I] [B<-w>|B<--width> I] [B<-c>|B<--columns> I] [B<-s>|B<--strip> I] IBI... - -This pretty-prints a I-separated list of Iings as a table. Per -default a colon-separated list (I=":") is pretty printed as a -three-column (=3) table no longer than 79 chars (I=79) is -generated where each column is 15 characters wide (I=15). - -The trick of this command is that it avoids to use the unportable tr(1) and -fmt(1) commands and instead is based entirely on sh(1), awk(1) and sed(1) -functionality. - -Example: - - # shell script - shtool table -F , -w 5 -c 4 "1,2,3,4,5,6,7,8,9,10,11,12" - -=item B [B<-p>|B<--prefix> I] - -This command displays a processing indication though a running propeller. The -option ``B<-p>'' can be used to set a particular prefix I which is -displayed in front of the propeller. The default is no prefix string, i.e. the -propeller is at the left border of the terminal. This command 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 cycles one step clock-wise. - -The trick of this command is that it provides a portable and easy to use way -to display such nice and psychologically important process indicators. - -Example: - - # shell script - configure 2>&1 |\ - tee logfile |\ - shtool prop -p "Configuring sources" - -=item B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-e>|B<--expand>] [B<-p>|B<--preserve>] I I - -This is a mv(1) style command, but with two special features: First if -option ``B<-e>'' (`expand') is used and an asterisk occurs somewhere in I -one can use ``C<%>I'' (where I is C<1>,C<2>,...) in I. This is -useful for renaming multiple files at once. Second, if option ``B<-p>'' -(for `preserve') is used and I and I are byte-wise the -same it just deletes I. The intention is that the permissions and -time stamps on I aren't changed which is important if I is -used in conjunction with Makefiles. Option ``B<-v>'' (verbose) can be used to -enable the output of extra processing information. Option ``B<-t>'' (trace) -can be used to enable the output of the essential shell commands which are -executed. - -The trick of this command is that it can rename multiple files at once and -preserves the timestamps if the contents isn't changed. - -Examples: - - # 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 - -=item B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [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] [B<-d>|B<--mkdir>] I I - -This command installs a program, script or datafile (dependent on I) in -a portable way while providing all important options of the BSD install(1) -command. Per default I is moved to the target I, but with option -``B<-c>'' I is copied. The target file is created with owner/group set -to the current active uid/gid, but if this script is called as root (uid 0) -the options ``B<-o>'' and ``B<-g>'' can be used to override this. - -Additionally program executables is stripped with strip(1) after -installation if option ``B<-s>'' is used. Option ``B<-C>'' is like -``B<-c>'', except if the destination file already exists and is the -same as the source file, no file is copied at all. Option ``B<-e>'' -can be used one or multiple times to apply one or more sed(1) commands -on-the-fly to the contents of the input I before the output file -is created. Option ``B<-v>'' (verbose) can be used to enable the output -of extra processing information. Option ``B<-t>'' (trace) can be used to -enable the output of the essential shell commands which are executed. - -The trick of this command is that it provides the functionality of BSD -install(1) in a portable emulated way. For even more compatibility, -the BSD "B C" usage is internally mapped to the -"B C" command. - -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)/ - -=item 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 ...] - -This is a mkdir(1) style command providing support for automatic parent -directory creation (if option ``B<-p>'' is used), directory permission -control (with option ``B<-m> I'' where I can be in any of -the formats specified to the chmod(1) command) and smart skipping if -I already exists (triggered by the force option ``B<-f>''). Option -``B<-t>'' (trace) can be used to enable the output of the essential -shell commands which are executed. The target directory is created with -owner/group set to the current active uid/gid, but if this script is -called as root (uid 0) the options ``B<-o>'' and ``B<-g>'' can be used -to override this. - -The trick of this command is that it provides both a portable ``B<-p>'' -functionality and the ability to be smart if the directory already exists -which is important for installation procedures. - -Example: - - # Makefile - install: - shtool mkdir -f -p -m 755 $(bindir) - shtool mkdir -f -p -m 755 $(mandir)/man1 - : - -=item B [B<-t>|B<--trace>] [B<-f>|B<--force>] [B<-s>|B<--symbolic>] I [I ...] I - -This is a ln(1) style command which provides automatic calculation and usage -of relative links if possible, i.e. 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. Options ``B<-f>'' and ``B<-s>'' are similar to -ln(1), i.e. they force the creation of the link (even if it exists) and -create a symbolic link instead of a hard-link. Option ``B<-t>'' (trace) can -be used to enable the output of the essential ``C'' command which is -executed. - -The trick of this command is that it tried hard to calculate the paths to get -the maximum possible relative paths. - -Example: - - # shell script - shtool mkln -s foo/bar baz/quux - -=item B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-a>|B<--all>] I I - -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. - -Option ``B<-v>'' (verbose) can be used to enable some displaying of processing -information. Option ``B<-t>'' (trace) can be used to display all commands -which are executed in order to construct I. Option ``B<-a>'' (all) -can be used to really shadow all files and directories in I. Per -default CVS related files and directories, backup files, object files, etc. -are not shadowed. - -The trick of this is that is provides such a high-level functionality with a -single command and hides all gory details. - -Example: - - # shell script - shtool mkshadow -v -a . /tmp/shadow - -=item B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] I [ I ... ] - -This command 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's intended to be run before a tarball is rolled out -of the source tree. Option ``B<-v>'' can be used to display some processing -information. Option ``B<-t>'' (trace) can be used to enable the output of the -essential shell commands which are executed. - -The trick is that this is more convenient that having to set the permissions -manually or with a large file list. - -Example: - - # Makefile.in - dist: - shtool fixperm -v * - ... - -=item 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<-o>|B<--owner> I] [B<-g>|B<--group> I] [B<-m>|B<--mode> I] [B<-M>|B<--migrate> I] [B<-P>|B<--prolog> I] [B<-E>|B<--epilog> I] I [...] - -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 archive file -number I-1; 2. move archive file number I-1 to I for I -counting from 1 to I-1; 3. move I to archive file number 0; -4. creating a new and empty instance of I. - -Option ``B<-s>'' can be used to only start a rotation step if I is -at least I bytes long. The argument I can be specified also -with the trailing units C (kilo), C (mega) or C (giga). - -Option ``B<-c>'' changes the approach of moving I to archive file -number 0: instead of a move followed by the creation of a new I, a -copy is performed followed by a truncation of I. The difference is -that in the first case (the default), if an application has I -still opened, after the rotation step it will have archive file number -0 opened and usually has to reopen the new I, while in the second -case the application can keep its open file handles to I. The -drawback of the second approach is that logfile entries are lost when -they are written to I between the execution of the copy and the -subsequent truncation operation. - -Option ``B<-r>'' removes I after rotation instead of providing a -new empty file. Option ``B<-a>'' forces archive files to be created in -the separate directory I. - -Option ``B<-z>'' enables compression of archive files with compression -level I (if option ``B<-b>'' is present, compression takes place in -background). By default, the tools bzip2(1), gzip(1) and compress(1) are -searched for in C<$PATH> (in this order), but one also can override this -by prefixing the compression level with one of the three particular tool -names. Option ``B<-d>'' delays the compression of archive file number 0. -This is useful if option ``B<-c>'' is not used, because an application -might still write to archive file 0 (through an open file handle). - -Option ``B<-p>'' 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. - -Options ``B<-o>'', ``B<-g>'' and ``B<-m>'' can be used to make sure that -the created files have particular file attributes. The valid arguments -are the same as for chown(1), chgrp(1) and chmod(1). Be aware that using -options ``B<-o>'' and ``B<-g>'' require root privileges. - -Option ``B<-M>'' allows one to execute a "migration" command just before -the archive file number I-1 is removed from the filesystem. The -specified I gets the archive filename as an argument appended. -Options ``B<-P>'' (prolog) and ``B<-E>'' (epilog) can be used to execute -commands before and after the rotation step. They are interesting in -conjunction with option ``B<-s>'', because they are not executed at all -if it is decided that no rotation step is performed. - -Option ``B<-f>'' (force) can be used to allow the archive directory -(option ``B<-a>'') to be silently created if it still does not exist and -that still not existing intermediate logfiles are silently skipped in -the rotation step. - -Option ``B<-v>'' (verbose) can be used to display the files which are -rotated. Option ``B<-t>'' (trace) can be used to enable the output of -the essential shell commands which are executed for the rotation step. - -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 - -=item B [B<-t>|B<--trace>] [B<-v>|B<--verbose>] [B<-o>|B<--output> I] [B<-c>|B<--compress> I] [B<-u>|B<--user> I] [B<-g>|B<--group> I] [B<-e>|B<--exclude> I] I [I ...] - -This command is for `rolling' distribution `tarballs', i.e. for the creation -of distribution files generated by `C'. The important aspects of -standardized free software tarballs are: first they have to unpack into a -single top-level directory; second this top-level directory should correspond -to the tarball filename (i.e. a tarball `C' per convention -unpacks into a top-level directory `C'); third the files in -the tarball should be sorted to allow users to use the `C' command -in a reasonable way; fourth the owner and group of the files in the tarball -for security reasons can be set to arbitrary names. - -The input files are given by the file or directory arguments I. -Directories are expanded before the comma-separated exclude (option B<-e>) -Is (B regular expressions) are used to filter the list. The -default filter is ``C''. Then the tarball is -created with its files owned by I (option B<-u>) and I (option -B<-g>). Finally the resulting tarball is piped through an optional compression -(option B<-c>) program and written to the output file I (option -B<-o>). Option ``B<-v>'' can be used to display the files which are stored in -the tarball. Option ``B<-t>'' (trace) can be used to enable the output of the -essential shell commands which are executed. - -The trick of this command is that it combines the complex process of rolling a -good tarball into a I command. - -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' . - -=item B [B<-v>|B<--verbose>] [B<-t>|B<--trace>] [B<-n>|B<--nop>] [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 ...] - -This command applies one or more sed(1) substitution operations to -F or any number of files. The sed(1) operations are either -specified on the command line with option ``B<-e>'' or are contained -in a file I and are specified with option ``B<-f>''. The -original untouched I is usually overridden. If option ``B<-b>'' -is given and specifies a file extension, the original file is preserved -as ``I.I''. If option ``B<-s>'' (stealth) is specified, -the timestamp is preserved on I, too. Option ``B<-i>'' enables -interactive mode where the user has to approve each operation. Option -``B<-n>'' (no operation) can be used to disable the actual execution of -the essential shell commands which would be executed. Option ``B<-t>'' -(trace) can be used to enable the output of the essential shell commands -which are executed. Option ``B<-v>'' (verbose) can be used to display -the files which are patched. - -Example: - - # interactive shell - 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 - -=item 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<-t>|B<--type> I] [B<-V>|B<--version>] [B<-h>|B<--help>] - -This command privides Unix platform identifications. 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). - -Option B<-F> controls the output formatting of this command. 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. - -Option B<-S> 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. Option B<-C> 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. Option B<-L> enforces conversion of the -output to all I case. Option B<-U> enforces conversion of the -output to all I case. - -Option B<-v> 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<]>". Option B<-c> 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>". Option B<-n> omits the usual trailing newline -character in the output. - -Option B<-t> 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 - -Option B<-V> outputs the version information of B only. -Option B<-h> outputs the usage information of B only. - -Example: - - # configure.in - PLATFORM=`shtool platform --type=binary` - -=item B [B<-t>|B<--trace>] [B<-C>|B<--command> I] I I I [I ...] - -This is a wrapper around the archive (``C'') tool. 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. When option ``B<-t>'' (trace) is given B shows the actually -involved shell commands. Option ``B<-C>'' can be used to set the ``ar'' -command to I. - -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-build sub-library archives (usually staying inside -subdirs) in a large source tree. - -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 - -=item B [B<-p>|B<--prefix> I] -- B<-L>I B<-l>I [ B<-L>I B<-l>I ... ] - -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. - -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" - : - -=item 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 ...] - -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). - -Option ``B<-v>'' can be used to enable some processing output. Option -``B<-p>'' can be used to make the decision whether to overwrite I -independent of the generated ``#line'' lines. This is useful for -Makefiles if the real contents of I will not change, just -line numbers. Option ``B<-f>'' (which can occur multiple times) can -be used to apply one or more pre-processing sed(1) I commands -(usually of type ``C'') to each input file before their -input is parsed. - -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; - } - -=item 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 - -This command generates and maintains a version information -file I for program name I in either textual -(I="C"), ANSI C (I="c"), Perl (I="perl") or -Python (I="python") language. 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]+>''. When the option ``B<-s>'' is given, -the contents of I is overridden with the specified 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. Option -``B<-e>'' can be used to interactively enter a new version. - -Unless option ``B<-e>'', ``B<-i>'' or ``B<-s>'' is specified, the performed -action is to display the current version. Option ``B<-d>'' then can be used -to 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. - -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. - -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" - -=item 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 ...] - -This command deals with shell C<$PATH> variables. It can find a program -executable in $PATH or I through one or more filenames (given by one or -more I arguments). The result is the absolute filesystem path to the -program displayed on C plus an exit code of 0 if it was really -found. - -The option ``B<-s>'' can be used to suppress the output which is useful to -just test whether a program exists with the help of the return code. The -option ``B<-m>'' enables some magic where currently for the programs -``C'' and ``C'' an advanced magic search is done. The option -``B<-r>'' can be used to transform a forward path to a subdirectory into a -reverse path. Option ``B<-d>'' and ``B<-b>'' just output the directory or base -name of I. - -Examples: - - # 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` - -=back - =head1 SEE ALSO sh(1), cp(1), rm(1), mkdir(1), awk(1), sed(1). Index: ossp-pkg/shtool/shtoolize.in RCS File: /v/ossp/cvs/ossp-pkg/shtool/shtoolize.in,v rcsdiff -q -kk '-r1.33' '-r1.34' -u '/v/ossp/cvs/ossp-pkg/shtool/shtoolize.in,v' 2>/dev/null --- shtoolize.in 2004/01/01 16:54:20 1.33 +++ shtoolize.in 2004/02/12 16:06:27 1.34 @@ -181,6 +181,9 @@ $code .= $_ while (); close(FP); + # strip away embedded documentation + $code =~ s|##\n##\s+manual\s+page\n##\s+.+$||si; + # determine attributes my $len = length($code); my $oneline = ''; @@ -451,7 +454,7 @@ foreach $name (@used) { print OUT " $name )\n"; $code = $SCRIPT->{$name}->{CODE1}; - $code =~ s|^| |mg; + $code =~ s|^(.)| $1|mg; sub mysub { my ($prolog, $code, $epilog) = @_; $code =~ s|^ ||mg; @@ -496,7 +499,7 @@ foreach $name (@used) { print OUT "$name )\n"; $code = $SCRIPT->{$name}->{CODE2}; - $code =~ s|^| |mg; + $code =~ s|^(.)| $1|mg; sub mysub { my ($prolog, $code, $epilog) = @_; $code =~ s|^ ||mg;