@echo CC $<
@${CC} -c ${CFLAGS} $<
-${OBJ}: config.mk util.c
+${OBJ}: config.h config.mk util.c
+
+config.h:
+ @echo creating $@ from config.def.h
+ @cp config.def.h $@
sic: ${OBJ}
@echo CC -o $@
--- /dev/null
+// 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"
#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];
static void
pout(char *channel, char *fmt, ...) {
- static char timestr[18];
+ static char timestr[80];
time_t t;
va_list ap;
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);
}