herbe

[fork] notifications
Log | Files | Refs | README | LICENSE

commit 8b455d4ced2d3c36ec064ee8d8c17b303a7d455b
parent c896d21ab20baba97c24b7237cbd80a578b7edcd
Author: Samuel Dudik <samuel.dudik@gmail.com>
Date:   Sun, 23 Aug 2020 13:35:19 +0200

Minor refactoring before first release

Diffstat:
MMakefile | 2+-
Mconfig.def.h | 2+-
Mherbe.c | 6+++---
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,4 +1,4 @@ -CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -lm -pthread +CFLAGS = -Wall -Wextra -pedantic -lX11 -lXft -I/usr/include/freetype2 -pthread PREFIX ?= /usr/local CC ?= cc diff --git a/config.def.h b/config.def.h @@ -1,7 +1,7 @@ static const char *background_color = "#3e3e3e"; static const char *border_color = "#ececec"; static const char *font_color = "#ececec"; -static const char *font_pattern = "Inconsolata:style=Medium:size=12"; +static const char *font_pattern = "monospace:size=10"; static const unsigned line_spacing = 5; static const unsigned int padding = 15; diff --git a/herbe.c b/herbe.c @@ -56,7 +56,7 @@ int get_max_len(char *string, XftFont *font, int max_text_width) return ++i; } - if (info.width < max_text_width) + if (info.width <= max_text_width) return eol; int temp = eol; @@ -133,13 +133,13 @@ int main(int argc, char *argv[]) for (int i = 1; i < argc; i++) { - for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol <= strlen(argv[i]) && eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width)) + for (unsigned int eol = get_max_len(argv[i], font, max_text_width); eol; argv[i] += eol, num_of_lines++, eol = get_max_len(argv[i], font, max_text_width)) { if (lines_size <= num_of_lines) { lines = realloc(lines, (lines_size += 5) * sizeof(char *)); if (!lines) - die("malloc failed"); + die("realloc failed"); } lines[num_of_lines] = malloc((eol + 1) * sizeof(char));