From 5fc0a4379eb44f69d62d98d8a9b72b14256da4d2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 20 Jun 1999 10:40:26 +0000 Subject: [PATCH] 1999-06-20 Mark Elbrecht * ylwrap: Handle filenames output by the DOS version of Bison. --- ChangeLog | 4 ++++ lib/ylwrap | 23 +++++++++++++++++++++-- ylwrap | 23 +++++++++++++++++++++-- 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b683b177b..ffd51295c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +1999-06-20 Mark Elbrecht + + * ylwrap: Handle filenames output by the DOS version of Bison. + 1999-06-20 Tom Tromey * ylwrap: Be less strict when recognizing DOS paths. From Mark diff --git a/lib/ylwrap b/lib/ylwrap index 6a9b615d7..467fd6609 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -90,15 +90,34 @@ if test $status -eq 0; then set X $pairlist shift first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + while test "$#" -ne 0; do - if test -f "$1"; then + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in /* | [A-Za-z]:*) target="$2";; *) target="../$2";; esac - mv "$1" "$target" || status=$? + mv "$from" "$target" || status=$? else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d diff --git a/ylwrap b/ylwrap index 6a9b615d7..467fd6609 100755 --- a/ylwrap +++ b/ylwrap @@ -90,15 +90,34 @@ if test $status -eq 0; then set X $pairlist shift first=yes + # Since DOS filename conventions don't allow two dots, + # the DOS version of Bison writes out y_tab.c instead of y.tab.c + # and y_tab.h instead of y.tab.h. Test to see if this is the case. + y_tab_nodot="no" + if test -f y_tab.c || test -f y_tab.h; then + y_tab_nodot="yes" + fi + while test "$#" -ne 0; do - if test -f "$1"; then + from="$1" + # Handle y_tab.c and y_tab.h output by DOS + if test $y_tab_nodot = "yes"; then + if test $from = "y.tab.c"; then + from="y_tab.c" + else + if test $from = "y.tab.h"; then + from="y_tab.h" + fi + fi + fi + if test -f "$from"; then # If $2 is an absolute path name, then just use that, # otherwise prepend `../'. case "$2" in /* | [A-Za-z]:*) target="$2";; *) target="../$2";; esac - mv "$1" "$target" || status=$? + mv "$from" "$target" || status=$? else # A missing file is only an error for the first file. This # is a blatant hack to let us support using "yacc -d". If -d -- 2.47.2