diff --git a/packaging/FreeBSD/recoll/Makefile b/packaging/FreeBSD/recoll/Makefile index b2f77e50..562d51c1 100644 --- a/packaging/FreeBSD/recoll/Makefile +++ b/packaging/FreeBSD/recoll/Makefile @@ -1,6 +1,6 @@ # New ports collection makefile for: recoll # Date created: 5 December 2005 -# Whom: J.F. Dockes +# Whom: J.F. Dockes # # $FreeBSD$ # @@ -18,7 +18,7 @@ LIB_DEPENDS= xapian.8:${PORTSDIR}/databases/xapian-core \ qt-mt.3:${PORTSDIR}/x11-toolkits/qt33 USE_QT_VER= 3 -MAKE_ENV= QTDIR="${QT_PREFIX}" QMAKESPEC="freebsd-g++" +MAKE_ENV= QTDIR="${QT_PREFIX}" QMAKESPEC="freebsd-g++" GNU_CONFIGURE= yes USE_GMAKE= yes diff --git a/src/Makefile b/src/Makefile index 50e4b850..82e821c3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,20 +1,18 @@ -# @(#$Id: Makefile,v 1.25 2006-01-14 11:48:03 dockes Exp $ (C) 2005 J.F.Dockes +# @(#$Id: Makefile,v 1.26 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes all: mk/sysconf common/rclversion.h cd lib; ${MAKE} cd bincimapmime; ${MAKE} cd index; ${MAKE} recollindex cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ - cat ../mk/sysconf Makefile | \ - ${MAKE} -f - + cat ../mk/sysconf Makefile | ${MAKE} -f - depth=.. mk/sysconf: ./configure common/rclversion.h: VERSION - (echo -n "static const char *rclversion= \"" && \ - echo -n `cat VERSION` && \ - echo "\";") > common/rclversion.h + echo 'static const char *rclversion = "'`cat VERSION`'";' \ + > common/rclversion.h static: cd lib; ${MAKE} @@ -22,9 +20,9 @@ static: cd index; rm -f recollindex; \ ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ - rm -f recoll; \ - cat ../mk/sysconf ../mk/localdefs Makefile | ${MAKE} -f - \ - BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic + rm -f recoll; + cat ../mk/sysconf Makefile | \ + ${MAKE} -f - BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic depth=.. clean: cd common; ${MAKE} clean @@ -38,7 +36,10 @@ clean: rm -f qtgui/Makefile qtgui/preview/Makefile qtgui/recoll distclean: clean - rm -f mk/sysconf mk/localdefs sampleconf/recoll.conf recollinstall + rm -f mk/sysconf mk/localdefs sampleconf/recoll.conf \ + recollinstall \ + doc/user/*.html* doc/user/*.txt doc/user/HTML.manifest + install: all bindir=${bindir} datadir=${datadir} ./recollinstall ${prefix} diff --git a/src/VERSION b/src/VERSION index 9084fa2f..26aaba0e 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -1.1.0 +1.2.0 diff --git a/src/bincimapmime/Makefile b/src/bincimapmime/Makefile index d330950d..af3f49d5 100644 --- a/src/bincimapmime/Makefile +++ b/src/bincimapmime/Makefile @@ -1,3 +1,7 @@ +# @(#$Id: Makefile,v 1.6 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes + +depth = .. +include $(depth)/mk/sysconf LIBS = libmime.a PROGS = trbinc @@ -15,8 +19,8 @@ OBJS = mime-getpart.o mime-parsefull.o mime-parseonlyheader.o \ libmime.a : $(OBJS) $(AR) ru libmime.a $(OBJS) -.cc .o : - $(CXX) $(CXXFLAGS) -c $< +.cc.o: + $(CXX) $(ALL_CXXFLAGS) -c $< TRBINCOBJS = trbinc.o trbinc: trbinc.o @@ -24,7 +28,7 @@ trbinc: trbinc.o depend: alldeps.stamp alldeps.stamp : $(SRCS) - $(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps + $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps touch alldeps.stamp clean: @@ -32,5 +36,4 @@ clean: rm -f alldeps.stamp rm -f ${LIBS} ${PROGS} ${OBJS} -include ../mk/sysconf include alldeps diff --git a/src/common/Makefile b/src/common/Makefile index 762c00bc..866dd828 100644 --- a/src/common/Makefile +++ b/src/common/Makefile @@ -1,6 +1,6 @@ -# @(#$Id: Makefile,v 1.8 2006-01-06 13:18:17 dockes Exp $ (C) 2005 J.F.Dockes - -include ../mk/sysconf +# @(#$Id: Makefile,v 1.9 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes +depth = .. +include $(depth)/mk/sysconf # Only test executables get build in here PROGS = internfile unacpp textsplit @@ -8,28 +8,28 @@ PROGS = internfile unacpp textsplit all: $(BIGLIB) $(PROGS) $(BIGLIB): - cd ../lib;$(MAKE) + cd $(depth)/lib;$(MAKE) UNACPP_OBJS= trunacpp.o $(BIGLIB) unacpp : $(UNACPP_OBJS) - $(CXX) $(CXXFLAGS) -o unacpp $(UNACPP_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o unacpp $(UNACPP_OBJS) \ $(LIBICONV) trunacpp.o : unacpp.cpp unacpp.h - $(CXX) $(CXXFLAGS) -DTEST_UNACPP -c -o trunacpp.o unacpp.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_UNACPP -c -o trunacpp.o unacpp.cpp TEXTSPLIT_OBJS= trtextsplit.o $(BIGLIB) textsplit : $(TEXTSPLIT_OBJS) - $(CXX) $(CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS) + $(CXX) $(ALL_CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS) trtextsplit.o : textsplit.cpp - $(CXX) $(CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \ + $(CXX) $(ALL_CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \ textsplit.cpp INTERNFILE_OBJS= trinternfile.o $(BIGLIB) $(MIMELIB) internfile : $(INTERNFILE_OBJS) - $(CXX) $(CXXFLAGS) -o internfile $(INTERNFILE_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o internfile $(INTERNFILE_OBJS) \ $(LIBICONV) $(LIBSYS) trinternfile.o : internfile.cpp - $(CXX) $(CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \ + $(CXX) $(ALL_CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \ internfile.cpp clean: diff --git a/src/doc/user/usermanual.sgml b/src/doc/user/usermanual.sgml index 21220a1a..8f3a9f07 100644 --- a/src/doc/user/usermanual.sgml +++ b/src/doc/user/usermanual.sgml @@ -24,7 +24,7 @@ Dockes - $Id: usermanual.sgml,v 1.3 2006-01-11 15:08:21 dockes Exp $ + $Id: usermanual.sgml,v 1.4 2006-01-19 12:01:42 dockes Exp $ This document introduces full text search notions @@ -484,11 +484,40 @@ Building &RCL; has been built on - Linux (redhat7.3, mandriva 2005), FreeBSD and Solaris 8. If - you build on another system, I would very - much welcome patches. - + Linux (redhat7.3, mandriva 2005, Fedora Core 3), FreeBSD and + Solaris 8. If you build on another system, I would very much + welcome patches. + + Depending on the qt + configuration on your system, you may have to set the + QTDIR and QMAKESPECS + variables in your environment: + + QTDIR should point to the + directory above the one that holds the qt include files (ie: + qt.h). + + QMAKESPECS should + be set to the name of one of the + qt mkspecs subdirectories (ie: + linux-g++). + + + + On many Linux systems, QTDIR is set + by the login scripts, and QMAKESPECS is not + needed because there is a default link in + mkspecs/. + + The &RCL; configure script does a + better job of checking these variables after release + 1.1.1. Before this, unexplained errors will occur during + compilation if the environment is not set up. Also, for 1.1.0 the + qmake command should be in your PATH (later + releases can also find it in + $QTDIR/bin). + Normal procedure: cd recoll-xxx @@ -647,22 +676,38 @@ skippedNames - A space-separated list of patterns for - names of files or directories that should be completely - ignored. The list defined in the default file is: + + A space-separated list of patterns for + names of files or directories that should be completely + ignored. The list defined in the default file is: *~ #* bin CVS Cache caughtspam tmp - The list can be redefined for subdirectories, but is only - actually changed for the top level ones in - topdirs + The list can be redefined for subdirectories, but is only + actually changed for the top level ones in + topdirs. + The top-level directories are not affected by this + list (that is, a directory in topdirs + might match and would still be indexed). + The list in the default configuration does not + exclude hidden directories (names beginning with a + dot), which means that it may index quite a few things + that you do not want. On the other hand, mail user + agents like thunderbird + usually store messages in hidden directories, and you + probably want this indexed. One possible solution is to + have .* in + skippedNames, and add things like + ~/.thunderbird or + ~/.evolution in + topdirs. loglevel Verbosity level for recoll and recollindex. A value of 4 lists quite a lot of - debug/information messages. 3 only lists errors. + debug/information messages. 2 only lists errors. @@ -758,6 +803,15 @@ should be handled specially, which is possible because they are usually all located in one place. + mimemap also has a + recoll_noindex variable which is a list of + suffixes. Matching files will be skipped (avoids unnecessary + decompressions or file executions). This is + partially redundant with skippedNames in + the main configuration file, with two differences: it will not + affect directories, and it can be changed for any + subdirectory. + diff --git a/src/index/Makefile b/src/index/Makefile index 73c9334a..aa178cd5 100644 --- a/src/index/Makefile +++ b/src/index/Makefile @@ -1,4 +1,5 @@ -include ../mk/sysconf +depth = .. +include $(depth)/mk/sysconf PROGS = recollindex csguess mimetype SRCS = recollindex.cpp @@ -7,35 +8,35 @@ all: depend $(PROGS) RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB) recollindex : $(RECOLLINDEX_OBJS) - $(CXX) $(CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \ $(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) $(LIBSYS) recollindex.o : recollindex.cpp - $(CXX) $(CXXFLAGS) -c -o recollindex.o $< + $(CXX) $(ALL_CXXFLAGS) -c -o recollindex.o $< CSGUESS_OBJS= trcsguess.o $(BIGLIB) csguess : $(CSGUESS_OBJS) - $(CXX) $(CXXFLAGS) -o csguess $(CSGUESS_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o csguess $(CSGUESS_OBJS) \ $(LIBICONV) trcsguess.o : csguess.cpp - $(CXX) $(CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \ + $(CXX) $(ALL_CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \ csguess.cpp MIMETYPE_OBJS= trmimetype.o $(BIGLIB) mimetype : $(MIMETYPE_OBJS) - $(CXX) $(CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \ $(LIBICONV) $(LIBSYS) trmimetype.o : mimetype.cpp - $(CXX) $(CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \ + $(CXX) $(ALL_CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \ mimetype.cpp $(BIGLIB): - cd ../lib;$(MAKE) + cd $(depth)/lib;$(MAKE) $(MIMELIB): - cd ../bincimapmime;$(MAKE) + cd $(depth)/bincimapmime;$(MAKE) depend: alldeps.stamp alldeps.stamp : $(SRCS) - $(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps + $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps touch alldeps.stamp clean: diff --git a/src/kde/kioslave/recoll/Makefile b/src/kde/kioslave/recoll/Makefile index ba044133..a5ba3368 100644 --- a/src/kde/kioslave/recoll/Makefile +++ b/src/kde/kioslave/recoll/Makefile @@ -1,6 +1,14 @@ +depth=../.. +include $(depth)/mk/sysconf + +all: kio_recoll.so + DEPS_CXXFLAGS = -MT pop3.lo -MD -MP -MF .deps/pop3.Tpo -INC_CXXFLAGS = -I. -I/usr/local/include -I/usr/X11R6/include +INC_CXXFLAGS = -I. -I/usr/local/include -I/usr/X11R6/include \ + -I$(depth)/common -I$(depth)/query -I$(depth)/utils \ + -I$(depth)/qtgui + PIC_CXXFLAGS = -fPIC -DPIC DEBUG_CXXFLAGS = -DNDEBUG -DNO_DEBUG -O2 -O LANG_CXXFLAGS = -fno-exceptions -fno-check-new -fno-common @@ -15,14 +23,18 @@ LDFLAGS = -rpath=/usr/lib:/usr/local/lib \ -Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so THREAD_LDFLAGS = -pthread -kio_recoll.so : kio_recoll.o - c++ -shared $(LDFLAGS) $(THREAD_LDFLAGS) kio_recoll.o \ +kio_recoll.so : kio_recoll.o piclib/librcl.a + c++ -shared $(LDFLAGS) $(THREAD_LDFLAGS) \ + -Wl,--no-undefined \ + kio_recoll.o piclib/librcl.a \ + $(LIBXAPIAN) $(LIBICONV) \ -L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdeui -lkdesu \ -lkdecore \ -lDCOP \ -lqt-mt \ -lpng -lXext -lX11 -lSM -lICE -lXrender \ -lz -lfam -lsasl2 -ljpeg -L/usr/lib -lstdc++ -lm \ + -lstdc++ -lc \ -o kio_recoll.so kio_recoll.o : kio_recoll.cpp kio_recoll.h @@ -30,3 +42,8 @@ kio_recoll.o : kio_recoll.cpp kio_recoll.h $(DEBUG_CXXFLAGS) $(LANG_CXXFLAGS) $(QT_CXXFLAGS) $(SYS_CXXFLAGS) \ $(THREAD_CXXFLAGS) \ -o kio_recoll.o + +piclib/librcl.a: + cd piclib;make + +.PHONY: all diff --git a/src/kde/kioslave/recoll/kio_recoll.cpp b/src/kde/kioslave/recoll/kio_recoll.cpp index d90cbed9..f7e74109 100644 --- a/src/kde/kioslave/recoll/kio_recoll.cpp +++ b/src/kde/kioslave/recoll/kio_recoll.cpp @@ -1,10 +1,15 @@ #ifndef lint -static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.1 2006-01-18 13:41:11 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.2 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes"; #endif #include #include #include +#include + +#include + +using namespace std; #include @@ -13,33 +18,164 @@ static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.1 2006-01-18 13:41:11 dockes E #include #include -#include +#include "rclconfig.h" +#include "rcldb.h" +#include "rclinit.h" +#include "docseq.h" +#include "pathut.h" + +#include "plaintorich.h" #include "kio_recoll.h" using namespace KIO; + RecollProtocol::RecollProtocol(const QCString &pool, const QCString &app) - : SlaveBase("recoll", pool, app) + : SlaveBase("recoll", pool, app), m_initok(false), + m_rclconfig(0), m_rcldb(0), m_docsource(0) { + string reason; + m_rclconfig = recollinit(0, 0, m_reason); + if (!m_rclconfig || !m_rclconfig->ok()) { + m_reason = string("Configuration problem: ") + reason; + return; + } + + if (m_rclconfig->getConfParam(string("dbdir"), m_dbdir) == 0) { + // Note: this will have to be replaced by a call to a + // configuration buildin dialog for initial configuration + m_reason = "No db directory in configuration ??"; + return; + } + m_dbdir = path_tildexpand(m_dbdir); + m_rcldb = new Rcl::Db; + if (!m_rcldb) { + m_reason = "Could not build database object. (out of memory ?)"; + return; + } + m_initok = true; + return; } RecollProtocol::~RecollProtocol() { + delete m_docsource; + delete m_rcldb; + delete m_rclconfig; +} + +bool RecollProtocol::maybeOpenDb(string &reason) +{ + if (!m_rcldb) { + reason = "Internal error: initialization error"; + return false; + } + if (!m_rcldb->isopen() && !m_rcldb->open(m_dbdir, Rcl::Db::DbRO)) { + reason = "Could not open database in " + m_dbdir; + return false; + } + return true; } void RecollProtocol::get(const KURL & url) { fprintf(stderr, "RecollProtocol::get %s\n", url.url().ascii()); - mimeType("text/html"); - QByteArray output; + if (!m_initok || !maybeOpenDb(m_reason)) { + outputError(m_reason.c_str()); + finished(); + return; + } + + string iconsdir; + m_rclconfig->getConfParam("iconsdir", iconsdir); + if (iconsdir.empty()) { + iconsdir = path_cat("/usr/local/share/recoll", "images"); + } else { + iconsdir = path_tildexpand(iconsdir); + } + + QString path = url.path(); + fprintf(stderr, "RecollProtocol::get:path [%s]\n", path.latin1()); + + Rcl::AdvSearchData sdata; + + QCString u8 = path.utf8(); + sdata.orwords = u8; + if (!m_rcldb->setQuery(sdata, Rcl::Db::QO_STEM, "english")) { + m_reason = "Internal Error: setQuery failed"; + outputError(m_reason.c_str()); + finished(); + return; + } + + if (m_docsource) + delete m_docsource; + + m_docsource = new DocSequenceDb(m_rcldb, "Query results"); + + QByteArray output; QTextStream os(output, IO_WriteOnly ); - os.setEncoding(QTextStream::Latin1); - os << - "Recoll:get" - "

