See patch.
>From 5cb4665c3777b64fd1b6d56d9ec947dcef91301b Mon Sep 17 00:00:00 2001
From: Pascal Stumpf <pascal.stu...@cubes.de>
Date: Sat, 11 Aug 2012 14:12:47 +0200
Subject: [PATCH] OpenBSD patches for ttsnoop.

Mostly adding std:: for strstream interfaces.
---
 cde/programs/ttsnoop/DtTt.C                      |   26 +++++++++++-----------
 cde/programs/ttsnoop/callbackChooser_stubs.C.src |    4 +-
 cde/programs/ttsnoop/fileChooser_stubs.C.src     |    8 +++---
 cde/programs/ttsnoop/messageProps_stubs.C.src    |   10 ++++----
 cde/programs/ttsnoop/patternProps_stubs.C.src    |    4 +-
 cde/programs/ttsnoop/sessionChooser_stubs.C.src  |    4 +-
 cde/programs/ttsnoop/ttChooser_stubs.C.src       |    6 ++--
 cde/programs/ttsnoop/ttsnoop.C.src               |   12 +++++-----
 cde/programs/ttsnoop/ttsnoop_stubs.C.src         |   12 +++++-----
 9 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/cde/programs/ttsnoop/DtTt.C b/cde/programs/ttsnoop/DtTt.C
index 26315dd..0f55c75 100644
--- a/cde/programs/ttsnoop/DtTt.C
+++ b/cde/programs/ttsnoop/DtTt.C
@@ -34,7 +34,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <strstream>
 #else
 #include <strstream.h>
