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