Commit 905b1c99 authored by Simon Middleton's avatar Simon Middleton
Browse files

Used srccommit.

Updated Makefile to create library versions.
 Upped max line length and allocated it via malloc.
Added new debug type with args for file and line.

Version 0.01, 1.1.2.2. Tagged as 'remotedb-0_01-1_1_2_2'
parent 72de0adc
......@@ -37,6 +37,7 @@ LD = link
RM = remove
WIPE = -wipe
CD = dir
LIBFILE = libfile
SOCKLIBZM = TCPIPLibs:o.socklibzm
SOCKLIB = TCPIPLibs:o.socklib
......@@ -68,6 +69,8 @@ DFLAGS = -DCOMPAT_INET4
#
COMPONENT = remote
COMPONENTZM = remotezm
LCOMPONENT = lremote
LCOMPONENTZM= lremotezm
OBJ = o.${COMPONENT}
OBJZM = z.${COMPONENT}
......@@ -82,7 +85,7 @@ OBJZM = z.${COMPONENT}
#
# Build
#
all: ${OBJ} ${OBJZM} local_dirs
all: ${COMPONENT} ${COMPONENTZM} ${LCOMPONENT} ${LCOMPONENTZM} local_dirs
@echo ${COMPONENT}: all complete
${COMPONENT}: ${OBJ}
......@@ -91,6 +94,12 @@ ${COMPONENT}: ${OBJ}
${COMPONENTZM}: ${OBJZM}
${LD} -o ${COMPONENTZM} -aof ${OBJZM} ${SOCKLIBZM} ${UNIXLIBZM} ${INETLIBZM}
${LCOMPONENT}: ${OBJ}
${LIBFILE} -o ${LCOMPONENT} -c ${OBJ}
${LCOMPONENTZM}: ${OBJZM}
${LIBFILE} -o ${LCOMPONENTZM} -c ${OBJZM}
local_dirs:
${MKDIR} o
${MKDIR} z
......@@ -100,6 +109,8 @@ clean:
${WIPE} z.${COMPONENT} ${WFLAGS}
${WIPE} ${COMPONENT} ${WFLAGS}
${WIPE} ${COMPONENTZM} ${WFLAGS}
${WIPE} ${LCOMPONENT} ${WFLAGS}
${WIPE} ${LCOMPONENTZM} ${WFLAGS}
@echo ${COMPONENT}: cleaned
export: export_${PHASE}
......@@ -115,6 +126,8 @@ export_libs: ${COMPONENT} ${COMPONENTZM} local_dirs
${MKDIR} ${DEBUGLIB}.o
${CP} ${COMPONENT} ${DEBUGLIB}.o.${COMPONENT} ${CPFLAGS}
${CP} ${COMPONENTZM} ${DEBUGLIB}.o.${COMPONENTZM} ${CPFLAGS}
${CP} ${LCOMPONENT} ${DEBUGLIB}.o.${LCOMPONENT} ${CPFLAGS}
${CP} ${LCOMPONENTZM} ${DEBUGLIB}.o.${LCOMPONENTZM} ${CPFLAGS}
#
......
......@@ -4,10 +4,10 @@
*
*/
#define Module_MajorVersion_CMHG 0.01
#define Module_MinorVersion_CMHG $Revision$
#define Module_MinorVersion_CMHG 1.1.2.2
#define Module_Date_CMHG 19 Jan 1998
#define Module_MajorVersion "0.01"
#define Module_MinorVersion "$Revision$"
#define Module_MinorVersion "1.1.2.2"
#define Module_Date "19 Jan 1998"
......@@ -37,9 +37,10 @@
#define REMOTE_DEBUG
#include "remote.h"
#define REMOTE_DEBUG_MAX_LINE 1024
#define REMOTE_DEBUG_MAX_LINE (10*1024)
static int poll=1;
static char *debug_line = NULL;
/*
* compare two strings caselessly
......@@ -64,7 +65,6 @@ caseless_strcmp(char *a, char *b)
int
debug_poll(debug_session *sess)
{
char debug_line[REMOTE_DEBUG_MAX_LINE];
fd_set read_set;
struct timeval tv;
char *argv[20];
......@@ -88,7 +88,7 @@ debug_poll(debug_session *sess)
{
if (FD_ISSET(sess->sock,&read_set))
{
if (recv(sess->sock, debug_line, sizeof(debug_line),MSG_PEEK)>0)
if (recv(sess->sock, debug_line, REMOTE_DEBUG_MAX_LINE,MSG_PEEK)>0)
if ((cp=strchr(debug_line,'\n'))!=NULL)
if (recv(sess->sock, debug_line, (cp-debug_line+1),0)>0)
{
......@@ -153,7 +153,6 @@ debug_poll(debug_session *sess)
void
debug_printf(debug_session *sess, char *format, ...)
{
char debug_line[REMOTE_DEBUG_MAX_LINE];
va_list list;
va_start (list, format);
......@@ -166,13 +165,27 @@ debug_printf(debug_session *sess, char *format, ...)
void
debug_vprintf(debug_session *sess, const char *format, va_list list)
{
char debug_line[REMOTE_DEBUG_MAX_LINE];
vsprintf(debug_line,format, list);
debug_print_line(sess, debug_line);
}
void
debug_dvprintf(debug_session *sess, int priority, const char *file, int line, const char *format, va_list list)
{
int n = 0;
if (priority != 0)
n += sprintf(debug_line, "(%d)", priority);
if (file)
n += sprintf(debug_line+n, " %s:%d: ", file, line);
vsprintf(debug_line+n, format, list);
debug_print_line(sess, debug_line);
}
void
debug_print_line(debug_session *sess, const char *debug_line)
{
......@@ -225,6 +238,10 @@ remote_debug_open(char *info, debug_session **db_sess)
char host[40];
char *port;
/* malloc to avoid problems in SVC mode */
if (debug_line == NULL)
debug_line = malloc(REMOTE_DEBUG_MAX_LINE);
memset(&sockaddr, 0, sizeof(sockaddr));
/*
......@@ -318,6 +335,13 @@ remote_debug_close(debug_session *sess)
free(sess->info);
free(sess);
}
if (debug_line)
{
free(debug_line);
debug_line = NULL;
}
return;
}
......
......@@ -66,6 +66,7 @@ void remote_debug_open(char *info, debug_session **sess);
*/
void debug_printf(debug_session *sess, char *format, ...);
void debug_vprintf(debug_session *sess, const char *format, va_list list);
void debug_dvprintf(debug_session *sess, int priority, const char *file, int line, const char *format, va_list list);
void debug_print_line(debug_session *sess, const char *debug_line);
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment