aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--kirc.c38
-rw-r--r--kirc.h1
3 files changed, 20 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 129bf70..0ab5a50 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,10 @@
.POSIX:
-ALL_WARNING = -Wall -Wextra -pedantic -std=c99
+ALL_WARNING = -Wall -Werror -Wextra -Wno-unused-result -pedantic -std=c99
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man
+CFLAGS = -O0 -g3
+CFLAGS += -fsanitize=address
kirc: kirc.c kirc.h
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 $(LDFLAGS) ${ALL_WARNING} kirc.c -o kirc
diff --git a/kirc.c b/kirc.c
index 20bd3ce..53b27fc 100644
--- a/kirc.c
+++ b/kirc.c
@@ -1062,25 +1062,23 @@ static void param_print_private(param p)
struct tm *timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
- char timestamp[13];
- if (!small_screen) {
- if (strnlen(p->nickname, p->nicklen) > (size_t)p->nicklen - 8) {
- *(p->nickname + p->nicklen - 8) = '\0';
- }
- strcpy(timestamp, "\x1b[90m");
- char buf[8];
- if (timeinfo->tm_hour < 10) {
- strcat(timestamp, "0");
- }
- snprintf(buf, sizeof(buf), "%d:", timeinfo->tm_hour);
- strcat(timestamp, buf);
- if (timeinfo->tm_min < 10) {
- strcat(timestamp, "0");
- }
- snprintf(buf, sizeof(buf), "%d\x1b[0m ", timeinfo->tm_min);
- strcat(timestamp, buf);
- printf("%s", timestamp);
- }
+ char timestamp[16];
+ if (strnlen(p->nickname, p->nicklen) > (size_t)p->nicklen - 8) {
+ *(p->nickname + p->nicklen - 8) = '\0';
+ }
+ strcpy(timestamp, "\x1b[90m");
+ char buf[16];
+ if (timeinfo->tm_hour < 10) {
+ strcat(timestamp, "0");
+ }
+ snprintf(buf, sizeof(buf), "%d:", timeinfo->tm_hour);
+ strcat(timestamp, buf);
+ if (timeinfo->tm_min < 10) {
+ strcat(timestamp, "0");
+ }
+ snprintf(buf, sizeof(buf), "%d\x1b[0m ", timeinfo->tm_min);
+ strcat(timestamp, buf);
+ printf("%s", timestamp);
int s = 0;
if (strnlen(p->nickname, MSG_MAX) <= (size_t)p->nicklen + strnlen(timestamp, sizeof(timestamp))) {
s = p->nicklen - strnlen(p->nickname, MSG_MAX) - strnlen(timestamp, sizeof(timestamp));
@@ -1146,11 +1144,9 @@ static void raw_parser(char *string)
};
if (WRAP_LEN > p.maxcols / 3) {
- small_screen = 1;
p.nicklen = p.maxcols / 3;
}
else {
- small_screen = 0;
p.nicklen = WRAP_LEN;
}
if (*chan != '\0' && !memcmp(p.command, "001", sizeof("001") - 1)) {
diff --git a/kirc.h b/kirc.h
index 1826826..4e1c4a0 100644
--- a/kirc.h
+++ b/kirc.h
@@ -90,7 +90,6 @@ static struct termios orig;
static int history_len = 0;
static char history_wrap = 0;
static char history[HIS_MAX][MSG_MAX];
-static char small_screen;
typedef struct PARAMETERS {
char *prefix;