~ubuntu-branches/ubuntu/intrepid/gwenview/intrepid

« back to all changes in this revision

Viewing changes to admin/ylwrap

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2004-06-13 18:55:04 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040613185504-net8ekxoswwvyxs9
Tags: 1.1.3-1
New upstream release. Translations now included.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# along with this program; if not, write to the Free Software
18
18
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
19
 
 
20
# As a special exception to the GNU General Public License, if you
 
21
# distribute this file as part of a program that contains a
 
22
# configuration script generated by Autoconf, you may include it under
 
23
# the same distribution terms that you use for the rest of that program.
 
24
 
20
25
# Usage:
21
 
#     ylwrap PROGRAM INPUT [OUTPUT DESIRED]... -- [ARGS]...
22
 
# * PROGRAM is program to run.
 
26
#     ylwrap INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
23
27
# * INPUT is the input file
24
28
# * OUTPUT is file PROG generates
25
29
# * DESIRED is file we actually want
 
30
# * PROGRAM is program to run
26
31
# * ARGS are passed to PROG
27
32
# Any number of OUTPUT,DESIRED pairs may be used.
28
33
 
29
 
# The program to run.
30
 
prog="$1"
31
 
shift
32
 
# Make any relative path in $prog absolute.
33
 
case "$prog" in
34
 
 /* | [A-Za-z]:*) ;;
35
 
 */*) prog="`pwd`/$prog" ;;
36
 
esac
37
 
 
38
34
# The input.
39
35
input="$1"
40
36
shift
41
37
case "$input" in
42
 
 /* | [A-Za-z]:*)
 
38
 [\\/]* | ?:[\\/]*)
43
39
    # Absolute path; do nothing.
44
40
    ;;
45
41
 *)
46
 
    # Relative path.  Make it absolute.  Why?  Because otherwise any
47
 
    # debugging info in the generated file will point to the wrong
48
 
    # place.  This is really gross.
 
42
    # Relative path.  Make it absolute.
49
43
    input="`pwd`/$input"
50
44
    ;;
51
45
esac
52
46
 
53
 
# We don't want to use the absolute path if the input in the current
54
 
# directory like when making a tar ball.
55
 
input_base=`echo $input | sed -e 's|.*/||'`
56
 
if test -f $input_base && cmp $input_base $input >/dev/null 2>&1; then
57
 
  input=$input_base
58
 
fi
 
47
# The directory holding the input.
 
48
input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
 
49
# Quote $INPUT_DIR so we can use it in a regexp.
 
50
# FIXME: really we should care about more than `.' and `\'.
 
51
input_rx=`echo "$input_dir" | sed -e 's,\\\\,\\\\\\\\,g' -e 's,\\.,\\\\.,g'`
 
52
 
 
53
echo "got $input_rx"
59
54
 
60
55
pairlist=
61
56
while test "$#" -ne 0; do
67
62
   shift
68
63
done
69
64
 
 
65
# The program to run.
 
66
prog="$1"
 
67
shift
 
68
# Make any relative path in $prog absolute.
 
69
case "$prog" in
 
70
 [\\/]* | ?:[\\/]*) ;;
 
71
 *[\\/]*) prog="`pwd`/$prog" ;;
 
72
esac
 
73
 
70
74
# FIXME: add hostname here for parallel makes that run commands on
71
75
# other machines.  But that might take us over the 14-char limit.
72
76
dirname=ylwrap$$
74
78
mkdir $dirname || exit 1
75
79
 
76
80
cd $dirname
77
 
case "$input" in
78
 
 /* | [A-Za-z]:*)
79
 
    # Absolute path; do nothing.
80
 
    ;;
81
 
 *)
82
 
    # Make a symbolic link, hard link or hardcopy.
83
 
    ln -s ../"$input" . > /dev/null 2>&1 || ln ../"$input" . > /dev/null 2>&1 || cp ../"$input" .
84
 
    ;;
85
 
esac
 
81
 
86
82
$prog ${1+"$@"} "$input"
87
83
status=$?
88
84
 
114
110
         # If $2 is an absolute path name, then just use that,
115
111
         # otherwise prepend `../'.
116
112
         case "$2" in
117
 
           /* | [A-Za-z]:*) target="$2";;
 
113
           [\\/]* | ?:[\\/]*) target="$2";;
118
114
           *) target="../$2";;
119
115
         esac
120
 
         mv "$from" "$target" || status=$?
 
116
 
 
117
         # Edit out `#line' or `#' directives.  We don't want the
 
118
         # resulting debug information to point at an absolute srcdir;
 
119
         # it is better for it to just mention the .y file with no
 
120
         # path.
 
121
         sed -e "/^#/ s,$input_rx,," "$from" > "$target" || status=$?
121
122
      else
122
123
         # A missing file is only an error for the first file.  This
123
124
         # is a blatant hack to let us support using "yacc -d".  If -d