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

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 all: mk/sysconf common/rclversion.h
cd lib; ${MAKE} cd lib; ${MAKE}
cd bincimapmime; ${MAKE} cd bincimapmime; ${MAKE}
cd index; ${MAKE} recollindex cd index; ${MAKE} recollindex
cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \
cat ../mk/sysconf Makefile | \ cat ../mk/sysconf Makefile | ${MAKE} -f - depth=..
${MAKE} -f -
mk/sysconf: mk/sysconf:
./configure ./configure
common/rclversion.h: VERSION common/rclversion.h: VERSION
(echo -n "static const char *rclversion= \"" && \ echo 'static const char *rclversion = "'`cat VERSION`'";' \
echo -n `cat VERSION` && \ > common/rclversion.h
echo "\";") > common/rclversion.h
static: static:
cd lib; ${MAKE} cd lib; ${MAKE}
@ -22,9 +20,9 @@ static:
cd index; rm -f recollindex; \ cd index; rm -f recollindex; \
${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex
cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \ cd qtgui; PATH=${PATH}:${QTDIR}/bin; export PATH; qmake recoll.pro; \
rm -f recoll; \ rm -f recoll;
cat ../mk/sysconf ../mk/localdefs Makefile | ${MAKE} -f - \ cat ../mk/sysconf Makefile | \
BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic ${MAKE} -f - BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic depth=..
clean: clean:
cd common; ${MAKE} clean cd common; ${MAKE} clean
@ -38,7 +36,10 @@ clean:
rm -f qtgui/Makefile qtgui/preview/Makefile qtgui/recoll rm -f qtgui/Makefile qtgui/preview/Makefile qtgui/recoll
distclean: clean 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 install: all
bindir=${bindir} datadir=${datadir} ./recollinstall ${prefix} 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 LIBS = libmime.a
PROGS = trbinc PROGS = trbinc
@ -15,8 +19,8 @@ OBJS = mime-getpart.o mime-parsefull.o mime-parseonlyheader.o \
libmime.a : $(OBJS) libmime.a : $(OBJS)
$(AR) ru libmime.a $(OBJS) $(AR) ru libmime.a $(OBJS)
.cc .o : .cc.o:
$(CXX) $(CXXFLAGS) -c $< $(CXX) $(ALL_CXXFLAGS) -c $<
TRBINCOBJS = trbinc.o TRBINCOBJS = trbinc.o
trbinc: trbinc.o trbinc: trbinc.o
@ -24,7 +28,7 @@ trbinc: trbinc.o
depend: alldeps.stamp depend: alldeps.stamp
alldeps.stamp : $(SRCS) alldeps.stamp : $(SRCS)
$(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps
touch alldeps.stamp touch alldeps.stamp
clean: clean:
@ -32,5 +36,4 @@ clean:
rm -f alldeps.stamp rm -f alldeps.stamp
rm -f ${LIBS} ${PROGS} ${OBJS} rm -f ${LIBS} ${PROGS} ${OBJS}
include ../mk/sysconf
include alldeps 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 # @(#$Id: Makefile,v 1.9 2006-01-19 12:01:42 dockes Exp $ (C) 2005 J.F.Dockes
depth = ..
include ../mk/sysconf include $(depth)/mk/sysconf
# Only test executables get build in here # Only test executables get build in here
PROGS = internfile unacpp textsplit PROGS = internfile unacpp textsplit
@ -8,28 +8,28 @@ PROGS = internfile unacpp textsplit
all: $(BIGLIB) $(PROGS) all: $(BIGLIB) $(PROGS)
$(BIGLIB): $(BIGLIB):
cd ../lib;$(MAKE) cd $(depth)/lib;$(MAKE)
UNACPP_OBJS= trunacpp.o $(BIGLIB) UNACPP_OBJS= trunacpp.o $(BIGLIB)
unacpp : $(UNACPP_OBJS) unacpp : $(UNACPP_OBJS)
$(CXX) $(CXXFLAGS) -o unacpp $(UNACPP_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o unacpp $(UNACPP_OBJS) \
$(LIBICONV) $(LIBICONV)
trunacpp.o : unacpp.cpp unacpp.h 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_OBJS= trtextsplit.o $(BIGLIB)
textsplit : $(TEXTSPLIT_OBJS) textsplit : $(TEXTSPLIT_OBJS)
$(CXX) $(CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS) $(CXX) $(ALL_CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS)
trtextsplit.o : textsplit.cpp trtextsplit.o : textsplit.cpp
$(CXX) $(CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \
textsplit.cpp textsplit.cpp
INTERNFILE_OBJS= trinternfile.o $(BIGLIB) $(MIMELIB) INTERNFILE_OBJS= trinternfile.o $(BIGLIB) $(MIMELIB)
internfile : $(INTERNFILE_OBJS) internfile : $(INTERNFILE_OBJS)
$(CXX) $(CXXFLAGS) -o internfile $(INTERNFILE_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o internfile $(INTERNFILE_OBJS) \
$(LIBICONV) $(LIBSYS) $(LIBICONV) $(LIBSYS)
trinternfile.o : internfile.cpp trinternfile.o : internfile.cpp
$(CXX) $(CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \
internfile.cpp internfile.cpp
clean: clean:

View File

@ -24,7 +24,7 @@
Dockes</holder> Dockes</holder>
</copyright> </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> <abstract>
<para>This document introduces full text search notions <para>This document introduces full text search notions
@ -484,10 +484,39 @@
<title>Building</title> <title>Building</title>
<para>&RCL; has been built on <para>&RCL; has been built on
Linux (redhat7.3, mandriva 2005), FreeBSD and Solaris 8. If Linux (redhat7.3, mandriva 2005, Fedora Core 3), FreeBSD and
you build on another system, <ulink Solaris 8. If you build on another system, <ulink
url="mailto:jean-francois.dockes@wanadoo.fr">I would very url="mailto:jean-francois.dockes@wanadoo.fr">I would very much
much welcome patches</ulink>.</para> 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> <para>Normal procedure:</para>
<screen> <screen>
@ -647,22 +676,38 @@
</varlistentry> </varlistentry>
<varlistentry><term><literal>skippedNames</literal></term> <varlistentry><term><literal>skippedNames</literal></term>
<listitem><para>A space-separated list of patterns for <listitem>
<para>A space-separated list of patterns for
names of files or directories that should be completely names of files or directories that should be completely
ignored. The list defined in the default file is: ignored. The list defined in the default file is: </para>
<programlisting> <programlisting>
*~ #* bin CVS Cache caughtspam tmp *~ #* bin CVS Cache caughtspam tmp
</programlisting> </programlisting>
The list can be redefined for subdirectories, but is only <para>The list can be redefined for subdirectories, but is only
actually changed for the top level ones in actually changed for the top level ones in
<emphasis>topdirs</emphasis></para> <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> </listitem>
</varlistentry> </varlistentry>
<varlistentry><term><literal>loglevel</literal></term> <varlistentry><term><literal>loglevel</literal></term>
<listitem><para>Verbosity level for recoll and <listitem><para>Verbosity level for recoll and
recollindex. A value of 4 lists quite a lot of 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> </listitem>
</varlistentry> </varlistentry>
@ -758,6 +803,15 @@
should be handled specially, which is possible because they should be handled specially, which is possible because they
are usually all located in one place.</para> 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>
<sect2 id="rclinstall.config.mimeconf"> <sect2 id="rclinstall.config.mimeconf">

View File

@ -1,4 +1,5 @@
include ../mk/sysconf depth = ..
include $(depth)/mk/sysconf
PROGS = recollindex csguess mimetype PROGS = recollindex csguess mimetype
SRCS = recollindex.cpp SRCS = recollindex.cpp
@ -7,35 +8,35 @@ all: depend $(PROGS)
RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB) RECOLLINDEX_OBJS= recollindex.o $(BIGLIB) $(MIMELIB)
recollindex : $(RECOLLINDEX_OBJS) recollindex : $(RECOLLINDEX_OBJS)
$(CXX) $(CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o recollindex $(RECOLLINDEX_OBJS) \
$(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) $(LIBSYS) $(BSTATIC) $(LIBXAPIAN) $(LIBICONV) $(BDYNAMIC) $(LIBSYS)
recollindex.o : recollindex.cpp recollindex.o : recollindex.cpp
$(CXX) $(CXXFLAGS) -c -o recollindex.o $< $(CXX) $(ALL_CXXFLAGS) -c -o recollindex.o $<
CSGUESS_OBJS= trcsguess.o $(BIGLIB) CSGUESS_OBJS= trcsguess.o $(BIGLIB)
csguess : $(CSGUESS_OBJS) csguess : $(CSGUESS_OBJS)
$(CXX) $(CXXFLAGS) -o csguess $(CSGUESS_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o csguess $(CSGUESS_OBJS) \
$(LIBICONV) $(LIBICONV)
trcsguess.o : csguess.cpp trcsguess.o : csguess.cpp
$(CXX) $(CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_CSGUESS -c -o trcsguess.o \
csguess.cpp csguess.cpp
MIMETYPE_OBJS= trmimetype.o $(BIGLIB) MIMETYPE_OBJS= trmimetype.o $(BIGLIB)
mimetype : $(MIMETYPE_OBJS) mimetype : $(MIMETYPE_OBJS)
$(CXX) $(CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o mimetype $(MIMETYPE_OBJS) \
$(LIBICONV) $(LIBSYS) $(LIBICONV) $(LIBSYS)
trmimetype.o : mimetype.cpp trmimetype.o : mimetype.cpp
$(CXX) $(CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_MIMETYPE -c -o trmimetype.o \
mimetype.cpp mimetype.cpp
$(BIGLIB): $(BIGLIB):
cd ../lib;$(MAKE) cd $(depth)/lib;$(MAKE)
$(MIMELIB): $(MIMELIB):
cd ../bincimapmime;$(MAKE) cd $(depth)/bincimapmime;$(MAKE)
depend: alldeps.stamp depend: alldeps.stamp
alldeps.stamp : $(SRCS) alldeps.stamp : $(SRCS)
$(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps
touch alldeps.stamp touch alldeps.stamp
clean: 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 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 PIC_CXXFLAGS = -fPIC -DPIC
DEBUG_CXXFLAGS = -DNDEBUG -DNO_DEBUG -O2 -O DEBUG_CXXFLAGS = -DNDEBUG -DNO_DEBUG -O2 -O
LANG_CXXFLAGS = -fno-exceptions -fno-check-new -fno-common 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 -Wl,-export-dynamic -Wl,-soname -Wl,kio_recoll.so
THREAD_LDFLAGS = -pthread THREAD_LDFLAGS = -pthread
kio_recoll.so : kio_recoll.o kio_recoll.so : kio_recoll.o piclib/librcl.a
c++ -shared $(LDFLAGS) $(THREAD_LDFLAGS) kio_recoll.o \ 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 \ -L/usr/local/lib -L/usr/X11R6/lib -lkio -lkdeui -lkdesu \
-lkdecore \ -lkdecore \
-lDCOP \ -lDCOP \
-lqt-mt \ -lqt-mt \
-lpng -lXext -lX11 -lSM -lICE -lXrender \ -lpng -lXext -lX11 -lSM -lICE -lXrender \
-lz -lfam -lsasl2 -ljpeg -L/usr/lib -lstdc++ -lm \ -lz -lfam -lsasl2 -ljpeg -L/usr/lib -lstdc++ -lm \
-lstdc++ -lc \
-o kio_recoll.so -o kio_recoll.so
kio_recoll.o : kio_recoll.cpp kio_recoll.h 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) \ $(DEBUG_CXXFLAGS) $(LANG_CXXFLAGS) $(QT_CXXFLAGS) $(SYS_CXXFLAGS) \
$(THREAD_CXXFLAGS) \ $(THREAD_CXXFLAGS) \
-o kio_recoll.o -o kio_recoll.o
piclib/librcl.a:
cd piclib;make
.PHONY: all

View File

@ -1,10 +1,15 @@
#ifndef lint #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 #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include <string>
using namespace std;
#include <qfile.h> #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 <kinstance.h>
#include <kio/global.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" #include "kio_recoll.h"
using namespace KIO; using namespace KIO;
RecollProtocol::RecollProtocol(const QCString &pool, const QCString &app) 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() 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) void RecollProtocol::get(const KURL & url)
{ {
fprintf(stderr, "RecollProtocol::get %s\n", url.url().ascii()); fprintf(stderr, "RecollProtocol::get %s\n", url.url().ascii());
mimeType("text/html"); 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 ); QTextStream os(output, IO_WriteOnly );
os.setEncoding(QTextStream::Latin1); os.setEncoding(QTextStream::UnicodeUTF8);
os << os << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">" << endl;
"<html><head><title>Recoll:get</title></head>" os << "<html><head>" << endl;
"<body><h1>Un titre!</h1><p>This is RECOLL</p></body></html>"; 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(output);
data(QByteArray()); data(QByteArray());
@ -55,6 +191,23 @@ void RecollProtocol::mimetype(const KURL & /*url*/)
finished(); 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); } extern "C" { int KDE_EXPORT kdemain(int argc, char **argv); }
int kdemain(int argc, char **argv) int kdemain(int argc, char **argv)

View File

@ -1,6 +1,8 @@
#ifndef _RECOLL_H #ifndef _RECOLL_H
#define _RECOLL_H #define _RECOLL_H
#include <string>
#include <kio/global.h> #include <kio/global.h>
#include <kio/slavebase.h> #include <kio/slavebase.h>
@ -14,5 +16,14 @@ public:
// virtual void listDir( const KURL & url ); // virtual void listDir( const KURL & url );
// virtual void stat( 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 #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 LIBS = librcl.a
@ -15,101 +17,105 @@ OBJS = base64.o conftree.o csguess.o debuglog.o \
textsplit.o transcode.o \ textsplit.o transcode.o \
unacpp.o unac.o docseq.o sortseq.o copyfile.o unacpp.o unac.o docseq.o sortseq.o copyfile.o
SRCS = ../utils/conftree.cpp \ SRCS = \
../index/csguess.cpp ../utils/debuglog.cpp \ $(depth)/utils/conftree.cpp $(depth)/index/csguess.cpp \
../utils/execmd.cpp ../utils/idfile.cpp ../utils/md5.cpp \ $(depth)/utils/debuglog.cpp $(depth)/utils/execmd.cpp \
../utils/wipedir.cpp ../utils/fstreewalk.cpp \ $(depth)/utils/idfile.cpp $(depth)/utils/md5.cpp \
../common/mh_html.cpp ../common/mh_mail.cpp ../common/mh_exec.cpp \ $(depth)/utils/wipedir.cpp $(depth)/utils/fstreewalk.cpp \
../common/mh_text.cpp ../common/htmlparse.cpp \ $(depth)/common/mh_html.cpp $(depth)/common/mh_mail.cpp \
../index/indexer.cpp ../common/internfile.cpp \ $(depth)/common/mh_exec.cpp $(depth)/common/mh_text.cpp \
../common/mimehandler.cpp ../utils/mimeparse.cpp ../index/mimetype.cpp \ $(depth)/common/htmlparse.cpp $(depth)/index/indexer.cpp \
../common/myhtmlparse.cpp ../common/pathhash.cpp ../utils/pathut.cpp \ $(depth)/common/internfile.cpp $(depth)/common/mimehandler.cpp \
../common/rclconfig.cpp ../common/rcldb.cpp ../common/rclinit.cpp \ $(depth)/utils/mimeparse.cpp $(depth)/index/mimetype.cpp \
../utils/base64.cpp ../utils/readfile.cpp ../utils/smallut.cpp \ $(depth)/common/myhtmlparse.cpp $(depth)/common/pathhash.cpp \
../common/textsplit.cpp ../utils/transcode.cpp \ $(depth)/utils/pathut.cpp $(depth)/common/rclconfig.cpp \
../common/unacpp.cpp ../unac/unac.c ../query/history.cpp \ $(depth)/common/rcldb.cpp $(depth)/common/rclinit.cpp \
../query/docseq.cpp ../query/sortseq.cpp ../utils/copyfile.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) librcl.a : $(OBJS)
ar ru librcl.a $(OBJS) ar ru librcl.a $(OBJS)
$(RANLIB) librcl.a $(RANLIB) librcl.a
unac.o : ../unac/unac.c ../unac/unac.h unac.o : $(depth)/unac/unac.c $(depth)/unac/unac.h
$(CC) $(UNACCFLAGS) -c $< $(CC) $(UNACCFLAGS) -c $<
# $(CXX) $(CXXFLAGS) -c $< conftree.o : $(depth)/utils/conftree.cpp
conftree.o : ../utils/conftree.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< csguess.o : $(depth)/index/csguess.cpp
csguess.o : ../index/csguess.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< debuglog.o : $(depth)/utils/debuglog.cpp
debuglog.o : ../utils/debuglog.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< execmd.o : $(depth)/utils/execmd.cpp
execmd.o : ../utils/execmd.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< wipedir.o : $(depth)/utils/wipedir.cpp
wipedir.o : ../utils/wipedir.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< fstreewalk.o : $(depth)/utils/fstreewalk.cpp
fstreewalk.o : ../utils/fstreewalk.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< history.o : $(depth)/query/history.cpp
history.o : ../query/history.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< sortseq.o : $(depth)/query/sortseq.cpp
sortseq.o : ../query/sortseq.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< docseq.o : $(depth)/query/docseq.cpp
docseq.o : ../query/docseq.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mh_html.o : $(depth)/common/mh_html.cpp
mh_html.o : ../common/mh_html.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mh_exec.o : $(depth)/common/mh_exec.cpp
mh_exec.o : ../common/mh_exec.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mh_text.o : $(depth)/common/mh_text.cpp
mh_text.o : ../common/mh_text.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< htmlparse.o : $(depth)/common/htmlparse.cpp
htmlparse.o : ../common/htmlparse.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< idfile.o : $(depth)/utils/idfile.cpp
idfile.o : ../utils/idfile.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< indexer.o : $(depth)/index/indexer.cpp
indexer.o : ../index/indexer.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< internfile.o : $(depth)/common/internfile.cpp
internfile.o : ../common/internfile.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mh_mail.o : $(depth)/common/mh_mail.cpp
mh_mail.o : ../common/mh_mail.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mimehandler.o : $(depth)/common/mimehandler.cpp
mimehandler.o : ../common/mimehandler.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mimeparse.o : $(depth)/utils/mimeparse.cpp
mimeparse.o : ../utils/mimeparse.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< mimetype.o : $(depth)/index/mimetype.cpp
mimetype.o : ../index/mimetype.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< myhtmlparse.o : $(depth)/common/myhtmlparse.cpp
myhtmlparse.o : ../common/myhtmlparse.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< pathut.o : $(depth)/utils/pathut.cpp
pathut.o : ../utils/pathut.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< pathhash.o : $(depth)/common/pathhash.cpp
pathhash.o : ../common/pathhash.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< rclconfig.o : $(depth)/common/rclconfig.cpp
rclconfig.o : ../common/rclconfig.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< rclinit.o : $(depth)/common/rclinit.cpp
rclinit.o : ../common/rclinit.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< rcldb.o : $(depth)/common/rcldb.cpp
rcldb.o : ../common/rcldb.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< readfile.o : $(depth)/utils/readfile.cpp
readfile.o : ../utils/readfile.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< base64.o : $(depth)/utils/base64.cpp
base64.o : ../utils/base64.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< smallut.o : $(depth)/utils/smallut.cpp
smallut.o : ../utils/smallut.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< textsplit.o : $(depth)/common/textsplit.cpp
textsplit.o : ../common/textsplit.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< transcode.o : $(depth)/utils/transcode.cpp
transcode.o : ../utils/transcode.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< md5.o : $(depth)/utils/md5.cpp
md5.o : ../utils/md5.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< unacpp.o : $(depth)/common/unacpp.cpp
unacpp.o : ../common/unacpp.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $< copyfile.o : $(depth)/utils/copyfile.cpp
copyfile.o : ../utils/copyfile.cpp $(CXX) $(ALL_CXXFLAGS) -c $<
$(CXX) $(CXXFLAGS) -c $<
depend: alldeps.stamp depend: alldeps.stamp
alldeps.stamp : $(SRCS) alldeps.stamp : $(SRCS)
$(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps
touch alldeps.stamp touch alldeps.stamp
clean: clean:
@ -118,4 +124,3 @@ clean:
rm -f $(OBJS) $(LIBS) rm -f $(OBJS) $(LIBS)
include alldeps include alldeps
include ../mk/sysconf

View File

@ -35,11 +35,19 @@ rm -f index/recollindex qtgui/recoll
make static || exit 1 make static || exit 1
strip index/recollindex qtgui/recoll strip index/recollindex qtgui/recoll
files="COPYING README INSTALL Makefile recollinstall files="COPYING README INSTALL VERSION Makefile recollinstall
filters sampleconf filters sampleconf doc/user doc/man
index/recollindex qtgui/recoll qtgui/mtpics/*.png" index/recollindex qtgui/recoll qtgui/*.qm qtgui/mtpics/*.png"
$TAR chf - $files | (cd $topdir; $TAR xf -) $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 ; \ (cd $targetdir ; \
$TAR chf - $topdirsimple | \ $TAR chf - $topdirsimple | \
gzip > $tarfile) gzip > $tarfile)

View File

@ -1,7 +1,7 @@
include ../mk/commondefs include $(depth)/mk/commondefs
include ../mk/localdefs include $(depth)/mk/localdefs
CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
-DHAVE_VASPRINTF=1 \ -DHAVE_VASPRINTF=1 \
-DHAVE_MKDTEMP=1 -DHAVE_MKDTEMP=1

View File

@ -1,7 +1,7 @@
include ../mk/commondefs include $(depth)/mk/commondefs
include ../mk/localdefs include $(depth)/mk/localdefs
CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
-pthread \ -pthread \
-DHAVE_VASPRINTF=1 \ -DHAVE_VASPRINTF=1 \
-DHAVE_MKDTEMP=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 \ -D_GNU_SOURCE \
-DPUTENV_ARG_NOT_CONST \ -DPUTENV_ARG_NOT_CONST \
-DHAVE_VASPRINTF=1 \ -DHAVE_VASPRINTF=1 \

View File

@ -1,10 +1,10 @@
include ../mk/commondefs include $(depth)/mk/commondefs
include ../mk/localdefs include $(depth)/mk/localdefs
CXXFLAGS = $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \ ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
-DPUTENV_ARG_NOT_CONST -DPUTENV_ARG_NOT_CONST
CC=gcc CC = gcc
CXX=g++ CXX = g++
LIBSYS = -lpthread -lnsl -lsocket LIBSYS = -lpthread -lnsl -lsocket

View File

@ -1,15 +1,18 @@
# Definitions mostly common to all systems, can be overridden by # Definitions mostly common to all systems, can be overridden by
# sys-specific include # 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 \ # We happen to be using gcc on all platforms for now. Can be overridden in
-I../unac -I../bincimapmime -I/usr/local/include # 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 RANLIB = test -f
AR=ar AR=ar
INSTALL = install -c
#QTDIR = /usr

View File

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

View File

@ -1,5 +1,5 @@
#ifndef lint #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 #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. // Fix result text for display inside the gui text window.
// //
// To compute the term character positions in the output text, we have // 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()); 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); myTextSplitCB cb(terms);
TextSplit splitter(&cb, true); TextSplit splitter(&cb, true);
// Note that splitter returns the term locations in byte, not // Note that splitter returns the term locations in byte, not

View File

@ -1,20 +1,21 @@
#ifndef _PLAINTORICH_H_INCLUDED_ #ifndef _PLAINTORICH_H_INCLUDED_
#define _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> #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 in raw text out of internfile.
* @param terms list of query terms * @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, extern string plaintorich(const string &in,
const list<string>& terms, const list<string>& terms,
list<pair<int, int> >&termoffsets); list<pair<int, int> >&termoffsets);
extern string stripMarkup(const string &in);
#endif /* _PLAINTORICH_H_INCLUDED_ */ #endif /* _PLAINTORICH_H_INCLUDED_ */

View File

@ -550,7 +550,7 @@ void RecollMain::showResultPage()
strftime(datebuf, 99, strftime(datebuf, 99,
"<i>Modified:</i>&nbsp;%Y-%m-%d&nbsp;%H:%M:%S", tm); "<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())); LOGDEB1(("Abstract: {%s}\n", abst.c_str()));
if (!img_name.empty()) { if (!img_name.empty()) {
result += "<img source=\"" + img_name + "\" align=\"left\">"; result += "<img source=\"" + img_name + "\" align=\"left\">";

View File

@ -1,35 +1,37 @@
depth = ..
include $(depth)/mk/sysconf
PROGS = xadump #trhist qtry qxtry PROGS = xadump #trhist qtry qxtry
all: $(PROGS) all: $(PROGS)
XADUMP_OBJS= xadump.o $(BIGLIB) XADUMP_OBJS= xadump.o $(BIGLIB)
xadump : $(XADUMP_OBJS) xadump : $(XADUMP_OBJS)
$(CXX) $(CXXFLAGS) -o xadump $(XADUMP_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o xadump $(XADUMP_OBJS) \
$(LIBICONV) $(LIBXAPIAN) $(LIBSYS) $(LIBICONV) $(LIBXAPIAN) $(LIBSYS)
QXTRY_OBJS= qxtry.o $(BIGLIB) QXTRY_OBJS= qxtry.o $(BIGLIB)
qxtry : $(QXTRY_OBJS) qxtry : $(QXTRY_OBJS)
$(CXX) $(CXXFLAGS) -o qxtry $(QXTRY_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o qxtry $(QXTRY_OBJS) \
$(LIBICONV) $(LIBXAPIAN) $(LIBICONV) $(LIBXAPIAN)
QTRY_OBJS= qtry.o $(BIGLIB) $(MIMELIB) QTRY_OBJS= qtry.o $(BIGLIB) $(MIMELIB)
qtry : $(QTRY_OBJS) qtry : $(QTRY_OBJS)
$(CXX) $(CXXFLAGS) -o qtry $(QTRY_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o qtry $(QTRY_OBJS) \
$(LIBICONV) $(LIBXAPIAN) $(LIBICONV) $(LIBXAPIAN)
HISTORY_OBJS= trhist.o $(BIGLIB) $(MIMELIB) HISTORY_OBJS= trhist.o $(BIGLIB) $(MIMELIB)
trhist : $(HISTORY_OBJS) trhist : $(HISTORY_OBJS)
$(CXX) $(CXXFLAGS) -o trhist $(HISTORY_OBJS) \ $(CXX) $(ALL_CXXFLAGS) -o trhist $(HISTORY_OBJS) \
$(LIBICONV) $(LIBXAPIAN) $(LIBICONV) $(LIBXAPIAN)
trhist.o : history.cpp history.h 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): $(BIGLIB):
cd ../lib;make cd $(depth)/lib;make
depend: alldeps.stamp depend: alldeps.stamp
alldeps.stamp : $(SRCS) alldeps.stamp : $(SRCS)
$(CXX) -M $(CXXFLAGS) $(SRCS) > alldeps $(CXX) -M $(ALL_CXXFLAGS) $(SRCS) > alldeps
touch alldeps.stamp touch alldeps.stamp
clean: clean:
@ -37,5 +39,4 @@ clean:
rm -f alldeps.stamp rm -f alldeps.stamp
rm -f *.o $(PROGS) rm -f *.o $(PROGS)
include ../mk/sysconf
include alldeps include alldeps

View File

@ -1,3 +1,5 @@
depth = ..
include $(depth)/mk/sysconf
PROGS = trconftree wipedir smallut trfstreewalk trpathut \ PROGS = trconftree wipedir smallut trfstreewalk trpathut \
transcode \ transcode \
@ -6,78 +8,77 @@ PROGS = trconftree wipedir smallut trfstreewalk trpathut \
all: $(PROGS) $(BIGLIB) all: $(PROGS) $(BIGLIB)
$(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) trfstreewalk : $(FSTREEWALK_OBJS)
$(CXX) -o trfstreewalk $(FSTREEWALK_OBJS) $(CXX) -o trfstreewalk $(FSTREEWALK_OBJS)
trfstreewalk.o : fstreewalk.cpp fstreewalk.h trfstreewalk.o : fstreewalk.cpp fstreewalk.h
$(CXX) -o trfstreewalk.o -c $(CXXFLAGS) \ $(CXX) -o trfstreewalk.o -c $(ALL_CXXFLAGS) \
-DTEST_FSTREEWALK fstreewalk.cpp -DTEST_FSTREEWALK fstreewalk.cpp
PATHUT_OBJS= trpathut.o pathut.o $(BIGLIB) PATHUT_OBJS= trpathut.o pathut.o $(BIGLIB)
trpathut : $(PATHUT_OBJS) trpathut : $(PATHUT_OBJS)
$(CXX) $(CXXFLAGS) -o trpathut $(PATHUT_OBJS) $(CXX) $(ALL_CXXFLAGS) -o trpathut $(PATHUT_OBJS)
trpathut.o : pathut.cpp pathut.h 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) EXECMD_OBJS= trexecmd.o $(BIGLIB)
trexecmd : $(EXECMD_OBJS) trexecmd : $(EXECMD_OBJS)
$(CXX) $(CXXFLAGS) -o trexecmd $(EXECMD_OBJS) $(CXX) $(ALL_CXXFLAGS) -o trexecmd $(EXECMD_OBJS)
trexecmd.o : execmd.cpp execmd.h 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_OBJS= trtranscode.o $(BIGLIB)
transcode : $(TRANSCODE_OBJS) transcode : $(TRANSCODE_OBJS)
$(CXX) $(CXXFLAGS) -o transcode $(TRANSCODE_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o transcode $(TRANSCODE_OBJS) $(LIBICONV)
trtranscode.o : ../utils/transcode.cpp trtranscode.o : transcode.cpp
$(CXX) $(CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \
transcode.cpp transcode.cpp
IDFILE_OBJS= tridfile.o $(BIGLIB) IDFILE_OBJS= tridfile.o $(BIGLIB)
idfile : $(IDFILE_OBJS) idfile : $(IDFILE_OBJS)
$(CXX) $(CXXFLAGS) -o idfile $(IDFILE_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o idfile $(IDFILE_OBJS) $(LIBICONV)
tridfile.o : ../utils/idfile.cpp tridfile.o : idfile.cpp
$(CXX) $(CXXFLAGS) -DTEST_IDFILE -c -o tridfile.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_IDFILE -c -o tridfile.o \
idfile.cpp idfile.cpp
MIMEPARSE_OBJS= trmimeparse.o $(BIGLIB) MIMEPARSE_OBJS= trmimeparse.o $(BIGLIB)
trmimeparse : $(MIMEPARSE_OBJS) trmimeparse : $(MIMEPARSE_OBJS)
$(CXX) $(CXXFLAGS) -o trmimeparse $(MIMEPARSE_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o trmimeparse $(MIMEPARSE_OBJS) $(LIBICONV)
trmimeparse.o : mimeparse.cpp trmimeparse.o : mimeparse.cpp
$(CXX) $(CXXFLAGS) -DTEST_MIMEPARSE -c -o trmimeparse.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_MIMEPARSE -c -o trmimeparse.o \
mimeparse.cpp mimeparse.cpp
SMALLUT_OBJS= trsmallut.o $(BIGLIB) SMALLUT_OBJS= trsmallut.o $(BIGLIB)
smallut : $(SMALLUT_OBJS) smallut : $(SMALLUT_OBJS)
$(CXX) $(CXXFLAGS) -o smallut $(SMALLUT_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o smallut $(SMALLUT_OBJS) $(LIBICONV)
trsmallut.o : ../utils/smallut.cpp trsmallut.o : smallut.cpp
$(CXX) $(CXXFLAGS) -DTEST_SMALLUT -c -o trsmallut.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_SMALLUT -c -o trsmallut.o \
smallut.cpp smallut.cpp
WIPEDIR_OBJS= trwipedir.o $(BIGLIB) WIPEDIR_OBJS= trwipedir.o $(BIGLIB)
wipedir : $(WIPEDIR_OBJS) wipedir : $(WIPEDIR_OBJS)
$(CXX) $(CXXFLAGS) -o wipedir $(WIPEDIR_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o wipedir $(WIPEDIR_OBJS) $(LIBICONV)
trwipedir.o : ../utils/wipedir.cpp trwipedir.o : wipedir.cpp
$(CXX) $(CXXFLAGS) -DTEST_WIPEDIR -c -o trwipedir.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_WIPEDIR -c -o trwipedir.o \
wipedir.cpp wipedir.cpp
UTF8ITER_OBJS= trutf8iter.o $(BIGLIB) UTF8ITER_OBJS= trutf8iter.o $(BIGLIB)
utf8iter : $(UTF8ITER_OBJS) utf8iter : $(UTF8ITER_OBJS)
$(CXX) $(CXXFLAGS) -o utf8iter $(UTF8ITER_OBJS) $(LIBICONV) $(CXX) $(ALL_CXXFLAGS) -o utf8iter $(UTF8ITER_OBJS) $(LIBICONV)
trutf8iter.o : ../utils/utf8iter.cpp utf8iter.h trutf8iter.o : utf8iter.cpp utf8iter.h
$(CXX) $(CXXFLAGS) -DTEST_UTF8ITER -c -o trutf8iter.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_UTF8ITER -c -o trutf8iter.o \
utf8iter.cpp utf8iter.cpp
CONFTREE_OBJS= trconftree.o $(BIGLIB) CONFTREE_OBJS= trconftree.o $(BIGLIB)
trconftree : $(CONFTREE_OBJS) trconftree : $(CONFTREE_OBJS)
$(CXX) $(CXXFLAGS) -o trconftree $(CONFTREE_OBJS) $(CXX) $(ALL_CXXFLAGS) -o trconftree $(CONFTREE_OBJS)
trconftree.o : ../utils/conftree.cpp trconftree.o : conftree.cpp
$(CXX) $(CXXFLAGS) -DTEST_CONFTREE -c -o trconftree.o \ $(CXX) $(ALL_CXXFLAGS) -DTEST_CONFTREE -c -o trconftree.o \
conftree.cpp conftree.cpp
clean: clean:
rm -f *.o $(PROGS) rm -f *.o $(PROGS)
include ../mk/sysconf

View File

@ -1,5 +1,5 @@
#ifndef lint #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 #endif
#ifndef TEST_SMALLUT #ifndef TEST_SMALLUT
#include <string> #include <string>
@ -311,6 +311,25 @@ void trimstring(string &s, const char *ws)
s.replace(pos+1, string::npos, ""); 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 #else
#include <string> #include <string>

View File

@ -1,6 +1,6 @@
#ifndef _SMALLUT_H_INCLUDED_ #ifndef _SMALLUT_H_INCLUDED_
#define _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 <string>
#include <list> #include <list>
@ -40,4 +40,6 @@ extern bool stringToBool(const string &s);
tab}) at beginning and end of input string */ tab}) at beginning and end of input string */
extern void trimstring(string &s, const char *ws = " \t"); extern void trimstring(string &s, const char *ws = " \t");
extern std::string escapeHtml(const std::string &in);
#endif /* _SMALLUT_H_INCLUDED_ */ #endif /* _SMALLUT_H_INCLUDED_ */