From: Scott Schwartz schwartz@cse.psu.edu
Subject: ftpfs eplf extension
Date: Sun, 29 Sep 1996 01:18:55 -0400 [thread overview]
Message-ID: <19960929051855.rjREFakp1kGpkd-bfnwmloF24eoBFojEsm_cPaDyHMU@z> (raw)
The ieft ftp working group has been talking about Dan Bernstein's
easily-parsed-list-format proposal (which can be found at
ftp://koobera.math.uic.edu/pub/docs/RFCEPLF). I think it's a good
idea, so here's a patch to teach ftpfs to interpret it. (The ftp site
listed above generates it, if you want an example.)
There are a couple of loose ends. First, They're still talking about
what character encoding it should use. The existing ftp spec
prescribes ascii. Using utf-7 has been proposed to fit within that
constraint. If they change it to be 8 bit clean then utf-8 could be
used. We'd prefer that, of course, so this code just assumes that's
what will happen. :-) Second, there have been suggestions for
communicating the file mode bits. None of those have been implemented
here, so files are either 777 or 000. Third, eplf communicates a
unique file identifier which could be used to help with cache
coherence, but isn't.
Enclosed is one new file, and patches to the ftpfs source
relative to the last update.
# To unbundle, run this file
echo eplf-patch
sed 's/.//' >eplf-patch <<'//GO.SYSIN DD eplf-patch'
-% diff /sys/src/cmd/ftpfs/ftpfs.h .
-76a77
-> int crack_eplf(char*, Dir*, char*, int);
-% diff /sys/src/cmd/ftpfs/mkfile
-7a8
-> eplf.$O\
-% diff /sys/src/cmd/ftpfs/proto.c .
-539a540,543
-> if (crack_eplf(p, dp, longname, sizeof(longname))) {
-> goto finish; /* blech */
-> }
->
-739a744
-> finish:
-1224a1230
-> char dstr[1024];
-1245a1252
->
-1254c1261,1262
-< snprint(msg, sizeof(msg), "%s!%s.%s.%s.%s!%d", net,
----
->
-> snprint(dstr, sizeof(dstr), "%s!%s.%s.%s.%s!%d", net,
-1257d1264
-<
-1259c1266
-< fd = dial(msg, 0, 0, 0);
----
-> fd = dial(dstr, 0, 0, 0);
-1262c1269
-< fprint(2, "passive mode connect to %s failed: %r\n", msg);
----
-> fprint(2, "passive mode connect to %s failed: %r\n", dstr);
//GO.SYSIN DD eplf-patch
echo eplf.c
sed 's/.//' >eplf.c <<'//GO.SYSIN DD eplf.c'
-#include <u.h>
-#include <libc.h>
-#include "ftpfs.h"
-
-int crack_eplf(char* line, Dir* dp, char* longname, int longsize)
-{
- int when;
- unsigned long size;
-
- if (*line++ != '+')
- return 0;
-
- strcpy(dp->uid, "none");
- strcpy(dp->gid, "none");
- dp->mode = 0;
- dp->length = 0;
- dp->atime = 0;
- safecpy(longname, "", longsize);
-
- while (*line) {
- switch (*line) {
- case '\t':
- safecpy(longname, line+1, longsize);
- return 1;
- case 's':
- size = 0;
- while (*++line && (*line != ','))
- size = size * 10 + (*line - '0');
- dp->length = size;
- break;
- case 'm':
- when = 0;
- while (*++line && (*line != ','))
- when = when * 10 + (*line - '0');
- dp->atime = when;
- break;
- case 'r':
- dp->mode = 0777;
- while (*line) if (*line++ == ',') break;
- break;
- case '/':
- dp->length = 0;
- dp->mode = CHDIR|0777;
- while (*line) if (*line++ == ',') break;
- break;
- case 'i':
- /* We should use this to control the cache, */
- /* but fallthru for now. */
- default:
- while (*line) if (*line++ == ',') break;
- break;
- }
- }
- return 0;
-}
-
//GO.SYSIN DD eplf.c
reply other threads:[~1996-09-29 5:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19960929051855.rjREFakp1kGpkd-bfnwmloF24eoBFojEsm_cPaDyHMU@z \
--to=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).