diff options
author | Fritz Elfert <felfert@to.com> | 1999-07-01 20:46:27 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 1999-07-01 20:46:27 +0000 |
commit | 3574706f9733e25590ca251a5ceeae1d89ca0f7e (patch) | |
tree | c6f56b28eb64d414b305cf1346073ee1b77d9a3c /plpftp | |
parent | 384fea108d69075c0f65e5f4642404d416575574 (diff) | |
download | plptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.tar.gz plptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.tar.bz2 plptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.zip |
moved dir display from rfsv to ftp.
Diffstat (limited to 'plpftp')
-rw-r--r-- | plpftp/ftp.cc | 29 | ||||
-rw-r--r-- | plpftp/main.cc | 6 |
2 files changed, 32 insertions, 3 deletions
diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc index 16a3bc2..70111e2 100644 --- a/plpftp/ftp.cc +++ b/plpftp/ftp.cc @@ -236,8 +236,33 @@ session(rfsv32 & a, int xargc, char **xargv) continue; } if ((!strcmp(argv[0], "ls")) || (!strcmp(argv[0], "dir"))) { - if ((res = a.dir(psionDir, NULL)) != 0) + bufferArray files; + if ((res = a.dir(psionDir, &files)) != 0) errprint(res, a); + else + while (!files.empty()) { + bufferStore s; + s = files.popBuffer(); + long date = s.getDWord(0); + long size = s.getDWord(4); + long attr = s.getDWord(8); + char dateBuff[100]; + struct tm *t; + t = localtime(&date); + strftime(dateBuff, 100, "%c", t); + cout << ((attr & rfsv32::PSI_ATTR_DIRECTORY) ? "d" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_RONLY) ? "-" : "w"); + cout << ((attr & rfsv32::PSI_ATTR_HIDDEN) ? "h" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_SYSTEM) ? "s" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_ARCHIVE) ? "a" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_VOLUME) ? "v" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_NORMAL) ? "n" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_TEMPORARY) ? "t" : "-"); + cout << ((attr & rfsv32::PSI_ATTR_COMPRESSED) ? "c" : "-"); + cout << " " << dec << setw(10) << setfill(' ') << size; + cout << " " << dateBuff; + cout << " " << s.getString(12) << endl; + } continue; } if (!strcmp(argv[0], "lcd")) { @@ -460,7 +485,7 @@ session(rfsv32 & a, int xargc, char **xargv) if (strcmp(argv[0], "bye") && strcmp(argv[0], "quit")) usage(); } while (strcmp(argv[0], "bye") && strcmp(argv[0], "quit") && - (a.getStatus() == 0) && (once == 0)); + ((a.getStatus() == 0) || (once == 0))); return a.getStatus(); } diff --git a/plpftp/main.cc b/plpftp/main.cc index e4e0875..2887e1c 100644 --- a/plpftp/main.cc +++ b/plpftp/main.cc @@ -23,6 +23,7 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <signal.h> #include "defs.h" #include "bool.h" @@ -56,9 +57,13 @@ main(int argc, char **argv) { ppsocket *skt; bool res; + sigset_t sigset; // Command line parameter processing int sockNum = DPORT; + sigemptyset(&sigset); + sigaddset(&sigset, SIGPIPE); + sigprocmask(SIG_BLOCK, &sigset, 0L); if ((argc > 2) && !strcmp(argv[1], "-s")) { sockNum = atoi(argv[2]); @@ -70,7 +75,6 @@ main(int argc, char **argv) if (argc < 2) ftpHeader(); skt = new ppsocket(); - skt->startup(); res = skt->connect(NULL, sockNum); if (!res) { delete skt; |