diff options
author | Fritz Elfert <felfert@to.com> | 2002-02-28 20:59:11 +0000 |
---|---|---|
committer | Fritz Elfert <felfert@to.com> | 2002-02-28 20:59:11 +0000 |
commit | 4f497127917554c3a7249658feee9f5bbae84b88 (patch) | |
tree | 99e50676b2ee4a410fd9300693a825a0201b6c5e /plpftp | |
parent | eecba3b5fcb47a01e6e13ee1940def989f6dd22d (diff) | |
download | plptools-4f497127917554c3a7249658feee9f5bbae84b88.tar.gz plptools-4f497127917554c3a7249658feee9f5bbae84b88.tar.bz2 plptools-4f497127917554c3a7249658feee9f5bbae84b88.zip |
- Added SIS stuff by Daniel Brahneborg
- Change readline detection again
Diffstat (limited to 'plpftp')
-rw-r--r-- | plpftp/Makefile.am | 11 | ||||
-rw-r--r-- | plpftp/ftp.cc | 45 | ||||
-rw-r--r-- | plpftp/ftp.h | 53 | ||||
-rw-r--r-- | plpftp/main.cc | 2 | ||||
-rw-r--r-- | plpftp/rlcrap.h | 30 |
5 files changed, 86 insertions, 55 deletions
diff --git a/plpftp/Makefile.am b/plpftp/Makefile.am index 9038254..60b2f5a 100644 --- a/plpftp/Makefile.am +++ b/plpftp/Makefile.am @@ -2,17 +2,6 @@ # INCLUDES = -I$(top_srcdir)/lib -I$(top_srcdir)/intl -if HAVE_LIBREADLINE -if ADD_LIBCURSES -LIBREADLINE=-lreadline -lcurses -else -LIBREADLINE=-lreadline -endif -endif -if HAVE_LIBHISTORY -LIBHISTORY=-lhistory -endif - bin_PROGRAMS = plpftp plpftp_LDADD = $(top_srcdir)/lib/libplp.la $(LIBREADLINE) $(LIBHISTORY) $(LIBCCMALLOC_CXX) $(INTLLIBS) plpftp_SOURCES = ftp.cc main.cc rlcrap.c diff --git a/plpftp/ftp.cc b/plpftp/ftp.cc index ab0492a..690320f 100644 --- a/plpftp/ftp.cc +++ b/plpftp/ftp.cc @@ -275,7 +275,7 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv) if (!once) getCommand(argc, argv); - if (!strcmp(argv[0], "help")) { + if ((!strcmp(argv[0], "help")) || (!strcmp(argv[0], "?"))) { usage(); continue; } @@ -356,7 +356,11 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv) if ((res = a.fgetmtime(f1, mtime)) != rfsv::E_PSI_GEN_NONE) cerr << _("Error: ") << res << endl; else - cout << mtime << endl; + cout << mtime << "(" << hex + << setw(8) << setfill('0') << mtime.getPsiTimeHi() + << ":" + << setw(8) << setfill('0') << mtime.getPsiTimeLo() + << ")" << endl; continue; } if (!strcmp(argv[0], "sattr") && (argc == 3)) { @@ -423,7 +427,7 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv) cout << (char) ('A' + i) << " " << hex << setw(4) << setfill('0') << drive.getMediaType() << " " << setw(12) << setfill(' ') << setiosflags(ios::left) << - drive.getName() << resetiosflags(ios::left) << dec << setw(9) << + drive.getName().c_str() << resetiosflags(ios::left) << dec << setw(9) << drive.getSize() << setw(9) << drive.getSpace() << " " << setw(8) << setfill('0') << hex << drive.getUID() << endl; } @@ -971,14 +975,12 @@ session(rfsv & a, rpcs & r, int xargc, char **xargv) #if HAVE_LIBREADLINE #if (READLINE_VERSION >= 402) -#define NULL_COMPLETION_RETTYPE char* -#define NULL_COMPLETION_RETVAL "" -#define FUNCAST(f) (CPFunction *)f +#define FUNCAST(f) f +#define CPFUNCAST(f) f #define MATCHFUNCTION rl_completion_matches #else -#define NULL_COMPLETION_RETTYPE int -#define NULL_COMPLETION_RETVAL 0 #define FUNCAST(f) (Function *)f +#define CPFUNCAST(f) (CPPFunction *)f #define MATCHFUNCTION completion_matches #endif @@ -987,7 +989,7 @@ static char *all_commands[] = { "dir", "ls", "dircnt", "cd", "lcd", "get", "put", "mget", "mput", "del", "rm", "mkdir", "rmdir", "prompt", "bye", "cp", "volname", "ps", "kill", "killsave", "runrestore", "run", "machinfo", - "ownerinfo", NULL + "ownerinfo", "help", NULL }; static char *localfile_commands[] = { @@ -1003,7 +1005,7 @@ static long maskAttr; static char cplPath[1024]; static char* -filename_generator(char *text, int state) +filename_generator(const char *text, int state) { static int len; string tmp; @@ -1040,7 +1042,7 @@ filename_generator(char *text, int state) } static char * -command_generator(char *text, int state) +command_generator(const char *text, int state) { static int idx, len; char *name; @@ -1057,20 +1059,25 @@ command_generator(char *text, int state) return NULL; } -static NULL_COMPLETION_RETTYPE -null_completion() { - return NULL_COMPLETION_RETVAL; +#if (READLINE_VERSION >= 402) +static char * null_completion(const char *, int) { + return ""; +} +#else +static int null_completion() { + return 0; } +#endif static char ** -do_completion(char *text, int start, int end) +do_completion(const char *text, int start, int end) { char **matches = NULL; rl_completion_entry_function = FUNCAST(null_completion); rl_completion_append_character = ' '; if (start == 0) - matches = MATCHFUNCTION(text, cmdgen_ptr); + matches = MATCHFUNCTION(text, command_generator); else { int idx = 0; char *name; @@ -1098,7 +1105,7 @@ do_completion(char *text, int start, int end) maskAttr = rfsv::PSI_A_DIR; } - matches = MATCHFUNCTION(text, fnmgen_ptr); + matches = MATCHFUNCTION(text, filename_generator); } return matches; } @@ -1110,9 +1117,11 @@ initReadline(void) #if HAVE_LIBREADLINE rl_readline_name = "plpftp"; rl_completion_entry_function = FUNCAST(null_completion); - rl_attempted_completion_function = (CPPFunction *)do_completion; + rl_attempted_completion_function = CPFUNCAST(do_completion); +#if (READLINE_VERSION < 402) rlcrap_setpointers(command_generator, filename_generator); #endif +#endif } void ftp:: diff --git a/plpftp/ftp.h b/plpftp/ftp.h index e825752..aabdf23 100644 --- a/plpftp/ftp.h +++ b/plpftp/ftp.h @@ -1,27 +1,26 @@ -// $Id$ -// -// PLP - An implementation of the PSION link protocol -// -// Copyright (C) 1999 Philip Proudman -// Modifications for plptools: -// Copyright (C) 1999 Fritz Elfert <felfert@to.com> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// e-mail philip.proudman@btinternet.com - +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com> + * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ #ifndef _ftp_h_ #define _ftp_h_ @@ -65,3 +64,9 @@ class ftp { }; #endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ diff --git a/plpftp/main.cc b/plpftp/main.cc index 9ff50d7..a60a2fb 100644 --- a/plpftp/main.cc +++ b/plpftp/main.cc @@ -72,7 +72,9 @@ main(int argc, char **argv) int status = 0; int sockNum = DPORT; +#ifdef LC_ALL setlocale (LC_ALL, ""); +#endif textdomain(PACKAGE); struct servent *se = getservbyname("psion", "tcp"); diff --git a/plpftp/rlcrap.h b/plpftp/rlcrap.h index 92df659..eb0994c 100644 --- a/plpftp/rlcrap.h +++ b/plpftp/rlcrap.h @@ -1,5 +1,25 @@ -/* - * Woraround for crappy readline.h which defines wrong prototypes. +/*-*-c++-*- + * $Id$ + * + * This file is part of plptools. + * + * Copyright (C) 1999 Philip Proudman <philip.proudman@btinternet.com> + * Copyright (C) 1999-2001 Fritz Elfert <felfert@to.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * */ #ifdef HAVE_CONFIG_H #include <config.h> @@ -19,3 +39,9 @@ extern void rlcrap_setpointers(CorrectFunProto, CorrectFunProto); } #endif #endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ |