From: Pascal Stumpf Date: Sat, 11 Aug 2012 12:12:47 +0000 (+0200) Subject: OpenBSD patches for ttsnoop. X-Git-Tag: 2.2.0b~83^2~18 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=43bae997c84eb8795eff68b9e7d58f696e3f61ad;p=oweals%2Fcde.git OpenBSD patches for ttsnoop. Mostly adding std:: for strstream interfaces. --- diff --git a/cde/programs/ttsnoop/DtTt.C b/cde/programs/ttsnoop/DtTt.C index 26315dd0..0f55c754 100644 --- a/cde/programs/ttsnoop/DtTt.C +++ b/cde/programs/ttsnoop/DtTt.C @@ -34,7 +34,7 @@ #include #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #else #include @@ -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 a67436b8..490c217b 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 #include #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 bb8c4614..051caa8c 100644 --- a/cde/programs/ttsnoop/fileChooser_stubs.C.src +++ b/cde/programs/ttsnoop/fileChooser_stubs.C.src @@ -39,7 +39,7 @@ #include #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #include #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 9a139580..bcc152c4 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 #else #include @@ -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 f7a7ce5f..4ca4f9c0 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 #else #include @@ -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 8a748854..cc956297 100644 --- a/cde/programs/ttsnoop/sessionChooser_stubs.C.src +++ b/cde/programs/ttsnoop/sessionChooser_stubs.C.src @@ -42,7 +42,7 @@ #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #include #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 4c7711d8..2592b3a6 100644 --- a/cde/programs/ttsnoop/ttChooser_stubs.C.src +++ b/cde/programs/ttsnoop/ttChooser_stubs.C.src @@ -42,7 +42,7 @@ #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #else #include @@ -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 e63e2068..d457bbe8 100644 --- a/cde/programs/ttsnoop/ttsnoop.C.src +++ b/cde/programs/ttsnoop/ttsnoop.C.src @@ -63,7 +63,7 @@ #include #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #include #include @@ -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 3abc2eb0..3d093894 100644 --- a/cde/programs/ttsnoop/ttsnoop_stubs.C.src +++ b/cde/programs/ttsnoop/ttsnoop_stubs.C.src @@ -37,7 +37,7 @@ #include -#if defined(linux) +#if defined(linux) || defined(CSRG_BASED) #include #include #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();