ttsnoop: drag into a modern C++ century
This program has never worked very well, and it may still not work very well. This commit removes the ancient C++ headers and uses modern replacements with some changes required due to the different interfaces. It builds a lot cleaner, and no longer does stupid things like deleteing char *, ostream.str()'s, and the like. This program could be really useful if it worked well. Some thought should be givien in the future to decouple this SW from dtappbuilder and maybe just rewrite from scratch.
This commit is contained in:
@@ -63,15 +63,9 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
|
||||
#include <iostream>
|
||||
#include <strstream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#else
|
||||
#include <iostream.h>
|
||||
#include <strstream.h>
|
||||
#include <fstream.h>
|
||||
#endif
|
||||
|
||||
#include <Dt/Term.h>
|
||||
#include <Tt/tt_c.h>
|
||||
@@ -95,7 +89,7 @@ char * snoopFile = 0;
|
||||
Boolean unlinkSnoopFile = True;
|
||||
char * traceFile = 0;
|
||||
Boolean unlinkTraceFile = True;
|
||||
char * traceScript = 0;
|
||||
const char * traceScript = 0;
|
||||
int globalTimeout = 20000;
|
||||
unsigned int globalSaveLines = 5000;
|
||||
const char * globalVersionString = "1.0";
|
||||
@@ -112,7 +106,7 @@ unsigned int snoopedArgsCount = 0;
|
||||
char * optTraceScript = 0;
|
||||
String apiTracerArgv[ 10 ];
|
||||
String snooperArgv[ 10 ];
|
||||
std::ostrstream tttraceCmd;
|
||||
std::ostringstream tttraceCmd;
|
||||
std::ofstream snoopStream;
|
||||
|
||||
// Xt squats on -tf ?! XXX
|
||||
@@ -188,7 +182,7 @@ signalHandler(
|
||||
if ((child > 0) && WIFEXITED( status )) {
|
||||
snoopStream << endl << endl << "SIGCHLD: WEXITSTATUS=="
|
||||
<< WEXITSTATUS(status) << ": "
|
||||
<< tttraceCmd.str() << endl << endl;
|
||||
<< tttraceCmd.str().c_str() << endl << endl;
|
||||
}
|
||||
break;
|
||||
case SIGCONT:
|
||||
@@ -666,14 +660,14 @@ main(int argc, char **argv)
|
||||
installSignalHandler();
|
||||
if (snoopedArgsCount > 0) {
|
||||
DtTtSetLabel( dtb_ttsnoop_ttsnoop_win.ttsnoopWin_label,
|
||||
tttraceCmd.str() );
|
||||
tttraceCmd.str().c_str() );
|
||||
}
|
||||
Tt_status status;
|
||||
snoopStream.open( snoopFile, ios::app );
|
||||
std::ostrstream envStr;
|
||||
std::ostringstream envStr;
|
||||
envStr << "TT_TRACE_SCRIPT=> ";
|
||||
envStr << traceFile << ends;
|
||||
traceScript = envStr.str();
|
||||
traceScript = envStr.str().c_str();
|
||||
if (optImmediateTracing) {
|
||||
turnOnTracing( 0, 0, 0 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user