Fix warnings on FreeBSD
[oweals/cde.git] / cde / programs / ttsnoop / ttsnoop.C.src
index 186600c3c2920210ed6d6b93eb3c0bbcb6c418b3..fc1495b1b2a22479acab40607ebc5bc48a54abee 100644 (file)
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <time.h>
+
+#if defined(__linux__) || defined(CSRG_BASED) || defined(sun)
+#include <iostream>
+#include <strstream>
+#include <fstream>
+#else
 #include <iostream.h>
 #include <strstream.h>
 #include <fstream.h>
+#endif
+
 #include <Dt/Term.h>
 #include <Tt/tt_c.h>
 #include <Tt/tttk.h>
@@ -104,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[] =
@@ -188,7 +196,7 @@ signalHandler(
        }
 }
 
-#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__osf__)
+#if defined(SVR4) || defined(aix) || defined(hpux) || defined(__linux__) || defined(CSRG_BASED)
 #if !defined(SIG_PF)
 typedef void (*sig_pf_t)(int);
 #define SIG_PF sig_pf_t
@@ -200,7 +208,7 @@ _tt_sigset(
        int     sig,
        SIG_PF  handler )
 {
-#if defined(hpux)
+#if defined(hpux) || defined(__linux__) || defined(CSRG_BASED)
        struct sigaction act;
        act.sa_handler = handler;
        sigemptyset(&act.sa_mask);
@@ -266,7 +274,7 @@ justSnoopIt(
 )
 {
        DtTtCreated( DTTT_MESSAGE, msg ); // XXX bad idea?
-       snoopIt( "Tt_callback_action", justSnoopIt, msg, pat, True );
+       snoopIt( "Tt_callback_action", (void *) justSnoopIt, msg, pat, True );
        return TT_CALLBACK_PROCESSED;
 }
 
@@ -285,7 +293,7 @@ _DtTtMediaLoadPatCb(
        tt_free( (caddr_t)contents );
        tt_free( file );
        tt_free( docname );
-       snoopIt( "Ttmedia_load_pat_cb", _DtTtMediaLoadPatCb, msg );
+       snoopIt( "Ttmedia_load_pat_cb", (void *) _DtTtMediaLoadPatCb, msg );
        return 0;
 }
 
@@ -332,8 +340,8 @@ main(int argc, char **argv)
     XtAppContext       app;
     Atom               save_yourself_atom;
 
-    Pixmap     icon_pixmap = NULL;
-    Pixmap     icon_mask_pixmap = NULL;
+    Pixmap     icon_pixmap = 0;
+    Pixmap     icon_mask_pixmap = 0;
     
     /**************************************************************************
      *** DTB_USER_CODE_START
@@ -662,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();
@@ -727,7 +735,7 @@ main(int argc, char **argv)
                    for (int i = 0; i < opsCount; i++) {
                            tt_pattern_op_add( pat, ops[i] );
                    }
-                   for (i = 0; i < sendersCount; i++) {
+                   for (int i = 0; i < sendersCount; i++) {
                            tt_pattern_sender_add( pat, senders[i] );
                    }
                    if (vtype != 0) {
@@ -758,7 +766,7 @@ main(int argc, char **argv)
                  snoopPatIsRegistered ? "Off" : "On" );
     if (optMapOnOutput) {
            XtVaSetValues( dtb_ttsnoop_ttsnoop_win.ttsnoopPane,
-                          DtNmapOnOutput, optMapOnOutput, 0 );
+                          DtNmapOnOutput, optMapOnOutput, NULL );
     }
     installSignalHandler();