Un titre!

This is RECOLL

"; + os.setEncoding(QTextStream::UnicodeUTF8); + os << "" << endl; + os << "" << endl; + os << "" << endl; + os << "" << endl; + os << "Recoll: query results" << endl; + os << "" << endl; + + Rcl::Doc doc; + for (int i = 0; i < 100; i++) { + string sh; + doc.erase(); + + int percent; + if (!m_docsource->getDoc(i, doc, &percent, &sh)) { + // This may very well happen for history if the doc has + // been removed since. So don't treat it as fatal. + doc.abstract = string("Unavailable document"); + } + + string iconname = m_rclconfig->getMimeIconName(doc.mimetype); + if (iconname.empty()) + iconname = "document"; + string imgfile = iconsdir + "/" + iconname + ".png"; + + string result; + if (!sh.empty()) + result += string("

") + sh + "

\n

"; + else + result = "

"; + + char perbuf[10]; + sprintf(perbuf, "%3d%%", percent); + if (doc.title.empty()) + doc.title = path_getsimple(doc.url); + char datebuf[100]; + datebuf[0] = 0; + if (!doc.dmtime.empty() || !doc.fmtime.empty()) { + time_t mtime = doc.dmtime.empty() ? + atol(doc.fmtime.c_str()) : atol(doc.dmtime.c_str()); + struct tm *tm = localtime(&mtime); + strftime(datebuf, 99, + "Modified: %Y-%m-%d %H:%M:%S", tm); + } + result += ""; + string abst = escapeHtml(doc.abstract); + result += string(perbuf) + " " + doc.title + "
" + + doc.mimetype + " " + + (datebuf[0] ? string(datebuf) + "
" : string("
")) + + (!abst.empty() ? abst + "
" : string("")) + + (!doc.keywords.empty() ? doc.keywords + "
" : string("")) + + "" + doc.url + "

