• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..15-Aug-2021-

Makefile.amH A D10-Jan-2021380 115

Makefile.inH A D15-Aug-202118.6 KiB636563

README.fishH A D10-Jan-20216.3 KiB218163

appendH A D10-Jan-2021422 1716

chmodH A D10-Jan-2021147 76

chownH A D10-Jan-2021172 76

fexistsH A D10-Jan-202188 43

getH A D10-Jan-20212.1 KiB106102

hardlinkH A D10-Jan-2021182 98

infoH A D10-Jan-2021985 4544

lnH A D10-Jan-2021187 98

lsH A D10-Jan-20214.6 KiB171165

mkdirH A D10-Jan-2021111 76

mvH A D10-Jan-2021142 76

rmdirH A D10-Jan-2021111 76

sendH A D10-Jan-2021442 1817

unlinkH A D10-Jan-2021114 76

utimeH A D10-Jan-2021613 1413

README.fish

1
2		FIles transferred over SHell protocol (V 0.0.3)
3		~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
5This protocol was designed for transferring files over a remote shell
6connection (rsh and compatibles). It can be as well used for transfers over
7rsh, and there may be other uses.
8
9Client sends requests of following form:
10
11#FISH_COMMAND
12equivalent shell commands,
13which may be multiline
14
15Only fish commands are defined here, shell equivalents are for your
16information only and will probably vary from implementation to
17implementation. Fish commands always have priority: server is
18expected to execute fish command if it understands it. If it does not,
19however, it can try the luck and execute shell command.
20
21Since version 4.7.3, the scripts that FISH sends to host machines after
22a command is transmitted are no longer hardwired in the Midnight
23Commander source code.
24
25First, mc looks for system-wide set of scripts, then it checks whether
26current user has host-specific overrides in his per-user mc
27configuration directory. User-defined overrides take priority over
28sytem-wide scripts if they exist. The order in which the directories are
29traversed is as follows:
30
31    /usr/libexec/mc/fish
32    ~/.local/share/mc/fish/<hostname>/
33
34Server's reply is multiline, but always ends with
35
36### 000<optional text>
37
38line. ### is prefix to mark this line, 000 is return code. Return
39codes are superset to those used in ftp.
40
41There are few new exit codes defined:
42
43000 don't know; if there were no previous lines, this marks COMPLETE
44success, if they were, it marks failure.
45
46001 don't know; if there were no previous lines, this marks
47PRELIMinary success, if they were, it marks failure
48
49				Connecting
50				~~~~~~~~~~
51Client uses "echo FISH:;/bin/sh" as command executed on remote
52machine. This should make it possible for server to distinguish FISH
53connections from normal rsh/ssh.
54
55				Commands
56				~~~~~~~~
57#FISH
58echo; start_fish_server; echo '### 200'
59
60This command is sent at the beginning. It marks that client wishes to
61talk via FISH protocol. #VER command must follow. If server
62understands FISH protocol, it has option to put FISH server somewhere
63on system path and name it start_fish_server.
64
65#VER 0.0.2 <feature1> <feature2> <...>
66echo '### 000'
67
68This command is the second one. It sends client version and extensions
69to the server. Server should reply with protocol version to be used,
70and list of extensions accepted.
71
72VER 0.0.0 <feature2>
73### 200
74
75#PWD
76pwd; echo '### 200'
77
78Server should reply with current directory (in form /abc/def/ghi)
79followed by line indicating success.
80
81#LIST /directory
82ls -lLa $1 | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
83S$s
84d$m $d $y
85:$n
86"; done )
87ls -lLa $1 | grep '^[cb]' | ( while read p x u g a i m d y n; do echo "P$p $u.$g
88E$a$i
89dD$m $d $y
90:$n
91"; done )
92echo '### 200'
93
94This allows client to list directory or get status information about
95single file. Output is in following form (any line except :<filename>
96may be omitted):
97
98P<unix permissions> <owner>.<group>
99S<size>
100d<3-letters month name> <day> <year or HH:MM>
101D<year> <month> <day> <hour> <minute> <second>[.1234]
102E<major-of-device>,<minor>
103:<filename>
104L<filename symlink points to>
105<blank line to separate items>
106
107Unix permissions are of form X--------- where X is type of
108file. Currently, '-' means regular file, 'd' means directory, 'c', 'b'
109means character and block device, 'l' means symbolic link, 'p' means
110FIFO and 's' means socket.
111
112'd' has three fields: month (one of strings Jan Feb Mar Apr May Jun
113Jul Aug Sep Oct Nov Dec), day of month, and third is either single
114number indicating year, or HH:MM field (assume current year in such
115case). As you've probably noticed, this is pretty broken; it is for
116compatibility with ls listing.
117
118#RETR /some/name
119ls -l /some/name | ( read a b c d x e; echo $x ); echo '### 100'; cat /some/name; echo '### 200'
120
121Server sends line with filesize on it, followed by line with ### 100
122indicating partial success, then it sends binary data (exactly
123filesize bytes) and follows them with (with no preceding newline) ###
124200.
125
126Note that there's no way to abort running RETR command - except
127closing the connection.
128
129#STOR <size> /file/name
130> /file/name; echo '### 001'; ( dd bs=4096 count=<size/4096>; dd bs=<size%4096> count=1 ) 2>/dev/null | ( cat > %s; cat > /dev/null ); echo '### 200'
131
132This command is for storing /file/name, which is exactly size bytes
133big. You probably think I went crazy. Well, I did not: that strange
134cat > /dev/null has purpose to discard any extra data which was not
135written to disk (due to for example out of space condition).
136
137[Why? Imagine uploading file with "rm -rf /" line in it.]
138
139#CWD /somewhere
140cd /somewhere; echo '### 000'
141
142It is specified here, but I'm not sure how wise idea is to use this
143one: it breaks stateless-ness of the protocol.
144
145Following commands should be rather self-explanatory:
146
147#CHMOD 1234 file
148chmod 1234 file; echo '### 000'
149
150#DELE /some/path
151rm -f /some/path; echo '### 000'
152
153#MKD /some/path
154mkdir /some/path; echo '### 000'
155
156#RMD /some/path
157rmdir /some/path; echo '### 000'
158
159#RENAME /path/a /path/b
160mv /path/a /path/b; echo '### 000'
161
162#LINK /path/a /path/b
163ln /path/a /path/b; echo '### 000'
164
165#SYMLINK /path/a /path/b
166ln -s /path/a /path/b; echo '### 000'
167
168#CHOWN user /file/name
169chown user /file/name; echo '### 000'
170
171#CHGRP group /file/name
172chgrp group /file/name; echo '### 000'
173
174#INFO
175...collect info about host into $result ...
176echo $result
177echo '### 200'
178
179#READ <offset> <size> /path/and/filename
180cat /path/and/filename | ( dd bs=4096 count=<offset/4096> > /dev/null;
181dd bs=<offset%4096> count=1 > /dev/null;
182dd bs=4096 count=<offset/4096>;
183dd bs=<offset%4096> count=1; )
184
185Returns ### 200 on successful exit, ### 291 on successful exit when
186reading ended at eof, ### 292 on successfull exit when reading did not
187end at eof.
188
189#WRITE <offset> <size> /path/and/filename
190
191Hmm, shall we define these ones if we know our client is not going to
192use them?
193
194you can use follow parameters:
195FISH_FILESIZE
196FISH_FILENAME
197FISH_FILEMODE
198FISH_FILEOWNER
199FISH_FILEGROUPE
200FISH_FILEFROM
201FISH_FILETO
202
203NB:
204'FISH_FILESIZE' used if we operate with single file name in 'unlink', 'rmdir', 'chmod', etc...
205'FISH_FILEFROM','FISH_FILETO'  used if we operate with two files in 'ln', 'hardlink', 'mv' etc...
206'FISH_FILEOWNER', 'FISH_FILEGROUPE' is a new user/group in chown
207
208also flags:
209FISH_HAVE_HEAD
210FISH_HAVE_SED
211FISH_HAVE_AWK
212FISH_HAVE_PERL
213FISH_HAVE_LSQ
214FISH_HAVE_DATE_MDYT
215
216That's all, folks!
217						pavel@ucw.cz
218