From: Bruno Haible Date: Fri, 3 Jan 2025 15:22:41 +0000 (+0100) Subject: Refactor: Use function str_endswith. X-Git-Tag: v0.24~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3659787df5c637266ed938699a075c887b468a0c;p=thirdparty%2Fgettext.git Refactor: Use function str_endswith. * libtextstyle/gnulib-local/lib/term-ostream.oo.c (term_ostream_create): Use str_endswith. * libtextstyle/gnulib-local/modules/term-ostream (Depends-on): Add str_endswith. --- diff --git a/libtextstyle/gnulib-local/lib/term-ostream.oo.c b/libtextstyle/gnulib-local/lib/term-ostream.oo.c index a7b08bb70..e296a4315 100644 --- a/libtextstyle/gnulib-local/lib/term-ostream.oo.c +++ b/libtextstyle/gnulib-local/lib/term-ostream.oo.c @@ -2677,14 +2677,11 @@ term_ostream_create (int fd, const char *filename, ttyctl_t tty_control) && (/* Recognize xterm-16color, xterm-88color, xterm-256color. */ (strlen (term) >= 5 && memcmp (term, "xterm", 5) == 0) || /* Recognize *-16color. */ - (strlen (term) > 8 - && strcmp (term + strlen (term) - 8, "-16color") == 0) + (strlen (term) > 8 && str_endswith (term, "-16color")) || /* Recognize *-256color. */ - (strlen (term) > 9 - && strcmp (term + strlen (term) - 9, "-256color") == 0) + (strlen (term) > 9 && str_endswith (term, "-256color")) || /* Recognize *-direct. */ - (strlen (term) > 7 - && strcmp (term + strlen (term) - 7, "-direct") == 0)) + (strlen (term) > 7 && str_endswith (term, "-direct"))) ? (/* Note: For recognizing cm_xtermrgb, recommends to test getenv ("COLORTERM"), but it does not seem like a good idea. diff --git a/libtextstyle/gnulib-local/modules/term-ostream b/libtextstyle/gnulib-local/modules/term-ostream index f63d01979..09afac3a3 100644 --- a/libtextstyle/gnulib-local/modules/term-ostream +++ b/libtextstyle/gnulib-local/modules/term-ostream @@ -19,6 +19,7 @@ get_ppid_of get_progname_of stdint-h str_startswith +str_endswith terminfo-h xalloc xgethostname