diff options
Diffstat (limited to 'build-aux/yyrename')
-rwxr-xr-x | build-aux/yyrename | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/build-aux/yyrename b/build-aux/yyrename index 6964fb5..077aec3 100755 --- a/build-aux/yyrename +++ b/build-aux/yyrename @@ -15,26 +15,26 @@ # You should have received a copy of the GNU General Public License # along with Grecs. If not, see <http://www.gnu.org/licenses/>. -# Usage: yyrename [-f OUTFILE [OUTFILE...]] COMMAND INFILE +# Usage: yyrename [-f "OUTFILE [OUTFILE...]"] COMMAND INFILE # Makefile.am: # LEXCOMPILE = yyrename -f $(LEX_OUTPUT_ROOT).c \ # '$(LEX) $(LFLAGS) $(AM_LFLAGS)' # YACCCOMPILE = yyrename '$(YACC) $(YFLAGS) $(AM_YFLAGS)' # # This script runs COMMAND with INFILE as its argument and scans -# OUTFILEs for identifiers starting with 'yy'. These identifiers -# are renamed by replacing 'yy' with the selected prefix. +# OUTFILEs for identifiers starting with 'yy'. It then renames these +# identifiers by replacing 'yy' with the selected prefix. # # The prefix is looked up in the file yytrans, located in the INFILE's # directory. If this file does not exist, the prefix is constructed # by concatenating the string 'grecs_' and the ``root name''. The root -# name is build by removing '-lex.l' or '-gram.y' from the base name. +# name is built by removing '-lex.l' or '-gram.y' from the base name. # If the latter does not end in any of these, the root name # is constructed by removing the suffix from the base name. # # The yytrans file is a line-oriented lookup table. Empty lines are # ignored, usual UNIX comment lines are honored. The remaining lines -# must consist of two words separated by any amount of whitespace. +# shall consist of two words separated by any amount of whitespace. # The first word is a look-up key, the second one provides a translation # (yy replacement) for that key. # @@ -55,6 +55,11 @@ case $1 in shift esac +if test $# -ne 2; then + echo >&2 "usage: yyrename [-f "OUTFILE [OUTFILE...]"] COMMAND INFILE" + exit 1 +fi + base=`expr "$2" : '.*/\(.*\)\.[ly]'` dir=`dirname "$2"` case $2 in |