And here is mine - somewhat tortuous. endswith() alone is short.
I think I neglected to take care of the phrase being longer than
the searchee, which could cause UB.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Yes, I know strlcat and strlcpy are in the implementors
namespace. Change them if you must.
See <
http://cbfalconer.home.att.net/download/strlcpy.zip>
for documentation and rationale.
The objective is to detect whether a given string terminates
another string. This is a fairly tortuous way of doing
"endswith", but is fairly clear.
By C.B.Falconer. Released to public domain
*/