From 52fa7836b70d84ff13904d922c816ab8f1808768 Mon Sep 17 00:00:00 2001
From: dockes
Date: Tue, 13 Dec 2005 12:43:00 +0000
Subject: [PATCH] pgup/down in result list
---
packaging/FreeBSD/recoll/Makefile | 23 ++++++-----
packaging/FreeBSD/recoll/distinfo | 6 +--
packaging/FreeBSD/recoll/pkg-descr | 2 +
packaging/FreeBSD/recoll/pkg-plist | 56 +++++++++++++-------------
src/common/rclconfig.cpp | 31 ++++++---------
src/doc/prog/Doxyfile | 2 +-
src/doc/prog/Makefile | 2 +-
src/doc/prog/filters.txt | 10 ++---
src/qtgui/main.cpp | 36 +++++++----------
src/qtgui/recollmain.ui | 2 +
src/qtgui/recollmain.ui.h | 63 ++++++++++++++++++++++++------
src/rcldb/rcldb.cpp | 5 +--
src/utils/fstreewalk.cpp | 5 +--
src/utils/pathut.cpp | 14 ++++++-
src/utils/pathut.h | 13 ++----
src/utils/smallut.cpp | 6 +--
src/utils/wipedir.cpp | 5 +--
17 files changed, 157 insertions(+), 124 deletions(-)
diff --git a/packaging/FreeBSD/recoll/Makefile b/packaging/FreeBSD/recoll/Makefile
index 1b737e3b..83ee2d5c 100644
--- a/packaging/FreeBSD/recoll/Makefile
+++ b/packaging/FreeBSD/recoll/Makefile
@@ -5,18 +5,21 @@
# $FreeBSD$
#
-PORTNAME= recoll
-PORTVERSION= 1.0.13
-CATEGORIES= deskutils
-MASTER_SITES= http://www.lesbonscomptes.com/recoll/
+PORTNAME= recoll
+PORTVERSION= 1.0.14
+CATEGORIES= deskutils
+MASTER_SITES= http://www.lesbonscomptes.com/recoll/
-MAINTAINER= jean-francois.dockes@wanadoo.fr
-COMMENT= A personal full text search package, based on QT and Xapian
+MAINTAINER= jean-francois.dockes@wanadoo.fr
+COMMENT= A personal full text search package, based on QT and Xapian
-LIB_DEPENDS= xapian.8:${PORTSDIR}/databases/xapian-core \
- qt-mt.3:${PORTSDIR}/x11-toolkits/qt33
+BUILD_DEPENDS= qmake:${PORTSDIR}/devel/qmake
+LIB_DEPENDS= xapian.8:${PORTSDIR}/databases/xapian-core \
+ qt-mt.3:${PORTSDIR}/x11-toolkits/qt33
-GNU_CONFIGURE= yes
-USE_GMAKE= yes
+USE_QT_VER= 3
+MAKE_ENV= QTDIR="${QT_PREFIX}" QMAKESPEC="freebsd-g++"
+GNU_CONFIGURE= yes
+USE_GMAKE= yes
.include
diff --git a/packaging/FreeBSD/recoll/distinfo b/packaging/FreeBSD/recoll/distinfo
index dbc4d015..33897885 100644
--- a/packaging/FreeBSD/recoll/distinfo
+++ b/packaging/FreeBSD/recoll/distinfo
@@ -1,3 +1,3 @@
-MD5 (recoll-1.0.13.tar.gz) = b4fd87b467e25e8f6ec96e86a8196181
-SHA256 (recoll-1.0.13.tar.gz) = d8407c5090a35e6196f4cef6b9f787f94e89a2746f995010b3b7ac6af9cb6bd7
-SIZE (recoll-1.0.13.tar.gz) = 328105
+MD5 (recoll-1.0.14.tar.gz) = 223037883f26294405491e0e2c8ab33b
+SHA256 (recoll-1.0.14.tar.gz) = 0552c467c2c1c8eedc98a1fcc457304e29f080c2afe11fad5c55b88b4cf3548f
+SIZE (recoll-1.0.14.tar.gz) = 328158
diff --git a/packaging/FreeBSD/recoll/pkg-descr b/packaging/FreeBSD/recoll/pkg-descr
index 546f9cf7..8fd0397d 100644
--- a/packaging/FreeBSD/recoll/pkg-descr
+++ b/packaging/FreeBSD/recoll/pkg-descr
@@ -20,3 +20,5 @@ Features:
necessary.
* An indexer which runs either as a thread inside the GUI or as an
external, cron'able program.
+
+WWW: http://www.lesbonscomptes.com/recoll/
diff --git a/packaging/FreeBSD/recoll/pkg-plist b/packaging/FreeBSD/recoll/pkg-plist
index 6e1d94eb..1ba32970 100644
--- a/packaging/FreeBSD/recoll/pkg-plist
+++ b/packaging/FreeBSD/recoll/pkg-plist
@@ -1,30 +1,30 @@
bin/recoll
bin/recollindex
-share/recoll/examples/mimeconf
-share/recoll/examples/mimemap
-share/recoll/examples/recoll.conf
-share/recoll/filters/rcldoc
-share/recoll/filters/rclgaim
-share/recoll/filters/rclpdf
-share/recoll/filters/rclps
-share/recoll/filters/rclrtf
-share/recoll/filters/rclsoff
-share/recoll/filters/rcluncomp
-share/recoll/images/document.png
-share/recoll/images/drawing.png
-share/recoll/images/html.png
-share/recoll/images/message.png
-share/recoll/images/mozilla_doc.png
-share/recoll/images/pdf.png
-share/recoll/images/postscript.png
-share/recoll/images/presentation.png
-share/recoll/images/soffice.png
-share/recoll/images/spreadsheet.png
-share/recoll/images/txt.png
-share/recoll/images/wordprocessing.png
-share/recoll/translations/recoll_fr.qm
-@dirrm share/recoll/examples
-@dirrm share/recoll/filters
-@dirrm share/recoll/images
-@dirrm share/recoll/translations
-@dirrm share/recoll
+%%DATADIR%%/examples/mimeconf
+%%DATADIR%%/examples/mimemap
+%%DATADIR%%/examples/recoll.conf
+%%DATADIR%%/filters/rcldoc
+%%DATADIR%%/filters/rclgaim
+%%DATADIR%%/filters/rclpdf
+%%DATADIR%%/filters/rclps
+%%DATADIR%%/filters/rclrtf
+%%DATADIR%%/filters/rclsoff
+%%DATADIR%%/filters/rcluncomp
+%%DATADIR%%/images/document.png
+%%DATADIR%%/images/drawing.png
+%%DATADIR%%/images/html.png
+%%DATADIR%%/images/message.png
+%%DATADIR%%/images/mozilla_doc.png
+%%DATADIR%%/images/pdf.png
+%%DATADIR%%/images/postscript.png
+%%DATADIR%%/images/presentation.png
+%%DATADIR%%/images/soffice.png
+%%DATADIR%%/images/spreadsheet.png
+%%DATADIR%%/images/txt.png
+%%DATADIR%%/images/wordprocessing.png
+%%DATADIR%%/translations/recoll_fr.qm
+@dirrm %%DATADIR%%/examples
+@dirrm %%DATADIR%%/filters
+@dirrm %%DATADIR%%/images
+@dirrm %%DATADIR%%/translations
+@dirrm %%DATADIR%%
diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp
index 88f28227..e313d666 100644
--- a/src/common/rclconfig.cpp
+++ b/src/common/rclconfig.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.16 2005-12-05 14:09:16 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.17 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include
#include
@@ -9,12 +9,11 @@ static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.16 2005-12-05 14:09:16 dockes E
#include
-#include "rclconfig.h"
#include "pathut.h"
+#include "rclconfig.h"
#include "conftree.h"
#include "debuglog.h"
#include "smallut.h"
-#include "pathut.h"
#include "copyfile.h"
#ifndef NO_NAMESPACES
@@ -29,8 +28,7 @@ static bool createConfig(string &reason)
const char *cprefix = getenv("RECOLL_PREFIX");
if (cprefix == 0)
cprefix = RECOLL_PREFIX;
- string prefix(cprefix);
- path_cat(prefix, "share/recoll/examples");
+ string prefix = path_cat(cprefix, "share/recoll/examples");
string recolldir = path_tildexpand("~/.recoll");
if (mkdir(recolldir.c_str(), 0755) < 0) {
@@ -39,10 +37,8 @@ static bool createConfig(string &reason)
return false;
}
for (int i = 0; i < ncffiles; i++) {
- string src = prefix;
- path_cat(src, string(configfiles[i]));
- string dst = recolldir;
- path_cat(dst, string(configfiles[i]));
+ string src = path_cat((const string&)prefix, string(configfiles[i]));
+ string dst = path_cat((const string&)recolldir, string(configfiles[i]));
if (!copyfile(src.c_str(), dst.c_str(), reason)) {
LOGERR(("Copyfile failed: %s\n", reason.c_str()));
return false;
@@ -70,8 +66,7 @@ RclConfig::RclConfig()
confdir = path_home();
confdir += ".recoll/";
}
- string cfilename = confdir;
- path_cat(cfilename, "recoll.conf");
+ string cfilename = path_cat(confdir, "recoll.conf");
if (access(confdir.c_str(), 0) != 0 || access(cfilename.c_str(), 0) != 0) {
if (!createConfig(reason))
@@ -92,8 +87,7 @@ RclConfig::RclConfig()
if (!conf->get("mimemapfile", mimemapfile, "")) {
mimemapfile = "mimemap";
}
- string mpath = confdir;
- path_cat(mpath, mimemapfile);
+ string mpath = path_cat(confdir, mimemapfile);
mimemap = new ConfTree(mpath.c_str(), true);
if (mimemap == 0 ||
(mimemap->getStatus() != ConfSimple::STATUS_RO &&
@@ -108,8 +102,7 @@ RclConfig::RclConfig()
if (!conf->get("mimeconffile", mimeconffile, "")) {
mimeconffile = "mimeconf";
}
- mpath = confdir;
- path_cat(mpath, mimeconffile);
+ mpath = path_cat(confdir, mimeconffile);
mimeconf = new ConfTree(mpath.c_str(), true);
if (mimeconf == 0 ||
(mimeconf->getStatus() != ConfSimple::STATUS_RO &&
@@ -230,17 +223,15 @@ string find_filter(RclConfig *conf, const string &icmd)
const char *cp;
if (cp = getenv("RECOLL_FILTERSDIR")) {
- cmd = cp;
- path_cat(cmd, icmd);
+ cmd = path_cat(cp, icmd);
if (access(cmd.c_str(), X_OK) == 0)
return cmd;
} else if (conf->getConfParam(string("filtersdir"), cmd)) {
- path_cat(cmd, icmd);
+ cmd = path_cat(cmd, icmd);
if (access(cmd.c_str(), X_OK) == 0)
return cmd;
} else {
- cmd = conf->getConfDir();
- path_cat(cmd, icmd);
+ cmd = path_cat(conf->getConfDir(), icmd);
if (access(cmd.c_str(), X_OK) == 0)
return cmd;
}
diff --git a/src/doc/prog/Doxyfile b/src/doc/prog/Doxyfile
index e6608386..d57dced8 100644
--- a/src/doc/prog/Doxyfile
+++ b/src/doc/prog/Doxyfile
@@ -606,7 +606,7 @@ GENERATE_HTML = YES
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
-HTML_OUTPUT = html
+HTML_OUTPUT = docprog_html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
diff --git a/src/doc/prog/Makefile b/src/doc/prog/Makefile
index 96b8af71..926acf16 100644
--- a/src/doc/prog/Makefile
+++ b/src/doc/prog/Makefile
@@ -1,5 +1,5 @@
documentation:
doxygen Doxyfile
clean:
- rm -f html/*
+ rm -f docprog_html/*
diff --git a/src/doc/prog/filters.txt b/src/doc/prog/filters.txt
index 75396a78..67cff502 100644
--- a/src/doc/prog/filters.txt
+++ b/src/doc/prog/filters.txt
@@ -22,7 +22,7 @@ external filter, which will probably be the simpler solution in most cases.
\section extfilts External filters
Filters are programs (usually shell scripts) that will turn a document of
-foreign type into something that Recoll can understand. Html was chosen as
+foreign type into something that Recoll can understand. HTML was chosen as
a pivot format for its ability to carry structured information.
The meta-information tags that Recoll will use at the moment are the
@@ -33,15 +33,15 @@ following:
- keywords
- description
-For an example, you can take a look, at rclsoff which translates openoffice
-documents.
+For an example, you can take a look at the rclsoff filter which translates
+openoffice documents.
The filter is executed with the input file name as a parameter and should
output the result to stdout.
\section extassoc Associating a filter to a mime type
-This is done in mimeconf. Take a look at the file, the format is
-self-explanatory.
+This is done in the mimeconf configuration file. Take a look at the file,
+the format is self-explanatory.
*/
diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp
index 363e9c04..78ed0209 100644
--- a/src/qtgui/main.cpp
+++ b/src/qtgui/main.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: main.cpp,v 1.21 2005-12-05 14:57:54 dockes Exp $ (C) 2005 J.F.Dockes";
+static char rcsid[] = "@(#$Id: main.cpp,v 1.22 2005-12-13 12:42:59 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include
@@ -38,6 +38,8 @@ bool showicons;
string iconsdir;
RclDHistory *history;
+static string dbdir;
+
void getQueryStemming(bool &dostem, std::string &stemlang)
{
string param;
@@ -51,20 +53,14 @@ void getQueryStemming(bool &dostem, std::string &stemlang)
bool maybeOpenDb(string &reason)
{
- if (!rcldb)
+ if (!rcldb) {
+ reason = "Internal error: db not created";
+ return false;
+ }
+ if (!rcldb->isopen() && !rcldb->open(dbdir, Rcl::Db::DbRO)) {
+ reason = "Could not open database in " +
+ dbdir + " wait for indexing to complete?";
return false;
- if (!rcldb->isopen()) {
- string dbdir;
- if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
- reason = "No db directory in configuration";
- return false;
- }
- dbdir = path_tildexpand(dbdir);
- if (!rcldb->open(dbdir, Rcl::Db::DbRO)) {
- reason = "Could not open database in " +
- dbdir + " wait for indexing to complete?";
- return false;
- }
}
return true;
}
@@ -134,7 +130,6 @@ int main( int argc, char ** argv )
exit(1);
}
- string dbdir;
if (rclconfig->getConfParam(string("dbdir"), dbdir) == 0) {
// Note: this will have to be replaced by a call to a
// configuration buildin dialog for initial configuration
@@ -143,10 +138,10 @@ int main( int argc, char ** argv )
"No db directory in configuration"));
exit(1);
}
+ dbdir = path_tildexpand(dbdir);
// Translations for Recoll
- string translatdir = string(recollsharedir);
- path_cat(translatdir, "translations");
+ string translatdir = path_cat(recollsharedir, "translations");
QTranslator translator( 0 );
// QTextCodec::locale() returns $LANG
translator.load( QString("recoll_") + QTextCodec::locale(),
@@ -157,8 +152,7 @@ int main( int argc, char ** argv )
rclconfig->getConfParam("showicons", &showicons);
rclconfig->getConfParam("iconsdir", iconsdir);
if (iconsdir.empty()) {
- iconsdir = string(recollsharedir);
- path_cat(iconsdir, "images");
+ iconsdir = path_cat(recollsharedir, "images");
} else {
iconsdir = path_tildexpand(iconsdir);
}
@@ -170,11 +164,9 @@ int main( int argc, char ** argv )
exit(1);
}
- string historyfile = rclconfig->getConfDir();
- path_cat(historyfile, "history");
+ string historyfile = path_cat(rclconfig->getConfDir(), "history");
history = new RclDHistory(historyfile);
- dbdir = path_tildexpand(dbdir);
rcldb = new Rcl::Db;
diff --git a/src/qtgui/recollmain.ui b/src/qtgui/recollmain.ui
index 85802544..f875504e 100644
--- a/src/qtgui/recollmain.ui
+++ b/src/qtgui/recollmain.ui
@@ -398,6 +398,8 @@
reslistTE_delayedclick()
startSimpleSearch()
startAdvSearch( Rcl::AdvSearchData sdata )
+ resPageUpOrBack()
+ resPageDownOrNext()
resultPageBack()
showResultPage()
previewClosed( Preview * w )
diff --git a/src/qtgui/recollmain.ui.h b/src/qtgui/recollmain.ui.h
index f38e9428..da788761 100644
--- a/src/qtgui/recollmain.ui.h
+++ b/src/qtgui/recollmain.ui.h
@@ -66,7 +66,12 @@ void RecollMain::init()
sortform = 0;
docsource = 0;
sortwidth = 0;
+
+ // We manage pgup/down, but let ie the arrows for the editor to process
+ reslistTE->installEventFilter(this);
reslistTE->viewport()->installEventFilter(this);
+ // reslistTE->viewport()->setFocusPolicy(QWidget::NoFocus);
+
}
// We also want to get rid of the advanced search form and previews
@@ -78,7 +83,8 @@ bool RecollMain::close(bool)
return false;
}
-#if 0
+//#define SHOWEVENTS
+#if defined(SHOWEVENTS)
static const char *eventTypeToStr(int tp)
{
switch (tp) {
@@ -167,12 +173,20 @@ static const char *eventTypeToStr(int tp)
// ^Q thing is necessary (we have an action for this)?
bool RecollMain::eventFilter( QObject * target, QEvent * event )
{
- // LOGDEB(("RecollMain::eventFilter target %p, event %s\n", target,
- // eventTypeToStr(int(event->type()))));
+#if defined(SHOWEVENTS)
+ LOGDEB(("RecollMain::eventFilter target %p, event %s\n", target,
+ eventTypeToStr(int(event->type()))));
+#endif
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = (QKeyEvent *)event;
if (keyEvent->key() == Key_Q && (keyEvent->state() & ControlButton)) {
recollNeedsExit = 1;
+ } else if (keyEvent->key() == Key_Prior) {
+ resPageUpOrBack();
+ return true;
+ } else if (keyEvent->key() == Key_Next) {
+ resPageDownOrNext();
+ return true;
}
} else if (target == reslistTE->viewport()) {
// We don't want btdown+drag+btup to be a click ! So monitor
@@ -413,6 +427,28 @@ void RecollMain::startAdvSearch(Rcl::AdvSearchData sdata)
showResultPage();
}
+// Page Up/Down: we don't try to check if current paragraph is last or
+// first. We just page up/down and check if viewport moved. If it did,
+// fair enough, else we go to next/previous result page.
+void RecollMain::resPageUpOrBack()
+{
+ int vpos = reslistTE->contentsY();
+ reslistTE->moveCursor(QTextEdit::MovePgUp, false);
+ if (vpos == reslistTE->contentsY())
+ resultPageBack();
+}
+void RecollMain::resPageDownOrNext()
+{
+ int vpos = reslistTE->contentsY();
+ reslistTE->moveCursor(QTextEdit::MovePgDown, false);
+ LOGDEB(("RecollMain::resPageDownOrNext: vpos before %d, after %d\n",
+ vpos, reslistTE->contentsY()));
+ if (vpos == reslistTE->contentsY())
+ showResultPage();
+}
+
+// Show previous page of results. We just set the current number back
+// 2 pages and show next page.
void RecollMain::resultPageBack()
{
if (reslist_winfirst <= 0)
@@ -457,9 +493,15 @@ void RecollMain::showResultPage()
int last = MIN(resCnt-reslist_winfirst, respagesize);
- string alltext;
- // Insert results if any in result list window
+ // Insert results if any in result list window. We have to send
+ // the text to the widgets, because we need the paragraph number
+ // each time we add a result paragraph (its diffult and
+ // error-prone to compute the paragraph numbers in parallel. We
+ // would like to disable updates while we're doing this, but
+ // couldn't find a way to make it work, the widget seems to become
+ // confused if appended while updates are disabled
+ // reslistTE->setUpdatesEnabled(false);
for (int i = 0; i < last; i++) {
string sh;
doc.erase();
@@ -477,13 +519,11 @@ void RecollMain::showResultPage()
QString line = "";
line += docsource->title().c_str();
line += "
";
- //alltext.append(line.utf8());
reslistTE->append(line);
line = tr("Displaying results starting at index"
" %1 (maximum set size %2)
\n")
.arg(reslist_winfirst+1)
.arg(resCnt);
- //alltext.append(line.utf8());
reslistTE->append(line);
}
@@ -544,7 +584,6 @@ void RecollMain::showResultPage()
"" + doc.url + +"
\n";
QString str = QString::fromUtf8(result.c_str(), result.length());
- //alltext.append(str.utf8());
reslistTE->append(str);
pageParaToReldocnums[reslistTE->paragraphs()-1] = i;
@@ -559,14 +598,16 @@ void RecollMain::showResultPage()
} else {
// Restore first in win parameter that we shouln't have incremented
reslistTE->append(tr(""
- /*"
"*/
- "No results found"
- "
"));
+ /*"
"*/
+ "No results found"
+ "
"));
reslist_winfirst -= respagesize;
if (reslist_winfirst < 0)
reslist_winfirst = -1;
}
+ //reslistTE->setUpdatesEnabled(true);reslistTE->sync();reslistTE->repaint();
+
#if 0
{
FILE *fp = fopen("/tmp/reslistdebug", "w");
diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp
index 2e28f35b..bd606bb2 100644
--- a/src/rcldb/rcldb.cpp
+++ b/src/rcldb/rcldb.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.43 2005-12-05 10:39:20 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: rcldb.cpp,v 1.44 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#include
#include
@@ -501,8 +501,7 @@ bool Rcl::Db::needUpdate(const string &filename, const struct stat *stp)
/// Compute name of stem db for given base database and language
static string stemdbname(const string& basename, string lang)
{
- string nm = basename;
- path_cat(nm, string("stem_") + lang);
+ string nm = path_cat(basename, string("stem_") + lang);
return nm;
}
diff --git a/src/utils/fstreewalk.cpp b/src/utils/fstreewalk.cpp
index 1a4aeeda..c755d120 100644
--- a/src/utils/fstreewalk.cpp
+++ b/src/utils/fstreewalk.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: fstreewalk.cpp,v 1.6 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_FSTREEWALK
@@ -128,8 +128,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string &top,
}
{
- string fn = top;
- path_cat(fn, ent->d_name);
+ string fn = path_cat(top, ent->d_name);
struct stat st;
int statret = (data->options & FtwFollow) ? stat(fn.c_str(), &st) :
diff --git a/src/utils/pathut.cpp b/src/utils/pathut.cpp
index 8802498c..51a2c265 100644
--- a/src/utils/pathut.cpp
+++ b/src/utils/pathut.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: pathut.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: pathut.cpp,v 1.6 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_PATHUT
@@ -12,6 +12,18 @@ static char rcsid[] = "@(#$Id: pathut.cpp,v 1.5 2005-11-24 07:16:16 dockes Exp $
using std::string;
#endif /* NO_NAMESPACES */
+void path_catslash(std::string &s) {
+ if (s.empty() || s[s.length() - 1] != '/')
+ s += '/';
+}
+
+std::string path_cat(const std::string &s1, const std::string &s2) {
+ std::string res = s1;
+ path_catslash(res);
+ res += s2;
+ return res;
+}
+
string path_getfather(const string &s) {
string father = s;
diff --git a/src/utils/pathut.h b/src/utils/pathut.h
index e5e2666e..13425a05 100644
--- a/src/utils/pathut.h
+++ b/src/utils/pathut.h
@@ -1,18 +1,11 @@
#ifndef _PATHUT_H_INCLUDED_
#define _PATHUT_H_INCLUDED_
-/* @(#$Id: pathut.h,v 1.3 2005-01-31 14:31:10 dockes Exp $ (C) 2004 J.F.Dockes */
+/* @(#$Id: pathut.h,v 1.4 2005-12-13 12:42:59 dockes Exp $ (C) 2004 J.F.Dockes */
#include
-inline void path_catslash(std::string &s) {
- if (s.empty() || s[s.length() - 1] != '/')
- s += '/';
-}
-inline void path_cat(std::string &s1, const std::string &s2) {
- path_catslash(s1);
- s1 += s2;
-}
-
+extern void path_catslash(std::string &s);
+extern std::string path_cat(const std::string &s1, const std::string &s2);
extern std::string path_getsimple(const std::string &s);
extern std::string path_getfather(const std::string &s);
extern std::string path_home();
diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp
index 1bc23896..6b02c30e 100644
--- a/src/utils/smallut.cpp
+++ b/src/utils/smallut.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: smallut.cpp,v 1.10 2005-11-25 14:36:45 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: smallut.cpp,v 1.11 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_SMALLUT
#include
@@ -27,8 +27,8 @@ bool maketmpdir(string& tdir)
tmpdir = getenv("TMPDIR");
if (!tmpdir)
tmpdir = "/tmp";
- tdir = tmpdir;
- path_cat(tdir, "rcltmpXXXXXX");
+ tdir = path_cat(tmpdir, "rcltmpXXXXXX");
+
{
char *cp = strdup(tdir.c_str());
if (!cp) {
diff --git a/src/utils/wipedir.cpp b/src/utils/wipedir.cpp
index 5372567d..e4525e63 100644
--- a/src/utils/wipedir.cpp
+++ b/src/utils/wipedir.cpp
@@ -1,5 +1,5 @@
#ifndef lint
-static char rcsid[] = "@(#$Id: wipedir.cpp,v 1.3 2005-11-24 07:16:16 dockes Exp $ (C) 2004 J.F.Dockes";
+static char rcsid[] = "@(#$Id: wipedir.cpp,v 1.4 2005-12-13 12:43:00 dockes Exp $ (C) 2004 J.F.Dockes";
#endif
#ifndef TEST_WIPEDIR
@@ -50,8 +50,7 @@ int wipedir(const string& dir)
if (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
continue;
- string fn = dir;
- path_cat(fn, ent->d_name);
+ string fn = path_cat(dir, ent->d_name);
struct stat st;
int statret = stat(fn.c_str(), &st);