[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lisp machine specific ftp client commands
From: |
Alfred M. Szmidt |
Subject: |
lisp machine specific ftp client commands |
Date: |
Tue, 09 Nov 2021 13:50:59 -0500 |
Quick hack to add some commands that are supported by the Lisp Machine
FTP server (now you didn't think to see that!). These are quite
eclectic.
- XLST - similar to LIST, but lists information as s-exps
ftp> xlst
200 PORT command okay.
150 Opening data connection (10.0.0.1,42773)
(NIL :DISK-SPACE-DESCRIPTION "Free=284238, Reserved=32055, Used=90179
(49 pages used in AMS;)" :SETTABLE-PROPERTIES (:AUTHOR :BYTE-SIZE
:CREATION-DATE :DELETED :CHARACTERS :DONT-DELETE :DONT-REAP :NOT-BACKED-UP)
:PATHNAME #FS::LM-PATHNAME "LAMA: AMS; *.*#*")
(#FS::LM-PATHNAME "LAMA: AMS; FOO.LISP#1" :BYTE-SIZE 8
:LENGTH-IN-BLOCKS 0 :LENGTH-IN-BYTES 0 :AUTHOR "AMS" :CREATION-DATE 3844596149
:NOT-BACKED-UP T :CHARACTERS T)
(#FS::LM-PATHNAME "LAMA: AMS; LISPM.INIT#1" :BYTE-SIZE 8
:LENGTH-IN-BLOCKS 1 :LENGTH-IN-BYTES 254 :AUTHOR "ams" :CREATION-DATE
3844424516 :CHARACTERS T)
(#FS::LM-PATHNAME "LAMA: AMS; LISPM.INIT#2" :BYTE-SIZE 8
:LENGTH-IN-BLOCKS 1 :LENGTH-IN-BYTES 362 :AUTHOR "ams" :CREATION-DATE
3845111809 :NOT-BACKED-UP T :CHARACTERS T)
(#FS::LM-PATHNAME "LAMA: AMS; NOTES.TEXT#1" :BYTE-SIZE 8
:LENGTH-IN-BLOCKS 1 :LENGTH-IN-BYTES 520 :AUTHOR "AMS" :CREATION-DATE
3844427411 :CHARACTERS T)
- XUND - undeletes a file on the remote
- XPNG - expunges file from file system on remote
I still need to test this a bit. The actual FTP CLI commands could be
better (expunge, undelete, what about xlst?).
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 780abc83..534d0179 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -1831,7 +1831,6 @@ lpwd (int argc _GL_UNUSED_PARAMETER, char **argv
_GL_UNUSED_PARAMETER)
void
makedir (int argc, char **argv)
{
-
if (argc < 2 && !another (&argc, &argv, "directory-name"))
{
printf ("usage: %s directory-name\n", argv[0]);
@@ -2719,3 +2718,71 @@ newer (int argc, char **argv)
printf ("Local file \"%s\" is newer than remote file \"%s\"\n",
argv[2], argv[1]);
}
+
+void
+xlst (int argc, char **argv)
+{
+ char *cmd, *dest;
+
+ if (argc < 2)
+ argc++, argv[1] = NULL;
+ if (argc > 2)
+ {
+ printf ("usage: %s remote-directory local-file\n", argv[0]);
+ code = -1;
+ return;
+ }
+
+ if (strcmp (argv[2], "-") != 0)
+ {
+ dest = globulize (argv[2]);
+ if (!dest)
+ {
+ code = -1;
+ return;
+ }
+ if (*dest != '|' && !confirm ("output to local-file:", dest))
+ {
+ code = -1;
+ goto out;
+ }
+ }
+ else
+ dest = 0;
+
+ recvrequest ("XLST", dest ? dest : "-", argv[1], "w", 0);
+out:
+ free (dest);
+}
+
+void
+xpng (int argc, char **argv)
+{
+ if (argc < 2 && !another (&argc, &argv, "remote-directory"))
+ {
+ printf ("usage: %s remote-directory\n", argv[0]);
+ code = -1;
+ return;
+ }
+ if (command ("XPNG %s", argv[1]) == ERROR && code == 500)
+ {
+ if (verbose)
+ printf ("XPNG command not recognized\n");
+ }
+}
+
+void
+xund (int argc, char **argv)
+{
+ if (argc < 2 && !another (&argc, &argv, "directory-name"))
+ {
+ printf ("usage: %s directory-name\n", argv[0]);
+ code = -1;
+ return;
+ }
+ if (command ("XUND %s", argv[1]) == ERROR && code == 500)
+ {
+ if (verbose)
+ printf ("XUND command not recognized\n");
+ }
+}
diff --git a/ftp/cmdtab.c b/ftp/cmdtab.c
index fe1cf397..10e49aae 100644
--- a/ftp/cmdtab.c
+++ b/ftp/cmdtab.c
@@ -132,6 +132,10 @@ char umaskhelp[] = "get (set) umask on remote side";
char userhelp[] = "send new user information";
char verbosehelp[] = "toggle verbose mode";
+char xlsthelp[] = "list contents of remote directory in :DIRECTORY-LIST
format";
+char xpnghelp[] = "expunges file from the remote file system";
+char xundhelp[] = "undeletes a file on the remote file system";
+
static struct cmd cmdtab[] = {
{"!", shellhelp, 0, 0, 0, shell},
{"$", domachelp, 1, 0, 0, domacro},
@@ -209,6 +213,9 @@ static struct cmd cmdtab[] = {
{"user", userhelp, 0, 1, 1, user},
{"umask", umaskhelp, 0, 1, 1, do_umask},
{"verbose", verbosehelp, 0, 0, 0, setverbose},
+ {"xlst", xlsthelp, 1, 1, 1, xlst},
+ {"xpng", xpnghelp, 1, 1, 1, xpng},
+ {"xund", xundhelp, 0, 1, 1, xund},
{"?", helphelp, 0, 0, 1, help},
{NULL, NULL, 0, 0, 0, NULL},
};
diff --git a/ftp/extern.h b/ftp/extern.h
index b77a4834..f60c236f 100644
--- a/ftp/extern.h
+++ b/ftp/extern.h
@@ -158,6 +158,10 @@ void syst (int, char **);
void tvsub (struct timeval *, struct timeval *, struct timeval *);
void user (int, char **);
+void xlst (int argc, char **argv);
+void xpng (int argc, char **argv);
+void xund (int argc, char **argv);
+
extern jmp_buf abortprox;
extern int abrtflag;
extern FILE *cout;
--
2.33.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- lisp machine specific ftp client commands,
Alfred M. Szmidt <=