From 3ad341e3c98e4508d5bcd028331856a129d58328 Mon Sep 17 00:00:00 2001 From: zegonix Date: Tue, 27 Oct 2026 09:09:51 +0100 Subject: [PATCH] readme comparison cleanup --- src/display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/display.c b/src/display.c index 49ddbd6..eb75830 100644 --- a/src/display.c +++ b/src/display.c @@ -308,9 +308,15 @@ void set_file_style( const directory_entry_t* const entry ) bool compare_makefile( const directory_entry_t* const entry ) { - return 0 == compare_strings( entry->name, "makefile", NAME_MAX, false ) - || 0 == compare_strings( entry->name, "readme", 6, false ) - || 0 == compare_strings( entry->name, "readme", 6, false ) + return 0 == compare_strings( entry->name, "makefile", 9, false ) + || 0 == compare_strings( entry->name, "readme", 7, false ) + /* do not compare the zero character, in order to also chatch + * readmes with extensions like '.md' or '.txt'. + * + * this also flags nonsensical files like 'readme.bullshit' + * but this is deemed acceptable + */ + || 0 == compare_strings( entry->name, "readme.", 7, false ) || 0 == compare_strings( entry->extension, "mk", 3, false ) || 0 == compare_strings( entry->name, "cmakelists.txt", 15, false ); }