summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Adams <schizo@debian.org>2005-06-21 23:30:25 +0000
committerClint Adams <schizo@debian.org>2005-06-21 23:30:25 +0000
commitc2a1c435ef5e7d590328802ce333de410ce40cb6 (patch)
tree6095e344242e76daf58d6d42afc5ca29673d2a0a
downloaddebianutils-c2a1c435ef5e7d590328802ce333de410ce40cb6.tar.gz
tag of schizo@debian.org--2004-primary/debianutils--etch--0--version-0
(automatically generated log message) git-archimport-id: schizo@debian.org--etch/debianutils--etch--0--base-0
-rw-r--r--Makefile.am17
-rw-r--r--configure.ac10
-rw-r--r--debian/changelog896
-rw-r--r--debian/control21
-rw-r--r--debian/copyright168
-rw-r--r--debian/mime1
-rwxr-xr-xdebian/postinst20
-rwxr-xr-xdebian/postrm18
-rw-r--r--debian/preinst6
-rwxr-xr-xdebian/prerm14
-rwxr-xr-xdebian/rules110
-rw-r--r--fr/Makefile.am7
-rw-r--r--fr/savelog.8149
-rw-r--r--fr/which.119
-rw-r--r--installkernel60
-rw-r--r--installkernel.838
-rw-r--r--mkboot395
-rw-r--r--mkboot.841
-rw-r--r--mktemp.1235
-rw-r--r--mktemp.c197
-rw-r--r--readlink.184
-rw-r--r--readlink.c94
-rw-r--r--run-parts.8111
-rw-r--r--run-parts.c472
-rw-r--r--savelog301
-rw-r--r--savelog.8139
-rw-r--r--sensible-browser40
-rw-r--r--sensible-editor31
-rw-r--r--sensible-editor.119
-rw-r--r--sensible-pager13
-rw-r--r--tempfile.161
-rw-r--r--tempfile.c151
-rw-r--r--which54
-rw-r--r--which.126
34 files changed, 4018 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..0156e29
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,17 @@
+AUTOMAKE_OPTIONS = foreign
+
+SUBDIRS = fr
+
+bin_PROGRAMS = mktemp run-parts tempfile
+mktemp_SOURCES = mktemp.c
+run_parts_SOURCES = run-parts.c
+tempfile_SOURCES = tempfile.c
+
+bin_SCRIPTS = which savelog sensible-browser sensible-editor \
+ sensible-pager
+
+sbin_SCRIPTS = installkernel mkboot
+
+man_MANS = mktemp.1 run-parts.8 tempfile.1 \
+ installkernel.8 mkboot.8 savelog.8 sensible-editor.1 \
+ tempfile.1 which.1
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..7d3b0fa
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,10 @@
+AC_INIT([debianutils],[DEBIANUTILS_VERSION])
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+
+AC_HEADER_STDC
+AC_CHECK_HEADERS(paths.h getopt.h)
+
+AC_CONFIG_FILES([Makefile fr/Makefile])
+AC_OUTPUT
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..f48bb9e
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,896 @@
+debianutils (2.13.2) unstable; urgency=low
+
+ * Don't install which compatibility symlink on the Hurd.
+ closes: #299075.
+
+ -- Clint Adams <schizo@debian.org> Sat, 26 Mar 2005 17:46:04 -0500
+
+debianutils (2.13.1) unstable; urgency=medium
+
+ * configure.ac, run-parts.c, tempfile.c: guard inclusion of getopt.h
+ * savelog: patch from Alan Sundell to fix the fix in #295850.
+ closes: #297225.
+
+ -- Clint Adams <schizo@debian.org> Sun, 27 Feb 2005 22:37:59 -0500
+
+debianutils (2.13.0) unstable; urgency=medium
+
+ * savelog: fix savelog -p, broken in the fix for #295021.
+ closes: #295850.
+ * run-parts.c: fix inconsistent error message "quoting".
+ closes: #295621.
+
+ -- Clint Adams <schizo@debian.org> Fri, 18 Feb 2005 14:39:31 -0500
+
+debianutils (2.12.1) unstable; urgency=medium
+
+ * savelog: patch from Alan Sundell to fix rotation of files
+ containing spaces. closes: #295163.
+
+ -- Clint Adams <schizo@debian.org> Thu, 17 Feb 2005 21:23:05 -0500
+
+debianutils (2.12.0) unstable; urgency=medium
+
+ * savelog: patch from Alan Sundell to fix rotation of files
+ starting with hyphens. closes: #295021.
+ * run-parts.c: fix a couple of errors which were mistakenly
+ being sent to stdout instead of stderr, pointed out by
+ Thomas Hood in #294789.
+ * debian/rules: move which to /bin and leave a compatibility
+ symlink in /usr/bin. The symlink will be dropped at a
+ later date. closes: #295058.
+
+ -- Clint Adams <schizo@debian.org> Sun, 13 Feb 2005 10:01:09 -0500
+
+debianutils (2.11.2) unstable; urgency=low
+
+ * configure.ac, debian/rules: derive version numbers from
+ debian/changelog.
+
+ -- Clint Adams <schizo@debian.org> Thu, 23 Dec 2004 15:34:30 -0500
+
+debianutils (2.11.1) unstable; urgency=low
+
+ * tempfile.1: remove note about requiring debianutils >= 1.6.
+ closes: #286464.
+
+ -- Clint Adams <schizo@debian.org> Mon, 20 Dec 2004 16:58:50 -0500
+
+debianutils (2.11.0) unstable; urgency=medium
+
+ * run-parts.c, run-parts.8: also ignore .dpkg-{new,tmp} files
+ when --lsbsysinit option is given. closes: #285031.
+
+ -- Clint Adams <schizo@debian.org> Fri, 10 Dec 2004 12:03:38 -0500
+
+debianutils (2.10.4) unstable; urgency=low
+
+ * debian/rules: Cross build support.
+ Do configure --host, on cross build.
+ closes: #283725.
+
+ -- NIIBE Yutaka <gniibe@fsij.org> Wed, 1 Dec 2004 07:37:18 +0900
+
+debianutils (2.10.3) unstable; urgency=low
+
+ * mktemp.1: remove note about requiring debianutils >= 1.7.
+ closes: #198778.
+
+ -- Clint Adams <schizo@debian.org> Sun, 17 Oct 2004 23:54:01 -0400
+
+debianutils (2.10.2) unstable; urgency=low
+
+ * installkernel: patch from Matthew Wilcox to handle systems
+ with "vmlinux" instead of "vmlinuz". closes: #272735.
+ * mkboot: check for PALO.
+
+ -- Clint Adams <schizo@debian.org> Wed, 22 Sep 2004 16:00:50 -0400
+
+debianutils (2.10.1) unstable; urgency=medium
+
+ * sensible-pager: fix spacing problem. closes: #272449.
+
+ -- Clint Adams <schizo@debian.org> Mon, 20 Sep 2004 09:28:58 -0400
+
+debianutils (2.10) unstable; urgency=low
+
+ * sensible-editor, sensible-pager: rewrite in POSIX sh.
+ * sensible-editor: fall back to $EDITOR in between $VISUAL and nano.
+ closes: #238262.
+ * mkboot.8: document SILO behavior introduced in 2.9.
+ * mkboot, mkboot.8: add -d option to allow override of floppy device.
+ closes: #247270.
+
+ -- Clint Adams <schizo@debian.org> Fri, 17 Sep 2004 20:44:01 -0400
+
+debianutils (2.9) unstable; urgency=low
+
+ * mkboot: apply patch from Martin Habets to check for SILO.
+ closes: #271909.
+ * Add prebuild target to debian/rules for arch-buildpackage.
+
+ -- Clint Adams <schizo@debian.org> Fri, 17 Sep 2004 19:46:12 -0400
+
+debianutils (2.8.4) unstable; urgency=low
+
+ * which.1: document exit status meanings. closes: #259035.
+
+ -- Clint Adams <schizo@debian.org> Mon, 12 Jul 2004 16:15:09 -0400
+
+debianutils (2.8.3) unstable; urgency=low
+
+ * Apply patch from Robert Millan to not ship installkernel and
+ mkboot on non-linux platforms. closes: #254478.
+
+ -- Clint Adams <schizo@debian.org> Fri, 18 Jun 2004 21:18:51 -0400
+
+debianutils (2.8.2) unstable; urgency=low
+
+ * run-parts.8: clarify DESCRIPTION. closes: #248149.
+
+ -- Clint Adams <schizo@debian.org> Sun, 9 May 2004 12:50:12 -0400
+
+debianutils (2.8.1) unstable; urgency=medium
+
+ * installkernel: stop trying to use a variable that was never set.
+
+ -- Clint Adams <schizo@debian.org> Tue, 30 Mar 2004 22:53:42 -0500
+
+debianutils (2.8) unstable; urgency=medium
+
+ * run-parts.c: run scripts in different process groups. closes: #226229.
+ * sensible-editor.1: fix "sendible" typo. closes: #239520.
+
+ -- Clint Adams <schizo@debian.org> Wed, 24 Mar 2004 15:13:26 -0500
+
+debianutils (2.7.5) unstable; urgency=low
+
+ * mktemp.1: add tempfile(1) to SEE ALSO. v. #227261.
+ * tempfile.1: add mktemp(1) to SEE ALSO. v. #227261.
+
+ -- Clint Adams <schizo@debian.org> Mon, 22 Mar 2004 10:06:18 -0500
+
+debianutils (2.7.4-0.1) unstable; urgency=low
+
+ * NMU.
+ * run-parts.c: allows symbolic links and reports broken ones now.
+ Thanks to Gustavo Noronha Silva for the patch (closes: #238816).
+
+ -- Sebastian Muszynski <do2ksm@linkt.de> Sat, 20 Mar 2004 11:30:03 +0100
+
+debianutils (2.7.4) unstable; urgency=low
+
+ * run-parts.c: skip all files that can't be statted unless
+ --exit-on-error is set.
+
+ -- Clint Adams <schizo@debian.org> Mon, 15 Mar 2004 23:28:57 -0500
+
+debianutils (2.7.3) unstable; urgency=medium
+
+ * run-parts.c: do not abort on broken symlinks without
+ --exit-on-error. closes: #205646.
+
+ -- Clint Adams <schizo@debian.org> Mon, 15 Mar 2004 20:43:59 -0500
+
+debianutils (2.7.2) unstable; urgency=medium
+
+ * mkboot: fix for determining root partition, thanks to
+ Matthew Foulkes. closes: #235436.
+ * mkboot.8: point out that mkboot requires rdev.
+
+ -- Clint Adams <schizo@debian.org> Sun, 29 Feb 2004 09:58:37 -0500
+
+debianutils (2.7.1) unstable; urgency=medium
+
+ * mkboot.8: correct spelling of "synopsis".
+ * mkboot.8: point out that the only sort of boot disk
+ currently handled is a floppy. closes: #208879.
+
+ -- Clint Adams <schizo@debian.org> Fri, 27 Feb 2004 10:33:48 -0500
+
+debianutils (2.7) unstable; urgency=medium
+
+ * run-parts.c: change -v to mean --verbose instead of --version,
+ and -V to mean --version. Print short forms in the usage.
+ closes: #232650.
+ * run-parts.8: document short options in OPTIONS section.
+
+ -- Clint Adams <schizo@debian.org> Tue, 24 Feb 2004 11:42:11 -0500
+
+debianutils (2.6.4) unstable; urgency=medium
+
+ * installkernel: add path to mkboot invocation (fix from
+ Alan Mimms). closes: #201232.
+
+ -- Clint Adams <schizo@debian.org> Tue, 24 Feb 2004 11:26:36 -0500
+
+debianutils (2.6.3) unstable; urgency=medium
+
+ * mkboot: add elilo support (patch from Matthew Wilcox).
+ closes: #234557.
+
+ -- Clint Adams <schizo@debian.org> Tue, 24 Feb 2004 10:57:40 -0500
+
+debianutils (2.6.2) unstable; urgency=medium
+
+ * mkboot: remove spaces from variable assignment. closes: #225079.
+
+ -- Clint Adams <schizo@debian.org> Tue, 6 Jan 2004 20:48:29 -0500
+
+debianutils (2.6.1) unstable; urgency=low
+
+ * savelog.8: add --list, --reverse, --, to SYNOPSIS. closes: #219981.
+
+ -- Clint Adams <schizo@debian.org> Wed, 12 Nov 2003 10:14:36 -0500
+
+debianutils (2.6) unstable; urgency=medium
+
+ * Replace the Replaces on manpages-fr, per Denis Barbier.
+ closes: #208272.
+ * Update mktemp and manpage from mktemp.org.
+ (This adds -V option to print version).
+ * mktemp.1: change examples and text to reflect behavior
+ of GNU libc (exactly the last 6 X's are used from template).
+ closes: #211467.
+ * mktemp.c: change default to have only 6 X's.
+
+ -- Clint Adams <schizo@debian.org> Mon, 20 Oct 2003 09:54:54 -0400
+
+debianutils (2.5.5) unstable; urgency=low
+
+ * Change Conflict on manpages-fr to (<= 0.9.3-1) and
+ remove Replaces, per Denis Barbier. closes: #208272.
+
+ -- Clint Adams <schizo@debian.org> Fri, 12 Sep 2003 20:08:23 -0400
+
+debianutils (2.5.4) unstable; urgency=medium
+
+ * mkboot: Use readlink -f instead of readlink. closes: #197461.
+
+ -- Clint Adams <schizo@debian.org> Tue, 24 Jun 2003 21:46:18 -0400
+
+debianutils (2.5.3) unstable; urgency=high
+
+ * mkboot: Check for existence of grub binary instead of package.
+ closes: #197243.
+
+ -- Clint Adams <schizo@debian.org> Tue, 24 Jun 2003 00:10:19 -0400
+
+debianutils (2.5.2) unstable; urgency=medium
+
+ * debian/postrm: fix cosmetic bug. closes: #192084.
+
+ -- Clint Adams <schizo@debian.org> Thu, 15 May 2003 20:21:54 -0400
+
+debianutils (2.5.1) unstable; urgency=medium
+
+ * debian/postinst: fix cosmetic bug. closes: #192084.
+ * Conflict with manpages-fr (<< 0.9.3-1). closes: #193113.
+
+ -- Clint Adams <schizo@debian.org> Sat, 10 May 2003 10:54:03 -0400
+
+debianutils (2.5.0) unstable; urgency=medium
+
+ * fr/savelog.8: French manpage update from Julien Louis.
+ * install text/html mailcap entry for sensible-browser. closes: #188764.
+
+ -- Clint Adams <schizo@debian.org> Wed, 23 Apr 2003 21:46:09 -0400
+
+debianutils (2.4.2) unstable; urgency=medium
+
+ * savelog.8: fix rotation semantics. closes: #188390.
+
+ -- Clint Adams <schizo@debian.org> Sat, 12 Apr 2003 11:37:34 -0400
+
+debianutils (2.4.1) unstable; urgency=low
+
+ * mkboot: Patch from Martin Orr to fix lilocheck/grubcheck breakage.
+ closes: #184148.
+
+ -- Clint Adams <schizo@debian.org> Tue, 11 Mar 2003 00:46:01 -0500
+
+debianutils (2.4) unstable; urgency=low
+
+ * Drop readlink, which is now in coreutils.
+ * Pre-Depend on coreutils.
+ * Replaces (French which manpage) manpages-fr (<< 0.9.3-1),
+ since it is unclear from manpages-fr's changelog when which
+ was dropped.
+
+ -- Clint Adams <schizo@debian.org> Sun, 2 Mar 2003 14:17:14 -0500
+
+debianutils (2.3.1) unstable; urgency=low
+
+ * run-parts.8: add --lsbsysinit to synopsis section, and move it higher in
+ the options section. closes: #181526.
+ * run-parts.c: add --lsbsysinit to --help.
+
+ -- Clint Adams <schizo@debian.org> Tue, 18 Feb 2003 21:25:18 -0500
+
+debianutils (2.3) unstable; urgency=low
+
+ * run-parts.c, run-parts.8: Michael Weber's patch to add --exit-on-error.
+ closes: #84960.
+
+ -- Clint Adams <schizo@debian.org> Tue, 18 Feb 2003 19:54:48 -0500
+
+debianutils (2.2.6) unstable; urgency=low
+
+ * Revert alternatives management of which.
+
+ -- Clint Adams <schizo@debian.org> Mon, 17 Feb 2003 09:33:15 -0500
+
+debianutils (2.2.5) unstable; urgency=low
+
+ * mkboot: Andrew T. Young's patch to construct a more appropriate
+ lilo.conf for the boot floppy. closes: #179827.
+ * mkboot: remove extraneous shift when -i is used. closes: #181105.
+
+ -- Clint Adams <schizo@debian.org> Sat, 15 Feb 2003 13:22:38 -0500
+
+debianutils (2.2.4) unstable; urgency=low
+
+ * Actually gzip French which.1.
+
+ -- Clint Adams <schizo@debian.org> Wed, 12 Feb 2003 13:39:52 -0500
+
+debianutils (2.2.3) unstable; urgency=low
+
+ * fr/which.1: French manpage for which by Laëtitia Groslong
+ <lgr@tartine.org>, submitted by Julien Louis. closes: #180263.
+
+ -- Clint Adams <schizo@debian.org> Sat, 8 Feb 2003 17:09:44 -0500
+
+debianutils (2.2.2) unstable; urgency=low
+
+ * mkboot.8: change "/boot/vmlinuz" to "/vmlinuz". closes: #180044.
+
+ -- Clint Adams <schizo@debian.org> Fri, 7 Feb 2003 15:34:45 -0500
+
+debianutils (2.2.1) unstable; urgency=low
+
+ * run-parts.8: change DESCRIPTION to Thomas Hood's rewrite.
+ closes: #179456.
+
+ -- Clint Adams <schizo@debian.org> Sun, 2 Feb 2003 10:17:43 -0500
+
+debianutils (2.2) unstable; urgency=low
+
+ * run-parts.c, run-parts.8: add --lsbsysinit option, and revert default
+ valid namespace to historical behavior. closes: #178859, #176695.
+
+ -- Clint Adams <schizo@debian.org> Thu, 30 Jan 2003 12:29:21 -0500
+
+debianutils (2.1.8) unstable; urgency=low
+
+ * run-parts.8: clarify valid namespaces. closes: #177302.
+
+ -- Clint Adams <schizo@debian.org> Thu, 30 Jan 2003 11:09:20 -0500
+
+debianutils (2.1.7) unstable; urgency=low
+
+ * Ship postinst and prerm again.
+
+ -- Clint Adams <schizo@debian.org> Thu, 30 Jan 2003 10:00:02 -0500
+
+debianutils (2.1.6) unstable; urgency=low
+
+ * Install which as which.debianutils and put under alternatives,
+ so that people can install GNU which for some reason. closes: #177339.
+
+ -- Clint Adams <schizo@debian.org> Wed, 29 Jan 2003 22:12:06 -0500
+
+debianutils (2.1.5) unstable; urgency=low
+
+ * mkboot: patch to better handle LILO on software raid. closes: #108513.
+
+ -- Clint Adams <schizo@debian.org> Wed, 29 Jan 2003 21:17:51 -0500
+
+debianutils (2.1.4) unstable; urgency=low
+
+ * mkboot: patch to handle devfs floppies not named /dev/fd0 from
+ Alban Browaeys. closes: #177283.
+
+ -- Clint Adams <schizo@debian.org> Sat, 18 Jan 2003 08:17:43 -0500
+
+debianutils (2.1.3) unstable; urgency=low
+
+ * fr/savelog.8: updates to French manpage from Antoine Gémis and
+ Julien Louis.
+
+ -- Clint Adams <schizo@debian.org> Sat, 18 Jan 2003 00:01:57 -0500
+
+debianutils (2.1.2) unstable; urgency=low
+
+ * tempfile.1: add missing backslash.
+
+ -- Clint Adams <schizo@debian.org> Sun, 5 Jan 2003 12:41:14 -0500
+
+debianutils (2.1.1) unstable; urgency=low
+
+ * savelog.8: document -C, -d, -r, -n, -q.
+
+ -- Clint Adams <schizo@debian.org> Fri, 3 Jan 2003 10:03:27 -0500
+
+debianutils (2.1) unstable; urgency=low
+
+ * which, which.1: add -a option to display all matches. closes: #174320.
+ * mkboot: switch to /bin/sh.
+
+ -- Clint Adams <schizo@debian.org> Thu, 2 Jan 2003 18:09:40 -0500
+
+debianutils (2.0.6) unstable; urgency=low
+
+ * run-parts.8: typo fix from Guillem Jover. closes: #173808.
+
+ -- Clint Adams <schizo@debian.org> Sat, 21 Dec 2002 15:53:52 -0500
+
+debianutils (2.0.5) unstable; urgency=low
+
+ * savelog: patch from Greg Norris to fix bzip2 extension and -q
+ parsing. closes: #173727.
+
+ -- Clint Adams <schizo@debian.org> Fri, 20 Dec 2002 08:06:58 -0500
+
+debianutils (2.0.4) unstable; urgency=low
+
+ * Remove bashism from preinst. closes: #171783.
+
+ -- Clint Adams <schizo@debian.org> Wed, 4 Dec 2002 19:18:32 -0500
+
+debianutils (2.0.3) unstable; urgency=low
+
+ * run-parts.c: patch from Ian Zimmerman which fixes problem
+ of losing program output in certain situations. closes: #170739.
+ * sensible-browser: patch from Joey Hess to better handle browser exit
+ status. closes: #171075. patch from Kevin B. McCarty to pass the url
+ to x-terminal-emulator -e browser. closes: #171316.
+
+ -- Clint Adams <schizo@debian.org> Tue, 3 Dec 2002 18:43:24 -0500
+
+debianutils (2.0.2) unstable; urgency=low
+
+ * Install installkernel, which, savelog, sensible-browser,
+ sensible-editor, sensible-pager, mkboot, and associated manpages
+ via Makefile, rather than via debian/rules.
+
+ -- Clint Adams <schizo@debian.org> Wed, 20 Nov 2002 20:52:40 -0500
+
+debianutils (2.0.1) unstable; urgency=low
+
+ * Install readlink, run-parts, tempfile, mktemp, and
+ associated manpages via Makefile, rather than via debian/rules.
+
+ -- Clint Adams <schizo@debian.org> Wed, 20 Nov 2002 20:03:19 -0500
+
+debianutils (2.0) unstable; urgency=low
+
+ * Bump Standards-Version up to 3.5.8.
+ * Joey Hess: Added sensible-browser command.
+ * Joey Hess: Modifed sensible-* man page to document sensible-browser too.
+
+ -- Clint Adams <schizo@debian.org> Wed, 20 Nov 2002 18:24:01 -0500
+
+debianutils (1.23) unstable; urgency=low
+
+ * readlink.c, readlink.1: apply patch from Martin Michlmayr to
+ support multiple arguments to readlink. closes: #66036.
+
+ -- Clint Adams <schizo@debian.org> Tue, 19 Nov 2002 06:20:24 -0500
+
+debianutils (1.22.6) unstable; urgency=low
+
+ * run-parts.8: stop manpage from contradicting actual behavior.
+
+ -- Clint Adams <schizo@debian.org> Tue, 19 Nov 2002 06:09:26 -0500
+
+debianutils (1.22.5) unstable; urgency=low
+
+ * run-parts.c, Makefile.am, configure.ac: use automake to build binaries.
+
+ -- Clint Adams <schizo@debian.org> Mon, 18 Nov 2002 14:52:10 -0500
+
+debianutils (1.22.4) unstable; urgency=low
+
+ * run-parts.c: use regexes based on LSB spec for /etc/cron.daily
+ naming &a, still excepting *.dpkg-{old,dist}.
+
+ -- Clint Adams <schizo@debian.org> Mon, 18 Nov 2002 14:13:49 -0500
+
+debianutils (1.22.3) unstable; urgency=low
+
+ * mkboot.8: fix hyphens.
+ * mkboot.8: add BUGS section to point out that mkboot is i386-only.
+ closes: #139377.
+
+ -- Clint Adams <schizo@debian.org> Fri, 15 Nov 2002 19:00:25 -0500
+
+debianutils (1.22.2) unstable; urgency=low
+
+ * savelog: error upon hardlink failure instead of clobbering file.
+ closes: #69685.
+
+ -- Clint Adams <schizo@debian.org> Fri, 15 Nov 2002 17:49:48 -0500
+
+debianutils (1.22.1) unstable; urgency=low
+
+ * run-parts.c, tempfile.c: clean multi-line string literals
+ to stop gcc 3.0 from bitching.
+
+ -- Clint Adams <schizo@debian.org> Thu, 14 Nov 2002 16:31:15 -0500
+
+debianutils (1.22.0) unstable; urgency=low
+
+ * run-parts.c, run-parts.8: add --reverse option from Marc Haber.
+ closes: #85070.
+
+ -- Clint Adams <schizo@debian.org> Thu, 14 Nov 2002 13:42:20 -0500
+
+debianutils (1.21.2) unstable; urgency=medium
+
+ * savelog: fixes from Cristian Ionescu-Idbohrn. closes: #168965.
+
+ -- Clint Adams <schizo@debian.org> Wed, 13 Nov 2002 16:26:13 -0500
+
+debianutils (1.21.1) unstable; urgency=medium
+
+ * savelog: add missing semicolons. closes: #168894.
+
+ -- Clint Adams <schizo@debian.org> Wed, 13 Nov 2002 03:31:19 -0500
+
+debianutils (1.21.0) unstable; urgency=low
+
+ * savelog: add -q for 'quiet'. closes: #144002.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 21:17:40 -0500
+
+debianutils (1.20.0) unstable; urgency=low
+
+ * savelog: add -n for 'do not rotate empty files'. closes: #144810.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 18:21:37 -0500
+
+debianutils (1.19.0) unstable; urgency=low
+
+ * savelog: apply new optional features from Gert-Jan Hagenaars:
+ ability to roll logs into another directory, ability to roll
+ logfiles with dates instead of "plain" numbers, and forcing cleanup
+ when the cycle is changed. closes: #132651.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 17:54:22 -0500
+
+debianutils (1.18.0) unstable; urgency=low
+
+ * savelog, savelog.8, savelog.fr.8: add -j option for bzip2.
+ closes: #44048.
+ * savelog.8, savelog.fr.8: fix hyphens.
+ * debian/copyright: reflect that the current which is in the public
+ domain.
+ * savelog: get rid of an XSIism.
+ * installkernel: use readlink instead of ls. closes: #166479.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 16:36:54 -0500
+
+debianutils (1.17.0) unstable; urgency=low
+
+ * Install French savelog manpage to /usr/share/man/fr.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 12:21:08 -0500
+
+debianutils (1.16.9) unstable; urgency=low
+
+ * New maintainer.
+ * Add French translation of savelog.8. closes: #168162.
+ * run-paths.c, run-parts.8: add --list option from Jon Middleton. closes:
+ #149438.
+
+ -- Clint Adams <schizo@debian.org> Mon, 11 Nov 2002 11:34:51 -0500
+
+debianutils (1.16.8) unstable; urgency=low
+
+ * NMU
+ * which: Apply Jeff Sheinberg's fixes. closes: #167496.
+ * installkernel: make a bit more POSIX-conformant. closes: #166479.
+
+ -- Clint Adams <schizo@debian.org> Sun, 10 Nov 2002 15:02:37 -0500
+
+debianutils (1.16.7) unstable; urgency=low
+
+ * NMU
+ * Add .disabled to the list of ignored file names, and document both it
+ and the non-running of .notslocate in run-parts(8). (closes: #163223)
+ * Only copy /boot/boot.b if the file is actually there. (closes: #164064)
+ * Give out correct error message when incorrect options are passed on
+ the command line. (closes: #161975)
+ * Fix sillyness in documentation referring to "#!/bin/interpretername
+ convention". (closes: #82802)
+
+ -- Tollef Fog Heen <tfheen@debian.org> Thu, 17 Oct 2002 05:37:13 +0200
+
+debianutils (1.16.6) unstable; urgency=low
+
+ * NMU
+ * which: Colin Watson's patch to fix which balking at full pathnames.
+ closes: #162967.
+ * which.1: further clarification.
+ * mktemp.1: mention a minimum of 6 trailing X's. closes: #154916.
+ * tempfile.1: patch from Colin Phipps. closes: #114610.
+
+ -- Clint Adams <schizo@debian.org> Tue, 1 Oct 2002 11:31:28 -0400
+
+debianutils (1.16.5) unstable; urgency=low
+
+ * NMU
+ * sensible-editor: try nano and nano-tiny instead of ae. closes: #153990.
+ * which: replace which with Colin Watson's POSIX-compliant version.
+ closes: #94507, #47985, #148178.
+ * which.1: clarify manpage
+ * Update to Standards-Version 3.5.7.
+ * Replace description with one penned by Colin Walters. closes: #139952.
+ * Handle noopt and nostrip in DEB_BUILD_OPTIONS, and don't force CFLAGS
+ in Makefile.
+ * Eradicate bashisms in debian/rules.
+
+ -- Clint Adams <schizo@debian.org> Sat, 28 Sep 2002 16:07:10 -0400
+
+debianutils (1.16.4) unstable; urgency=low
+
+ * NMU.
+ * Fix run-parts to allow LSB-sanctioned cronjob filenames. (Closes: #118646)
+ * Remove /usr/doc transition business.
+
+ -- Chris Lawrence <lawrencc@debian.org> Fri, 27 Sep 2002 23:41:18 -0500
+
+debianutils (1.16.3) unstable; urgency=high
+
+ * Non-maintainer upload
+ * installkernel: Check for the INSTALL_PATH being a 0-length string
+ as well as unset. Closes: #139226
+
+ -- Matthew Wilcox <willy@debian.org> Thu, 13 Jun 2002 08:21:20 -0400
+
+debianutils (1.16.2) woody-proposed-updates unstable; urgency=high
+
+ * Non-maintainer upload
+ * Properly fix infinite busy-loop using patch from Bruce Perens.
+ Closes: Bug#145278
+
+ -- Wichert Akkerman <wakkerma@debian.org> Sun, 5 May 2002 16:30:35 +0200
+
+debianutils (1.16.1) unstable; urgency=medium
+
+ * Non-maintainer upload
+ * Apply patch from Garth Mollett to fix race in the select handling:
+ on SMP machines the child process may have finished when we hit the select
+ and we could end up waiting forever. Closes: Bug#114864,#132539
+
+ -- Wichert Akkerman <wakkerma@debian.org> Fri, 26 Apr 2002 14:47:45 +0200
+
+debianutils (1.16) unstable; urgency=low
+
+ * installkernel: honor INSTALL_PATH. closes: #50117, #129195, #134176
+ * installkernel: copy .config. closes: #116593
+ * mkboot: look for GRUB. closes: #98262, #116592
+ * mkboot: call the boot floppy kernel vmlinuz. closes: #130889
+ * mkboot: default kernel is /vmlinuz. closes: #125722
+ * mkboot: cd later so relative path works. closes: #134594
+ * debian/rules: test for id 0. closes: #104217
+ * run-parts: make --test less verbose. closes: #113293
+ * mktemp: update to current BSD. closes: #61718, #61026, #104226
+ * integrate NMU changes. closes: #106829, #131719
+
+ -- Guy Maor <maor@debian.org> Mon, 18 Feb 2002 23:20:42 -0600
+
+debianutils (1.15.2) unstable; urgency=low
+
+ * NMU
+ * fix the typo introduced by the last NMU (closes: #131376, #106829)
+ $filaname -> $filename
+
+ -- Junichi Uekawa <dancer@debian.org> Fri, 1 Feb 2002 01:04:38 +0900
+
+debianutils (1.15.1) unstable; urgency=low
+
+ * NMU to fix serious-severity bug.
+ * savelog:
+ - Use touch, chown, etc, instead of cp, when used with -p. (closes: #106829)
+
+ -- Daniel Stone <DanielS@esd.nec.com.au> Mon, 28 Jan 2002 07:09:23 +1100
+
+debianutils (1.15) unstable; urgency=low
+
+ * Maintainer back to me.
+ * mkboot: fix image= line when making lilo boot disk, closes: #69972, #55087.
+ * mkboot: add -r option to specify alternate root partition, closes: #69973.
+ * installkernel.8: add explanation of /sbin instead of /usr/sbin,
+ closes: #59915.
+ * run-parts: add --arg option to pass arguments: closes: #61736.
+ * readlink.1: elaborate on -f behavior, closes: #71630.
+
+ -- Guy Maor <maor@debian.org> Fri, 19 Jan 2001 09:42:32 -0800
+
+debianutils (1.14) unstable; urgency=low
+
+ * New maintainer.
+ * debian/copyright: update and fix location of GPL.
+ * debian/prerm: don't use $0 remove /usr/doc/ link on upgrade too.
+ * debian/control (Standards-Version): bump to 3.2.1.
+
+ -- James Troup <james@nocrew.org> Tue, 5 Dec 2000 22:29:21 +0000
+
+debianutils (1.13.3) frozen unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Release Manager: this fixes RC bug #59121.
+ * run-parts.c: Added patch by Ingo Saitz <Ingo.Saitz@stud.uni-hannover.de>
+ to correctly catch defunct children (this will fix #59121,#57464)
+
+ -- Steve Greenland <stevegr@debian.org> Sun, 2 Apr 2000 13:53:21 -0500
+
+debianutils (1.13.2) unstable; urgency=low
+
+ * Non-maintainer release.
+ * debian/control: Replaces tetex-bin (<< 1.0.6-1.1).
+ (closes:Bug#51286)
+ * readlink.c: Add stupid PATH_MAX kluge until I have time to
+ fix it properly.
+
+ -- Joel Klecker <espy@debian.org> Tue, 7 Dec 1999 09:52:08 -0800
+
+debianutils (1.13.1) unstable; urgency=low
+
+ * Non-maintainer release.
+ * Add readlink (from OpenBSD).
+ * debian/control:
+ - Replaces tetex-bin.
+ - Update Standards-Version to 3.1.0.
+ * debian/rules:
+ - Use /usr/share/man and /usr/share/doc
+ (add postinst and preinst for /usr/doc symlink).
+ - Call dpkg-gencontrol with -isp.
+
+ -- Joel Klecker <espy@debian.org> Mon, 8 Nov 1999 11:42:08 -0800
+
+debianutils (1.13) unstable; urgency=low
+
+ * fix -n segfault, closes: #43942, #44547.
+
+ -- Guy Maor <maor@debian.org> Sun, 12 Sep 1999 16:29:16 -0700
+
+debianutils (1.12) unstable; urgency=low
+
+ * mkboot: search for lilo signature in first 16 bytes, closes: #41636,
+ #33750
+ * mkboot: fix simple typo, closes: #33571
+ * mkboot: use TMPDIR, closes: #36273
+ * tempfile: default permission is 0600, closes: #42836
+ * tempfile: add --suffix option, closes: #32653.
+ * savelog.8: be clear about file deletion, closes: #41597.
+ * hurd patch, closes: #39126.
+ * fix core on --test invaliddir, closes: #37885.
+
+ -- Guy Maor <maor@debian.org> Sun, 29 Aug 1999 17:29:34 -0700
+
+debianutils (1.11) unstable; urgency=low
+
+ * Fixed examples in mktemp.1, closes: #27428.
+ * installkernel - don't run psupdate as it's obsolete, closes: #29879.
+ * savelog - be POSIX, closes: #31780.
+ * make interactive on no arguments, closes: #40671, #43012.
+ * don't depend on perl-base, closes: #42543.
+
+ -- Guy Maor <maor@debian.org> Fri, 29 Jan 1999 01:17:37 -0800
+
+debianutils (1.10) unstable; urgency=low
+
+ * Corrections to tempfile.1, fixes: #20785, #22347.
+ * Corrections to mktemp.1, fixes: #20814.
+ * Fix mkboot's lilo.conf when making boot disk, fixes: #22831.
+ * Turn set -x off (oops!), fixes: #23114.
+ * run-parts: fix error message, fixes: #24232.
+ * savelog: don't destroy .0 file timestamps, fixes: #21373.
+
+ -- Guy Maor <maor@ece.utexas.edu> Sun, 16 Aug 1998 15:28:57 -0700
+
+debianutils (1.9) frozen unstable; urgency=high
+
+ * run-parts: close unused fd's to prevent hang. fixes: #20678.
+ * run-parts: flush buffers after printing message. fixes: #20287.
+ * run-parts: fix error message. fixes: #19741.
+ * mktemp manpage corrections. fixes: #20224, #20225.
+
+ -- Guy Maor <maor@ece.utexas.edu> Sun, 5 Apr 1998 14:46:17 -0700
+
+debianutils (1.8) unstable; urgency=low
+
+ * Strip binaries.
+ * Added sensible-pager.1
+
+ -- Guy Maor <maor@ece.utexas.edu> Fri, 13 Mar 1998 02:43:11 -0800
+
+debianutils (1.7) unstable; urgency=low
+
+ * Fixed tempfile --help. fixes: #13874
+ * savelog, installkernel use /bin/sh. fixes: #15171, #15872
+ * Clarify run-parts.8. fixes: #16865
+ * Added --report ro runparts. fixes: #9965
+ * Improved installkernel, inspired by David ROCHER <rocher@easynet.fr>.
+ fixes: #14951
+ * Added mktemp. fixes: 15947.
+
+ -- Guy Maor <maor@ece.utexas.edu> Sun, 15 Feb 1998 03:01:04 -0800
+
+debianutils (1.6) unstable; urgency=low
+
+ * Fixed which for filenames with dash (#11625).
+ * Fixed mkboot so always removes directory (#10048).
+ * Compiled with libc6 (#11671).
+ * New commands: tempfile, sensible-editor, sensible-pager (#12161).
+ * savelog: add -p option (#9211), ln and mv logfile to prevent race (#10999)
+
+ -- Guy Maor <maor@ece.utexas.edu> Sun, 24 Aug 1997 20:23:13 -0500
+
+debianutils (1.5) frozen unstable; urgency=low
+
+ * Improved which, added which.1 (#7435).
+ * Fixed includes in run-parts (#7660, #8231, #8748).
+ * Fixed savelog.8 (#9777).
+
+ -- Guy Maor <maor@ece.utexas.edu> Thu, 15 May 1997 01:01:49 -0500
+
+debianutils (1.4) unstable; urgency=low
+
+ * installkernel: fixed bug #6395 - /boot/vmlinuz.old link is broken when
+ recompiling a kernel.
+ * mkboot: fixed bug #6227 - mkboot recovers better from errors
+
+ -- Guy Maor <maor@ece.utexas.edu> Tue, 7 Jan 1997 12:03:51 -0600
+
+debianutils (1.3) unstable; urgency=low
+
+ * New source format.
+ * installkernel.8: fixed typo, bug #3511.
+ * which: fixed quoting problem, bug #4363
+
+ -- Guy Maor <maor@ece.utexas.edu> Mon, 30 Sep 1996 16:26:25 -0500
+
+debianutils (1.2-3) unstable; urgency=low
+
+ * installkernel: Fixed silly bug.
+
+ -- Guy Maor <maor@ece.utexas.edu> Sat, 08 Jun 1996 22:38:50 -0500
+
+debianutils (1.2-2) unstable; urgency=low
+
+ * installkernel.8: Improved it, fixes bug 2887
+ * debian.rules: Changed package name to debianutils (with a
+ Conflict,Replaces debian-utils)
+ * which: Fixed to print paths when arg is a shell builtin
+ * mkboot: Can specify kernel to use with argument. Defaults to
+ /boot/vmlinuz.
+ * run-parts.c: Added --verbose option from Austin Donnelly
+ <and1000@cam.ac.uk>.
+
+ -- Guy Maor <maor@ece.utexas.edu> Wed, 05 Jun 1996 06:15:25 -0500
+
+debianutils (1.2-1) unstable; urgency=low
+
+ * Added priorty and replaces cron (<=3.0pl1-31)
+ * savelog{,.8}: Savelog moved in from cron. I also wrote a man-page.
+
+ -- Guy Maor <maor@ece.utexas.edu> Thu, 25 Apr 1996 04:41:47 -0500
+
+debianutils (1.1-2) unstable; urgency=low
+
+ * run-parts.c (run_part): silly bug with return code reporting.
+
+ -- Guy Maor <maor@ece.utexas.edu> Sat, 20 Apr 1996 05:15:08 -0500
+
+debianutils (1.1-1) unstable; urgency=low
+
+ * Initial release
+ * mkboot: Rewrote from scratch, fixes Bugs 918, 1520, 1521
+ * debian.control: Added 'Section: base'
+ * run-parts.c: Now skips over directories, fixes Bug 2244
+
+ -- Guy Maor <maor@ece.utexas.edu> Thu, 18 Apr 1996 19:54:33 -0500
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..f06ff52
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,21 @@
+Source: debianutils
+Section: base
+Priority: required
+Maintainer: Clint Adams <schizo@debian.org>
+Standards-Version: 3.6.1
+
+Package: debianutils
+Architecture: any
+Pre-Depends: ${shlibs:Depends}, coreutils (>= 4.5.8-1)
+Section: base
+Essential: yes
+Replaces: miscutils, cron (<=3.0pl1-31), tetex-bin (<< 1.0.6-1.1), manpages-fr (<= 0.9.3-1)
+Conflicts: manpages-fr (<= 0.9.3-1)
+Description: Miscellaneous utilities specific to Debian
+ This package provides a number of small utilities which are used
+ primarily by the installation scripts of Debian packages, although
+ you may use them directly.
+ .
+ The specific utilities included are: installkernel mkboot mktemp
+ run-parts savelog sensible-browser sensible-editor sensible-pager
+ tempfile which.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..99810f4
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,168 @@
+This is the Debian GNU/Linux package debianutils.
+
+It is an original Debian package. Programs in it were maintained by
+Guy Maor <maor@debian.org>, and are now maintained by Clint Adams
+<schizo@debian.org>.
+
+All its programs except mktemp, readlink, savelog, and which may be
+redistributed under the terms of the GNU GPL, Version 2 or later,
+found on Debian systems in the file /usr/share/common-licenses/GPL.
+
+which is in the public domain.
+
+mktemp is Copyright (c) 1996 Todd C. Miller <Todd.Miller@courtesan.com>,
+and may be distributed under the terms of the BSD copyright, found on
+Debian systems in the file /usr/share/common-licenses/BSD.
+
+readlink is Copyright (c) 1997 Kenneth Stailey, and may also be
+distributed under the terms of the BSD copyright.
+
+savelog may be redistributed under the following terms: (The rest of
+this file consists of savelog's distribution terms.)
+
+#ident "@(#)smail:RELEASE-3_2:COPYING,v 1.2 1996/06/14 18:59:10 woods Exp"
+
+ SMAIL GENERAL PUBLIC LICENSE
+ (Clarified 11 Feb 1988)
+
+ Copyright (C) 1988 Landon Curt Noll & Ronald S. Karr
+ Copyright (C) 1992 Ronald S. Karr
+ Copyleft (GNU) 1988 Landon Curt Noll & Ronald S. Karr
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license, but changing it is not allowed. You can also
+ use this wording to make the terms for other programs.
+
+ The license agreements of most software companies keep you at the
+mercy of those companies. By contrast, our general public license is
+intended to give everyone the right to share SMAIL. To make sure that
+you get the rights we want you to have, we need to make restrictions
+that forbid anyone to deny you these rights or to ask you to surrender
+the rights. Hence this license agreement.
+
+ Specifically, we want to make sure that you have the right to give
+away copies of SMAIL, that you receive source code or else can get it
+if you want it, that you can change SMAIL or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To make sure that everyone has such rights, we have to forbid you to
+deprive anyone else of these rights. For example, if you distribute
+copies of SMAIL, you must give the recipients all the rights that you
+have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ Also, for our own protection, we must make certain that everyone
+finds out that there is no warranty for SMAIL. If SMAIL is modified by
+someone else and passed on, we want its recipients to know that what
+they have is not what we distributed, so that any problems introduced
+by others will not reflect on our reputation.
+
+ Therefore we (Landon Curt Noll and Ronald S. Karr) make the following
+terms which say what you must do to be allowed to distribute or change
+SMAIL.
+
+
+ COPYING POLICIES
+
+ 1. You may copy and distribute verbatim copies of SMAIL source code
+as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy a valid copyright notice "Copyright
+(C) 1988 Landon Curt Noll & Ronald S. Karr" (or with whatever year is
+appropriate); keep intact the notices on all files that refer to this
+License Agreement and to the absence of any warranty; and give any
+other recipients of the SMAIL program a copy of this License
+Agreement along with the program. You may charge a distribution fee
+for the physical act of transferring a copy.
+
+ 2. You may modify your copy or copies of SMAIL or any portion of it,
+and copy and distribute such modifications under the terms of
+Paragraph 1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish,
+ that in whole or in part contains or is a derivative of SMAIL or
+ any part thereof, to be licensed at no charge to all third
+ parties on terms identical to those contained in this License
+ Agreement (except that you may choose to grant more extensive
+ warranty protection to some or all third parties, at your option).
+
+ c) You may charge a distribution fee for the physical act of
+ transferring a copy, and you may at your option offer warranty
+ protection in exchange for a fee.
+
+Mere aggregation of another unrelated program with this program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other program under the scope of these terms.
+
+ 3. You may copy and distribute SMAIL (or a portion or derivative of it,
+under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal
+ shipping charge) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for non-commercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+For an executable file, complete source code means all the source code for
+all modules it contains; but, as a special exception, it need not include
+source code for modules which are standard libraries that accompany the
+operating system on which the executable file runs.
+
+ 4. You may not copy, sublicense, distribute or transfer SMAIL
+except as expressly provided under this License Agreement. Any attempt
+otherwise to copy, sublicense, distribute or transfer SMAIL is void and
+your rights to use the program under this License agreement shall be
+automatically terminated. However, parties who have received computer
+software programs from you with this License Agreement will not have
+their licenses terminated so long as such parties remain in full compliance.
+
+ 5. If you wish to incorporate parts of SMAIL into other free
+programs whose distribution conditions are different, write to Landon
+Curt Noll & Ronald S. Karr via the Free Software Foundation at 59
+Temple Place - Suite 330, Boston, MA 02111-1307, USA. We have not yet
+worked out a simple rule that can be stated here, but we will often
+permit this. We will be guided by the two goals of preserving the
+free status of all derivatives of our free software and of promoting
+the sharing and reuse of software.
+
+Your comments and suggestions about our licensing policies and our
+software are welcome! This contract was based on the contract made by
+the Free Software Foundation. Please contact the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA, or call (617) 542-5942 for details on copylefted material in
+general.
+
+ NO WARRANTY
+
+ BECAUSE SMAIL IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO
+WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING, LANDON CURT NOLL & RONALD S. KARR AND/OR
+OTHER PARTIES PROVIDE SMAIL "AS IS" WITHOUT WARRANTY OF ANY KIND,
+EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF SMAIL IS WITH
+YOU. SHOULD SMAIL PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
+NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL LANDON CURT NOLL &
+RONALD S. KARR AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE
+SMAIL AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
+(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE
+PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) SMAIL, EVEN IF YOU HAVE
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY
+ANY OTHER PARTY.
diff --git a/debian/mime b/debian/mime
new file mode 100644
index 0000000..64d2cc3
--- /dev/null
+++ b/debian/mime
@@ -0,0 +1 @@
+text/html; /usr/bin/sensible-browser %s; description=HTML Text; nametemplate=%s.html; priority=1
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000..af4f2f5
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,20 @@
+#! /bin/sh
+set -e
+
+case "$1" in
+ configure)
+ if which update-mime >/dev/null;
+ then
+ update-mime
+ fi
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
diff --git a/debian/postrm b/debian/postrm
new file mode 100755
index 0000000..22a4433
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,18 @@
+#! /bin/sh
+
+set -e
+
+case "$1" in
+ remove|purge|upgrade|deconfigure|disappear)
+ if which update-mime >/dev/null;
+ then
+ update-mime
+ fi
+ ;;
+ failed-upgrade|abort-install|abort-upgrade)
+ ;;
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
diff --git a/debian/preinst b/debian/preinst
new file mode 100644
index 0000000..94ed254
--- /dev/null
+++ b/debian/preinst
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if ! dpkg --assert-support-predepends ; then
+ echo "\nPlease upgrade to a newer version of dpkg\n"
+ exit 1
+fi
diff --git a/debian/prerm b/debian/prerm
new file mode 100755
index 0000000..5bff87b
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+set -e
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ ;;
+ failed-upgrade)
+ ;;
+ *)
+ echo "prerm called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..cc84deb
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,110 @@
+#! /usr/bin/make -f
+
+package = debianutils
+
+CFLAGS = -Wall -g
+INSTALL = install
+INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
+INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
+INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755
+INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755
+
+DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
+DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+CONFARGS = --host=$(DEB_HOST_GNU_TYPE)
+endif
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+CFLAGS += -O0
+else
+CFLAGS += -O2
+endif
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+INSTALL_PROGRAM += -s
+endif
+
+build:
+ $(checkdir)
+ CFLAGS="$(CFLAGS)" ./configure --prefix=/usr \
+ --mandir=/usr/share/man $(CONFARGS)
+ $(MAKE)
+
+clean:
+ $(checkdir)
+ -$(MAKE) clean
+ $(RM) -rf autom4te.cache
+ $(RM) -r debian/tmp* debian/files* debian/substvars debianutils*
+ find . -name '*~' -print0 | xargs -0 rm -f
+
+binary-indep: checkroot build
+ $(checkdir)
+
+binary-arch: checkroot build
+ $(checkdir)
+ -rm -rf debian/tmp
+ $(INSTALL_DIR) debian/tmp/DEBIAN \
+ debian/tmp/bin \
+ debian/tmp/sbin \
+ debian/tmp/usr/bin \
+ debian/tmp/usr/sbin \
+ debian/tmp/usr/share/man/man1 \
+ debian/tmp/usr/share/man/man8 \
+ debian/tmp/usr/share/man/fr/man8 \
+ debian/tmp/usr/lib/mime/packages \
+ debian/tmp/usr/share/doc/$(package)
+ $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp INSTALL_PROGRAM="$(INSTALL_PROGRAM)"
+ mv debian/tmp/usr/bin/run-parts \
+ debian/tmp/usr/bin/tempfile \
+ debian/tmp/usr/bin/mktemp \
+ debian/tmp/usr/bin/which \
+ debian/tmp/bin/
+ifeq ($(DEB_BUILD_GNU_SYSTEM),gnu)
+ ln -s /bin/which debian/tmp/usr/bin/which
+endif
+ifeq ($(DEB_BUILD_GNU_SYSTEM),linux)
+ mv debian/tmp/usr/sbin/installkernel debian/tmp/sbin/
+else
+ rm debian/tmp/usr/sbin/installkernel \
+ debian/tmp/usr/sbin/mkboot \
+ debian/tmp/usr/share/man/man8/installkernel.8 \
+ debian/tmp/usr/share/man/man8/mkboot.8
+endif
+ ln -s sensible-editor.1.gz debian/tmp/usr/share/man/man1/sensible-pager.1.gz
+ ln -s sensible-editor.1.gz debian/tmp/usr/share/man/man1/sensible-browser.1.gz
+ $(INSTALL_FILE) debian/changelog debian/tmp/usr/share/doc/$(package)
+ find debian/tmp/usr/share/man/man[18] \
+ debian/tmp/usr/share/doc/$(package) -type f | xargs gzip -9
+ gzip -9f debian/tmp/usr/share/man/fr/man1/which.1 \
+ debian/tmp/usr/share/man/fr/man8/savelog.8
+ $(INSTALL_FILE) debian/copyright debian/tmp/usr/share/doc/$(package)
+ $(INSTALL_SCRIPT) debian/preinst debian/tmp/DEBIAN/
+ $(INSTALL_SCRIPT) debian/prerm debian/tmp/DEBIAN/
+ $(INSTALL_SCRIPT) debian/postinst debian/tmp/DEBIAN/
+ $(INSTALL_SCRIPT) debian/postrm debian/tmp/DEBIAN/
+ $(INSTALL_FILE) debian/mime debian/tmp/usr/lib/mime/packages/debianutils
+ dpkg-shlibdeps run-parts tempfile mktemp
+ dpkg-gencontrol -isp
+ dpkg --build debian/tmp ..
+
+define checkdir
+ test -f run-parts.c && test -f debian/rules
+endef
+
+binary: binary-indep binary-arch
+
+checkroot:
+ $(checkdir)
+ test 0 = `id -u`
+
+prebuild:
+ printf "define(DEBIANUTILS_VERSION, %s)\n" $$(dpkg-parsechangelog | sed -n '/^Version: \(.*\)$$/ {s//\1/;p}') >acinclude.m4
+
+ autoreconf -fi
+
+.PHONY: binary binary-arch binary-indep clean checkroot build prebuild
+
+# Local Variables:
+# mode:Makefile
+# End:
diff --git a/fr/Makefile.am b/fr/Makefile.am
new file mode 100644
index 0000000..07f85bb
--- /dev/null
+++ b/fr/Makefile.am
@@ -0,0 +1,7 @@
+AUTOMAKE_OPTIONS=foreign
+
+manfronedir = $(mandir)/fr/man1
+manfrone_DATA = which.1
+
+manfreightdir = $(mandir)/fr/man8
+manfreight_DATA = savelog.8
diff --git a/fr/savelog.8 b/fr/savelog.8
new file mode 100644
index 0000000..732a47d
--- /dev/null
+++ b/fr/savelog.8
@@ -0,0 +1,149 @@
+.\"Traduction Lundi 13 janvier 2003 par Antoine Gémis
+.\"(agemis@netuup.com)
+.\"(savelog 1.16.7)
+.TH SAVELOG 8 "12 avril 2003" "Debian GNU/Linux"
+.SH NOM
+savelog \- sauvegarde un fichier journal
+.SH SYNOPSIS
+.B savelog
+[\-m mode] [\-u utilisateur] [\-g groupe] [\-t] [\-p] [\-c cycle] [\-l] [\-j]
+[\-C] [\-d] [\-l] [\-r répertoire] [\-n] [\-q] fichier...
+.SH DESCRIPTION
+Le programme
+.B savelog
+sauvegarde un fichier journal et éventuellement, compresse
+les anciens fichiers. Les anciennes versions de
+.I fichier
+sont renommées\ :
+.RS
+
+.IR "fichier" "." "<numéro>" "" "<extension_de_compression>"
+
+.RE
+ou
+.I <numéro>
+est le numéro de version, la version la plus récente portant le numéro 0. Si
+l'option
+.B \-l
+n'est pas spécifiée, les versions dont le numéro
+est > 0 sont compressées.
+La version 0 n'est pas compressée car le
+.I fichier
+est peut-être utilisé par un programme.
+L'argument
+.I cycle
+indique le nombre de versions à conserver.
+
+Si le fichier n'existe pas et que l'option
+.B \-t
+est utilisée, le fichier est créé.
+
+Les actions suivantes sont effectuées pour les fichiers existants, dont la taille
+est supérieure à zéro\ :
+
+.IP 1)
+La version change, le fichier de version
+.IR cycle \-2
+est renommé version
+.IR cycle "\-3,"
+la version
+.IR cycle \-1
+est renommée version
+.IR cycle "\-2 ,"
+et ainsi de suite. Finalement, la version 0 est renommée version 1 et la
+version
+.I cycle
+est supprimée. Même en spécifiant l'option
+.BR \-l ,
+les fichiers compressés et non
+compressés sont renommés.
+Les versions manquantes sont ignorées.
+
+.IP 2)
+Le nouveau
+.I fichier.1
+est compressé sauf si l'option
+.B \-l
+est utilisée. Il est modifié en tenant compte des arguments des options
+.BR "\-m" ", " "\-u" ", et " "\-g" .
+.
+
+.IP 3)
+Le fichier principal est renommé
+.IR fichier.0 .
+
+.IP 4)
+Si les options
+.BR "\-m" ", " "\-u" ", " "\-g" ", " "\-t" ", ou " "\-p"
+sont utilisées, alors un
+.I fichier
+vide est créé en tenant compte des arguments de ces options.
+En utilisant l'option
+.B \-p
+, le fichier est créé avec le même utilisateur, groupe et permissions que
+l'ancien fichier.
+
+.IP 5)
+Le nouveau
+.I fichier.0
+est modifié en fonction des arguments des options
+.BR "-m" ", " "-u" ", et " "-g" .
+
+Comme le numéro de version commence à 0,
+.I cycle
+n'est jamais atteint. La valeur de
+.I cycle
+doit être supérieure ou égale à 2.
+
+.SH OPTIONS
+.TP
+.B "\-m mode"
+Modifie les autorisations d'accès des fichiers journaux (chmod mode).
+.TP
+.B "\-u utilisateur"
+Attribue les fichiers journaux à utilisateur (chown utilisateur).
+.TP
+.B "\-g groupe"
+Attribue les fichiers journaux au groupe groupe (chgrp groupe).
+.TP
+.B "\-c cycle"
+Sauvegarde cycle versions du fichier journal (7 par défaut).
+.TP
+.B \-t
+Si nécessaire, crée le fichier journal.
+.TP
+.B \-l
+Ne compresse pas les fichiers journaux (par défaut, les fichiers sont
+compressés).
+.TP
+.B \-p
+Conserve le propriétaire, le groupe et les permissions du fichier journal.
+.TP
+.B \-j
+Compresse avec bzip2 au lieu de gzip.
+.TP
+.B \-C
+Force la suppression des sauvegardes.
+.TP
+.B \-d
+Utilise la date (YYMMDDhhmmss) au lieu du numéro de version.
+.TP
+.B \-r
+Sauvegarde les fichiers journaux dans le répertoire
+.I répertoire
+au lieu de .
+.TP
+.B \-n
+Ne sauvegarde pas les fichiers vides.
+.TP
+.B \-q
+N'affiche pas de message.
+
+.SH BOGUES
+Si un programme est en train d'écrire
+.IR "fichier.0" ","
+et que savelog le renomme
+.I fichier.1
+et le compresse, des données peuvent être perdues.
+.SH TRADUCTION
+Antoine Gémis <agemis@netuup.com>.
diff --git a/fr/which.1 b/fr/which.1
new file mode 100644
index 0000000..bccddaa
--- /dev/null
+++ b/fr/which.1
@@ -0,0 +1,19 @@
+.\" -*- nroff -*-
+.TH WHICH 1 "02 jan 2003" "Debian"
+.SH NOM
+which \- localise une commande
+.SH SYNOPSIS
+.B which [\-a] nom de fichier ...
+.SH DESCRIPTION
+.B which
+retourne le chemin des fichiers qui seraient exécutés dans l'environnement
+courant. Ses arguments lui sont donnés sous la forme de commandes shell strictement
+conformes POSIX. Pour ce faire, which cherche dans la variable PATH les fichiers exécutables
+correspondants aux noms des arguments.
+.SH OPTIONS
+.TP
+.B \-a
+affiche tous les chemins correspondants à chaque argument
+.SH TRADUCTION
+Laëtitia Groslong <lgr@tartine.org>
+
diff --git a/installkernel b/installkernel
new file mode 100644
index 0000000..f9f2a7f
--- /dev/null
+++ b/installkernel
@@ -0,0 +1,60 @@
+#!/bin/sh
+#
+# Copyright (C) 1995 - 1998, Ian A. Murdock <imurdock@debian.org>
+#
+# Install the kernel on a Debian Linux system.
+#
+# This script is called from /usr/src/linux/arch/i386/boot/install.sh.
+# If you install it as /sbin/installkernel, you can do a "make install"
+# from a generic kernel source tree, and the image will be installed to
+# the proper place for Debian GNU/Linux.
+
+set -e
+
+if [ $# -eq 3 ] || [ $# -eq 4 ] ; then
+ img="$2"
+ map="$3"
+ ver="$1"
+ if [ $# -eq 4 ] && [ -n "$4" ] ; then
+ dir="$4"
+ else
+ dir="/boot"
+ fi
+else
+ echo "Usage: installkernel <version> <zImage> <System.map> <directory>"
+ exit 1
+fi
+
+updatever () {
+ if [ -f "$dir/$1-$ver" ] ; then
+ mv "$dir/$1-$ver" "$dir/$1-$ver.old"
+ fi
+
+ cat "$2" > "$dir/$1-$ver"
+
+ if test -f "$dir/$1" ; then
+ if test -L "$dir/$1" &&
+ [ "$(readlink -f ${dir}/${1})" = "${dir}/${1}-${ver}" ]; then
+ ln -sf "$1-$ver.old" "$dir/$1.old"
+ else
+ mv "$dir/$1" "$dir/$1.old"
+ fi
+ fi
+
+ ln -sf "$1-$ver" "$dir/$1"
+}
+
+if [ "$img" = "vmlinux" ] ; then
+ updatever vmlinux "$img"
+else
+ updatever vmlinuz "$img"
+fi
+updatever System.map "$map"
+
+config=$(dirname "$map")
+config="${config}/.config"
+if [ -f "$config" ] ; then
+ updatever config "$config"
+fi
+
+mkboot -i ${dir}/${img}-${ver}
diff --git a/installkernel.8 b/installkernel.8
new file mode 100644
index 0000000..e635a97
--- /dev/null
+++ b/installkernel.8
@@ -0,0 +1,38 @@
+.TH INSTALLKERNEL 8 "7 Jan 2001" "Debian Linux"
+.SH NAME
+installkernel \- install a new kernel image
+.SH SYNOPSYS
+.BI "installkernel " "version zImage System.map [directory]"
+.SH DESCRIPTION
+.PP
+.B installkernel
+installs a new kernel image onto the system from the Linux source
+tree. It is called by the Linux kernel makefiles when
+.B make install
+is invoked there.
+.P
+The new kernel is installed into
+.IR {directory}/vmlinuz-{version} ,
+a link is made from
+.I {directory}/vmlinuz
+to the new kernel, and the previously installed kernel is available as
+.IR {directory}/vmlinuz.old .
+If you use LILO,
+.I /etc/lilo.conf
+should contain entries for the images
+.IR {directory}/vmlinuz " and " {directory}/vmlinuz.old .
+.RI ( {version}
+is the new kernel's version.)
+.P
+.B installkernel
+calls
+.B mkboot -i
+to make the system bootable after the kernel is installed.
+.SH BUGS
+installkernel resides in /sbin only because the Linux kernel makefiles
+call it from there. It should really be in /usr/sbin. It isn't
+needed to boot a system, and it calls
+.BR mkboot ,
+which depends on the /usr partition being mounted.
+.SH "SEE ALSO"
+mkboot(8), lilo(8), lilo.conf(5)
diff --git a/mkboot b/mkboot
new file mode 100644
index 0000000..f36549d
--- /dev/null
+++ b/mkboot
@@ -0,0 +1,395 @@
+#!/bin/sh
+# mkboot: make the system bootable
+# Debian GNU/Linux
+# Copyright 1996-1997 Guy Maor <maor@debian.org>
+# This is free software; see the GNU General Public License version 2
+# or later for copying conditions. There is NO warranty.
+
+set -e
+
+PATH=$PATH:/sbin:/usr/sbin
+
+# basic devfsd support
+if [ -e /dev/.devfsd ]; then
+ FLOPPY=/dev/floppy/0
+else
+ FLOPPY=/dev/fd0
+fi
+
+# root partition
+which rdev >/dev/null && rootpart=$(rdev | cut -d ' ' -f 1)
+# temporary directory
+tmpdir=${TMPDIR-/tmp}
+
+# check whether ELILO is installed
+elilocheck() {
+ printf "\nChecking for ELILO..."
+ if [ -f /etc/elilo.conf ] && [ -x /usr/sbin/elilo ]; then
+ echo "Yes"
+ return 0
+ fi
+ echo "No"
+ return 1
+}
+
+# check whether SILO is installed
+silocheck() {
+ printf "\nChecking for SILO..."
+ if [ -f /etc/silo.conf ] && [ -x /sbin/silo ]; then
+ echo "Yes"
+ return 0
+ fi
+ echo "No"
+ return 1
+}
+
+# check whether GRUB is installed
+grubcheck () {
+ if ! which grub >/dev/null; then return 1; fi
+}
+
+# check whether LILO is installed
+lilocheck () {
+ printf "\nChecking for LILO..."
+ if [ $(whoami) != root ] ; then
+ echo "Only root can check for LILO"
+ return 1;
+ fi
+ if [ ! -f /etc/lilo.conf ] || [ ! -x /sbin/lilo ] ; then
+ echo "No"
+ return 1;
+ fi
+ bootpart=$(perl -ne 'print $1 if /^\s*boot\s*=\s*(\S*)/' /etc/lilo.conf)
+ if [ -z "$bootpart" ] ; then
+ # lilo defaults to current root when 'boot=' is not present
+ bootpart=$rootpart
+ fi
+ if [ ${bootpart#/dev/md} != $bootpart ] ||
+ [ ${bootpart#/dev/evms/md} != $bootpart ]; then
+ echo " - on software RAID device $bootpart - assuming LILO is installed and working."
+ return 0;
+ fi
+ if ! dd if=$bootpart ibs=16 count=1 2>&- | grep -q LILO ; then
+ printf "\nYes, but I couldn't find a LILO signature on $bootpart\n"
+ echo "Check your /etc/lilo.conf, or run /sbin/lilo by hand."
+ return 1;
+ fi
+ echo "Yes, on $bootpart"
+ return 0;
+}
+
+# check whether PALO is installed
+palocheck() {
+ printf "\nChecking for PALO..."
+ if [ -f /etc/palo.conf ] && [ -x /sbin/palo ]; then
+ echo "Yes"
+ return 0
+ fi
+ echo "No"
+ return 1
+}
+
+# make a lilo boot disk
+makelilo () {
+(
+ b=$tmpdir/boot$$
+ trap "set +e; cd /; umount $FLOPPY; rmdir $b" EXIT
+ mkdir $b
+ mke2fs -q $FLOPPY
+ mount -t ext2 $FLOPPY $b
+ if [ -e /boot/boot.b ]; then
+ cp /boot/boot.b $b/boot.b
+ fi
+ cp $1 $b/vmlinuz
+ # if a symbolic link, look for the real file
+ kfile=`readlink -f $1`
+ # see if we need an "initrd=" line in lilo.conf
+ kdir=`dirname $kfile`
+ if [ $kdir = . ]; then kdir=$PWD # full path
+ elif [ $kdir = boot ]; then kdir=/boot; kfile="/$kfile"; fi
+ # make sure directory exists
+ if [ -d $kdir ]; then
+ # extract version
+ case $kfile in
+ *-*) kvers=${kfile#*-} ;;
+ *) kvers="" ;;
+ esac
+ # look for matching initrd.img
+ if [ "$kvers" = "" ]; then ifile="$kdir"/initrd.img
+ else ifile="$kdir"/initrd.img-$kvers ; fi
+ #
+ if [ ! -f $ifile ]; then ifile=""; fi
+ else
+ kdir="" ; ifile=""
+ fi
+ # kfile is now the full path to the kernel image, and
+ # ifile is now the initrd.img that matches the kernel, or null
+ #
+ echo "Kernel is at $kfile in $kdir"
+ if [ "$ifile" != "" ]; then echo "Matching initrd image is $ifile";fi
+ #
+ lilo_conf="# floppy lilo.conf
+ boot = $FLOPPY
+ install = boot.b
+ map = map"
+ state=G
+ usesinitrd=n
+ # examine /etc/lilo.conf
+ while read line
+ do
+ case $line in
+ "#"* | "" ) continue ;; # skip comments and blank lines
+ *boot*=* | *root*=* | *install*=* ) continue ;;
+ *map*=* | *message*=* ) continue # skip these files as well
+ ;;
+ *image*=* ) if [ $state = L ]; then
+ break
+ fi # done
+ #
+ case $line in
+ *$1 ) kimg=`echo ${line#*=}`
+ state=L # found correct kernel
+ ;;
+ *linu*) kimg=`echo ${line#*=}`
+ # see if this is the right Linux kernel
+ if [ `ls -l $kimg |
+ awk '{print $NF}'` = $kfile ]; then
+ state=L # found right kernel
+ else
+ state=I # Ignore wrong kernel
+ fi
+ ;;
+ * ) state=I # Ignore this stanza
+ ;;
+ esac
+ #
+ if [ $state = L ]; then
+ lilo_conf="$lilo_conf
+ # kernel-specific:
+ $line"
+ fi
+ ;;
+ *other*=* ) state=I # ignore non-Linux stanza
+ ;;
+ * ) if [ $state != I ]; then
+ lilo_conf=`printf "$lilo_conf\n$line\n"`
+ fi
+ #
+ case $line in
+ *initrd*=* ) lcinitrd=`ls -l ${line#*=} |
+ awk '{print $NF}'`
+ if [ $lcinitrd = "$ifile" ]; then
+ usesinitrd=y
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ done < /etc/lilo.conf
+ #
+ lilo_conf=`printf "$lilo_conf\nroot = $rootpart\n"`
+ #
+ if [ $state = L ]; then
+ echo "Found kernel image $kimg in existing /etc/lilo.conf"
+ if [ "$liloOK" != n ] && [ $usesinitrd = y ] && [ "$ifile" != "" ]; then
+ echo " and the correct initrd.img as well."
+ problems=n
+ elif [ "$liloOK" != n ] && [ $usesinitrd = n ] && [ "$ifile" = "" ]; then
+ problems=n # no initrd needed
+ elif [ "$liloOK" != n ] && [ $usesinitrd = n ] && [ "$ifile" != "" ]; then
+ echo " but it does not invoke $ifile ."
+ problems=y
+ elif [ "$liloOK" = n ] && [ $usesinitrd = y ]; then
+ echo " and the correct initrd.img as well,"
+ echo " but there were problems in installing from it."
+ problems=y
+ else
+ echo "but it does not mention the required initrd.img ."
+ problems=y
+ fi
+ else
+ echo "Could not find the requested kernel in your"
+ echo " current /etc/lilo.conf ."
+ problems=y
+ fi
+ #
+ if [ $problems = n ]; then
+ echo "Your current /etc/lilo.conf looks good, and can be used"
+ echo " as the basis for the boot-floppy lilo.conf."
+ else
+ echo "The mkboot script can probably do better."
+ fi
+ sleep 8
+ #
+ echo
+ echo "Here is the proposed lilo.conf:"
+ echo
+ echo "$lilo_conf"
+ echo
+ echo "You can install the boot-loader from this best guess,"
+ echo "or you can try to install from a \`vanilla\' lilo.conf ."
+ echo
+ reply=""
+ while [ "$reply" = "" ]
+ do
+ printf "Which do you choose? (Enter B for best, V for vanilla): "
+ read reply
+ done
+ #
+ if [ $reply = B ] || [ $reply = b ]; then
+ echo "Installing the best-guess lilo.conf..."
+ cd $b
+ echo "$lilo_conf" > lilo.conf
+ else
+ echo "Installing the vanilla lilo.conf..."
+ cd $b
+ cat > lilo.conf <<- EOF
+ lba32
+ boot = $FLOPPY
+ install = boot.b
+ map = map
+ compact
+ prompt
+ timeout = 50
+ read-only
+ image = vmlinuz
+ label = linux
+ root = $rootpart
+ EOF
+ fi
+ #
+ lilo -C lilo.conf
+ cat <<EOF
+If you need to modify the floppy's lilo.conf, run the following:
+
+ mount $FLOPPY /mnt
+ cd /mnt
+ vi lilo.conf # edit the file
+ lilo -C lilo.conf # run lilo on floppy
+ cd
+ umount $FLOPPY
+EOF
+)
+}
+
+
+# make a simple boot disk
+makesimple () {
+(
+ dd if=$1 of=$FLOPPY
+ rdev $FLOPPY $rootpart
+ rdev -R $FLOPPY 1
+)
+}
+
+
+
+# make a boot disk
+makedisk () {
+ kernel=${1:-/vmlinuz}
+ if [ ! -r $kernel ] ; then
+ echo "Error: Can't read $kernel."
+ exit 1
+ fi
+
+ boottype="lilo"
+ if [ $(whoami) != root ] ; then
+ echo "Since you don't have root permissions, I can't put LILO on the diskette."
+ echo "I will make a non-LILO diskette instead, but it won't be as useful. You"
+ echo "can hit <Ctrl-C> to cancel."
+ boottype="simple"
+ fi
+
+ printf "\nInsert a floppy diskette into your boot drive, and press <Return>. "
+ read input
+ diskok=0
+ while [ "$diskok" != 1 ] ; do
+ printf "\nCreating a $boottype bootdisk...\n"
+ make$boottype $kernel
+ if [ $? -eq 0 ] ; then
+ diskok=1
+ else
+ printf "\nThere was a problem creating the boot diskette. Please make sure that\n"
+ echo "you inserted the diskette into the correct drive and that the diskette"
+ echo "is not write-protected."
+ printf "\nWould you like to try again? (y/n) "
+ read input
+ if [ "$input" != "y" ] ; then
+ return 1
+ fi
+ fi
+ done
+ echo "...Success."
+ return 0
+}
+
+usage="$0 [-r rootpartition] [-i] [-d device] [kernel]"
+
+while getopts "r:id:h-" opt ; do
+ case "$opt" in
+ r) rootpart="$OPTARG" ;;
+ i) installkernel=1 ;;
+ d) FLOPPY="$OPTARG" ;;
+ h) echo $usage ; exit 0 ;;
+ -) break ;;
+ *) echo $usage 1>&2 ; exit 1 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "$installkernel" ] ; then
+ echo "In order to use the new kernel image you have just installed, you"
+ echo "will need to reboot the machine. First, however, you will need to"
+ echo "either make a bootable floppy diskette, re-run LILO, or have GRUB"
+ echo "installed."
+
+ if elilocheck; then
+ printf "\nShould I run /usr/sbin/elilo? (y/N) "
+ read input
+ if [ "$input" = "y" ] ; then
+ /usr/sbin/elilo && exit 0
+ echo "There was a problem running /usr/sbin/elilo."
+ fi
+ fi
+
+ if grubcheck; then
+ printf "\nGRUB is installed. To automatically switch to new kernels, point your\n"
+ echo "default entry in menu.lst to $1"
+ exit 0
+ fi
+
+ if lilocheck; then
+ liloOK=y
+ printf "\nShould I run /sbin/lilo? (y/N) "
+ read input
+ if [ "$input" = "y" ] ; then
+ /sbin/lilo && exit 0
+ echo "There was a problem running /sbin/lilo."
+ liloOK=n
+ fi
+ fi
+
+ if silocheck; then
+ printf "\nSILO is installed. To automatically switch to new kernels, point your\n"
+ echo "default entry in silo.conf to $1"
+ exit 0
+ fi
+
+ if palocheck; then
+ printf "\nPALO is installed. To automatically switch to new kernels, point your\n"
+ echo "default entry in palo.conf to $1"
+ exit 0
+ fi
+
+ printf "\nShould I make a bootdisk? (y/N) "
+ read input
+ if [ "$input" = "y" ] ; then
+ makedisk $1 && exit 0
+ fi
+
+ printf "\nWARNING: Your system is probably unbootable now. After correcting any\n"
+ echo "problems, rerun this script with the command \`mkboot -installkernel'."
+ exit 1
+fi
+
+makedisk $1
diff --git a/mkboot.8 b/mkboot.8
new file mode 100644
index 0000000..98a6724
--- /dev/null
+++ b/mkboot.8
@@ -0,0 +1,41 @@
+.TH MKBOOT 8 "18 September 2004" "Debian"
+.SH NAME
+mkboot \- makes a bootdisk
+.SH SYNOPSIS
+.B "mkboot [\-r rootpartition] [\-i] [\-d device] [kernel]"
+.SH DESCRIPTION
+.PP
+.B mkboot
+makes a bootdisk.
+.P
+By default the bootdisk will use the kernel
+.I /vmlinuz
+and the current root partition. Use the
+.B \-r
+option to specify a different parition, and provide the new kernel
+file directly to specify a different kernel. Use the
+.B \-d
+option to specify a different device for the floppy drive.
+.P
+If invoked with the
+.B \-i
+option, it tries to make a Debian GNU/Linux system bootable after a new
+kernel was installed by
+.BR "/sbin/installkernel" "."
+If ELILO is installed, it runs
+.BR "/usr/sbin/elilo" "."
+If GRUB is installed, it does nothing. If LILO is in use, it runs
+.BR "/sbin/lilo" "."
+If SILO is installed, it does nothing.
+Otherwise,
+.B mkboot
+will make a new bootdisk.
+.SH "BUGS"
+.P
+mkboot only works on i386 and ia64. mkboot only works
+on floppy diskette drives. If rdev is not present, mkboot will fail to
+determine the correct root partition.
+Patches to correct these deficiencies are welcome.
+.P
+.SH "SEE ALSO"
+installkernel(8), lilo(8), grub(8), silo(8)
diff --git a/mktemp.1 b/mktemp.1
new file mode 100644
index 0000000..c1a610b
--- /dev/null
+++ b/mktemp.1
@@ -0,0 +1,235 @@
+.\" $Id: mktemp.man,v 1.9 2001/11/12 19:47:06 millert Exp $
+.\"
+.\" Copyright (c) 1996, 2000, 2001 Todd C. Miller <Todd.Miller@courtesan.com>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.TH MKTEMP 1 "17 October 2004"
+.SH NAME
+\fBmktemp\fP \- make temporary filename (unique)
+.SH SYNOPSIS
+\fBmktemp\fP [\fB\-V\fP] | [\fB\-dqtu\fP] [\fB\-p\fP \fIdirectory\fP] [\fItemplate\fP]
+.SH DESCRIPTION
+The
+.B mktemp
+utility takes the given filename
+.I template
+and overwrites a portion of it to create a unique filename.
+The
+.I template
+may be any filename with six (6)
+`Xs' appended to it, for example
+.I /tmp/tfile.XXXXXX.
+If no
+.I template
+is specified a default of
+.I tmp.XXXXXX
+is used and the
+.B \-t
+flag is implied (see below).
+.PP
+The trailing `Xs' are replaced with a combination
+of the current process number and random letters.
+.PP
+If
+.B mktemp
+can successfully generate a unique filename, the file (or directory)
+is created with file permissions such that it is only readable and writable
+by its owner (unless the
+.B \-u
+flag is given) and the filename is printed to standard output.
+.PP
+.B mktemp
+is provided to allow shell scripts to safely use temporary
+files. Traditionally, many shell scripts take the name of the program with
+the PID as a suffix and use that as a temporary filename.
+This kind of naming scheme is predictable and the race condition it creates
+is easy for an attacker to win.
+A safer, though still inferior approach
+is to make a temporary directory using the same naming scheme.
+While this does allow one to guarantee that a temporary file will not be
+subverted, it still allows a simple denial of service attack.
+For these reasons it is suggested that
+.B mktemp
+be used instead.
+.PP
+The options are as follows:
+.TP
+.B \-V
+Print the version and exit.
+.TP
+.B \-d
+Make a directory instead of a file.
+.TP
+.BI "\-p " directory
+Use the specified
+.I directory
+as a prefix when generating the temporary filename.
+The
+.I directory
+will be overridden by the user's
+.SM TMPDIR
+environment variable if it is set.
+This option implies the
+.B \-t
+flag (see below).
+.TP
+.B \-q
+Fail silently if an error occurs.
+This is useful if
+a script does not want error output to go to standard error.
+.TP
+.B \-t
+Generate a path rooted in a temporary directory.
+This directory is chosen as follows:
+.RS
+.IP \(bu
+If the user's
+.SM TMPDIR
+environment variable is set, the directory contained therein is used.
+.IP \(bu
+Otherwise, if the
+.B \-p
+flag was given the specified directory is used.
+.IP \(bu
+If none of the above apply,
+.I /tmp
+is used.
+.RE
+.PP
+In this mode, the
+.I template
+(if specified) should be a directory component (as opposed to a full path)
+and thus should not contain any forward slashes.
+.TP
+.B \-u
+Operate in ``unsafe'' mode.
+The temp file will be unlinked before
+.B mktemp
+exits. This is slightly better than mktemp(3)
+but still introduces a race condition. Use of this
+option is not encouraged.
+.PP
+The
+.B mktemp
+utility
+exits with a value of 0 on success or 1 on failure.
+.SH EXAMPLES
+The following sh(1)
+fragment illustrates a simple use of
+.B mktemp
+where the script should quit if it cannot get a safe
+temporary file.
+.RS
+.nf
+
+TMPFILE=`mktemp /tmp/example.XXXXXX` || exit 1
+echo "program output" >> $TMPFILE
+
+.fi
+.RE
+The same fragment with support for a user's
+.SM TMPDIR
+environment variable can be written as follows.
+.RS
+.nf
+
+TMPFILE=`mktemp \-t example.XXXXXX` || exit 1
+echo "program output" >> $TMPFILE
+
+.fi
+.RE
+This can be further simplified if we don't care about the actual name of
+the temporary file. In this case the
+.B \-t
+flag is implied.
+.RS
+.nf
+
+TMPFILE=`mktemp` || exit 1
+echo "program output" >> $TMPFILE
+
+.fi
+.RE
+In some cases, it may be desirable to use a default temporary directory
+other than
+.I /tmp.
+In this example the temporary file will be created in
+.I /extra/tmp
+unless the user's
+.SM TMPDIR
+environment variable specifies otherwise.
+.RS
+.nf
+
+TMPFILE=`mktemp \-p /extra/tmp example.XXXXXX` || exit 1
+echo "program output" >> $TMPFILE
+
+.fi
+.RE
+In some cases, we want the script to catch the error.
+For instance, if we attempt to create two temporary files and
+the second one fails we need to remove the first before exiting.
+.RS
+.nf
+
+TMP1=`mktemp \-t example.1.XXXXXX` || exit 1
+TMP2=`mktemp \-t example.2.XXXXXX`
+if [ $? \-ne 0 ]; then
+ rm \-f $TMP1
+ exit 1
+fi
+
+.fi
+.RE
+Or perhaps you don't want to exit if
+.B mktemp
+is unable to create the file.
+In this case you can protect that part of the script thusly.
+.RS
+.nf
+
+TMPFILE=`mktemp \-t example.XXXXXX` && {
+ # Safe to use $TMPFILE in this block
+ echo data > $TMPFILE
+ ...
+ rm \-f $TMPFILE
+}
+
+.fi
+.RE
+.SH ENVIRONMENT
+.IP TMPDIR 8
+directory in which to place the temporary file when in
+.B \-t
+mode
+.SH SEE ALSO
+.BR mkdtemp (3),
+.BR mkstemp (3),
+.BR mktemp (3),
+.BR tempfile (1)
+.SH HISTORY
+The
+.B mktemp
+utility appeared in OpenBSD 2.1.
diff --git a/mktemp.c b/mktemp.c
new file mode 100644
index 0000000..e10c431
--- /dev/null
+++ b/mktemp.c
@@ -0,0 +1,197 @@
+/* $OpenBSD: mktemp.c,v 1.6 2001/10/01 17:08:30 millert Exp $ */
+
+/*
+ * Copyright (c) 1996, 2000, 2001 Todd C. Miller <Todd.Miller@courtesan.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* #include "config.h" */
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif /* HAVE_STDLIB_H */
+#ifdef HAVE_STRING_H
+# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
+# include <memory.h>
+# endif
+# include <string.h>
+#else
+# ifdef HAVE_STRINGS_H
+# include <strings.h>
+# endif /* HAVE_STRINGS_H */
+#endif /* HAVE_STRING_H */
+#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
+#include <malloc.h>
+#endif /* HAVE_MALLOC_H && !STDC_HEADERS */
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif /* HAVE_PATHS_H */
+#include <errno.h>
+
+#ifndef _PATH_TMP
+#define _PATH_TMP "/tmp"
+#endif
+
+#ifdef HAVE_PROGNAME
+extern char *__progname;
+#else
+char *__progname;
+#endif
+
+void usage __P((void)) __attribute__((__noreturn__));
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ int ch, fd, uflag = 0, quiet = 0, tflag = 0, makedir = 0;
+ char *cp, *template, *tempfile, *prefix = _PATH_TMP;
+ size_t plen;
+ extern char *optarg;
+ extern int optind;
+
+#ifndef HAVE_PROGNAME
+ __progname = argv[0];
+#endif
+
+ while ((ch = getopt(argc, argv, "dp:qtuV")) != -1)
+ switch(ch) {
+ case 'd':
+ makedir = 1;
+ break;
+ case 'p':
+ prefix = optarg;
+ tflag = 1;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 't':
+ tflag = 1;
+ break;
+ case 'u':
+ uflag = 1;
+ break;
+ case 'V':
+ printf("%s version debianutils-%s\n", __progname, PACKAGE_VERSION);
+ exit(0);
+ default:
+ usage();
+ }
+
+ /* If no template specified use a default one (implies -t mode) */
+ switch (argc - optind) {
+ case 1:
+ template = argv[optind];
+ break;
+ case 0:
+ template = "tmp.XXXXXX";
+ tflag = 1;
+ break;
+ default:
+ usage();
+ }
+
+ if (tflag) {
+ if (strchr(template, '/')) {
+ if (!quiet)
+ (void)fprintf(stderr,
+ "%s: template must not contain directory separators in -t mode\n", __progname);
+ exit(1);
+ }
+
+ cp = getenv("TMPDIR");
+ if (cp != NULL && *cp != '\0')
+ prefix = cp;
+ plen = strlen(prefix);
+ while (plen != 0 && prefix[plen - 1] == '/')
+ plen--;
+
+ tempfile = (char *)malloc(plen + 1 + strlen(template) + 1);
+ if (tempfile == NULL) {
+ if (!quiet)
+ (void)fprintf(stderr,
+ "%s: cannot allocate memory\n", __progname);
+ exit(1);
+ }
+ (void)memcpy(tempfile, prefix, plen);
+ tempfile[plen] = '/';
+ (void)strcpy(tempfile + plen + 1, template); /* SAFE */
+ } else {
+ if ((tempfile = strdup(template)) == NULL) {
+ if (!quiet)
+ (void)fprintf(stderr,
+ "%s: cannot allocate memory\n", __progname);
+ exit(1);
+ }
+ }
+
+ if (makedir) {
+ if (mkdtemp(tempfile) == NULL) {
+ if (!quiet) {
+ (void)fprintf(stderr,
+ "%s: cannot make temp dir %s: %s\n",
+ __progname, tempfile, strerror(errno));
+ }
+ exit(1);
+ }
+
+ if (uflag)
+ (void)rmdir(tempfile);
+ } else {
+ if ((fd = mkstemp(tempfile)) < 0) {
+ if (!quiet) {
+ (void)fprintf(stderr,
+ "%s: cannot create temp file %s: %s\n",
+ __progname, tempfile, strerror(errno));
+ }
+ exit(1);
+ }
+ (void)close(fd);
+
+ if (uflag)
+ (void)unlink(tempfile);
+ }
+
+ (void)puts(tempfile);
+ free(tempfile);
+
+ exit(0);
+}
+
+void
+usage()
+{
+
+ (void)fprintf(stderr,
+ "Usage: %s [-V] | [-dqtu] [-p prefix] [template]\n",
+ __progname);
+ exit(1);
+}
diff --git a/readlink.1 b/readlink.1
new file mode 100644
index 0000000..1cd8c23
--- /dev/null
+++ b/readlink.1
@@ -0,0 +1,84 @@
+.\" $OpenBSD: readlink.1,v 1.4 1998/09/27 16:57:50 aaron Exp $
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd November 19, 2002
+.Dt READLINK 1
+.Os
+.Sh NAME
+.Nm readlink
+.Nd display target of symbolic link on standard output
+.Sh SYNOPSIS
+.Nm readlink
+.Op Fl fn
+.Ar file
+.Op ...
+.Sh DESCRIPTION
+The
+.Nm readlink
+utility when invoked with the pathname of a symbolic link as its
+argument dereferences the symbolic link and prints the name of target
+on standard output. When more then one pathname is given,
+.Nm readlink
+prints those symbolic links which have been found for the given pathnames.
+If readlink is invoked with an argument other than the pathname of a
+symbolic link, it exits with a non-zero exit code without printing anything.
+.Pp
+The following options are available:
+.Bl -tag -width flag
+.It Fl f
+Using realpath(3), canonicalize by following every symlink in every
+component of the given path recursively. Note that the resultant
+pathname might not exist,
+.It Fl n
+Do not print a trailing newline character.
+.El
+.Pp
+The
+.Nm readlink
+utility exits 0 on success or >0 if an error occurred.
+.Sh NOTE
+Debian packages using
+.Nm readlink
+in maintainer scripts must depend on debianutils >= 1.13.1. Multiple
+pathnames have been supported since version 1.23.
+.Sh SEE ALSO
+.Xr readlink 2
+.Xr realpath 3
+.Sh HISTORY
+The
+.Nm readlink
+utility first appeared in
+.Bx Open .
diff --git a/readlink.c b/readlink.c
new file mode 100644
index 0000000..5f69ae2
--- /dev/null
+++ b/readlink.c
@@ -0,0 +1,94 @@
+/*
+ * $OpenBSD: readlink.c,v 1.18 1998/08/24 14:45:33 kstailey Exp $
+ *
+ * Copyright (c) 1997
+ * Kenneth Stailey (hereinafter referred to as the author)
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <limits.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+int
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ char buf[PATH_MAX];
+ int n, ch, nflag = 0, fflag = 0, i, found = 0;
+ extern int optind;
+
+ while ((ch = getopt(argc, argv, "fn")) != -1)
+ switch (ch) {
+ case 'f':
+ fflag = 1;
+ break;
+ case 'n':
+ nflag = 1;
+ break;
+ default:
+ (void)fprintf(stderr,
+ "usage: readlink [-n] [-f] symlink [...]\n");
+ exit(1);
+ }
+ argc -= optind;
+ argv += optind;
+
+ if (argc < 1) {
+ fprintf(stderr, "usage: readlink [-n] [-f] symlink\n");
+ exit(1);
+ }
+
+ for (i = 0; i < argc; i++) {
+ n = strlen(argv[i]);
+ if (n > PATH_MAX - 1) {
+ fprintf(stderr, "readlink: filename longer than PATH_MAX-1 (%d)\n", PATH_MAX - 1);
+ exit(1);
+ }
+
+ if (fflag)
+ realpath(argv[i], buf);
+ else {
+ if ((n = readlink(argv[i], buf, sizeof buf-1)) < 0)
+ continue;
+ buf[n] = '\0';
+ }
+
+ printf("%s", buf);
+ found = 1;
+ if ((argc > 1 && i < argc-1) || !nflag)
+ putchar('\n');
+ }
+ if (found)
+ exit(0);
+ exit(1);
+}
diff --git a/run-parts.8 b/run-parts.8
new file mode 100644
index 0000000..8221146
--- /dev/null
+++ b/run-parts.8
@@ -0,0 +1,111 @@
+.\" Hey, Emacs! This is an -*- nroff -*- source file.
+.\" Build-from-directory and this manpage are Copyright 1994 by Ian Jackson.
+.\" Changes to this manpage are Copyright 1996 by Jeff Noxon.
+.\" More
+.\"
+.\" This is free software; see the GNU General Public Licence version 2
+.\" or later for copying conditions. There is NO warranty.
+.TH RUN\-PARTS 8 "9 May 2004" "Debian"
+.SH NAME
+run\-parts \- run scripts or programs in a directory
+.SH SYNOPSIS
+.PP
+.B run\-parts
+[\-\-test] [\-\-verbose] [\-\-report] [\-\-lsbsysinit] [\-\-umask=umask]
+[\-\-arg=argument] [\-\-exit\-on\-error] [\-\-help] [\-\-version]
+[\-\-list] [\-\-reverse] [\-\-] DIRECTORY
+.PP
+.B run\-parts
+\-V
+.SH DESCRIPTION
+.PP
+.B run\-parts
+runs all the executable files named within constraints described below, found
+in directory
+.IR directory .
+Other files and directories are silently ignored.
+
+If the \-\-lsbsysinit option is not given then the names must consist
+entirely of upper and lower case letters, digits, underscores, and
+hyphens.
+
+If the \-\-lsbsysinit option is given, then the names must not end
+in .dpkg\-old or .dpkg\-dist or .dpkg\-new or .dpkg\-tmp, and must
+belong to one or more of the following namespaces: the
+LANANA-assigned namespace (^[a\-z0\-9]+$); the LSB hierarchical and
+reserved namespaces (^_?([a\-z0\-9_.]+\-)+[a\-z0\-9]+$);
+and the Debian cron script namespace (^[a\-z0\-9][a\-z0\-9\-]*$).
+
+Files are run in the lexical sort order of their names unless the
+\-\-reverse option is given, in which case they are run in the
+opposite order.
+
+.SS OPTIONS
+.TP
+.B \-\-test
+print the names of the scripts which would be run, but don't actually run
+them.
+.TP
+.B \-\-list
+print the names of the all matching files (not limited to executables),
+but don't actually run them. This option cannot be used with --test.
+.TP
+.B \-v, \-\-verbose
+print the name of each script to stderr before running.
+.TP
+.B \-\-report
+similar to
+.BR \-\-verbose ,
+but only prints the name of scripts which produce output. The script's name is printed to whichever of stdout or stderr the script first produces output on.
+.TP
+.B \-\-reverse
+reverse the scripts' execution order.
+.B
+.TP
+.B \-\-exit\-on\-error
+exit as soon as a script returns with a non-zero exit code.
+.TP
+.B \-\-lsbsysinit
+Use LSB namespaces instead of classical behavior.
+.TP
+.BI "\-u, \-\-umask=" umask
+Sets the umask to
+.I umask
+before running the scripts.
+.I umask
+should be specified in octal. By default the umask is set to 022.
+.TP
+.BI "\-a, \-\-arg=" argument
+Pass
+.I argument
+to the scripts. Use
+.B --arg
+once for each argument you want passed.
+.TP
+.B "\-\-"
+Specifies that this is the end of the options. Any filename after
+.B "\-\-"
+will be not be interpreted as an option even if it starts with a
+hyphen.
+.TP
+.B \-h, \-\-help
+Display usage information and exit.
+.TP
+.B \-V, \-\-version
+Display version and copyright and exit.
+
+.SH COPYRIGHT
+.P
+Copyright (C) 1994 Ian Jackson.
+.P
+Copyright (C) 1996 Jeff Noxon.
+.P
+Copyright (C) 1996, 1997, 1998 Guy Maor
+.P
+Copyright (C) 2002, 2003, 2004 Clint Adams
+
+.B run\-parts
+is free software; see the GNU General Public License version 2 or
+later for copying conditions. There is
+.I no
+warranty.
diff --git a/run-parts.c b/run-parts.c
new file mode 100644
index 0000000..b599046
--- /dev/null
+++ b/run-parts.c
@@ -0,0 +1,472 @@
+/* run-parts: run a bunch of scripts in a directory
+ *
+ * Debian run-parts program
+ * Copyright (C) 1996 Jeff Noxon <jeff@router.patch.net>,
+ * Copyright (C) 1996-1999 Guy Maor <maor@debian.org>
+ * Copyright (C) 2002, 2003, 2004, 2005 Clint Adams <schizo@debian.org>
+ *
+ * This is free software; see the GNU General Public License version 2
+ * or later for copying conditions. There is NO warranty.
+ *
+ * Based on run-parts.pl version 0.2, Copyright (C) 1994 Ian Jackson.
+ *
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <dirent.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/time.h>
+#include <regex.h>
+
+int test_mode = 0;
+int list_mode = 0;
+int verbose_mode = 0;
+int report_mode = 0;
+int reverse_mode = 0;
+int exitstatus = 0;
+int lsbsysinit_mode = 0;
+int exit_on_error_mode = 0;
+
+int argcount = 0, argsize = 0;
+char **args = 0;
+
+void error(char *format, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "run-parts: ");
+
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+
+ fprintf(stderr, "\n");
+}
+
+
+void version()
+{
+ fprintf(stderr, "Debian run-parts program, version " PACKAGE_VERSION
+ "\nCopyright (C) 1994 Ian Jackson, Copyright (C) 1996 Jeff Noxon.\n"
+ "Copyright (C) 1996,1997,1998,1999 Guy Maor\n"
+ "Copyright (C) 2002, 2003, 2004, 2005 Clint Adams\n"
+ "This is free software; see the GNU General Public License version 2\n"
+ "or later for copying conditions. There is NO warranty.\n");
+ exit(0);
+}
+
+
+void usage()
+{
+ fprintf(stderr, "Usage: run-parts [OPTION]... DIRECTORY\n"
+ " --test print script names which would run, but don't run them.\n"
+ " --list print names of all valid files (can not be used with\n"
+ " --test)\n"
+ " -v, --verbose print script names before running them.\n"
+ " --report print script names if they produce output.\n"
+ " --reverse reverse execution order of scripts.\n"
+ " --exit-on-error exit as soon as a script returns with a non-zero exit\n"
+ " code.\n"
+ " --lsbsysinit validate filenames based on LSB sysinit specs.\n"
+ " -u, --umask=UMASK sets umask to UMASK (octal), default is 022.\n"
+ " -a, --arg=ARGUMENT pass ARGUMENT to scripts, use once for each argument.\n"
+ " -V, --version output version information and exit.\n"
+ " -h, --help display this help and exit.\n");
+ exit(0);
+}
+
+
+/* The octal conversion in libc is not foolproof; it will take the 8 and 9
+ * digits under some circumstances. We'll just have to live with it.
+ */
+void set_umask()
+{
+ int mask, result;
+
+ result = sscanf(optarg, "%o", &mask);
+ if ((result != 1) || (mask > 07777) || (mask < 0)) {
+ error("bad umask value");
+ exit(1);
+ }
+
+ umask(mask);
+}
+
+/* Add an argument to the commands that we will call. Called once for
+ every argument. */
+void add_argument(char *newarg)
+{
+ if (argcount + 1 >= argsize) {
+ argsize = argsize ? argsize * 2 : 4;
+ args = realloc(args, argsize * (sizeof(char *)));
+ if (!args) {
+ error("failed to reallocate memory for arguments: %s", strerror(errno));
+ exit(1);
+ }
+ }
+ args[argcount++] = newarg;
+ args[argcount] = 0;
+}
+
+/* True or false? Is this a valid filename? */
+int valid_name(const struct dirent *d)
+{
+ char *c = d->d_name;
+ regex_t hierre, tradre, excsre, classicalre;
+
+ /* The regcomps should be moved to program init */
+
+ if (lsbsysinit_mode) {
+
+ if (regcomp
+ (&hierre, "^_?([a-z0-9_.]+-)+[a-z0-9]+$", REG_EXTENDED | REG_NOSUB)
+ || regcomp(&excsre, "^[a-z0-9-].*dpkg-(old|dist|new|tmp)$",
+ REG_EXTENDED | REG_NOSUB)
+ || regcomp(&tradre, "^[a-z0-9][a-z0-9-]*$", REG_NOSUB)) {
+ error("regex failure");
+ exit(1);
+ }
+
+ if (!regexec(&hierre, c, 0, NULL, 0))
+ return regexec(&excsre, c, 0, NULL, 0);
+
+ return !regexec(&tradre, c, 0, NULL, 0);
+ }
+ else {
+ if (regcomp(&classicalre, "^[a-zA-Z0-9_-]+$", REG_EXTENDED | REG_NOSUB)) {
+ error("regex failure");
+ exit(1);
+ }
+ return !regexec(&classicalre, c, 0, NULL, 0);
+ }
+
+}
+
+
+void set_fl(int fd, int flags)
+{
+ int val;
+ if ((val = fcntl(fd, F_GETFL, 0)) < 0) {
+ error("fcntl F_GETFL: %s", strerror(errno));
+ exit(1);
+ }
+ val |= flags;
+ if (fcntl(fd, F_SETFL, val) < 0) {
+ error("fcntl F_SETFL: %s", strerror(errno));
+ exit(1);
+ }
+}
+
+
+/* We have to abort the select() call in run_part when we receive a
+ * SIGCHLD signal. We can't simply ignore it, so we do nothing.
+ */
+
+/* itz Tue Nov 26 13:23:27 PST 2002 why "We have to abort?"
+ just leave the default and reap child at the end
+ */
+void catch_sigchld(int sig)
+{
+}
+
+
+/* Execute a file */
+void run_part(char *progname)
+{
+ int result;
+ int pid;
+ int pout[2], perr[2];
+
+ if (report_mode && (pipe(pout) || pipe(perr))) {
+ error("pipe: %s", strerror(errno));
+ exit(1);
+ }
+ if ((pid = fork()) < 0) {
+ error("failed to fork: %s", strerror(errno));
+ exit(1);
+ }
+ else if (!pid) {
+ setsid();
+ if (report_mode) {
+ if (dup2(pout[1], STDOUT_FILENO) == -1 ||
+ dup2(perr[1], STDERR_FILENO) == -1) {
+ error("dup2: %s", strerror(errno));
+ exit(1);
+ }
+ close(pout[0]);
+ close(perr[0]);
+ close(pout[1]);
+ close(perr[1]);
+ }
+ args[0] = progname;
+ execv(progname, args);
+ error("failed to exec %s: %s", progname, strerror(errno));
+ exit(1);
+ }
+
+ if (report_mode) {
+ fd_set set;
+ int max, r, printflag;
+ ssize_t c;
+ char buf[4096];
+
+ close(pout[1]);
+ close(perr[1]);
+ /* itz Tue Nov 26 13:26:09 PST 2002 why is this necessary? */
+ /* set_fl(pout[0], O_NONBLOCK); */
+ /* set_fl(perr[0], O_NONBLOCK); */
+ max = pout[0] > perr[0] ? pout[0] + 1 : perr[0] + 1;
+ printflag = 0;
+
+ while (pout[0] >= 0 || perr[0] >= 0) {
+
+ FD_ZERO(&set);
+ if (pout[0] >= 0)
+ FD_SET(pout[0], &set);
+ if (perr[0] >= 0)
+ FD_SET(perr[0], &set);
+ r = select(max, &set, 0, 0, 0);
+ while (r < 0 && errno == EINTR) {
+ FD_ZERO(&set);
+ if (pout[0] >= 0)
+ FD_SET(pout[0], &set);
+ if (perr[0] >= 0)
+ FD_SET(perr[0], &set);
+ r = select(max, &set, 0, 0, 0);
+ } /*while */
+
+ if (r < 0) {
+ /* assert(errno != EINTR) */
+ error("select: %s", strerror(errno));
+ exit(1);
+ }
+ else if (r > 0) {
+ if (pout[0] >= 0 && FD_ISSET(pout[0], &set)) {
+ c = read(pout[0], buf, sizeof(buf));
+ if (c > 0) {
+ if (!printflag) {
+ printf("%s:\n", progname);
+ fflush(stdout);
+ printflag = 1;
+ }
+ write(STDOUT_FILENO, buf, c);
+ }
+ else if (c == 0) {
+ close(pout[0]);
+ pout[0] = -1;
+ }
+ }
+ if (perr[0] >= 0 && FD_ISSET(perr[0], &set)) {
+ c = read(perr[0], buf, sizeof(buf));
+ if (c > 0) {
+ if (!printflag) {
+ fprintf(stderr, "%s:\n", progname);
+ fflush(stderr);
+ printflag = 1;
+ }
+ write(STDERR_FILENO, buf, c);
+ }
+ else if (c == 0) {
+ close(perr[0]);
+ perr[0] = -1;
+ }
+ }
+ }
+ else {
+ /* assert(FALSE): select was called with infinite timeout, so
+ it either returns successfully or is interrupted */
+ } /*if */
+ } /*while */
+ }
+
+ waitpid(pid, &result, 0);
+
+ if (WIFEXITED(result) && WEXITSTATUS(result)) {
+ error("%s exited with return code %d", progname, WEXITSTATUS(result));
+ exitstatus = 1;
+ }
+ else if (WIFSIGNALED(result)) {
+ error("%s exited because of uncaught signal %d", progname,
+ WTERMSIG(result));
+ exitstatus = 1;
+ }
+}
+
+
+/* Find the parts to run & call run_part() */
+void run_parts(char *dirname)
+{
+ struct dirent **namelist;
+ char *filename;
+ size_t filename_length, dirname_length;
+ int entries, i, result;
+ struct stat st;
+
+ /* dirname + "/" */
+ dirname_length = strlen(dirname) + 1;
+ /* dirname + "/" + ".." + "\0" (This will save one realloc.) */
+ filename_length = dirname_length + 2 + 1;
+ if (!(filename = malloc(filename_length))) {
+ error("failed to allocate memory for path: %s", strerror(errno));
+ exit(1);
+ }
+ strcpy(filename, dirname);
+ strcat(filename, "/");
+
+ /* scandir() isn't POSIX, but it makes things easy. */
+ entries = scandir(dirname, &namelist, valid_name, alphasort);
+ if (entries < 0) {
+ error("failed to open directory %s: %s", dirname, strerror(errno));
+ exit(1);
+ }
+
+ i = reverse_mode ? 0 : entries;
+ for (i = reverse_mode ? (entries - 1) : 0;
+ reverse_mode ? (i >= 0) : (i < entries); reverse_mode ? i-- : i++) {
+ if (filename_length < dirname_length + strlen(namelist[i]->d_name) + 1) {
+ filename_length = dirname_length + strlen(namelist[i]->d_name) + 1;
+ if (!(filename = realloc(filename, filename_length))) {
+ error("failed to reallocate memory for path: %s", strerror(errno));
+ exit(1);
+ }
+ }
+ strcpy(filename + dirname_length, namelist[i]->d_name);
+
+ strcpy(filename, dirname);
+ strcat(filename, "/");
+ strcat(filename, namelist[i]->d_name);
+
+ result = lstat(filename, &st);
+ if (result < 0) {
+ if (exit_on_error_mode) {
+ error("failed to lstat component %s: %s", filename, strerror(errno));
+ exit(1);
+ }
+ else
+ return;
+ }
+
+ if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+ if (!access(filename, X_OK)) {
+ if (test_mode) {
+ printf("%s\n", filename);
+ }
+ else if (list_mode) {
+ if (!access(filename, R_OK))
+ printf("%s\n", filename);
+ }
+ else {
+ if (verbose_mode)
+ fprintf(stderr, "run-parts: executing %s\n", filename);
+ run_part(filename);
+ if (exitstatus != 0 && exit_on_error_mode) return;
+ }
+ }
+ else if (!access(filename, R_OK)) {
+ if (list_mode) {
+ printf("%s\n", filename);
+ }
+ }
+ else if (S_ISLNK(st.st_mode)) {
+ if (!list_mode) {
+ error("run-parts: component %s is a broken symbolic link\n",filename);
+ exitstatus = 1;
+ }
+ }
+ }
+ else if (!S_ISDIR(st.st_mode)) {
+ if (!list_mode) {
+ error("run-parts: component %s is not an executable plain file\n",
+ filename);
+ exitstatus = 1;
+ }
+ }
+
+ free(namelist[i]);
+ }
+ free(namelist);
+ free(filename);
+}
+
+/* Process options */
+int main(int argc, char *argv[])
+{
+ umask(022);
+ add_argument(0);
+
+ for (;;) {
+ int c;
+ int option_index = 0;
+
+ static struct option long_options[] = {
+ {"test", 0, &test_mode, 1},
+ {"list", 0, &list_mode, 1},
+ {"verbose", 0, 0, 'v'},
+ {"report", 0, &report_mode, 1},
+ {"reverse", 0, &reverse_mode, 1},
+ {"umask", 1, 0, 'u'},
+ {"arg", 1, 0, 'a'},
+ {"help", 0, 0, 'h'},
+ {"version", 0, 0, 'V'},
+ {"lsbsysinit", 0, &lsbsysinit_mode, 1},
+ {"exit-on-error", 0, &exit_on_error_mode, 1},
+ {0, 0, 0, 0}
+ };
+
+ c = getopt_long(argc, argv, "u:ha:vV", long_options, &option_index);
+ if (c == EOF)
+ break;
+ switch (c) {
+ case 0:
+ break;
+ case 'u':
+ set_umask();
+ break;
+ case 'a':
+ add_argument(optarg);
+ break;
+ case 'h':
+ usage();
+ break;
+ case 'v':
+ verbose_mode = 1;
+ break;
+ case 'V':
+ version();
+ break;
+ default:
+ fprintf(stderr, "Try `run-parts --help' for more information.\n");
+ exit(1);
+ }
+ }
+
+ /* We require exactly one argument: the directory name */
+ if (optind != (argc - 1)) {
+ error("missing operand");
+ fprintf(stderr, "Try `run-parts --help' for more information.\n");
+ exit(1);
+ }
+
+ if (list_mode && test_mode) {
+ error("--list and --test can not be used together");
+ fprintf(stderr, "Try `run-parts --help' for more information.\n");
+ exit(1);
+ }
+
+ run_parts(argv[optind]);
+
+ return exitstatus;
+}
diff --git a/savelog b/savelog
new file mode 100644
index 0000000..abbd063
--- /dev/null
+++ b/savelog
@@ -0,0 +1,301 @@
+#! /bin/sh
+# savelog - save a log file
+# Copyright (C) 1987, 1988 Ronald S. Karr and Landon Curt Noll
+# Copyright (C) 1992 Ronald S. Karr
+# Slight modifications by Ian A. Murdock <imurdock@gnu.ai.mit.edu>:
+# * uses `gzip' rather than `compress'
+# * doesn't use $savedir; keeps saved log files in the same directory
+# * reports successful rotation of log files
+# * for the sake of consistency, files are rotated even if they are
+# empty
+# More modifications by Guy Maor <maor@debian.org>:
+# * cleanup.
+# * -p (preserve) option
+#
+# usage: savelog [-m mode] [-u user] [-g group] [-t] [-p] [-c cycle]
+# [-j] [-C] [-d] [-l] [-r rolldir] [-n] [-q] file...
+# -m mode - chmod log files to mode
+# -u user - chown log files to user
+# -g group - chgrp log files to group
+# -c cycle - save cycle versions of the logfile (default: 7)
+# -r rolldir- use rolldir instead of . to roll files
+# -C - force cleanup of cycled logfiles
+# -d - use standard date for rolling
+# -t - touch file
+# -l - don't compress any log files (default: compress)
+# -p - preserve mode/user/group of original file
+# -j - use bzip2 instead of gzip
+# -n - do not rotate empty files
+# -q - be quiet
+# file - log file names
+#
+# The savelog command saves and optionally compresses old copies of files.
+# Older version of 'file' are named:
+#
+# 'file'.<number><compress_suffix>
+#
+# where <number> is the version number, 0 being the newest. By default,
+# version numbers > 0 are compressed (unless -l prevents it). The
+# version number 0 is never compressed on the off chance that a process
+# still has 'file' opened for I/O.
+#
+# if the '-d' option is specified, <number> will be YYMMDDhhmmss
+#
+# If the 'file' does not exist and -t was given, it will be created.
+#
+# For files that do exist and have lengths greater than zero, the following
+# actions are performed.
+#
+# 1) Version numered files are cycled. That is version 6 is moved to
+# version 7, version is moved to becomes version 6, ... and finally
+# version 0 is moved to version 1. Both compressed names and
+# uncompressed names are cycled, regardless of -t. Missing version
+# files are ignored.
+#
+# 2) The new file.1 is compressed and is changed subject to
+# the -m, -u and -g flags. This step is skipped if the -t flag
+# was given.
+#
+# 3) The main file is moved to file.0.
+#
+# 4) If the -m, -u, -g, -t, or -p flags are given, then the file is
+# touched into existence subject to the given flags. The -p flag
+# will preserve the original owner, group, and permissions.
+#
+# 5) The new file.0 is changed subject to the -m, -u and -g flags.
+#
+# Note: If no -m, -u, -g, -t, or -p is given, then the primary log file is
+# not created.
+#
+# Note: Since the version numbers start with 0, version number <cycle>
+# is never formed. The <cycle> count must be at least 2.
+#
+# Bugs: If a process is still writing to the file.0 and savelog
+# moved it to file.1 and compresses it, data could be lost.
+# Smail does not have this problem in general because it
+# restats files often.
+
+# common location
+export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin
+COMPRESS="gzip -9f"
+DOT_Z=".gz"
+DATUM=`date +%Y%m%d%H%M%S`
+
+# parse args
+exitcode=0 # no problems to far
+prog=`basename $0`
+mode=
+user=
+group=
+touch=
+forceclean=
+rolldir=
+datum=
+preserve=
+quiet=0
+rotateifempty=yes
+count=7
+
+usage()
+{
+ echo "Usage: $prog [-m mode] [-u user] [-g group] [-t] [-c cycle] [-p]"
+ echo " [-j] [-C] [-d] [-l] [-r rolldir] [-n] [-q] file ..."
+ echo " -m mode - chmod log files to mode"
+ echo " -u user - chown log files to user"
+ echo " -g group - chgrp log files to group"
+ echo " -c cycle - save cycle versions of the logfile (default: 7)"
+ echo " -r rolldir - use rolldir instead of . to roll files"
+ echo " -C - force cleanup of cycled logfiles"
+ echo " -d - use standard date for rolling"
+ echo " -t - touch file"
+ echo " -l - don't compress any log files (default: compress)"
+ echo " -p - preserve mode/user/group of original file"
+ echo " -j - use bzip2 instead of gzip"
+ echo " -n - do not rotate empty files"
+ echo " -q - suppress rotation message"
+ echo " file - log file names"
+}
+
+
+fixfile()
+{
+ if [ -n "$user" ]; then
+ chown -- "$user" "$1"
+ fi
+ if [ -n "$group" ]; then
+ chgrp -- "$group" "$1"
+ fi
+ if [ -n "$mode" ]; then
+ chmod -- "$mode" "$1"
+ fi
+}
+
+
+while getopts m:u:g:c:r:Cdtlphjnq opt ; do
+ case "$opt" in
+ m) mode="$OPTARG" ;;
+ u) user="$OPTARG" ;;
+ g) group="$OPTARG" ;;
+ c) count="$OPTARG" ;;
+ r) rolldir="$OPTARG" ;;
+ C) forceclean=1 ;;
+ d) datum=1 ;;
+ t) touch=1 ;;
+ j) COMPRESS="bzip2 -9f" ; DOT_Z=".bz2" ;;
+ l) COMPRESS="" ;;
+ p) preserve=1 ;;
+ n) rotateifempty="no" ;;
+ q) quiet=1 ;;
+ h) usage; exit 0 ;;
+ *) usage; exit 1 ;;
+ esac
+done
+
+shift $(($OPTIND - 1))
+
+if [ "$count" -lt 2 ]; then
+ echo "$prog: count must be at least 2" 1>&2
+ exit 2
+fi
+
+# cycle thru filenames
+while [ $# -gt 0 ]; do
+
+ # get the filename
+ filename="$1"
+ shift
+
+ # catch bogus files
+ if [ -e "$filename" ] && [ ! -f "$filename" ]; then
+ echo "$prog: $filename is not a regular file" 1>&2
+ exitcode=3
+ continue
+ fi
+
+ # if not a file or empty, do nothing major
+ # (in the Debian version, we rotate even if empty by default)
+ if [ ! -s "$filename" ] && [ "$rotateifempty" != "yes" ]; then
+ # if -t was given and it does not exist, create it
+ if test -n "$touch" && [ ! -f "$filename" ]; then
+ touch -- "$filename"
+ if [ "$?" -ne 0 ]; then
+ echo "$prog: could not touch $filename" 1>&2
+ exitcode=4
+ continue
+ fi
+ fixfile "$filename"
+ fi
+ continue
+ fi
+
+ # be sure that the savedir exists and is writable
+ # (Debian default: $savedir is . and not ./OLD)
+ savedir=`dirname -- "$filename"`
+ if [ -z "$savedir" ]; then
+ savedir=.
+ fi
+ savedir="$savedir/$rolldir"
+ if [ ! -d "$savedir" ]; then
+ mkdir -p -- "$savedir"
+ if [ "$?" -ne 0 ]; then
+ echo "$prog: could not mkdir $savedir" 1>&2
+ exitcode=5
+ continue
+ fi
+ chmod 0755 -- "$savedir"
+ fi
+ if [ ! -w "$savedir" ]; then
+ echo "$prog: directory $savedir is not writable" 1>&2
+ exitcode=7
+ continue
+ fi
+
+ # determine our uncompressed file names
+ newname=`basename -- "$filename"`
+ newname="$savedir/$newname"
+
+ # cycle the old compressed log files
+ cycle=$(( $count - 1))
+ rm -f -- "$newname.$cycle" "$newname.$cycle$DOT_Z"
+ while [ $cycle -gt 1 ]; do
+ # --cycle
+ oldcycle=$cycle
+ cycle=$(( $cycle - 1 ))
+ # cycle log
+ if [ -f "$newname.$cycle$DOT_Z" ]; then
+ mv -f -- "$newname.$cycle$DOT_Z" \
+ "$newname.$oldcycle$DOT_Z"
+ fi
+ if [ -f "$newname.$cycle" ]; then
+ # file was not compressed. move it anyway
+ mv -f -- "$newname.$cycle" "$newname.$oldcycle"
+ fi
+ done
+
+ # compress the old uncompressed log if needed
+ if [ -f "$newname.0" ]; then
+ if [ -z "$COMPRESS" ]; then
+ newfile="$newname.1"
+ mv -- "$newname.0" "$newfile"
+ else
+ newfile="$newname.1$DOT_Z"
+# $COMPRESS < $newname.0 > $newfile
+# rm -f $newname.0
+ $COMPRESS "$newname.0"
+ mv -- "$newname.0$DOT_Z" "$newfile"
+ fi
+ fixfile "$newfile"
+ fi
+
+ # compress the old uncompressed log if needed
+ if test -n "$datum" && test -n "$COMPRESS"; then
+ $COMPRESS -- "$newname".[0-9]*[0-9]
+ fi
+
+ # remove old files if so desired
+ if [ -n "$forceclean" ]; then
+ cycle=$(( $count - 1))
+ if [ -z "$COMPRESS" ]; then
+ rm -f -- `ls -t -- $newname.[0-9]* | sed -e 1,${cycle}d`
+ else
+ rm -f -- `ls -t -- $newname.[0-9]*$DOT_Z | sed -e 1,${cycle}d`
+ fi
+ fi
+
+ # create new file if needed
+ if [ -n "$preserve" ]; then
+ (umask 077
+ touch -- "$filename.new"
+ chown --reference="$filename" -- "$filename.new"
+ chmod --reference="$filename" -- "$filename.new")
+ filenew=1
+ elif [ -n "$touch$user$group$mode" ]; then
+ touch -- "$filename.new"
+ fixfile "$filename.new"
+ filenew=1
+ fi
+
+ # link the file into the file.0 holding place
+ if [ -f "$filename" ]; then
+ if [ -n "$filenew" ]; then
+ if ln -f -- "$filename" "$newname.0"; then
+ mv -- "$filename.new" "$filename"
+ else
+ echo "Error hardlinking $filename to $newname.0" >&2
+ exitcode=8
+ continue
+ fi
+ else
+ mv -- "$filename" "$newname.0"
+ fi
+ fi
+ [ ! -f "$newname.0" ] && touch -- "$newname.0"
+ fixfile "$newname.0"
+ if [ -n "$datum" ]; then
+ mv -- "$newname.0" "$newname.$DATUM"
+ fi
+
+ # report successful rotation
+ test "$quiet" -eq 1 || echo "Rotated \`$filename' at `date`."
+done
+exit $exitcode
diff --git a/savelog.8 b/savelog.8
new file mode 100644
index 0000000..49ed7bf
--- /dev/null
+++ b/savelog.8
@@ -0,0 +1,139 @@
+.\" -*- nroff -*-
+.TH SAVELOG 8 "12 April 2003" "Debian"
+.SH NAME
+savelog \- save a log file
+.SH SYNOPSIS
+.B savelog
+[\-m mode] [\-u user] [\-g group] [\-t] [\-p] [\-c cycle] [\-l] [\-j]
+[\-C] [\-d] [\-l] [\-r rolldir] [\-n] [\-q] file ...
+.SH DESCRIPTION
+The
+.B savelog
+command saves and optionally compresses old copies of files. Older versions
+of
+.I file
+are named:
+.RS
+
+.IR "file" "." "<number>" "" "<compress_suffix>"
+
+.RE
+where
+.I <number>
+is the version number, 0 being the newest. Version numbers > 0 are compressed
+unless
+.B \-l
+prevents it. Version number 0 is not compressed becase a process might still
+have
+.I file
+opened for I/O. Only
+.I cycle
+versions of the file are kept.
+
+If the file does not exist and
+.B \-t
+was given, it will be created.
+
+For files that do exist and have lengths greater than zero, the following
+actions are performed:
+
+.IP 1)
+Version numbered files are cycled. Version
+.IR cycle \-2
+is moved to version
+.IR cycle "\-3,"
+version
+.IR cycle \-1
+is moved to version
+.IR cycle "\-2 ,"
+and so on. Finally version 0 is moved to version 1, and version
+.I cycle
+is deleted. Both
+compressed names and uncompressed names are cycled, regardless of
+.BR \-l .
+Missing version files are ignored.
+
+.IP 2)
+The new
+.I file.1
+is compressed unless the
+.B \-l
+flag was given. It is changed subject to the
+.BR "\-m" ", " "\-u" ", and " "\-g"
+flags.
+
+.IP 3)
+The main file is moved to
+.IR file.0 .
+
+.IP 4)
+If the
+.BR "\-m" ", " "\-u" ", " "\-g" ", " "\-t" ", or " "\-p"
+flags are given, then an empty
+.I file
+is created subject to the given flags. With the
+.B \-p
+flag, the file is created with the same owner, group, and permissions as
+before.
+
+.IP 5)
+The new
+.I file.0
+is changed subject to the
+.BR "\-m" ", " "\-u" ", and " "\-g"
+flags.
+
+Since the version numbers start with 0, version number
+.I cycle
+is never formed. The
+.I cycle
+count must be at least 2.
+
+.SH OPTIONS
+.TP
+.B "\-m mode"
+chmod the log files to mode
+.TP
+.B "\-u user"
+chown log files to user
+.TP
+.B "\-g group"
+chgrp log files to group
+.TP
+.B "\-c cycle"
+Save cycle versions of the logfile (default: 7)
+.TP
+.B \-t
+touch new logfile into existence
+.TP
+.B \-l
+don't compress any log files (default: do compress)
+.TP
+.B \-p
+preserve owner, group, and permissions of logfile
+.TP
+.B \-j
+compress with bzip2 instead of gzip
+.TP
+.B \-C
+force cleanup of cycled logfiles
+.TP
+.B \-d
+use standard date for rolling
+.TP
+.B \-r
+use
+.I rolldir
+instead of . to roll files
+.TP
+.B \-n
+do not rotate empty files
+.TP
+.B \-q
+be quiet
+.SH BUGS
+If a process is still writing to
+.IR "file.0" ","
+and savelog moves it to
+.I file.1
+and compresses it, data could be lost.
diff --git a/sensible-browser b/sensible-browser
new file mode 100644
index 0000000..234def5
--- /dev/null
+++ b/sensible-browser
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+# This program is copyright 2002 by Joey Hess <joeyh@debian.org>,
+# and is licensed under the terms of the GNU GPL, version 2 or higher.
+my $url=shift;
+if (exists $ENV{BROWSER}) {
+ foreach (split ':' , $ENV{BROWSER}) {
+ if (! /%s/) {
+ $_.=" %s";
+ }
+ # substitute %s with url, and %% to %.
+ s/%([%s])/$1 eq '%' ? '%' : $url/eg;
+ $ret=system split ' ', $_;
+ if ($ret >> 8 == 0) {
+ exit(0);
+ }
+ # on failure, continue to next in list
+ }
+
+ print STDERR "None of the browsers in \$BROWSER worked!\n";
+ exit 1;
+}
+
+if (exists $ENV{DISPLAY}) {
+ if (-e '/usr/bin/x-www-browser') {
+ exec '/usr/bin/x-www-browser', $url;
+ exit 1;
+ }
+ elsif (-e '/usr/bin/x-terminal-emulator' && -e '/usr/bin/www-browser') {
+ exec "x-terminal-emulator", "-e", "/usr/bin/www-browser", $url;
+ exit 1;
+ }
+}
+elsif (-e '/usr/bin/www-browser') {
+ exec '/usr/bin/www-browser', $url;
+ exit 1;
+}
+
+print STDERR "Couldn't find a suitable web browser!\n";
+print STDERR "Set the BROWSER environment variable to your desired browser.\n";
+exit 1;
diff --git a/sensible-editor b/sensible-editor
new file mode 100644
index 0000000..fe9e4e1
--- /dev/null
+++ b/sensible-editor
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+ret="$?"
+
+if [ -n "$VISUAL" ]; then
+ ${VISUAL} "$@"
+ ret="$?"
+ if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then
+ exit "$ret"
+ fi
+fi
+
+${EDITOR:-editor} "$@"
+ret="$?"
+if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+ nano "$@"
+ ret="$?"
+ if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+ nano-tiny "$@"
+ ret="$?"
+ if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+ vi "$@"
+ ret="$?"
+ if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+ echo "Couldn't find an editor!" 1>&2
+ echo "Set the \$EDITOR environment variable to your desired editor." 1>&2
+ exit 1
+ fi
+ fi
+ fi
+fi
diff --git a/sensible-editor.1 b/sensible-editor.1
new file mode 100644
index 0000000..6118c79
--- /dev/null
+++ b/sensible-editor.1
@@ -0,0 +1,19 @@
+.\" -*- nroff -*-
+.TH SENSIBLE-EDITOR 1 "03 Mar 2004" "Debian"
+.SH NAME
+sensible-editor, sensible-pager, sensible-browser \- sensible editing, paging, and web browsing
+.SH SYNOPSIS
+.BR sensible-editor " [OPTIONS...]"
+.br
+.BR sensible-pager " [OPTIONS...]"
+.br
+.BR sensible-browser " url"
+.br
+.SH DESCRIPTION
+.BR sensible-editor ", " sensible-pager " and " sensible-browser
+make sensible decisions on which editor, pager, and web browser to call,
+respectively. Programs in Debian can use these scripts
+as their default editor, pager, or web browser or emulate their behavior.
+.SH "SEE ALSO"
+Documentation of the EDITOR, PAGER, and BROWSER variables in
+.BR environ (7)
diff --git a/sensible-pager b/sensible-pager
new file mode 100644
index 0000000..af6d462
--- /dev/null
+++ b/sensible-pager
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+${PAGER:-pager} "$@"
+ret="$?"
+if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+more "$@"
+ret="$?"
+ if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
+ echo "Couldn't find a pager!" 1>&2
+ echo "Set the \$PAGER environment variable to your desired pager." 1>&2
+ exit 1
+ fi
+fi
diff --git a/tempfile.1 b/tempfile.1
new file mode 100644
index 0000000..904f4cd
--- /dev/null
+++ b/tempfile.1
@@ -0,0 +1,61 @@
+.\" -*- nroff -*-
+.TH TEMPFILE 1 "20 December 2004" "Debian"
+.SH NAME
+tempfile \- create a temporary file in a safe manner
+.SH SYNOPSYS
+.B tempfile
+[\-d DIR] [\-p STRING] [\-s STRING] [\-m MODE] [\-n FILE] [\-\-directory=DIR]
+[\-\-prefix=STRING] [\-\-suffix=STRING] [\-\-mode=MODE] [\-\-name=FILE] [\-\-help] [\-\-version]
+.SH DESCRIPTION
+.PP
+.B tempfile
+creates a temporary file in a safe manner. It uses
+.BR tempnam (3)
+to choose the name and opens it with O_RDWR | O_CREAT | O_EXCL. The filename
+is printed on standard output.
+.PP
+The directory to place the file is searched for in the following order:
+.IP a)
+The directory specified by the environment variable
+.BR TMPDIR ,
+if it is writable.
+.IP b)
+The directory specified by the
+.B --directory
+argument, if given.
+.IP c)
+The directory
+.IR /tmp .
+.SH OPTIONS
+.TP
+.BI "-d, --directory " DIR
+Place the file in DIR.
+.TP
+.BI "-p, --prefix " STRING
+Use up to five letters of STRING to generate the name.
+.TP
+.BI "-s, --suffix " STRING
+Generate the file with STRING as the suffix.
+.TP
+.BI "-m, --mode " MODE
+Open the file with MODE instead of 0600.
+.TP
+.BI "-n, --name " FILE
+Use FILE for the name instead of
+.BR tempnam (3) .
+The options -d, -p, and -s are ignored if this option is given.
+.TP
+.B "--help"
+Print a usage message on standard output and exit succesfully.
+.TP
+.B "--version"
+Print version information on standard output and exist succesfully.
+.SH RETURN VALUES
+An exit status of 0 means the temporary file was created succesfully.
+Any other exit status indicates an error.
+.SH BUGS
+Exclusive creation is not guaranteed when creating files on NFS
+partitions.
+.SH "SEE ALSO"
+.BR tempnam (3)
+.BR mktemp (1)
diff --git a/tempfile.c b/tempfile.c
new file mode 100644
index 0000000..c259349
--- /dev/null
+++ b/tempfile.c
@@ -0,0 +1,151 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif /* HAVE_GETOPT_H */
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+char *progname;
+
+void
+usage (int status)
+{
+ if (status)
+ fprintf(stderr, "Try `%s --help' for more information.\n", progname);
+ else
+ printf("Usage: %s [OPTION]\n\n"
+"Create a temporary file in a safe manner.\n\n"
+"-d, --directory=DIR place temporary file in DIR\n"
+"-p, --prefix=STRING set temporary file's prefix to STRING\n"
+"-s, --suffix=STRING set temporary file's suffix to STRING\n"
+"-m, --mode=MODE open with MODE instead of 0600\n"
+"-n, --name=FILE use FILE instead of tempnam(3)\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n", progname);
+ exit(status);
+}
+
+
+void
+syserror (const char *fx)
+{
+ perror(fx);
+ exit(1);
+}
+
+
+int
+parsemode (const char *in, mode_t *out)
+{
+ char *endptr;
+ long int mode;
+ mode = strtol(in, &endptr, 8);
+ if (*endptr || mode<0 || mode>07777)
+ return 1;
+ *out = (mode_t) mode;
+ return 0;
+}
+
+
+int
+main (int argc, char **argv)
+{
+ char *name=0, *dir=0, *pfx=0, *sfx=0;
+ mode_t mode = 0600;
+ int fd, optc;
+ struct option long_options[] = {
+ {"prefix", required_argument, 0, 'p'},
+ {"suffix", required_argument, 0, 's'},
+ {"directory", required_argument, 0, 'd'},
+ {"mode", required_argument, 0, 'm'},
+ {"name", required_argument, 0, 'n'},
+ {"help", no_argument, 0, 'h'},
+ {"version", no_argument, 0, 'v'},
+ {0, 0, 0, 0}
+ };
+ progname = argv[0];
+
+ while ((optc = getopt_long (argc, argv, "p:s:d:m:n:", long_options, 0))
+ != EOF) {
+ switch (optc) {
+ case 0:
+ break;
+ case 'p':
+ pfx = optarg;
+ break;
+ case 's':
+ sfx = optarg;
+ break;
+ case 'd':
+ dir = optarg;
+ break;
+ case 'm':
+ if (parsemode(optarg, &mode)) {
+ fprintf(stderr, "Invalid mode `%s'. Mode must be octal.\n", optarg);
+ usage(1);
+ }
+ break;
+ case 'n':
+ name = optarg;
+ break;
+ case 'h':
+ usage(0);
+ case 'v':
+ puts("tempfile " PACKAGE_VERSION);
+ exit(0);
+ default:
+ usage(1);
+ }
+ }
+
+ if (name) {
+ if ((fd = open(name, O_RDWR | O_CREAT | O_EXCL, mode)) < 0)
+ syserror("open");
+ }
+
+ else {
+ for (;;) {
+ if (!(name = tempnam(dir, pfx)))
+ syserror("tempnam");
+ if ((fd = open(name, O_RDWR | O_CREAT | O_EXCL, mode)) < 0) {
+ if (errno == EEXIST) {
+ free(name);
+ continue;
+ }
+ syserror("open");
+ }
+ if (sfx) {
+ char *namesfx;
+ if (!(namesfx = malloc(strlen(name) + strlen(sfx) + 1)))
+ syserror("malloc");
+ strcpy(namesfx, name);
+ strcat(namesfx, sfx);
+ if (link(name, namesfx) < 0) {
+ if (errno == EEXIST) {
+ if (unlink(name) < 0)
+ syserror("unlink");
+ free(name);
+ free(namesfx);
+ continue;
+ }
+ syserror("link");
+ }
+ if (unlink(name) < 0)
+ syserror("unlink");
+ free(name);
+ name = namesfx;
+ }
+ break;
+ }
+ }
+
+ if (close(fd))
+ syserror("close");
+ puts(name);
+ exit(0);
+}
diff --git a/which b/which
new file mode 100644
index 0000000..3898be0
--- /dev/null
+++ b/which
@@ -0,0 +1,54 @@
+#! /bin/sh
+set -ef
+
+ALLMATCHES=0
+
+while getopts a whichopts
+do
+ case "$whichopts" in
+ a) ALLMATCHES=1 ;;
+ ?) printf "Usage: %s [-a] args\n" $0 ; exit 2 ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+if [ "$#" -eq 0 ]; then
+ ALLRET=1
+else
+ ALLRET=0
+fi
+case $PATH in
+ *::) : "not *DIR:" ;;
+ *:) PATH="$PATH:" ;;
+esac
+for PROGRAM in "$@"; do
+ RET=1
+ IFS_SAVE="$IFS"
+ IFS=:
+ case $PROGRAM in
+ */*)
+ if [ -f "$PROGRAM" ] && [ -x "$PROGRAM" ]; then
+ printf '%s\n' "$PROGRAM"
+ RET=0
+ fi
+ ;;
+ *)
+ for ELEMENT in $PATH; do
+ if [ -z "$ELEMENT" ]; then
+ ELEMENT=.
+ fi
+ if [ -f "$ELEMENT/$PROGRAM" ] && [ -x "$ELEMENT/$PROGRAM" ]; then
+ printf '%s\n' "$ELEMENT/$PROGRAM"
+ RET=0
+ [ "$ALLMATCHES" -eq 1 ] || break
+ fi
+ done
+ ;;
+ esac
+ IFS="$IFS_SAVE"
+ if [ "$RET" -ne 0 ]; then
+ ALLRET=1
+ fi
+done
+
+exit "$ALLRET"
diff --git a/which.1 b/which.1
new file mode 100644
index 0000000..1199984
--- /dev/null
+++ b/which.1
@@ -0,0 +1,26 @@
+.\" -*- nroff -*-
+.TH WHICH 1 "12 Jul 2004" "Debian"
+.SH NAME
+which \- locate a command
+.SH SYNOPSIS
+which [\-a] filename ...
+.SH DESCRIPTION
+.B which
+returns the pathnames of the files which would be executed in the current
+environment, had its arguments been given as commands in a strictly
+POSIX-conformant shell. It does this by searching the PATH for executable
+files matching the names of the arguments.
+.SH OPTIONS
+.TP
+.B \-a
+print all matching pathnames of each argument
+.SH EXIT STATUS
+.TP
+.B 0
+if all specified commands are found and executable
+.TP
+.B 1
+if one or more specified commands is nonexistent or not executable
+.TP
+.B 2
+if an invalid option is specified