[hackers] [sic] applied Eric's config.def.h patch || Anselm R Garbe
commit f87d3f5bef896bc066d46170b6e124d2a2239fba
Author: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Sun Nov 2 09:23:48 2014 +0100
applied Eric's config.def.h patch
diff --git a/Makefile b/Makefile
index d77b4f2..6fdcfbb 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -17,7 +17,11 @@ options:
_AT_echo CC $<
_AT_${CC} -c ${CFLAGS} $<
-${OBJ}: config.mk util.c
+${OBJ}: config.h config.mk util.c
+
+config.h:
+ _AT_echo creating $@ from config.def.h
+ _AT_cp config.def.h $@
sic: ${OBJ}
_AT_echo CC -o $@
diff --git a/config.def.h b/config.def.h
new file mode 100644
index 0000000..6bbad14
--- /dev/null
+++ b/config.def.h
_AT_@ -0,0 +1,8 @@
+// Host used when "-h" is not given
+#define DEFAULT_HOST "irc.oftc.net"
+
+// Port used when "-p" is not given
+#define DEFAULT_PORT "6667"
+
+// Timestamp format; see strftime(3)
+#define TIMESTAMP_FORMAT "%F %R"
diff --git a/sic.c b/sic.c
index d93c2ec..7a3edee 100644
--- a/sic.c
+++ b/sic.c
_AT_@ -8,8 +8,10 @@
#include <time.h>
#include <unistd.h>
-static char *host = "irc.oftc.net";
-static char *port = "6667";
+#include "config.h"
+
+static char *host = DEFAULT_HOST;
+static char *port = DEFAULT_PORT;
static char *password;
static char nick[32];
static char bufin[4096];
_AT_@ -22,7 +24,7 @@ static FILE *srv;
static void
pout(char *channel, char *fmt, ...) {
- static char timestr[18];
+ static char timestr[80];
time_t t;
va_list ap;
_AT_@ -30,7 +32,7 @@ pout(char *channel, char *fmt, ...) {
vsnprintf(bufout, sizeof bufout, fmt, ap);
va_end(ap);
t = time(NULL);
- strftime(timestr, sizeof timestr, "%D %R", localtime(&t));
+ strftime(timestr, sizeof timestr, TIMESTAMP_FORMAT, localtime(&t));
fprintf(stdout, "%-12s: %s %s\n", channel, timestr, bufout);
}
Received on Sun Nov 02 2014 - 09:24:00 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 02 2014 - 09:24:09 CET