misc small mods to help with building kio_recoll

This commit is contained in:
dockes 2006-01-19 12:01:43 +00:00
parent 4bcdb17480
commit 6e0ec42dad
25 changed files with 504 additions and 238 deletions

View File

@ -1,6 +1,6 @@
# New ports collection makefile for: recoll
# Date created: 5 December 2005
# Whom: J.F. Dockes
# Whom: J.F. Dockes <jean-francois.dockes@wanadoo.fr>
#
# $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

View File

@ -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}

View File

@ -1 +1 @@
1.1.0
1.2.0

View File

@ -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

View File

@ -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:

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.3 2006-01-11 15:08:21 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.4 2006-01-19 12:01:42 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -484,11 +484,40 @@
<title>Building</title>
<para>&RCL; has been built on
Linux (redhat7.3, mandriva 2005), FreeBSD and Solaris 8. If
you build on another system, <ulink
url="mailto:jean-francois.dockes@wanadoo.fr">I would very
much welcome patches</ulink>.</para>
Linux (redhat7.3, mandriva 2005, Fedora Core 3), FreeBSD and
Solaris 8. If you build on another system, <ulink
url="mailto:jean-francois.dockes@wanadoo.fr">I would very much
welcome patches</ulink>.</para>
<para>Depending on the <application>qt</application>
configuration on your system, you may have to set the
<literal>QTDIR</literal> and <literal>QMAKESPECS</literal>
variables in your environment:</para>
<itemizedlist>
<listitem><para><literal>QTDIR</literal> should point to the
directory above the one that holds the qt include files (ie:
qt.h).</para>
</listitem>
<listitem><para><literal>QMAKESPECS</literal> should
be set to the name of one of the
<application>qt</application> mkspecs subdirectories (ie:
linux-g++).</para>
</listitem>
</itemizedlist>
<para>On many Linux systems, <literal>QTDIR</literal> is set
by the login scripts, and <literal>QMAKESPECS</literal> is not
needed because there is a <filename>default</filename> link in
<filename>mkspecs/</filename>.</para>
<para>The &RCL; <command>configure</command> 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
<command>qmake</command> command should be in your PATH (later
releases can also find it in
<filename>$QTDIR/bin</filename>).</para>
<para>Normal procedure:</para>
<screen>
<userinput>cd recoll-xxx</userinput>
@ -647,22 +676,38 @@
</varlistentry>
<varlistentry><term><literal>skippedNames</literal></term>
<listitem><para>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:
<listitem>
<para>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: </para>
<programlisting>
*~ #* bin CVS Cache caughtspam tmp
</programlisting>
The list can be redefined for subdirectories, but is only
actually changed for the top level ones in
<emphasis>topdirs</emphasis></para>
<para>The list can be redefined for subdirectories, but is only
actually changed for the top level ones in
<literal>topdirs</literal>.</para>
<para>The top-level directories are not affected by this
list (that is, a directory in <literal>topdirs</literal>
might match and would still be indexed).</para>
<para>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 <application>thunderbird</application>
usually store messages in hidden directories, and you
probably want this indexed. One possible solution is to
have <userinput>.*</userinput> in
<literal>skippedNames</literal>, and add things like
<filename>~/.thunderbird</filename> or
<filename>~/.evolution</filename> in
<literal>topdirs</literal>.</para>
</listitem>
</varlistentry>
<varlistentry><term><literal>loglevel</literal></term>
<listitem><para>Verbosity level for recoll and
recollindex. A value of 4 lists quite a lot of
debug/information messages. 3 only lists errors. </para>
debug/information messages. 2 only lists errors. </para>
</listitem>
</varlistentry>
@ -758,6 +803,15 @@
should be handled specially, which is possible because they
are usually all located in one place.</para>
<para><filename>mimemap</filename> also has a
<literal>recoll_noindex</literal> variable which is a list of
suffixes. Matching files will be skipped (avoids unnecessary
decompressions or <command>file</command> executions). This is
partially redundant with <literal>skippedNames</literal> in
the main configuration file, with two differences: it will not
affect directories, and it can be changed for any
subdirectory.</para>
</sect2>
<sect2 id="rclinstall.config.mimeconf">

View File

@ -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:

View File

@ -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

View File

@ -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 <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string>
using namespace std;
#include <qfile.h>
@ -13,33 +18,164 @@ static char rcsid[] = "@(#$Id: kio_recoll.cpp,v 1.1 2006-01-18 13:41:11 dockes E
#include <kinstance.h>
#include <kio/global.h>
#include <errno.h>
#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 <<
"<html><head><title>Recoll:get</title></head>"
"<body><h1>Un titre!</h1><p>This is RECOLL</p></body></html>";
os.setEncoding(QTextStream::UnicodeUTF8);
os << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" << endl;
os << "<html><head>" << endl;
os << "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" << endl;
os << "<meta http-equiv=\"Pragma\" content=\"no-cache\">" << endl;
os << "<title>Recoll: query results</title>" << endl;
os << "</head><body>" << 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("<p><b>") + sh + "</p>\n<p>";
else
result = "<p>";
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,
"<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%H:%M:%S", tm);
}
result += "<img src=\"file://" + imgfile + "\" align=\"left\">";
string abst = escapeHtml(doc.abstract);
result += string(perbuf) + " <b>" + doc.title + "</b><br>" +
doc.mimetype + "&nbsp;" +
(datebuf[0] ? string(datebuf) + "<br>" : string("<br>")) +
(!abst.empty() ? abst + "<br>" : string("")) +
(!doc.keywords.empty() ? doc.keywords + "<br>" : string("")) +
"<a href=\"" + doc.url + "\">" + doc.url + "</a><br></p>\n";
QString str = QString::fromUtf8(result.c_str(), result.length());
os << str;
}
os << "</body></html>";
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 << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Strict//EN\">" << endl;
os << "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">" << endl;
os << "<title>" << "Recoll output" << "</title>\n" << endl;
os << "</head>" << endl;
os << "<body><h1>Recoll Error</h1>" << errmsg << "</body>" << endl;
os << "</html>" << endl;
data(array);
}
extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); }
int kdemain(int argc, char **argv)

View File

@ -1,6 +1,8 @@
#ifndef _RECOLL_H
#define _RECOLL_H
#include <string>
#include <kio/global.h>
#include <kio/slavebase.h>
@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -9,3 +9,4 @@ RECOLL_PREFIX=@prefix@
LOCALCXXFLAGS = $(INCICONV) $(XAPIANCXXFLAGS) \
-DRECOLL_PREFIX=\"$(RECOLL_PREFIX)\"
CXXFLAGS = -g

View File

@ -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 += "&lt;";
break;
case '&':
out += "&amp;";
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<string>& 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

View File

@ -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 <string>
/**
* 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<string>& terms,
list<pair<int, int> >&termoffsets);
extern string stripMarkup(const string &in);
#endif /* _PLAINTORICH_H_INCLUDED_ */

View File

@ -550,7 +550,7 @@ void RecollMain::showResultPage()
strftime(datebuf, 99,
"<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%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 += "<img source=\"" + img_name + "\" align=\"left\">";

View File

@ -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

View File

@ -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

View File

@ -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 <string>
@ -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 += "&lt;";
break;
case '&':
out += "&amp;";
break;
default:
out += in.at(pos);
}
}
return out;
}
#else
#include <string>

View File

@ -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 <string>
#include <list>
@ -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_ */