Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion GNUmakefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ bindir = @bindir@
datarootdir = @datarootdir@
mandir = @mandir@
man1dir = $(mandir)/man1
baseshell = @baseshell@

tests = $(testdir)/*.t

Expand Down Expand Up @@ -47,7 +48,7 @@ fake: fake.tmp
install -m 755 $< $@

fake.tmp: $(srcdir)/fake.in
sed -e 's:@basexy''@:$(basexy):' < $< > $@
sed -e 's:@basexy''@:$(basexy):' -e 's:@baseshell''@:$(baseshell):' < $< > $@

fake.1: $(smandir)/fake.1.in
cp $< $@
Expand Down
5 changes: 4 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ populate() # {{{
-e "s @datarootdir@ $datarootdir g" \
-e "s @mandir@ $mandir g" \
-e "s @basexy@ $basexy g" \
-e "s @baseshell@ $baseshell g" \
$1 \
> $2
} # }}}
Expand All @@ -58,17 +59,19 @@ bindir='$(prefix)/bin'
datarootdir='$(prefix)/share'
mandir='$(datarootdir)/man'
mandir_set=0
baseshell=/bin/sh

for a in "$@"; do
case $a in
--baseshell=*) baseshell="${a#*=}" ;;
--bindir=*) bindir="${a#*=}" ;;
--datarootdir=*) datarootdir="${a#*=}" ;;
--mandir=*)
mandir="${a#*=}"
mandir_set=1
;;
--prefix=*) prefix="${a#*=}" ;;
--with-basexy=*) basexy="${a#*=}" ;;
--with-basexy=*) basexy="${a#*=}" ;;
esac
done

Expand Down
14 changes: 7 additions & 7 deletions s/fake.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!@baseshell@
# vim: sw=2 sts=2 et fdm=marker cms=\ #\ %s

set -e
Expand Down Expand Up @@ -270,14 +270,14 @@ impl_has_body() # {{{
impl_passthrough() # {{{
{
sed 's/^ *//' > "${1:?}" <<\EOF
#!/bin/sh
#!@baseshell@
exec "$ARGV0" "$@"
EOF
} # }}}
impl_transparent() # {{{
{
sed 's/^ *//' > "${1:?}" <<\EOF
#!/bin/sh
#!@baseshell@
argv0=$(command -v "$ARGV0")
export PATH="$FAKE_BINDIR${PATH+:$PATH}"
exec "$argv0" "$@"
Expand All @@ -286,7 +286,7 @@ EOF
impl_has_errout() # {{{
{
{
printf -- "%s\n" "#!/bin/sh"
printf -- "%s\n" "#!@baseshell@"
printf -- "%s\n" "cat >&${1:?} <<\\EOF"
cat
printf -- "%s\n" "EOF"
Expand All @@ -295,7 +295,7 @@ impl_has_errout() # {{{
impl_reflect() # {{{
{
sed 's/^ *//' > "${1:?}" <<\EOF
#!/bin/sh
#!@baseshell@
exec >&2
printf "%s" "${ARGV0##*/}"
test $# -eq 0 || printf " %s" "$*"
Expand All @@ -305,7 +305,7 @@ EOF
impl_default() # {{{
{
{
printf -- "%s\n" "#!/bin/sh"
printf -- "%s\n" "#!@baseshell@"
} > "${1:?}"
} # }}}

Expand All @@ -330,7 +330,7 @@ test -z "$exitcode" || printf -- >> "$name" "exit %s\n" "$exitcode"
chmod +x "$name"

{
printf '#!/bin/sh\n\n'
printf '#!@baseshell@\n\n'
sed -n '/^#### SHARED {{{/,/### SHARED }}}/p' < "$0"
sed -n '/^#### BEGIN FRONTEND$/,$p' < "$0" |
sed \
Expand Down
2 changes: 1 addition & 1 deletion t/argv-0-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ test::
$ test -x $FAKE_BINDIR/.fubar/0-

$ cat $FAKE_BINDIR/.fubar/0-
#!/bin/sh
#!*/sh (glob)
2 changes: 1 addition & 1 deletion t/argv-n-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ test::
$ test -x $FAKE_BINDIR/.fubar/2-/5KMMQRRICK======-EDQ7APJ6

$ cat $FAKE_BINDIR/.fubar/2-/5KMMQRRICK======-EDQ7APJ6
#!/bin/sh
#!*/sh (glob)
2 changes: 1 addition & 1 deletion t/body-catchall-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ test::
$ test -f $FAKE_BINDIR/.fubar/0+
$ test -x $FAKE_BINDIR/.fubar/0+
$ cat $FAKE_BINDIR/.fubar/0+
#!/bin/sh
#!*/sh (glob)
echo "hello ${1-unknown}!"
2 changes: 1 addition & 1 deletion t/body-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ test::
$ test -f $FAKE_BINDIR/.fubar/0-
$ test -x $FAKE_BINDIR/.fubar/0-
$ cat $FAKE_BINDIR/.fubar/0-
#!/bin/sh
#!*/sh (glob)
echo "hello world!"
2 changes: 1 addition & 1 deletion t/error-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test::
$ test -f $FAKE_BINDIR/.fubar/0-
$ test -x $FAKE_BINDIR/.fubar/0-
$ cat $FAKE_BINDIR/.fubar/0-
#!/bin/sh
#!*/sh (glob)
cat >&2 <<\EOF
gloomy sunday...
EOF
Expand Down
2 changes: 1 addition & 1 deletion t/exitcode-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ test::
$ test -f $FAKE_BINDIR/.fubar/0-
$ test -x $FAKE_BINDIR/.fubar/0-
$ cat $FAKE_BINDIR/.fubar/0-
#!/bin/sh
#!*sh (glob)
exit 42
2 changes: 1 addition & 1 deletion t/output-files.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test::
$ test -f $FAKE_BINDIR/.fubar/0-
$ test -x $FAKE_BINDIR/.fubar/0-
$ cat $FAKE_BINDIR/.fubar/0-
#!/bin/sh
#!*/sh (glob)
cat >&1 <<\EOF
hello world!
EOF
Expand Down