--- /dev/null
+diff -Nur plptools-0.12/kde2/kioslave/kio_plp.cpp plp-cvs/kde2/kioslave/kio_plp.cpp
+--- plptools-0.12/kde2/kioslave/kio_plp.cpp 2002-07-14 22:15:29.000000000 +0200
++++ plp-cvs/kde2/kioslave/kio_plp.cpp 2003-02-05 08:59:07.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,13 +24,12 @@
+ #include <config.h>
+ #endif
+
+-#include "kio_plp.h"
++#include <rfsvfactory.h>
++#include <rpcsfactory.h>
++#include <bufferarray.h>
+
+ #include <iomanip>
+-#include <stdio.h>
+-#include <pwd.h>
+-#include <grp.h>
+-#include <sys/stat.h>
++#include <string>
+
+ #include <qfile.h>
+ #include <qregexp.h>
+@@ -41,11 +40,12 @@
+ #include <klocale.h>
+ #include <kconfig.h>
+
+-#include <rfsvfactory.h>
+-#include <rpcsfactory.h>
+-#include <bufferarray.h>
++#include "kio_plp.h"
+
+-#include <string>
++#include <stdio.h>
++#include <pwd.h>
++#include <grp.h>
++#include <sys/stat.h>
+
+ using namespace KIO;
+
+@@ -1107,7 +1107,7 @@
+ char drv;
+
+ stream >> param;
+- cout << "p='" << param << "'" << endl;
++ kdDebug(PLP_DEBUGAREA) << "p='" << param << "'" << endl;
+ if (param.isEmpty()) {
+ error(ERR_MALFORMED_URL, i18n("(empty)"));
+ return;
+diff -Nur plptools-0.12/kde2/klipsi/toplevel.cpp plp-cvs/kde2/klipsi/toplevel.cpp
+--- plptools-0.12/kde2/klipsi/toplevel.cpp 2002-07-07 15:45:59.000000000 +0200
++++ plp-cvs/kde2/klipsi/toplevel.cpp 2004-03-13 10:47:22.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -40,10 +40,14 @@
+
+ #include <psibitmap.h>
+
++#include <iostream>
++
+ #define QUIT_ITEM 50
+ #define ABOUT_ITEM 51
+ #define CLIPFILE "C:/System/Data/Clpboard.cbd"
+
++using namespace std;
++
+ TopLevel::TopLevel()
+ : KMainWindow(0)
+ {
+@@ -593,7 +597,7 @@
+ KMessageBox::error(NULL, i18n(
+ "<QT>Your Psion does not support the remote clipboard "
+ "protocol.<BR/>The reason for that is usually a missing "
+- "server library on your Psion.<BR/>Make shure, that "
++ "server library on your Psion.<BR/>Make sure that "
+ "<B>C:\\System\\Libs\\clipsvr.rsy</B> exists.<BR/>"
+ "This file is part of PsiWin and usually gets copied "
+ "to your Psion when you enable CopyAnywhere in PsiWin. "
+diff -Nur plptools-0.12/kde2/kpsion/kpsionconfig.cpp plp-cvs/kde2/kpsion/kpsionconfig.cpp
+--- plptools-0.12/kde2/kpsion/kpsionconfig.cpp 2001-05-21 23:46:35.000000000 +0200
++++ plp-cvs/kde2/kpsion/kpsionconfig.cpp 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -26,7 +26,7 @@
+ #include <klocale.h>
+ #include <kstddirs.h>
+
+-#include <iostream.h>
++#include <iostream>
+
+ KPsionConfig::KPsionConfig() {
+ optionNames.insert(OPT_BACKUPDIR, QString("Settings/BackupDir"));
+diff -Nur plptools-0.12/kde2/kpsion/kpsion.cpp plp-cvs/kde2/kpsion/kpsion.cpp
+--- plptools-0.12/kde2/kpsion/kpsion.cpp 2003-02-03 09:29:25.000000000 +0100
++++ plp-cvs/kde2/kpsion/kpsion.cpp 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -55,8 +55,12 @@
+ #include <bufferarray.h>
+ #include <psiprocess.h>
+
++#include <iostream>
++
+ #define STID_CONNECTION 1
+
++using namespace std;
++
+ KPsionMainWindow::KPsionMainWindow()
+ : KMainWindow() {
+ setupActions();
+diff -Nur plptools-0.12/kde2/kpsion/kpsion.h plp-cvs/kde2/kpsion/kpsion.h
+--- plptools-0.12/kde2/kpsion/kpsion.h 2002-08-11 03:41:44.000000000 +0200
++++ plp-cvs/kde2/kpsion/kpsion.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,6 +23,10 @@
+ #ifndef _KPSION_H_
+ #define _KPSION_H_
+
++#include <rfsv.h>
++#include <rpcs.h>
++#include <ppsocket.h>
++
+ // get KDE_VERSION
+ #include <kapplication.h>
+
+@@ -35,10 +39,6 @@
+ #include <kiconview.h>
+ #include <kdialogbase.h>
+
+-#include <rfsv.h>
+-#include <rpcs.h>
+-#include <ppsocket.h>
+-
+ typedef QMap<char,QString> driveMap;
+ typedef QMap<QString,QString> psionMap;
+
+diff -Nur plptools-0.12/kde2/plugins/plpprops.cc plp-cvs/kde2/plugins/plpprops.cc
+--- plptools-0.12/kde2/plugins/plpprops.cc 2002-07-14 22:15:29.000000000 +0200
++++ plp-cvs/kde2/plugins/plpprops.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -40,7 +40,7 @@
+ #include <qwhatsthis.h>
+ #include <qpushbutton.h>
+
+-#include <strstream>
++#include <sstream>
+ #include <iomanip>
+
+ #ifdef ENABLE_NLS
+@@ -937,9 +937,9 @@
+ d->machType->setText(KGlobal::locale()->translate(d->mi.machineType));
+ d->machName->setText(QString(d->mi.machineName));
+ // ??! None of QString's formatting methods knows about long long.
+- ostrstream s;
++ ostringstream s;
+ s << hex << setw(16) << d->mi.machineUID << '\0';
+- d->machUID->setText(QString(s.str()));
++ d->machUID->setText(QString(s.str().c_str()));
+ d->machLang->setText(KGlobal::locale()->translate(d->mi.uiLanguage));
+ d->dispGeo->setText(QString("%1x%2").arg(
+ d->mi.displayWidth).arg(d->mi.displayHeight));
+@@ -980,9 +980,9 @@
+ d->machDST->setText((d->mi.tz.dst_zones & PsiTime::PSI_TZ_HOME)
+ ? i18n("yes") : i18n("no"));
+
+- ostrstream mbs;
++ ostringstream mbs;
+ mbs << d->mi.mainBatteryUsedTime << '\0';
+- d->mbattUsage->setText(QString(mbs.str()));
++ d->mbattUsage->setText(QString(mbs.str().c_str()));
+ pt.setPsiTime(&d->mi.mainBatteryInsertionTime);
+ dt.setTime_t(pt.getTime());
+ d->mbattChanged->setText(KGlobal::locale()->formatDateTime(dt, false));
+@@ -1010,9 +1010,9 @@
+ QString("%1 mV").arg(KGlobal::locale()->formatNumber(
+ d->mi.backupBatteryMaxVoltage, 0)));
+
+- ostrstream bbs;
++ ostringstream bbs;
+ bbs << d->mi.externalPowerUsedTime << '\0';
+- d->epowerUsage->setText(QString(bbs.str()));
++ d->epowerUsage->setText(QString(bbs.str().c_str()));
+ d->epowerSupplied->setText(
+ d->mi.externalPower ? i18n("Yes") : i18n("No"));
+ }
+diff -Nur plptools-0.12/kde2/plugins/plppropsFactory.cc plp-cvs/kde2/plugins/plppropsFactory.cc
+--- plptools-0.12/kde2/plugins/plppropsFactory.cc 2002-03-20 01:20:41.000000000 +0100
++++ plp-cvs/kde2/plugins/plppropsFactory.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -5,7 +5,7 @@
+ #include "plppropsFactory.h"
+ #include "plpprops.h"
+
+-#include <stream.h>
++#include <iostream>
+ #include <kdebug.h>
+ #include <klocale.h>
+
+diff -Nur plptools-0.12/lib/bufferarray.cc plp-cvs/lib/bufferarray.cc
+--- plptools-0.12/lib/bufferarray.cc 2001-03-01 01:22:22.000000000 +0100
++++ plp-cvs/lib/bufferarray.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,9 +21,9 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+-
+-#include <stream.h>
+-#include <iomanip.h>
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
+
+ #include "bufferstore.h"
+ #include "bufferarray.h"
+diff -Nur plptools-0.12/lib/bufferarray.h plp-cvs/lib/bufferarray.h
+--- plptools-0.12/lib/bufferarray.h 2001-03-01 01:22:22.000000000 +0100
++++ plp-cvs/lib/bufferarray.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -27,6 +27,7 @@
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
++
+ class bufferStore;
+
+ /**
+diff -Nur plptools-0.12/lib/bufferstore.cc plp-cvs/lib/bufferstore.cc
+--- plptools-0.12/lib/bufferstore.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/bufferstore.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,16 +25,17 @@
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+-#include <stream.h>
++
++#include "bufferstore.h"
++
+ // Should be iostream.h, but won't build on Sun WorkShop C++ 5.0
+ #include <iomanip>
++#include <string>
++
+ #include <stdlib.h>
+-#include <string.h>
+ #include <ctype.h>
+ #include <assert.h>
+
+-#include "bufferstore.h"
+-
+ using namespace std;
+
+ bufferStore::bufferStore()
+diff -Nur plptools-0.12/lib/bufferstore.h plp-cvs/lib/bufferstore.h
+--- plptools-0.12/lib/bufferstore.h 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/bufferstore.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,8 +24,9 @@
+ #ifndef _BUFFERSTORE_H_
+ #define _BUFFERSTORE_H_
+
++#include <iostream>
++
+ #include <sys/types.h>
+-#include <stream.h>
+
+ /**
+ * A generic container for an array of bytes.
+diff -Nur plptools-0.12/lib/Enum.cc plp-cvs/lib/Enum.cc
+--- plptools-0.12/lib/Enum.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/Enum.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -20,6 +20,10 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include "Enum.h"
+
+ using namespace std;
+diff -Nur plptools-0.12/lib/Enum.h plp-cvs/lib/Enum.h
+--- plptools-0.12/lib/Enum.h 2002-08-10 20:47:05.000000000 +0200
++++ plp-cvs/lib/Enum.h 2004-09-08 18:46:37.000000000 +0200
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -27,11 +27,13 @@
+ #include <config.h>
+ #endif
+
+-#include <plpintl.h>
+-
++#include <assert.h>
+ #include <map>
+ #include <string>
+
++#include <plpintl.h>
++#include <assert.h>
++
+ /**
+ * the Base for the Enum template.
+ * currently, only purpose is to provide a class type for mapping
+@@ -276,13 +278,13 @@
+ * // declaration of enumeration; somewhere
+ * class rfsv {
+ * [...]
+- * enum PSI_ERROR_CODES { E_PSI_GEN_NONE, E_PSI_GEN_FAIL, E_PSI_GEN_ARG };
++ * enum PSI_ERROR_CODES { E_PSI_GEN_NONE, E_PSI_GEN_FAIL, E_PSI_GEN_ARG };
+ * [...]
+ * };
+ *
+ * // definition of the Enum<E> with the appropriate string representations
+ * ENUM_DEFINITION(rfsv::PSI_ERROR_CODES,
+- * rfsv::E_PSI_GEN_NONE) {
++ * rfsv::E_PSI_GEN_NONE) {
+ * stringRep.add(rfsv::E_PSI_GEN_NONE, "no error");
+ * stringRep.add(rfsv::E_PSI_GEN_FAIL, "general");
+ * stringRep.add(rfsv::E_PSI_GEN_ARG, "bad argument");
+diff -Nur plptools-0.12/lib/iowatch.cc plp-cvs/lib/iowatch.cc
+--- plptools-0.12/lib/iowatch.cc 2002-08-11 03:41:44.000000000 +0200
++++ plp-cvs/lib/iowatch.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,15 +21,18 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include "iowatch.h"
++
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
+-#include <stream.h>
+ #include <memory.h>
+
+-#include "iowatch.h"
+-
+ IOWatch::IOWatch() {
+ num = 0;
+ io = new int [FD_SETSIZE];
+diff -Nur plptools-0.12/lib/log.cc plp-cvs/lib/log.cc
+--- plptools-0.12/lib/log.cc 2003-02-03 01:56:52.000000000 +0100
++++ plp-cvs/lib/log.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -22,13 +22,14 @@
+ *
+ */
+ #include "log.h"
++
+ #include <unistd.h>
+
+-logbuf::logbuf(int level, int fd) {
++logbuf::logbuf(int loglevel, int fd) {
+ ptr = buf;
+ len = 0;
+ _on = true;
+- _level = level;
++ _level = loglevel;
+ _fd = fd;
+ }
+
+diff -Nur plptools-0.12/lib/log.h plp-cvs/lib/log.h
+--- plptools-0.12/lib/log.h 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/log.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,7 +24,8 @@
+ #ifndef _LOG_H_
+ #define _LOG_H_
+
+-#include <ostream.h>
++#include <iostream>
++
+ #include <syslog.h>
+
+ /**
+@@ -51,32 +52,32 @@
+ * file. If it is omitted or set to -1, logging can be switched on
+ * or off. The initial state is on.
+ */
+-class logbuf : public streambuf {
++class logbuf : public std::streambuf {
+ public:
+
+ /**
+ * Constructs a new instance.
+ *
+- * @param level The log level for this instance.
++ * @param loglevel The log level for this instance.
+ * see syslog(3) for symbolic names to use.
+ * @param fd An optional file descriptor to use
+ * if switched off.
+ */
+- logbuf(int level, int fd = -1);
++ logbuf(int loglevel, int fd = -1);
+
+ /**
+ * Switches loggin on or off.
+ *
+- * @param on The desired state.
++ * @param newstate The desired state.
+ */
+- void setOn(bool on) { _on = on; }
++ void setOn(bool newstate) { _on = newstate; }
+
+ /**
+ * Modifies the loglevel of this instance.
+ *
+- * @param level The new loglevel.
++ * @param newlevel The new loglevel.
+ */
+- void setLevel(int level) { _level = level; }
++ void setLevel(int newlevel) { _level = newlevel; }
+
+ /**
+ * Retrieve the current state.
+diff -Nur plptools-0.12/lib/plpdirent.cc plp-cvs/lib/plpdirent.cc
+--- plptools-0.12/lib/plpdirent.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/plpdirent.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,7 +21,7 @@
+ *
+ */
+ #include "plpdirent.h"
+-#include <stream.h>
++
+ #include <iomanip>
+
+ using namespace std;
+diff -Nur plptools-0.12/lib/plpdirent.h plp-cvs/lib/plpdirent.h
+--- plptools-0.12/lib/plpdirent.h 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/plpdirent.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,9 @@
+ #ifndef _PLPDIRENT_H_
+ #define _PLPDIRENT_H_
+
++#include <iostream>
+ #include <string>
++
+ #include <psitime.h>
+ #include <rfsv.h>
+
+@@ -175,7 +177,7 @@
+ * The output is in human readable similar to the
+ * output of a "ls" command.
+ */
+- friend ostream &operator<<(ostream &o, const PlpDirent &e);
++ friend std::ostream &operator<<(std::ostream &o, const PlpDirent &e);
+
+ private:
+ u_int32_t size;
+diff -Nur plptools-0.12/lib/ppsocket.cc plp-cvs/lib/ppsocket.cc
+--- plptools-0.12/lib/ppsocket.cc 2002-08-05 14:36:02.000000000 +0200
++++ plp-cvs/lib/ppsocket.cc 2004-09-08 19:09:06.000000000 +0200
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,10 +25,15 @@
+ #include "config.h"
+ #endif
+
++#include "bufferstore.h"
++#include "ppsocket.h"
++#include "iowatch.h"
++
++#include <iostream>
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
+-#include <iostream.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <errno.h>
+@@ -38,13 +43,13 @@
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+
+-#include "bufferstore.h"
+-#include "ppsocket.h"
+-#include "iowatch.h"
+-
+ #define INVALID_SOCKET -1
+ #define SOCKET_ERROR -1
+
++#ifndef MSG_NOSIGNAL
++#define MSG_NOSIGNAL 0
++#endif
++
+ using namespace std;
+
+ ppsocket::ppsocket(const ppsocket & another)
+diff -Nur plptools-0.12/lib/ppsocket.h plp-cvs/lib/ppsocket.h
+--- plptools-0.12/lib/ppsocket.h 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/ppsocket.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,6 +25,7 @@
+ #define _PPSOCKET_H_
+
+ #include <string>
++
+ #include <unistd.h>
+ #include <netdb.h>
+ #include <sys/socket.h>
+diff -Nur plptools-0.12/lib/psibitmap.cpp plp-cvs/lib/psibitmap.cpp
+--- plptools-0.12/lib/psibitmap.cpp 2002-03-04 02:34:16.000000000 +0100
++++ plp-cvs/lib/psibitmap.cpp 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -142,17 +142,17 @@
+ bool
+ decodeBitmap(const unsigned char *p, int &width, int &height, bufferStore &out)
+ {
+- u_int32_t totlen = *((u_int32_t*)p); p += 4;
+- u_int32_t hdrlen = *((u_int32_t*)p); p += 4;
++ u_int32_t totlen = *((const u_int32_t*)p); p += 4;
++ u_int32_t hdrlen = *((const u_int32_t*)p); p += 4;
+ u_int32_t datlen = totlen - hdrlen;
+- u_int32_t xPixels = *((u_int32_t*)p); p += 4;
+- u_int32_t yPixels = *((u_int32_t*)p); p += 4;
+- u_int32_t xTwips = *((u_int32_t*)p); p += 4;
+- u_int32_t yTwips = *((u_int32_t*)p); p += 4;
+- u_int32_t bitsPerPixel = *((u_int32_t*)p); p += 4;
+- u_int32_t unknown1 = *((u_int32_t*)p); p += 4;
+- u_int32_t unknown2 = *((u_int32_t*)p); p += 4;
+- u_int32_t RLEflag = *((u_int32_t*)p); p += 4;
++ u_int32_t xPixels = *((const u_int32_t*)p); p += 4;
++ u_int32_t yPixels = *((const u_int32_t*)p); p += 4;
++ u_int32_t xTwips = *((const u_int32_t*)p); p += 4;
++ u_int32_t yTwips = *((const u_int32_t*)p); p += 4;
++ u_int32_t bitsPerPixel = *((const u_int32_t*)p); p += 4;
++ u_int32_t unknown1 = *((const u_int32_t*)p); p += 4;
++ u_int32_t unknown2 = *((const u_int32_t*)p); p += 4;
++ u_int32_t RLEflag = *((const u_int32_t*)p); p += 4;
+
+ width = xPixels;
+ height = yPixels;
+diff -Nur plptools-0.12/lib/psiprocess.cc plp-cvs/lib/psiprocess.cc
+--- plptools-0.12/lib/psiprocess.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/psiprocess.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,8 +21,8 @@
+ *
+ */
+ #include "psiprocess.h"
+-#include <stream.h>
+-#include <strstream>
++
++#include <sstream>
+ #include <iomanip>
+
+ using namespace std;
+@@ -63,13 +63,13 @@
+
+ const char *PsiProcess::
+ getProcId() {
+- ostrstream tmp;
++ ostringstream tmp;
+
+ if (s5mx)
+ tmp << name << ".$" << setw(2) << setfill('0') << pid << '\0';
+ else
+ tmp << name << ".$" << pid << '\0';
+- return tmp.str();
++ return tmp.str().c_str();
+ }
+
+ void PsiProcess::
+diff -Nur plptools-0.12/lib/psiprocess.h plp-cvs/lib/psiprocess.h
+--- plptools-0.12/lib/psiprocess.h 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/psiprocess.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,7 +24,7 @@
+ #define _PSIPROCESS_H_
+
+ #include <string>
+-#include <stream.h>
++#include <iostream>
+
+ class rpcs;
+
+diff -Nur plptools-0.12/lib/psitime.cc plp-cvs/lib/psitime.cc
+--- plptools-0.12/lib/psitime.cc 2002-08-05 13:27:54.000000000 +0200
++++ plp-cvs/lib/psitime.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,11 +21,14 @@
+ *
+ */
+ #include "psitime.h"
++#include "plp_inttypes.h"
++
+ #include <stdlib.h>
+-#include <plp_inttypes.h>
+
+ #define OnePM 3600 // 13:00 offset for SIBO
+
++using namespace std;
++
+ PsiTime::PsiTime(void) {
+ ptzValid = false;
+ tryPsiZone();
+@@ -63,7 +66,7 @@
+ psi2unix();
+ }
+
+-PsiTime::PsiTime(struct timeval *_utv, struct timezone *_utz = 0L) {
++PsiTime::PsiTime(struct timeval *_utv, struct timezone *_utz) {
+ if (_utv != 0L)
+ utv = *_utv;
+ if (_utz != 0L)
+diff -Nur plptools-0.12/lib/psitime.h plp-cvs/lib/psitime.h
+--- plptools-0.12/lib/psitime.h 2002-08-05 13:04:16.000000000 +0200
++++ plp-cvs/lib/psitime.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -27,6 +27,8 @@
+ #include <config.h>
+ #endif
+
++#include <iostream>
++
+ #if TIME_WITH_SYS_TIME
+ # include <sys/time.h>
+ # include <time.h>
+@@ -41,7 +43,6 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+
+-#include <ostream.h>
+ #include <plpintl.h>
+
+ /**
+@@ -54,8 +55,8 @@
+ /**
+ * Prints a psi_timeval in human readable format.
+ */
+- friend ostream &operator<<(ostream &o, const psi_timeval_t &ptv) {
+- ostream::fmtflags old = o.flags();
++ friend std::ostream &operator<<(std::ostream &o, const psi_timeval_t &ptv) {
++ std::ostream::fmtflags old = o.flags();
+ u_int64_t micro = ptv.tv_high;
+ micro = (micro << 32) | ptv.tv_low;
+ micro /= 1000000;
+@@ -95,8 +96,8 @@
+ * holds a Psion time zone description.
+ */
+ typedef struct psi_timezone_t {
+- friend ostream &operator<<(ostream &s, const psi_timezone_t &ptz) {
+- ostream::fmtflags old = s.flags();
++ friend std::ostream &operator<<(std::ostream &s, const psi_timezone_t &ptz) {
++ std::ostream::fmtflags old = s.flags();
+ int h = ptz.utc_offset / 3600;
+ int m = ptz.utc_offset % 3600;
+ s << "offs: " << std::dec << h << "h";
+@@ -291,7 +292,7 @@
+ *
+ * @returns The stream.
+ */
+- friend ostream &operator<<(ostream &s, const PsiTime &t);
++ friend std::ostream &operator<<(std::ostream &s, const PsiTime &t);
+
+ /**
+ * Assignment operator
+@@ -310,7 +311,7 @@
+ PSI_TZ_EUROPEAN = 1,
+ PSI_TZ_NORTHERN = 2,
+ PSI_TZ_SOUTHERN = 4,
+- PSI_TZ_HOME = 0x40000000,
++ PSI_TZ_HOME = 0x40000000
+ };
+
+ private:
+diff -Nur plptools-0.12/lib/rclip.cc plp-cvs/lib/rclip.cc
+--- plptools-0.12/lib/rclip.cc 2001-07-31 20:30:32.000000000 +0200
++++ plp-cvs/lib/rclip.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,18 +24,14 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
++#include "rclip.h"
++#include "bufferstore.h"
++#include "ppsocket.h"
++#include "bufferarray.h"
++#include "Enum.h"
++
+ #include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+ #include <time.h>
+-#include <string.h>
+-
+-#include <rclip.h>
+-#include <bufferstore.h>
+-#include <ppsocket.h>
+-#include <bufferarray.h>
+-#include <Enum.h>
+
+ rclip::rclip(ppsocket * _skt)
+ {
+diff -Nur plptools-0.12/lib/rclip.h plp-cvs/lib/rclip.h
+--- plptools-0.12/lib/rclip.h 2002-03-08 09:35:01.000000000 +0100
++++ plp-cvs/lib/rclip.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -143,7 +143,7 @@
+ enum commands {
+ RCLIP_INIT = 0x00,
+ RCLIP_NOTIFY = 0x08,
+- RCLIP_LISTEN = 0x04,
++ RCLIP_LISTEN = 0x04
+ };
+
+ /**
+diff -Nur plptools-0.12/lib/rfsv16.cc plp-cvs/lib/rfsv16.cc
+--- plptools-0.12/lib/rfsv16.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/rfsv16.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -26,18 +26,17 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip>
+-#include <time.h>
+-#include <string>
+-
+ #include "rfsv16.h"
+ #include "bufferstore.h"
+ #include "ppsocket.h"
+ #include "bufferarray.h"
+
++#include <iostream>
++#include <fstream>
++
++#include <stdlib.h>
++#include <time.h>
++
+ #define RFSV16_MAXDATALEN 852 // 640
+
+ using namespace std;
+@@ -347,7 +346,6 @@
+ return status;
+
+ while (1) {
+- bufferStore a;
+ a.init();
+ a.addWord(fileHandle & 0xFFFF);
+ if (!sendCommand(FDEVICEREAD, a))
+diff -Nur plptools-0.12/lib/rfsv32.cc plp-cvs/lib/rfsv32.cc
+--- plptools-0.12/lib/rfsv32.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/rfsv32.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,19 +25,18 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdlib.h>
+-#include <fstream>
+-#include <iomanip>
+-#include <time.h>
+-#include <string>
+-
+ #include "rfsv32.h"
+ #include "bufferstore.h"
+ #include "ppsocket.h"
+ #include "bufferarray.h"
+ #include "plpdirent.h"
+
++#include <iostream>
++#include <fstream>
++
++#include <stdlib.h>
++#include <time.h>
++
+ using namespace std;
+
+ rfsv32::rfsv32(ppsocket * _skt)
+@@ -856,14 +855,14 @@
+ };
+
+ Enum<rfsv::errs> rfsv32::
+-err2psierr(int32_t status)
++err2psierr(int32_t istatus)
+ {
+- if ((status > E_EPOC_NONE) || (status < E_EPOC_DIR_FULL)) {
+- cerr << "FATAL: inavlid error-code" << endl;
+- cerr << "status: " << status << " " << hex << status << endl;
++ if ((istatus > E_EPOC_NONE) || (istatus < E_EPOC_DIR_FULL)) {
++ cerr << "FATAL: invalid error-code" << endl;
++ cerr << "status: " << istatus << " " << hex << istatus << endl;
+ return E_PSI_INTERNAL;
+ }
+- return e2psi[status - E_EPOC_DIR_FULL];
++ return e2psi[istatus - E_EPOC_DIR_FULL];
+ }
+
+
+diff -Nur plptools-0.12/lib/rfsv.cc plp-cvs/lib/rfsv.cc
+--- plptools-0.12/lib/rfsv.cc 2002-07-17 19:43:09.000000000 +0200
++++ plp-cvs/lib/rfsv.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -22,6 +22,10 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
+ #include "rfsv.h"
+ #include "ppsocket.h"
+ #include "bufferstore.h"
+diff -Nur plptools-0.12/lib/rfsvfactory.cc plp-cvs/lib/rfsvfactory.cc
+--- plptools-0.12/lib/rfsvfactory.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/rfsvfactory.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,13 +24,6 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "rfsv.h"
+ #include "rfsv16.h"
+ #include "rfsv32.h"
+@@ -39,6 +32,9 @@
+ #include "ppsocket.h"
+ #include "Enum.h"
+
++#include <stdlib.h>
++#include <time.h>
++
+ using namespace std;
+
+ ENUM_DEFINITION(rfsvfactory::errs, rfsvfactory::FACERR_NONE) {
+diff -Nur plptools-0.12/lib/rfsvfactory.h plp-cvs/lib/rfsvfactory.h
+--- plptools-0.12/lib/rfsvfactory.h 2002-03-08 09:35:01.000000000 +0100
++++ plp-cvs/lib/rfsvfactory.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -45,7 +45,7 @@
+ FACERR_AGAIN = 2,
+ FACERR_NOPSION = 3,
+ FACERR_PROTVERSION = 4,
+- FACERR_NORESPONSE = 5,
++ FACERR_NORESPONSE = 5
+ };
+
+ /**
+diff -Nur plptools-0.12/lib/rfsv.h plp-cvs/lib/rfsv.h
+--- plptools-0.12/lib/rfsv.h 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/rfsv.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -26,6 +26,7 @@
+
+ #include <deque>
+ #include <string>
++
+ #include <Enum.h>
+ #include <plpdirent.h>
+ #include <bufferstore.h>
+@@ -91,7 +92,7 @@
+ enum open_flags {
+ PSI_O_RDONLY = 0000,
+ PSI_O_WRONLY = 0001,
+- PSI_O_RDWR = 0002,
++ PSI_O_RDWR = 0002
+ };
+
+ /**
+@@ -102,7 +103,7 @@
+ PSI_O_EXCL = 00200,
+ PSI_O_TRUNC = 01000,
+ PSI_O_APPEND = 02000,
+- PSI_O_SHARE = 04000,
++ PSI_O_SHARE = 04000
+ };
+
+ /**
+@@ -210,7 +211,7 @@
+ PSI_A_READ = 0x0200,
+ PSI_A_EXEC = 0x0400,
+ PSI_A_STREAM = 0x0800,
+- PSI_A_TEXT = 0x1000,
++ PSI_A_TEXT = 0x1000
+ };
+
+ virtual ~rfsv();
+diff -Nur plptools-0.12/lib/rpcs16.cc plp-cvs/lib/rpcs16.cc
+--- plptools-0.12/lib/rpcs16.cc 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/rpcs16.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,19 +25,15 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "rpcs16.h"
+ #include "bufferstore.h"
+ #include "bufferarray.h"
+ #include "ppsocket.h"
+
++#include <stdio.h>
++#include <stdlib.h>
++#include <time.h>
++
+ using namespace std;
+
+ rpcs16::rpcs16(ppsocket * _skt)
+diff -Nur plptools-0.12/lib/rpcs32.cc plp-cvs/lib/rpcs32.cc
+--- plptools-0.12/lib/rpcs32.cc 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/rpcs32.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,19 +24,17 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "rpcs32.h"
+ #include "bufferstore.h"
+ #include "bufferarray.h"
+ #include "ppsocket.h"
+
++#include <iostream>
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <time.h>
++
+ using namespace std;
+
+ rpcs32::rpcs32(ppsocket * _skt)
+diff -Nur plptools-0.12/lib/rpcs.cc plp-cvs/lib/rpcs.cc
+--- plptools-0.12/lib/rpcs.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/lib/rpcs.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,14 +24,6 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "rpcs.h"
+ #include "bufferstore.h"
+ #include "ppsocket.h"
+@@ -39,6 +31,10 @@
+ #include "psiprocess.h"
+ #include "Enum.h"
+
++#include <stdio.h>
++#include <stdlib.h>
++#include <time.h>
++
+ using namespace std;
+
+ ENUM_DEFINITION(rpcs::machs, rpcs::PSI_MACH_UNKNOWN) {
+@@ -387,23 +383,20 @@
+ if ((res = (enum rfsv::errs)getResponse(a, true)) != rfsv::E_PSI_GEN_NONE)
+ return res;
+ a.addByte(0);
+- int l = a.getLen();
+- char *s = (char *)a.getString(0);
+- for (int i = 0; i < l; i++)
+- if (s[i] == 6)
+- s[i] = 0;
++ string s = a.getString(0);
+ owner.clear();
+- while (l > 0) {
+- if (*s != '\0') {
+- bufferStore b;
+- b.addStringT(s);
+- owner += b;
+- l -= (strlen(s) + 1);
+- s += (strlen(s) + 1);
+- } else {
+- l--;
+- s++;
+- }
++ int p = 0;
++ int l;
++ while ((l = s.find('\006', p)) != s.npos) {
++ bufferStore b;
++ b.addStringT(s.substr(p, l - p).c_str());
++ owner += b;
++ p = l + 1;
++ }
++ if (s.substr(p).length()) {
++ bufferStore b;
++ b.addStringT(s.substr(p).c_str());
++ owner += b;
+ }
+ return res;
+ }
+diff -Nur plptools-0.12/lib/rpcsfactory.cc plp-cvs/lib/rpcsfactory.cc
+--- plptools-0.12/lib/rpcsfactory.cc 2001-03-01 01:22:22.000000000 +0100
++++ plp-cvs/lib/rpcsfactory.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,21 +24,16 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "rpcs16.h"
+ #include "rpcs32.h"
+ #include "rpcsfactory.h"
+ #include "bufferstore.h"
+ #include "ppsocket.h"
+-
+ #include "Enum.h"
+
++#include <stdlib.h>
++#include <time.h>
++
+ ENUM_DEFINITION(rpcsfactory::errs, rpcsfactory::FACERR_NONE) {
+ stringRep.add(rpcsfactory::FACERR_NONE, N_("no error"));
+ stringRep.add(rpcsfactory::FACERR_COULD_NOT_SEND, N_("could not send version request"));
+diff -Nur plptools-0.12/lib/rpcsfactory.h plp-cvs/lib/rpcsfactory.h
+--- plptools-0.12/lib/rpcsfactory.h 2002-03-08 09:35:01.000000000 +0100
++++ plp-cvs/lib/rpcsfactory.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -44,7 +44,7 @@
+ FACERR_AGAIN = 2,
+ FACERR_NOPSION = 3,
+ FACERR_PROTVERSION = 4,
+- FACERR_NORESPONSE = 5,
++ FACERR_NORESPONSE = 5
+ };
+
+ /**
+diff -Nur plptools-0.12/lib/rpcs.h plp-cvs/lib/rpcs.h
+--- plptools-0.12/lib/rpcs.h 2002-07-14 21:07:04.000000000 +0200
++++ plp-cvs/lib/rpcs.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,12 +23,13 @@
+ #ifndef _RPCS_H_
+ #define _RPCS_H_
+
+-#include <vector>
+ #include <psitime.h>
+ #include <psiprocess.h>
+ #include <rfsv.h>
+ #include <Enum.h>
+
++#include <vector>
++
+ class ppsocket;
+ class bufferStore;
+ class bufferArray;
+@@ -66,7 +67,7 @@
+ PSI_MACH_SIENNA = 7,
+ PSI_MACH_S3C = 8,
+ PSI_MACH_S5 = 32,
+- PSI_MACH_WINC = 33,
++ PSI_MACH_WINC = 33
+ // TODO: Code for 5mx
+ };
+
+@@ -102,7 +103,7 @@
+ PSI_LANG_cs_CZ = 25,
+ PSI_LANG_sk_SK = 26,
+ PSI_LANG_pl_PL = 27,
+- PSI_LANG_sl_SI = 28,
++ PSI_LANG_sl_SI = 28
+ };
+
+ /**
+@@ -112,7 +113,7 @@
+ PSI_BATT_DEAD = 0,
+ PSI_BATT_VERYLOW = 1,
+ PSI_BATT_LOW = 2,
+- PSI_BATT_GOOD = 3,
++ PSI_BATT_GOOD = 3
+ };
+
+ /**
+diff -Nur plptools-0.12/lib/siscomponentrecord.cpp plp-cvs/lib/siscomponentrecord.cpp
+--- plptools-0.12/lib/siscomponentrecord.cpp 2002-07-06 20:39:33.000000000 +0200
++++ plp-cvs/lib/siscomponentrecord.cpp 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /** -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -83,10 +83,10 @@
+ sisFile->getLanguage(i)->m_name,
+ m_nameLengths[i],
+ buf + m_namePtrs[i]);
+- int len = m_nameLengths[i];
+- m_names[i] = new uint8_t[len + 1];
+- memcpy(m_names[i], buf + m_namePtrs[i], len);
+- m_names[i][len] = 0;
++ int nlen = m_nameLengths[i];
++ m_names[i] = new uint8_t[nlen + 1];
++ memcpy(m_names[i], buf + m_namePtrs[i], nlen);
++ m_names[i][nlen] = 0;
+ }
+ if (logLevel >= 1)
+ printf(_("%d .. %d (%d bytes): Name records\n"), base, base + size, size);
+diff -Nur plptools-0.12/lib/siscomponentrecord.h plp-cvs/lib/siscomponentrecord.h
+--- plptools-0.12/lib/siscomponentrecord.h 2002-07-06 20:39:33.000000000 +0200
++++ plp-cvs/lib/siscomponentrecord.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISCOMPONENTRECORD_H
+ #define _SISCOMPONENTRECORD_H
+
+-#include "sistypes.h"
++#include <sistypes.h>
+
+ class SISFile;
+
+diff -Nur plptools-0.12/lib/sisfile.h plp-cvs/lib/sisfile.h
+--- plptools-0.12/lib/sisfile.h 2002-07-06 20:39:33.000000000 +0200
++++ plp-cvs/lib/sisfile.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,9 +23,9 @@
+ #ifndef _SISFILE_H
+ #define _SISFILE_H
+
+-#include "sistypes.h"
+-#include "sisfileheader.h"
+-#include "siscomponentrecord.h"
++#include <sistypes.h>
++#include <sisfileheader.h>
++#include <siscomponentrecord.h>
+
+ class SISLangRecord;
+ class SISFileRecord;
+diff -Nur plptools-0.12/lib/sisfileheader.h plp-cvs/lib/sisfileheader.h
+--- plptools-0.12/lib/sisfileheader.h 2002-03-10 17:29:26.000000000 +0100
++++ plp-cvs/lib/sisfileheader.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISFILEHEADER_H
+ #define _SISFILEHEADER_H
+
+-#include "sistypes.h"
++#include <sistypes.h>
+
+ /**
+ * The first part of a SISFile.
+@@ -62,21 +62,23 @@
+
+ enum FileOptions {
+ op_isUnicode = 1,
+- op_isDistributable = 2,
++ op_isDistributable = 2
+ #ifdef EPOC6
++ ,
+ op_noCompress = 8,
+- op_shutdownApps = 16,
++ op_shutdownApps = 16
+ #endif
+ };
+
+ enum FileType {
+- FT_App = 0,
++ FT_App = 0
+ #ifdef EPOC6
++ ,
+ FT_System = 1,
+ FT_Option = 2,
+ FT_Config = 3,
+ FT_Patch = 4,
+- FT_Upgrade = 5,
++ FT_Upgrade = 5
+ #endif
+ };
+
+diff -Nur plptools-0.12/lib/sisfilerecord.h plp-cvs/lib/sisfilerecord.h
+--- plptools-0.12/lib/sisfilerecord.h 2002-04-05 17:07:02.000000000 +0200
++++ plp-cvs/lib/sisfilerecord.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISFILERECORD_H
+ #define _SISFILERECORD_H
+
+-#include "sistypes.h"
++#include <sistypes.h>
+
+ class SISFile;
+
+diff -Nur plptools-0.12/lib/sislangrecord.h plp-cvs/lib/sislangrecord.h
+--- plptools-0.12/lib/sislangrecord.h 2002-03-08 09:34:06.000000000 +0100
++++ plp-cvs/lib/sislangrecord.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISLANGRECORD_H
+ #define _SISLANGRECORD_H
+
+-#include "sistypes.h"
++#include <sistypes.h>
+
+ /**
+ * A simple language record, only containing the epoc specific 16 bit
+diff -Nur plptools-0.12/lib/sisreqrecord.h plp-cvs/lib/sisreqrecord.h
+--- plptools-0.12/lib/sisreqrecord.h 2002-03-08 09:34:06.000000000 +0100
++++ plp-cvs/lib/sisreqrecord.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISREQRECORD_H
+ #define _SISREQRECORD_H
+
+-#include "sistypes.h"
++#include <sistypes.h>
+
+ class SISFile;
+
+diff -Nur plptools-0.12/lib/sistypes.h plp-cvs/lib/sistypes.h
+--- plptools-0.12/lib/sistypes.h 2002-04-05 17:07:02.000000000 +0200
++++ plp-cvs/lib/sistypes.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,7 +23,7 @@
+ #ifndef _SISTYPES_H
+ #define _SISTYPES_H
+
+-#include "plp_inttypes.h"
++#include <plp_inttypes.h>
+
+ /**
+ * Return Codes.
+@@ -38,7 +38,7 @@
+ SIS_DIFFERENT_APP,
+ SIS_VER_EARLIER,
+ SIS_SAME_OR_LATER,
+- SIS_OTHER_VARIANT,
++ SIS_OTHER_VARIANT
+ };
+
+ extern uint16_t read16(uint8_t* p);
+@@ -61,7 +61,7 @@
+ {
+ uint16_t m_no;
+ char m_code[3];
+- char* m_name;
++ const char* m_name;
+ };
+
+ extern LangTableEntry langTable[];
+diff -Nur plptools-0.12/lib/wprt.cc plp-cvs/lib/wprt.cc
+--- plptools-0.12/lib/wprt.cc 2002-03-04 00:49:27.000000000 +0100
++++ plp-cvs/lib/wprt.cc 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,19 +24,19 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
+-#include <stdlib.h>
+-#include <fstream.h>
+-#include <iomanip.h>
+-#include <time.h>
+-#include <string.h>
+-
+ #include "wprt.h"
+ #include "bufferstore.h"
+ #include "ppsocket.h"
+ #include "bufferarray.h"
+ #include "Enum.h"
+
++#include <iostream>
++
++#include <stdlib.h>
++#include <time.h>
++
++using namespace std;
++
+ wprt::wprt(ppsocket * _skt)
+ {
+ skt = _skt;
+diff -Nur plptools-0.12/lib/wprt.h plp-cvs/lib/wprt.h
+--- plptools-0.12/lib/wprt.h 2002-03-08 09:35:01.000000000 +0100
++++ plp-cvs/lib/wprt.h 2003-02-05 08:59:08.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -93,7 +93,7 @@
+ WPRT_INIT = 0x00,
+ WPRT_GET = 0xf0,
+ WPRT_CANCEL = 0xf1,
+- WPRT_STOP = 0xff,
++ WPRT_STOP = 0xff
+ };
+
+ /**
+diff -Nur plptools-0.12/ncpd/channel.cc plp-cvs/ncpd/channel.cc
+--- plptools-0.12/ncpd/channel.cc 2002-03-17 00:10:51.000000000 +0100
++++ plp-cvs/ncpd/channel.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,7 +24,7 @@
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+-#include <stream.h>
++#include <iostream>
+ #include <string>
+
+ #include "channel.h"
+diff -Nur plptools-0.12/ncpd/link.cc plp-cvs/ncpd/link.cc
+--- plptools-0.12/ncpd/link.cc 2003-02-03 09:29:26.000000000 +0100
++++ plp-cvs/ncpd/link.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,18 +25,20 @@
+ #include "config.h"
+ #endif
+
+-#include <stream.h>
++#include <iostream>
++
++#include <bufferstore.h>
++#include <bufferarray.h>
++#include <plp_inttypes.h>
++
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <stdio.h>
+ #include <sys/time.h>
+-#include <plp_inttypes.h>
+
+ #include "link.h"
+ #include "packet.h"
+ #include "ncp.h"
+-#include "bufferstore.h"
+-#include "bufferarray.h"
+ #include "main.h"
+
+ extern "C" {
+diff -Nur plptools-0.12/ncpd/linkchan.cc plp-cvs/ncpd/linkchan.cc
+--- plptools-0.12/ncpd/linkchan.cc 2002-07-16 09:38:20.000000000 +0200
++++ plp-cvs/ncpd/linkchan.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -21,14 +21,14 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+-#include <stream.h>
+ #include <iomanip>
+ #include <string>
+
++#include <bufferstore.h>
++#include <bufferarray.h>
++
+ #include "linkchan.h"
+ #include "ncp.h"
+-#include "bufferstore.h"
+-#include "bufferarray.h"
+ #include "main.h"
+
+ using namespace std;
+diff -Nur plptools-0.12/ncpd/main.cc plp-cvs/ncpd/main.cc
+--- plptools-0.12/ncpd/main.cc 2002-08-06 04:02:53.000000000 +0200
++++ plp-cvs/ncpd/main.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,9 +25,15 @@
+ #include "config.h"
+ #endif
+
+-#include <stdio.h>
+ #include <string>
+-#include <stream.h>
++#include <iostream>
++
++#include <bufferstore.h>
++#include <ppsocket.h>
++#include <iowatch.h>
++#include <log.h>
++
++#include <stdio.h>
+ #include <stdlib.h>
+ #include <signal.h>
+ #include <errno.h>
+@@ -38,14 +44,10 @@
+ #include <plpintl.h>
+
+ #include "ncp.h"
+-#include "bufferstore.h"
+-#include "ppsocket.h"
+ #include "socketchan.h"
+-#include "iowatch.h"
+ #include "linkchan.h"
+ #include "link.h"
+ #include "packet.h"
+-#include "log.h"
+
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE
+diff -Nur plptools-0.12/ncpd/main.h plp-cvs/ncpd/main.h
+--- plptools-0.12/ncpd/main.h 2002-07-16 02:06:30.000000000 +0200
++++ plp-cvs/ncpd/main.h 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,7 +24,7 @@
+ #ifndef _main_h_
+ #define _main_h_
+
+-#include <ostream.h>
++#include <iostream>
+
+ extern std::ostream lout;
+ extern std::ostream lerr;
+diff -Nur plptools-0.12/ncpd/mp_serial.h plp-cvs/ncpd/mp_serial.h
+--- plptools-0.12/ncpd/mp_serial.h 2002-02-14 07:22:08.000000000 +0100
++++ plp-cvs/ncpd/mp_serial.h 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,8 +24,14 @@
+ #ifndef _mp_serial_h
+ #define _mp_serial_h
+
++#ifdef __cplusplus
++extern "C" {
++#endif
+ int init_serial(const char *dev, int speed, int debug);
+ void ser_exit(int fd);
++#ifdef __cplusplus
++}
++#endif
+
+ #endif
+
+diff -Nur plptools-0.12/ncpd/ncp.cc plp-cvs/ncpd/ncp.cc
+--- plptools-0.12/ncpd/ncp.cc 2002-07-16 21:40:29.000000000 +0200
++++ plp-cvs/ncpd/ncp.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,8 +25,9 @@
+ #include <config.h>
+ #endif
+
+-#include <stream.h>
++#include <iostream>
+ #include <string>
++
+ #include <time.h>
+
+ #include <bufferstore.h>
+diff -Nur plptools-0.12/ncpd/packet.cc plp-cvs/ncpd/packet.cc
+--- plptools-0.12/ncpd/packet.cc 2002-08-11 03:41:44.000000000 +0200
++++ plp-cvs/ncpd/packet.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,22 +25,21 @@
+ #include <config.h>
+ #endif
+
++#include <string>
++#include <fstream>
++#include <iomanip>
++
+ #include <stdio.h>
+ #include <malloc.h>
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <sys/types.h>
+-#include <string>
+-#include <fstream>
+-#include <iomanip>
+ #include <errno.h>
+ #include <sys/ioctl.h>
+ #include <termios.h>
+ #include <signal.h>
+
+-extern "C" {
+ #include "mp_serial.h"
+-}
+ #include "packet.h"
+ #include "link.h"
+ #include "main.h"
+diff -Nur plptools-0.12/ncpd/socketchan.cc plp-cvs/ncpd/socketchan.cc
+--- plptools-0.12/ncpd/socketchan.cc 2002-07-14 21:07:05.000000000 +0200
++++ plp-cvs/ncpd/socketchan.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,17 +24,20 @@
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #endif
+-#include <stream.h>
++
++#include <string>
++
++#include <ppsocket.h>
++#include <rfsv.h>
++
+ #include <stdio.h>
+-#include <string.h>
+ #include <malloc.h>
+
+ #include "socketchan.h"
+ #include "ncp.h"
+-#include <ppsocket.h>
+-#include <rfsv.h>
++#include "main.h"
+
+-extern std::ostream lerr;
++using namespace std;
+
+ socketChan:: socketChan(ppsocket * _skt, ncp * _ncpController):
+ channel(_ncpController)
+diff -Nur plptools-0.12/plpbackup/plpbackup.cc plp-cvs/plpbackup/plpbackup.cc
+--- plptools-0.12/plpbackup/plpbackup.cc 2003-02-04 11:26:35.000000000 +0100
++++ plp-cvs/plpbackup/plpbackup.cc 2004-03-13 12:17:14.000000000 +0100
+@@ -1,5 +1,5 @@
+ /* -*- Mode: C++ -*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,15 +25,26 @@
+ #include <config.h>
+ #endif
+
+-#include <sys/types.h>
+-#include <sys/wait.h>
+-#include <dirent.h>
+ #include <fstream>
+-#include <strstream>
++#include <sstream>
++#include <iostream>
+ #include <iomanip>
+ #include <vector>
+ #include <set>
+
++#include <plpintl.h>
++#include <ppsocket.h>
++#include <rfsv.h>
++#include <rfsvfactory.h>
++#include <rpcs.h>
++#include <rpcsfactory.h>
++#include <bufferstore.h>
++#include <bufferarray.h>
++
++#include <sys/types.h>
++#include <sys/wait.h>
++#include <dirent.h>
++
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -46,15 +57,6 @@
+ #include <getopt.h>
+ #include <fcntl.h>
+
+-#include <plpintl.h>
+-#include <ppsocket.h>
+-#include <rfsv.h>
+-#include <rfsvfactory.h>
+-#include <rpcs.h>
+-#include <rpcsfactory.h>
+-#include <bufferstore.h>
+-#include <bufferarray.h>
+-
+ using namespace std;
+
+ bool full = false;
+@@ -287,21 +289,21 @@
+ // If we got an error here, that happened probably because
+ // we have no path at all (e.g. Macro5) and the program is
+ // not registered in the Psion's path properly. Now try
+- // the ususal \System\Apps\<AppName>\<AppName>.app
++ // the usual \System\Apps\<AppName>\<AppName>.app
+ // on all drives.
+ if (cmd.find('\\') == cmd.npos) {
+ u_int32_t devbits;
+ if ((res = Rfsv->devlist(devbits)) == rfsv::E_PSI_GEN_NONE) {
+ int i;
+ for (i = 0; i < 26; i++) {
+- if (devbits & 1) {
+- ostrstream tmp;
+- tmp << 'A' + i << "\\System\\Apps\\"
+- << cmd << "\\" << cmd << ".app";
+- res = Rpcs->execProgram(tmp.str(), "");
++ if (devbits & (1 << i)) {
++ ostringstream tmp;
++ tmp << (char)('A' + i) << ":\\System\\Apps\\" <<
++ cmd << "\\" << cmd << ".app" << '\0';
++ res = Rpcs->execProgram(tmp.str().c_str(), "");
++ if (res == rfsv::E_PSI_GEN_NONE)
++ break;
+ }
+- if (res == rfsv::E_PSI_GEN_NONE)
+- break;
+ }
+ }
+ }
+@@ -867,7 +869,7 @@
+ {
+ unsigned int i;
+ char indexbuf[40];
+- ostrstream tarcmd;
++ ostringstream tarcmd;
+ string dstPath;
+ struct timeval start_tv, end_tv, cstart_tv, cend_tv;
+
+@@ -875,7 +877,7 @@
+ tarcmd << "tar --to-stdout -xzf " << archList[i]
+ << " 'KPsion*Index'" << ends;
+ char backupType = '?';
+- FILE *f = popen(tarcmd.str(), "r");
++ FILE *f = popen(tarcmd.str().c_str(), "r");
+ if (!f) {
+ perror(_("Could not get backup index"));
+ continue;
+@@ -932,7 +934,7 @@
+ tarcmd << "tar xzCf " << dstPath << " " << fn << ends;
+ if (verbose > 0)
+ cout << _("Extracting tar archive ...") << endl;
+- if (system(tarcmd.str()) != 0)
++ if (system(tarcmd.str().c_str()) != 0)
+ cerr << _("Execution of ") << tarcmd.str() << _(" failed.")
+ << endl;
+ continue;
+@@ -997,7 +999,7 @@
+ u_int32_t sattr = e.getAttr() & mask;
+ u_int32_t dattr = ~sattr & mask;
+ int retry = 10;
+- // Retry, because file somtimes takes some time
++ // Retry, because file sometimes takes some time
+ // to close;
+ do {
+ res = Rfsv->fsetattr(fn, sattr, dattr);
+@@ -1340,7 +1342,7 @@
+
+ // tar it all up
+ if (!bErr) {
+- ostrstream tarcmd;
++ ostringstream tarcmd;
+
+ if (verbose > 0)
+ cout << _("Creating tar archive ...") << endl;
+@@ -1355,7 +1357,7 @@
+ tarcmd << ends;
+
+ mkdirp(archPath.c_str());
+- if (system(tarcmd.str())) {
++ if (system(tarcmd.str().c_str())) {
+ cerr << _("plpbackup: Error during execution of ")
+ << tarcmd.str() << endl;
+ unlink(archPath.c_str());
+@@ -1553,6 +1555,10 @@
+ cerr << _("Backup can only create one archive at a time.") << endl;
+ usage(&cerr);
+ }
++ if (!(doBackup || doRestore || doFormat)) {
++ cerr << _("No action specified.") << endl;
++ usage(&cerr);
++ }
+
+ signal(SIGTERM, sig_handler);
+ signal(SIGINT, sig_handler);
+diff -Nur plptools-0.12/plpftp/ftp.cc plp-cvs/plpftp/ftp.cc
+--- plptools-0.12/plpftp/ftp.cc 2002-07-14 08:35:33.000000000 +0200
++++ plp-cvs/plpftp/ftp.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -27,26 +27,28 @@
+ #include "config.h"
+ #endif
+
++#include <plpintl.h>
++#include <rfsv.h>
++#include <rpcs.h>
++#include <bufferarray.h>
++#include <bufferstore.h>
++#include <Enum.h>
++
++#include <iostream>
++#include <fstream>
++#include <string>
++#include <iomanip>
++
+ #include <sys/types.h>
+ #include <dirent.h>
+-#include <stream.h>
+-#include <fstream.h>
+-#include <string.h>
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <stdio.h>
+-#include <iomanip.h>
+ #include <unistd.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <signal.h>
+
+-#include <plpintl.h>
+-#include <rfsv.h>
+-#include <rpcs.h>
+-#include <bufferarray.h>
+-#include <bufferstore.h>
+-#include <Enum.h>
+ #include "ftp.h"
+
+ #if HAVE_LIBREADLINE
+diff -Nur plptools-0.12/plpftp/main.cc plp-cvs/plpftp/main.cc
+--- plptools-0.12/plpftp/main.cc 2002-07-14 21:07:06.000000000 +0200
++++ plp-cvs/plpftp/main.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -25,11 +25,6 @@
+ #include <config.h>
+ #endif
+
+-#include <stream.h>
+-#include <string.h>
+-#include <stdlib.h>
+-#include <stdio.h>
+-
+ #include <plpintl.h>
+ #include <ppsocket.h>
+ #include <rfsv.h>
+@@ -38,6 +33,12 @@
+ #include <rpcsfactory.h>
+ #include <bufferstore.h>
+
++#include <iostream>
++#include <string>
++
++#include <stdlib.h>
++#include <stdio.h>
++
+ #include "ftp.h"
+
+ #ifndef _GNU_SOURCE
+@@ -45,6 +46,8 @@
+ #endif
+ #include <getopt.h>
+
++using namespace std;
++
+ static void
+ help()
+ {
+diff -Nur plptools-0.12/plpnfsd/main.cc plp-cvs/plpnfsd/main.cc
+--- plptools-0.12/plpnfsd/main.cc 2002-07-14 21:07:06.000000000 +0200
++++ plp-cvs/plpnfsd/main.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,29 +24,31 @@
+ #include <config.h>
+ #endif
+
+-#include <stream.h>
+-#include <string.h>
++#include <rfsv.h>
++#include <rpcs.h>
++#include <rfsvfactory.h>
++#include <rpcsfactory.h>
++#include <bufferstore.h>
++#include <bufferarray.h>
++#include <ppsocket.h>
++
++#include <iostream>
++#include <string>
++
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <signal.h>
+ #include <syslog.h>
+
+-#include "rfsv.h"
+-#include "rpcs.h"
+-#include "rfsvfactory.h"
+-#include "rpcsfactory.h"
+-#include "bufferstore.h"
+-#include "bufferarray.h"
+-#include "ppsocket.h"
+-extern "C" {
+ #include "rfsv_api.h"
+-}
+
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE
+ #endif
+ #include <getopt.h>
+
++using namespace std;
++
+ static rfsv *a;
+ static rfsvfactory *rf;
+ static char *a_filename = 0;
+diff -Nur plptools-0.12/plpnfsd/mp_inode.c plp-cvs/plpnfsd/mp_inode.c
+--- plptools-0.12/plpnfsd/mp_inode.c 2002-07-12 17:18:01.000000000 +0200
++++ plp-cvs/plpnfsd/mp_inode.c 2004-09-08 18:46:04.000000000 +0200
+@@ -1,4 +1,4 @@
+-/* $Id$
++/* $Id$
+ *
+ * Original version of this file from p3nfsd-5.4 by
+ * Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
+@@ -11,7 +11,7 @@
+ #include "mp.h"
+ #include "rfsv_api.h"
+
+-#if defined(__SVR4) || defined(__GLIBC__) || defined(__FreeBSD__)
++#if defined(__SVR4) || defined(__GLIBC__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <string.h>
+ #include <stdlib.h>
+ #endif
+diff -Nur plptools-0.12/plpnfsd/mp_main.c plp-cvs/plpnfsd/mp_main.c
+--- plptools-0.12/plpnfsd/mp_main.c 2003-01-31 23:52:47.000000000 +0100
++++ plp-cvs/plpnfsd/mp_main.c 2004-09-08 18:46:04.000000000 +0200
+@@ -1,4 +1,4 @@
+-/* $Id$
++/* $Id$
+ *
+ * Original version of this file from p3nfsd-5.4 by
+ * Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
+@@ -22,7 +22,7 @@
+ #include <errno.h>
+ #include "nfs_prot.h"
+ #include "mp.h"
+-#if defined (__SVR4) || defined(__sgi)
++#if defined (__SVR4) || defined(__sgi) || defined(__NetBSD__)
+ #include <stdlib.h> /* getenv */
+ #include <string.h> /* strcmp */
+ #endif
+diff -Nur plptools-0.12/plpnfsd/mp_mount.c plp-cvs/plpnfsd/mp_mount.c
+--- plptools-0.12/plpnfsd/mp_mount.c 2002-07-12 16:45:41.000000000 +0200
++++ plp-cvs/plpnfsd/mp_mount.c 2004-09-08 19:10:16.000000000 +0200
+@@ -1,4 +1,4 @@
+-/* $Id$
++/* $Id$
+ *
+ * Original version of this file from p3nfsd-5.4 by
+ * Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
+@@ -21,7 +21,7 @@
+ #define PORTMAP /* I need svcudp_create in rpc/svc_soc.h, sol 2.4 */
+ #endif
+
+-#include <OSdefs.h>
++#include "OSdefs.h"
+ #include <stdio.h>
+ #include <signal.h>
+ #include <sys/stat.h>
+@@ -63,6 +63,17 @@
+ #endif
+ #endif /* __FreeBSD__ */
+
++#ifdef __NetBSD__
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
++#include <sys/types.h>
++#include <stdlib.h>
++#include <unistd.h>
++#include <strings.h>
++#include <nfs/nfsmount.h>
++#endif /* __NetBSD__ */
++
+ #include <rpc/rpc.h>
+ #include "nfs_prot.h"
+
+@@ -156,7 +167,7 @@
+ struct mntent *ent;
+ #endif
+ #endif
+-#ifndef __FreeBSD__
++#if !defined(__FreeBSD__) && !defined(__NetBSD__)
+ struct stat statb;
+ #endif
+
+@@ -277,7 +288,7 @@
+ #else
+ struct nfs_args nfs_args;
+ #endif
+-#ifdef __FreeBSD__
++#if defined(__FreeBSD__) || defined(__NetBSD__)
+ int mount_flags;
+ #endif
+
+@@ -453,20 +464,23 @@
+ #endif
+
+ #ifdef __NetBSD__
++ nfs_args.version = NFS_ARGSVERSION;
+ nfs_args.addrlen = sizeof(sain);
+ nfs_args.sotype = SOCK_DGRAM;
+ nfs_args.maxgrouplist = NGROUPS;
+ nfs_args.readahead = 1;
+ nfs_args.addr = (struct sockaddr *) &sain;
+ nfs_args.fh = (void *) root_fh;
++ nfs_args.fhsize = sizeof(*root_fh);
+ nfs_args.wsize = PBUFSIZE;
+ nfs_args.rsize = PBUFSIZE;
+ nfs_args.retrans = 10;
+ nfs_args.timeo = 600;
+ nfs_args.hostname = PSIONHOSTNAME;
+ nfs_args.flags = NFSMNT_INT | NFSMNT_RETRANS | NFSMNT_TIMEO
+- | NFSMNT_NOCONN | NFSMNT_DUMBTIMR | NFSMNT_MYWRITE
++ | NFSMNT_NOCONN | NFSMNT_DUMBTIMR
+ | NFSMNT_WSIZE | NFSMNT_RSIZE;
++ mount_flags = MNT_NOSUID | MNT_NODEV | MNT_NOEXEC | MNT_NOATIME;
+ #endif
+
+ #if defined(_IBMR2)
+@@ -496,7 +510,7 @@
+ #if defined(__sgi) || (defined(sun) && defined(__SVR4))
+ if (mount("", dir, MS_DATA, "nfs", &nfs_args, sizeof(nfs_args)))
+ #endif
+-#if defined(__NetBSD__) || defined(__NeXT__)
++#if defined(__NeXT__)
+ if (mount(MOUNT_NFS, dir, 0, (caddr_t) & nfs_args))
+ #endif
+ #ifdef hpux
+@@ -512,7 +526,7 @@
+ if (aix3_mount("psion:loc", dir, 0, MOUNT_TYPE_NFS, &nfs_args, "plpnfsd"))
+ #endif
+
+-#ifdef __FreeBSD__
++#if defined(__NetBSD__) || defined(__FreeBSD__)
+ #if __FreeBSD_version >= 300001
+ if (mount("nfs", dir, mount_flags, &nfs_args))
+ #else
+diff -Nur plptools-0.12/plpnfsd/mp_pfs_ops.c plp-cvs/plpnfsd/mp_pfs_ops.c
+--- plptools-0.12/plpnfsd/mp_pfs_ops.c 2002-03-08 09:29:50.000000000 +0100
++++ plp-cvs/plpnfsd/mp_pfs_ops.c 2004-09-08 18:46:04.000000000 +0200
+@@ -1,4 +1,4 @@
+-/* $Id$
++/* $Id$
+ *
+ * Original version of this file from p3nfsd-5.4 by
+ * Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
+@@ -10,7 +10,7 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <pwd.h>
+-#if defined(__SVR4) || defined(__GLIBC__)
++#if defined(__SVR4) || defined(__GLIBC__) || defined(__NetBSD__)
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <string.h>
+diff -Nur plptools-0.12/plpnfsd/nfs_prot_svc.c plp-cvs/plpnfsd/nfs_prot_svc.c
+--- plptools-0.12/plpnfsd/nfs_prot_svc.c 2002-03-08 09:29:50.000000000 +0100
++++ plp-cvs/plpnfsd/nfs_prot_svc.c 2004-09-08 18:46:04.000000000 +0200
+@@ -1,4 +1,4 @@
+-/* $Id$
++/* $Id$
+ *
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+@@ -8,7 +8,7 @@
+ #include "OSdefs.h"
+
+ #define PORTMAP
+-#ifdef __SVR4
++#if defined(__SVR4) || defined(__NetBSD__)
+ #include <unistd.h>
+ #include <stdlib.h>
+ #endif
+@@ -16,7 +16,7 @@
+ #include <rpc/rpc.h>
+ #include "nfs_prot.h"
+ #include "mp.h"
+-#ifdef __GLIBC__
++#if defined(__GLIBC__) || defined(__NetBSD__)
+ #include <string.h>
+ #endif
+
+@@ -197,7 +197,7 @@
+ }
+ memset((char *)&argument, 0, sizeof(argument));
+ #if !defined(__SVR4) && !defined(__FreeBSD__)
+-#ifdef __GLIBC__
++#if defined(__GLIBC__) || defined(__NetBSD__)
+ if (!svc_getargs(transp, (xdrproc_t)xdr_argument, (caddr_t)&argument)) {
+ #else
+ if (!svc_getargs(transp, xdr_argument, &argument)) {
+@@ -217,7 +217,7 @@
+ svcerr_systemerr(transp);
+ }
+ #if !defined(__SVR4) && !defined(__FreeBSD__)
+-#ifdef __GLIBC__
++#if defined(__GLIBC__) || defined(__NetBSD__)
+ if (!svc_freeargs(transp, (xdrproc_t)xdr_argument,(caddr_t)&argument)) {
+ #else
+ if (!svc_freeargs(transp, xdr_argument, &argument)) {
+diff -Nur plptools-0.12/plpnfsd/rfsv_api.h plp-cvs/plpnfsd/rfsv_api.h
+--- plptools-0.12/plpnfsd/rfsv_api.h 2002-02-14 07:24:33.000000000 +0100
++++ plp-cvs/plpnfsd/rfsv_api.h 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -23,6 +23,10 @@
+ #ifndef _rfsv_api_h_
+ #define _rfsv_api_h_
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ #include "mp.h"
+ #include "builtins.h"
+
+@@ -64,6 +68,10 @@
+ #define PSI_A_STREAM 0x0800
+ #define PSI_A_TEXT 0x1000
+
++#ifdef __cplusplus
++}
++#endif
++
+ #endif
+
+ /*
+diff -Nur plptools-0.12/plpprint/plpprintd.cc plp-cvs/plpprint/plpprintd.cc
+--- plptools-0.12/plpprint/plpprintd.cc 2003-02-03 01:56:52.000000000 +0100
++++ plp-cvs/plpprint/plpprintd.cc 2003-02-05 08:59:09.000000000 +0100
+@@ -1,5 +1,5 @@
+ /*-*-c++-*-
+- * $Id$
++ * $Id$
+ *
+ * This file is part of plptools.
+ *
+@@ -24,8 +24,13 @@
+ #include <config.h>
+ #endif
+
+-#include <stream.h>
+-#include <string.h>
++#include <ppsocket.h>
++#include <wprt.h>
++#include <psibitmap.h>
++
++#include <iostream>
++#include <string>
++
+ #include <stdlib.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+@@ -35,10 +40,6 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+
+-#include <ppsocket.h>
+-#include <wprt.h>
+-#include <psibitmap.h>
+-
+ #ifndef _GNU_SOURCE
+ #define _GNU_SOURCE
+ #endif