aboutsummaryrefslogtreecommitdiffstats
path: root/plpftp/ftp.cc
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>1999-07-01 20:46:27 +0000
committerFritz Elfert <felfert@to.com>1999-07-01 20:46:27 +0000
commit3574706f9733e25590ca251a5ceeae1d89ca0f7e (patch)
treec6f56b28eb64d414b305cf1346073ee1b77d9a3c /plpftp/ftp.cc
parent384fea108d69075c0f65e5f4642404d416575574 (diff)
downloadplptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.tar.gz
plptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.tar.bz2
plptools-3574706f9733e25590ca251a5ceeae1d89ca0f7e.zip
moved dir display from rfsv to ftp.
Diffstat (limited to 'plpftp/ftp.cc')
-rw-r--r--plpftp/ftp.cc29
1 files changed, 27 insertions, 2 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();
}