diff options
author | Phil Shafer <phil@FreeBSD.org> | 2017-06-16 06:29:21 +0000 |
---|---|---|
committer | Phil Shafer <phil@FreeBSD.org> | 2017-06-16 06:29:21 +0000 |
commit | 264104f26834fdb27974e0c5fdedf8f2f5a90383 (patch) | |
tree | b9b0cc4939ae6d0a54c6a53836677ac4e6c9609a /usr.bin/xohtml/xohtml.sh | |
parent | 51deaaab9087f1070fd9936032c2ac3b30a25884 (diff) | |
parent | f652982ac455ca6a2e60c46e067222ec58a1479f (diff) | |
download | src-264104f26834fdb27974e0c5fdedf8f2f5a90383.tar.gz src-264104f26834fdb27974e0c5fdedf8f2f5a90383.zip |
Notes
Diffstat (limited to 'usr.bin/xohtml/xohtml.sh')
-rwxr-xr-x | usr.bin/xohtml/xohtml.sh | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/usr.bin/xohtml/xohtml.sh b/usr.bin/xohtml/xohtml.sh new file mode 100755 index 000000000000..c1e85f7e151d --- /dev/null +++ b/usr.bin/xohtml/xohtml.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# $FreeBSD$ +# +# Copyright (c) 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. +# Phil Shafer, July 2014 +# + +BASE=/usr/share/libxo +CMD=cat +DONE= + +do_help () { + echo "xohtml: wrap libxo-enabled output in HTML" + echo "Usage: xohtml [options] [command [arguments]]" + echo "Valid options are:" + echo " -b <basepath> | --base <basepath>" + echo " -c <command> | --command <command>" + echo " -f <output-file> | --file <output-file>" + exit 1 +} + +while [ -z "$DONE" -a ! -z "$1" ]; do + case "$1" in + -b|--base) + shift; + BASE="$1"; + shift; + ;; + -c|--command) + shift; + CMD="$1"; + shift; + ;; + -f|--file) + shift; + FILE="$1"; + shift; + exec > "$FILE"; + ;; + -*) + do_help + ;; + *) + DONE=1; + XX=$1; + shift; + CMD="$XX --libxo=html $@" + ;; + esac +done + +if [ "$CMD" = "cat" -a -t 0 ]; then + do_help +fi + +echo '<html>' +echo '<head>' +echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>' +echo '<link rel="stylesheet" href="'$BASE'/xohtml.css">' +echo '<link rel="stylesheet" href="'$BASE'/external/jquery.qtip.css"/>' +echo '<script type="text/javascript" src="'$BASE'/external/jquery.js"></script>' +echo '<script type="text/javascript" src="'$BASE'/external/jquery.qtip.js"></script>' +echo '<script type="text/javascript" src="'$BASE'/xohtml.js"></script>' +echo '<script>' +echo '</script>' +echo '</head>' +echo '<body>' + +$CMD + +echo '</body>' +echo '</html>' + +exit 0 |