Files
mercury/scripts/c2init.in
Fergus Henderson eaf2c48c34 Don't use `getopts', since it is not portable.
c2init.in:
	Don't use `getopts', since it is not portable.
	Add long versions of all the options.
	Improve usage message.
1995-07-21 08:13:26 +00:00

49 lines
1.5 KiB
Bash
Executable File

#! /bin/sh
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995 University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
# C2INIT - Convert *.c to *_init.c
#
# This script outputs an appropriate init.c, given the .c files.
# Type `c2init --help' for usage message.
#
# Environment variables: MERCURY_MOD_LIB_DIR, MERCURY_MOD_LIB_MODS,
# MERCURY_MKINIT.
MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS=$MERCURY_MOD_LIB_DIR/*}
MKINIT=${MERCURY_MKINIT=mkinit}
# maximum number of calls to put in a single function
maxcalls=40
defentry=mercury__io__run_0_0
while true; do
case "$1" in
-c|--max-calls)
maxcalls="$2"; shift 2;;
-w|--entry-point)
defentry="$2"; shift 2;;
--)
shift; break;;
-*)
echo "Usage: c2init [options] modules ..." 1>&2
echo "Options: " 1>&2
echo "-c <n>, --max-calls <n>" 1>&2
echo " Break up the initialization into groups of at" \
"most <n> function calls" 1>&2
echo " (Default value of <n> is 40)" 1>&2
echo "-w <label>, --entry-point <label>" 1>&2
echo " Set entry point to <label>" 1>&2
echo " (Default value is \`mercury__io__run_0_0')" 1>&2
exit 1;;
*)
break;;
esac
done
exec $MKINIT -w"$defentry" -c"$maxcalls" "$@" $MERCURY_MOD_LIB_MODS