* Ensured the bin directory is created [issue #1];

* Fixed all compiler warnings with gcc 5.2.1;
* Fixed version substitution in header file.
This commit is contained in:
simon 2016-03-08 18:46:34 +00:00
parent 5168a633c4
commit 5b5f3f450f
4 changed files with 19 additions and 14 deletions

View file

@ -6,26 +6,30 @@ CFLAGS= -g
LD= gcc LD= gcc
LDFLAGS= -g LDFLAGS= -g
HOMEDIR= /usr/local/etc/gild HOMEDIR= /usr/local/etc/gild
TARGETS= ../bin/gild BINDIR= ../bin
COMPONENTS = gild.o wrapper.o config.o log.o TARGETS= $(BINDIR)/gild
COMPONENTS = gild.h gild.o wrapper.o config.o log.o
VERSION= $(shell git describe)
all: $(TARGETS) all: $(TARGETS)
.c.o: .c.o:
$(CC) $(CFLAGS) -c $< $(CC) $(CFLAGS) -c $<
gild.h: gild.h.src
sed "s?@Revision@?$(VERSION)?" gild.h.src > gild.h
../bin/gild: $(COMPONENTS) gild.h Makefile ../bin/gild: $(COMPONENTS) gild.h Makefile
$(LD) $(LDFLAGS) -o gild $(COMPONENTS) $(LD) $(LDFLAGS) -o gild $(COMPONENTS)
mv gild ../bin test -d $(BINDIR) || mkdir $(BINDIR)
mv gild $(BINDIR)
clean: clean:
rm core $(COMPONENTS) $(TARGETS) rm -f core $(COMPONENTS) $(TARGETS)
install: $(TARGETS) install: $(TARGETS)
install --strip $(TARGETS) $(HOMEDIR) install --strip $(TARGETS) $(HOMEDIR)
install gild.conf $(HOMEDIR) install gild.conf $(HOMEDIR)
cd handlers; make install cd handlers; make install
version: $(TARGETS)
cvs commit gild.c wrapper.c config.c log.c Makefile gild.h \
gild.conf handlers

View file

@ -27,7 +27,7 @@ extern handler * handlers;
void error( int severity) void error( int severity)
/* log the current contents of errorBuff and then if severity is bad die */ /* log the current contents of errorBuff and then if severity is bad die */
{ {
log( severity, errorBuff); log_message( severity, errorBuff);
switch ( severity) switch ( severity)
{ {

View file

@ -14,14 +14,15 @@
/* $Header$ */ /* $Header$ */
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <regex.h> #include <regex.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h>
#include <arpa/inet.h> #include <arpa/inet.h>
/* #include <linux/in.h> */
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -29,8 +30,8 @@
#define GILD_NAME "gild" #define GILD_NAME "gild"
#define GILD_VERSION "$Revision$" #define GILD_VERSION "@Revision@"
#define GILD_ID "gild $Revision$" #define GILD_ID "gild @Revision@"
#define CONFIG_PATH "/usr/local/etc/gild/gild.conf" #define CONFIG_PATH "/usr/local/etc/gild/gild.conf"
#define DEFAULT_PORT_NO 8421 #define DEFAULT_PORT_NO 8421
@ -61,7 +62,7 @@ void error( int severity);
handler * get_handler( char * match); handler * get_handler( char * match);
/* find a handler whose pattern matches match, and return it's command */ /* find a handler whose pattern matches match, and return it's command */
int log( int level, char *message); int log_message( int level, char *message);
/* hand this message over to the syslog daemon for recording */ /* hand this message over to the syslog daemon for recording */
int parse_config( char * path); int parse_config( char * path);

View file

@ -18,14 +18,14 @@
#include "gild.h" #include "gild.h"
int log( int level, char *message) int log_message( int level, char *message)
/* hand this message over to the syslog daemon for recording */ /* hand this message over to the syslog daemon for recording */
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf( stderr, "%s: DEBUG: %s\n", GILD_ID, message); fprintf( stderr, "%s: DEBUG: %s\n", GILD_ID, message);
#else #else
openlog( GILD_NAME, 0, LOG_DAEMON); openlog( GILD_NAME, 0, LOG_DAEMON);
syslog( level, message); syslog( level, "%s", message);
closelog(); closelog();
#endif #endif
} }