Posts Tagged ‘patch’

Hushed Peep-ing

Saturday, August 29th, 2009

This kludgy patch is the minimum needed to get peep-0.5.0-rc2 to compile without warning or error.  If I liked it more, I’d try to feed it upstream.  As it is, this is a place for me to tuck this so I don’t lose it. peep patch

Nary a Peep

Sunday, August 2nd, 2009

In the unlikely event that you, like me, become interested in Peep, the aural network analyzer, and try to compile it, here is the start of a patch which will silence many of the warnings and fix the one compilation error you may see.  Not fully complete, but this is as far as I got before a warning baffled and balked me.  Here in a file:  peep.patch

mtn diff –diff-args=-u  –external –revision=8ceea9d20d313dbf6715b4f1e34ad2c517811786
#
# old_revision [8ceea9d20d313dbf6715b4f1e34ad2c517811786]
#
# patch “peep-0.5.0-rc2/server/Makefile.in”
#  from [ef4bccc99a35e0974eff71a7c1fa545fcf3aee45]
#    to [e26423ae2636eefc1dd8507fb6fc662fee0217ba]
#
# patch “peep-0.5.0-rc2/server/cmdline.c”
#  from [9a76bcfe4baaf11a9994d462f1bdbbcf9c9d53b8]
#    to [d464590f8c8981ac93769bda0db0ace9c0c04f85]
#
# patch “peep-0.5.0-rc2/server/cmdline.h”
#  from [83e62a8db5117b75f333450ef240ca94239e4aff]
#    to [80677cbd08b164cd949eac4306ef14625393c6ad]
#
# patch “peep-0.5.0-rc2/server/debug.c”
#  from [d57e2db5bfa388a43a2e2ca2a54a0b7df9bb6fff]
#    to [1df39546ba7eb7e845006b490e24e862fd215ee5]
#
# patch “peep-0.5.0-rc2/server/debug.h”
#  from [94fa9d4f58d4cf8337be4110a0bc576d298dbe16]
#    to [caa26a381625a860730579c6a5b627b49019e6b8]
#
# patch “peep-0.5.0-rc2/server/engine.c”
#  from [193790ce9a81312816cf826228de8c71dcafb6ae]
#    to [4e68651c2c01ae59178edf958b2b7d515ff794f6]
#
# patch “peep-0.5.0-rc2/server/engine.h”
#  from [9f8ee670d0a42f1d3ef68d7933e4caf5dc46673a]
#    to [d77e4bc5126fb0cfbe3b7583b7157a9fad8497ce]
#
# patch “peep-0.5.0-rc2/server/main.c”
#  from [a8e02bd355754afd429afce4583f8e961e299b0a]
#    to [d731c64a931310a24a66a04ea8ceea100e720f1e]
#
# patch “peep-0.5.0-rc2/server/mixer_queue.h”
#  from [6ada4f50ad42c9e7e130b3e284a4f86cd25599ef]
#    to [6cc9e810bc4566051ea3bb22e9f66986534e0bcd]
#
— peep-0.5.0-rc2/server/Makefile.in    old
+++ peep-0.5.0-rc2/server/Makefile.in    new
@@ -157,7 +157,7 @@
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -Wall -Werror
DIST_SOURCES = $(peepd_SOURCES)
DIST_COMMON = Makefile.am Makefile.in
SOURCES = $(peepd_SOURCES)
— peep-0.5.0-rc2/server/cmdline.c    old
+++ peep-0.5.0-rc2/server/cmdline.c    new
@@ -316,7 +316,7 @@
{

printVersion ();
-    printf (”
+    printf (“\
Usage: %s [OPTIONS]…\n\
-h         –help                Print help and exit\n\
-V         –version             Print version and exit\n\
— peep-0.5.0-rc2/server/cmdline.h    old
+++ peep-0.5.0-rc2/server/cmdline.h    new
@@ -71,8 +71,9 @@

#define GET_INT_ARG(x, y) \
{ if (argv[1][2] != ‘\0′) \
-        if (!sscanf ((char *)&(argv[1][2]), “%d”, &x)) \
+        { if (!sscanf ((char *)&(argv[1][2]), “%d”, &x)) \
optError (y); \
+        } \
else { \
argc–; argv++; \
if (!sscanf (argv[1], “%d”, &x)) \
— peep-0.5.0-rc2/server/debug.c    old
+++ peep-0.5.0-rc2/server/debug.c    new
@@ -43,7 +43,7 @@
{

if (!boolean)
-        log (DBG_ASSRT, “Assertion %s failed in line %d of file %s\n”, boolstr, line, file);
+        mylog (DBG_ASSRT, “Assertion %s failed in line %d of file %s\n”, boolstr, line, file);
/* else log(DBG_ASSRT, “Assertion %s succeeded in line %d of file %s\n”,
* boolstr,line,file);
*/
@@ -78,7 +78,7 @@

}

-int logClose (void)
+void logClose (void)
{

if (fclose (log_handle) != 0)
@@ -86,7 +86,7 @@

}

-void log (int level, char *s, …)
+void mylog (int level, char *s, …)
{

va_list ap;
@@ -114,7 +114,7 @@
sprintf (log_string, “[%s] %s”, time_string, output);

/* Output and flush the stream so we don’t hang onto logging info */
-        fprintf (log_handle, log_string);
+        fprintf (log_handle, “%s”, log_string);
fflush (log_handle);

free (log_string);
— peep-0.5.0-rc2/server/debug.h    old
+++ peep-0.5.0-rc2/server/debug.h    new
@@ -56,15 +56,17 @@
int logInit (char *log_file);

/* Close the logfile and clean up */
-int logClose (void);
+void logClose (void);

#define LOG_BUF 1024

/* Include stdio so we don’t have problems with using
* a FILE * type */
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>

/* Variable argument logging function */
-void log (int level, char *s, …);
+void mylog (int level, char *s, …);

#endif
— peep-0.5.0-rc2/server/engine.c    old
+++ peep-0.5.0-rc2/server/engine.c    new
@@ -21,6 +21,7 @@
#include <string.h>
#include “engine.h”
#include “engine_queue.h”
+#include “mixer_queue.h”
#include “thread.h”
#include “mixer.h”
#include “playback.h”
@@ -138,11 +139,9 @@
int index = engineSoundHash (name);
struct sound_entry *p = NULL;

-    for (p = sound_table[index]; p; p ->next) {
-
+    for (p = sound_table[index]; p; p=p->next) {
if (!strcasecmp (p->name, name))
return p;
-
}

return NULL;
@@ -398,7 +397,7 @@

if (! playbackRecordEvent (*engine_event)) {

-            log (DBG_GEN, “WARNING: Error recording an event. Event not recorded.\n”);
+            mylog (DBG_GEN, “WARNING: Error recording an event. Event not recorded.\n”);
/* continue anyway */

}
@@ -615,8 +614,6 @@
void engineShutdown (void)
{

-    int i, j;
-
/* Free the engine scheduler data structure */
cfree (sched);

— peep-0.5.0-rc2/server/engine.h    old
+++ peep-0.5.0-rc2/server/engine.h    new
@@ -104,7 +104,7 @@
};

/* Allocate and create the sound table data structure */
-int engineSoundTableInit (void);
+int engineInitSoundTable (void);

/* Inserts an event entry into the sound table */
int engineSoundTableInsertEvent (char *name, EVENT_ENTRY *event);
— peep-0.5.0-rc2/server/main.c    old
+++ peep-0.5.0-rc2/server/main.c    new
@@ -30,6 +30,7 @@
#include “mixer.h”
#include “playback.h”
#include “debug.h”
+#include “parser.h”

static struct args_info args_info;
static FILE *pid_file = NULL;
@@ -77,14 +78,14 @@

if ((pid_file = fopen (pid_path, “w”)) == NULL) {

-            log (DBG_DEF, “Couldn’t write pid to file %s: %s.\n”, pid_path, strerror (errno));
-            log (DBG_DEF, “Continuing anyway…\n”);
+            mylog (DBG_DEF, “Couldn’t write pid to file %s: %s.\n”, pid_path, strerror (errno));
+            mylog (DBG_DEF, “Continuing anyway…\n”);

}
else {

/* Write our pid out to the file */
-            fprintf (pid_file, “%d\n”, pid_file);
+            fprintf (pid_file, “%d\n”, pid);
fflush (pid_file);
fclose (pid_file);

@@ -102,27 +103,27 @@
switch (DEBUG_LEVEL) {

case DBG_LOWER:
-            log (DBG_GEN, “%s %s\n”, str, “LOWER”);
+            mylog (DBG_GEN, “%s %s\n”, str, “LOWER”);
break;

case DBG_MEDIUM:
-            log (DBG_GEN, “%s %s\n”, str, “MEDIUM”);
+            mylog (DBG_GEN, “%s %s\n”, str, “MEDIUM”);
break;

case DBG_HIGHER:
-            log (DBG_GEN, “%s %s\n”, str, “HIGHER”);
+            mylog (DBG_GEN, “%s %s\n”, str, “HIGHER”);
break;

case DBG_HIGHEST:
-            log (DBG_GEN, “%s %s\n”, str, “HIGHEST”);
+            mylog (DBG_GEN, “%s %s\n”, str, “HIGHEST”);
break;

case DBG_ALL_W_ASSERT:
-            log (DBG_GEN, “%s %s\n”, str, “HIGHEST WITH ASSERTIONS!”);
+            mylog (DBG_GEN, “%s %s\n”, str, “HIGHEST WITH ASSERTIONS!”);
break;

default:
-            log (DBG_GEN, “%s %s\n”, str, “UNKNOWN. WEIRD.”);
+            mylog (DBG_GEN, “%s %s\n”, str, “UNKNOWN. WEIRD.”);
break;

}
@@ -132,14 +133,14 @@
if (!args_info.voices_given)
args_info.voices_arg = DEFAULT_MIXER_VOICES;

-    log (DBG_DEF, “Mixing voices: %d\n”, args_info.voices_arg);
-    log (DBG_DEF, “Initializing the sound engine and mixer…\n”);
+    mylog (DBG_DEF, “Mixing voices: %d\n”, args_info.voices_arg);
+    mylog (DBG_DEF, “Initializing the sound engine and mixer…\n”);

#ifdef STATIC_VOLUME
-    log (DBG_DEF, “Using static volume mixing…\n”);
+    mylog (DBG_DEF, “Using static volume mixing…\n”);
#endif
#ifdef DYNAMIC_VOLUME
-    log (DBG_DEF, “Using dynamic volume mixing…\n”);
+    mylog (DBG_DEF, “Using dynamic volume mixing…\n”);
#endif

/* Perform some error checking to set arguments correctly */
@@ -160,7 +161,7 @@

}

-    log (DBG_DEF, “Parsing configuration…\n”);
+    mylog (DBG_DEF, “Parsing configuration…\n”);

if (!args_info.config_given)
args_info.config_arg = DEFAULT_CONFIG_PATH;
@@ -179,20 +180,20 @@

if (parsed < 0) {

-            log (DBG_GEN, “Error parsing peep configuration file…\n”);
+            mylog (DBG_GEN, “Error parsing peep configuration file…\n”);
shutDown ();

}

}

-    log (DBG_DEF, “Finished configuration…\n”);
+    mylog (DBG_DEF, “Finished configuration…\n”);

-    log (DBG_DEF, “Starting mixer thread…\n”);
+    mylog (DBG_DEF, “Starting mixer thread…\n”);

startThread (doMixing, 0, &mthread);

-    log (DBG_DEF, “Starting engine thread…\n”);
+    mylog (DBG_DEF, “Starting engine thread…\n”);

startThread (engineLoop, 0, &ethread);

@@ -216,11 +217,11 @@
if (!args_info.record_file_given)
args_info.record_file_arg = DEFAULT_RECORD_FILE;

-        log (DBG_DEF, “Initializing playback file…\n”);
+        mylog (DBG_DEF, “Initializing playback file…\n”);

if (!playbackFileInit (args_info.record_file_arg)) {

-            log (DBG_DEF, “Uh Oh! Couldn’t successfully initiliaze playback file! Giving up.\n”);
+            mylog (DBG_DEF, “Uh Oh! Couldn’t successfully initiliaze playback file! Giving up.\n”);
shutDown ();

}
@@ -232,7 +233,7 @@
*/
if (playbackModeOn (NULL) && playbackSetMode (NULL) == PLAY_MODE) {

-        log (DBG_DEF, “Entering playback mode…\n”);
+        mylog (DBG_DEF, “Entering playback mode…\n”);

if (!args_info.start_time_given)
args_info.start_time_arg = NULL;
@@ -245,12 +246,12 @@
}
else {

-        log (DBG_DEF, “Initializing server…\n”);
+        mylog (DBG_DEF, “Initializing server…\n”);

setSigHandlers ();

if (playbackModeOn (NULL) && playbackSetMode (NULL) == RECORD_MODE)
-            log (DBG_DEF, “Record mode on – Recording events to %s.\n”, args_info.record_file_arg);
+            mylog (DBG_DEF, “Record mode on – Recording events to %s.\n”, args_info.record_file_arg);

/* Check whether the port has been set */
if (!args_info.port_given)
@@ -260,29 +261,30 @@

if (serverInit () < 0) {

-            log (DBG_GEN, “Uh Oh! Error initializing server!\n”);
+            mylog (DBG_GEN, “Uh Oh! Error initializing server!\n”);
shutDown ();

}

-        log (DBG_DEF, “Starting server…\n”);
+        mylog (DBG_DEF, “Starting server…\n”);

serverStart ();

}

+    return 0;
}

void printGreeting (void)
{

-    log (DBG_DEF, “\n”);
-    log (DBG_DEF, “========================================================\n”);
-    log (DBG_DEF, “Welcome to Peep (The Network Auralizer).\n”);
-    log (DBG_DEF, “Copyright (C) 2000 Michael Gilfix.\n”);
-    log (DBG_DEF, “v%s\n”, PACKAGE_VERSION);
-    log (DBG_DEF, “=========================================================\n”);
-    log (DBG_DEF, “\n”);
+    mylog (DBG_DEF, “\n”);
+    mylog (DBG_DEF, “========================================================\n”);
+    mylog (DBG_DEF, “Welcome to Peep (The Network Auralizer).\n”);
+    mylog (DBG_DEF, “Copyright (C) 2000 Michael Gilfix.\n”);
+    mylog (DBG_DEF, “v%s\n”, PACKAGE_VERSION);
+    mylog (DBG_DEF, “=========================================================\n”);
+    mylog (DBG_DEF, “\n”);

}

@@ -293,24 +295,24 @@

if ((handler = signal (SIGINT, handleSignal)) == SIG_ERR) {

-        log (DBG_GEN, “Error registering SIGINT handler: %s\n”, strerror (errno));
+        mylog (DBG_GEN, “Error registering SIGINT handler: %s\n”, strerror (errno));
shutDown ();

}

#if DEBUG_LEVEL & DBG_SETUP
-    log (DBG_SETUP, “Registered SIGINT handler.\n”);
+    mylog (DBG_SETUP, “Registered SIGINT handler.\n”);
#endif

if ((handler = signal (SIGHUP, handleSignal)) == SIG_ERR) {

-        log (DBG_GEN, “Error registering SIGHUP handler: %s\n”, strerror (errno));
+        mylog (DBG_GEN, “Error registering SIGHUP handler: %s\n”, strerror (errno));
shutDown ();

}

#if DEBUG_LEVEL & DBG_SETUP
-    log (DBG_SETUP, “Registered SIGHUP handler.\n”);
+    mylog (DBG_SETUP, “Registered SIGHUP handler.\n”);
#endif

}
@@ -348,17 +350,17 @@
client_event = engineDequeue ();

#if DEBUG_LEVEL & DBG_SRVR
-        log (DBG_SRVR, “\n”);
-        log (DBG_SRVR, “Received Event:\n”);
-        log (DBG_SRVR, “\ttype:   %d\n”, client_event.type);
-        log (DBG_SRVR, “\tlen:    %d\n”, client_event.sound_len);
-        log (DBG_SRVR, “\tsound:  %s\n”, client_event.sound);
-        log (DBG_SRVR, “\tloc:    %d\n”, client_event.loc);
-        log (DBG_SRVR, “\tprior:  %d\n”, client_event.prior);
-        log (DBG_SRVR, “\tvol:    %d\n”, client_event.vol);
-        log (DBG_SRVR, “\tdither: %d\n”, client_event.dither);
-        log (DBG_SRVR, “\tflags:  0x%04x\n”, client_event.flags);
-        log (DBG_SRVR, “\n”);
+        mylog (DBG_SRVR, “\n”);
+        mylog (DBG_SRVR, “Received Event:\n”);
+        mylog (DBG_SRVR, “\ttype:   %d\n”, client_event.type);
+        mylog (DBG_SRVR, “\tlen:    %d\n”, client_event.sound_len);
+        mylog (DBG_SRVR, “\tsound:  %s\n”, client_event.sound);
+        mylog (DBG_SRVR, “\tloc:    %d\n”, client_event.loc);
+        mylog (DBG_SRVR, “\tprior:  %d\n”, client_event.prior);
+        mylog (DBG_SRVR, “\tvol:    %d\n”, client_event.vol);
+        mylog (DBG_SRVR, “\tdither: %d\n”, client_event.dither);
+        mylog (DBG_SRVR, “\tflags:  0x%04x\n”, client_event.flags);
+        mylog (DBG_SRVR, “\n”);
#endif

/* Check if we have a valid event */
@@ -366,8 +368,8 @@
if (entry == NULL) {

#if DEBUG_LEVEL & DBG_SRVR
-            log (DBG_SRVR, “Server does not have event [%s] in its sound table!\n”, client_event.sound);
-            log (DBG_SRVR, “Discarding….\n”);
+            mylog (DBG_SRVR, “Server does not have event [%s] in its sound table!\n”, client_event.sound);
+            mylog (DBG_SRVR, “Discarding….\n”);
#endif

continue;
@@ -376,7 +378,7 @@
else if (client_event.type != entry->type) {

#if DEBUG_LEVEL & DBG_SRVR
-                log (DBG_SRVR, “Received invalid event type or type does not match sound table.\n”);
+                mylog (DBG_SRVR, “Received invalid event type or type does not match sound table.\n”);
#endif

continue;
@@ -403,7 +405,7 @@
void handleSignal (int sig)
{

-    log (DBG_DEF, “Performing shutdown…\n”);
+    mylog (DBG_DEF, “Performing shutdown…\n”);

if (ethread)
threadKill (ethread);
@@ -413,23 +415,23 @@

/* cleanup */
-    log (DBG_DEF, “Cleaning up engine…\n”);
+    mylog (DBG_DEF, “Cleaning up engine…\n”);
engineShutdown ();

-    log (DBG_DEF, “Cleaning up mixer…\n”);
+    mylog (DBG_DEF, “Cleaning up mixer…\n”);
mixerShutdown ();

-    log (DBG_DEF, “Cleaning up server…\n”);
+    mylog (DBG_DEF, “Cleaning up server…\n”);
serverShutdown ();

if (playbackModeOn (NULL)) {

-        log (DBG_DEF, “Closing playback file…\n”);
+        mylog (DBG_DEF, “Closing playback file…\n”);
playbackFileShutdown ();

}

-    log (DBG_DEF, “Exiting…\n”);
+    mylog (DBG_DEF, “Exiting…\n”);

/* Close logging routines */
logClose ();
— peep-0.5.0-rc2/server/mixer_queue.h    old
+++ peep-0.5.0-rc2/server/mixer_queue.h    new
@@ -45,8 +45,8 @@
ENGINE_EVENT *mixerDequeue (void);

/* Check the status of the queue */
-int MixerQueueEmpty (void);
-int MixerQueueFull (void);
+int mixerQueueEmpty (void);
+int mixerQueueFull (void);

/***************************************************************
* Internal function

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...