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