-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTo
executable file
·46 lines (34 loc) · 778 Bytes
/
To
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
set -e
if [ "$1" = "-h" ] && [ "$2" = "" ]; then
p=`basename $0`
cat <<EOF
NAME
$p
SYNOPSYS
$p [-h]
$p [-c] [-a|id|pattern]
DESCRIPTION
$p redirects stdin/stdout to the first window pointed by
[-a|id|pattern]. We default to -a (+Buffer file).
If there's no buffer to write to, act as a cat(1).
If -c is specified, then the output buffer is cleared.
EXAMPLES
# Display stat(1)'s output for current buffer in +Buffer,
# creating it if necessary.
(tagline)\$ stat \$% | To
EOF
exit 0
fi
clear=
if [ "$1" == "-c" ]; then clear=1; shift; fi
if [ -z "$1" ]; then set -- -a; fi
id=`Getids $1 | sed 1q`
# Reasonable default
if [ -z "$id" ]; then
exec cat
fi
if [ -n "$clear" ]; then
echo -n , | 9p write acme/$id/addr
fi
exec 9p write acme/$id/data