]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/xohtml/xohtml.sh
Merge ACPICA 20170728.
[FreeBSD/FreeBSD.git] / usr.bin / xohtml / xohtml.sh
1 #!/bin/sh
2 # $FreeBSD$
3 #
4 # Copyright (c) 2014, Juniper Networks, Inc.
5 # All rights reserved.
6 # This SOFTWARE is licensed under the LICENSE provided in the
7 # ../Copyright file. By downloading, installing, copying, or otherwise
8 # using the SOFTWARE, you agree to be bound by the terms of that
9 # LICENSE.
10 # Phil Shafer, July 2014
11 #
12
13 BASE=/usr/share/libxo
14 CMD=cat
15 DONE=
16
17 do_help () {
18     echo "xohtml: wrap libxo-enabled output in HTML"
19     echo "Usage: xohtml [options] [command [arguments]]"
20     echo "Valid options are:"
21     echo "    -b <basepath> | --base <basepath>"
22     echo "    -c <command> | --command <command>"
23     echo "    -f <output-file> | --file <output-file>"
24     exit 1
25 }
26
27 while [ -z "$DONE" -a ! -z "$1" ]; do
28     case "$1" in
29         -b|--base)
30             shift;
31             BASE="$1";
32             shift;
33             ;;
34         -c|--command)
35             shift;
36             CMD="$1";
37             shift;
38             ;;
39         -f|--file)
40             shift;
41             FILE="$1";
42             shift;
43             exec > "$FILE";
44             ;;
45         -*)
46             do_help
47             ;;
48         *)
49             DONE=1;
50             XX=$1;
51             shift;
52             CMD="$XX --libxo=html $@"
53             ;;
54     esac
55 done
56
57 if [ "$CMD" = "cat" -a -t 0 ]; then
58     do_help
59 fi
60
61 echo '<html>'
62 echo '<head>'
63 echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>'
64 echo '<link rel="stylesheet" href="'$BASE'/xohtml.css">'
65 echo '<link rel="stylesheet" href="'$BASE'/external/jquery.qtip.css"/>'
66 echo '<script type="text/javascript" src="'$BASE'/external/jquery.js"></script>'
67 echo '<script type="text/javascript" src="'$BASE'/external/jquery.qtip.js"></script>'
68 echo '<script type="text/javascript" src="'$BASE'/xohtml.js"></script>'
69 echo '<script>'
70 echo '</script>'
71 echo '</head>'
72 echo '<body>'
73
74 $CMD
75
76 echo '</body>'
77 echo '</html>'
78
79 exit 0