-/* NetHack 3.6 extern.h $NHDT-Date: 1445215014 2015/10/19 00:36:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.509 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1446336781 2015/11/01 00:13:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.511 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E char *FDECL(upstart, (char *));
E char *FDECL(mungspaces, (char *));
E char *FDECL(eos, (char *));
+E boolean FDECL(str_end_is, (const char *, const char *));
E char *FDECL(strkitten, (char *, CHAR_P));
E void FDECL(copynchars, (char *, const char *, int));
E char FDECL(chrcasecpy, (int, int));
-/* NetHack 3.6 hacklib.c $NHDT-Date: 1432723746 2015/05/27 10:49:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.43 $ */
+/* NetHack 3.6 hacklib.c $NHDT-Date: 1446336792 2015/11/01 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
-/* Copyright (c) Robert Patrick Rankin, 1991 */
+/* Copyright (c) Robert Patrick Rankin, 1991 */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h" /* for config.h+extern.h */
char * upstart (char *)
char * mungspaces (char *)
char * eos (char *)
+ boolean str_end_is (const char *, const char *)
char * strkitten (char *,char)
void copynchars (char *,const char *,int)
char chrcasecpy (int,int)
return s;
}
+/* determine whether 'str' ends in 'chkstr' */
+boolean
+str_end_is(str, chkstr)
+const char *str, *chkstr;
+{
+ int clen = (int) strlen(chkstr);
+
+ if ((int) strlen(str) >= clen)
+ return (boolean) (!strncmp(eos((char *) str) - clen, chkstr, clen));
+ return FALSE;
+}
+
/* append a character to a string (in place): strcat(s, {c,'\0'}); */
char *
strkitten(s, c)
int oc, nc;
{
#if 0 /* this will be necessary if we switch to <ctype.h> */
- oc = (int)(unsigned char)oc;
- nc = (int)(unsigned char)nc;
+ oc = (int) (unsigned char) oc;
+ nc = (int) (unsigned char) nc;
#endif
if ('a' <= oc && oc <= 'z') {
/* old char is lower case; if new char is upper case, downcase it */
return buf;
}
-boolean onlyspace(s) /* is a string entirely whitespace? */
+/* is a string entirely whitespace? */
+boolean
+onlyspace(s)
const char *s;
{
for (; *s; s++)
return TRUE;
}
-char *tabexpand(sbuf) /* expand tabs into proper number of spaces */
+/* expand tabs into proper number of spaces */
+char *
+tabexpand(sbuf)
char *sbuf;
{
char buf[BUFSZ];
return strcpy(sbuf, buf);
}
-char *visctrl(c) /* make a displayable string from a character */
+/* make a displayable string from a character */
+char *
+visctrl(c)
char c;
{
Static char ccc[3];
return (boolean) (!dy || !dx || dy == dx || dy == -dx);
}
-/* guts of pmatch(), pmatchi(), and pmatchz() */
+/* guts of pmatch(), pmatchi(), and pmatchz();
+ match a string against a pattern */
static boolean
-pmatch_internal(patrn, strng, ci, sk) /* match a string against a pattern */
+pmatch_internal(patrn, strng, ci, sk)
const char *patrn, *strng;
boolean ci; /* True => case-insensitive, False => case-sensitive */
const char *sk; /* set of characters to skip */
-/* 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. */
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.