1 ########################################################################
3 # This software is part of the ast package #
4 # Copyright (c) 1994-2016 AT&T Intellectual Property #
5 # and is licensed under the #
6 # Eclipse Public License, Version 1.0 #
7 # by AT&T Intellectual Property #
9 # A copy of the License is available at #
10 # http://www.eclipse.org/org/documents/epl-v10.html #
11 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
13 # Information and Software Systems Research #
17 # Glenn Fowler <glenn.s.fowler@gmail.com> #
19 ########################################################################
20 ########################################################################
22 # This software is part of the ast package #
23 # Copyright (c) 1994-2011 AT&T Intellectual Property #
24 # and is licensed under the #
25 # Eclipse Public License, Version 1.0 #
26 # by AT&T Intellectual Property #
28 # A copy of the License is available at #
29 # http://www.eclipse.org/org/documents/epl-v10.html #
30 # (with md5 checksum b35adb5213ca9657e911e9befb180842) #
32 # Information and Software Systems Research #
36 # Glenn Fowler <glenn.s.fowler@gmail.com> #
38 ########################################################################
39 : convert
command that operates on
file args to pipeline filter
46 case `(getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null` in
47 0123) ARGV0
="-a $command"
50 @(#)$Id: filter (AT&T Labs Research) 2001-05-31 $
53 [+NAME?filter - run a command in stdin/stdout mode]
54 [+DESCRIPTION?\bfilter\b runs \acommand\a in a mode that takes input from
55 the \afile\a operands, or from the standard input if no \afile\a
56 operands are specified, and writes the results to the standard output.
57 It can be used to run commands like \bsplit\b(1), that normally modify
58 \afile\a operands in-place, in pipelines. The \afile\a operands are
59 not modified; \acommand\a is run on copies in \b/tmp\b.]
61 command [ option ... ] [ file ... ]
63 [+SEE ALSO?\bstrip\b(1)]
67 USAGE
="command [ option ... ] [ file ... ]"
74 getopts $ARGV0 "$USAGE" OPT
'-?'
78 while getopts $ARGV0 "$USAGE" OPT
83 shift `expr $OPTIND - 1`
99 trap 'rm -f $tmp$suf' 0 1 2 3 15
107 *.
*) suf
=.
${suf#*.} ;;
110 cp $file $tmp$suf ||
exit 1
111 chmod u
+rwx
$tmp$suf ||
exit 1
112 $cmd $tmp$suf ||
exit 1