#
# Makefile for sash
#
+ # The HAVE_GZIP definition adds the -gzip and -gunzip commands.
+ # The HAVE_EXT2 definition adds the -chattr and -lsattr comamnds.
+ #
- CFLAGS = -O3 -Wall -DHAVE_GZIP
-CFLAGS = -O3 -Wall -Wmissing-prototypes -DHAVE_GZIP -DHAVE_EXT2
++CFLAGS = -g -Os -Wall -Wmissing-prototypes -DHAVE_GZIP -DHAVE_EXT2
LDFLAGS = -static -s
LIBS = -lz
#include <grp.h>
#include <utime.h>
#include <errno.h>
++#ifndef MS_RDONLY
#include <linux/fs.h>
++#endif
void
fd = open(name, O_CREAT | O_WRONLY | O_EXCL, 0666);
- if (fd >= 0) {
+ if (fd >= 0)
+ {
close(fd);
--
-- continue;
-- }
--
-- if (utime(name, &now) < 0)
++ } else {
perror(name);
++ }
}
}
--- /dev/null
- ----------------------
+sash for DEBIAN
- I found the latest version on http://www.tip.net.au/~dbell/
++--------------------------
++[random tips and comments]
++--------------------------
+
- Michael Meskes <meskes@debian.org>, Fri Jan 30 10:28:17 CET 1998
++In an emergency, you can run linux (just barely) with just the linux
++kernel, a boot loader (such as lilo), and /bin/sash. Use the boot loader
++to start linux with the option: init=/bin/sash
+
++For a list of built-in sash commands, type help
+
++You may or may not be able to log in using sash on a damaged system.
++People with real experience on damaged systems who have simple
++suggestions on how sash could be made more robust in this circumstance
++are invited to file wishlist bugs against the sash package.
++
++If you wish to avoid the overhead of rebooting in an emergency the best
++option is probably to keep a sash root account always logged in. This
++can be a security problem unless you lock the session with a program
++such as vlock. At the moment, vlock is only useful at the linux console.
++
++
++--------------------------
++
++To take apart a debian .deb file with sash, use
++-ar x filename.deb
++
++This will create three files:
++control.tar.gz data.tar.gz debian-binary
++
++See section 7 of the debian FAQ (and the documentation it references)
++for more details on the contents of the two tar.gz files (a copy of the
++debian FAQ is supplied in the doc-debian package).
++
++
++--------------------------
++
++If you plan on being able to use sash for emergency repair work, make
++sure that you understand what each of the built in commands does. This
++is best accomplished by reading the manual page for the full featured
++counterpart, and performing some controlled tests under non-emergency
++conditions.
++
++It's probably a also good idea to have a small partition with a copy
++of the debian base system on it. There are some good low-level tools
++for creating/repairing file systems, sash doesn't substitute for these.
++Also, sash doesn't provide any networking tools. It's a good idea to
++have a stock of rescue floppies, and distribution cdroms. And none of
++these precautions substitute for decent backups.
--- /dev/null
- -- Raul Miller <rdm@test.legislate.com> Sun, 11 Oct 1998 14:54:25 -0400
++sash (3.4-6) stable; urgency=medium
++
++ * incorporated suggestion from Matt Zimmerman <mdz@debian.org>
++ such that clone_root_as_sashroot is properly atomic, even
++ for ownership and permissions.
++
++ -- Raul Miller <moth@debian.org> Wed, 17 Jan 2001 12:47:42 -0500
++
++sash (3.4-5) stable; urgency=medium
++
++ * fix up /etc/shadow to give group shadow read access
++
++ -- Raul Miller <moth@debian.org> Tue, 16 Jan 2001 11:47:27 -0500
++
++sash (3.4-4) stable; urgency=high
++
++ * umask 077 before cloning /etc/shadow (fixes #81793)
++ [ouch]
++
++ -- Raul Miller <moth@debian.org> Wed, 10 Jan 2001 20:42:15 -0500
++
++sash (3.4-3) unstable; urgency=low
++
++ * put back /usr/doc/sash if helper programs fail to provide it
++
++ -- Raul Miller <moth@debian.org> Fri, 15 Oct 1999 18:55:13 -0400
++
++sash (3.4-2) unstable; urgency=low
++
++ * set permissions on sashconfig from debian/rules (Fixes #47307)
++
++ -- Raul Miller <moth@debian.org> Wed, 13 Oct 1999 13:16:49 -0400
++
++sash (3.4-1) unstable; urgency=low
++
++ * new upstream version, adds -ar command for debian
++ * cleaned up handling of Q option in prompts, fixes (#46054, #46820)
++ * rewrote README.debian with some minor hints about usage (fixes #45617)
++
++ -- Raul Miller <moth@debian.org> Thu, 7 Oct 1999 23:10:19 -0400
++
++sash (3.3-7) unstable; urgency=high
++
++ * Re-invented sash config system again. This time with a rich set of
++ prompts, and the option to record them so they need be answered
++ only once. (fixes #45617) This reinstates /var/lib/sash/.
++ * Mentioned init=/bin/sash at boot prompt (fixes #45547)
++ * rm -rf /var/lib/sash/ at package purge time (fixes #27770)
++ * make #include <linux/fs.h> conditional in cmds.c
++
++ -- Raul Miller <moth@debian.org> Thu, 23 Sep 1999 22:13:43 -0400
++
++sash (3.3-6) unstable; urgency=low
++
++ * rewrote postinst to support NIS (fixes #45467)
++ * removed empty /var/lib/sash/
++ * use -Os (instead of -O3) for smaller footprint
++ [At the moment, this results in no measurable change --
++ and most of the footprint is from libc. I'm leaving it
++ in for documentation purposes.]
++
++ -- Raul Miller <moth@debian.org> Sun, 19 Sep 1999 08:32:29 -0400
++
++sash (3.3-5) unstable; urgency=low
++
++ * added Depends: lockfile-progs (needed for new postinst/prerm)
++
++ -- Raul Miller <moth@debian.org> Sun, 19 Sep 1999 01:04:38 -0400
++
++sash (3.3-4) unstable; urgency=low
++
++ * rebuilt using altgcc (cuts executable size ~44%)
++
++ -- Raul Miller <moth@debian.org> Fri, 3 Sep 1999 18:51:39 -0400
++
++sash (3.3-3) unstable; urgency=low
++
++ * removed yet more junk files from diff
++
++ -- Raul Miller <moth@debian.org> Fri, 3 Sep 1999 18:51:34 -0400
++
++sash (3.3-2) unstable; urgency=low
++
++ * removed junk file from diff
++
++ -- Raul Miller <moth@debian.org> Fri, 3 Sep 1999 18:37:33 -0400
++
++sash (3.3-1) unstable; urgency=low
++
++ * new upstream version
++ * use $(CC) in makefile in place of cc (#31220)
++ * completely rewrote postinst and replaced postrm with new prerm (#27632, #41968)
++ * simplified error handling for failed -touch (#43428)
++ * upgraded to upstream version 3.3 (#39145)
++
++ -- Raul Miller <moth@debian.org> Fri, 3 Sep 1999 18:03:00 -0400
++
+sash (2.1-5) unstable; urgency=low
+
+ * New maintainer done properly
+
++ -- Raul Miller <rdm@test.legislate.com> Fri, 3 Sep 1999 18:01:14 -0400
+
+sash (2.1-4) unstable; urgency=low
+
+ * Use $PATH in exec [#25034]
+ * New maintainer
+
+ -- Raul Miller <rdm@test.legislate.com> Thu, 27 Aug 1998 12:19:33 -0400
+
+sash (2.1-3) frozen unstable; urgency=low
+
+ * correct root shell if package is removed
+
+ -- Michael Meskes <meskes@debian.org> Fri, 20 Mar 1998 14:11:28 +0100
+
+sash (2.1-2) unstable; urgency=low
+
+ * Fixed postinst (#19584)
+ * Added -i option (#19656)
+
+ -- Michael Meskes <meskes@debian.org> Mon, 16 Mar 1998 15:23:44 +0100
+
+sash (2.1-1) unstable; urgency=low
+
+ * New upstream version: David incorporated most of my changes except that
+ he wants sash to print a message everytime it starts. But he has added
+ an option -q to get it quiet. I hope that solves the problem as well.
+
+ -- Michael Meskes <meskes@debian.org> Mon, 9 Mar 1998 13:42:33 +0100
+
+sash (2.0-3) unstable; urgency=low
+
+ * corrected argv handling for exec call (#18695)
+ * reworked postinst/prerm to make installation ask less questions
+
+ -- Michael Meskes <meskes@debian.org> Fri, 27 Feb 1998 08:57:00 +0100
+
+sash (2.0-2) unstable; urgency=low
+
+ * sash no longer prints a message every time you invoke it (#18580)
+
+ -- Michael Meskes <meskes@debian.org> Fri, 27 Feb 1998 08:57:00 +0100
+
+sash (2.0-1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Michael Meskes <meskes@debian.org> Fri, 30 Jan 1998 10:25:59 +0100
+
+sash (1.0-3) unstable; urgency=low
+
+ * Added -c option which fixes the problem with su as well as bug (#17573).
+
+ -- Michael Meskes <meskes@debian.org> Thu, 29 Jan 1998 09:38:41 +0100
+
+sash (1.0-2) unstable; urgency=low
+
+ * Added section entry.
+
+ -- Michael Meskes <meskes@debian.org> Tue, 16 Dec 1997 11:05:51 +0100
+
+sash (1.0-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Michael Meskes <meskes@debian.org> Tue, 16 Dec 1997 11:05:51 +0100
+
+Local variables:
+mode: debian-changelog
+add-log-mailing-address: "moth@debian.org"
+End:
--- /dev/null
+Source: sash
+Section: shells
+Priority: optional
+Maintainer: Raul Miller <moth@debian.org>
+Standards-Version: 2.4.0.0
+
+Package: sash
+Architecture: any
++Source-Depends: zlib1-altdev | zlib1g-dev
++Depends: lockfile-progs
++Conflicts: fileutils (<<4.0-1)
++Suggests: doc-debian
+Description: Stand-alone shell.
+ The purpose of this program is to make replacing of shared libraries
+ easy and safe. It does this by firstly being linked statically, and
+ secondly by including many of the standard utilities within itself.
++ .
++ This version offers a variety of choices for those who want more than
++ support for init=/bin/sash at the boot prompt.
--- /dev/null
- This package was debianized by Michael Meskes meskes@debian.org on
- Tue, 16 Dec 1997 11:05:51 +0100.
++This package was debianized by Michael Meskes <meskes@debian.org>
++on Tue, 16 Dec 1997 11:05:51 +0100, and is currently being maintained
++by Raul Miller <moth@debian.org>.
+
+It was downloaded from
- ftp://sunsite.unc.edu/pub/Linux/system/shells/sash.tar.z.
++http://www.tip.net.au/~dbell/programs/sash-3.4.tar.gz
+
- The new upstream version can be found under http://www.tip.net.au/~dbell/.
++New versions will probably be announced at
++http://www.tip.net.au/~dbell/.
+
+Copyright:
+
+ * Copyright (c) 1998 by David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
++
++The code for the internal ar command has the copyright:
++
++ * Original:
++ * Copyright (c) 1999 by Aaron R. Crane.
++ * Permission is granted to use, distribute, or modify this source,
++ * provided that this copyright notice remains intact.
++ *
++ * Modified:
++ * Copyright (c) 1999 by David I. Bell
++ * Permission is granted to use, distribute, or modify this source,
++ * provided that this copyright notice remains intact.
++
--- /dev/null
-
+bin
++usr/sbin
+usr/man/man1
++usr/man/man8
+var/lib/sash
--- /dev/null
--- /dev/null
++sash: statically-linked-binary ./bin/sash
--- /dev/null
--- /dev/null
++?package(sash):needs="text" section="Apps/Shells" title="Sash" command="/bin/sash"
--- /dev/null
- rootshell=`awk -F: '/^root/ {print $7}' /etc/passwd`
-
- if [ "$rootshell" != "/bin/sash" ]
- then
- echo "The best way to use sash is to install it as root's login shell. Currently"
- echo "root's login shell is set to "$rootshell"."
-
- while true
- do
- echo -n "Shall I make sash the login shell for root? [y/N] "
- read input
- if [ $input = "y" -o $input = "Y" ]
- then
- wd=1
- break
- elif [ $input = "n" -o $input = "N" ]
- then
- wd=0
- break
- elif [ ! $input ]
- then
- wd=0
- break
- else
- echo "Please answer \`Y' or \`N'."
- fi 2>/dev/null
- done
-
- if [ $wd = 1 ]
- then
- chsh -s /bin/sash root
- echo $rootshell > /var/lib/sash/rootshell
- fi
- fi
+#!/bin/sh
++# postinst for sash
++#
++# rewritten to use new "sashconfig"
+
++set -e
++PATH=$PATH:/usr/sbin
++sashconfig Q0=ask $(grep '^Q.=.$' /var/lib/sash/package-config 2>/dev/null)
--- /dev/null
- if [ "$1" = "purge" -o "$1" = "remove" ]
- then
-
- rootshell=`awk -F: '/root/ {print $7}' /etc/passwd`
-
- if [ $rootshell == "/bin/sash" ]
- then
- chsh -s `cat /var/lib/sash/rootshell` root
- /bin/rm -f /var/lib/sash/rootshell
- fi
- fi
+#!/bin/sh
+
++case "$1" in purge)
++ rm -rf /var/lib/sash/
++esac
--- /dev/null
--- /dev/null
++#!/bin/sh
++# prerm for sash
++# make sure that accounts using sash will
++# at least continue to work after sash is removed...
++
++set -e
++
++if [ "$1" = remove ]; then
++
++ if grep -qi Q5=Y /var/lib/sash/package-config 2>/dev/null; then
++ if (
++ set -x
++ userdel sashroot
++ ); then
++ : ok
++ else
++ # What I really want is userdel -f that would succeed
++ # as long as account doesn't exist when userdel would exit.
++ echo -n 'Could not remove sashroot, not sure why, proceed? [Y/n]'
++ read resp
++ case "$resp" in N*|n*) exit 1; esac
++ fi
++ fi
++
++ for sashacct in $(
++ perl -le '
++ while (@ent= getpwent) {
++ print $ent[0] if $ent[8] =~m(/bin/sash)
++ }
++ '
++ ); do
++ (
++ set -x
++ chsh -s /bin/sh $sashacct
++ )
++ done
++
++fi
++
++exit 0
--- /dev/null
- debstd README
+#!/usr/bin/make -f
+# Made with the aid of debmake, by Christoph Lameter,
+# based on the sample debian/rules file for GNU hello by Ian Jackson.
+
+package=sash
+
+build:
+ $(checkdir)
+
+ make CFLAGS="-O2 -g -Wall -DHAVE_GZIP"
+ touch build
+
+clean:
+ $(checkdir)
+ -rm -f build
+ -make clean
+ -rm -f `find . -name "*~"`
+ -rm -rf debian/tmp debian/files* core debian/substvars
+
+binary-indep: checkroot build
+ $(checkdir)
+# There are no architecture-independent files to be uploaded
+# generated by this package. If there were any they would be
+# made here.
+
+binary-arch: checkroot build
+ $(checkdir)
+ -rm -rf debian/tmp
+ install -d debian/tmp
+ cd debian/tmp && install -d `cat ../dirs`
+ make install BINDIR=`pwd`/debian/tmp/bin MANDIR=`pwd`/debian/tmp/usr/man/man1
++ install debian/sashconfig debian/tmp/usr/sbin/.
++ cd debian; pod2man --section=8 sashconfig.pod --center='Debian Linux manual' >tmp/usr/man/man8/sashconfig.8
+# Must have debmake installed for this to work. Otherwise please copy
+# /usr/bin/debstd into the debian directory and change debstd to debian/debstd
++ debstd README
+ dpkg-gencontrol
+ chown -R root.root debian/tmp
+ chmod -R go=rX debian/tmp
++ # guarantee backwards compatability on /usr/doc, if debstd gets it wrong
++ [ -f debian/tmp/usr/doc/sash/copyright ] || ( cd debian/tmp/usr&& cp -a share/doc doc && rm -rf share/doc ../DEBIAN/md5sums)
+ dpkg --build debian/tmp ..
+
+define checkdir
+ test -f debian/rules
+endef
+
+binary: binary-indep binary-arch
+
+checkroot:
+ $(checkdir)
+ test root = "`whoami`"
+
+.PHONY: binary binary-arch binary-indep clean checkroot
--- /dev/null
--- /dev/null
++#!/bin/sh
++#
++# there are a number of reasonable ways to configure a system
++# for use with sash. Try to find the admin's choice as efficiently
++# as possible, and optionally remember the result for later.
++#
++# sashconfig will be replaced after debconf is released
++#
++# For the moment, answers are tracked in the form: Q5=Y Q6=N
++# [translation: The answer to question 5 is yes, question 6 is no.]
++
++# clean up potential damage from earlier versions of sashconfig
++if [ -f /etc/shadow ]; then
++ chown root.shadow /etc/shadow
++ chmod 640 /etc/shadow
++fi
++
++set -e; trap "echo Aborting sashconfig" 0
++
++# parse cmdline for any pre-set answers:
++uc(){ tr '[a-z]' '[A-Z]';}
++
++preset(){
++ Q=$(echo "$1" | sed 's/[^0-9]//g')
++ A=$(echo "$1" | uc | sed 's/[^YN]//g')
++ eval Q$Q="$A"
++}
++for option in $(set | grep '^Q[0-6]=.$'); do
++ # don't inherit answers
++ preset "$(option | sed 's/=.*//')";
++done
++Q0=Y
++for option in "$@"; do preset "$option"; done
++
++# debconf inspired prompt handler:
++# don't ask if we already know the answer
++ask(){
++ num=$1; eval A=\$Q$num; shift;
++ if [ -z "$A" ]; then
++ while [ -z "$A" ]; do
++ echo -n "$*? [Y/n/?/q] "
++ read resp ignore
++ case $resp in
++ '?'*) help | sensible-pager;;
++ Q|q) exit 1;;
++ Y*|y*|'') A=Y;;
++ N*|n*) A=N;;
++ *) echo Invalid response;;
++ esac
++ echo
++ done
++ else
++ eval echo '$*': \$Q$num
++ fi
++ eval Q$num=$A
++}
++
++help(){
++ cat <<___
++
++Answer any question with "?" to get this help.
++Answer any question with "q" to cancel and exit
++The default answer to any question is Yes, you may also type "Y" or "y"
++You may instead type "N" or "n"
++
++Questions where the answer is obvious, or irrelevant, are skipped.
++
++The questions are:
++
++1 Create sashroot account?
++
++ Advantage: current root account is left untouched
++ Disadvantage: you'd have two root accounts to keep track of
++
++2 Clone root password for sashroot?
++
++ Advantage: easy to remember
++ Disadvantage: easy to remember
++
++3 Prompt for new sashroot password at config time?
++
++ Advantage: harder to remember
++ Disadvantage: harder to remember
++
++4 Make sash to login shell for root?
++
++Only offered if you did not use the sashroot account. Note that you
++can change root's shell at any time with chsh.
++
++5 Delete sashroot account when sash package is removed?
++
++ Advantage: more secure
++ Disadvantage: may lose account customization (if any)
++
++6 Remember this configuration?
++
++If not you'll get these questions again the next time the sash package
++is configured. Note that, currently, you can get these questions again
++by running sashconfig. Note that even if you answer yes to this question
++the configuration will not be saved if your choices cause any errors.
++
++Final note: Even if you elect not to have sash as a root shell,
++you might be able to salvage a system using init=/bin/sash at the
++boot prompt.
++
++___
++}
++
++
++clone_root_as_sashroot(){
++ if (
++ # /etc/shadow might not exist
++ if [ -e $1 ]; then
++ lockfile-create $1
++ if grep -q ^sashroot: $1; then
++ : sashroot already exists in $1
++ else
++ echo cloning root account entry to create sashroot account in $1
++ umask 077
++ perl -pe '
++ if (/^root:/ && !$found_root) {
++ $found_root++;
++ print;
++ s/^/sash/;
++ }
++ END{
++ die "no root account entry\n"
++ unless $found_root;
++ }
++ ' $1 >$1-sashroot.tmp
++ chown --reference=$1 $1-sashroot.tmp
++ chmod --reference=$1 $1-sashroot.tmp
++ mv $1-sashroot.tmp $1
++ fi
++ lockfile-remove $1
++ fi
++ ) ; then
++ echo Cloned sashroot from root in $1
++ else
++ # we died, attempt to clean up
++ lockfile-remove $1
++ exit 1
++ fi
++}
++
++# for sash.postinst
++ask 0 Configure sash
++if [ "$Q0" = N ]; then
++ exit 0
++fi
++
++create=Create
++if grep -q ^sashroot: /etc/passwd; then
++ create='Use existing'
++fi
++ask 1 $create sashroot account
++if [ "$Q1" = Y ]; then
++ if [ "$create" = Create -a "$Q3" != Y ]; then
++ ask 2 "Clone root password for sashroot"
++ fi
++ if [ "$Q2" != Y ]; then
++ ask 3 Prompt for new sashroot password at config time
++ fi
++else
++ ask 4 Make sash the login shell for root
++fi
++if [ "$create" != Create -o "$Q1" = Y ]; then
++ ask 5 Delete sashroot account when sash package is removed
++ if [ "$Q5" = Y ]; then
++ Q6=Y
++ fi
++fi
++ask 6 Remember this configuration?
++if [ "$Q6" = Y ]; then
++ echo root may change this configuration with sashconfig
++ echo or, cancel it with rm /var/lib/sash/package-config
++ echo
++fi
++
++
++if [ "$Q1" = Y ]; then
++ if [ "$create" = Create ]; then
++ if [ "$Q2" = Y ]; then
++ clone_root_as_sashroot /etc/passwd
++ clone_root_as_sashroot /etc/shadow
++ else
++ (
++ set -x
++ useradd -c 'emergency root shell' -d /root -g root -m -s /bin/sash -u 0 -o sashroot
++ )
++ fi
++ fi
++ if [ "$Q3" = Y ]; then
++ passwd sashroot
++ fi
++ (
++ set -x
++ chsh -s /bin/sash sashroot
++ )
++else
++ if [ "$Q4" = Y ]; then
++ (
++ set -x
++ chsh -s /bin/sash root
++ )
++ fi
++fi
++if [ "$Q6" = Y ]; then
++ (
++ set | grep ^Q[0-6]=
++ help
++ ) >/var/lib/sash/package-config
++fi
++
++trap true 0
--- /dev/null
--- /dev/null
++=head1 NAME
++
++sashconfig -- configure debian "sash" package
++
++=head1 SYNOPSIS
++
++B<sashconfig>
++
++B<sashconfig> [B<Q>[B<0>..B<6>]B<=>[B<Y>|B<N>]] ...
++
++=head1 SUMMARY
++
++B<sashconfig> optionally configures root or sashroot with /bin/sash
++as its root shell.
++
++=head1 DESCRIPTION
++
++B<sashconfig> is designed for use in the B<postinst> script of
++the Debian B<sash> package. It asks a few basic questions to
++determine what the system administrator would prefer for a root
++sash shell account. It then configures the system appropriately.
++
++=head1 BUGS
++
++B<sashconfig> will offer to save its configuration, but it's
++the B<postinst> script which knows how to read this configuration
++file.
++
++This entire mechanism will be replaced with something based on
++debconf, after debconf is ready.
++
++/var/lib/sash/package-config
++
++=head1 SEE ALSO
++
++B<sash>(1).
++
++=cut
{
const char * cp;
const char * singleCommand;
- BOOL quietFlag, interactive;
- char buf[PATHLEN];
+ BOOL quietFlag;
+ BOOL aliasFlag;
++ BOOL interactiveFlag;
+ char buf[PATH_LEN];
singleCommand = NULL;
- quietFlag = interactive = FALSE;
+ quietFlag = FALSE;
+ aliasFlag = FALSE;
++ interactiveFlag = FALSE;
/*
* Look for options.
/*
* Execute specified command.
*/
- if ((argc != 1) || singleCommand || interactive)
- if ((argc != 1) || singleCommand)
++ if ((argc != 1) || singleCommand || interactiveFlag)
usage();
singleCommand = *argv++;
break;
- interactive = TRUE;
+ case 'i':
+ /*
+ * Be an interactive shell
++ * ..is a no-op, but some contexts require this
++ * ..interactiveFlag is to avoid -ic as a legacy
+ */
+ if (singleCommand)
+ usage();
+
++ interactiveFlag = TRUE;
+ break;
+
case 'p':
/*
* Set the prompt string.
name = argv[1];
- while (--sourcecount >= 0) {
- if (sourcefiles[sourcecount] != stdin)
- fclose(sourcefiles[sourcecount]);
- if (access(name, 4))
- {
- perror(name);
-
- return;
- }
-
+ while (--sourceCount >= 0)
+ {
+ if (sourcefiles[sourceCount] != stdin)
+ fclose(sourcefiles[sourceCount]);
}
argv[argc] = NULL;
{
fprintf(stderr, "Stand-alone shell (version %s)\n", version);
fprintf(stderr, "\n");
- fprintf(stderr, "Usage: sash [-q] [-c command] [-p prompt] [-i]\n");
- fprintf(stderr, "Usage: sash [-a] [-q] [-c command] [-p prompt]\n");
++ fprintf(stderr, "Usage: sash [-a] [-q] [-c command] [-p prompt] [-i]\n");
exit(1);
}