diff options
Diffstat (limited to 'twopane.bash')
-rwxr-xr-x | twopane.bash | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/twopane.bash b/twopane.bash index 2a530db..0001f60 100755 --- a/twopane.bash +++ b/twopane.bash | |||
@@ -119,15 +119,12 @@ connect() | |||
119 | return 1 | 119 | return 1 |
120 | ;; | 120 | ;; |
121 | esac | 121 | esac |
122 | std0=${1:-200} | ||
123 | std1=${2:-201} | ||
124 | if ! [ "${SOCAT[0]}" ] | 122 | if ! [ "${SOCAT[0]}" ] |
125 | then | 123 | then |
126 | disconnect $std0 $std1 | ||
127 | coproc SOCAT { socat_connect; } | 124 | coproc SOCAT { socat_connect; } |
128 | fi | 125 | fi |
129 | pid=${SOCAT_PID} | 126 | pid=${SOCAT_PID} |
130 | eval "exec ${std0}<&${SOCAT[0]} ${std1}>&${SOCAT[1]}" | 127 | eval "exec {std0}<&${SOCAT[0]} {std1}>&${SOCAT[1]}" |
131 | } | 128 | } |
132 | 129 | ||
133 | sendc() | 130 | sendc() |
@@ -144,7 +141,7 @@ send() | |||
144 | 141 | ||
145 | disconnect() | 142 | disconnect() |
146 | { | 143 | { |
147 | eval "exec ${1:-200}<&- ${2:-201}>&-" | 144 | [ "$1" -a "$2" ] && eval "exec $1<&- $2>&-" |
148 | wait -f "$SOCAT_PID" 2>/dev/null | 145 | wait -f "$SOCAT_PID" 2>/dev/null |
149 | } | 146 | } |
150 | 147 | ||
@@ -215,7 +212,7 @@ focus() | |||
215 | 212 | ||
216 | output_filter() | 213 | output_filter() |
217 | { | 214 | { |
218 | exec 15> >(exec cat -v) | 215 | exec {OUTPUT_FILTER}> >(exec cat -v) |
219 | while read -r -N1 | 216 | while read -r -N1 |
220 | do | 217 | do |
221 | case "$REPLY" in | 218 | case "$REPLY" in |
@@ -228,7 +225,7 @@ output_filter() | |||
228 | then | 225 | then |
229 | printf '%s' "$REPLY" | 226 | printf '%s' "$REPLY" |
230 | else | 227 | else |
231 | printf '%s' "$REPLY" >&15 | 228 | printf '%s' "$REPLY" >&${OUTPUT_FILTER} |
232 | fi | 229 | fi |
233 | done | 230 | done |
234 | } | 231 | } |