File: wvDocBook.in

package info (click to toggle)
wv 1.2.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,952 kB
  • ctags: 3,905
  • sloc: ansic: 30,943; sh: 10,225; xml: 1,677; makefile: 53
file content (143 lines) | stat: -rw-r--r-- 2,980 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/sh

wv_script_name="$0"

prefix=@prefix@
exec_prefix=
datadir=
t_dir=.

wv_opts=
i_file=
o_file=
print_help=no

while test $# -gt 0; do
  case "$1" in
  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  *) optarg= ;;
  esac

  case $1 in
    --prefix=*)
      prefix=$optarg
      ;;
    --exec-prefix=*)
      exec_prefix=$optarg
      ;;
    --datadir=*)
      datadir=$optarg
      ;;
    --targetdir=*)
      t_dir=$optarg
      ;;
    --charset=* | --password=*)
      wv_opts="$wv_opts $1"
      ;;
    -v | --version)
      echo @VERSION@
      exit 0
      ;;
    -\? | -h | --help)
      cat << EOF
Usage: $wv_script_name [OPTIONS] <input-file> <output-file>
Options:
      --prefix=<DIR>        Set prefix (default is @prefix@)
      --exec-prefix=<DIR>   Set exec_prefix (default is @exec_prefix@)
      --datadir=<DIR>       Set datadir (default is @datadir@)
      --targetdir=<DIR>     Target directory (target is <DIR>/<output-file>)
      --charset=<charset>   Specify an iconv charset encoding
      --password=<password> Specify password for encrypted
  -v, --version             Print version info and exit

Authors:
  Dom Lachowicz (dominicl@seas.upenn.edu)
  Caolan McNamara (original author)
Visit http://www.wvware.com/
EOF
      exit 0
      ;;
    -?*)
      echo "Option '$1' not recognized."
      exit 1
      ;;
    *)
      if test "x$i_file" = "x"; then
        i_file=$1
      elif test "x$o_file" = "x"; then
        o_file=$1
      else
        echo "Option '$1' not recognized."
        exit 1
      fi
      ;;
  esac
  shift
done

if test "x$i_file" = "x-"; then
  echo "error: cannot specify '-' as input"
  exit 1
fi
if test -r "$i_file"; then
  okay=yes
else
  echo "error: '$i_file' unreadable"
  exit 1
fi

if test "x$o_file" = "x"; then
  echo "Usage: $1 [OPTIONS] <input-file> <output-file>"
  exit 1
fi
name=`basename "$o_file"`
if test "x$o_file" != "x$name"; then
  echo "* * * Better to use '--targetdir' for writing in another directory * * *"
  exit 1
fi
name=`echo $name | sed 's/\.[^\.]*$//'`

if test "x$exec_prefix" = "x"; then
  exec_prefix=@exec_prefix@
fi
wv_exec="$exec_prefix/bin/wvWare"
if test -x "$wv_exec"; then
  okay=yes
else
  wv_version=`wvWare -v 2>&1 | cut -f 2 -d " "`
  if test "x$wv_version" = "x@VERSION@"; then
    wv_exec="wvWare"
  else
    echo "error: no executable at '$wv_exec' or in path"
    exit 1
  fi
fi

if test "x$datadir" = "x"; then
  datadir=@datadir@
fi
xmlcfg="$datadir/wv/wvDocbook.xml"
if test -r "$xmlcfg"; then
  okay=yes
else
  echo "error: '$xmlcfg' unreadable"
  exit 1
fi

if test -d "$t_dir"; then
  if test -w "$t_dir"; then
    okay=yes
  else
    echo "error: '$t_dir' is not writable"
    exit 1
  fi
else
  echo "error: '$t_dir' is not a directory"
  exit 1
fi

if test "x$o_file" = "x-"; then
  "$wv_exec" $wv_opts -x "$xmlcfg" -d "$t_dir" -b "$name" "$i_file"
else
  "$wv_exec" $wv_opts -x "$xmlcfg" -d "$t_dir" -b "$name" "$i_file" > "$t_dir"/"$o_file"
fi