aboutsummaryrefslogtreecommitdiffstats
path: root/plpftp
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2001-02-02 04:49:20 +0000
committerFritz Elfert <felfert@to.com>2001-02-02 04:49:20 +0000
commit9fac7af37460c6a73a7debac1ba82b094a8f066c (patch)
treec6ef3e0ebd088c62348f140289f82482d82db1cf /plpftp
parent4da48658c8f1dfbf5960bb1768dc6d154c528734 (diff)
downloadplptools-9fac7af37460c6a73a7debac1ba82b094a8f066c.tar.gz
plptools-9fac7af37460c6a73a7debac1ba82b094a8f066c.tar.bz2
plptools-9fac7af37460c6a73a7debac1ba82b094a8f066c.zip
Replaced lot of ugly char * by string.
Fixed bug in plpftp's filename-completion, which was introduced yesterday. Added a class PlpUID for dealing with application-UIDs Added UID->mimetype mapping in kioslave.
Diffstat (limited to 'plpftp')
-rw-r--r--plpftp/ftp.cc47
1 files changed, 17 insertions, 30 deletions
diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc
index 837f668..222dd4e 100644
--- a/plpftp/ftp.cc
+++ b/plpftp/ftp.cc
@@ -328,17 +328,13 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv)
continue;
}
if (!strcmp(argv[0], "test") && (argc == 2)) {
- long attr, size;
- PsiTime time;
+ PlpDirent e;
strcpy(f1, psionDir);
strcat(f1, argv[1]);
- if ((res = a.fgeteattr(f1, attr, size, time)) != rfsv::E_PSI_GEN_NONE)
+ if ((res = a.fgeteattr(f1, e)) != rfsv::E_PSI_GEN_NONE)
cerr << "Error: " << res << endl;
- else {
- cout << a.attr2String(attr);
- cout << " " << dec << setw(10) << setfill(' ') << size;
- cout << " " << time << " " << argv[1] << endl;
- }
+ else
+ cout << e << endl;
continue;
}
if (!strcmp(argv[0], "gattr") && (argc == 2)) {
@@ -993,49 +989,40 @@ static char *remote_dir_commands[] = {
static PlpDir comp_files;
static long maskAttr;
-static char tmpPath[1024];
static char cplPath[1024];
static char*
filename_generator(char *text, int state)
{
static int len;
-
+ string tmp;
if (!state) {
- char *p;
Enum<rfsv::errs> res;
len = strlen(text);
- strcpy(tmpPath, psionDir);
- strcat(tmpPath, cplPath);
- for (p = tmpPath; *p; p++)
- if (*p == '/')
- *p = '\\';
- if ((res = comp_a->dir(tmpPath, comp_files)) != rfsv::E_PSI_GEN_NONE) {
+ tmp = psionDir;
+ tmp += cplPath;
+ tmp = rfsv::convertSlash(tmp);
+ if ((res = comp_a->dir(tmp.c_str(), comp_files)) != rfsv::E_PSI_GEN_NONE) {
cerr << "Error: " << res << endl;
return NULL;
}
}
- for (int i = 0; i < comp_files.size(); i++) {
- PlpDirent e = comp_files[i];
+ while (!comp_files.empty()) {
+ PlpDirent e = comp_files.front();
long attr = e.getAttr();
- char *p;
+ comp_files.pop_front();
if ((attr & maskAttr) == 0)
continue;
- strcpy(tmpPath, cplPath);
- strcat(tmpPath, e.getName());
- for (p = tmpPath; *p; p++)
- if (*p == '\\')
- *p = '/';
- if (!(strncmp(tmpPath, text, len))) {
- char fnbuf[1024];
- strcpy(fnbuf, tmpPath);
+ tmp = cplPath;
+ tmp += e.getName();
+ if (!(strncmp(tmp.c_str(), text, len))) {
if (attr & rfsv::PSI_A_DIR) {
rl_completion_append_character = '\0';
- strcat(fnbuf, "/");
+ tmp += '/';
}
- return (strdup(fnbuf));
+ return (strdup(tmp.c_str()));
}
}
return NULL;