str_end_is()

Move this small utility routine to hacklib.c where other such things
live and where it's feasible to find them if you need the functionality
elsewhere.
This commit is contained in:
PatR
2015-10-31 17:13:26 -07:00
parent b44486e7cc
commit 68cb45c9fd
3 changed files with 32 additions and 21 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1445556879 2015/10/22 23:34:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.227 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1446336796 2015/11/01 00:13:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.234 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -5106,16 +5106,6 @@ const char *str;
return;
}
boolean
str_end_is(str, chkstr)
char *str, *chkstr;
{
int clen = strlen(chkstr);
if (strlen(str) >= clen)
return !strncmp(eos(str) - clen, chkstr, clen);
return FALSE;
}
/* Returns the fid of the fruit type; if that type already exists, it
* returns the fid of that one; if it does not exist, it adds a new fruit
* type to the chain and returns the new one.