From 4f497127917554c3a7249658feee9f5bbae84b88 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Thu, 28 Feb 2002 20:59:11 +0000 Subject: - Added SIS stuff by Daniel Brahneborg - Change readline detection again --- Makefile.am | 3 +- conf/m4/plptools/PLP_CHECK_READLINE.m4 | 61 ++++++++++++++++++++-------------- configure.in | 8 +++-- plpftp/Makefile.am | 11 ------ plpftp/ftp.cc | 45 +++++++++++++++---------- plpftp/ftp.h | 53 ++++++++++++++++------------- plpftp/main.cc | 2 ++ plpftp/rlcrap.h | 30 +++++++++++++++-- 8 files changed, 129 insertions(+), 84 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3f9a2ae..2696133 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,8 @@ else KDESUB = endif -SUBDIRS = intl po lib ncpd plpnfsd plpftp plpbackup plpprint $(KDESUB) doc . +SUBDIRS = intl po lib ncpd plpnfsd plpftp plpbackup plpprint sisinstall \ + $(KDESUB) doc . EXTRA_DIST = CHANGES COPYING README TODO INSTALL README.mjg ABOUT-NLS include/*.h* etc/*magic etc/*.in patches conf/m4/kde/*.m4 conf/m4/plptools/*.m4 conf/[a-l]* conf/missing conf/mkinstalldirs DISTCLEANFILES = etc/psion AUTOMAKE_OPTIONS = foreign diff --git a/conf/m4/plptools/PLP_CHECK_READLINE.m4 b/conf/m4/plptools/PLP_CHECK_READLINE.m4 index 3df8b5b..7f832ac 100644 --- a/conf/m4/plptools/PLP_CHECK_READLINE.m4 +++ b/conf/m4/plptools/PLP_CHECK_READLINE.m4 @@ -10,36 +10,51 @@ dnl AC_DEFUN(PLP_CHECK_READLINE, [ AC_MSG_CHECKING(for readline in -lreadline) - ac_cv_addcurses=false - ac_cv_have_libreadline=false + ac_cv_readline_libs="" + rl_desc="Define this, if you have libreadline" saved_libs=$LIBS LIBS="$LIBS -lreadline" - link1ok=0 - link2ok=0 - AC_TRY_LINK(,[extern char *readline(void); readline();],link1ok=1) - LIBS="$LIBS -lreadline -lcurses" - AC_TRY_LINK(,[extern char *readline(void); readline();],link2ok=1) + l1ok=0 + l2ok=0 + l3ok=0 + l4ok=0 + AC_TRY_LINK(,[extern char *readline(void); readline();],l1ok=1) + LIBS="$saved_LIBS -lreadline -ltermcap" + AC_TRY_LINK(,[extern char *readline(void); readline();],l2ok=1) + LIBS="$saved_LIBS -lreadline -lcurses" + AC_TRY_LINK(,[extern char *readline(void); readline();],l3ok=1) + LIBS="$saved_LIBS -lreadline -lncurses" + AC_TRY_LINK(,[extern char *readline(void); readline();],l4ok=1) LIBS="$saved_LIBS" - case "$link1ok$link2ok" in - 00) + case "$l1ok$l2ok$l3ok$l4ok" in + 0000) AC_MSG_RESULT(no) ;; - 01) - ac_cv_have_libreadline=true; - ac_cv_addcurses=true - AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE) + 01*) + dnl We prefer libtermcap cause it's smaller + ac_cv_readline_libs="-lreadline -ltermcap" + AC_MSG_RESULT([yes, and needs libtermcap]) + ;; + 001*) + dnl Prefer libcurses over libncurses + ac_cv_readline_libs="-lreadline -lcurses" AC_MSG_RESULT([yes, and needs libcurses]) - PLP_READLINE_402 + ;; + 0001) + ac_cv_readline_libs="-lreadline -lncurses" + AC_MSG_RESULT([yes, and needs libncurses]) ;; 1*) - ac_cv_have_libreadline=true; - AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE) + ac_cv_readline_libs="-lreadline" AC_MSG_RESULT(yes) - PLP_READLINE_402 ;; esac - AM_CONDITIONAL(HAVE_LIBREADLINE, test x$ac_cv_have_libreadline = xtrue) - AM_CONDITIONAL(ADD_LIBCURSES, test x$ac_cv_addcurses = xtrue) + LIBREADLINE="${ac_cv_readline_libs}" + AC_SUBST(LIBREADLINE) + if test "${ac_cv_readline_libs}" != "" ; then + AC_DEFINE_UNQUOTED(HAVE_LIBREADLINE,1,$rl_desc) + PLP_READLINE_VERSION + fi ]) dnl @@ -47,15 +62,11 @@ dnl Check for readline version. dnl Those readline developers change their API too frequently dnl and don't provide a version number in the headers :-( dnl -AC_DEFUN(PLP_READLINE_402, +AC_DEFUN(PLP_READLINE_VERSION, [ AC_MSG_CHECKING(for readline version) saved_libs=$LIBS - if $ac_cv_addcurses ; then - LIBS="$LIBS -lreadline -lcurses" - else - LIBS="$LIBS -lreadline" - fi + LIBS="$LIBS $LIBREADLINE" rl42=false AC_TRY_LINK(,[extern void rl_set_prompt(void); rl_set_prompt();],rl42=true) LIBS="$saved_LIBS" diff --git a/configure.in b/configure.in index ecf62d4..c8f2ed3 100644 --- a/configure.in +++ b/configure.in @@ -77,7 +77,7 @@ if test "x$ac_enable_readline" = "xyes" ; then fi ac_enable_history=yes -AM_CONDITIONAL(HAVE_LIBHISTORY, false) +ac_cv_libhistory= AC_ARG_ENABLE(history, [ --disable-history disable libhistory support [no]], if test "$enableval" = "no" ; then @@ -89,10 +89,11 @@ if test "x$ac_enable_history" = "xyes" ; then AC_CHECK_LIB(history, add_history, [ AC_DEFINE_UNQUOTED(HAVE_LIBHISTORY) - have_libhistory=true + ac_cv_libhistory=-lhistory ]) - AM_CONDITIONAL(HAVE_LIBHISTORY, test x$have_libhistory = xtrue) fi +LIBHISTORY=${ac_cv_libhistory} +AC_SUBST(LIBHISTORY) dnl these three are for solaris AC_CHECK_LIB(socket, socket) @@ -278,6 +279,7 @@ AC_OUTPUT( kde2/doc/de/Makefile plpbackup/Makefile plpprint/Makefile + sisinstall/Makefile doc/Makefile doc/api/Makefile include/config.h 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 -// -// 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 + * Copyright (C) 1999-2001 Fritz Elfert + * + * 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 + * Copyright (C) 1999-2001 Fritz Elfert + * + * 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 @@ -19,3 +39,9 @@ extern void rlcrap_setpointers(CorrectFunProto, CorrectFunProto); } #endif #endif + +/* + * Local variables: + * c-basic-offset: 4 + * End: + */ -- cgit v1.2.3