3 rwd, conswdir \- maintain remote working directory
20 informed about the current directory on
21 remote systems during login sessions.
25 include this information in plumb messages sent to
27 If the remote system's name space is mounted in the
29 the end result is that file paths printed during the session
38 The name of the remote machine is taken from
39 the environment variable
42 writes the full path to
44 writes the last element of the path,
53 window, changes the window title to
59 copies standard input to standard output, looking for in-band messages
60 about directory changes.
61 The messages are of the form:
64 \e033];\fIpath\fP\e007
71 are ASCII escape and bell characters.
72 Such messages are removed from the stream and not printed to standard output;
83 Add this plumbing rule (see
85 in order to run commands in the plumber's name space:
88 # have plumber run command
90 data matches 'Local (.*)'
95 Mount a Unix system in your name space and the plumber's:
99 % plumb 'Local 9fs unix'
102 (If you're using acme, execute
104 with the middle button to mount the Unix system in acme's name space.)
106 Connect to the Unix system, processing in-band directory change messages:
109 % ssh unix | aux/conswdir
112 Add this shell function to your
115 to generate directory change messages every time a
120 H=`hostname | sed 's/\e..*//'`
126 echo /n/$H$_dir | awk '{printf("\e033];%s\e007", $1);}'
132 The examples described so far only help for relative
133 path names. Add this plumbing rule to handle rooted names
135 .BR /usr/include/stdio.h :
138 # remote rooted path names
140 wdir matches '/n/unix(/.*)?'
141 data matches '/([.a-zA-Z¡-0-9_/\e-]*[a-zA-Z¡-0-9_/\e-])('$addr')?'
142 arg isfile /n/unix/$1
146 plumb client window $editor
151 .B /sys/src/cmd/aux/conswdir.c
157 This mechanism is clunky, but Unix and SSH
158 make it hard to build a better one.
160 The escape sequence was chosen because
161 it changes the title on xterm windows.