aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2001-01-20 02:49:35 +0000
committerFritz Elfert <felfert@to.com>2001-01-20 02:49:35 +0000
commitcf5a844d0446ab652baa21b85ebf0ec542e7fd22 (patch)
tree392567360bdd8e3893466113ebe74ed1cc79396a
parent67b623860c2d2437afe930bb3722ba18fbb72723 (diff)
downloadplptools-cf5a844d0446ab652baa21b85ebf0ec542e7fd22.tar.gz
plptools-cf5a844d0446ab652baa21b85ebf0ec542e7fd22.tar.bz2
plptools-cf5a844d0446ab652baa21b85ebf0ec542e7fd22.zip
- Applied patches from peter.riocreux@cs.man.ac.uk.
- Added ownerinfo command to plpftp. - Fixed filename completion to handle remote subdirs.
-rw-r--r--README9
-rw-r--r--acconfig.h3
-rw-r--r--configure.in40
-rw-r--r--plpftp/ftp.cc47
4 files changed, 78 insertions, 21 deletions
diff --git a/README b/README
index 242fe81..94a2d96 100644
--- a/README
+++ b/README
@@ -75,6 +75,15 @@
be specified as C-like backslashes and if you consider shell's
escape-mechanism, these in turn have to be escaped with backslashes ;-)
+ --disable-mnttab
+
+ By default, configure checks for existence of /etc/mtab or /etc/mnttab
+ and configures plpnfsd to update that file every time when it
+ mounts or unmounts the psion. If plpnfsd crashes or is killed during
+ that update, /etc/mtab resp. /etc/mnttab can be corrupted. Since
+ this file on some operating systems is vital for functionality
+ of mount/umount, this update can be disabled with the above option.
+
You will get 3 programs and a shared and static library.
By default, the install-prefix is /usr/local, so you probably
should add /usr/local/lib to your /etc/ld.so.conf and then run
diff --git a/acconfig.h b/acconfig.h
index d9c7cb1..e64db73 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -24,6 +24,9 @@
/* Define this to your temporary mtab's path */
#undef MTAB_TMP
+/* Define this this if you want to prevent plpnfsd from updating mtab */
+#undef DONT_UPDATE_MTAB
+
/* Define this to your serial device node */
#undef DDEV
diff --git a/configure.in b/configure.in
index 943cd52..90e2b5f 100644
--- a/configure.in
+++ b/configure.in
@@ -88,20 +88,32 @@ AC_CHECK_LIB(nsl, gethostbyname)
ac_save_LDFLAGS=$LDFLAGS; LDFLAGS="-L/usr/ucblib -R/usr/ucblib $LDFLAGS"
AC_CHECK_LIB(rpcsoc, svcudp_create,,LDFLAGS=$ac_save_LDFLAGS)
-dnl checks for mount table
-AC_MSG_CHECKING(for mount table)
-AC_FIND_FILE(/etc/mnttab /etc/mtab, MTAB)
-AC_MSG_RESULT($MTAB)
-test "$MTAB" = "NO" && AC_DEFINE_UNQUOTED(DONT_UPDATE_MTAB)
-AC_DEFINE_UNQUOTED(MTAB_PATH,"$MTAB")
-case "$target_alias" in
- *linux*)
- AC_DEFINE_UNQUOTED(MTAB_TMP,"${MTAB}~")
- ;;
- *)
- AC_DEFINE_UNQUOTED(MTAB_TMP,"${MTAB}.plpnfsd")
- ;;
-esac
+dnl checks for mount table - if desired
+ac_enable_mnttab=yes
+AC_ARG_ENABLE(mnttab,
+ [ --disable-mnttab disable mnttab writing [no]],
+ if test "$enableval" = "no" ; then
+ AC_MSG_RESULT([support for mnttab disabled])
+ ac_enable_mnttab=no
+ fi
+)
+if test "x$ac_enable_mnttab" = "xyes" ; then
+ AC_MSG_CHECKING(for mount table)
+ AC_FIND_FILE(/etc/mnttab /etc/mtab, MTAB)
+ AC_MSG_RESULT($MTAB)
+ test "$MTAB" = "NO" && AC_DEFINE_UNQUOTED(DONT_UPDATE_MTAB)
+ AC_DEFINE_UNQUOTED(MTAB_PATH,"$MTAB")
+ case "$target_alias" in
+ *linux*)
+ AC_DEFINE_UNQUOTED(MTAB_TMP,"${MTAB}~")
+ ;;
+ *)
+ AC_DEFINE_UNQUOTED(MTAB_TMP,"${MTAB}.plpnfsd")
+ ;;
+ esac
+else
+ AC_DEFINE_UNQUOTED(DONT_UPDATE_MTAB)
+fi
dnl Type of sighandlers
AC_TYPE_SIGNAL
diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc
index 97f9e8c..5769660 100644
--- a/plpftp/ftp.cc
+++ b/plpftp/ftp.cc
@@ -213,7 +213,7 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv)
if (xargc > 1) {
once = true;
- argc = (xargc<10)?xargc:10;
+ argc = (xargc<11)?xargc-1:10;
for (int i = 0; i < argc; i++)
argv[i] = xargv[i+1];
}
@@ -751,6 +751,16 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv)
r.execProgram(cmdbuf, argbuf);
continue;
}
+ if (!strcmp(argv[0], "ownerinfo")) {
+ bufferArray b;
+ if ((res = r.getOwnerInfo(b)) != rfsv::E_PSI_GEN_NONE) {
+ cerr << "Error: " << res << endl;
+ continue;
+ }
+ while (!b.empty())
+ cout << " " << b.pop().getString() << endl;
+ continue;
+ }
if (!strcmp(argv[0], "machinfo")) {
rpcs::machineInfo mi;
if ((res = r.getMachineInfo(mi)) != rfsv::E_PSI_GEN_NONE) {
@@ -960,7 +970,8 @@ static char *all_commands[] = {
"pwd", "ren", "touch", "gtime", "test", "gattr", "sattr", "devs",
"dir", "ls", "dircnt", "cd", "lcd", "get", "put", "mget", "mput",
"del", "rm", "mkdir", "rmdir", "prompt", "bye",
- "ps", "kill", "killsave", "runrestore", "run", "machinfo", NULL
+ "ps", "kill", "killsave", "runrestore", "run", "machinfo",
+ "ownerinfo", NULL
};
static char *localfile_commands[] = {
@@ -973,6 +984,8 @@ static char *remote_dir_commands[] = {
static bufferArray *comp_files = NULL;
static long maskAttr;
+static char tmpPath[1024];
+static char cplPath[1024];
static char*
filename_generator(char *text, int state)
@@ -986,21 +999,29 @@ filename_generator(char *text, int state)
if (comp_files)
delete comp_files;
comp_files = new bufferArray();
- if ((res = comp_a->dir(psionDir, *comp_files)) != rfsv::E_PSI_GEN_NONE) {
+ strcpy(tmpPath, psionDir);
+ strcat(tmpPath, cplPath);
+ if ((res = comp_a->dir(tmpPath, *comp_files)) != rfsv::E_PSI_GEN_NONE) {
cerr << "Error: " << res << endl;
return NULL;
}
}
while (!comp_files->empty()) {
bufferStore s;
+ char *p;
s = comp_files->pop();
long attr = s.getDWord(8);
if ((attr & maskAttr) == 0)
continue;
- if (!(strncmp(s.getString(12), text, len))) {
- char fnbuf[512];
- strcpy(fnbuf, s.getString(12));
+ strcpy(tmpPath, cplPath);
+ strcat(tmpPath, s.getString(12));
+ for (p = tmpPath; *p; p++)
+ if (*p == '\\')
+ *p = '/';
+ if (!(strncmp(tmpPath, text, len))) {
+ char fnbuf[1024];
+ strcpy(fnbuf, tmpPath);
if (attr & rfsv::PSI_A_DIR)
strcat(fnbuf, "/");
return (strdup(fnbuf));
@@ -1054,10 +1075,22 @@ do_completion(char *text, int start, int end)
}
maskAttr = 0xffff;
idx = 0;
+ strcpy(cplPath, text);
+ rl_completion_append_character = ' ';
while ((name = remote_dir_commands[idx])) {
idx++;
- if (!strncmp(name, rl_line_buffer, strlen(name)))
+ if (!strncmp(name, rl_line_buffer, strlen(name))) {
+ char *p = strrchr(cplPath, '/');
+ if (p) {
+ *(++p) = '\0';
+ for (p = cplPath; *p; p++)
+ if (*p == '/')
+ *p = '\\';
+ } else
+ cplPath[0] = '\0';
maskAttr = rfsv::PSI_A_DIR;
+ rl_completion_append_character = '\0';
+ }
}
matches = completion_matches(text, fnmgen_ptr);