#!/bin/sh # # Copyright (c) 1980, 1993 # The Regents of the University of California. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @(#)vgrind.sh 8.1 (Berkeley) 6/6/93 # # $FreeBSD: stable/11/usr.bin/vgrind/vgrind.sh 216370 2010-12-11 08:32:16Z joel $ # setglobal voptions = ''"" setglobal options = ''"" setglobal files = ''"" setglobal f = ''"" setglobal head = ''"" setglobal vf = '"/usr/libexec/vfontedpr'" setglobal tm = '"/usr/share/tmac'" setglobal postproc = '"psroff'" # Parse args while test $Argc -gt 0 { match $1 { with -f setglobal f = '"filter'" setglobal options = ""$options -f"" with -t setglobal voptions = ""$voptions -t"" with -o* setglobal voptions = ""$voptions $1"" with -W setglobal voptions = ""$voptions -W"" with -d if test $Argc -lt 2 { echo "$0: option $1 must have argument" > !2 exit 1 } setglobal options = ""$options $1 $2"" shift with -h if test $Argc -lt 2 { echo "$0: option $1 must have argument" > !2 exit 1 } setglobal head = $2 shift with -p if test $Argc -lt 2 { echo "$0: option $1 must have argument" > !2 exit 1 } setglobal postproc = $2 shift with -* setglobal options = ""$options $1"" with * setglobal files = ""$files $1"" } shift } if test -r index { echo > nindex for i in [$files] { # make up a sed delete command for filenames # being careful about slashes. echo "? $i ?d" | sed -e "s:/:\\/:g" -e "s:?:/:g" >> nindex } sed -f nindex index > xindex if test "x$f" = xfilter { if test "x$head" != x { $vf $options -h $head $files } else { $vf $options $files } | cat $tm/tmac.vgrind - } else { if test "x$head" != x { $vf $options -h $head $files } else { $vf $options $files } | sh -c "$postproc -rx1 $voptions -i -mvgrind 2>> xindex" } sort -df -k 1,2 xindex > index rm nindex xindex } else { if test "x$f" = xfilter { if test "x$head" != x { $vf $options -h $head $files } else { $vf $options $files } | cat $tm/tmac.vgrind - } else { if test "x$head" != x { $vf $options -h $head $files } else { $vf $options $files } | $postproc -i $voptions -mvgrind } }