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 12BASE=@XO_SHAREDIR@ 13CMD=cat 14DONE= 15 16do_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 26while [ -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 54done 55 56if [ "$CMD" = "cat" -a -t 0 ]; then 57 do_help 58fi 59 60echo "<html>\n<head>\n" 61echo '<meta http-equiv="content-type" content="text/html; charset=utf-8"/>' 62echo '<link rel="stylesheet" href="'$BASE'/xohtml.css">' 63echo '<link rel="stylesheet" href="'$BASE'/external/jquery.qtip.css"/>' 64echo '<script type="text/javascript" src="'$BASE'/external/jquery.js"></script>' 65echo '<script type="text/javascript" src="'$BASE'/external/jquery.qtip.js"></script>' 66echo '<script type="text/javascript" src="'$BASE'/xohtml.js"></script>' 67echo '<script>' 68echo '</script>' 69echo "</head>\n<body>\n" 70 71$CMD 72 73echo "</body>\n</html>\n" 74 75exit 0 76