~ubuntu-branches/ubuntu/oneiric/gnupg2/oneiric-updates

« back to all changes in this revision

Viewing changes to scripts/db2html.in

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-10-04 10:25:53 UTC
  • mfrom: (5.1.15 intrepid)
  • Revision ID: james.westby@ubuntu.com-20081004102553-fv62pp8dsitxli47
Tags: 2.0.9-3.1
* Non-maintainer upload.
* agent/gpg-agent.c: Deinit the threading library before exec'ing
  the command to run in --daemon mode. And because that still doesn't
  restore the sigprocmask, do that manually. Closes: #499569

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
# db2html.in - Docbook to HTML rendering (wk 2000-02-15)
3
 
#
4
 
#       Copyright (C) 2000 Free Software Foundation
5
 
#
6
 
# This is free software; you can redistribute it and/or modify
7
 
# it under the terms of the GNU General Public License as published by
8
 
# the Free Software Foundation; either version 2 of the License, or
9
 
# (at your option) any later version.
10
 
#
11
 
# This is distributed in the hope that it will be useful,
12
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
# GNU General Public License for more details.
15
 
#
16
 
# You should have received a copy of the GNU General Public License
17
 
# along with this program; if not, write to the Free Software
18
 
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
 
 
20
 
nosplit=no
21
 
copyfiles=no
22
 
stylesheet=@DSL_FOR_HTML@
23
 
JADE=@JADE@
24
 
 
25
 
usage () {
26
 
    echo 'usage: db2html [--nosplit] [--copyfiles] filename' >&2
27
 
    exit 1
28
 
}
29
 
 
30
 
 
31
 
while test "`echo $1 | head -c1`" = "-"; do
32
 
    case $1 in
33
 
      --version)
34
 
        cat <<EOF
35
 
db2html 0.5
36
 
Copyright (C) 2000 Free Software Foundation, Inc.
37
 
This is free software; see the source for copying conditions.  There is NO
38
 
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
39
 
 
40
 
stylesteet: $stylesheet
41
 
EOF
42
 
        exit 0
43
 
        ;;
44
 
      --help|-h|-help)
45
 
        usage
46
 
        ;;
47
 
      --nosplit)
48
 
        nosplit=yes
49
 
        ;;
50
 
      --copyfiles)
51
 
        copyfiles=yes
52
 
        ;;
53
 
      --)
54
 
        shift
55
 
        break
56
 
        ;;
57
 
      *)
58
 
        echo "invalid option $1" >&2
59
 
        exit 1
60
 
        ;;
61
 
    esac
62
 
    shift
63
 
done
64
 
 
65
 
if test $# = 1; then
66
 
   input="$1"
67
 
else
68
 
   usage
69
 
fi
70
 
 
71
 
# grep the document type
72
 
doctype=`grep -i '\<doctype' $input|awk 'NR==1 {print $2}'| tr '[A-Z]' '[a-z]'`
73
 
if test -z $doctype; then
74
 
    doctype=book
75
 
    echo "no DOCTYPE found - assuming '$doctype'" >&2
76
 
else
77
 
    echo "DOCTYPE is '$doctype'" >&2
78
 
fi
79
 
 
80
 
output="`basename $input| sed 's/\.sgml$//'`.html"
81
 
 
82
 
 
83
 
if test $nosplit = yes; then
84
 
    echo "running jade on '$input' ..." >&2
85
 
    $JADE -d $stylesheet -t sgml -i html -V nochunks $input > $output
86
 
    echo "$output created"
87
 
    exit 0
88
 
fi
89
 
 
90
 
if test -d html ; then
91
 
    :
92
 
else
93
 
    if mkdir html; then
94
 
        echo "'html' directory created" >&2
95
 
    else
96
 
        echo "failed to create 'html' directory" >&2
97
 
        exit 1
98
 
    fi
99
 
fi
100
 
 
101
 
outputdir="html/`basename $input| sed 's/\.sgml$//'`"
102
 
 
103
 
if test -d $outputdir ; then
104
 
    :
105
 
else
106
 
    if mkdir $outputdir; then
107
 
        echo "'$outputdir' created" >&2
108
 
    else
109
 
        echo "failed to create '$outputdir'" >&2
110
 
        exit 1
111
 
    fi
112
 
fi
113
 
echo "creating html pages in '$outputdir' ..." >&2
114
 
if test "$input" = "`basename $input`"; then
115
 
    inp="../../$input"
116
 
else
117
 
    inp="$input"
118
 
fi
119
 
echo "running jade on '$inp' ..." >&2
120
 
(cd $outputdir && $JADE -t sgml -i html -d $stylesheet $inp )
121
 
echo "html version in '$outputdir' created" >&2
122
 
 
123
 
# break out all filerefs and copy them to the outputdirectory
124
 
# fixme: handling of path components is wrong
125
 
if test $copyfiles = yes; then
126
 
    echo "looking for filerefs ..." >&2
127
 
    for file in `nsgmls -i html $input \
128
 
                    | awk '/^AFILEREF[ \t]+CDATA/ {print $3}'`; do
129
 
        d=$outputdir/`basename $file`
130
 
        if cat $file > $outputdir/`basename $file` ; then
131
 
            echo "  $file -> $d" >&2
132
 
        fi
133
 
    done
134
 
fi
135
 
 
136
 
mainfile=`ls $outputdir/${doctype}* | head -1`
137
 
 
138
 
cat > $output <<EOF
139
 
<html><title>$output</title>
140
 
<body>
141
 
 
142
 
<a href="$mainfile">$mainfile</a>
143
 
 
144
 
</body>
145
 
</html>
146
 
EOF
147
 
 
148
 
echo "$output created with link to '$mainfile'" >&2
149
 
 
150
 
exit 0
151