Add --help, --version.

* mes.c (main): Handle --help, --version.
* scripts/include.mes: Handle --help.
* scripts/elf.mes: Pass any arguments on to mes.
* scripts/mescc.mes: Likewise.
* scripts/paren.mes: Likewise.
* scripts/repl.mes: Likewise.
This commit is contained in:
Jan Nieuwenhuizen 2016-10-16 13:45:24 +02:00
parent c5aa93d67b
commit ac4b1eed3f
6 changed files with 10 additions and 4 deletions

2
mes.c
View file

@ -1543,6 +1543,8 @@ read_file (scm *e, scm *a)
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
if (argc > 1 && !strcmp (argv[1], "--help")) return puts ("Usage: mes < FILE\n");
if (argc > 1 && !strcmp (argv[1], "--version")) return puts ("Mes 0.0\n");
scm *a = mes_environment (); scm *a = mes_environment ();
#if STATIC_PRIMITIVES #if STATIC_PRIMITIVES
mes_primitives (); mes_primitives ();

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*-scheme-*- # -*-scheme-*-
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes > a.out cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes "$@" > a.out
chmod +x a.out chmod +x a.out
exit $? exit $?
!# !#

View file

@ -1,5 +1,9 @@
#! /bin/sh #! /bin/sh
if [ "$1" == "--help" ]; then
echo "Usage: include.mes FILE"
exit 0
fi
for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do for prefix in $(dirname $(dirname $0))/share/mes . $(dirname $(dirname $0)); do
if [ -d ${prefix}/module ]; then if [ -d ${prefix}/module ]; then
break; break;

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*-scheme-*- # -*-scheme-*-
cat ${1-$(dirname $(dirname $0))/share/doc/mes/examples/main.c} | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes > a.out cat ${1-$(dirname $(dirname $0))/share/doc/mes/examples/main.c} | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes "$@" > a.out
chmod +x a.out chmod +x a.out
exit $? exit $?
!# !#

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*-scheme-*- # -*-scheme-*-
echo -e 'EOF\n___P((()))' | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes echo -e 'EOF\n___P((()))' | cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes "$@"
chmod +x a.out chmod +x a.out
exit $? exit $?
!# !#

View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# -*-scheme-*- # -*-scheme-*-
cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes cat $($(dirname $0)/include.mes $0) $0 /dev/stdin | $(dirname $0)/mes "$@"
exit $? exit $?
!# !#