@@ -468,7 +468,7 @@ DtTtSetLabel(
 )
 {
     Tt_status status = tt_ptr_error( val );
-    ostrstream errStream;
+    std::ostrstream errStream;
     errStream << func << " = " << val << " (" << status << ")" << ends;
     char *label = errStream.str();
     DtTtSetLabel( labelWidget, label );
@@ -483,7 +483,7 @@ DtTtSetLabel(
        Tt_status status
 )
 {
-    ostrstream errStream;
+    std::ostrstream errStream;
     errStream << func << " = " << status << ends;
     char *label = errStream.str();
     DtTtSetLabel( labelWidget, label );
@@ -498,7 +498,7 @@ DtTtSetLabel(
        int returnVal
 )
 {
-    ostrstream errStream;
+    std::ostrstream errStream;
     errStream << func << " = " << returnVal << ends;
     char *label = errStream.str();
     DtTtSetLabel( labelWidget, label );
@@ -519,7 +519,7 @@ _DtTtChoices(
                return 0;
        }
        for (int i = 0; i < count; i++) {
-               ostrstream itemStream;
+               std::ostrstream itemStream;
                itemStream << (void *)pPats[ i ];
                char *name = (char *)
                        tt_pattern_user( *pPats[ i ], _DtTtPatsNameKey );
@@ -566,7 +566,7 @@ _DtTtChoices(
                }
                *itemCount = dtTtMessagesCount;
                for (i = 0; i < dtTtMessagesCount; i++) {
-                       ostrstream itemStream;
+                       std::ostrstream itemStream;
                        itemStream << (void *)dtTtMessages[ i ];
                        char *op = tt_message_op( dtTtMessages[ i ] );
                        if (! tt_is_err( tt_ptr_error( op ))) {
@@ -592,7 +592,7 @@ _DtTtChoices(
                }
                *itemCount = dtTtPatternsCount;
                for (i = 0; i < dtTtPatternsCount; i++) {
-                       ostrstream itemStream;
+                       std::ostrstream itemStream;
                        itemStream << (void *)dtTtPatterns[ i ] << ends;
                        items[ i ] = XmStringCreateLocalized(
                                        itemStream.str() );
@@ -636,11 +636,11 @@ _DtOpen(
 )
 {
     char *file = tempnam( 0, AIX_CONST_STRING tempnamTemplate );
-    ostrstream cmdStream;
+    std::ostrstream cmdStream;
     cmdStream << cmd << " > " << file << ends;
     int sysStat = system( cmdStream.str() );
     if (! WIFEXITED( sysStat )) {
-           ostrstream func;
+           std::ostrstream func;
            func << "system( \"" << cmdStream.str() << "\" )" << ends;
            DtTtSetLabel( label, func.str(), sysStat );
            delete cmdStream.str();
@@ -662,12 +662,12 @@ _DtOpen(
        const char *    file
 )
 {
-    ostrstream labelStream;
+    std::ostrstream labelStream;
     labelStream << "dtaction Open " << file << ends;
     DtTtSetLabel( label, labelStream.str() );
     delete labelStream.str();
 
-    ostrstream cmd;
+    std::ostrstream cmd;
     cmd << "( unset TT_TRACE_SCRIPT; if dtaction Open " << file
        << "; then :; else textedit " << file << "; fi; sleep 600; rm -f "
        << file << " ) &" << ends;
@@ -699,12 +699,12 @@ _DtMan(
        const char *    topic
 )
 {
-    ostrstream labelStream;
+    std::ostrstream labelStream;
     labelStream << "dtaction Dtmanpageview " << topic << ends;
     DtTtSetLabel( label, labelStream.str() );
     delete labelStream.str();
 
-    ostrstream cmd;
+    std::ostrstream cmd;
     cmd << "unset TT_TRACE_SCRIPT; if dtaction Dtmanpageview " << topic
        << "; then :; else cmdtool -c man " << topic << "; fi &" << ends;
     system( cmd.str() );
diff --git a/cde/programs/ttsnoop/callbackChooser_stubs.C.src 
b/cde/programs/ttsnoop/callbackChooser_stubs.C.src
index a67436b..490c217 100644
--- a/cde/programs/ttsnoop/callbackChooser_stubs.C.src
+++ b/cde/programs/ttsnoop/callbackChooser_stubs.C.src
@@ -40,7 +40,7 @@
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <fstream>
 #include <strstream>
 #else
@@ -50,7 +50,7 @@
 
 #include "DtTt.h"
 
-extern ofstream snoopStream;
+extern std::ofstream snoopStream;
 
 typedef enum {
        DoJustPrint,
diff --git a/cde/programs/ttsnoop/fileChooser_stubs.C.src 
b/cde/programs/ttsnoop/fileChooser_stubs.C.src
index bb8c461..051caa8 100644
--- a/cde/programs/ttsnoop/fileChooser_stubs.C.src
+++ b/cde/programs/ttsnoop/fileChooser_stubs.C.src
@@ -39,7 +39,7 @@
 #include <sys/wait.h>
 #include <Xm/TextF.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <fstream>
 #include <strstream>
 #else
@@ -61,7 +61,7 @@ extern XtPointer _XmStringUngenerate (XmString string,
                         XmTextType output_type);
 }
 
-extern ofstream snoopStream;
+extern std::ofstream snoopStream;
 extern int     globalTimeout;
 
 typedef struct _FileChooserInfo {
@@ -217,7 +217,7 @@ fileOkayed(
     XtVaGetValues( instance->fchooser, XmNuserData, &xtPtr, 0 );
     FileChooserInfo *info = (FileChooserInfo *)xtPtr;
     Widget label = dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label;
-    ostrstream script;
+    std::ostrstream script;
     switch (info->choice) {
            Tt_pattern *pats;
            Tt_message msg;
@@ -305,7 +305,7 @@ fileOkayed(
                    break;
            }
            if (WEXITSTATUS( ival ) != 0) {
-                   ostrstream diagnosis;
+                   std::ostrstream diagnosis;
                    diagnosis << "tt_type_comp -p: syntax error in "
                            << path << ends;
                    DtTtSetLabel( label, diagnosis.str() );
diff --git a/cde/programs/ttsnoop/messageProps_stubs.C.src 
b/cde/programs/ttsnoop/messageProps_stubs.C.src
index 9a13958..bcc152c 100644
--- a/cde/programs/ttsnoop/messageProps_stubs.C.src
+++ b/cde/programs/ttsnoop/messageProps_stubs.C.src
@@ -40,7 +40,7 @@
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <strstream>
 #else
 #include <strstream.h>
@@ -620,7 +620,7 @@ DtTtMessageWidgetCreate(
                }
        }
 
-       ostrstream labelStream;
+       std::ostrstream labelStream;
        labelStream << "Tt_message " << (void *)msg;
        XtVaSetValues( instance->messageProps,
                       XmNtitle, labelStream.str(),
@@ -1408,7 +1408,7 @@ msgGenAction(
     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
     
     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
-    ostrstream action; // XXX when to delete .str()?
+    std::ostrstream action; // XXX when to delete .str()?
     DtbMessagePropsMessagePropsInfo instance =
            (DtbMessagePropsMessagePropsInfo)clientData;
     Tt_message msg = messageProps2Msg( instance );
@@ -1475,7 +1475,7 @@ msgGenC(
     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
     
     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
-       ostrstream code; // XXX when to delete .str()?
+       std::ostrstream code; // XXX when to delete .str()?
        DtbMessagePropsMessagePropsInfo instance =
                (DtbMessagePropsMessagePropsInfo)clientData;
        Tt_message msg = messageProps2Msg( instance );
@@ -1878,7 +1878,7 @@ genObserver(
     /*** DTB_USER_CODE_END   ^^^ Add C variables and code above ^^^ ***/
     
     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
-    ostrstream ptype; // XXX when to delete .str()?
+    std::ostrstream ptype; // XXX when to delete .str()?
     DtbMessagePropsMessagePropsInfo instance =
            (DtbMessagePropsMessagePropsInfo)clientData;
     Tt_message msg = messageProps2Msg( instance );
diff --git a/cde/programs/ttsnoop/patternProps_stubs.C.src 
b/cde/programs/ttsnoop/patternProps_stubs.C.src
index f7a7ce5..4ca4f9c 100644
--- a/cde/programs/ttsnoop/patternProps_stubs.C.src
+++ b/cde/programs/ttsnoop/patternProps_stubs.C.src
@@ -40,7 +40,7 @@
  *** Add include files, types, macros, externs, and user functions here.
  ***/
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <strstream>
 #else
 #include <strstream.h>
@@ -371,7 +371,7 @@ DtTtPatternWidgetCreate(
                }
        }
 
-       ostrstream labelStream;
+       std::ostrstream labelStream;
        labelStream << "Tt_pattern " << (void *)pat << ends;
        XtVaSetValues( instance->patternProps,
                       XmNtitle, labelStream.str(),
diff --git a/cde/programs/ttsnoop/sessionChooser_stubs.C.src 
b/cde/programs/ttsnoop/sessionChooser_stubs.C.src
index 8a74885..cc95629 100644
--- a/cde/programs/ttsnoop/sessionChooser_stubs.C.src
+++ b/cde/programs/ttsnoop/sessionChooser_stubs.C.src
@@ -42,7 +42,7 @@
 
 #include <Xm/TextF.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <fstream>
 #include <strstream>
 #else
@@ -52,7 +52,7 @@
 
 #include "DtTt.h"
 
-extern ofstream snoopStream;
+extern std::ofstream snoopStream;
 
 void
 _DtSessionChooserSet(
diff --git a/cde/programs/ttsnoop/ttChooser_stubs.C.src 
b/cde/programs/ttsnoop/ttChooser_stubs.C.src
index 4c7711d..2592b3a 100644
--- a/cde/programs/ttsnoop/ttChooser_stubs.C.src
+++ b/cde/programs/ttsnoop/ttChooser_stubs.C.src
@@ -42,7 +42,7 @@
 
 #include <stdio.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <strstream>
 #else
 #include <strstream.h>
@@ -213,7 +213,7 @@ _DtTtChooserSet(
     XmTextFieldSetString( instance->chooserText, 0 );
     XtVaSetValues( instance->chooser, XmNtitle, title, 0 );
 
-    ostrstream valuesStream;
+    std::ostrstream valuesStream;
     valuesStream << itemCount << " " << valuesLabel;
     if (itemCount != 1) valuesStream << "s";
     valuesStream << ends;
@@ -314,7 +314,7 @@ choiceSelected(
            break;
     }
     void *entity = DtTtNth( type, info->item_position - 1 );
-    ostrstream entityName;
+    std::ostrstream entityName;
     if (isString) {
            entityName << (char *)entity << ends;
     } else {
diff --git a/cde/programs/ttsnoop/ttsnoop.C.src 
b/cde/programs/ttsnoop/ttsnoop.C.src
index e63e206..d457bbe 100644
--- a/cde/programs/ttsnoop/ttsnoop.C.src
+++ b/cde/programs/ttsnoop/ttsnoop.C.src
@@ -63,7 +63,7 @@
 #include <sys/stat.h>
 #include <time.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <iostream>
 #include <strstream>
 #include <fstream>
@@ -112,8 +112,8 @@ unsigned int        snoopedArgsCount        = 0;
 char *         optTraceScript          = 0;
 String         apiTracerArgv[ 10 ];
 String         snooperArgv[ 10 ];
-ostrstream     tttraceCmd;
-ofstream       snoopStream;
+std::ostrstream        tttraceCmd;
+std::ofstream  snoopStream;
 
 // Xt squats on -tf ?! XXX
 const char Usage[] =
@@ -196,7 +196,7 @@ signalHandler(
        }
 }
 
-#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__) || 
defined(linux)
+#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__) || 
defined(linux) || defined(CSRG_BASED)
 #if !defined(SIG_PF)
 typedef void (*sig_pf_t)(int);
 #define SIG_PF sig_pf_t
@@ -208,7 +208,7 @@ _tt_sigset(
        int     sig,
        SIG_PF  handler )
 {
-#if defined(hpux) || defined(linux)
+#if defined(hpux) || defined(linux) || defined(CSRG_BASED)
        struct sigaction act;
        act.sa_handler = handler;
        sigemptyset(&act.sa_mask);
@@ -670,7 +670,7 @@ main(int argc, char **argv)
     }
     Tt_status status;
     snoopStream.open( snoopFile, ios::app );
-    ostrstream envStr;
+    std::ostrstream envStr;
     envStr << "TT_TRACE_SCRIPT=> ";
     envStr << traceFile << ends;
     traceScript = envStr.str();
diff --git a/cde/programs/ttsnoop/ttsnoop_stubs.C.src 
b/cde/programs/ttsnoop/ttsnoop_stubs.C.src
index 3abc2eb..3d09389 100644
--- a/cde/programs/ttsnoop/ttsnoop_stubs.C.src
+++ b/cde/programs/ttsnoop/ttsnoop_stubs.C.src
@@ -37,7 +37,7 @@
 
 #include <unistd.h>
 
-#if defined(linux)
+#if defined(linux) || defined(CSRG_BASED)
 #include <fstream>
 #include <strstream>
 #else
@@ -50,7 +50,7 @@
 
 extern "C" { const char *_tt_lib_version; };
 
-extern ofstream                snoopStream;
+extern std::ofstream   snoopStream;
 extern unsigned int    globalSaveLines;
 extern char *          traceScript;
 extern const char *    globalVersionString;
@@ -93,7 +93,7 @@ fork_tttrace(
     
     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
     DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
-    ostrstream tttraceCmd;
+    std::ostrstream tttraceCmd;
     tttraceCmd << "unset TT_TRACE_SCRIPT; dtterm -sb -sl ";
     tttraceCmd << globalSaveLines;
     tttraceCmd << " -title tttrace -geometry 120x24 -e tttrace &";
@@ -659,7 +659,7 @@ libcPause(
     
     /*** DTB_USER_CODE_START vvv Add C code below vvv ***/
     DtbTtsnoopTtsnoopWinInfo instance = (DtbTtsnoopTtsnoopWinInfo)clientData;
-    ostrstream advice;
+    std::ostrstream advice;
     advice << "pause(); /* kill -CONT " << getpid() << " */";
     DtTtSetLabel( instance->ttsnoopWin_label, advice.str() );
     delete advice.str();
@@ -667,7 +667,7 @@ libcPause(
     //
     // run "(if dterror.ds blah blah; then kill -CONT pid; fi)&"
     //
-    ostrstream script;
+    std::ostrstream script;
     script << "(if dterror.ds ";
     // arg 1: text
     script << "\"kill -CONT " << getpid() << "\" ";
@@ -1343,7 +1343,7 @@ toggleSnooping(
     if (! tt_is_err( status )) {
            snoopPatIsRegistered = ! snoopPatIsRegistered;
     }
-    ostrstream stream;
+    std::ostrstream stream;
     stream << func << (void *)snoopPat << ")" << ends;
     DtTtSetLabel( instance->ttsnoopWin_label, stream.str(), status );
     delete stream.str();
-- 
1.7.6

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
cdesktopenv-devel mailing list
cdesktopenv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdesktopenv-devel

Reply via email to