eel

formatter for ii(1) logs
Log | Files | Refs | README

commit a4d2ee4f323179f3911085b67f7e4f9a5cac7e95
parent fc944fb514fe39fa9de9bc179ddeea2919689104
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sat, 21 Oct 2017 13:02:05 +0200

eel.c: still need to use #define for array

Diffstat:
MMakefile | 4++++
Meel.c | 14+++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile @@ -4,5 +4,9 @@ CC = clang eel: eel.c ${CC} ${CFLAGS} eel.c -o eel +install: eel + mkdir -p $(PREFIX)/bin + cp eel $(PREFIX)/bin/eel + clean: rm eel diff --git a/eel.c b/eel.c @@ -4,18 +4,18 @@ #include <string.h> #define NICK_MAX 256 -#define NICK 10 -#define TIME 6 -#define COLS 80 +#define NICK_COL 10 +#define TIME_COL 6 +#define COLS_MAX 80 char * print_row(char *time, char *nick, char *message) { char *blank = NULL; char *m = message; - int offset = printf("%*s %*s ", TIME, time, NICK, nick); + int offset = printf("%*s %*s ", TIME_COL, time, NICK_COL, nick); - for (; offset + (m - message) < COLS; m++) { + for (; offset + (m - message) < COLS_MAX; m++) { if (*m == ' ') blank = m; if (!*m) @@ -39,14 +39,14 @@ tail: void print_message(time_t time, char *nick, int same, char *message) { - char time_str[TIME]; + char time_str[TIME_COL]; if (same) nick = ""; else putchar('\n'); - strftime(time_str, TIME, "%02H:%02M", localtime(&time)); + strftime(time_str, TIME_COL, "%02H:%02M", localtime(&time)); while ((message = print_row(time_str, nick, message))) { time_str[0] = '\0'; nick = "";