\n"; + + QString str = QString::fromUtf8(result.c_str(), result.length()); + os << str; + } + + os << ""; data(output); data(QByteArray()); @@ -55,6 +191,23 @@ void RecollProtocol::mimetype(const KURL & /*url*/) finished(); } +void RecollProtocol::outputError(const QString& errmsg) +{ + QByteArray array; + QTextStream os(array, IO_WriteOnly); + os.setEncoding(QTextStream::UnicodeUTF8); + + os << "" << endl; + os << "" << endl; + os << "" << "Recoll output" << "\n" << endl; + os << "" << endl; + os << "

Recoll Error

" << errmsg << "" << endl; + os << "" << endl; + + data(array); +} + + extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); } int kdemain(int argc, char **argv) diff --git a/src/kde/kioslave/recoll/kio_recoll.h b/src/kde/kioslave/recoll/kio_recoll.h index c13bec1f..7236905d 100644 --- a/src/kde/kioslave/recoll/kio_recoll.h +++ b/src/kde/kioslave/recoll/kio_recoll.h @@ -1,6 +1,8 @@ #ifndef _RECOLL_H #define _RECOLL_H +#include + #include #include @@ -14,5 +16,14 @@ public: // virtual void listDir( const KURL & url ); // virtual void stat( const KURL & url ); + private: + bool m_initok; + RclConfig *m_rclconfig; + Rcl::Db *m_rcldb; + DocSequence *m_docsource; + std::string m_dbdir; + std::string m_reason; + bool maybeOpenDb(string &reason); + void outputError(const QString& errmsg); }; #endif diff --git a/src/lib/Makefile b/src/lib/Makefile index 813feb20..17797bbf 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,5 +1,7 @@ +depth = .. +include $(depth)/mk/sysconf -UNACCFLAGS = -g -I. -I../unac $(INCICONV) -DUNAC_VERSION=\"1.0.7\" +UNACCFLAGS = -g -I. -I$(depth)/unac $(INCICONV) -DUNAC_VERSION=\"1.0.7\" LIBS = librcl.a @@ -15,101 +17,105 @@ OBJS = base64.o conftree.o csguess.o debuglog.o \ textsplit.o transcode.o \ unacpp.o unac.o docseq.o sortseq.o copyfile.o -SRCS = ../utils/conftree.cpp \ - ../index/csguess.cpp ../utils/debuglog.cpp \ - ../utils/execmd.cpp ../utils/idfile.cpp ../utils/md5.cpp \ - ../utils/wipedir.cpp ../utils/fstreewalk.cpp \ - ../common/mh_html.cpp ../common/mh_mail.cpp ../common/mh_exec.cpp \ - ../common/mh_text.cpp ../common/htmlparse.cpp \ - ../index/indexer.cpp ../common/internfile.cpp \ - ../common/mimehandler.cpp ../utils/mimeparse.cpp ../index/mimetype.cpp \ - ../common/myhtmlparse.cpp ../common/pathhash.cpp ../utils/pathut.cpp \ - ../common/rclconfig.cpp ../common/rcldb.cpp ../common/rclinit.cpp \ - ../utils/base64.cpp ../utils/readfile.cpp ../utils/smallut.cpp \ - ../common/textsplit.cpp ../utils/transcode.cpp \ - ../common/unacpp.cpp ../unac/unac.c ../query/history.cpp \ - ../query/docseq.cpp ../query/sortseq.cpp ../utils/copyfile.cpp +SRCS = \ + $(depth)/utils/conftree.cpp $(depth)/index/csguess.cpp \ + $(depth)/utils/debuglog.cpp $(depth)/utils/execmd.cpp \ + $(depth)/utils/idfile.cpp $(depth)/utils/md5.cpp \ + $(depth)/utils/wipedir.cpp $(depth)/utils/fstreewalk.cpp \ + $(depth)/common/mh_html.cpp $(depth)/common/mh_mail.cpp \ + $(depth)/common/mh_exec.cpp $(depth)/common/mh_text.cpp \ + $(depth)/common/htmlparse.cpp $(depth)/index/indexer.cpp \ + $(depth)/common/internfile.cpp $(depth)/common/mimehandler.cpp \ + $(depth)/utils/mimeparse.cpp $(depth)/index/mimetype.cpp \ + $(depth)/common/myhtmlparse.cpp $(depth)/common/pathhash.cpp \ + $(depth)/utils/pathut.cpp $(depth)/common/rclconfig.cpp \ + $(depth)/common/rcldb.cpp $(depth)/common/rclinit.cpp \ + $(depth)/utils/base64.cpp $(depth)/utils/readfile.cpp \ + $(depth)/utils/smallut.cpp $(depth)/common/textsplit.cpp \ + $(depth)/utils/transcode.cpp $(depth)/common/unacpp.cpp \ + $(depth)/unac/unac.c $(depth)/query/history.cpp \ + $(depth)/query/docseq.cpp $(depth)/query/sortseq.cpp \ + $(depth)/utils/copyfile.cpp librcl.a : $(OBJS) ar ru librcl.a $(OBJS) $(RANLIB) librcl.a -unac.o : ../unac/unac.c ../unac/unac.h +unac.o : $(depth)/unac/unac.c $(depth)/unac/unac.h $(CC) $(UNACCFLAGS) -c $< -# $(CXX) $(CXXFLAGS) -c $< -conftree.o : ../utils/conftree.cpp - $(CXX) $(CXXFLAGS) -c $< -csguess.o : ../index/csguess.cpp - $(CXX) $(CXXFLAGS) -c $< -debuglog.o : ../utils/debuglog.cpp - $(CXX) $(CXXFLAGS) -c $< -execmd.o : ../utils/execmd.cpp - $(CXX) $(CXXFLAGS) -c $< -wipedir.o : ../utils/wipedir.cpp - $(CXX) $(CXXFLAGS) -c $< -fstreewalk.o : ../utils/fstreewalk.cpp - $(CXX) $(CXXFLAGS) -c $< -history.o : ../query/history.cpp - $(CXX) $(CXXFLAGS) -c $< -sortseq.o : ../query/sortseq.cpp - $(CXX) $(CXXFLAGS) -c $< -docseq.o : ../query/docseq.cpp - $(CXX) $(CXXFLAGS) -c $< -mh_html.o : ../common/mh_html.cpp - $(CXX) $(CXXFLAGS) -c $< -mh_exec.o : ../common/mh_exec.cpp - $(CXX) $(CXXFLAGS) -c $< -mh_text.o : ../common/mh_text.cpp - $(CXX) $(CXXFLAGS) -c $< -htmlparse.o : ../common/htmlparse.cpp - $(CXX) $(CXXFLAGS) -c $< -idfile.o : ../utils/idfile.cpp - $(CXX) $(CXXFLAGS) -c $< -indexer.o : ../index/indexer.cpp - $(CXX) $(CXXFLAGS) -c $< -internfile.o : ../common/internfile.cpp - $(CXX) $(CXXFLAGS) -c $< -mh_mail.o : ../common/mh_mail.cpp - $(CXX) $(CXXFLAGS) -c $< -mimehandler.o : ../common/mimehandler.cpp - $(CXX) $(CXXFLAGS) -c $< -mimeparse.o : ../utils/mimeparse.cpp - $(CXX) $(CXXFLAGS) -c $< -mimetype.o : ../index/mimetype.cpp - $(CXX) $(CXXFLAGS) -c $< -myhtmlparse.o : ../common/myhtmlparse.cpp - $(CXX) $(CXXFLAGS) -c $< -pathut.o : ../utils/pathut.cpp - $(CXX) $(CXXFLAGS) -c $< -pathhash.o : ../common/pathhash.cpp - $(CXX) $(CXXFLAGS) -c $< -rclconfig.o : ../common/rclconfig.cpp - $(CXX) $(CXXFLAGS) -c $< -rclinit.o : ../common/rclinit.cpp - $(CXX) $(CXXFLAGS) -c $< -rcldb.o : ../common/rcldb.cpp - $(CXX) $(CXXFLAGS) -c $< -readfile.o : ../utils/readfile.cpp - $(CXX) $(CXXFLAGS) -c $< -base64.o : ../utils/base64.cpp - $(CXX) $(CXXFLAGS) -c $< -smallut.o : ../utils/smallut.cpp - $(CXX) $(CXXFLAGS) -c $< -textsplit.o : ../common/textsplit.cpp - $(CXX) $(CXXFLAGS) -c $< -transcode.o : ../utils/transcode.cpp - $(CXX) $(CXXFLAGS) -c $< -md5.o : ../utils/md5.cpp - $(CXX) $(CXXFLAGS) -c $< -unacpp.o : ../common/unacpp.cpp - $(CXX) $(CXXFLAGS) -c $< -copyfile.o : ../utils/copyfile.cpp - $(CXX) $(CXXFLAGS) -c $< +conftree.o : $(depth)/utils/conftree.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +csguess.o : $(depth)/index/csguess.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +debuglog.o : $(depth)/utils/debuglog.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +execmd.o : $(depth)/utils/execmd.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +wipedir.o : $(depth)/utils/wipedir.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +fstreewalk.o : $(depth)/utils/fstreewalk.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +history.o : $(depth)/query/history.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +sortseq.o : $(depth)/query/sortseq.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +docseq.o : $(depth)/query/docseq.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mh_html.o : $(depth)/common/mh_html.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mh_exec.o : $(depth)/common/mh_exec.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mh_text.o : $(depth)/common/mh_text.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +htmlparse.o : $(depth)/common/htmlparse.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +idfile.o : $(depth)/utils/idfile.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +indexer.o : $(depth)/index/indexer.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +internfile.o : $(depth)/common/internfile.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mh_mail.o : $(depth)/common/mh_mail.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mimehandler.o : $(depth)/common/mimehandler.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mimeparse.o : $(depth)/utils/mimeparse.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +mimetype.o : $(depth)/index/mimetype.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +myhtmlparse.o : $(depth)/common/myhtmlparse.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +pathut.o : $(depth)/utils/pathut.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +pathhash.o : $(depth)/common/pathhash.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +rclconfig.o : $(depth)/common/rclconfig.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +rclinit.o : $(depth)/common/rclinit.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +rcldb.o : $(depth)/common/rcldb.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +readfile.o : $(depth)/utils/readfile.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +base64.o : $(depth)/utils/base64.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +smallut.o : $(depth)/utils/smallut.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +textsplit.o : $(depth)/common/textsplit.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +transcode.o : $(depth)/utils/transcode.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +md5.o : $(depth)/utils/md5.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +unacpp.o : $(depth)/common/unacpp.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< +copyfile.o : $(depth)/utils/copyfile.cpp + $(CXX) $(ALL_CXXFLAGS) -c $< depend: alldeps.stamp alldeps.stamp : $(SRCS) - $(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps + $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps touch alldeps.stamp clean: @@ -118,4 +124,3 @@ clean: rm -f $(OBJS) $(LIBS) include alldeps -include ../mk/sysconf diff --git a/src/makestaticdist.sh b/src/makestaticdist.sh index 562c6b8c..fa48462e 100644 --- a/src/makestaticdist.sh +++ b/src/makestaticdist.sh @@ -35,11 +35,19 @@ rm -f index/recollindex qtgui/recoll make static || exit 1 strip index/recollindex qtgui/recoll -files="COPYING README INSTALL Makefile recollinstall -filters sampleconf -index/recollindex qtgui/recoll qtgui/mtpics/*.png" +files="COPYING README INSTALL VERSION Makefile recollinstall +filters sampleconf doc/user doc/man +index/recollindex qtgui/recoll qtgui/*.qm qtgui/mtpics/*.png" $TAR chf - $files | (cd $topdir; $TAR xf -) + +# Remove any install dependancy +chmod +w $topdir/Makefile +sed -e '/^install:/c\ +install: ' < $topdir/Makefile > $topdir/toto && \ + mv $topdir/toto $topdir/Makefile + + (cd $targetdir ; \ $TAR chf - $topdirsimple | \ gzip > $tarfile) diff --git a/src/mk/Darwin b/src/mk/Darwin index c2e66b25..8d5e8858 100644 --- a/src/mk/Darwin +++ b/src/mk/Darwin @@ -1,7 +1,7 @@ -include ../mk/commondefs -include ../mk/localdefs +include $(depth)/mk/commondefs +include $(depth)/mk/localdefs -CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ +ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ -DHAVE_VASPRINTF=1 \ -DHAVE_MKDTEMP=1 diff --git a/src/mk/FreeBSD b/src/mk/FreeBSD index d6001839..87896190 100644 --- a/src/mk/FreeBSD +++ b/src/mk/FreeBSD @@ -1,7 +1,7 @@ -include ../mk/commondefs -include ../mk/localdefs +include $(depth)/mk/commondefs +include $(depth)/mk/localdefs -CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ +ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ -pthread \ -DHAVE_VASPRINTF=1 \ -DHAVE_MKDTEMP=1 diff --git a/src/mk/Linux b/src/mk/Linux index 8d85edd0..3691872b 100644 --- a/src/mk/Linux +++ b/src/mk/Linux @@ -1,7 +1,8 @@ -include ../mk/commondefs -include ../mk/localdefs -CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ +include $(depth)/mk/commondefs +include $(depth)/mk/localdefs + +ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ -D_GNU_SOURCE \ -DPUTENV_ARG_NOT_CONST \ -DHAVE_VASPRINTF=1 \ diff --git a/src/mk/SunOS b/src/mk/SunOS index 5b87989f..2f7bf968 100644 --- a/src/mk/SunOS +++ b/src/mk/SunOS @@ -1,10 +1,10 @@ -include ../mk/commondefs -include ../mk/localdefs +include $(depth)/mk/commondefs +include $(depth)/mk/localdefs -CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ +ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ -DPUTENV_ARG_NOT_CONST -CC=gcc -CXX=g++ +CC = gcc +CXX = g++ LIBSYS = -lpthread -lnsl -lsocket diff --git a/src/mk/commondefs b/src/mk/commondefs index 6a457168..7f97c0a2 100644 --- a/src/mk/commondefs +++ b/src/mk/commondefs @@ -1,15 +1,18 @@ # Definitions mostly common to all systems, can be overridden by # sys-specific include +COMMONCXXFLAGS = -Wall -Wno-unused -I. -I$(depth)/index \ + -I$(depth)/utils -I$(depth)/common \ + -I$(depth)/unac -I$(depth)/bincimapmime \ + -I/usr/local/include -COMMONCXXFLAGS = -Wall -Wno-unused -g -I. -I../index -I../utils -I../common \ - -I../unac -I../bincimapmime -I/usr/local/include +# We happen to be using gcc on all platforms for now. Can be overridden in +# sys file anyway +PIC_CXXFLAGS = -fPIC -DPIC + +BIGLIB = $(depth)/lib/librcl.a +MIMELIB = $(depth)/bincimapmime/libmime.a -BIGLIB = ../lib/librcl.a -MIMELIB = ../bincimapmime/libmime.a RANLIB = test -f + AR=ar - -INSTALL = install -c - -#QTDIR = /usr diff --git a/src/mk/localdefs.in b/src/mk/localdefs.in index 07529659..7d5306ca 100644 --- a/src/mk/localdefs.in +++ b/src/mk/localdefs.in @@ -9,3 +9,4 @@ RECOLL_PREFIX=@prefix@ LOCALCXXFLAGS = $(INCICONV) $(XAPIANCXXFLAGS) \ -DRECOLL_PREFIX=\"$(RECOLL_PREFIX)\" +CXXFLAGS = -g diff --git a/src/qtgui/plaintorich.cpp b/src/qtgui/plaintorich.cpp index 33cd8075..1bd58d59 100644 --- a/src/qtgui/plaintorich.cpp +++ b/src/qtgui/plaintorich.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.6 2005-11-24 07:16:16 dockes Exp $ (C) 2005 J.F.Dockes"; +static char rcsid[] = "@(#$Id: plaintorich.cpp,v 1.7 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes"; #endif @@ -49,25 +49,6 @@ class myTextSplitCB : public TextSplitCB { } }; -// Just strip/escape things that would look like markup -string stripMarkup(const string &in) -{ - string out; - for (string::size_type pos = 0; pos < in.length(); pos++) { - switch(in.at(pos)) { - case '<': - out += "<"; - break; - case '&': - out += "&"; - break; - default: - out += in.at(pos); - } - } - return out; -} - // Fix result text for display inside the gui text window. // // To compute the term character positions in the output text, we have @@ -83,6 +64,9 @@ string plaintorich(const string &in, const list& terms, termoffsets.erase(termoffsets.begin(), termoffsets.end()); + // We first use the text splitter to break the text into words, + // and compare the words to the search terms, which yields the + // query terms positions inside the text myTextSplitCB cb(terms); TextSplit splitter(&cb, true); // Note that splitter returns the term locations in byte, not diff --git a/src/qtgui/plaintorich.h b/src/qtgui/plaintorich.h index ba77ac24..4e238d00 100644 --- a/src/qtgui/plaintorich.h +++ b/src/qtgui/plaintorich.h @@ -1,20 +1,21 @@ #ifndef _PLAINTORICH_H_INCLUDED_ #define _PLAINTORICH_H_INCLUDED_ -/* @(#$Id: plaintorich.h,v 1.2 2005-10-10 13:24:53 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: plaintorich.h,v 1.3 2006-01-19 12:01:43 dockes Exp $ (C) 2004 J.F.Dockes */ #include /** - * Fix result text for display inside the gui text window. + * Transform plain text into qt rich text for the preview window. + * + * We mainly escape characters like < or &, and add qt rich text tags to + * colorize the query terms. * * @param in raw text out of internfile. * @param terms list of query terms - * @param termoffsets character offsets where we find terms + * @param termoffsets output: character offsets where we find terms. */ extern string plaintorich(const string &in, const list& terms, list >&termoffsets); -extern string stripMarkup(const string &in); - #endif /* _PLAINTORICH_H_INCLUDED_ */ diff --git a/src/qtgui/recollmain.ui.h b/src/qtgui/recollmain.ui.h index 7c6a0a2b..efa82d13 100644 --- a/src/qtgui/recollmain.ui.h +++ b/src/qtgui/recollmain.ui.h @@ -550,7 +550,7 @@ void RecollMain::showResultPage() strftime(datebuf, 99, "Modified: %Y-%m-%d %H:%M:%S", tm); } - string abst = stripMarkup(doc.abstract); + string abst = escapeHtml(doc.abstract); LOGDEB1(("Abstract: {%s}\n", abst.c_str())); if (!img_name.empty()) { result += ""; diff --git a/src/query/Makefile b/src/query/Makefile index 2350ef99..62ecd8a4 100644 --- a/src/query/Makefile +++ b/src/query/Makefile @@ -1,35 +1,37 @@ +depth = .. +include $(depth)/mk/sysconf PROGS = xadump #trhist qtry qxtry all: $(PROGS) XADUMP_OBJS= xadump.o $(BIGLIB) xadump : $(XADUMP_OBJS) - $(CXX) $(CXXFLAGS) -o xadump $(XADUMP_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o xadump $(XADUMP_OBJS) \ $(LIBICONV) $(LIBXAPIAN) $(LIBSYS) QXTRY_OBJS= qxtry.o $(BIGLIB) qxtry : $(QXTRY_OBJS) - $(CXX) $(CXXFLAGS) -o qxtry $(QXTRY_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o qxtry $(QXTRY_OBJS) \ $(LIBICONV) $(LIBXAPIAN) QTRY_OBJS= qtry.o $(BIGLIB) $(MIMELIB) qtry : $(QTRY_OBJS) - $(CXX) $(CXXFLAGS) -o qtry $(QTRY_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o qtry $(QTRY_OBJS) \ $(LIBICONV) $(LIBXAPIAN) HISTORY_OBJS= trhist.o $(BIGLIB) $(MIMELIB) trhist : $(HISTORY_OBJS) - $(CXX) $(CXXFLAGS) -o trhist $(HISTORY_OBJS) \ + $(CXX) $(ALL_CXXFLAGS) -o trhist $(HISTORY_OBJS) \ $(LIBICONV) $(LIBXAPIAN) trhist.o : history.cpp history.h - $(CXX) $(CXXFLAGS) -DTEST_HISTORY -c -o trhist.o history.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_HISTORY -c -o trhist.o history.cpp $(BIGLIB): - cd ../lib;make + cd $(depth)/lib;make depend: alldeps.stamp alldeps.stamp : $(SRCS) - $(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps + $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps touch alldeps.stamp clean: @@ -37,5 +39,4 @@ clean: rm -f alldeps.stamp rm -f *.o $(PROGS) -include ../mk/sysconf include alldeps diff --git a/src/utils/Makefile b/src/utils/Makefile index 2e4e187b..fbe3da63 100644 --- a/src/utils/Makefile +++ b/src/utils/Makefile @@ -1,3 +1,5 @@ +depth = .. +include $(depth)/mk/sysconf PROGS = trconftree wipedir smallut trfstreewalk trpathut \ transcode \ @@ -6,78 +8,77 @@ PROGS = trconftree wipedir smallut trfstreewalk trpathut \ all: $(PROGS) $(BIGLIB) $(BIGLIB): - cd ../lib;$(MAKE) + cd $(depth)/lib;$(MAKE) -FSTREEWALK_OBJS= trfstreewalk.o fstreewalk.o pathut.o +FSTREEWALK_OBJS= trfstreewalk.o fstreewalk.o $(BIGLIB) trfstreewalk : $(FSTREEWALK_OBJS) $(CXX) -o trfstreewalk $(FSTREEWALK_OBJS) trfstreewalk.o : fstreewalk.cpp fstreewalk.h - $(CXX) -o trfstreewalk.o -c $(CXXFLAGS) \ + $(CXX) -o trfstreewalk.o -c $(ALL_CXXFLAGS) \ -DTEST_FSTREEWALK fstreewalk.cpp PATHUT_OBJS= trpathut.o pathut.o $(BIGLIB) trpathut : $(PATHUT_OBJS) - $(CXX) $(CXXFLAGS) -o trpathut $(PATHUT_OBJS) + $(CXX) $(ALL_CXXFLAGS) -o trpathut $(PATHUT_OBJS) trpathut.o : pathut.cpp pathut.h - $(CXX) -o trpathut.o -c $(CXXFLAGS) -DTEST_PATHUT pathut.cpp + $(CXX) -o trpathut.o -c $(ALL_CXXFLAGS) -DTEST_PATHUT pathut.cpp EXECMD_OBJS= trexecmd.o $(BIGLIB) trexecmd : $(EXECMD_OBJS) - $(CXX) $(CXXFLAGS) -o trexecmd $(EXECMD_OBJS) + $(CXX) $(ALL_CXXFLAGS) -o trexecmd $(EXECMD_OBJS) trexecmd.o : execmd.cpp execmd.h - $(CXX) -o trexecmd.o -c $(CXXFLAGS) -DTEST_EXECMD execmd.cpp + $(CXX) -o trexecmd.o -c $(ALL_CXXFLAGS) -DTEST_EXECMD execmd.cpp TRANSCODE_OBJS= trtranscode.o $(BIGLIB) transcode : $(TRANSCODE_OBJS) - $(CXX) $(CXXFLAGS) -o transcode $(TRANSCODE_OBJS) $(LIBICONV) -trtranscode.o : ../utils/transcode.cpp - $(CXX) $(CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \ + $(CXX) $(ALL_CXXFLAGS) -o transcode $(TRANSCODE_OBJS) $(LIBICONV) +trtranscode.o : transcode.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \ transcode.cpp IDFILE_OBJS= tridfile.o $(BIGLIB) idfile : $(IDFILE_OBJS) - $(CXX) $(CXXFLAGS) -o idfile $(IDFILE_OBJS) $(LIBICONV) -tridfile.o : ../utils/idfile.cpp - $(CXX) $(CXXFLAGS) -DTEST_IDFILE -c -o tridfile.o \ + $(CXX) $(ALL_CXXFLAGS) -o idfile $(IDFILE_OBJS) $(LIBICONV) +tridfile.o : idfile.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_IDFILE -c -o tridfile.o \ idfile.cpp MIMEPARSE_OBJS= trmimeparse.o $(BIGLIB) trmimeparse : $(MIMEPARSE_OBJS) - $(CXX) $(CXXFLAGS) -o trmimeparse $(MIMEPARSE_OBJS) $(LIBICONV) + $(CXX) $(ALL_CXXFLAGS) -o trmimeparse $(MIMEPARSE_OBJS) $(LIBICONV) trmimeparse.o : mimeparse.cpp - $(CXX) $(CXXFLAGS) -DTEST_MIMEPARSE -c -o trmimeparse.o \ + $(CXX) $(ALL_CXXFLAGS) -DTEST_MIMEPARSE -c -o trmimeparse.o \ mimeparse.cpp SMALLUT_OBJS= trsmallut.o $(BIGLIB) smallut : $(SMALLUT_OBJS) - $(CXX) $(CXXFLAGS) -o smallut $(SMALLUT_OBJS) $(LIBICONV) -trsmallut.o : ../utils/smallut.cpp - $(CXX) $(CXXFLAGS) -DTEST_SMALLUT -c -o trsmallut.o \ + $(CXX) $(ALL_CXXFLAGS) -o smallut $(SMALLUT_OBJS) $(LIBICONV) +trsmallut.o : smallut.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_SMALLUT -c -o trsmallut.o \ smallut.cpp WIPEDIR_OBJS= trwipedir.o $(BIGLIB) wipedir : $(WIPEDIR_OBJS) - $(CXX) $(CXXFLAGS) -o wipedir $(WIPEDIR_OBJS) $(LIBICONV) -trwipedir.o : ../utils/wipedir.cpp - $(CXX) $(CXXFLAGS) -DTEST_WIPEDIR -c -o trwipedir.o \ + $(CXX) $(ALL_CXXFLAGS) -o wipedir $(WIPEDIR_OBJS) $(LIBICONV) +trwipedir.o : wipedir.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_WIPEDIR -c -o trwipedir.o \ wipedir.cpp UTF8ITER_OBJS= trutf8iter.o $(BIGLIB) utf8iter : $(UTF8ITER_OBJS) - $(CXX) $(CXXFLAGS) -o utf8iter $(UTF8ITER_OBJS) $(LIBICONV) -trutf8iter.o : ../utils/utf8iter.cpp utf8iter.h - $(CXX) $(CXXFLAGS) -DTEST_UTF8ITER -c -o trutf8iter.o \ + $(CXX) $(ALL_CXXFLAGS) -o utf8iter $(UTF8ITER_OBJS) $(LIBICONV) +trutf8iter.o : utf8iter.cpp utf8iter.h + $(CXX) $(ALL_CXXFLAGS) -DTEST_UTF8ITER -c -o trutf8iter.o \ utf8iter.cpp CONFTREE_OBJS= trconftree.o $(BIGLIB) trconftree : $(CONFTREE_OBJS) - $(CXX) $(CXXFLAGS) -o trconftree $(CONFTREE_OBJS) -trconftree.o : ../utils/conftree.cpp - $(CXX) $(CXXFLAGS) -DTEST_CONFTREE -c -o trconftree.o \ + $(CXX) $(ALL_CXXFLAGS) -o trconftree $(CONFTREE_OBJS) +trconftree.o : conftree.cpp + $(CXX) $(ALL_CXXFLAGS) -DTEST_CONFTREE -c -o trconftree.o \ conftree.cpp clean: rm -f *.o $(PROGS) -include ../mk/sysconf diff --git a/src/utils/smallut.cpp b/src/utils/smallut.cpp index 9bf65c13..176ba038 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.12 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: smallut.cpp,v 1.13 2006-01-19 12:01:43 dockes Exp $ (C) 2004 J.F.Dockes"; #endif #ifndef TEST_SMALLUT #include @@ -311,6 +311,25 @@ void trimstring(string &s, const char *ws) s.replace(pos+1, string::npos, ""); } +// Escape things that would look like markup +string escapeHtml(const string &in) +{ + string out; + for (string::size_type pos = 0; pos < in.length(); pos++) { + switch(in.at(pos)) { + case '<': + out += "<"; + break; + case '&': + out += "&"; + break; + default: + out += in.at(pos); + } + } + return out; +} + #else #include diff --git a/src/utils/smallut.h b/src/utils/smallut.h index f372ebe7..9cc6b6a2 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -1,6 +1,6 @@ #ifndef _SMALLUT_H_INCLUDED_ #define _SMALLUT_H_INCLUDED_ -/* @(#$Id: smallut.h,v 1.11 2006-01-04 11:33:44 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: smallut.h,v 1.12 2006-01-19 12:01:43 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -40,4 +40,6 @@ extern bool stringToBool(const string &s); tab}) at beginning and end of input string */ extern void trimstring(string &s, const char *ws = " \t"); +extern std::string escapeHtml(const std::string &in); + #endif /* _SMALLUT_H_INCLUDED_ */