some C99 changes
Instead of using index() macro defined to strchr, use C99 strchr.
Instead of using rindex() macro defined to strrchr, use C99 strrchr.
If you want to try building on a platform that doesn't offer those
two functions, these are available:
define NOT_C99 /* to make some non-C99 code available */
define NEED_INDEX /* to define a macro for index() */
define NEED_RINDX /* to define a macro for rindex() */
This commit is contained in:
@@ -226,13 +226,6 @@
|
|||||||
#define HLOCK "NHPERM"
|
#define HLOCK "NHPERM"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef index
|
|
||||||
#define index strchr
|
|
||||||
#endif
|
|
||||||
#ifndef rindex
|
|
||||||
#define rindex strrchr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef AMIGA
|
#ifndef AMIGA
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,6 +6,15 @@
|
|||||||
#ifndef SYSTEM_H
|
#ifndef SYSTEM_H
|
||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
|
#ifdef NOT_C99
|
||||||
|
#ifdef NEED_INDEX
|
||||||
|
#define strchr index
|
||||||
|
#endif
|
||||||
|
#ifdef NEED_RINDX
|
||||||
|
#define strrchr rindex
|
||||||
|
#endif
|
||||||
|
#endif /* NOT_C99 */
|
||||||
|
|
||||||
#if !defined(WIN32)
|
#if !defined(WIN32)
|
||||||
#if !defined(__cplusplus) && !defined(__GO32__)
|
#if !defined(__cplusplus) && !defined(__GO32__)
|
||||||
#define E extern
|
#define E extern
|
||||||
@@ -414,6 +423,7 @@ E char *strcat(char *, const char *);
|
|||||||
E char *strncat(char *, const char *, size_t);
|
E char *strncat(char *, const char *, size_t);
|
||||||
E char *strpbrk(const char *, const char *);
|
E char *strpbrk(const char *, const char *);
|
||||||
|
|
||||||
|
#ifdef NOT_C99
|
||||||
#if defined(SYSV) || defined(MICRO) || defined(MAC) || defined(VMS) \
|
#if defined(SYSV) || defined(MICRO) || defined(MAC) || defined(VMS) \
|
||||||
|| defined(HPUX)
|
|| defined(HPUX)
|
||||||
E char *strchr(const char *, int);
|
E char *strchr(const char *, int);
|
||||||
@@ -422,6 +432,7 @@ E char *strrchr(const char *, int);
|
|||||||
E char *index(const char *, int);
|
E char *index(const char *, int);
|
||||||
E char *rindex(const char *, int);
|
E char *rindex(const char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
E int strcmp(const char *, const char *);
|
E int strcmp(const char *, const char *);
|
||||||
E int strncmp(const char *, const char *, size_t);
|
E int strncmp(const char *, const char *, size_t);
|
||||||
@@ -440,10 +451,12 @@ E int strlen(const char *);
|
|||||||
|
|
||||||
#endif /* !_XtIntrinsic_h_ && !POSIX_TYPES */
|
#endif /* !_XtIntrinsic_h_ && !POSIX_TYPES */
|
||||||
|
|
||||||
|
#ifdef NOT_C99
|
||||||
#if defined(ULTRIX) && defined(__GNUC__)
|
#if defined(ULTRIX) && defined(__GNUC__)
|
||||||
E char *index(const char *, int);
|
E char *index(const char *, int);
|
||||||
E char *rindex(const char *, int);
|
E char *rindex(const char *, int);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Old varieties of BSD have char *sprintf().
|
/* Old varieties of BSD have char *sprintf().
|
||||||
* Newer varieties of BSD have int sprintf() but allow for the old char *.
|
* Newer varieties of BSD have int sprintf() but allow for the old char *.
|
||||||
|
|||||||
+3
-1
@@ -335,13 +335,15 @@
|
|||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#endif
|
#endif
|
||||||
#else /* therefore SYSV */
|
#else /* therefore SYSV */
|
||||||
|
#ifdef NOT_C99
|
||||||
#ifndef index /* some systems seem to do this for you */
|
#ifndef index /* some systems seem to do this for you */
|
||||||
#define index strchr
|
#define index strchr
|
||||||
#endif
|
#endif
|
||||||
#ifndef rindex
|
#ifndef rindex
|
||||||
#define rindex strrchr
|
#define rindex strrchr
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* NOT_C99 */
|
||||||
|
#endif /* SYSV */
|
||||||
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
/* the high quality random number routines */
|
/* the high quality random number routines */
|
||||||
|
|||||||
@@ -262,9 +262,6 @@ typedef __mode_t mode_t;
|
|||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#define index strchr
|
|
||||||
#define rindex strrchr
|
|
||||||
|
|
||||||
/* Use the high quality random number routines. */
|
/* Use the high quality random number routines. */
|
||||||
#ifndef USE_ISAAC64
|
#ifndef USE_ISAAC64
|
||||||
# if defined(RANDOM)
|
# if defined(RANDOM)
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ typedef SSIZE_T ssize_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_SIGNAL
|
#define NO_SIGNAL
|
||||||
#define index strchr
|
|
||||||
#define rindex strrchr
|
|
||||||
|
|
||||||
/* Time stuff */
|
/* Time stuff */
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ char *path;
|
|||||||
|
|
||||||
strncpy(fileName, path, sizeof(fileName) - 1);
|
strncpy(fileName, path, sizeof(fileName) - 1);
|
||||||
fileName[31] = 0;
|
fileName[31] = 0;
|
||||||
if (colon = index(fileName, ':'))
|
if (colon = strchr(fileName, ':'))
|
||||||
colon[1] = '\0';
|
colon[1] = '\0';
|
||||||
else
|
else
|
||||||
fileName[0] = '\0';
|
fileName[0] = '\0';
|
||||||
@@ -511,6 +511,6 @@ register char *s;
|
|||||||
{
|
{
|
||||||
register char *lp;
|
register char *lp;
|
||||||
|
|
||||||
while ((lp = index(s, ':')) || (lp = index(s, '/')))
|
while ((lp = strchr(s, ':')) || (lp = strchr(s, '/')))
|
||||||
*lp = '_';
|
*lp = '_';
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -476,7 +476,7 @@ amii_player_selection()
|
|||||||
#if 0 /* OBSOLETE */
|
#if 0 /* OBSOLETE */
|
||||||
if( *g.pl_character ){
|
if( *g.pl_character ){
|
||||||
g.pl_character[ 0 ] = toupper( g.pl_character[ 0 ] );
|
g.pl_character[ 0 ] = toupper( g.pl_character[ 0 ] );
|
||||||
if( index( pl_classes, g.pl_character[ 0 ] ) )
|
if( strchr( pl_classes, g.pl_character[ 0 ] ) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -528,7 +528,7 @@ amii_player_selection()
|
|||||||
switch( class )
|
switch( class )
|
||||||
{
|
{
|
||||||
case VANILLAKEY:
|
case VANILLAKEY:
|
||||||
if( index( pl_classes, toupper( code ) ) )
|
if( strchr( pl_classes, toupper( code ) ) )
|
||||||
{
|
{
|
||||||
g.pl_character[0] = toupper( code );
|
g.pl_character[0] = toupper( code );
|
||||||
aredone = 1;
|
aredone = 1;
|
||||||
@@ -1016,10 +1016,10 @@ char def;
|
|||||||
if (resp) {
|
if (resp) {
|
||||||
char *rb, respbuf[QBUFSZ];
|
char *rb, respbuf[QBUFSZ];
|
||||||
|
|
||||||
allow_num = (index(resp, '#') != 0);
|
allow_num = (strchr(resp, '#') != 0);
|
||||||
Strcpy(respbuf, resp);
|
Strcpy(respbuf, resp);
|
||||||
/* any acceptable responses that follow <esc> aren't displayed */
|
/* any acceptable responses that follow <esc> aren't displayed */
|
||||||
if ((rb = index(respbuf, '\033')) != 0)
|
if ((rb = strchr(respbuf, '\033')) != 0)
|
||||||
*rb = '\0';
|
*rb = '\0';
|
||||||
(void) strncpy(prompt, query, QBUFSZ - 1);
|
(void) strncpy(prompt, query, QBUFSZ - 1);
|
||||||
prompt[QBUFSZ - 1] = '\0';
|
prompt[QBUFSZ - 1] = '\0';
|
||||||
@@ -1062,18 +1062,18 @@ char def;
|
|||||||
#endif /*0*/
|
#endif /*0*/
|
||||||
digit_ok = allow_num && isdigit(q);
|
digit_ok = allow_num && isdigit(q);
|
||||||
if (q == '\033') {
|
if (q == '\033') {
|
||||||
if (index(resp, 'q'))
|
if (strchr(resp, 'q'))
|
||||||
q = 'q';
|
q = 'q';
|
||||||
else if (index(resp, 'n'))
|
else if (strchr(resp, 'n'))
|
||||||
q = 'n';
|
q = 'n';
|
||||||
else
|
else
|
||||||
q = def;
|
q = def;
|
||||||
break;
|
break;
|
||||||
} else if (index(quitchars, q)) {
|
} else if (strchr(quitchars, q)) {
|
||||||
q = def;
|
q = def;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!index(resp, q) && !digit_ok) {
|
if (!strchr(resp, q) && !digit_ok) {
|
||||||
amii_bell();
|
amii_bell();
|
||||||
q = (char) 0;
|
q = (char) 0;
|
||||||
} else if (q == '#' || digit_ok) {
|
} else if (q == '#' || digit_ok) {
|
||||||
@@ -1099,7 +1099,7 @@ char def;
|
|||||||
break; /* overflow: try again */
|
break; /* overflow: try again */
|
||||||
digit_string[0] = z;
|
digit_string[0] = z;
|
||||||
amii_addtopl(digit_string), n_len++;
|
amii_addtopl(digit_string), n_len++;
|
||||||
} else if (z == 'y' || index(quitchars, z)) {
|
} else if (z == 'y' || strchr(quitchars, z)) {
|
||||||
if (z == '\033')
|
if (z == '\033')
|
||||||
value = -1; /* abort */
|
value = -1; /* abort */
|
||||||
z = '\n'; /* break */
|
z = '\n'; /* break */
|
||||||
@@ -1176,7 +1176,7 @@ boolean complain;
|
|||||||
cw->morestr = (char *) fn;
|
cw->morestr = (char *) fn;
|
||||||
|
|
||||||
while (dlb_fgets(buf, sizeof(buf), fp) != NULL) {
|
while (dlb_fgets(buf, sizeof(buf), fp) != NULL) {
|
||||||
if (t = index(buf, '\n'))
|
if (t = strchr(buf, '\n'))
|
||||||
*t = 0;
|
*t = 0;
|
||||||
amii_putstr(win, 0, buf);
|
amii_putstr(win, 0, buf);
|
||||||
}
|
}
|
||||||
@@ -1362,9 +1362,9 @@ amii_player_selection()
|
|||||||
cursor_on(WIN_MESSAGE);
|
cursor_on(WIN_MESSAGE);
|
||||||
pick4u = lowc(WindowGetchar());
|
pick4u = lowc(WindowGetchar());
|
||||||
cursor_off(WIN_MESSAGE);
|
cursor_off(WIN_MESSAGE);
|
||||||
if (index(quitchars, pick4u))
|
if (strchr(quitchars, pick4u))
|
||||||
pick4u = 'y';
|
pick4u = 'y';
|
||||||
} while (!index(ynqchars, pick4u));
|
} while (!strchr(ynqchars, pick4u));
|
||||||
pbuf[0] = pick4u;
|
pbuf[0] = pick4u;
|
||||||
pbuf[1] = 0;
|
pbuf[1] = 0;
|
||||||
amii_addtopl(pbuf);
|
amii_addtopl(pbuf);
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ char *str;
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
char drive;
|
char drive;
|
||||||
|
|
||||||
if ((ptr = index(str, ':')) != (char *) 0) {
|
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
||||||
drive = toupper(*(ptr - 1));
|
drive = toupper(*(ptr - 1));
|
||||||
(void) Dsetdrv(drive - 'A');
|
(void) Dsetdrv(drive - 'A');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ error VA_DECL(const char *, line)
|
|||||||
{ /* opening brace for vprogerror(), nested block for USE_OLDARG error() */
|
{ /* opening brace for vprogerror(), nested block for USE_OLDARG error() */
|
||||||
char pbuf[BUFSZ];
|
char pbuf[BUFSZ];
|
||||||
|
|
||||||
if(index(line, '%')) {
|
if(strchr(line, '%')) {
|
||||||
Vsprintf(pbuf,line,VA_ARGS);
|
Vsprintf(pbuf,line,VA_ARGS);
|
||||||
line = pbuf;
|
line = pbuf;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ char *str;
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
char drive;
|
char drive;
|
||||||
|
|
||||||
if ((ptr = index(str, ':')) != (char *) 0) {
|
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
||||||
drive = toupper(*(ptr - 1));
|
drive = toupper(*(ptr - 1));
|
||||||
#ifdef OS2_32BITAPI
|
#ifdef OS2_32BITAPI
|
||||||
DosSetDefaultDisk((ULONG)(drive - 'A' + 1));
|
DosSetDefaultDisk((ULONG)(drive - 'A' + 1));
|
||||||
|
|||||||
@@ -193,22 +193,22 @@ mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
red_value =
|
red_value =
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
red_value *= 16;
|
red_value *= 16;
|
||||||
red_value +=
|
red_value +=
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
|
|
||||||
green_value =
|
green_value =
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
green_value *= 16;
|
green_value *= 16;
|
||||||
green_value +=
|
green_value +=
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
|
|
||||||
blue_value =
|
blue_value =
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
blue_value *= 16;
|
blue_value *= 16;
|
||||||
blue_value +=
|
blue_value +=
|
||||||
index(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
strchr(hexadecimals, tolower(*colorstring++)) - hexadecimals;
|
||||||
|
|
||||||
*colorptr = RGB(red_value, blue_value, green_value);
|
*colorptr = RGB(red_value, blue_value, green_value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -316,9 +316,9 @@ prompt_for_player_selection(void)
|
|||||||
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
||||||
do {
|
do {
|
||||||
/* pick4u = lowc(readchar()); */
|
/* pick4u = lowc(readchar()); */
|
||||||
if (index(quitchars, pick4u))
|
if (strchr(quitchars, pick4u))
|
||||||
pick4u = 'y';
|
pick4u = 'y';
|
||||||
} while (!index(ynqchars, pick4u));
|
} while (!strchr(ynqchars, pick4u));
|
||||||
if ((int) strlen(prompt) + 1 < CO) {
|
if ((int) strlen(prompt) + 1 < CO) {
|
||||||
/* Echo choice and move back down line */
|
/* Echo choice and move back down line */
|
||||||
/* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
|
/* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
|
||||||
@@ -1377,7 +1377,7 @@ mswin_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
if (choices) {
|
if (choices) {
|
||||||
char *cb, choicebuf[QBUFSZ];
|
char *cb, choicebuf[QBUFSZ];
|
||||||
Strcpy(choicebuf, choices);
|
Strcpy(choicebuf, choices);
|
||||||
if ((cb = index(choicebuf, '\033')) != 0) {
|
if ((cb = strchr(choicebuf, '\033')) != 0) {
|
||||||
/* anything beyond <esc> is hidden */
|
/* anything beyond <esc> is hidden */
|
||||||
*cb = '\0';
|
*cb = '\0';
|
||||||
}
|
}
|
||||||
@@ -1389,7 +1389,7 @@ mswin_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
Strcat(message, " ");
|
Strcat(message, " ");
|
||||||
/* escape maps to 'q' or 'n' or default, in that order */
|
/* escape maps to 'q' or 'n' or default, in that order */
|
||||||
yn_esc_map =
|
yn_esc_map =
|
||||||
(index(choices, 'q') ? 'q' : (index(choices, 'n') ? 'n' : def));
|
(strchr(choices, 'q') ? 'q' : (strchr(choices, 'n') ? 'n' : def));
|
||||||
} else {
|
} else {
|
||||||
Strcpy(message, question);
|
Strcpy(message, question);
|
||||||
}
|
}
|
||||||
@@ -1399,7 +1399,7 @@ mswin_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
ZeroMemory(buf, sizeof(buf));
|
ZeroMemory(buf, sizeof(buf));
|
||||||
if (choices) {
|
if (choices) {
|
||||||
if (!index(choices, '\033'))
|
if (!strchr(choices, '\033'))
|
||||||
buf[0] = '\033'; /* make sure ESC is always available */
|
buf[0] = '\033'; /* make sure ESC is always available */
|
||||||
strncat(buf, choices, sizeof(buf) - 2);
|
strncat(buf, choices, sizeof(buf) - 2);
|
||||||
NHSPhoneSetKeypadFromString(buf);
|
NHSPhoneSetKeypadFromString(buf);
|
||||||
@@ -1431,7 +1431,7 @@ mswin_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
ch = mswin_nhgetch();
|
ch = mswin_nhgetch();
|
||||||
if (ch == '\033') {
|
if (ch == '\033') {
|
||||||
result = yn_esc_map;
|
result = yn_esc_map;
|
||||||
} else if (choices && !index(choices, ch)) {
|
} else if (choices && !strchr(choices, ch)) {
|
||||||
/* FYI: ch==-115 is for KP_ENTER */
|
/* FYI: ch==-115 is for KP_ENTER */
|
||||||
if (def
|
if (def
|
||||||
&& (ch == ' ' || ch == '\r' || ch == '\n' || ch == -115)) {
|
&& (ch == ' ' || ch == '\r' || ch == '\n' || ch == -115)) {
|
||||||
|
|||||||
@@ -4799,11 +4799,11 @@ void NetHackQtBind::qt_display_file(const char *filename, BOOLEAN_P must_exist)
|
|||||||
complain = must_exist;
|
complain = must_exist;
|
||||||
} else {
|
} else {
|
||||||
while (dlb_fgets(buf, BUFSZ, f)) {
|
while (dlb_fgets(buf, BUFSZ, f)) {
|
||||||
if ((cr = index(buf, '\n')) != 0) *cr = 0;
|
if ((cr = strchr(buf, '\n')) != 0) *cr = 0;
|
||||||
#ifdef MSDOS
|
#ifdef MSDOS
|
||||||
if ((cr = index(buf, '\r')) != 0) *cr = 0;
|
if ((cr = strchr(buf, '\r')) != 0) *cr = 0;
|
||||||
#endif
|
#endif
|
||||||
if (index(buf, '\t') != 0) (void) tabexpand(buf);
|
if (strchr(buf, '\t') != 0) (void) tabexpand(buf);
|
||||||
window->PutStr(ATR_NONE, buf);
|
window->PutStr(ATR_NONE, buf);
|
||||||
}
|
}
|
||||||
window->Display(FALSE);
|
window->Display(FALSE);
|
||||||
@@ -4981,7 +4981,7 @@ char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CH
|
|||||||
if (choices) {
|
if (choices) {
|
||||||
char *cb, choicebuf[QBUFSZ];
|
char *cb, choicebuf[QBUFSZ];
|
||||||
Strcpy(choicebuf, choices);
|
Strcpy(choicebuf, choices);
|
||||||
if ((cb = index(choicebuf, '\033')) != 0) {
|
if ((cb = strchr(choicebuf, '\033')) != 0) {
|
||||||
// anything beyond <esc> is hidden
|
// anything beyond <esc> is hidden
|
||||||
*cb = '\0';
|
*cb = '\0';
|
||||||
}
|
}
|
||||||
@@ -4991,8 +4991,8 @@ char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CH
|
|||||||
if (def) Sprintf(eos(message), " (%c)", def);
|
if (def) Sprintf(eos(message), " (%c)", def);
|
||||||
Strcat(message, " ");
|
Strcat(message, " ");
|
||||||
// escape maps to 'q' or 'n' or default, in that order
|
// escape maps to 'q' or 'n' or default, in that order
|
||||||
yn_esc_map = (index(choices, 'q') ? 'q' :
|
yn_esc_map = (strchr(choices, 'q') ? 'q' :
|
||||||
(index(choices, 'n') ? 'n' : def));
|
(strchr(choices, 'n') ? 'n' : def));
|
||||||
} else {
|
} else {
|
||||||
Strcpy(message, question);
|
Strcpy(message, question);
|
||||||
}
|
}
|
||||||
@@ -5024,7 +5024,7 @@ char NetHackQtBind::qt_yn_function(const char *question, const char *choices, CH
|
|||||||
char ch=NetHackQtBind::qt_nhgetch();
|
char ch=NetHackQtBind::qt_nhgetch();
|
||||||
if (ch=='\033') {
|
if (ch=='\033') {
|
||||||
result=yn_esc_map;
|
result=yn_esc_map;
|
||||||
} else if (choices && !index(choices,ch)) {
|
} else if (choices && !strchr(choices,ch)) {
|
||||||
if (def && (ch==' ' || ch=='\r' || ch=='\n')) {
|
if (def && (ch==' ' || ch=='\r' || ch=='\n')) {
|
||||||
result=def;
|
result=def;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -736,9 +736,9 @@ boolean complain;
|
|||||||
|
|
||||||
datawin = Gem_create_nhwindow(NHW_TEXT);
|
datawin = Gem_create_nhwindow(NHW_TEXT);
|
||||||
while (dlb_fgets(buf, BUFSZ, f)) {
|
while (dlb_fgets(buf, BUFSZ, f)) {
|
||||||
if ((cr = index(buf, '\n')) != 0)
|
if ((cr = strchr(buf, '\n')) != 0)
|
||||||
*cr = 0;
|
*cr = 0;
|
||||||
if (index(buf, '\t') != 0)
|
if (strchr(buf, '\t') != 0)
|
||||||
(void) tabexpand(buf);
|
(void) tabexpand(buf);
|
||||||
Gem_putstr(datawin, 0, buf);
|
Gem_putstr(datawin, 0, buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1032,7 +1032,7 @@ gnome_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
if (choices) {
|
if (choices) {
|
||||||
char *cb, choicebuf[QBUFSZ];
|
char *cb, choicebuf[QBUFSZ];
|
||||||
Strcpy(choicebuf, choices);
|
Strcpy(choicebuf, choices);
|
||||||
if ((cb = index(choicebuf, '\033')) != 0) {
|
if ((cb = strchr(choicebuf, '\033')) != 0) {
|
||||||
/* anything beyond <esc> is hidden */
|
/* anything beyond <esc> is hidden */
|
||||||
*cb = '\0';
|
*cb = '\0';
|
||||||
}
|
}
|
||||||
@@ -1044,13 +1044,13 @@ gnome_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
Strcat(message, " ");
|
Strcat(message, " ");
|
||||||
/* escape maps to 'q' or 'n' or default, in that order */
|
/* escape maps to 'q' or 'n' or default, in that order */
|
||||||
yn_esc_map =
|
yn_esc_map =
|
||||||
(index(choices, 'q') ? 'q' : (index(choices, 'n') ? 'n' : def));
|
(strchr(choices, 'q') ? 'q' : (strchr(choices, 'n') ? 'n' : def));
|
||||||
} else {
|
} else {
|
||||||
Strcpy(message, question);
|
Strcpy(message, question);
|
||||||
}
|
}
|
||||||
|
|
||||||
gnome_putstr(WIN_MESSAGE, ATR_BOLD, message);
|
gnome_putstr(WIN_MESSAGE, ATR_BOLD, message);
|
||||||
if (mainWnd != NULL && choices && !index(choices, ch)) {
|
if (mainWnd != NULL && choices && !strchr(choices, ch)) {
|
||||||
return (ghack_yes_no_dialog(question, choices, def));
|
return (ghack_yes_no_dialog(question, choices, def));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1059,7 +1059,7 @@ gnome_yn_function(const char *question, const char *choices, CHAR_P def)
|
|||||||
ch = gnome_nhgetch();
|
ch = gnome_nhgetch();
|
||||||
if (ch == '\033') {
|
if (ch == '\033') {
|
||||||
result = yn_esc_map;
|
result = yn_esc_map;
|
||||||
} else if (choices && !index(choices, ch)) {
|
} else if (choices && !strchr(choices, ch)) {
|
||||||
/* FYI: ch==-115 is for KP_ENTER */
|
/* FYI: ch==-115 is for KP_ENTER */
|
||||||
if (def
|
if (def
|
||||||
&& (ch == ' ' || ch == '\r' || ch == '\n' || ch == -115)) {
|
&& (ch == ' ' || ch == '\r' || ch == '\n' || ch == -115)) {
|
||||||
|
|||||||
+3
-3
@@ -894,10 +894,10 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
const char *extended_opt = index(userea, ':');
|
const char *extended_opt = strchr(userea, ':');
|
||||||
|
|
||||||
if (!extended_opt)
|
if (!extended_opt)
|
||||||
extended_opt = index(userea, '=');
|
extended_opt = strchr(userea, '=');
|
||||||
switch(e_arg) {
|
switch(e_arg) {
|
||||||
case ARG_DEBUG:
|
case ARG_DEBUG:
|
||||||
if (extended_opt) {
|
if (extended_opt) {
|
||||||
@@ -970,7 +970,7 @@ debug_fields(const char *opts)
|
|||||||
char *op;
|
char *op;
|
||||||
boolean negated = FALSE;
|
boolean negated = FALSE;
|
||||||
|
|
||||||
while ((op = index(opts, ',')) != 0) {
|
while ((op = strchr(opts, ',')) != 0) {
|
||||||
*op++ = 0;
|
*op++ = 0;
|
||||||
/* recurse */
|
/* recurse */
|
||||||
debug_fields(op);
|
debug_fields(op);
|
||||||
|
|||||||
+3
-3
@@ -2257,7 +2257,7 @@ has_ltgt_percentnumber(const char *str)
|
|||||||
const char *s = str;
|
const char *s = str;
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
if (!index("<>=-+0123456789%", *s))
|
if (!strchr("<>=-+0123456789%", *s))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
s++;
|
s++;
|
||||||
}
|
}
|
||||||
@@ -2282,7 +2282,7 @@ splitsubfields(char *str, char ***sfarr, int maxsf)
|
|||||||
|
|
||||||
maxsf = (maxsf == 0) ? MAX_SUBFIELDS : min(maxsf, MAX_SUBFIELDS);
|
maxsf = (maxsf == 0) ? MAX_SUBFIELDS : min(maxsf, MAX_SUBFIELDS);
|
||||||
|
|
||||||
if (index(str, '+') || index(str, '&')) {
|
if (strchr(str, '+') || strchr(str, '&')) {
|
||||||
char *c = str;
|
char *c = str;
|
||||||
|
|
||||||
sf = 0;
|
sf = 0;
|
||||||
@@ -3580,7 +3580,7 @@ status_hilite_menu_add(int origfld)
|
|||||||
goto choose_value;
|
goto choose_value;
|
||||||
}
|
}
|
||||||
/* restore suffix for use in color and attribute prompts */
|
/* restore suffix for use in color and attribute prompts */
|
||||||
if (!index(numstart, '%'))
|
if (!strchr(numstart, '%'))
|
||||||
Strcat(numstart, "%");
|
Strcat(numstart, "%");
|
||||||
|
|
||||||
/* reject negative values except for AC and >-1; reject 0 for < */
|
/* reject negative values except for AC and >-1; reject 0 for < */
|
||||||
|
|||||||
@@ -1431,7 +1431,7 @@ wiz_flip_level(void)
|
|||||||
if (wizard) {
|
if (wizard) {
|
||||||
char c = yn_function(prmpt, choices, '\0', TRUE);
|
char c = yn_function(prmpt, choices, '\0', TRUE);
|
||||||
|
|
||||||
if (c && index(choices, c)) {
|
if (c && strchr(choices, c)) {
|
||||||
c -= '0';
|
c -= '0';
|
||||||
|
|
||||||
if (!c)
|
if (!c)
|
||||||
@@ -4451,8 +4451,8 @@ parseautocomplete(char *autocomplete, boolean condition)
|
|||||||
register char *autoc;
|
register char *autoc;
|
||||||
|
|
||||||
/* break off first autocomplete from the rest; parse the rest */
|
/* break off first autocomplete from the rest; parse the rest */
|
||||||
if ((autoc = index(autocomplete, ',')) != 0
|
if ((autoc = strchr(autocomplete, ',')) != 0
|
||||||
|| (autoc = index(autocomplete, ':')) != 0) {
|
|| (autoc = strchr(autocomplete, ':')) != 0) {
|
||||||
*autoc++ = '\0';
|
*autoc++ = '\0';
|
||||||
parseautocomplete(autoc, condition);
|
parseautocomplete(autoc, condition);
|
||||||
}
|
}
|
||||||
@@ -5228,7 +5228,7 @@ getdir(const char *s)
|
|||||||
} else if (!(is_mov = movecmd(dirsym, MV_ANY)) && !u.dz) {
|
} else if (!(is_mov = movecmd(dirsym, MV_ANY)) && !u.dz) {
|
||||||
boolean did_help = FALSE, help_requested;
|
boolean did_help = FALSE, help_requested;
|
||||||
|
|
||||||
if (!index(quitchars, dirsym)) {
|
if (!strchr(quitchars, dirsym)) {
|
||||||
help_requested = (dirsym == g.Cmd.spkeys[NHKF_GETDIR_HELP]);
|
help_requested = (dirsym == g.Cmd.spkeys[NHKF_GETDIR_HELP]);
|
||||||
if (help_requested || iflags.cmdassist) {
|
if (help_requested || iflags.cmdassist) {
|
||||||
did_help = help_dir((s && *s == '^') ? dirsym : '\0',
|
did_help = help_dir((s && *s == '^') ? dirsym : '\0',
|
||||||
@@ -5378,9 +5378,9 @@ help_dir(
|
|||||||
sym = highc(sym); /* @A-Z[ (note: letter() accepts '@') */
|
sym = highc(sym); /* @A-Z[ (note: letter() accepts '@') */
|
||||||
ctrl = (sym - 'A') + 1; /* 0-27 (note: 28-31 aren't applicable) */
|
ctrl = (sym - 'A') + 1; /* 0-27 (note: 28-31 aren't applicable) */
|
||||||
if ((explain = dowhatdoes_core(ctrl, buf2)) != 0
|
if ((explain = dowhatdoes_core(ctrl, buf2)) != 0
|
||||||
&& (!index(wiz_only_list, sym) || wizard)) {
|
&& (!strchr(wiz_only_list, sym) || wizard)) {
|
||||||
Sprintf(buf, "Are you trying to use ^%c%s?", sym,
|
Sprintf(buf, "Are you trying to use ^%c%s?", sym,
|
||||||
index(wiz_only_list, sym) ? ""
|
strchr(wiz_only_list, sym) ? ""
|
||||||
: " as specified in the Guidebook");
|
: " as specified in the Guidebook");
|
||||||
putstr(win, 0, buf);
|
putstr(win, 0, buf);
|
||||||
putstr(win, 0, "");
|
putstr(win, 0, "");
|
||||||
@@ -6186,7 +6186,7 @@ get_count(
|
|||||||
backspaced = TRUE;
|
backspaced = TRUE;
|
||||||
} else if (key == g.Cmd.spkeys[NHKF_ESC]) {
|
} else if (key == g.Cmd.spkeys[NHKF_ESC]) {
|
||||||
break;
|
break;
|
||||||
} else if (!allowchars || index(allowchars, key)) {
|
} else if (!allowchars || strchr(allowchars, key)) {
|
||||||
*count = (cmdcount_nht) cnt;
|
*count = (cmdcount_nht) cnt;
|
||||||
if ((long) *count != cnt)
|
if ((long) *count != cnt)
|
||||||
impossible("get_count: cmdcount_nht");
|
impossible("get_count: cmdcount_nht");
|
||||||
|
|||||||
+1
-1
@@ -1255,7 +1255,7 @@ use_crystal_ball(struct obj **optr)
|
|||||||
You("may look for an object, monster, or special map symbol.");
|
You("may look for an object, monster, or special map symbol.");
|
||||||
ch = yn_function("What do you look for?", (char *) 0, '\0', TRUE);
|
ch = yn_function("What do you look for?", (char *) 0, '\0', TRUE);
|
||||||
/* Don't filter out ' ' here; it has a use */
|
/* Don't filter out ' ' here; it has a use */
|
||||||
if ((ch != def_monsyms[S_GHOST].sym) && index(quitchars, ch)) {
|
if ((ch != def_monsyms[S_GHOST].sym) && strchr(quitchars, ch)) {
|
||||||
if (Verbose(0, use_crystal_ball2))
|
if (Verbose(0, use_crystal_ball2))
|
||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ lib_dlb_fgets(char *buf, int len, dlb *dp)
|
|||||||
*bp = '\0';
|
*bp = '\0';
|
||||||
|
|
||||||
#if defined(MSDOS) || defined(WIN32)
|
#if defined(MSDOS) || defined(WIN32)
|
||||||
if ((bp = index(buf, '\r')) != 0) {
|
if ((bp = strchr(buf, '\r')) != 0) {
|
||||||
*bp++ = '\n';
|
*bp++ = '\n';
|
||||||
*bp = '\0';
|
*bp = '\0';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1724,7 +1724,7 @@ goto_level(
|
|||||||
mesg = halu_fam_msgs[which];
|
mesg = halu_fam_msgs[which];
|
||||||
else
|
else
|
||||||
mesg = fam_msgs[which];
|
mesg = fam_msgs[which];
|
||||||
if (mesg && index(mesg, '%')) {
|
if (mesg && strchr(mesg, '%')) {
|
||||||
Sprintf(buf, mesg, !Blind ? "looks" : "seems");
|
Sprintf(buf, mesg, !Blind ? "looks" : "seems");
|
||||||
mesg = buf;
|
mesg = buf;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -816,7 +816,7 @@ getpos(coord *ccp, boolean force, const char *goal)
|
|||||||
cy = ty;
|
cy = ty;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((cp = index(pick_chars, c)) != 0) {
|
if ((cp = strchr(pick_chars, c)) != 0) {
|
||||||
/* '.' => 0, ',' => 1, ';' => 2, ':' => 3 */
|
/* '.' => 0, ',' => 1, ';' => 2, ':' => 3 */
|
||||||
result = pick_chars_def[(int) (cp - pick_chars)].ret;
|
result = pick_chars_def[(int) (cp - pick_chars)].ret;
|
||||||
break;
|
break;
|
||||||
@@ -916,7 +916,7 @@ getpos(coord *ccp, boolean force, const char *goal)
|
|||||||
iflags.getloc_moveskip ? "S" : "Not s");
|
iflags.getloc_moveskip ? "S" : "Not s");
|
||||||
msg_given = TRUE;
|
msg_given = TRUE;
|
||||||
goto nxtc;
|
goto nxtc;
|
||||||
} else if ((cp = index(mMoOdDxX, c)) != 0) { /* 'm|M', 'o|O', &c */
|
} else if ((cp = strchr(mMoOdDxX, c)) != 0) { /* 'm|M', 'o|O', &c */
|
||||||
/* nearest or farthest monster or object or door or unexplored */
|
/* nearest or farthest monster or object or door or unexplored */
|
||||||
int gtmp = (int) (cp - mMoOdDxX), /* 0..7 */
|
int gtmp = (int) (cp - mMoOdDxX), /* 0..7 */
|
||||||
gloc = gtmp >> 1; /* 0..3 */
|
gloc = gtmp >> 1; /* 0..3 */
|
||||||
@@ -945,7 +945,7 @@ getpos(coord *ccp, boolean force, const char *goal)
|
|||||||
cy = garr[gloc][gidx[gloc]].y;
|
cy = garr[gloc][gidx[gloc]].y;
|
||||||
goto nxtc;
|
goto nxtc;
|
||||||
} else {
|
} else {
|
||||||
if (!index(quitchars, c)) {
|
if (!strchr(quitchars, c)) {
|
||||||
char matching[MAXPCHARS];
|
char matching[MAXPCHARS];
|
||||||
int pass, lo_x, lo_y, hi_x, hi_y, k = 0;
|
int pass, lo_x, lo_y, hi_x, hi_y, k = 0;
|
||||||
|
|
||||||
@@ -2322,7 +2322,7 @@ bogusmon(char *buf, char *code)
|
|||||||
get_rnd_text(BOGUSMONFILE, buf, rn2_on_display_rng, MD_PAD_BOGONS);
|
get_rnd_text(BOGUSMONFILE, buf, rn2_on_display_rng, MD_PAD_BOGONS);
|
||||||
if (!*mnam) {
|
if (!*mnam) {
|
||||||
Strcpy(buf, "bogon");
|
Strcpy(buf, "bogon");
|
||||||
} else if (index(bogon_codes, *mnam)) { /* strip prefix if present */
|
} else if (strchr(bogon_codes, *mnam)) { /* strip prefix if present */
|
||||||
if (code)
|
if (code)
|
||||||
*code = *mnam;
|
*code = *mnam;
|
||||||
++mnam;
|
++mnam;
|
||||||
@@ -2362,7 +2362,7 @@ bogon_is_pname(char code)
|
|||||||
{
|
{
|
||||||
if (!code)
|
if (!code)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
return index("-+=", code) ? TRUE : FALSE;
|
return strchr("-+=", code) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* name of a Rogue player */
|
/* name of a Rogue player */
|
||||||
@@ -2375,7 +2375,7 @@ roguename(void)
|
|||||||
for (i = opts; *i; i++)
|
for (i = opts; *i; i++)
|
||||||
if (!strncmp("name=", i, 5)) {
|
if (!strncmp("name=", i, 5)) {
|
||||||
char *j;
|
char *j;
|
||||||
if ((j = index(i + 5, ',')) != 0)
|
if ((j = strchr(i + 5, ',')) != 0)
|
||||||
*j = (char) 0;
|
*j = (char) 0;
|
||||||
return i + 5;
|
return i + 5;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -459,7 +459,7 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((obj = g.level.objects[omx][omy]) != 0
|
if ((obj = g.level.objects[omx][omy]) != 0
|
||||||
&& !index(nofetch, obj->oclass)
|
&& !strchr(nofetch, obj->oclass)
|
||||||
#ifdef MAIL_STRUCTURES
|
#ifdef MAIL_STRUCTURES
|
||||||
&& obj->otyp != SCR_MAIL
|
&& obj->otyp != SCR_MAIL
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-3
@@ -598,7 +598,7 @@ really_kick_object(coordxy x, coordxy y)
|
|||||||
obj_extract_self(g.kickedobj);
|
obj_extract_self(g.kickedobj);
|
||||||
newsym(x, y);
|
newsym(x, y);
|
||||||
if (costly && (!costly_spot(u.ux, u.uy)
|
if (costly && (!costly_spot(u.ux, u.uy)
|
||||||
|| !index(u.urooms, *in_rooms(x, y, SHOPBASE))))
|
|| !strchr(u.urooms, *in_rooms(x, y, SHOPBASE))))
|
||||||
addtobill(g.kickedobj, FALSE, FALSE, FALSE);
|
addtobill(g.kickedobj, FALSE, FALSE, FALSE);
|
||||||
if (!flooreffects(g.kickedobj, u.ux, u.uy, "fall")) {
|
if (!flooreffects(g.kickedobj, u.ux, u.uy, "fall")) {
|
||||||
place_object(g.kickedobj, u.ux, u.uy);
|
place_object(g.kickedobj, u.ux, u.uy);
|
||||||
@@ -1501,7 +1501,7 @@ impact_drop(
|
|||||||
if (costly) {
|
if (costly) {
|
||||||
price += stolen_value(obj, x, y,
|
price += stolen_value(obj, x, y,
|
||||||
(costly_spot(u.ux, u.uy)
|
(costly_spot(u.ux, u.uy)
|
||||||
&& index(u.urooms,
|
&& strchr(u.urooms,
|
||||||
*in_rooms(x, y, SHOPBASE))),
|
*in_rooms(x, y, SHOPBASE))),
|
||||||
TRUE);
|
TRUE);
|
||||||
/* set obj->no_charge to 0 */
|
/* set obj->no_charge to 0 */
|
||||||
@@ -1629,7 +1629,7 @@ ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj)
|
|||||||
(void) stolen_value(
|
(void) stolen_value(
|
||||||
otmp, ox, oy,
|
otmp, ox, oy,
|
||||||
(costly_spot(u.ux, u.uy)
|
(costly_spot(u.ux, u.uy)
|
||||||
&& index(u.urooms, *in_rooms(ox, oy, SHOPBASE))),
|
&& strchr(u.urooms, *in_rooms(ox, oy, SHOPBASE))),
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
/* set otmp->no_charge to 0 */
|
/* set otmp->no_charge to 0 */
|
||||||
|
|||||||
+1
-1
@@ -1599,7 +1599,7 @@ throwit(struct obj *obj,
|
|||||||
/* [perhaps this should be moved into thitmonst or hmon] */
|
/* [perhaps this should be moved into thitmonst or hmon] */
|
||||||
if (mon && mon->isshk
|
if (mon && mon->isshk
|
||||||
&& (!inside_shop(u.ux, u.uy)
|
&& (!inside_shop(u.ux, u.uy)
|
||||||
|| !index(in_rooms(mon->mx, mon->my, SHOPBASE), *u.ushops)))
|
|| !strchr(in_rooms(mon->mx, mon->my, SHOPBASE), *u.ushops)))
|
||||||
hot_pursuit(mon);
|
hot_pursuit(mon);
|
||||||
|
|
||||||
if (obj_gone)
|
if (obj_gone)
|
||||||
|
|||||||
+1
-1
@@ -3153,7 +3153,7 @@ seen_string(xint16 x, const char *obj)
|
|||||||
return "no";
|
return "no";
|
||||||
/* an() returns too much. index is ok in this case */
|
/* an() returns too much. index is ok in this case */
|
||||||
case 1:
|
case 1:
|
||||||
return index(vowels, *obj) ? "an" : "a";
|
return strchr(vowels, *obj) ? "an" : "a";
|
||||||
case 2:
|
case 2:
|
||||||
return "some";
|
return "some";
|
||||||
case 3:
|
case 3:
|
||||||
|
|||||||
@@ -517,7 +517,7 @@ done_in_by(struct monst *mtmp, int how)
|
|||||||
*/
|
*/
|
||||||
if (sscanf(g.multireasonbuf, "%u:%c", &reasonmid, &reasondummy) == 2
|
if (sscanf(g.multireasonbuf, "%u:%c", &reasonmid, &reasondummy) == 2
|
||||||
&& mtmp->m_id == reasonmid) {
|
&& mtmp->m_id == reasonmid) {
|
||||||
if ((p = index(g.multireasonbuf, ' ')) != 0)
|
if ((p = strchr(g.multireasonbuf, ' ')) != 0)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -686,7 +686,7 @@ should_query_disclose_option(int category, char *defquery)
|
|||||||
char disclose, *dop;
|
char disclose, *dop;
|
||||||
|
|
||||||
*defquery = 'n';
|
*defquery = 'n';
|
||||||
if ((dop = index(disclosure_options, category)) != 0) {
|
if ((dop = strchr(disclosure_options, category)) != 0) {
|
||||||
idx = (int) (dop - disclosure_options);
|
idx = (int) (dop - disclosure_options);
|
||||||
if (idx < 0 || idx >= NUM_DISCLOSURE_OPTIONS) {
|
if (idx < 0 || idx >= NUM_DISCLOSURE_OPTIONS) {
|
||||||
impossible(
|
impossible(
|
||||||
|
|||||||
+3
-3
@@ -108,7 +108,7 @@ wipeout_text(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* rub out unreadable & small punctuation marks */
|
/* rub out unreadable & small punctuation marks */
|
||||||
if (index("?.,'`-|_", *s)) {
|
if (strchr("?.,'`-|_", *s)) {
|
||||||
*s = ' ';
|
*s = ' ';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1073,7 +1073,7 @@ doengrave(void)
|
|||||||
if (*sp == ' ')
|
if (*sp == ' ')
|
||||||
len -= 1;
|
len -= 1;
|
||||||
|
|
||||||
if (len == 0 || index(ebuf, '\033')) {
|
if (len == 0 || strchr(ebuf, '\033')) {
|
||||||
if (zapwand) {
|
if (zapwand) {
|
||||||
if (!Blind)
|
if (!Blind)
|
||||||
pline("%s, then %s.", Tobjnam(otmp, "glow"),
|
pline("%s, then %s.", Tobjnam(otmp, "glow"),
|
||||||
@@ -1086,7 +1086,7 @@ doengrave(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* A single `x' is the traditional signature of an illiterate person */
|
/* A single `x' is the traditional signature of an illiterate person */
|
||||||
if (len != 1 || (!index(ebuf, 'x') && !index(ebuf, 'X')))
|
if (len != 1 || (!strchr(ebuf, 'x') && !strchr(ebuf, 'X')))
|
||||||
if (!u.uconduct.literate++)
|
if (!u.uconduct.literate++)
|
||||||
livelog_printf(LL_CONDUCT, "became literate by engraving \"%s\"",
|
livelog_printf(LL_CONDUCT, "became literate by engraving \"%s\"",
|
||||||
ebuf);
|
ebuf);
|
||||||
|
|||||||
+1
-1
@@ -881,7 +881,7 @@ scatter(coordxy sx, coordxy sy, /* location of objects to scatter */
|
|||||||
}
|
}
|
||||||
if (!flooreffects(stmp->obj, x, y, "land")) {
|
if (!flooreffects(stmp->obj, x, y, "land")) {
|
||||||
if (obj_left_shop
|
if (obj_left_shop
|
||||||
&& index(u.urooms, *in_rooms(u.ux, u.uy, SHOPBASE))) {
|
&& strchr(u.urooms, *in_rooms(u.ux, u.uy, SHOPBASE))) {
|
||||||
/* At the moment this only takes on gold. While it is
|
/* At the moment this only takes on gold. While it is
|
||||||
simple enough to call addtobill for other items that
|
simple enough to call addtobill for other items that
|
||||||
leave the shop due to scatter(), by default the hero
|
leave the shop due to scatter(), by default the hero
|
||||||
|
|||||||
+19
-19
@@ -219,7 +219,7 @@ fname_encode(
|
|||||||
(void) sprintf(op, "%c%02X", quotechar, *sp);
|
(void) sprintf(op, "%c%02X", quotechar, *sp);
|
||||||
op += 3;
|
op += 3;
|
||||||
cnt += 3;
|
cnt += 3;
|
||||||
} else if ((index(legal, *sp) != 0) || (index(hexdigits, *sp) != 0)) {
|
} else if ((strchr(legal, *sp) != 0) || (strchr(hexdigits, *sp) != 0)) {
|
||||||
*op++ = *sp;
|
*op++ = *sp;
|
||||||
*op = '\0';
|
*op = '\0';
|
||||||
cnt++;
|
cnt++;
|
||||||
@@ -491,7 +491,7 @@ set_levelfile_name(char *file, int lev)
|
|||||||
{
|
{
|
||||||
char *tf;
|
char *tf;
|
||||||
|
|
||||||
tf = rindex(file, '.');
|
tf = strrchr(file, '.');
|
||||||
if (!tf)
|
if (!tf)
|
||||||
tf = eos(file);
|
tf = eos(file);
|
||||||
Sprintf(tf, ".%d", lev);
|
Sprintf(tf, ".%d", lev);
|
||||||
@@ -711,7 +711,7 @@ set_bonestemp_name(void)
|
|||||||
{
|
{
|
||||||
char *tf;
|
char *tf;
|
||||||
|
|
||||||
tf = rindex(g.lock, '.');
|
tf = strrchr(g.lock, '.');
|
||||||
if (!tf)
|
if (!tf)
|
||||||
tf = eos(g.lock);
|
tf = eos(g.lock);
|
||||||
Sprintf(tf, ".bn");
|
Sprintf(tf, ".bn");
|
||||||
@@ -976,7 +976,7 @@ set_error_savefile(void)
|
|||||||
{
|
{
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
{
|
{
|
||||||
char *semi_colon = rindex(g.SAVEF, ';');
|
char *semi_colon = strrchr(g.SAVEF, ';');
|
||||||
|
|
||||||
if (semi_colon)
|
if (semi_colon)
|
||||||
*semi_colon = '\0';
|
*semi_colon = '\0';
|
||||||
@@ -1726,7 +1726,7 @@ make_lockname(const char *filename, char *lockname)
|
|||||||
#endif
|
#endif
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
{
|
{
|
||||||
char *semi_colon = rindex(lockname, ';');
|
char *semi_colon = strrchr(lockname, ';');
|
||||||
if (semi_colon)
|
if (semi_colon)
|
||||||
*semi_colon = '\0';
|
*semi_colon = '\0';
|
||||||
}
|
}
|
||||||
@@ -2123,7 +2123,7 @@ fopen_config_file(const char *filename, int src)
|
|||||||
Strcpy(tmp_config, "NetHack.cnf");
|
Strcpy(tmp_config, "NetHack.cnf");
|
||||||
else
|
else
|
||||||
Sprintf(tmp_config, "%s%s%s", envp,
|
Sprintf(tmp_config, "%s%s%s", envp,
|
||||||
!index(":]>/", envp[strlen(envp) - 1]) ? "/" : "",
|
!strchr(":]>/", envp[strlen(envp) - 1]) ? "/" : "",
|
||||||
"NetHack.cnf");
|
"NetHack.cnf");
|
||||||
set_configfile_name(tmp_config);
|
set_configfile_name(tmp_config);
|
||||||
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
|
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
|
||||||
@@ -2251,7 +2251,7 @@ adjust_prefix(char *bufp, int prefixid)
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
/* Backward compatibility, ignore trailing ;n */
|
/* Backward compatibility, ignore trailing ;n */
|
||||||
if ((ptr = index(bufp, ';')) != 0)
|
if ((ptr = strchr(bufp, ';')) != 0)
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
if (strlen(bufp) > 0) {
|
if (strlen(bufp) > 0) {
|
||||||
g.fqn_prefix[prefixid] = (char *) alloc(strlen(bufp) + 2);
|
g.fqn_prefix[prefixid] = (char *) alloc(strlen(bufp) + 2);
|
||||||
@@ -2329,7 +2329,7 @@ is_config_section(
|
|||||||
if (*a++ != '[')
|
if (*a++ != '[')
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
/* last character should be close bracket, ignoring any comment */
|
/* last character should be close bracket, ignoring any comment */
|
||||||
z = index(a, ']');
|
z = strchr(a, ']');
|
||||||
if (!z)
|
if (!z)
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
/* comment, if present, can be preceded by spaces */
|
/* comment, if present, can be preceded by spaces */
|
||||||
@@ -2385,8 +2385,8 @@ find_optparam(const char *buf)
|
|||||||
{
|
{
|
||||||
char *bufp, *altp;
|
char *bufp, *altp;
|
||||||
|
|
||||||
bufp = index(buf, '=');
|
bufp = strchr(buf, '=');
|
||||||
altp = index(buf, ':');
|
altp = strchr(buf, ':');
|
||||||
if (!bufp || (altp && altp < bufp))
|
if (!bufp || (altp && altp < bufp))
|
||||||
bufp = altp;
|
bufp = altp;
|
||||||
|
|
||||||
@@ -2485,7 +2485,7 @@ parse_config_line(char *origbuf)
|
|||||||
} else if (match_varname(buf, "SAVE", 4)) {
|
} else if (match_varname(buf, "SAVE", 4)) {
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
if ((ptr = index(bufp, ';')) != 0) {
|
if ((ptr = strchr(bufp, ';')) != 0) {
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2991,7 +2991,7 @@ config_erradd(const char *buf)
|
|||||||
/* if buf[] doesn't end in a period, exclamation point, or question mark,
|
/* if buf[] doesn't end in a period, exclamation point, or question mark,
|
||||||
we'll include a period (in the message, not appended to buf[]) */
|
we'll include a period (in the message, not appended to buf[]) */
|
||||||
punct = eos((char *) buf) - 1; /* eos(buf)-1 is valid; cast away const */
|
punct = eos((char *) buf) - 1; /* eos(buf)-1 is valid; cast away const */
|
||||||
punct = index(".!?", *punct) ? "" : ".";
|
punct = strchr(".!?", *punct) ? "" : ".";
|
||||||
|
|
||||||
if (!g.program_state.config_error_ready) {
|
if (!g.program_state.config_error_ready) {
|
||||||
/* either very early, where pline() will use raw_print(), or
|
/* either very early, where pline() will use raw_print(), or
|
||||||
@@ -3130,7 +3130,7 @@ parse_conf_buf(struct _cnf_parser_state *p, boolean (*proc)(char *arg))
|
|||||||
{
|
{
|
||||||
p->cont = FALSE;
|
p->cont = FALSE;
|
||||||
p->pbreak = FALSE;
|
p->pbreak = FALSE;
|
||||||
p->ep = index(p->inbuf, '\n');
|
p->ep = strchr(p->inbuf, '\n');
|
||||||
if (p->skip) { /* in case previous line was too long */
|
if (p->skip) { /* in case previous line was too long */
|
||||||
if (p->ep)
|
if (p->ep)
|
||||||
p->skip = FALSE; /* found newline; next line is normal */
|
p->skip = FALSE; /* found newline; next line is normal */
|
||||||
@@ -3713,7 +3713,7 @@ testinglog(const char *filenm, /* ad hoc file name */
|
|||||||
if (!filenm)
|
if (!filenm)
|
||||||
return;
|
return;
|
||||||
Strcpy(fnbuf, filenm);
|
Strcpy(fnbuf, filenm);
|
||||||
if (index(fnbuf, '.') == 0)
|
if (strchr(fnbuf, '.') == 0)
|
||||||
Strcat(fnbuf, ".log");
|
Strcat(fnbuf, ".log");
|
||||||
lfile = fopen_datafile(fnbuf, "a", TROUBLEPREFIX);
|
lfile = fopen_datafile(fnbuf, "a", TROUBLEPREFIX);
|
||||||
if (lfile) {
|
if (lfile) {
|
||||||
@@ -4021,7 +4021,7 @@ debugcore(const char *filename, boolean wildcards)
|
|||||||
|
|
||||||
/* strip filename's path if present */
|
/* strip filename's path if present */
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
if ((p = rindex(filename, '/')) != 0)
|
if ((p = strrchr(filename, '/')) != 0)
|
||||||
filename = p + 1;
|
filename = p + 1;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
@@ -4402,10 +4402,10 @@ read_tribute(const char *tribsection, const char *tribtitle,
|
|||||||
char *st = &line[7]; /* 7 from "%title " */
|
char *st = &line[7]; /* 7 from "%title " */
|
||||||
char *p1, *p2;
|
char *p1, *p2;
|
||||||
|
|
||||||
if ((p1 = index(st, '(')) != 0) {
|
if ((p1 = strchr(st, '(')) != 0) {
|
||||||
*p1++ = '\0';
|
*p1++ = '\0';
|
||||||
(void) mungspaces(st);
|
(void) mungspaces(st);
|
||||||
if ((p2 = index(p1, ')')) != 0) {
|
if ((p2 = strchr(p1, ')')) != 0) {
|
||||||
*p2 = '\0';
|
*p2 = '\0';
|
||||||
passagecnt = atoi(p1);
|
passagecnt = atoi(p1);
|
||||||
scope = TITLESCOPE;
|
scope = TITLESCOPE;
|
||||||
@@ -4487,11 +4487,11 @@ read_tribute(const char *tribsection, const char *tribtitle,
|
|||||||
display_nhwindow(tribwin, FALSE);
|
display_nhwindow(tribwin, FALSE);
|
||||||
/* put the final attribution line into message history,
|
/* put the final attribution line into message history,
|
||||||
analogous to the summary line from long quest messages */
|
analogous to the summary line from long quest messages */
|
||||||
if (index(lastline, '['))
|
if (strchr(lastline, '['))
|
||||||
mungspaces(lastline); /* to remove leading spaces */
|
mungspaces(lastline); /* to remove leading spaces */
|
||||||
else /* construct one if necessary */
|
else /* construct one if necessary */
|
||||||
Sprintf(lastline, "[%s, by Terry Pratchett]", tribtitle);
|
Sprintf(lastline, "[%s, by Terry Pratchett]", tribtitle);
|
||||||
if ((p = rindex(lastline, ']')) != 0)
|
if ((p = strrchr(lastline, ']')) != 0)
|
||||||
Sprintf(p, "; passage #%d]", targetpassage);
|
Sprintf(p, "; passage #%d]", targetpassage);
|
||||||
putmsghistory(lastline, FALSE);
|
putmsghistory(lastline, FALSE);
|
||||||
grasped = TRUE;
|
grasped = TRUE;
|
||||||
|
|||||||
+7
-7
@@ -2917,7 +2917,7 @@ monstinroom(struct permonst *mdat, int roomno)
|
|||||||
if (DEADMONSTER(mtmp))
|
if (DEADMONSTER(mtmp))
|
||||||
continue;
|
continue;
|
||||||
if (mtmp->data == mdat
|
if (mtmp->data == mdat
|
||||||
&& index(in_rooms(mtmp->mx, mtmp->my, 0), roomno + ROOMOFFSET))
|
&& strchr(in_rooms(mtmp->mx, mtmp->my, 0), roomno + ROOMOFFSET))
|
||||||
return mtmp;
|
return mtmp;
|
||||||
}
|
}
|
||||||
return (struct monst *) 0;
|
return (struct monst *) 0;
|
||||||
@@ -2969,19 +2969,19 @@ in_rooms(register coordxy x, register coordxy y, register int typewanted)
|
|||||||
for (x = min_x; x <= max_x; x += step) {
|
for (x = min_x; x <= max_x; x += step) {
|
||||||
lev = &levl[x][min_y];
|
lev = &levl[x][min_y];
|
||||||
y = 0;
|
y = 0;
|
||||||
if ((rno = lev[y].roomno) >= ROOMOFFSET && !index(ptr, rno)
|
if ((rno = lev[y].roomno) >= ROOMOFFSET && !strchr(ptr, rno)
|
||||||
&& goodtype(rno))
|
&& goodtype(rno))
|
||||||
*(--ptr) = rno;
|
*(--ptr) = rno;
|
||||||
y += step;
|
y += step;
|
||||||
if (y > max_y_offset)
|
if (y > max_y_offset)
|
||||||
continue;
|
continue;
|
||||||
if ((rno = lev[y].roomno) >= ROOMOFFSET && !index(ptr, rno)
|
if ((rno = lev[y].roomno) >= ROOMOFFSET && !strchr(ptr, rno)
|
||||||
&& goodtype(rno))
|
&& goodtype(rno))
|
||||||
*(--ptr) = rno;
|
*(--ptr) = rno;
|
||||||
y += step;
|
y += step;
|
||||||
if (y > max_y_offset)
|
if (y > max_y_offset)
|
||||||
continue;
|
continue;
|
||||||
if ((rno = lev[y].roomno) >= ROOMOFFSET && !index(ptr, rno)
|
if ((rno = lev[y].roomno) >= ROOMOFFSET && !strchr(ptr, rno)
|
||||||
&& goodtype(rno))
|
&& goodtype(rno))
|
||||||
*(--ptr) = rno;
|
*(--ptr) = rno;
|
||||||
}
|
}
|
||||||
@@ -3034,11 +3034,11 @@ move_update(register boolean newlev)
|
|||||||
for (ptr1 = u.urooms, ptr2 = u.uentered,
|
for (ptr1 = u.urooms, ptr2 = u.uentered,
|
||||||
ptr3 = u.ushops, ptr4 = u.ushops_entered; *ptr1; ptr1++) {
|
ptr3 = u.ushops, ptr4 = u.ushops_entered; *ptr1; ptr1++) {
|
||||||
c = *ptr1;
|
c = *ptr1;
|
||||||
if (!index(u.urooms0, c))
|
if (!strchr(u.urooms0, c))
|
||||||
*ptr2++ = c;
|
*ptr2++ = c;
|
||||||
if (IS_SHOP(c - ROOMOFFSET)) {
|
if (IS_SHOP(c - ROOMOFFSET)) {
|
||||||
*ptr3++ = c;
|
*ptr3++ = c;
|
||||||
if (!index(u.ushops0, c))
|
if (!strchr(u.ushops0, c))
|
||||||
*ptr4++ = c;
|
*ptr4++ = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3046,7 +3046,7 @@ move_update(register boolean newlev)
|
|||||||
|
|
||||||
/* filter u.ushops0 -> u.ushops_left */
|
/* filter u.ushops0 -> u.ushops_left */
|
||||||
for (ptr1 = u.ushops0, ptr2 = u.ushops_left; *ptr1; ptr1++)
|
for (ptr1 = u.ushops0, ptr2 = u.ushops_left; *ptr1; ptr1++)
|
||||||
if (!index(u.ushops, *ptr1))
|
if (!strchr(u.ushops, *ptr1))
|
||||||
*ptr2++ = *ptr1;
|
*ptr2++ = *ptr1;
|
||||||
*ptr2 = '\0';
|
*ptr2 = '\0';
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -210,7 +210,7 @@ trimspaces(char *txt)
|
|||||||
char *
|
char *
|
||||||
strip_newline(char *str)
|
strip_newline(char *str)
|
||||||
{
|
{
|
||||||
char *p = rindex(str, '\n');
|
char *p = strrchr(str, '\n');
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
if (p > str && *(p - 1) == '\r')
|
if (p > str && *(p - 1) == '\r')
|
||||||
@@ -283,7 +283,7 @@ str_lines_maxlen(const char *str)
|
|||||||
|
|
||||||
s1 = str;
|
s1 = str;
|
||||||
while (s1 && *s1) {
|
while (s1 && *s1) {
|
||||||
s2 = index(s1, '\n');
|
s2 = strchr(s1, '\n');
|
||||||
if (s2) {
|
if (s2) {
|
||||||
len = (int) (s2 - s1);
|
len = (int) (s2 - s1);
|
||||||
s1 = s2 + 1;
|
s1 = s2 + 1;
|
||||||
@@ -400,14 +400,14 @@ ing_suffix(const char *s)
|
|||||||
if ((p >= &buf[3] && !strcmpi(p - 3, " on"))
|
if ((p >= &buf[3] && !strcmpi(p - 3, " on"))
|
||||||
|| (p >= &buf[4] && !strcmpi(p - 4, " off"))
|
|| (p >= &buf[4] && !strcmpi(p - 4, " off"))
|
||||||
|| (p >= &buf[5] && !strcmpi(p - 5, " with"))) {
|
|| (p >= &buf[5] && !strcmpi(p - 5, " with"))) {
|
||||||
p = rindex(buf, ' ');
|
p = strrchr(buf, ' ');
|
||||||
Strcpy(onoff, p);
|
Strcpy(onoff, p);
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
if (p >= &buf[2] && !strcmpi(p - 2, "er")) { /* slither + ing */
|
if (p >= &buf[2] && !strcmpi(p - 2, "er")) { /* slither + ing */
|
||||||
/* nothing here */
|
/* nothing here */
|
||||||
} else if (p >= &buf[3] && !index(vowel, *(p - 1))
|
} else if (p >= &buf[3] && !strchr(vowel, *(p - 1))
|
||||||
&& index(vowel, *(p - 2)) && !index(vowel, *(p - 3))) {
|
&& strchr(vowel, *(p - 2)) && !strchr(vowel, *(p - 3))) {
|
||||||
/* tip -> tipp + ing */
|
/* tip -> tipp + ing */
|
||||||
*p = *(p - 1);
|
*p = *(p - 1);
|
||||||
*(p + 1) = '\0';
|
*(p + 1) = '\0';
|
||||||
@@ -530,7 +530,7 @@ stripchars(char *bp, const char *stuff_to_strip, const char *orig)
|
|||||||
|
|
||||||
if (s) {
|
if (s) {
|
||||||
while (*orig && i < (BUFSZ - 1)) {
|
while (*orig && i < (BUFSZ - 1)) {
|
||||||
if (!index(stuff_to_strip, *orig)) {
|
if (!strchr(stuff_to_strip, *orig)) {
|
||||||
*s++ = *orig;
|
*s++ = *orig;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -757,10 +757,10 @@ pmatch_internal(const char *patrn, const char *strng,
|
|||||||
/* fuzzy match variant of pmatch; particular characters are ignored */
|
/* fuzzy match variant of pmatch; particular characters are ignored */
|
||||||
do {
|
do {
|
||||||
s = *strng++;
|
s = *strng++;
|
||||||
} while (index(sk, s));
|
} while (strchr(sk, s));
|
||||||
do {
|
do {
|
||||||
p = *patrn++;
|
p = *patrn++;
|
||||||
} while (index(sk, p));
|
} while (strchr(sk, p));
|
||||||
}
|
}
|
||||||
if (!p) /* end of pattern */
|
if (!p) /* end of pattern */
|
||||||
return (boolean) (s == '\0'); /* matches iff end of string too */
|
return (boolean) (s == '\0'); /* matches iff end of string too */
|
||||||
@@ -881,9 +881,9 @@ fuzzymatch(const char *s1, const char *s2, const char *ignore_chars,
|
|||||||
register char c1, c2;
|
register char c1, c2;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
while ((c1 = *s1++) != '\0' && index(ignore_chars, c1) != 0)
|
while ((c1 = *s1++) != '\0' && strchr(ignore_chars, c1) != 0)
|
||||||
continue;
|
continue;
|
||||||
while ((c2 = *s2++) != '\0' && index(ignore_chars, c2) != 0)
|
while ((c2 = *s2++) != '\0' && strchr(ignore_chars, c2) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (!c1 || !c2)
|
if (!c1 || !c2)
|
||||||
break; /* stop when end of either string is reached */
|
break; /* stop when end of either string is reached */
|
||||||
|
|||||||
+2
-2
@@ -2548,9 +2548,9 @@ vanqsort_cmp(const genericptr vptr1, const genericptr vptr2)
|
|||||||
S_LIZARD, S_EEL, S_GOLEM, S_GHOST, S_DEMON, S_HUMAN, '\0'
|
S_LIZARD, S_EEL, S_GOLEM, S_GHOST, S_DEMON, S_HUMAN, '\0'
|
||||||
};
|
};
|
||||||
|
|
||||||
if ((punct = index(punctclasses, mcls1)) != 0)
|
if ((punct = strchr(punctclasses, mcls1)) != 0)
|
||||||
mcls1 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses));
|
mcls1 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses));
|
||||||
if ((punct = index(punctclasses, mcls2)) != 0)
|
if ((punct = strchr(punctclasses, mcls2)) != 0)
|
||||||
mcls2 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses));
|
mcls2 = (schar) (S_ZOMBIE + 1 + (int) (punct - punctclasses));
|
||||||
}
|
}
|
||||||
res = mcls1 - mcls2; /* class */
|
res = mcls1 - mcls2; /* class */
|
||||||
|
|||||||
+23
-23
@@ -87,7 +87,7 @@ loot_classify(Loot *sort_item, struct obj *obj)
|
|||||||
seen = obj->dknown ? TRUE : FALSE,
|
seen = obj->dknown ? TRUE : FALSE,
|
||||||
/* class order */
|
/* class order */
|
||||||
classorder = flags.sortpack ? flags.inv_order : def_srt_order;
|
classorder = flags.sortpack ? flags.inv_order : def_srt_order;
|
||||||
p = index(classorder, oclass);
|
p = strchr(classorder, oclass);
|
||||||
if (p)
|
if (p)
|
||||||
k = 1 + (int) (p - classorder);
|
k = 1 + (int) (p - classorder);
|
||||||
else
|
else
|
||||||
@@ -1706,7 +1706,7 @@ getobj(
|
|||||||
cntgiven = TRUE;
|
cntgiven = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index(quitchars, ilet)) {
|
if (strchr(quitchars, ilet)) {
|
||||||
if (Verbose(1, getobj1))
|
if (Verbose(1, getobj1))
|
||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return (struct obj *) 0;
|
return (struct obj *) 0;
|
||||||
@@ -2014,7 +2014,7 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
|||||||
getlin(qbuf, buf);
|
getlin(qbuf, buf);
|
||||||
if (buf[0] == '\033')
|
if (buf[0] == '\033')
|
||||||
return 0;
|
return 0;
|
||||||
if (index(buf, 'i')) {
|
if (strchr(buf, 'i')) {
|
||||||
char ailets[1+26+26+1+5+1]; /* $ + a-z + A-Z + # + slop + \0 */
|
char ailets[1+26+26+1+5+1]; /* $ + a-z + A-Z + # + slop + \0 */
|
||||||
struct obj *otmp;
|
struct obj *otmp;
|
||||||
|
|
||||||
@@ -2022,8 +2022,8 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
|||||||
ailets[0] = '\0';
|
ailets[0] = '\0';
|
||||||
if (ofilter)
|
if (ofilter)
|
||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
||||||
/* index() check: limit overflow items to one '#' */
|
/* strchr() check: limit overflow items to one '#' */
|
||||||
if ((*ofilter)(otmp) && !index(ailets, otmp->invlet))
|
if ((*ofilter)(otmp) && !strchr(ailets, otmp->invlet))
|
||||||
(void) strkitten(ailets, otmp->invlet);
|
(void) strkitten(ailets, otmp->invlet);
|
||||||
if (display_inventory(ailets, TRUE) == '\033')
|
if (display_inventory(ailets, TRUE) == '\033')
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2050,9 +2050,9 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
|||||||
continue;
|
continue;
|
||||||
oc_of_sym = def_char_to_objclass(sym);
|
oc_of_sym = def_char_to_objclass(sym);
|
||||||
if (takeoff && oc_of_sym != MAXOCLASSES) {
|
if (takeoff && oc_of_sym != MAXOCLASSES) {
|
||||||
if (index(extra_removeables, oc_of_sym)) {
|
if (strchr(extra_removeables, oc_of_sym)) {
|
||||||
; /* skip rest of takeoff checks */
|
; /* skip rest of takeoff checks */
|
||||||
} else if (!index(removeables, oc_of_sym)) {
|
} else if (!strchr(removeables, oc_of_sym)) {
|
||||||
pline("Not applicable.");
|
pline("Not applicable.");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (oc_of_sym == ARMOR_CLASS && !wearing_armor()) {
|
} else if (oc_of_sym == ARMOR_CLASS && !wearing_armor()) {
|
||||||
@@ -2081,7 +2081,7 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
|||||||
} else if (sym == 'u') {
|
} else if (sym == 'u') {
|
||||||
add_valid_menu_class('u');
|
add_valid_menu_class('u');
|
||||||
ckfn = ckunpaid;
|
ckfn = ckunpaid;
|
||||||
} else if (index("BUCXP", sym)) {
|
} else if (strchr("BUCXP", sym)) {
|
||||||
add_valid_menu_class(sym); /* 'B','U','C','X', or 'P' */
|
add_valid_menu_class(sym); /* 'B','U','C','X', or 'P' */
|
||||||
ckfn = ckvalidcat;
|
ckfn = ckvalidcat;
|
||||||
} else if (sym == 'm') {
|
} else if (sym == 'm') {
|
||||||
@@ -2089,7 +2089,7 @@ ggetobj(const char *word, int (*fn)(OBJ_P), int mx,
|
|||||||
} else if (oc_of_sym == MAXOCLASSES) {
|
} else if (oc_of_sym == MAXOCLASSES) {
|
||||||
You("don't have any %c's.", sym);
|
You("don't have any %c's.", sym);
|
||||||
} else {
|
} else {
|
||||||
if (!index(olets, oc_of_sym)) {
|
if (!strchr(olets, oc_of_sym)) {
|
||||||
add_valid_menu_class(oc_of_sym);
|
add_valid_menu_class(oc_of_sym);
|
||||||
olets[oletct++] = oc_of_sym;
|
olets[oletct++] = oc_of_sym;
|
||||||
olets[oletct] = '\0';
|
olets[oletct] = '\0';
|
||||||
@@ -3373,7 +3373,7 @@ display_pickinv(
|
|||||||
int tmpglyph;
|
int tmpglyph;
|
||||||
glyph_info tmpglyphinfo = nul_glyphinfo;
|
glyph_info tmpglyphinfo = nul_glyphinfo;
|
||||||
|
|
||||||
if (lets && !index(lets, otmp->invlet))
|
if (lets && !strchr(lets, otmp->invlet))
|
||||||
continue;
|
continue;
|
||||||
if (!flags.sortpack || otmp->oclass == *invlet) {
|
if (!flags.sortpack || otmp->oclass == *invlet) {
|
||||||
if (wizid && !not_fully_identified(otmp))
|
if (wizid && !not_fully_identified(otmp))
|
||||||
@@ -3520,7 +3520,7 @@ display_inventory(const char *lets, boolean want_reply)
|
|||||||
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
for (otmp = g.invent; otmp; otmp = otmp->nobj)
|
||||||
if (otmp->invlet == cmdq->key
|
if (otmp->invlet == cmdq->key
|
||||||
&& (!lets || !*lets
|
&& (!lets || !*lets
|
||||||
|| index(lets, def_oc_syms[(int)otmp->oclass].sym))) {
|
|| strchr(lets, def_oc_syms[(int)otmp->oclass].sym))) {
|
||||||
free(cmdq);
|
free(cmdq);
|
||||||
return otmp->invlet;
|
return otmp->invlet;
|
||||||
}
|
}
|
||||||
@@ -3839,7 +3839,7 @@ this_type_only(struct obj *obj)
|
|||||||
} else if (obj->oclass == COIN_CLASS) {
|
} else if (obj->oclass == COIN_CLASS) {
|
||||||
/* if filtering by bless/curse state, gold is classified as
|
/* if filtering by bless/curse state, gold is classified as
|
||||||
either unknown or uncursed based on user option setting */
|
either unknown or uncursed based on user option setting */
|
||||||
if (g.this_type && index("BUCX", g.this_type))
|
if (g.this_type && strchr("BUCX", g.this_type))
|
||||||
res = (g.this_type == (flags.goldX ? 'X' : 'U'));
|
res = (g.this_type == (flags.goldX ? 'X' : 'U'));
|
||||||
} else {
|
} else {
|
||||||
switch (g.this_type) {
|
switch (g.this_type) {
|
||||||
@@ -3953,9 +3953,9 @@ dotypeinv(void)
|
|||||||
*extra_types++ = 'X';
|
*extra_types++ = 'X';
|
||||||
if (!jcnt)
|
if (!jcnt)
|
||||||
*extra_types++ = 'P';
|
*extra_types++ = 'P';
|
||||||
*extra_types = '\0'; /* for index() */
|
*extra_types = '\0'; /* for strchr() */
|
||||||
for (i = 0; i < MAXOCLASSES; i++)
|
for (i = 0; i < MAXOCLASSES; i++)
|
||||||
if (!index(types, def_oc_syms[i].sym)) {
|
if (!strchr(types, def_oc_syms[i].sym)) {
|
||||||
*extra_types++ = def_oc_syms[i].sym;
|
*extra_types++ = def_oc_syms[i].sym;
|
||||||
*extra_types = '\0';
|
*extra_types = '\0';
|
||||||
}
|
}
|
||||||
@@ -3992,7 +3992,7 @@ dotypeinv(void)
|
|||||||
goto doI_done;
|
goto doI_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index("BUCXP", c))
|
if (strchr("BUCXP", c))
|
||||||
oclass = c; /* not a class but understood by this_type_only() */
|
oclass = c; /* not a class but understood by this_type_only() */
|
||||||
else
|
else
|
||||||
oclass = def_char_to_objclass(c); /* change to object class */
|
oclass = def_char_to_objclass(c); /* change to object class */
|
||||||
@@ -4034,13 +4034,13 @@ dotypeinv(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (traditional) {
|
if (traditional) {
|
||||||
if (index(types, c) > index(types, '\033')) {
|
if (strchr(types, c) > strchr(types, '\033')) {
|
||||||
You("have no %sobjects%s.", before, after);
|
You("have no %sobjects%s.", before, after);
|
||||||
goto doI_done;
|
goto doI_done;
|
||||||
}
|
}
|
||||||
g.this_type = oclass; /* extra input for this_type_only() */
|
g.this_type = oclass; /* extra input for this_type_only() */
|
||||||
}
|
}
|
||||||
if (index("BUCXP", c)) {
|
if (strchr("BUCXP", c)) {
|
||||||
/* the before and after phrases for "you have no..." can both be
|
/* the before and after phrases for "you have no..." can both be
|
||||||
treated as mutually-exclusive suffices when creating a title */
|
treated as mutually-exclusive suffices when creating a title */
|
||||||
Sprintf(title, "Items %s", (before && *before) ? before : after);
|
Sprintf(title, "Items %s", (before && *before) ? before : after);
|
||||||
@@ -4704,7 +4704,7 @@ useupf(struct obj *obj, long numused)
|
|||||||
else
|
else
|
||||||
otmp = obj;
|
otmp = obj;
|
||||||
if (costly_spot(otmp->ox, otmp->oy)) {
|
if (costly_spot(otmp->ox, otmp->oy)) {
|
||||||
if (index(u.urooms, *in_rooms(otmp->ox, otmp->oy, 0)))
|
if (strchr(u.urooms, *in_rooms(otmp->ox, otmp->oy, 0)))
|
||||||
addtobill(otmp, FALSE, FALSE, FALSE);
|
addtobill(otmp, FALSE, FALSE, FALSE);
|
||||||
else
|
else
|
||||||
(void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE);
|
(void) stolen_value(otmp, otmp->ox, otmp->oy, FALSE, FALSE);
|
||||||
@@ -4740,7 +4740,7 @@ let_to_name(char let, boolean unpaid, boolean showsym)
|
|||||||
|
|
||||||
if (oclass)
|
if (oclass)
|
||||||
class_name = names[oclass];
|
class_name = names[oclass];
|
||||||
else if ((pos = index(oth_symbols, let)) != 0)
|
else if ((pos = strchr(oth_symbols, let)) != 0)
|
||||||
class_name = oth_names[pos - oth_symbols];
|
class_name = oth_names[pos - oth_symbols];
|
||||||
else
|
else
|
||||||
class_name = names[0];
|
class_name = names[0];
|
||||||
@@ -4972,7 +4972,7 @@ adjust_split(void)
|
|||||||
GC_ECHOFIRST | GC_CONDHIST);
|
GC_ECHOFIRST | GC_CONDHIST);
|
||||||
/* \033 is in quitchars[] so we need to check for it separately
|
/* \033 is in quitchars[] so we need to check for it separately
|
||||||
in order to treat it as cancel rather than as accept */
|
in order to treat it as cancel rather than as accept */
|
||||||
if (!let || let == '\033' || !index(quitchars, let)) {
|
if (!let || let == '\033' || !strchr(quitchars, let)) {
|
||||||
pline1(Never_mind);
|
pline1(Never_mind);
|
||||||
return ECMD_CANCEL;
|
return ECMD_CANCEL;
|
||||||
}
|
}
|
||||||
@@ -5081,7 +5081,7 @@ doorganize_core(struct obj *obj)
|
|||||||
if (let == '\033')
|
if (let == '\033')
|
||||||
goto noadjust;
|
goto noadjust;
|
||||||
}
|
}
|
||||||
if (index(quitchars, let)
|
if (strchr(quitchars, let)
|
||||||
/* adjusting to same slot is meaningful since all
|
/* adjusting to same slot is meaningful since all
|
||||||
compatible stacks get collected along the way,
|
compatible stacks get collected along the way,
|
||||||
but splitting to same slot is not */
|
but splitting to same slot is not */
|
||||||
@@ -5099,9 +5099,9 @@ doorganize_core(struct obj *obj)
|
|||||||
goto noadjust;
|
goto noadjust;
|
||||||
}
|
}
|
||||||
/* letter() classifies '@' as one; compactify() can put '-' in lets;
|
/* letter() classifies '@' as one; compactify() can put '-' in lets;
|
||||||
the only thing of interest that index() might find is '$' or '#'
|
the only thing of interest that strchr() might find is '$' or '#'
|
||||||
since letter() catches everything else that we put into lets[] */
|
since letter() catches everything else that we put into lets[] */
|
||||||
if ((letter(let) && let != '@') || (index(lets, let) && let != '-'))
|
if ((letter(let) && let != '@') || (strchr(lets, let) && let != '-'))
|
||||||
break; /* got one */
|
break; /* got one */
|
||||||
if (trycnt == 5)
|
if (trycnt == 5)
|
||||||
goto noadjust;
|
goto noadjust;
|
||||||
|
|||||||
+2
-2
@@ -493,7 +493,7 @@ readmail(struct obj *otmp UNUSED)
|
|||||||
const char *const it_reads = "It reads: \"";
|
const char *const it_reads = "It reads: \"";
|
||||||
|
|
||||||
i = rn2(SIZE(junk_templates));
|
i = rn2(SIZE(junk_templates));
|
||||||
if (index(junk_templates[i], '%')) {
|
if (strchr(junk_templates[i], '%')) {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
recipient = DEVTEAM_EMAIL;
|
recipient = DEVTEAM_EMAIL;
|
||||||
delivery = subst_delivery;
|
delivery = subst_delivery;
|
||||||
@@ -614,7 +614,7 @@ read_simplemail(const char *mbox, boolean adminmsg)
|
|||||||
|
|
||||||
/* supply ending punctuation only if the message doesn't have any */
|
/* supply ending punctuation only if the message doesn't have any */
|
||||||
endpunct = "";
|
endpunct = "";
|
||||||
if (!index(".!?", msg[msglen - 2]))
|
if (!strchr(".!?", msg[msglen - 2]))
|
||||||
endpunct = ".";
|
endpunct = ".";
|
||||||
|
|
||||||
if (adminmsg) {
|
if (adminmsg) {
|
||||||
|
|||||||
+2
-2
@@ -746,11 +746,11 @@ opt_out_words(
|
|||||||
char *word;
|
char *word;
|
||||||
|
|
||||||
while (*str) {
|
while (*str) {
|
||||||
word = index(str, ' ');
|
word = strchr(str, ' ');
|
||||||
#if 0
|
#if 0
|
||||||
/* treat " (" as unbreakable space */
|
/* treat " (" as unbreakable space */
|
||||||
if (word && *(word + 1) == '(')
|
if (word && *(word + 1) == '(')
|
||||||
word = index(word + 1, ' ');
|
word = strchr(word + 1, ' ');
|
||||||
#endif
|
#endif
|
||||||
if (word)
|
if (word)
|
||||||
*word = '\0';
|
*word = '\0';
|
||||||
|
|||||||
+3
-3
@@ -1009,8 +1009,8 @@ makemaz(const char *s)
|
|||||||
if (wizard && *protofile && sp && sp->rndlevs) {
|
if (wizard && *protofile && sp && sp->rndlevs) {
|
||||||
char *ep = getenv("SPLEVTYPE"); /* not nh_getenv */
|
char *ep = getenv("SPLEVTYPE"); /* not nh_getenv */
|
||||||
if (ep) {
|
if (ep) {
|
||||||
/* rindex always succeeds due to code in prior block */
|
/* strrchr always succeeds due to code in prior block */
|
||||||
int len = (int) ((rindex(protofile, '-') - protofile) + 1);
|
int len = (int) ((strrchr(protofile, '-') - protofile) + 1);
|
||||||
|
|
||||||
while (ep && *ep) {
|
while (ep && *ep) {
|
||||||
if (!strncmp(ep, protofile, len)) {
|
if (!strncmp(ep, protofile, len)) {
|
||||||
@@ -1020,7 +1020,7 @@ makemaz(const char *s)
|
|||||||
Sprintf(protofile + len, "%d", pick);
|
Sprintf(protofile + len, "%d", pick);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
ep = index(ep, ',');
|
ep = strchr(ep, ',');
|
||||||
if (ep)
|
if (ep)
|
||||||
++ep;
|
++ep;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -761,7 +761,7 @@ static const char dknowns[] = { WAND_CLASS, RING_CLASS, POTION_CLASS,
|
|||||||
void
|
void
|
||||||
clear_dknown(struct obj *obj)
|
clear_dknown(struct obj *obj)
|
||||||
{
|
{
|
||||||
obj->dknown = index(dknowns, obj->oclass) ? 0 : 1;
|
obj->dknown = strchr(dknowns, obj->oclass) ? 0 : 1;
|
||||||
if ((obj->otyp >= ELVEN_SHIELD && obj->otyp <= ORCISH_SHIELD)
|
if ((obj->otyp >= ELVEN_SHIELD && obj->otyp <= ORCISH_SHIELD)
|
||||||
|| obj->otyp == SHIELD_OF_REFLECTION
|
|| obj->otyp == SHIELD_OF_REFLECTION
|
||||||
|| objects[obj->otyp].oc_merge)
|
|| objects[obj->otyp].oc_merge)
|
||||||
|
|||||||
@@ -1613,7 +1613,7 @@ mpickstuff(struct monst *mtmp, const char *str)
|
|||||||
|
|
||||||
/* Nymphs take everything. Most monsters don't pick up corpses. */
|
/* Nymphs take everything. Most monsters don't pick up corpses. */
|
||||||
if (!str ? searches_for_item(mtmp, otmp)
|
if (!str ? searches_for_item(mtmp, otmp)
|
||||||
: !!(index(str, otmp->oclass))) {
|
: !!(strchr(str, otmp->oclass))) {
|
||||||
if (otmp->otyp == CORPSE && mtmp->data->mlet != S_NYMPH
|
if (otmp->otyp == CORPSE && mtmp->data->mlet != S_NYMPH
|
||||||
/* let a handful of corpse types thru to can_carry() */
|
/* let a handful of corpse types thru to can_carry() */
|
||||||
&& !touch_petrifies(&mons[otmp->corpsenm])
|
&& !touch_petrifies(&mons[otmp->corpsenm])
|
||||||
|
|||||||
+3
-3
@@ -1333,18 +1333,18 @@ m_move(register struct monst* mtmp, register int after)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (((likegold && otmp->oclass == COIN_CLASS)
|
if (((likegold && otmp->oclass == COIN_CLASS)
|
||||||
|| (likeobjs && index(practical, otmp->oclass)
|
|| (likeobjs && strchr(practical, otmp->oclass)
|
||||||
&& (otmp->otyp != CORPSE
|
&& (otmp->otyp != CORPSE
|
||||||
|| (ptr->mlet == S_NYMPH
|
|| (ptr->mlet == S_NYMPH
|
||||||
&& !is_rider(&mons[otmp->corpsenm]))))
|
&& !is_rider(&mons[otmp->corpsenm]))))
|
||||||
|| (likemagic && index(magical, otmp->oclass))
|
|| (likemagic && strchr(magical, otmp->oclass))
|
||||||
|| (uses_items && searches_for_item(mtmp, otmp))
|
|| (uses_items && searches_for_item(mtmp, otmp))
|
||||||
|| (likerock && otmp->otyp == BOULDER)
|
|| (likerock && otmp->otyp == BOULDER)
|
||||||
|| (likegems && otmp->oclass == GEM_CLASS
|
|| (likegems && otmp->oclass == GEM_CLASS
|
||||||
&& objects[otmp->otyp].oc_material != MINERAL)
|
&& objects[otmp->otyp].oc_material != MINERAL)
|
||||||
|| (conceals && !cansee(otmp->ox, otmp->oy))
|
|| (conceals && !cansee(otmp->ox, otmp->oy))
|
||||||
|| (ptr == &mons[PM_GELATINOUS_CUBE]
|
|| (ptr == &mons[PM_GELATINOUS_CUBE]
|
||||||
&& !index(indigestion, otmp->oclass)
|
&& !strchr(indigestion, otmp->oclass)
|
||||||
&& !(otmp->otyp == CORPSE
|
&& !(otmp->otyp == CORPSE
|
||||||
&& touch_petrifies(&mons[otmp->corpsenm]))))
|
&& touch_petrifies(&mons[otmp->corpsenm]))))
|
||||||
&& touch_artifact(otmp, mtmp)) {
|
&& touch_artifact(otmp, mtmp)) {
|
||||||
|
|||||||
+1
-1
@@ -1587,7 +1587,7 @@ nhl_loadlua(lua_State *L, const char *fname)
|
|||||||
bufin -= ct, cnt += ct, ct = 0;
|
bufin -= ct, cnt += ct, ct = 0;
|
||||||
|
|
||||||
while (cnt > 0) {
|
while (cnt > 0) {
|
||||||
if ((nl = index(bufin, '\n')) != 0) {
|
if ((nl = strchr(bufin, '\n')) != 0) {
|
||||||
/* normal case, newline is present */
|
/* normal case, newline is present */
|
||||||
ct = (long) (nl - bufin + 1L); /* +1: keep the newline */
|
ct = (long) (nl - bufin + 1L); /* +1: keep the newline */
|
||||||
for (p = bufin; p <= nl; ++p)
|
for (p = bufin; p <= nl; ++p)
|
||||||
|
|||||||
+7
-7
@@ -604,7 +604,7 @@ dodiscovered(void) /* free after Robert Viduya */
|
|||||||
long sortindx; // should be ptrdiff_t, but we don't require that exists
|
long sortindx; // should be ptrdiff_t, but we don't require that exists
|
||||||
boolean alphabetized, alphabyclass, lootsort;
|
boolean alphabetized, alphabyclass, lootsort;
|
||||||
|
|
||||||
if (!flags.discosort || !(p = index(disco_order_let, flags.discosort)))
|
if (!flags.discosort || !(p = strchr(disco_order_let, flags.discosort)))
|
||||||
flags.discosort = 'o';
|
flags.discosort = 'o';
|
||||||
|
|
||||||
if (iflags.menu_requested) {
|
if (iflags.menu_requested) {
|
||||||
@@ -614,7 +614,7 @@ dodiscovered(void) /* free after Robert Viduya */
|
|||||||
alphabyclass = (flags.discosort == 'c');
|
alphabyclass = (flags.discosort == 'c');
|
||||||
alphabetized = (flags.discosort == 'a' || alphabyclass);
|
alphabetized = (flags.discosort == 'a' || alphabyclass);
|
||||||
lootsort = (flags.discosort == 's');
|
lootsort = (flags.discosort == 's');
|
||||||
sortindx = index(disco_order_let, flags.discosort) - disco_order_let;
|
sortindx = strchr(disco_order_let, flags.discosort) - disco_order_let;
|
||||||
|
|
||||||
tmpwin = create_nhwindow(NHW_MENU);
|
tmpwin = create_nhwindow(NHW_MENU);
|
||||||
Sprintf(buf, "Discoveries, %s", disco_orders_descr[sortindx]);
|
Sprintf(buf, "Discoveries, %s", disco_orders_descr[sortindx]);
|
||||||
@@ -637,7 +637,7 @@ dodiscovered(void) /* free after Robert Viduya */
|
|||||||
|
|
||||||
/* several classes are omitted from packorder; one is of interest here */
|
/* several classes are omitted from packorder; one is of interest here */
|
||||||
Strcpy(classes, flags.inv_order);
|
Strcpy(classes, flags.inv_order);
|
||||||
if (!index(classes, VENOM_CLASS))
|
if (!strchr(classes, VENOM_CLASS))
|
||||||
(void) strkitten(classes, VENOM_CLASS); /* append char to string */
|
(void) strkitten(classes, VENOM_CLASS); /* append char to string */
|
||||||
|
|
||||||
ct = uniq_ct + arti_ct;
|
ct = uniq_ct + arti_ct;
|
||||||
@@ -743,7 +743,7 @@ doclassdisco(void)
|
|||||||
boolean traditional, alphabetized, lootsort;
|
boolean traditional, alphabetized, lootsort;
|
||||||
int clr = 0;
|
int clr = 0;
|
||||||
|
|
||||||
if (!flags.discosort || !(p = index(disco_order_let, flags.discosort)))
|
if (!flags.discosort || !(p = strchr(disco_order_let, flags.discosort)))
|
||||||
flags.discosort = 'o';
|
flags.discosort = 'o';
|
||||||
|
|
||||||
if (iflags.menu_requested) {
|
if (iflags.menu_requested) {
|
||||||
@@ -788,7 +788,7 @@ doclassdisco(void)
|
|||||||
/* collect classes with discoveries, in packorder ordering; several
|
/* collect classes with discoveries, in packorder ordering; several
|
||||||
classes are omitted from packorder and one is of interest here */
|
classes are omitted from packorder and one is of interest here */
|
||||||
Strcpy(allclasses, flags.inv_order);
|
Strcpy(allclasses, flags.inv_order);
|
||||||
if (!index(allclasses, VENOM_CLASS))
|
if (!strchr(allclasses, VENOM_CLASS))
|
||||||
(void) strkitten(allclasses, VENOM_CLASS); /* append char to string */
|
(void) strkitten(allclasses, VENOM_CLASS); /* append char to string */
|
||||||
/* construct discosyms[] */
|
/* construct discosyms[] */
|
||||||
for (s = allclasses; *s; ++s) {
|
for (s = allclasses; *s; ++s) {
|
||||||
@@ -797,7 +797,7 @@ doclassdisco(void)
|
|||||||
for (i = g.bases[(int) oclass];
|
for (i = g.bases[(int) oclass];
|
||||||
i < NUM_OBJECTS && objects[i].oc_class == oclass; ++i)
|
i < NUM_OBJECTS && objects[i].oc_class == oclass; ++i)
|
||||||
if ((dis = g.disco[i]) != 0 && interesting_to_discover(dis)) {
|
if ((dis = g.disco[i]) != 0 && interesting_to_discover(dis)) {
|
||||||
if (!index(discosyms, c)) {
|
if (!strchr(discosyms, c)) {
|
||||||
Sprintf(eos(discosyms), "%c", c);
|
Sprintf(eos(discosyms), "%c", c);
|
||||||
if (!traditional) {
|
if (!traditional) {
|
||||||
any.a_int = c;
|
any.a_int = c;
|
||||||
@@ -829,7 +829,7 @@ doclassdisco(void)
|
|||||||
Sprintf(allclasses_plustwo, "%s%c%c", allclasses, 'u', 'a');
|
Sprintf(allclasses_plustwo, "%s%c%c", allclasses, 'u', 'a');
|
||||||
for (s = allclasses_plustwo, xtras = 0; *s; ++s) {
|
for (s = allclasses_plustwo, xtras = 0; *s; ++s) {
|
||||||
c = (*s == 'u' || *s == 'a') ? *s : def_oc_syms[(int) *s].sym;
|
c = (*s == 'u' || *s == 'a') ? *s : def_oc_syms[(int) *s].sym;
|
||||||
if (!index(discosyms, c)) {
|
if (!strchr(discosyms, c)) {
|
||||||
if (!xtras++)
|
if (!xtras++)
|
||||||
(void) strkitten(discosyms, '\033');
|
(void) strkitten(discosyms, '\033');
|
||||||
(void) strkitten(discosyms, c);
|
(void) strkitten(discosyms, c);
|
||||||
|
|||||||
+24
-24
@@ -439,7 +439,7 @@ fruit_from_name(
|
|||||||
compromise and use 'fname_k >= k' instead of '>',
|
compromise and use 'fname_k >= k' instead of '>',
|
||||||
accepting 1 char length discrepancy without risking
|
accepting 1 char length discrepancy without risking
|
||||||
false match (I hope...) */
|
false match (I hope...) */
|
||||||
if (fname_k >= k && (p = index(&fnamebuf[k], ' ')) != 0) {
|
if (fname_k >= k && (p = strchr(&fnamebuf[k], ' ')) != 0) {
|
||||||
*p = '\0'; /* truncate at 1st space past length of f->fname */
|
*p = '\0'; /* truncate at 1st space past length of f->fname */
|
||||||
altfname = makesingular(fnamebuf);
|
altfname = makesingular(fnamebuf);
|
||||||
k = Strlen(altfname); /* actually revised 'fname_k' */
|
k = Strlen(altfname); /* actually revised 'fname_k' */
|
||||||
@@ -1231,9 +1231,9 @@ doname_base(
|
|||||||
are described as slippery when hero has slippery fingers */
|
are described as slippery when hero has slippery fingers */
|
||||||
if (obj == uarmg && Glib) /* just appended "(something)",
|
if (obj == uarmg && Glib) /* just appended "(something)",
|
||||||
* change to "(something; slippery)" */
|
* change to "(something; slippery)" */
|
||||||
Strcpy(rindex(bp, ')'), "; slippery)");
|
Strcpy(strrchr(bp, ')'), "; slippery)");
|
||||||
else if (!Blind && obj->lamplit && artifact_light(obj))
|
else if (!Blind && obj->lamplit && artifact_light(obj))
|
||||||
Sprintf(rindex(bp, ')'), ", %s lit)",
|
Sprintf(strrchr(bp, ')'), ", %s lit)",
|
||||||
arti_light_description(obj));
|
arti_light_description(obj));
|
||||||
}
|
}
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
@@ -1840,21 +1840,21 @@ just_an(char *outbuf, const char *str)
|
|||||||
c0 = lowc(*str);
|
c0 = lowc(*str);
|
||||||
if (!str[1] || str[1] == ' ') {
|
if (!str[1] || str[1] == ' ') {
|
||||||
/* single letter; might be used for named fruit or a musical note */
|
/* single letter; might be used for named fruit or a musical note */
|
||||||
Strcpy(outbuf, index("aefhilmnosx", c0) ? "an " : "a ");
|
Strcpy(outbuf, strchr("aefhilmnosx", c0) ? "an " : "a ");
|
||||||
} else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
|
} else if (!strncmpi(str, "the ", 4) || !strcmpi(str, "molten lava")
|
||||||
|| !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) {
|
|| !strcmpi(str, "iron bars") || !strcmpi(str, "ice")) {
|
||||||
; /* no article */
|
; /* no article */
|
||||||
} else {
|
} else {
|
||||||
/* normal case is "an <vowel>" or "a <consonant>" */
|
/* normal case is "an <vowel>" or "a <consonant>" */
|
||||||
if ((index(vowels, c0) /* some exceptions warranting "a <vowel>" */
|
if ((strchr(vowels, c0) /* some exceptions warranting "a <vowel>" */
|
||||||
/* 'wun' initial sound */
|
/* 'wun' initial sound */
|
||||||
&& (strncmpi(str, "one", 3) || (str[3] && !index("-_ ", str[3])))
|
&& (strncmpi(str, "one", 3) || (str[3] && !strchr("-_ ", str[3])))
|
||||||
/* long 'u' initial sound */
|
/* long 'u' initial sound */
|
||||||
&& strncmpi(str, "eu", 2) /* "eucalyptus leaf" */
|
&& strncmpi(str, "eu", 2) /* "eucalyptus leaf" */
|
||||||
&& strncmpi(str, "uke", 3) && strncmpi(str, "ukulele", 7)
|
&& strncmpi(str, "uke", 3) && strncmpi(str, "ukulele", 7)
|
||||||
&& strncmpi(str, "unicorn", 7) && strncmpi(str, "uranium", 7)
|
&& strncmpi(str, "unicorn", 7) && strncmpi(str, "uranium", 7)
|
||||||
&& strncmpi(str, "useful", 6)) /* "useful tool" */
|
&& strncmpi(str, "useful", 6)) /* "useful tool" */
|
||||||
|| (c0 == 'x' && !index(vowels, lowc(str[1]))))
|
|| (c0 == 'x' && !strchr(vowels, lowc(str[1]))))
|
||||||
Strcpy(outbuf, "an ");
|
Strcpy(outbuf, "an ");
|
||||||
else
|
else
|
||||||
Strcpy(outbuf, "a ");
|
Strcpy(outbuf, "a ");
|
||||||
@@ -1920,13 +1920,13 @@ the(const char* str)
|
|||||||
int l;
|
int l;
|
||||||
|
|
||||||
/* some objects have capitalized adjectives in their names */
|
/* some objects have capitalized adjectives in their names */
|
||||||
if (((tmp = rindex(str, ' ')) != 0 || (tmp = rindex(str, '-')) != 0)
|
if (((tmp = strrchr(str, ' ')) != 0 || (tmp = strrchr(str, '-')) != 0)
|
||||||
&& (tmp[1] < 'A' || tmp[1] > 'Z')) {
|
&& (tmp[1] < 'A' || tmp[1] > 'Z')) {
|
||||||
/* insert "the" unless we have an apostrophe (where we assume
|
/* insert "the" unless we have an apostrophe (where we assume
|
||||||
we're dealing with "Unique's corpse" when "Unique" wasn't
|
we're dealing with "Unique's corpse" when "Unique" wasn't
|
||||||
caught by CapitalMon() above) */
|
caught by CapitalMon() above) */
|
||||||
insert_the = !index(str, '\'');
|
insert_the = !strchr(str, '\'');
|
||||||
} else if (tmp && index(str, ' ') < tmp) { /* has spaces */
|
} else if (tmp && strchr(str, ' ') < tmp) { /* has spaces */
|
||||||
/* it needs an article if the name contains "of" */
|
/* it needs an article if the name contains "of" */
|
||||||
tmp = strstri(str, " of ");
|
tmp = strstri(str, " of ");
|
||||||
named = strstri(str, " named ");
|
named = strstri(str, " named ");
|
||||||
@@ -2261,7 +2261,7 @@ vtense(const char* subj, const char* verb)
|
|||||||
if (!strncmpi(subj, "a ", 2) || !strncmpi(subj, "an ", 3))
|
if (!strncmpi(subj, "a ", 2) || !strncmpi(subj, "an ", 3))
|
||||||
goto sing;
|
goto sing;
|
||||||
spot = (const char *) 0;
|
spot = (const char *) 0;
|
||||||
for (sp = subj; (sp = index(sp, ' ')) != 0; ++sp) {
|
for (sp = subj; (sp = strchr(sp, ' ')) != 0; ++sp) {
|
||||||
if (!strncmpi(sp, " of ", 4) || !strncmpi(sp, " from ", 6)
|
if (!strncmpi(sp, " of ", 4) || !strncmpi(sp, " from ", 6)
|
||||||
|| !strncmpi(sp, " called ", 8) || !strncmpi(sp, " named ", 7)
|
|| !strncmpi(sp, " called ", 8) || !strncmpi(sp, " named ", 7)
|
||||||
|| !strncmpi(sp, " labeled ", 9)) {
|
|| !strncmpi(sp, " labeled ", 9)) {
|
||||||
@@ -2279,7 +2279,7 @@ vtense(const char* subj, const char* verb)
|
|||||||
* Guess at a few other special cases that makeplural creates.
|
* Guess at a few other special cases that makeplural creates.
|
||||||
*/
|
*/
|
||||||
if ((lowc(*spot) == 's' && spot != subj
|
if ((lowc(*spot) == 's' && spot != subj
|
||||||
&& !index("us", lowc(*(spot - 1))))
|
&& !strchr("us", lowc(*(spot - 1))))
|
||||||
|| !BSTRNCMPI(subj, spot - 3, "eeth", 4)
|
|| !BSTRNCMPI(subj, spot - 3, "eeth", 4)
|
||||||
|| !BSTRNCMPI(subj, spot - 3, "feet", 4)
|
|| !BSTRNCMPI(subj, spot - 3, "feet", 4)
|
||||||
|| !BSTRNCMPI(subj, spot - 1, "ia", 2)
|
|| !BSTRNCMPI(subj, spot - 1, "ia", 2)
|
||||||
@@ -2316,13 +2316,13 @@ vtense(const char* subj, const char* verb)
|
|||||||
Strcasecpy(buf, "is");
|
Strcasecpy(buf, "is");
|
||||||
} else if (!strcmpi(buf, "have")) {
|
} else if (!strcmpi(buf, "have")) {
|
||||||
Strcasecpy(bspot - 1, "s");
|
Strcasecpy(bspot - 1, "s");
|
||||||
} else if (index("zxs", lowc(*bspot))
|
} else if (strchr("zxs", lowc(*bspot))
|
||||||
|| (len >= 2 && lowc(*bspot) == 'h'
|
|| (len >= 2 && lowc(*bspot) == 'h'
|
||||||
&& index("cs", lowc(*(bspot - 1))))
|
&& strchr("cs", lowc(*(bspot - 1))))
|
||||||
|| (len == 2 && lowc(*bspot) == 'o')) {
|
|| (len == 2 && lowc(*bspot) == 'o')) {
|
||||||
/* Ends in z, x, s, ch, sh; add an "es" */
|
/* Ends in z, x, s, ch, sh; add an "es" */
|
||||||
Strcasecpy(bspot + 1, "es");
|
Strcasecpy(bspot + 1, "es");
|
||||||
} else if (lowc(*bspot) == 'y' && !index(vowels, lowc(*(bspot - 1)))) {
|
} else if (lowc(*bspot) == 'y' && !strchr(vowels, lowc(*(bspot - 1)))) {
|
||||||
/* like "y" case in makeplural */
|
/* like "y" case in makeplural */
|
||||||
Strcasecpy(bspot, "ies");
|
Strcasecpy(bspot, "ies");
|
||||||
} else {
|
} else {
|
||||||
@@ -2480,7 +2480,7 @@ singplur_compound(char *str)
|
|||||||
for (p = str; *p; ++p) {
|
for (p = str; *p; ++p) {
|
||||||
/* substring starting at p can only match if *p is found
|
/* substring starting at p can only match if *p is found
|
||||||
within compound_start[] */
|
within compound_start[] */
|
||||||
if (!index(compound_start, *p))
|
if (!strchr(compound_start, *p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* check current substring against all words in the compound[] list */
|
/* check current substring against all words in the compound[] list */
|
||||||
@@ -2609,7 +2609,7 @@ makeplural(const char* oldstr)
|
|||||||
if (len >= 3 && !strcmpi(spot - 2, "erf")) {
|
if (len >= 3 && !strcmpi(spot - 2, "erf")) {
|
||||||
/* avoid "nerf" -> "nerves", "serf" -> "serves" */
|
/* avoid "nerf" -> "nerves", "serf" -> "serves" */
|
||||||
; /* fall through to default (append 's') */
|
; /* fall through to default (append 's') */
|
||||||
} else if (index("lr", lo_c) || index(vowels, lo_c)) {
|
} else if (strchr("lr", lo_c) || strchr(vowels, lo_c)) {
|
||||||
/* [aeioulr]f to [aeioulr]ves */
|
/* [aeioulr]f to [aeioulr]ves */
|
||||||
Strcasecpy(spot, "ves");
|
Strcasecpy(spot, "ves");
|
||||||
goto bottom;
|
goto bottom;
|
||||||
@@ -2676,8 +2676,8 @@ makeplural(const char* oldstr)
|
|||||||
goto bottom;
|
goto bottom;
|
||||||
}
|
}
|
||||||
/* Ends in z, x, s, ch, sh; add an "es" */
|
/* Ends in z, x, s, ch, sh; add an "es" */
|
||||||
if (index("zxs", lo_c)
|
if (strchr("zxs", lo_c)
|
||||||
|| (len >= 2 && lo_c == 'h' && index("cs", lowc(*(spot - 1)))
|
|| (len >= 2 && lo_c == 'h' && strchr("cs", lowc(*(spot - 1)))
|
||||||
/* 21st century k-sound */
|
/* 21st century k-sound */
|
||||||
&& !(len >= 4 && lowc(*(spot - 1)) == 'c' && ch_ksound(str)))
|
&& !(len >= 4 && lowc(*(spot - 1)) == 'c' && ch_ksound(str)))
|
||||||
/* Kludge to get "tomatoes" and "potatoes" right */
|
/* Kludge to get "tomatoes" and "potatoes" right */
|
||||||
@@ -2687,7 +2687,7 @@ makeplural(const char* oldstr)
|
|||||||
goto bottom;
|
goto bottom;
|
||||||
}
|
}
|
||||||
/* Ends in y preceded by consonant (note: also "qu") change to "ies" */
|
/* Ends in y preceded by consonant (note: also "qu") change to "ies" */
|
||||||
if (lo_c == 'y' && !index(vowels, lowc(*(spot - 1)))) {
|
if (lo_c == 'y' && !strchr(vowels, lowc(*(spot - 1)))) {
|
||||||
Strcasecpy(spot, "ies"); /* y -> ies */
|
Strcasecpy(spot, "ies"); /* y -> ies */
|
||||||
goto bottom;
|
goto bottom;
|
||||||
}
|
}
|
||||||
@@ -2774,8 +2774,8 @@ makesingular(const char* oldstr)
|
|||||||
goto bottom;
|
goto bottom;
|
||||||
}
|
}
|
||||||
/* wolves, but f to ves isn't fully reversible */
|
/* wolves, but f to ves isn't fully reversible */
|
||||||
if (p - 4 >= bp && (index("lr", lowc(*(p - 4)))
|
if (p - 4 >= bp && (strchr("lr", lowc(*(p - 4)))
|
||||||
|| index(vowels, lowc(*(p - 4))))
|
|| strchr(vowels, lowc(*(p - 4))))
|
||||||
&& !BSTRCMPI(bp, p - 3, "ves")) {
|
&& !BSTRCMPI(bp, p - 3, "ves")) {
|
||||||
if (!BSTRCMPI(bp, p - 6, "cloves")
|
if (!BSTRCMPI(bp, p - 6, "cloves")
|
||||||
|| !BSTRCMPI(bp, p - 6, "nerves"))
|
|| !BSTRCMPI(bp, p - 6, "nerves"))
|
||||||
@@ -2826,7 +2826,7 @@ makesingular(const char* oldstr)
|
|||||||
}
|
}
|
||||||
/* balactheria -> balactherium */
|
/* balactheria -> balactherium */
|
||||||
if (p - 4 >= bp && !strcmpi(p - 2, "ia")
|
if (p - 4 >= bp && !strcmpi(p - 2, "ia")
|
||||||
&& index("lr", lowc(*(p - 3))) && lowc(*(p - 4)) == 'e') {
|
&& strchr("lr", lowc(*(p - 3))) && lowc(*(p - 4)) == 'e') {
|
||||||
Strcasecpy(p - 1, "um"); /* a -> um */
|
Strcasecpy(p - 1, "um"); /* a -> um */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3767,7 +3767,7 @@ readobjnam_preparse(struct _readobjnam_data *d)
|
|||||||
static void
|
static void
|
||||||
readobjnam_parse_charges(struct _readobjnam_data *d)
|
readobjnam_parse_charges(struct _readobjnam_data *d)
|
||||||
{
|
{
|
||||||
if (strlen(d->bp) > 1 && (d->p = rindex(d->bp, '(')) != 0) {
|
if (strlen(d->bp) > 1 && (d->p = strrchr(d->bp, '(')) != 0) {
|
||||||
boolean keeptrailingchars = TRUE;
|
boolean keeptrailingchars = TRUE;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
|||||||
+39
-39
@@ -371,7 +371,7 @@ parseoptions(
|
|||||||
using_alias = FALSE;
|
using_alias = FALSE;
|
||||||
g.opt_initial = tinitial;
|
g.opt_initial = tinitial;
|
||||||
g.opt_from_file = tfrom_file;
|
g.opt_from_file = tfrom_file;
|
||||||
if ((op = index(opts, ',')) != 0) {
|
if ((op = strchr(opts, ',')) != 0) {
|
||||||
*op++ = 0;
|
*op++ = 0;
|
||||||
if (!parseoptions(op, g.opt_initial, g.opt_from_file))
|
if (!parseoptions(op, g.opt_initial, g.opt_from_file))
|
||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
@@ -533,7 +533,7 @@ parseoptions(
|
|||||||
|
|
||||||
if (opts) {
|
if (opts) {
|
||||||
Snprintf(pfxbuf, sizeof pfxbuf, "%s", opts);
|
Snprintf(pfxbuf, sizeof pfxbuf, "%s", opts);
|
||||||
if ((pfxp = index(pfxbuf, ':')) != 0)
|
if ((pfxp = strchr(pfxbuf, ':')) != 0)
|
||||||
*pfxp = '\0';
|
*pfxp = '\0';
|
||||||
config_error_add("bad option suffix variation '%s'", pfxbuf);
|
config_error_add("bad option suffix variation '%s'", pfxbuf);
|
||||||
}
|
}
|
||||||
@@ -773,11 +773,11 @@ optfn_autounlock(
|
|||||||
return optn_ok;
|
return optn_ok;
|
||||||
}
|
}
|
||||||
newflags = 0;
|
newflags = 0;
|
||||||
sep = index(op, '+') ? '+' : ' ';
|
sep = strchr(op, '+') ? '+' : ' ';
|
||||||
while (op) {
|
while (op) {
|
||||||
boolean matched = FALSE;
|
boolean matched = FALSE;
|
||||||
op = trimspaces(op); /* might have leading space */
|
op = trimspaces(op); /* might have leading space */
|
||||||
if ((nxt = index(op, sep)) != 0) {
|
if ((nxt = strchr(op, sep)) != 0) {
|
||||||
*nxt++ = '\0';
|
*nxt++ = '\0';
|
||||||
op = trimspaces(op); /* might have trailing space after
|
op = trimspaces(op); /* might have trailing space after
|
||||||
* plus sign removal */
|
* plus sign removal */
|
||||||
@@ -1139,7 +1139,7 @@ optfn_disclose(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
c = 'v'; /* killed -> vanquished */
|
c = 'v'; /* killed -> vanquished */
|
||||||
if (c == 'd')
|
if (c == 'd')
|
||||||
c = 'o'; /* dungeon -> overview */
|
c = 'o'; /* dungeon -> overview */
|
||||||
dop = index(disclosure_options, c);
|
dop = strchr(disclosure_options, c);
|
||||||
if (dop) {
|
if (dop) {
|
||||||
idx = (int) (dop - disclosure_options);
|
idx = (int) (dop - disclosure_options);
|
||||||
if (idx < 0 || idx > NUM_DISCLOSURE_OPTIONS - 1) {
|
if (idx < 0 || idx > NUM_DISCLOSURE_OPTIONS - 1) {
|
||||||
@@ -1157,7 +1157,7 @@ optfn_disclose(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
prefix_val = -1;
|
prefix_val = -1;
|
||||||
} else
|
} else
|
||||||
flags.end_disclose[idx] = DISCLOSE_YES_WITHOUT_PROMPT;
|
flags.end_disclose[idx] = DISCLOSE_YES_WITHOUT_PROMPT;
|
||||||
} else if (index(valid_settings, c)) {
|
} else if (strchr(valid_settings, c)) {
|
||||||
prefix_val = c;
|
prefix_val = c;
|
||||||
} else if (c == ' ') {
|
} else if (c == ' ') {
|
||||||
; /* do nothing */
|
; /* do nothing */
|
||||||
@@ -2459,7 +2459,7 @@ optfn_paranoid_confirmation(
|
|||||||
"paranoid_confirm:whichone wheretwo whothree"
|
"paranoid_confirm:whichone wheretwo whothree"
|
||||||
and "paranoid_confirm:" prefix has already
|
and "paranoid_confirm:" prefix has already
|
||||||
been stripped off by the time we get here */
|
been stripped off by the time we get here */
|
||||||
pp = index(op, ' ');
|
pp = strchr(op, ' ');
|
||||||
if (pp)
|
if (pp)
|
||||||
*pp = '\0';
|
*pp = '\0';
|
||||||
/* we aren't matching option names but match_optname()
|
/* we aren't matching option names but match_optname()
|
||||||
@@ -2747,7 +2747,7 @@ optfn_pickup_types(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
the old value (above) as a default action */
|
the old value (above) as a default action */
|
||||||
}
|
}
|
||||||
if (use_menu) {
|
if (use_menu) {
|
||||||
if (wizard && !index(ocl, VENOM_SYM))
|
if (wizard && !strchr(ocl, VENOM_SYM))
|
||||||
strkitten(ocl, VENOM_SYM);
|
strkitten(ocl, VENOM_SYM);
|
||||||
(void) choose_classes_menu("Autopickup what?", 1, TRUE, ocl,
|
(void) choose_classes_menu("Autopickup what?", 1, TRUE, ocl,
|
||||||
tbuf);
|
tbuf);
|
||||||
@@ -2766,7 +2766,7 @@ optfn_pickup_types(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
oc_sym = def_char_to_objclass(*op);
|
oc_sym = def_char_to_objclass(*op);
|
||||||
/* make sure all are valid obj symbols occurring once */
|
/* make sure all are valid obj symbols occurring once */
|
||||||
if (oc_sym != MAXOCLASSES
|
if (oc_sym != MAXOCLASSES
|
||||||
&& !index(flags.pickup_types, oc_sym)) {
|
&& !strchr(flags.pickup_types, oc_sym)) {
|
||||||
flags.pickup_types[num] = (char) oc_sym;
|
flags.pickup_types[num] = (char) oc_sym;
|
||||||
flags.pickup_types[++num] = '\0';
|
flags.pickup_types[++num] = '\0';
|
||||||
} else
|
} else
|
||||||
@@ -3234,7 +3234,7 @@ optfn_sortdiscoveries(
|
|||||||
if (req == get_val || req == get_cnf_val) {
|
if (req == get_val || req == get_cnf_val) {
|
||||||
extern const char *const disco_orders_descr[]; /* o_init.c */
|
extern const char *const disco_orders_descr[]; /* o_init.c */
|
||||||
extern const char disco_order_let[];
|
extern const char disco_order_let[];
|
||||||
const char *p = index(disco_order_let, flags.discosort);
|
const char *p = strchr(disco_order_let, flags.discosort);
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
flags.discosort = 'o', p = disco_order_let;
|
flags.discosort = 'o', p = disco_order_let;
|
||||||
@@ -3963,7 +3963,7 @@ optfn_whatis_coord(int optidx, int req, boolean negated, char *opts, char *op)
|
|||||||
GPCOORDS_SCREEN, '\0' };
|
GPCOORDS_SCREEN, '\0' };
|
||||||
char c = lowc(*op);
|
char c = lowc(*op);
|
||||||
|
|
||||||
if (c && index(gpcoords, c))
|
if (c && strchr(gpcoords, c))
|
||||||
iflags.getpos_coords = c;
|
iflags.getpos_coords = c;
|
||||||
else {
|
else {
|
||||||
config_error_add("Unknown %s parameter '%s'",
|
config_error_add("Unknown %s parameter '%s'",
|
||||||
@@ -4433,7 +4433,7 @@ int pfxfn_verbose(int optidx UNUSED, int req, boolean negated,
|
|||||||
if (req == do_set) {
|
if (req == do_set) {
|
||||||
if (opts) {
|
if (opts) {
|
||||||
if (!strncmp(opts, "verbose", 7)) {
|
if (!strncmp(opts, "verbose", 7)) {
|
||||||
p = index("01234", *(opts + 7));
|
p = strchr("01234", *(opts + 7));
|
||||||
if (p && *p == '\0') /* plain verbose, not verboseN */
|
if (p && *p == '\0') /* plain verbose, not verboseN */
|
||||||
param_optional = TRUE;
|
param_optional = TRUE;
|
||||||
if ((op = string_for_opt(opts, param_optional)) != empty_optstr) {
|
if ((op = string_for_opt(opts, param_optional)) != empty_optstr) {
|
||||||
@@ -5774,8 +5774,8 @@ string_for_opt(char *opts, boolean val_optional)
|
|||||||
{
|
{
|
||||||
char *colon, *equals;
|
char *colon, *equals;
|
||||||
|
|
||||||
colon = index(opts, ':');
|
colon = strchr(opts, ':');
|
||||||
equals = index(opts, '=');
|
equals = strchr(opts, '=');
|
||||||
if (!colon || (equals && equals < colon))
|
if (!colon || (equals && equals < colon))
|
||||||
colon = equals;
|
colon = equals;
|
||||||
|
|
||||||
@@ -5846,8 +5846,8 @@ determine_ambiguities(void)
|
|||||||
static int
|
static int
|
||||||
length_without_val(const char *user_string, int len)
|
length_without_val(const char *user_string, int len)
|
||||||
{
|
{
|
||||||
const char *p = index(user_string, ':'),
|
const char *p = strchr(user_string, ':'),
|
||||||
*q = index(user_string, '=');
|
*q = strchr(user_string, '=');
|
||||||
|
|
||||||
if (!p || (q && q < p))
|
if (!p || (q && q < p))
|
||||||
p = q;
|
p = q;
|
||||||
@@ -6025,23 +6025,23 @@ escapes(const char *cp, /* might be 'tp', updating in place */
|
|||||||
++cp;
|
++cp;
|
||||||
|
|
||||||
/* remaining cases are all for backslash; we know cp[1] is not \0 */
|
/* remaining cases are all for backslash; we know cp[1] is not \0 */
|
||||||
} else if (index(dec, cp[1])) {
|
} else if (strchr(dec, cp[1])) {
|
||||||
++cp; /* move past backslash to first digit */
|
++cp; /* move past backslash to first digit */
|
||||||
do {
|
do {
|
||||||
cval = (cval * 10) + (*cp - '0');
|
cval = (cval * 10) + (*cp - '0');
|
||||||
} while (*++cp && index(dec, *cp) && ++dcount < 3);
|
} while (*++cp && strchr(dec, *cp) && ++dcount < 3);
|
||||||
} else if ((cp[1] == 'o' || cp[1] == 'O') && cp[2]
|
} else if ((cp[1] == 'o' || cp[1] == 'O') && cp[2]
|
||||||
&& index(oct, cp[2])) {
|
&& strchr(oct, cp[2])) {
|
||||||
cp += 2; /* move past backslash and 'O' */
|
cp += 2; /* move past backslash and 'O' */
|
||||||
do {
|
do {
|
||||||
cval = (cval * 8) + (*cp - '0');
|
cval = (cval * 8) + (*cp - '0');
|
||||||
} while (*++cp && index(oct, *cp) && ++dcount < 3);
|
} while (*++cp && strchr(oct, *cp) && ++dcount < 3);
|
||||||
} else if ((cp[1] == 'x' || cp[1] == 'X') && cp[2]
|
} else if ((cp[1] == 'x' || cp[1] == 'X') && cp[2]
|
||||||
&& (dp = index(hex, cp[2])) != 0) {
|
&& (dp = strchr(hex, cp[2])) != 0) {
|
||||||
cp += 2; /* move past backslash and 'X' */
|
cp += 2; /* move past backslash and 'X' */
|
||||||
do {
|
do {
|
||||||
cval = (cval * 16) + ((int) (dp - hex) / 2);
|
cval = (cval * 16) + ((int) (dp - hex) / 2);
|
||||||
} while (*++cp && (dp = index(hex, *cp)) != 0 && ++dcount < 2);
|
} while (*++cp && (dp = strchr(hex, *cp)) != 0 && ++dcount < 2);
|
||||||
} else { /* C-style character escapes */
|
} else { /* C-style character escapes */
|
||||||
switch (*++cp) {
|
switch (*++cp) {
|
||||||
case '\\':
|
case '\\':
|
||||||
@@ -6332,7 +6332,7 @@ initoptions_init(void)
|
|||||||
if ((opts = nh_getenv("TERM"))
|
if ((opts = nh_getenv("TERM"))
|
||||||
/* [could also check "xterm" which emulates vtXXX by default] */
|
/* [could also check "xterm" which emulates vtXXX by default] */
|
||||||
&& !strncmpi(opts, "vt", 2)
|
&& !strncmpi(opts, "vt", 2)
|
||||||
&& AS && AE && index(AS, '\016') && index(AE, '\017')) {
|
&& AS && AE && strchr(AS, '\016') && strchr(AE, '\017')) {
|
||||||
if (!g.symset[PRIMARYSET].explicitly)
|
if (!g.symset[PRIMARYSET].explicitly)
|
||||||
load_symset("DECGraphics", PRIMARYSET);
|
load_symset("DECGraphics", PRIMARYSET);
|
||||||
switch_symbols(TRUE);
|
switch_symbols(TRUE);
|
||||||
@@ -6555,7 +6555,7 @@ change_inv_order(char *op)
|
|||||||
int retval = 1;
|
int retval = 1;
|
||||||
|
|
||||||
num = 0;
|
num = 0;
|
||||||
if (!index(op, GOLD_SYM))
|
if (!strchr(op, GOLD_SYM))
|
||||||
buf[num++] = COIN_CLASS;
|
buf[num++] = COIN_CLASS;
|
||||||
|
|
||||||
for (sp = op; *sp; sp++) {
|
for (sp = op; *sp; sp++) {
|
||||||
@@ -6566,14 +6566,14 @@ change_inv_order(char *op)
|
|||||||
config_error_add("Not an object class '%c'", *sp);
|
config_error_add("Not an object class '%c'", *sp);
|
||||||
retval = 0;
|
retval = 0;
|
||||||
fail = TRUE;
|
fail = TRUE;
|
||||||
} else if (!index(flags.inv_order, oc_sym)) {
|
} else if (!strchr(flags.inv_order, oc_sym)) {
|
||||||
/* VENOM_CLASS, RANDOM_CLASS, and ILLOBJ_CLASS are excluded
|
/* VENOM_CLASS, RANDOM_CLASS, and ILLOBJ_CLASS are excluded
|
||||||
because they aren't in def_inv_order[] so don't make it
|
because they aren't in def_inv_order[] so don't make it
|
||||||
into flags.inv_order, hence always fail this index() test */
|
into flags.inv_order, hence always fail this strchr() test */
|
||||||
config_error_add("Object class '%c' not allowed", *sp);
|
config_error_add("Object class '%c' not allowed", *sp);
|
||||||
retval = 0;
|
retval = 0;
|
||||||
fail = TRUE;
|
fail = TRUE;
|
||||||
} else if (index(sp + 1, *sp)) {
|
} else if (strchr(sp + 1, *sp)) {
|
||||||
config_error_add("Duplicate object class '%c'", *sp);
|
config_error_add("Duplicate object class '%c'", *sp);
|
||||||
retval = 0;
|
retval = 0;
|
||||||
fail = TRUE;
|
fail = TRUE;
|
||||||
@@ -6586,7 +6586,7 @@ change_inv_order(char *op)
|
|||||||
|
|
||||||
/* fill in any omitted classes, using previous ordering */
|
/* fill in any omitted classes, using previous ordering */
|
||||||
for (sp = flags.inv_order; *sp; sp++)
|
for (sp = flags.inv_order; *sp; sp++)
|
||||||
if (!index(buf, *sp))
|
if (!strchr(buf, *sp))
|
||||||
(void) strkitten(&buf[num++], *sp);
|
(void) strkitten(&buf[num++], *sp);
|
||||||
buf[MAXOCLASSES - 1] = '\0';
|
buf[MAXOCLASSES - 1] = '\0';
|
||||||
|
|
||||||
@@ -6690,17 +6690,17 @@ parsebindings(char *bindings)
|
|||||||
|
|
||||||
/* look for first comma, then decide whether it is the key being bound
|
/* look for first comma, then decide whether it is the key being bound
|
||||||
or a list element separator; if it's a key, find separator beyond it */
|
or a list element separator; if it's a key, find separator beyond it */
|
||||||
if ((bind = index(bindings, ',')) != 0) {
|
if ((bind = strchr(bindings, ',')) != 0) {
|
||||||
/* at start so it represents a key */
|
/* at start so it represents a key */
|
||||||
if (bind == bindings)
|
if (bind == bindings)
|
||||||
bind = index(bind + 1, ',');
|
bind = strchr(bind + 1, ',');
|
||||||
|
|
||||||
/* to get here, bind is non-Null and not equal to bindings,
|
/* to get here, bind is non-Null and not equal to bindings,
|
||||||
so it is greater than bindings and bind[-1] is valid; check
|
so it is greater than bindings and bind[-1] is valid; check
|
||||||
whether current comma happens to be for "\,:cmd" or "',':cmd"
|
whether current comma happens to be for "\,:cmd" or "',':cmd"
|
||||||
(":cmd" part is assumed if the comma has expected quoting) */
|
(":cmd" part is assumed if the comma has expected quoting) */
|
||||||
else if (bind[-1] == '\\' || (bind[-1] == '\'' && bind[1] == '\''))
|
else if (bind[-1] == '\\' || (bind[-1] == '\'' && bind[1] == '\''))
|
||||||
bind = index(bind + 2, ',');
|
bind = strchr(bind + 2, ',');
|
||||||
}
|
}
|
||||||
/* if a comma separator has been found, break off first binding from rest;
|
/* if a comma separator has been found, break off first binding from rest;
|
||||||
parse the rest and then handle this first one when recursion returns */
|
parse the rest and then handle this first one when recursion returns */
|
||||||
@@ -6711,7 +6711,7 @@ parsebindings(char *bindings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* parse a single binding: first split around : */
|
/* parse a single binding: first split around : */
|
||||||
if (! (bind = index(bindings, ':')))
|
if (! (bind = strchr(bindings, ':')))
|
||||||
return FALSE; /* it's not a binding */
|
return FALSE; /* it's not a binding */
|
||||||
*bind++ = 0;
|
*bind++ = 0;
|
||||||
|
|
||||||
@@ -7336,14 +7336,14 @@ add_menu_coloring(char *tmpstr) /* never Null but could be empty */
|
|||||||
(void) strncpy(str, tmpstr, sizeof str - 1);
|
(void) strncpy(str, tmpstr, sizeof str - 1);
|
||||||
str[sizeof str - 1] = '\0';
|
str[sizeof str - 1] = '\0';
|
||||||
|
|
||||||
if ((cs = index(str, '=')) == 0) {
|
if ((cs = strchr(str, '=')) == 0) {
|
||||||
config_error_add("Malformed MENUCOLOR");
|
config_error_add("Malformed MENUCOLOR");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmps = cs + 1; /* advance past '=' */
|
tmps = cs + 1; /* advance past '=' */
|
||||||
mungspaces(tmps);
|
mungspaces(tmps);
|
||||||
if ((amp = index(tmps, '&')) != 0)
|
if ((amp = strchr(tmps, '&')) != 0)
|
||||||
*amp = '\0';
|
*amp = '\0';
|
||||||
|
|
||||||
c = match_str2clr(tmps);
|
c = match_str2clr(tmps);
|
||||||
@@ -7539,7 +7539,7 @@ add_menu_cmd_alias(char from_ch, char to_ch)
|
|||||||
char
|
char
|
||||||
get_menu_cmd_key(char ch)
|
get_menu_cmd_key(char ch)
|
||||||
{
|
{
|
||||||
char *found = index(g.mapped_menu_op, ch);
|
char *found = strchr(g.mapped_menu_op, ch);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
int idx = (int) (found - g.mapped_menu_op);
|
int idx = (int) (found - g.mapped_menu_op);
|
||||||
@@ -7556,7 +7556,7 @@ get_menu_cmd_key(char ch)
|
|||||||
char
|
char
|
||||||
map_menu_cmd(char ch)
|
map_menu_cmd(char ch)
|
||||||
{
|
{
|
||||||
char *found = index(g.mapped_menu_cmds, ch);
|
char *found = strchr(g.mapped_menu_cmds, ch);
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
int idx = (int) (found - g.mapped_menu_cmds);
|
int idx = (int) (found - g.mapped_menu_cmds);
|
||||||
@@ -8732,7 +8732,7 @@ sym_val(const char *strval) /* up to 4*BUFSZ-1 long; only first few
|
|||||||
|
|
||||||
/* if backslash, handle single or double quote or second backslash */
|
/* if backslash, handle single or double quote or second backslash */
|
||||||
} else if (strval[1] == '\\' && strval[2] && strval[3] == '\''
|
} else if (strval[1] == '\\' && strval[2] && strval[3] == '\''
|
||||||
&& index("'\"\\", strval[2]) && !strval[4]) {
|
&& strchr("'\"\\", strval[2]) && !strval[4]) {
|
||||||
buf[0] = strval[2];
|
buf[0] = strval[2];
|
||||||
|
|
||||||
/* not simple quote or basic backslash;
|
/* not simple quote or basic backslash;
|
||||||
@@ -8743,7 +8743,7 @@ sym_val(const char *strval) /* up to 4*BUFSZ-1 long; only first few
|
|||||||
/* +1: skip opening single quote */
|
/* +1: skip opening single quote */
|
||||||
(void) strncpy(tmp, strval + 1, sizeof tmp - 1);
|
(void) strncpy(tmp, strval + 1, sizeof tmp - 1);
|
||||||
tmp[sizeof tmp - 1] = '\0';
|
tmp[sizeof tmp - 1] = '\0';
|
||||||
if ((p = rindex(tmp, '\'')) != 0) {
|
if ((p = strrchr(tmp, '\'')) != 0) {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
escapes(tmp, buf);
|
escapes(tmp, buf);
|
||||||
} /* else buf[0] stays '\0' */
|
} /* else buf[0] stays '\0' */
|
||||||
@@ -9112,7 +9112,7 @@ choose_classes_menu(const char *prompt,
|
|||||||
impossible("choose_classes_menu: invalid category %d", category);
|
impossible("choose_classes_menu: invalid category %d", category);
|
||||||
}
|
}
|
||||||
if (way && *class_select) { /* Selections there already */
|
if (way && *class_select) { /* Selections there already */
|
||||||
if (index(class_select, *class_list)) {
|
if (strchr(class_select, *class_list)) {
|
||||||
selected = TRUE;
|
selected = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-10
@@ -768,7 +768,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
/* remove enchantment ("+0 aklys"); [for 3.6.0 and earlier, this wasn't
|
/* remove enchantment ("+0 aklys"); [for 3.6.0 and earlier, this wasn't
|
||||||
needed because looking at items on the map used xname() rather than
|
needed because looking at items on the map used xname() rather than
|
||||||
doname() hence known enchantment was implicitly suppressed] */
|
doname() hence known enchantment was implicitly suppressed] */
|
||||||
if (*dbase_str && index("+-", dbase_str[0]) && digit(dbase_str[1])) {
|
if (*dbase_str && strchr("+-", dbase_str[0]) && digit(dbase_str[1])) {
|
||||||
++dbase_str; /* skip sign */
|
++dbase_str; /* skip sign */
|
||||||
while (digit(*dbase_str))
|
while (digit(*dbase_str))
|
||||||
++dbase_str;
|
++dbase_str;
|
||||||
@@ -812,7 +812,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
if (alt && (!strncmpi(alt, "a ", 2)
|
if (alt && (!strncmpi(alt, "a ", 2)
|
||||||
|| !strncmpi(alt, "an ", 3)
|
|| !strncmpi(alt, "an ", 3)
|
||||||
|| !strncmpi(alt, "the ", 4)))
|
|| !strncmpi(alt, "the ", 4)))
|
||||||
alt = index(alt, ' ') + 1;
|
alt = strchr(alt, ' ') + 1;
|
||||||
/* remove charges or "(lit)" or wizmode "(N aum)" */
|
/* remove charges or "(lit)" or wizmode "(N aum)" */
|
||||||
if ((ep = strstri(dbase_str, " (")) != 0 && ep > dbase_str)
|
if ((ep = strstri(dbase_str, " (")) != 0 && ep > dbase_str)
|
||||||
*ep = '\0';
|
*ep = '\0';
|
||||||
@@ -854,7 +854,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
/* a number indicates the end of current entry */
|
/* a number indicates the end of current entry */
|
||||||
skipping_entry = FALSE;
|
skipping_entry = FALSE;
|
||||||
} else if (!skipping_entry) {
|
} else if (!skipping_entry) {
|
||||||
if (!(ep = index(buf, '\n')))
|
if (!(ep = strchr(buf, '\n')))
|
||||||
goto bad_data_file;
|
goto bad_data_file;
|
||||||
(void) strip_newline((ep > buf) ? ep - 1 : ep);
|
(void) strip_newline((ep > buf) ? ep - 1 : ep);
|
||||||
/* if we match a key that begins with "~", skip
|
/* if we match a key that begins with "~", skip
|
||||||
@@ -920,7 +920,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
if (!dlb_fgets(tabbuf, BUFSZ, fp))
|
if (!dlb_fgets(tabbuf, BUFSZ, fp))
|
||||||
goto bad_data_file;
|
goto bad_data_file;
|
||||||
tp = tabbuf;
|
tp = tabbuf;
|
||||||
if (!index(tp, '\n'))
|
if (!strchr(tp, '\n'))
|
||||||
goto bad_data_file;
|
goto bad_data_file;
|
||||||
(void) strip_newline(tp);
|
(void) strip_newline(tp);
|
||||||
/* text in this file is indented with one tab but
|
/* text in this file is indented with one tab but
|
||||||
@@ -940,7 +940,7 @@ checkfile(char *inp, struct permonst *pm, boolean user_typed_name,
|
|||||||
/* if a tab after the leading one is found,
|
/* if a tab after the leading one is found,
|
||||||
convert tabs into spaces; the attributions
|
convert tabs into spaces; the attributions
|
||||||
at the end of quotes typically have them */
|
at the end of quotes typically have them */
|
||||||
if (index(tp, '\t') != 0)
|
if (strchr(tp, '\t') != 0)
|
||||||
(void) tabexpand(tp);
|
(void) tabexpand(tp);
|
||||||
putstr(datawin, 0, tp);
|
putstr(datawin, 0, tp);
|
||||||
}
|
}
|
||||||
@@ -2050,7 +2050,7 @@ whatdoes_cond(char *buf, struct wd_stack_frame *stack, int *depth, int lnum)
|
|||||||
if ((neg = (*buf == '!')) != 0)
|
if ((neg = (*buf == '!')) != 0)
|
||||||
if (*++buf == ' ')
|
if (*++buf == ' ')
|
||||||
++buf;
|
++buf;
|
||||||
p = index(buf, '='), q = index(buf, ':');
|
p = strchr(buf, '='), q = strchr(buf, ':');
|
||||||
if (!p || (q && q < p))
|
if (!p || (q && q < p))
|
||||||
p = q;
|
p = q;
|
||||||
if (p) { /* we have a value specified */
|
if (p) { /* we have a value specified */
|
||||||
@@ -2073,7 +2073,7 @@ whatdoes_cond(char *buf, struct wd_stack_frame *stack, int *depth, int lnum)
|
|||||||
: (-1 * iflags.num_pad_mode); /* -1..0 */
|
: (-1 * iflags.num_pad_mode); /* -1..0 */
|
||||||
newcond = FALSE;
|
newcond = FALSE;
|
||||||
for (; p; p = q) {
|
for (; p; p = q) {
|
||||||
q = index(p, ',');
|
q = strchr(p, ',');
|
||||||
if (q)
|
if (q)
|
||||||
*q++ = '\0';
|
*q++ = '\0';
|
||||||
if (atoi(p) == np) {
|
if (atoi(p) == np) {
|
||||||
@@ -2190,7 +2190,7 @@ dowhatdoes_core(char q, char *cbuf)
|
|||||||
cond = stack[0].active = 1;
|
cond = stack[0].active = 1;
|
||||||
while (dlb_fgets(buf, sizeof buf, fp)) {
|
while (dlb_fgets(buf, sizeof buf, fp)) {
|
||||||
++lnum;
|
++lnum;
|
||||||
if (buf[0] == '&' && buf[1] && index("?:.#", buf[1])) {
|
if (buf[0] == '&' && buf[1] && strchr("?:.#", buf[1])) {
|
||||||
cond = whatdoes_cond(buf, stack, &depth, lnum);
|
cond = whatdoes_cond(buf, stack, &depth, lnum);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2202,7 +2202,7 @@ dowhatdoes_core(char q, char *cbuf)
|
|||||||
: (ctrl ? buf[0] == '^' && highc(buf[1]) == q
|
: (ctrl ? buf[0] == '^' && highc(buf[1]) == q
|
||||||
: buf[0] == q)) {
|
: buf[0] == q)) {
|
||||||
(void) strip_newline(buf);
|
(void) strip_newline(buf);
|
||||||
if (index(buf, '\t'))
|
if (strchr(buf, '\t'))
|
||||||
(void) tabexpand(buf);
|
(void) tabexpand(buf);
|
||||||
if (meta && ctrl && buf[4] == ' ') {
|
if (meta && ctrl && buf[4] == ' ') {
|
||||||
(void) strncpy(buf, "M-^? ", 8);
|
(void) strncpy(buf, "M-^? ", 8);
|
||||||
@@ -2265,7 +2265,7 @@ dowhatdoes(void)
|
|||||||
#endif
|
#endif
|
||||||
reslt = dowhatdoes_core(q, bufr);
|
reslt = dowhatdoes_core(q, bufr);
|
||||||
if (reslt) {
|
if (reslt) {
|
||||||
char *p = index(reslt, '\n'); /* 'm' prefix has two lines of output */
|
char *p = strchr(reslt, '\n'); /* 'm' prefix has two lines of output */
|
||||||
|
|
||||||
if (q == '&' || q == '?')
|
if (q == '&' || q == '?')
|
||||||
whatdoes_help();
|
whatdoes_help();
|
||||||
|
|||||||
+13
-13
@@ -102,10 +102,10 @@ collect_obj_classes(char ilets[], struct obj *otmp, boolean here,
|
|||||||
register char c;
|
register char c;
|
||||||
|
|
||||||
*itemcount = 0;
|
*itemcount = 0;
|
||||||
ilets[iletct] = '\0'; /* terminate ilets so that index() will work */
|
ilets[iletct] = '\0'; /* terminate ilets so that strchr() will work */
|
||||||
while (otmp) {
|
while (otmp) {
|
||||||
c = def_oc_syms[(int) otmp->oclass].sym;
|
c = def_oc_syms[(int) otmp->oclass].sym;
|
||||||
if (!index(ilets, c) && (!filter || (*filter)(otmp)))
|
if (!strchr(ilets, c) && (!filter || (*filter)(otmp)))
|
||||||
ilets[iletct++] = c, ilets[iletct] = '\0';
|
ilets[iletct++] = c, ilets[iletct] = '\0';
|
||||||
*itemcount += 1;
|
*itemcount += 1;
|
||||||
otmp = here ? otmp->nexthere : otmp->nobj;
|
otmp = here ? otmp->nexthere : otmp->nobj;
|
||||||
@@ -208,12 +208,12 @@ query_classes(char oclasses[], boolean *one_at_a_time, boolean *everything,
|
|||||||
goto ask_again;
|
goto ask_again;
|
||||||
} else if (sym == 'm') {
|
} else if (sym == 'm') {
|
||||||
m_seen = TRUE;
|
m_seen = TRUE;
|
||||||
} else if (index("uBUCXP", sym)) {
|
} else if (strchr("uBUCXP", sym)) {
|
||||||
add_valid_menu_class(sym); /* 'u' or 'B','U','C','X','P' */
|
add_valid_menu_class(sym); /* 'u' or 'B','U','C','X','P' */
|
||||||
filtered = TRUE;
|
filtered = TRUE;
|
||||||
} else {
|
} else {
|
||||||
oc_of_sym = def_char_to_objclass(sym);
|
oc_of_sym = def_char_to_objclass(sym);
|
||||||
if (index(ilets, sym)) {
|
if (strchr(ilets, sym)) {
|
||||||
add_valid_menu_class(oc_of_sym);
|
add_valid_menu_class(oc_of_sym);
|
||||||
oclasses[oclassct++] = oc_of_sym;
|
oclasses[oclassct++] = oc_of_sym;
|
||||||
oclasses[oclassct] = '\0';
|
oclasses[oclassct] = '\0';
|
||||||
@@ -401,7 +401,7 @@ n_or_more(struct obj *obj)
|
|||||||
boolean
|
boolean
|
||||||
menu_class_present(int c)
|
menu_class_present(int c)
|
||||||
{
|
{
|
||||||
return (c && index(g.valid_menu_classes, c)) ? TRUE : FALSE;
|
return (c && strchr(g.valid_menu_classes, c)) ? TRUE : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -460,7 +460,7 @@ allow_category(struct obj *obj)
|
|||||||
* is also specified since player has explicitly requested coins.
|
* is also specified since player has explicitly requested coins.
|
||||||
*/
|
*/
|
||||||
if (obj->oclass == COIN_CLASS && g.class_filter)
|
if (obj->oclass == COIN_CLASS && g.class_filter)
|
||||||
return index(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE;
|
return strchr(g.valid_menu_classes, COIN_CLASS) ? TRUE : FALSE;
|
||||||
|
|
||||||
if (Role_if(PM_CLERIC) && !obj->bknown)
|
if (Role_if(PM_CLERIC) && !obj->bknown)
|
||||||
set_bknown(obj, 1);
|
set_bknown(obj, 1);
|
||||||
@@ -485,7 +485,7 @@ allow_category(struct obj *obj)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* if class is expected but obj's class is not in the list, reject */
|
/* if class is expected but obj's class is not in the list, reject */
|
||||||
if (g.class_filter && !index(g.valid_menu_classes, obj->oclass))
|
if (g.class_filter && !strchr(g.valid_menu_classes, obj->oclass))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
/* if unpaid is expected and obj isn't unpaid, reject (treat a container
|
/* if unpaid is expected and obj isn't unpaid, reject (treat a container
|
||||||
holding any unpaid object as unpaid even if isn't unpaid itself) */
|
holding any unpaid object as unpaid even if isn't unpaid itself) */
|
||||||
@@ -509,7 +509,7 @@ allow_category(struct obj *obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if its category is not in the list, reject */
|
/* if its category is not in the list, reject */
|
||||||
if (!index(g.valid_menu_classes, bucx))
|
if (!strchr(g.valid_menu_classes, bucx))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (g.picked_filter && !obj->pickup_prev)
|
if (g.picked_filter && !obj->pickup_prev)
|
||||||
@@ -524,8 +524,8 @@ static boolean
|
|||||||
allow_cat_no_uchain(struct obj *obj)
|
allow_cat_no_uchain(struct obj *obj)
|
||||||
{
|
{
|
||||||
if (obj != uchain
|
if (obj != uchain
|
||||||
&& ((index(g.valid_menu_classes, 'u') && obj->unpaid)
|
&& ((strchr(g.valid_menu_classes, 'u') && obj->unpaid)
|
||||||
|| index(g.valid_menu_classes, obj->oclass)))
|
|| strchr(g.valid_menu_classes, obj->oclass)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -765,7 +765,7 @@ pickup(int what) /* should be a long */
|
|||||||
obj2 = FOLLOW(obj, traverse_how);
|
obj2 = FOLLOW(obj, traverse_how);
|
||||||
if (bycat ? !allow_category(obj)
|
if (bycat ? !allow_category(obj)
|
||||||
: (!selective && oclasses[0]
|
: (!selective && oclasses[0]
|
||||||
&& !index(oclasses, obj->oclass)))
|
&& !strchr(oclasses, obj->oclass)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
lcount = -1L;
|
lcount = -1L;
|
||||||
@@ -865,7 +865,7 @@ autopick_testobj(struct obj *otmp, boolean calc_costly)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* check for pickup_types */
|
/* check for pickup_types */
|
||||||
pickit = (!*otypes || index(otypes, otmp->oclass));
|
pickit = (!*otypes || strchr(otypes, otmp->oclass));
|
||||||
|
|
||||||
/* check for autopickup exceptions */
|
/* check for autopickup exceptions */
|
||||||
ape = check_autopickup_exceptions(otmp);
|
ape = check_autopickup_exceptions(otmp);
|
||||||
@@ -1758,7 +1758,7 @@ pick_obj(struct obj *otmp)
|
|||||||
/* sets obj->unpaid if necessary */
|
/* sets obj->unpaid if necessary */
|
||||||
addtobill(otmp, TRUE, FALSE, FALSE);
|
addtobill(otmp, TRUE, FALSE, FALSE);
|
||||||
Strcpy(u.ushops, saveushops);
|
Strcpy(u.ushops, saveushops);
|
||||||
robshop = otmp->unpaid && !index(u.ushops, *fakeshop);
|
robshop = otmp->unpaid && !strchr(u.ushops, *fakeshop);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = addinv(otmp);
|
result = addinv(otmp);
|
||||||
|
|||||||
+2
-2
@@ -113,7 +113,7 @@ vpline(const char *line, va_list the_args)
|
|||||||
if (g.program_state.wizkit_wishing)
|
if (g.program_state.wizkit_wishing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (index(line, '%')) {
|
if (strchr(line, '%')) {
|
||||||
#if !defined(NO_VSNPRINTF)
|
#if !defined(NO_VSNPRINTF)
|
||||||
vlen = vsnprintf(pbuf, sizeof(pbuf), line, the_args);
|
vlen = vsnprintf(pbuf, sizeof(pbuf), line, the_args);
|
||||||
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG)
|
#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) && defined(DEBUG)
|
||||||
@@ -475,7 +475,7 @@ vraw_printf(const char *line, va_list the_args)
|
|||||||
{
|
{
|
||||||
char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
|
char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
|
||||||
|
|
||||||
if (index(line, '%')) {
|
if (strchr(line, '%')) {
|
||||||
#if !defined(NO_VSNPRINTF)
|
#if !defined(NO_VSNPRINTF)
|
||||||
(void) vsnprintf(pbuf, sizeof(pbuf), line, the_args);
|
(void) vsnprintf(pbuf, sizeof(pbuf), line, the_args);
|
||||||
#else
|
#else
|
||||||
|
|||||||
+1
-1
@@ -1947,7 +1947,7 @@ mbodypart(struct monst *mon, int part)
|
|||||||
}
|
}
|
||||||
if ((part == HAND || part == HANDED)
|
if ((part == HAND || part == HANDED)
|
||||||
&& (humanoid(mptr) && attacktype(mptr, AT_CLAW)
|
&& (humanoid(mptr) && attacktype(mptr, AT_CLAW)
|
||||||
&& !index(not_claws, mptr->mlet) && mptr != &mons[PM_STONE_GOLEM]
|
&& !strchr(not_claws, mptr->mlet) && mptr != &mons[PM_STONE_GOLEM]
|
||||||
&& mptr != &mons[PM_AMOROUS_DEMON]))
|
&& mptr != &mons[PM_AMOROUS_DEMON]))
|
||||||
return (part == HAND) ? "claw" : "clawed";
|
return (part == HAND) ? "claw" : "clawed";
|
||||||
if ((mptr == &mons[PM_MUMAK] || mptr == &mons[PM_MASTODON])
|
if ((mptr == &mons[PM_MUMAK] || mptr == &mons[PM_MASTODON])
|
||||||
|
|||||||
+1
-1
@@ -197,7 +197,7 @@ pri_move(struct monst *priest)
|
|||||||
Your("displaced image doesn't fool %s!", mon_nam(priest));
|
Your("displaced image doesn't fool %s!", mon_nam(priest));
|
||||||
(void) mattacku(priest);
|
(void) mattacku(priest);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (index(u.urooms, temple)) {
|
} else if (strchr(u.urooms, temple)) {
|
||||||
/* chase player if inside temple & can see him */
|
/* chase player if inside temple & can see him */
|
||||||
if (priest->mcansee && m_canseeu(priest)) {
|
if (priest->mcansee && m_canseeu(priest)) {
|
||||||
gx = u.ux;
|
gx = u.ux;
|
||||||
|
|||||||
+2
-2
@@ -364,7 +364,7 @@ convert_line(char *in_line, char *out_line)
|
|||||||
case 'I':
|
case 'I':
|
||||||
case 'j': /* his/her */
|
case 'j': /* his/her */
|
||||||
case 'J':
|
case 'J':
|
||||||
if (index("dlno", lowc(*(c - 1))))
|
if (strchr("dlno", lowc(*(c - 1))))
|
||||||
qtext_pronoun(*(c - 1), *c);
|
qtext_pronoun(*(c - 1), *c);
|
||||||
else
|
else
|
||||||
--c; /* default action */
|
--c; /* default action */
|
||||||
@@ -568,7 +568,7 @@ com_pager_core(
|
|||||||
/* switch from by_pline to by_window if line has multiple segments or
|
/* switch from by_pline to by_window if line has multiple segments or
|
||||||
is unreasonably long (the latter ought to checked after formatting
|
is unreasonably long (the latter ought to checked after formatting
|
||||||
conversions rather than before...) */
|
conversions rather than before...) */
|
||||||
if (output == 0 && (index(text, '\n') || strlen(text) >= BUFSZ - 1)) {
|
if (output == 0 && (strchr(text, '\n') || strlen(text) >= BUFSZ - 1)) {
|
||||||
output = 2;
|
output = 2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+1
-1
@@ -405,7 +405,7 @@ doread(void)
|
|||||||
int ln = (int) strlen(mesg);
|
int ln = (int) strlen(mesg);
|
||||||
|
|
||||||
/* we will be displaying a sentence; need ending punctuation */
|
/* we will be displaying a sentence; need ending punctuation */
|
||||||
if (ln > 0 && !index(".!?", mesg[ln - 1]))
|
if (ln > 0 && !strchr(".!?", mesg[ln - 1]))
|
||||||
endpunct = ".";
|
endpunct = ".";
|
||||||
pline("It reads:");
|
pline("It reads:");
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1623,12 +1623,12 @@ plnamesuffix(void)
|
|||||||
|
|
||||||
/* Look for tokens delimited by '-' */
|
/* Look for tokens delimited by '-' */
|
||||||
sptr = g.plname + g.plnamelen;
|
sptr = g.plname + g.plnamelen;
|
||||||
if ((eptr = index(sptr, '-')) != (char *) 0)
|
if ((eptr = strchr(sptr, '-')) != (char *) 0)
|
||||||
*eptr++ = '\0';
|
*eptr++ = '\0';
|
||||||
while (eptr) {
|
while (eptr) {
|
||||||
/* Isolate the next token */
|
/* Isolate the next token */
|
||||||
sptr = eptr;
|
sptr = eptr;
|
||||||
if ((eptr = index(sptr, '-')) != (char *) 0)
|
if ((eptr = strchr(sptr, '-')) != (char *) 0)
|
||||||
*eptr++ = '\0';
|
*eptr++ = '\0';
|
||||||
|
|
||||||
/* Try to match it to something */
|
/* Try to match it to something */
|
||||||
@@ -1705,7 +1705,7 @@ role_selection_prolog(int which, winid where)
|
|||||||
/* distinct female name [caveman/cavewoman, priest/priestess] */
|
/* distinct female name [caveman/cavewoman, priest/priestess] */
|
||||||
if (gend == 1)
|
if (gend == 1)
|
||||||
/* female specified; replace male role name with female one */
|
/* female specified; replace male role name with female one */
|
||||||
Sprintf(index(buf, ':'), ": %s", roles[r].name.f);
|
Sprintf(strchr(buf, ':'), ": %s", roles[r].name.f);
|
||||||
else if (gend < 0)
|
else if (gend < 0)
|
||||||
/* gender unspecified; append slash and female role name */
|
/* gender unspecified; append slash and female role name */
|
||||||
Sprintf(eos(buf), "/%s", roles[r].name.f);
|
Sprintf(eos(buf), "/%s", roles[r].name.f);
|
||||||
|
|||||||
+12
-12
@@ -228,7 +228,7 @@ rumor_check(void)
|
|||||||
(void) dlb_fseek(rumors, (long) g.true_rumor_start, SEEK_SET);
|
(void) dlb_fseek(rumors, (long) g.true_rumor_start, SEEK_SET);
|
||||||
ftell_rumor_start = dlb_ftell(rumors);
|
ftell_rumor_start = dlb_ftell(rumors);
|
||||||
(void) dlb_fgets(line, sizeof line, rumors);
|
(void) dlb_fgets(line, sizeof line, rumors);
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
Sprintf(rumor_buf, "T %06ld %s", ftell_rumor_start,
|
Sprintf(rumor_buf, "T %06ld %s", ftell_rumor_start,
|
||||||
xcrypt(line, xbuf));
|
xcrypt(line, xbuf));
|
||||||
@@ -237,7 +237,7 @@ rumor_check(void)
|
|||||||
while (dlb_fgets(line, sizeof line, rumors)
|
while (dlb_fgets(line, sizeof line, rumors)
|
||||||
&& dlb_ftell(rumors) < g.true_rumor_end)
|
&& dlb_ftell(rumors) < g.true_rumor_end)
|
||||||
continue;
|
continue;
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
Sprintf(rumor_buf, " %6s %s", "", xcrypt(line, xbuf));
|
Sprintf(rumor_buf, " %6s %s", "", xcrypt(line, xbuf));
|
||||||
putstr(tmpwin, 0, rumor_buf);
|
putstr(tmpwin, 0, rumor_buf);
|
||||||
@@ -246,7 +246,7 @@ rumor_check(void)
|
|||||||
(void) dlb_fseek(rumors, (long) g.false_rumor_start, SEEK_SET);
|
(void) dlb_fseek(rumors, (long) g.false_rumor_start, SEEK_SET);
|
||||||
ftell_rumor_start = dlb_ftell(rumors);
|
ftell_rumor_start = dlb_ftell(rumors);
|
||||||
(void) dlb_fgets(line, sizeof line, rumors);
|
(void) dlb_fgets(line, sizeof line, rumors);
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
Sprintf(rumor_buf, "F %06ld %s", ftell_rumor_start,
|
Sprintf(rumor_buf, "F %06ld %s", ftell_rumor_start,
|
||||||
xcrypt(line, xbuf));
|
xcrypt(line, xbuf));
|
||||||
@@ -255,7 +255,7 @@ rumor_check(void)
|
|||||||
while (dlb_fgets(line, sizeof line, rumors)
|
while (dlb_fgets(line, sizeof line, rumors)
|
||||||
&& dlb_ftell(rumors) < g.false_rumor_end)
|
&& dlb_ftell(rumors) < g.false_rumor_end)
|
||||||
continue;
|
continue;
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
Sprintf(rumor_buf, " %6s %s", "", xcrypt(line, xbuf));
|
Sprintf(rumor_buf, " %6s %s", "", xcrypt(line, xbuf));
|
||||||
putstr(tmpwin, 0, rumor_buf);
|
putstr(tmpwin, 0, rumor_buf);
|
||||||
@@ -329,7 +329,7 @@ others_check(
|
|||||||
putstr(tmpwin, 0, xbuf);
|
putstr(tmpwin, 0, xbuf);
|
||||||
/* show the bad line; we don't know whether it has been
|
/* show the bad line; we don't know whether it has been
|
||||||
encrypted via xcrypt() so show it both ways */
|
encrypted via xcrypt() so show it both ways */
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
putstr(tmpwin, 0, "- first line, as is");
|
putstr(tmpwin, 0, "- first line, as is");
|
||||||
putstr(tmpwin, 0, line);
|
putstr(tmpwin, 0, line);
|
||||||
@@ -349,19 +349,19 @@ others_check(
|
|||||||
goto closeit;
|
goto closeit;
|
||||||
}
|
}
|
||||||
++entrycount;
|
++entrycount;
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
||||||
if (!dlb_fgets(line, sizeof line, fh)) {
|
if (!dlb_fgets(line, sizeof line, fh)) {
|
||||||
putstr(tmpwin, 0, "(no second entry)");
|
putstr(tmpwin, 0, "(no second entry)");
|
||||||
} else {
|
} else {
|
||||||
++entrycount;
|
++entrycount;
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
||||||
while (dlb_fgets(line, sizeof line, fh)) {
|
while (dlb_fgets(line, sizeof line, fh)) {
|
||||||
++entrycount;
|
++entrycount;
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
(void) xcrypt(line, xbuf);
|
(void) xcrypt(line, xbuf);
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ get_rnd_line(
|
|||||||
(void) dlb_fseek(fh, startpos, SEEK_SET);
|
(void) dlb_fseek(fh, startpos, SEEK_SET);
|
||||||
(void) dlb_fgets(buf, bufsiz, fh);
|
(void) dlb_fgets(buf, bufsiz, fh);
|
||||||
}
|
}
|
||||||
if ((newl = index(buf, '\n')) != 0)
|
if ((newl = strchr(buf, '\n')) != 0)
|
||||||
*newl = '\0';
|
*newl = '\0';
|
||||||
/* decrypt line; make sure that our intermediate buffer is big enough */
|
/* decrypt line; make sure that our intermediate buffer is big enough */
|
||||||
xbufp = (strlen(buf) <= sizeof xbuf - 1) ? &xbuf[0]
|
xbufp = (strlen(buf) <= sizeof xbuf - 1) ? &xbuf[0]
|
||||||
@@ -660,7 +660,7 @@ outoracle(boolean special, boolean delphi)
|
|||||||
putstr(tmpwin, 0, "");
|
putstr(tmpwin, 0, "");
|
||||||
|
|
||||||
while (dlb_fgets(line, COLNO, oracles) && strcmp(line, "---\n")) {
|
while (dlb_fgets(line, COLNO, oracles) && strcmp(line, "---\n")) {
|
||||||
if ((endp = index(line, '\n')) != 0)
|
if ((endp = strchr(line, '\n')) != 0)
|
||||||
*endp = 0;
|
*endp = 0;
|
||||||
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
putstr(tmpwin, 0, xcrypt(line, xbuf));
|
||||||
}
|
}
|
||||||
@@ -858,12 +858,12 @@ init_CapMons(void)
|
|||||||
gender and/or to distinguish an individual from a type
|
gender and/or to distinguish an individual from a type
|
||||||
(code is a single punctuation character when present) */
|
(code is a single punctuation character when present) */
|
||||||
while (dlb_fgets(hline, sizeof hline, bogonfile)) {
|
while (dlb_fgets(hline, sizeof hline, bogonfile)) {
|
||||||
if ((endp = index(hline, '\n')) != 0)
|
if ((endp = strchr(hline, '\n')) != 0)
|
||||||
*endp = '\0'; /* strip newline */
|
*endp = '\0'; /* strip newline */
|
||||||
(void) xcrypt(hline, xbuf);
|
(void) xcrypt(hline, xbuf);
|
||||||
unpadline(xbuf);
|
unpadline(xbuf);
|
||||||
|
|
||||||
if (!xbuf[0] || !index(bogon_codes, xbuf[0]))
|
if (!xbuf[0] || !strchr(bogon_codes, xbuf[0]))
|
||||||
code = '\0', startp = &xbuf[0]; /* ordinary */
|
code = '\0', startp = &xbuf[0]; /* ordinary */
|
||||||
else
|
else
|
||||||
code = xbuf[0], startp = &xbuf[1]; /* special */
|
code = xbuf[0], startp = &xbuf[1]; /* special */
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ shkgone(struct monst* mtmp)
|
|||||||
|
|
||||||
/* Make sure bill is set only when the
|
/* Make sure bill is set only when the
|
||||||
dead shk is the resident shk. */
|
dead shk is the resident shk. */
|
||||||
if ((p = index(u.ushops, eshk->shoproom)) != 0) {
|
if ((p = strchr(u.ushops, eshk->shoproom)) != 0) {
|
||||||
setpaid(mtmp);
|
setpaid(mtmp);
|
||||||
eshk->bill_p = (struct bill_x *) 0;
|
eshk->bill_p = (struct bill_x *) 0;
|
||||||
/* remove eshk->shoproom from u.ushops */
|
/* remove eshk->shoproom from u.ushops */
|
||||||
@@ -562,7 +562,7 @@ u_entered_shop(char* enterstring)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(shkp = shop_keeper(*enterstring))) {
|
if (!(shkp = shop_keeper(*enterstring))) {
|
||||||
if (!index(empty_shops, *enterstring)
|
if (!strchr(empty_shops, *enterstring)
|
||||||
&& in_rooms(u.ux, u.uy, SHOPBASE)
|
&& in_rooms(u.ux, u.uy, SHOPBASE)
|
||||||
!= in_rooms(u.ux0, u.uy0, SHOPBASE))
|
!= in_rooms(u.ux0, u.uy0, SHOPBASE))
|
||||||
deserted_shop(enterstring);
|
deserted_shop(enterstring);
|
||||||
@@ -576,7 +576,7 @@ u_entered_shop(char* enterstring)
|
|||||||
if (!inhishop(shkp)) {
|
if (!inhishop(shkp)) {
|
||||||
/* dump core when referenced */
|
/* dump core when referenced */
|
||||||
eshkp->bill_p = (struct bill_x *) -1000;
|
eshkp->bill_p = (struct bill_x *) -1000;
|
||||||
if (!index(empty_shops, *enterstring))
|
if (!strchr(empty_shops, *enterstring))
|
||||||
deserted_shop(enterstring);
|
deserted_shop(enterstring);
|
||||||
Strcpy(empty_shops, u.ushops);
|
Strcpy(empty_shops, u.ushops);
|
||||||
u.ushops[0] = '\0';
|
u.ushops[0] = '\0';
|
||||||
@@ -825,7 +825,7 @@ inhishop(register struct monst* mtmp)
|
|||||||
{
|
{
|
||||||
struct eshk *eshkp = ESHK(mtmp);
|
struct eshk *eshkp = ESHK(mtmp);
|
||||||
|
|
||||||
return (index(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), eshkp->shoproom)
|
return (strchr(in_rooms(mtmp->mx, mtmp->my, SHOPBASE), eshkp->shoproom)
|
||||||
&& on_level(&eshkp->shoplevel, &u.uz));
|
&& on_level(&eshkp->shoplevel, &u.uz));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1734,7 +1734,7 @@ paybill(
|
|||||||
mtmp2 = mtmp->nmon;
|
mtmp2 = mtmp->nmon;
|
||||||
eshkp = ESHK(mtmp);
|
eshkp = ESHK(mtmp);
|
||||||
local = on_level(&eshkp->shoplevel, &u.uz);
|
local = on_level(&eshkp->shoplevel, &u.uz);
|
||||||
if (local && index(u.ushops, eshkp->shoproom)) {
|
if (local && strchr(u.ushops, eshkp->shoproom)) {
|
||||||
/* inside this shk's shop [there might be more than one
|
/* inside this shk's shop [there might be more than one
|
||||||
resident shk if hero is standing in a breech of a shared
|
resident shk if hero is standing in a breech of a shared
|
||||||
wall, so give priority to one who's also owed money] */
|
wall, so give priority to one who's also owed money] */
|
||||||
@@ -3568,7 +3568,7 @@ repairable_damage(struct damage *dam, struct monst *shkp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* does it belong to shkp? */
|
/* does it belong to shkp? */
|
||||||
if (!index(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom))
|
if (!strchr(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -3622,7 +3622,7 @@ discard_damage_owned_by(struct monst *shkp)
|
|||||||
while (dam) {
|
while (dam) {
|
||||||
coordxy x = dam->place.x, y = dam->place.y;
|
coordxy x = dam->place.x, y = dam->place.y;
|
||||||
|
|
||||||
if (index(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom)) {
|
if (strchr(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom)) {
|
||||||
dam2 = dam->next;
|
dam2 = dam->next;
|
||||||
if (prevdam)
|
if (prevdam)
|
||||||
prevdam->next = dam2;
|
prevdam->next = dam2;
|
||||||
|
|||||||
+4
-4
@@ -150,15 +150,15 @@ temple_priest_sound(struct monst *mtmp)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
msg = temple_msg[rn2(SIZE(temple_msg) - 1 + hallu)];
|
msg = temple_msg[rn2(SIZE(temple_msg) - 1 + hallu)];
|
||||||
if (index(msg, '*') && speechless)
|
if (strchr(msg, '*') && speechless)
|
||||||
continue;
|
continue;
|
||||||
if (index(msg, '#') && in_sight)
|
if (strchr(msg, '#') && in_sight)
|
||||||
continue;
|
continue;
|
||||||
break; /* msg is acceptable */
|
break; /* msg is acceptable */
|
||||||
} while (++trycount < 50);
|
} while (++trycount < 50);
|
||||||
while (!letter(*msg))
|
while (!letter(*msg))
|
||||||
++msg; /* skip control flags */
|
++msg; /* skip control flags */
|
||||||
if (index(msg, '%')) {
|
if (strchr(msg, '%')) {
|
||||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||||
You_hear(msg, halu_gname(EPRI(mtmp)->shralign));
|
You_hear(msg, halu_gname(EPRI(mtmp)->shralign));
|
||||||
RESTORE_WARNING_FORMAT_NONLITERAL
|
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||||
@@ -305,7 +305,7 @@ dosounds(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tended_shop(sroom)
|
if (tended_shop(sroom)
|
||||||
&& !index(u.ushops, (int) (ROOM_INDEX(sroom) + ROOMOFFSET))) {
|
&& !strchr(u.ushops, (int) (ROOM_INDEX(sroom) + ROOMOFFSET))) {
|
||||||
static const char *const shop_msg[3] = {
|
static const char *const shop_msg[3] = {
|
||||||
"someone cursing shoplifters.",
|
"someone cursing shoplifters.",
|
||||||
"the chime of a cash register.", "Neiman and Marcus arguing!",
|
"the chime of a cash register.", "Neiman and Marcus arguing!",
|
||||||
|
|||||||
+1
-1
@@ -237,7 +237,7 @@ mapfrag_fromstr(char *str)
|
|||||||
mf->hei = 0;
|
mf->hei = 0;
|
||||||
tmps = mf->data;
|
tmps = mf->data;
|
||||||
while (tmps && *tmps) {
|
while (tmps && *tmps) {
|
||||||
char *s1 = index(tmps, '\n');
|
char *s1 = strchr(tmps, '\n');
|
||||||
|
|
||||||
if (mf->hei > MAP_Y_LIM) {
|
if (mf->hei > MAP_Y_LIM) {
|
||||||
free(mf->data);
|
free(mf->data);
|
||||||
|
|||||||
+1
-1
@@ -719,7 +719,7 @@ getspell(int* spell_no)
|
|||||||
ilet = yn_function(qbuf, (char *) 0, '\0', TRUE);
|
ilet = yn_function(qbuf, (char *) 0, '\0', TRUE);
|
||||||
if (ilet == '*' || ilet == '?')
|
if (ilet == '*' || ilet == '?')
|
||||||
break; /* use menu mode */
|
break; /* use menu mode */
|
||||||
if (index(quitchars, ilet))
|
if (strchr(quitchars, ilet))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
idx = spell_let_to_idx(ilet);
|
idx = spell_let_to_idx(ilet);
|
||||||
|
|||||||
+1
-1
@@ -689,7 +689,7 @@ mdrop_obj(
|
|||||||
if (unwornmask && mon->mtame && (unwornmask & W_SADDLE) != 0L
|
if (unwornmask && mon->mtame && (unwornmask & W_SADDLE) != 0L
|
||||||
&& !obj->unpaid && costly_spot(omx, omy)
|
&& !obj->unpaid && costly_spot(omx, omy)
|
||||||
/* being at costly_spot guarantees lev->roomno is not 0 */
|
/* being at costly_spot guarantees lev->roomno is not 0 */
|
||||||
&& index(in_rooms(u.ux, u.uy, SHOPBASE), levl[omx][omy].roomno)) {
|
&& strchr(in_rooms(u.ux, u.uy, SHOPBASE), levl[omx][omy].roomno)) {
|
||||||
obj->no_charge = 1;
|
obj->no_charge = 1;
|
||||||
}
|
}
|
||||||
/* obj_no_longer_held(obj); -- done by place_object */
|
/* obj_no_longer_held(obj); -- done by place_object */
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ can_saddle(struct monst* mtmp)
|
|||||||
{
|
{
|
||||||
struct permonst *ptr = mtmp->data;
|
struct permonst *ptr = mtmp->data;
|
||||||
|
|
||||||
return (index(steeds, ptr->mlet) && (ptr->msize >= MZ_MEDIUM)
|
return (strchr(steeds, ptr->mlet) && (ptr->msize >= MZ_MEDIUM)
|
||||||
&& (!humanoid(ptr) || ptr->mlet == S_CENTAUR) && !amorphous(ptr)
|
&& (!humanoid(ptr) || ptr->mlet == S_CENTAUR) && !amorphous(ptr)
|
||||||
&& !noncorporeal(ptr) && !is_whirly(ptr) && !unsolid(ptr));
|
&& !noncorporeal(ptr) && !is_whirly(ptr) && !unsolid(ptr));
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -434,12 +434,12 @@ parse_sym_line(char *buf, int which_set)
|
|||||||
separating space slips through; for handling or set description,
|
separating space slips through; for handling or set description,
|
||||||
symbol set creator is responsible for preceding '#' with a space
|
symbol set creator is responsible for preceding '#' with a space
|
||||||
and that comment itself doesn't contain " #") */
|
and that comment itself doesn't contain " #") */
|
||||||
if ((commentp = rindex(buf, '#')) != 0 && commentp[-1] == ' ')
|
if ((commentp = strrchr(buf, '#')) != 0 && commentp[-1] == ' ')
|
||||||
commentp[-1] = '\0';
|
commentp[-1] = '\0';
|
||||||
|
|
||||||
/* find the '=' or ':' */
|
/* find the '=' or ':' */
|
||||||
bufp = index(buf, '=');
|
bufp = strchr(buf, '=');
|
||||||
altp = index(buf, ':');
|
altp = strchr(buf, ':');
|
||||||
if (!bufp || (altp && altp < bufp))
|
if (!bufp || (altp && altp < bufp))
|
||||||
bufp = altp;
|
bufp = altp;
|
||||||
if (!bufp) {
|
if (!bufp) {
|
||||||
@@ -747,7 +747,7 @@ parsesymbols(register char *opts, int which_set)
|
|||||||
* "S_sample=','" or "S_sample=':'".
|
* "S_sample=','" or "S_sample=':'".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((op = index(opts, ',')) != 0) {
|
if ((op = strchr(opts, ',')) != 0) {
|
||||||
*op++ = '\0';
|
*op++ = '\0';
|
||||||
if (!parsesymbols(op, which_set))
|
if (!parsesymbols(op, which_set))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -755,9 +755,9 @@ parsesymbols(register char *opts, int which_set)
|
|||||||
|
|
||||||
/* S_sample:string */
|
/* S_sample:string */
|
||||||
symname = opts;
|
symname = opts;
|
||||||
strval = index(opts, ':');
|
strval = strchr(opts, ':');
|
||||||
if (!strval)
|
if (!strval)
|
||||||
strval = index(opts, '=');
|
strval = strchr(opts, '=');
|
||||||
if (!strval)
|
if (!strval)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*strval++ = '\0';
|
*strval++ = '\0';
|
||||||
@@ -813,7 +813,7 @@ match_sym(char *buf)
|
|||||||
{ "S_explode8", "S_expl_bc" }, { "S_explode9", "S_expl_br" },
|
{ "S_explode8", "S_expl_bc" }, { "S_explode9", "S_expl_br" },
|
||||||
};
|
};
|
||||||
size_t len = strlen(buf);
|
size_t len = strlen(buf);
|
||||||
const char *p = index(buf, ':'), *q = index(buf, '=');
|
const char *p = strchr(buf, ':'), *q = strchr(buf, '=');
|
||||||
const struct symparse *sp = loadsyms;
|
const struct symparse *sp = loadsyms;
|
||||||
|
|
||||||
if (!p || (q && q < p))
|
if (!p || (q && q < p))
|
||||||
|
|||||||
+2
-2
@@ -1657,9 +1657,9 @@ rloco(register struct obj* obj)
|
|||||||
} else {
|
} else {
|
||||||
if (costly_spot(otx, oty)
|
if (costly_spot(otx, oty)
|
||||||
&& (!costly_spot(tx, ty)
|
&& (!costly_spot(tx, ty)
|
||||||
|| !index(in_rooms(tx, ty, 0), *in_rooms(otx, oty, 0)))) {
|
|| !strchr(in_rooms(tx, ty, 0), *in_rooms(otx, oty, 0)))) {
|
||||||
if (costly_spot(u.ux, u.uy)
|
if (costly_spot(u.ux, u.uy)
|
||||||
&& index(u.urooms, *in_rooms(otx, oty, 0)))
|
&& strchr(u.urooms, *in_rooms(otx, oty, 0)))
|
||||||
addtobill(obj, FALSE, FALSE, FALSE);
|
addtobill(obj, FALSE, FALSE, FALSE);
|
||||||
else
|
else
|
||||||
(void) stolen_value(obj, otx, oty, FALSE, FALSE);
|
(void) stolen_value(obj, otx, oty, FALSE, FALSE);
|
||||||
|
|||||||
+3
-3
@@ -274,7 +274,7 @@ choke_dialogue(void)
|
|||||||
} else {
|
} else {
|
||||||
const char *str = choke_texts[SIZE(choke_texts) - i];
|
const char *str = choke_texts[SIZE(choke_texts) - i];
|
||||||
|
|
||||||
if (index(str, '%'))
|
if (strchr(str, '%'))
|
||||||
urgent_pline(str, hcolor(NH_BLUE));
|
urgent_pline(str, hcolor(NH_BLUE));
|
||||||
else
|
else
|
||||||
urgent_pline("%s", str);
|
urgent_pline("%s", str);
|
||||||
@@ -335,7 +335,7 @@ levitation_dialogue(void)
|
|||||||
if (((HLevitation & TIMEOUT) % 2L) && i > 0L && i <= SIZE(levi_texts)) {
|
if (((HLevitation & TIMEOUT) % 2L) && i > 0L && i <= SIZE(levi_texts)) {
|
||||||
const char *s = levi_texts[SIZE(levi_texts) - i];
|
const char *s = levi_texts[SIZE(levi_texts) - i];
|
||||||
|
|
||||||
if (index(s, '%')) {
|
if (strchr(s, '%')) {
|
||||||
boolean danger = (is_pool_or_lava(u.ux, u.uy)
|
boolean danger = (is_pool_or_lava(u.ux, u.uy)
|
||||||
&& !Is_waterlevel(&u.uz));
|
&& !Is_waterlevel(&u.uz));
|
||||||
|
|
||||||
@@ -377,7 +377,7 @@ slime_dialogue(void)
|
|||||||
if (nolimbs(g.youmonst.data) && strstri(buf, "limbs"))
|
if (nolimbs(g.youmonst.data) && strstri(buf, "limbs"))
|
||||||
(void) strsubst(buf, "limbs", "extremities");
|
(void) strsubst(buf, "limbs", "extremities");
|
||||||
|
|
||||||
if (index(buf, '%')) {
|
if (strchr(buf, '%')) {
|
||||||
if (i == 4L) { /* "you are turning green" */
|
if (i == 4L) { /* "you are turning green" */
|
||||||
if (!Blind) /* [what if you're already green?] */
|
if (!Blind) /* [what if you're already green?] */
|
||||||
urgent_pline(buf, hcolor(NH_GREEN));
|
urgent_pline(buf, hcolor(NH_GREEN));
|
||||||
|
|||||||
+6
-6
@@ -248,7 +248,7 @@ readentry(FILE* rfile, struct toptenentry* tt)
|
|||||||
if (!fgets(inbuf, sizeof inbuf, rfile)) {
|
if (!fgets(inbuf, sizeof inbuf, rfile)) {
|
||||||
/* sscanf will fail and tt->points will be set to 0 */
|
/* sscanf will fail and tt->points will be set to 0 */
|
||||||
*inbuf = '\0';
|
*inbuf = '\0';
|
||||||
} else if (!index(inbuf, '\n')) {
|
} else if (!strchr(inbuf, '\n')) {
|
||||||
Strcpy(&inbuf[sizeof inbuf - 2], "\n");
|
Strcpy(&inbuf[sizeof inbuf - 2], "\n");
|
||||||
discardexcess(rfile);
|
discardexcess(rfile);
|
||||||
}
|
}
|
||||||
@@ -963,7 +963,7 @@ outentry(int rank, struct toptenentry* t1, boolean so)
|
|||||||
!strncmp(" (", t1->death + 7, 2) ? t1->death + 7 + 2 : "",
|
!strncmp(" (", t1->death + 7, 2) ? t1->death + 7 + 2 : "",
|
||||||
t1->maxlvl);
|
t1->maxlvl);
|
||||||
/* fixup for closing paren in "escaped... with...Amulet)[max..." */
|
/* fixup for closing paren in "escaped... with...Amulet)[max..." */
|
||||||
if ((bp = index(linebuf, ')')) != 0)
|
if ((bp = strchr(linebuf, ')')) != 0)
|
||||||
*bp = (t1->deathdnum == astral_level.dnum) ? '\0' : ' ';
|
*bp = (t1->deathdnum == astral_level.dnum) ? '\0' : ' ';
|
||||||
second_line = FALSE;
|
second_line = FALSE;
|
||||||
} else if (!strncmp("ascended", t1->death, 8)) {
|
} else if (!strncmp("ascended", t1->death, 8)) {
|
||||||
@@ -1110,7 +1110,7 @@ score_wanted(
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i = 0; i < playerct; i++) {
|
for (i = 0; i < playerct; i++) {
|
||||||
if (players[i][0] == '-' && index("pr", players[i][1])
|
if (players[i][0] == '-' && strchr("pr", players[i][1])
|
||||||
&& players[i][2] == 0 && i + 1 < playerct) {
|
&& players[i][2] == 0 && i + 1 < playerct) {
|
||||||
const char *arg = players[i + 1];
|
const char *arg = players[i + 1];
|
||||||
if ((players[i][1] == 'p'
|
if ((players[i][1] == 'p'
|
||||||
@@ -1255,7 +1255,7 @@ prscore(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
Strcat(pbuf, players[i]);
|
Strcat(pbuf, players[i]);
|
||||||
if (i < playerct - 1) {
|
if (i < playerct - 1) {
|
||||||
if (players[i][0] == '-' && index("pr", players[i][1])
|
if (players[i][0] == '-' && strchr("pr", players[i][1])
|
||||||
&& players[i][2] == 0)
|
&& players[i][2] == 0)
|
||||||
Strcat(pbuf, " ");
|
Strcat(pbuf, " ");
|
||||||
else
|
else
|
||||||
@@ -1377,7 +1377,7 @@ static void
|
|||||||
nsb_mung_line(p)
|
nsb_mung_line(p)
|
||||||
char *p;
|
char *p;
|
||||||
{
|
{
|
||||||
while ((p = index(p, ' ')) != 0)
|
while ((p = strchr(p, ' ')) != 0)
|
||||||
*p = '|';
|
*p = '|';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1385,7 +1385,7 @@ static void
|
|||||||
nsb_unmung_line(p)
|
nsb_unmung_line(p)
|
||||||
char *p;
|
char *p;
|
||||||
{
|
{
|
||||||
while ((p = index(p, '|')) != 0)
|
while ((p = strchr(p, '|')) != 0)
|
||||||
*p = ' ';
|
*p = ' ';
|
||||||
}
|
}
|
||||||
#endif /* NO_SCAN_BRACK */
|
#endif /* NO_SCAN_BRACK */
|
||||||
|
|||||||
+1
-1
@@ -5371,7 +5371,7 @@ openholdingtrap(
|
|||||||
trapdescr = trapname(t->ttyp, FALSE);
|
trapdescr = trapname(t->ttyp, FALSE);
|
||||||
if (!which)
|
if (!which)
|
||||||
which = t->tseen ? the_your[t->madeby_u]
|
which = t->tseen ? the_your[t->madeby_u]
|
||||||
: index(vowels, *trapdescr) ? "an" : "a";
|
: strchr(vowels, *trapdescr) ? "an" : "a";
|
||||||
if (*which)
|
if (*which)
|
||||||
which = strcat(strcpy(whichbuf, which), " ");
|
which = strcat(strcpy(whichbuf, which), " ");
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -206,11 +206,11 @@ unicode_val(const char *cp)
|
|||||||
if (cp && *cp) {
|
if (cp && *cp) {
|
||||||
cval = dcount = 0;
|
cval = dcount = 0;
|
||||||
if ((unicode = ((*cp == 'U' || *cp == 'u') && cp[1] == '+')) && cp[2]
|
if ((unicode = ((*cp == 'U' || *cp == 'u') && cp[1] == '+')) && cp[2]
|
||||||
&& (dp = index(hex, cp[2])) != 0) {
|
&& (dp = strchr(hex, cp[2])) != 0) {
|
||||||
cp += 2; /* move past the 'U' and '+' */
|
cp += 2; /* move past the 'U' and '+' */
|
||||||
do {
|
do {
|
||||||
cval = (cval * 16) + ((int) (dp - hex) / 2);
|
cval = (cval * 16) + ((int) (dp - hex) / 2);
|
||||||
} while (*++cp && (dp = index(hex, *cp)) != 0 && ++dcount < 7);
|
} while (*++cp && (dp = strchr(hex, *cp)) != 0 && ++dcount < 7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cval;
|
return cval;
|
||||||
|
|||||||
+4
-4
@@ -124,7 +124,7 @@ doextversion(void)
|
|||||||
/* if extra text (git info) is present, put it on separate line
|
/* if extra text (git info) is present, put it on separate line
|
||||||
but don't wrap on (x86) */
|
but don't wrap on (x86) */
|
||||||
if (strlen(buf) >= COLNO)
|
if (strlen(buf) >= COLNO)
|
||||||
p = rindex(buf, '(');
|
p = strrchr(buf, '(');
|
||||||
if (p && p > buf && p[-1] == ' ' && p[1] != 'x')
|
if (p && p > buf && p[-1] == ' ' && p[1] != 'x')
|
||||||
p[-1] = '\0';
|
p[-1] = '\0';
|
||||||
else
|
else
|
||||||
@@ -182,7 +182,7 @@ doextversion(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void) strip_newline(buf);
|
(void) strip_newline(buf);
|
||||||
if (index(buf, '\t') != 0)
|
if (strchr(buf, '\t') != 0)
|
||||||
(void) tabexpand(buf);
|
(void) tabexpand(buf);
|
||||||
|
|
||||||
if (*buf && *buf != ' ') {
|
if (*buf && *buf != ' ') {
|
||||||
@@ -195,7 +195,7 @@ doextversion(void)
|
|||||||
if (prolog || !*buf)
|
if (prolog || !*buf)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (index(buf, ':'))
|
if (strchr(buf, ':'))
|
||||||
insert_rtoption(buf);
|
insert_rtoption(buf);
|
||||||
|
|
||||||
if (*buf)
|
if (*buf)
|
||||||
@@ -438,7 +438,7 @@ get_feature_notice_ver(char *str)
|
|||||||
istr[j] = str;
|
istr[j] = str;
|
||||||
if (j == 2)
|
if (j == 2)
|
||||||
break;
|
break;
|
||||||
} else if (index("0123456789", *str) != 0) {
|
} else if (strchr("0123456789", *str) != 0) {
|
||||||
str++;
|
str++;
|
||||||
} else
|
} else
|
||||||
return 0L;
|
return 0L;
|
||||||
|
|||||||
+1
-1
@@ -165,7 +165,7 @@ hitval(struct obj *otmp, struct monst *mon)
|
|||||||
if (Is_weapon && otmp->blessed && mon_hates_blessings(mon))
|
if (Is_weapon && otmp->blessed && mon_hates_blessings(mon))
|
||||||
tmp += 2;
|
tmp += 2;
|
||||||
|
|
||||||
if (is_spear(otmp) && index(kebabable, ptr->mlet))
|
if (is_spear(otmp) && strchr(kebabable, ptr->mlet))
|
||||||
tmp += 2;
|
tmp += 2;
|
||||||
|
|
||||||
/* trident is highly effective against swimmers */
|
/* trident is highly effective against swimmers */
|
||||||
|
|||||||
+2
-2
@@ -1408,7 +1408,7 @@ decode_glyph(const char *str, int *glyph_ptr)
|
|||||||
const char *dp;
|
const char *dp;
|
||||||
|
|
||||||
for (; *str && ++dcount <= 4; ++str) {
|
for (; *str && ++dcount <= 4; ++str) {
|
||||||
if ((dp = index(hex, *str)) != 0) {
|
if ((dp = strchr(hex, *str)) != 0) {
|
||||||
retval++;
|
retval++;
|
||||||
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
|
||||||
} else
|
} else
|
||||||
@@ -1417,7 +1417,7 @@ decode_glyph(const char *str, int *glyph_ptr)
|
|||||||
if (rndchk == g.context.rndencode) {
|
if (rndchk == g.context.rndencode) {
|
||||||
*glyph_ptr = dcount = 0;
|
*glyph_ptr = dcount = 0;
|
||||||
for (; *str && ++dcount <= 4; ++str) {
|
for (; *str && ++dcount <= 4; ++str) {
|
||||||
if ((dp = index(hex, *str)) != 0) {
|
if ((dp = strchr(hex, *str)) != 0) {
|
||||||
retval++;
|
retval++;
|
||||||
*glyph_ptr = (*glyph_ptr * 16) + ((int) (dp - hex) / 2);
|
*glyph_ptr = (*glyph_ptr * 16) + ((int) (dp - hex) / 2);
|
||||||
} else
|
} else
|
||||||
|
|||||||
+1
-1
@@ -535,7 +535,7 @@ pick_nasty(
|
|||||||
alt = big_to_little(res);
|
alt = big_to_little(res);
|
||||||
if (alt != res && (g.mvitals[alt].mvflags & G_GENOD) == 0) {
|
if (alt != res && (g.mvitals[alt].mvflags & G_GENOD) == 0) {
|
||||||
const char *mnam = mons[alt].pmnames[NEUTRAL],
|
const char *mnam = mons[alt].pmnames[NEUTRAL],
|
||||||
*lastspace = rindex(mnam, ' ');
|
*lastspace = strrchr(mnam, ' ');
|
||||||
|
|
||||||
/* only non-juveniles can become alternate choice */
|
/* only non-juveniles can become alternate choice */
|
||||||
if (strncmp(mnam, "baby ", 5)
|
if (strncmp(mnam, "baby ", 5)
|
||||||
|
|||||||
@@ -1662,7 +1662,7 @@ poly_obj(struct obj *obj, int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* keep special fields (including charges on wands) */
|
/* keep special fields (including charges on wands) */
|
||||||
if (index(charged_objs, otmp->oclass))
|
if (strchr(charged_objs, otmp->oclass))
|
||||||
otmp->spe = obj->spe;
|
otmp->spe = obj->spe;
|
||||||
otmp->recharged = obj->recharged;
|
otmp->recharged = obj->recharged;
|
||||||
|
|
||||||
|
|||||||
@@ -541,7 +541,7 @@ whoami(void)
|
|||||||
|
|
||||||
if (s && *s) {
|
if (s && *s) {
|
||||||
(void) strncpy(g.plname, s, sizeof g.plname - 1);
|
(void) strncpy(g.plname, s, sizeof g.plname - 1);
|
||||||
if (index(g.plname, '-'))
|
if (strchr(g.plname, '-'))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ wd_message(void)
|
|||||||
if (sysopt.wizards && sysopt.wizards[0]) {
|
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||||
char *tmp = build_english_list(sysopt.wizards);
|
char *tmp = build_english_list(sysopt.wizards);
|
||||||
pline("Only user%s %s may access debug (wizard) mode.",
|
pline("Only user%s %s may access debug (wizard) mode.",
|
||||||
index(sysopt.wizards, ' ') ? "s" : "", tmp);
|
strchr(sysopt.wizards, ' ') ? "s" : "", tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else
|
} else
|
||||||
pline("Entering explore/discovery mode instead.");
|
pline("Entering explore/discovery mode instead.");
|
||||||
|
|||||||
+1
-1
@@ -457,7 +457,7 @@ chdrive(char *str)
|
|||||||
union REGS inregs;
|
union REGS inregs;
|
||||||
char drive;
|
char drive;
|
||||||
|
|
||||||
if ((ptr = index(str, ':')) != (char *) 0) {
|
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
||||||
drive = toupper(*(ptr - 1));
|
drive = toupper(*(ptr - 1));
|
||||||
inregs.h.ah = SELECTDISK;
|
inregs.h.ah = SELECTDISK;
|
||||||
inregs.h.dl = drive - 'A';
|
inregs.h.dl = drive - 'A';
|
||||||
|
|||||||
+6
-6
@@ -766,11 +766,11 @@ assign_videoshades(char *choiceptr)
|
|||||||
cvalue[0] = choices;
|
cvalue[0] = choices;
|
||||||
|
|
||||||
/* find the next ' ' or tab */
|
/* find the next ' ' or tab */
|
||||||
cptr = index(cvalue[0], '-');
|
cptr = strchr(cvalue[0], '-');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
cptr = index(cvalue[0], ' ');
|
cptr = strchr(cvalue[0], ' ');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
cptr = index(cvalue[0], '\t');
|
cptr = strchr(cvalue[0], '\t');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
return 0;
|
return 0;
|
||||||
*cptr = '\0';
|
*cptr = '\0';
|
||||||
@@ -780,11 +780,11 @@ assign_videoshades(char *choiceptr)
|
|||||||
} while (isspace(*cptr) || (*cptr == '-'));
|
} while (isspace(*cptr) || (*cptr == '-'));
|
||||||
cvalue[1] = cptr;
|
cvalue[1] = cptr;
|
||||||
|
|
||||||
cptr = index(cvalue[1], '-');
|
cptr = strchr(cvalue[1], '-');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
cptr = index(cvalue[0], ' ');
|
cptr = strchr(cvalue[0], ' ');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
cptr = index(cvalue[0], '\t');
|
cptr = strchr(cvalue[0], '\t');
|
||||||
if (!cptr)
|
if (!cptr)
|
||||||
return 0;
|
return 0;
|
||||||
*cptr = '\0';
|
*cptr = '\0';
|
||||||
|
|||||||
+2
-2
@@ -198,7 +198,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
/* sysconf should be searched for in this location */
|
/* sysconf should be searched for in this location */
|
||||||
envp = nh_getenv("COMMONPROGRAMFILES");
|
envp = nh_getenv("COMMONPROGRAMFILES");
|
||||||
if (envp) {
|
if (envp) {
|
||||||
if ((sptr = index(envp, ';')) != 0)
|
if ((sptr = strchr(envp, ';')) != 0)
|
||||||
*sptr = '\0';
|
*sptr = '\0';
|
||||||
if (strlen(envp) > 0) {
|
if (strlen(envp) > 0) {
|
||||||
g.fqn_prefix[SYSCONFPREFIX] =
|
g.fqn_prefix[SYSCONFPREFIX] =
|
||||||
@@ -241,7 +241,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
* overridden */
|
* overridden */
|
||||||
envp = nh_getenv("USERPROFILE");
|
envp = nh_getenv("USERPROFILE");
|
||||||
if (envp) {
|
if (envp) {
|
||||||
if ((sptr = index(envp, ';')) != 0)
|
if ((sptr = strchr(envp, ';')) != 0)
|
||||||
*sptr = '\0';
|
*sptr = '\0';
|
||||||
if (strlen(envp) > 0) {
|
if (strlen(envp) > 0) {
|
||||||
g.fqn_prefix[CONFIGPREFIX] =
|
g.fqn_prefix[CONFIGPREFIX] =
|
||||||
|
|||||||
+9
-9
@@ -102,10 +102,10 @@ tc_store(const char *trm, const char *ent)
|
|||||||
size_t n;
|
size_t n;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (!ent || !*ent || !trm || !*trm || (col = index(ent, ':')) == 0)
|
if (!ent || !*ent || !trm || !*trm || (col = strchr(ent, ':')) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
(void) strcpy(tc_entry, trm);
|
(void) strcpy(tc_entry, trm);
|
||||||
if (((bar = index(ent, '|')) != 0 && bar < col)
|
if (((bar = strchr(ent, '|')) != 0 && bar < col)
|
||||||
|| ((long) (n = strlen(trm)) == (long) (col - ent)
|
|| ((long) (n = strlen(trm)) == (long) (col - ent)
|
||||||
&& strncmp(ent, trm, n) == 0))
|
&& strncmp(ent, trm, n) == 0))
|
||||||
(void) strcat(tc_entry, col);
|
(void) strcat(tc_entry, col);
|
||||||
@@ -171,7 +171,7 @@ tc_find(FILE *fp, const char *term, char *buffer, int bufsiz)
|
|||||||
*op++ = *ip, bufsiz -= 1;
|
*op++ = *ip, bufsiz -= 1;
|
||||||
if (ip[0] == ':' && ip[1] == 't' && ip[2] == 'c' && ip[3] == '=') {
|
if (ip[0] == ':' && ip[1] == 't' && ip[2] == 'c' && ip[3] == '=') {
|
||||||
tc_fetch = &ip[4];
|
tc_fetch = &ip[4];
|
||||||
if ((ip = index(tc_fetch, ':')) != 0)
|
if ((ip = strchr(tc_fetch, ':')) != 0)
|
||||||
*ip = '\0';
|
*ip = '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -197,11 +197,11 @@ tc_name(const char *nam, char *ent)
|
|||||||
char *nxt, *lst, *p = ent;
|
char *nxt, *lst, *p = ent;
|
||||||
size_t n = strlen(nam);
|
size_t n = strlen(nam);
|
||||||
|
|
||||||
if ((lst = index(p, ':')) == 0)
|
if ((lst = strchr(p, ':')) == 0)
|
||||||
lst = p + strlen(p);
|
lst = p + strlen(p);
|
||||||
|
|
||||||
while (p < lst) {
|
while (p < lst) {
|
||||||
if ((nxt = index(p, '|')) == 0 || nxt > lst)
|
if ((nxt = strchr(p, '|')) == 0 || nxt > lst)
|
||||||
nxt = lst;
|
nxt = lst;
|
||||||
if ((long) (nxt - p) == (long) n && strncmp(p, nam, n) == 0)
|
if ((long) (nxt - p) == (long) n && strncmp(p, nam, n) == 0)
|
||||||
return lst;
|
return lst;
|
||||||
@@ -248,7 +248,7 @@ tgetstr(const char *which, char **outptr)
|
|||||||
if (!p || p[2] != '=')
|
if (!p || p[2] != '=')
|
||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
p += 3;
|
p += 3;
|
||||||
if ((q = index(p, ':')) == 0)
|
if ((q = strchr(p, ':')) == 0)
|
||||||
q = p + strlen(p);
|
q = p + strlen(p);
|
||||||
r = result = *outptr;
|
r = result = *outptr;
|
||||||
while (p < q) {
|
while (p < q) {
|
||||||
@@ -320,7 +320,7 @@ tc_field(const char *field, const char **tc_end)
|
|||||||
|
|
||||||
end = p + strlen(p);
|
end = p + strlen(p);
|
||||||
while (p < end) {
|
while (p < end) {
|
||||||
if ((p = index(p, ':')) == 0)
|
if ((p = strchr(p, ':')) == 0)
|
||||||
break;
|
break;
|
||||||
++p;
|
++p;
|
||||||
if (p[0] == field[0] && p[1] == field[1]
|
if (p[0] == field[0] && p[1] == field[1]
|
||||||
@@ -329,7 +329,7 @@ tc_field(const char *field, const char **tc_end)
|
|||||||
}
|
}
|
||||||
if (tc_end) {
|
if (tc_end) {
|
||||||
if (p) {
|
if (p) {
|
||||||
if ((q = index(p + 2, ':')) == 0)
|
if ((q = strchr(p + 2, ':')) == 0)
|
||||||
q = end;
|
q = end;
|
||||||
} else
|
} else
|
||||||
q = 0;
|
q = 0;
|
||||||
@@ -395,7 +395,7 @@ tparam(const char *ctl, /* parameter control string */
|
|||||||
LF from becoming CR+LF, for instance; only
|
LF from becoming CR+LF, for instance; only
|
||||||
makes sense if this is a cursor positioning
|
makes sense if this is a cursor positioning
|
||||||
sequence, but we have no way to check that */
|
sequence, but we have no way to check that */
|
||||||
while (index("\004\t\n\013\f\r", *r)) {
|
while (strchr("\004\t\n\013\f\r", *r)) {
|
||||||
if (ac & 1) { /* row */
|
if (ac & 1) { /* row */
|
||||||
if (!UP || !*UP)
|
if (!UP || !*UP)
|
||||||
break; /* can't fix */
|
break; /* can't fix */
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ main(int argc, char **argv)
|
|||||||
struct passwd *user;
|
struct passwd *user;
|
||||||
char dnbuf[100], *index(), *strcat(), *strcpy();
|
char dnbuf[100], *index(), *strcat(), *strcpy();
|
||||||
|
|
||||||
sl = index(dest, '/');
|
sl = strchr(dest, '/');
|
||||||
if (sl == NULL) {
|
if (sl == NULL) {
|
||||||
fprintf(stderr, "Illegal ~user\n");
|
fprintf(stderr, "Illegal ~user\n");
|
||||||
exit(3);
|
exit(3);
|
||||||
|
|||||||
+4
-4
@@ -336,8 +336,8 @@ lopt(
|
|||||||
return (char *) 0;
|
return (char *) 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p = index(arg, '=')) == 0)
|
if ((p = strchr(arg, '=')) == 0)
|
||||||
p = index(arg, ':');
|
p = strchr(arg, ':');
|
||||||
if (p && opttype == ArgValDisallowed)
|
if (p && opttype == ArgValDisallowed)
|
||||||
goto loptnotallowed;
|
goto loptnotallowed;
|
||||||
|
|
||||||
@@ -831,7 +831,7 @@ whoami(void)
|
|||||||
|
|
||||||
if (s && *s) {
|
if (s && *s) {
|
||||||
(void) strncpy(g.plname, s, sizeof g.plname - 1);
|
(void) strncpy(g.plname, s, sizeof g.plname - 1);
|
||||||
if (index(g.plname, '-'))
|
if (strchr(g.plname, '-'))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -897,7 +897,7 @@ wd_message(void)
|
|||||||
if (sysopt.wizards && sysopt.wizards[0]) {
|
if (sysopt.wizards && sysopt.wizards[0]) {
|
||||||
char *tmp = build_english_list(sysopt.wizards);
|
char *tmp = build_english_list(sysopt.wizards);
|
||||||
pline("Only user%s %s may access debug (wizard) mode.",
|
pline("Only user%s %s may access debug (wizard) mode.",
|
||||||
index(sysopt.wizards, ' ') ? "s" : "", tmp);
|
strchr(sysopt.wizards, ' ') ? "s" : "", tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
} else
|
} else
|
||||||
pline("Entering explore/discovery mode instead.");
|
pline("Entering explore/discovery mode instead.");
|
||||||
|
|||||||
+3
-3
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
/* This file collects some Unix dependencies */
|
/* This file collects some Unix dependencies */
|
||||||
|
|
||||||
#include "hack.h" /* mainly for index() which depends on BSD */
|
#include "hack.h" /* mainly for strchr() which depends on BSD */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -218,8 +218,8 @@ regularize(char *s)
|
|||||||
{
|
{
|
||||||
register char *lp;
|
register char *lp;
|
||||||
|
|
||||||
while ((lp = index(s, '.')) != 0 || (lp = index(s, '/')) != 0
|
while ((lp = strchr(s, '.')) != 0 || (lp = strchr(s, '/')) != 0
|
||||||
|| (lp = index(s, ' ')) != 0)
|
|| (lp = strchr(s, ' ')) != 0)
|
||||||
*lp = '_';
|
*lp = '_';
|
||||||
#if defined(SYSV) && !defined(AIX_31) && !defined(SVR4) && !defined(LINUX) \
|
#if defined(SYSV) && !defined(AIX_31) && !defined(SVR4) && !defined(LINUX) \
|
||||||
&& !defined(__APPLE__)
|
&& !defined(__APPLE__)
|
||||||
|
|||||||
+4
-4
@@ -117,13 +117,13 @@ vms_creat(const char *file, unsigned int mode)
|
|||||||
{
|
{
|
||||||
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
||||||
|
|
||||||
if (index(file, ';')) {
|
if (strchr(file, ';')) {
|
||||||
/* assumes remove or delete, not vms_unlink */
|
/* assumes remove or delete, not vms_unlink */
|
||||||
if (!unlink(file)) {
|
if (!unlink(file)) {
|
||||||
(void) sleep(1);
|
(void) sleep(1);
|
||||||
(void) unlink(file);
|
(void) unlink(file);
|
||||||
}
|
}
|
||||||
} else if (!index(file, '.')) {
|
} else if (!strchr(file, '.')) {
|
||||||
/* force some punctuation to be present */
|
/* force some punctuation to be present */
|
||||||
file = strcat(strcpy(filnambuf, file), ".");
|
file = strcat(strcpy(filnambuf, file), ".");
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ vms_open(const char *file, int flags, unsigned int mode)
|
|||||||
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!index(file, '.') && !index(file, ';')) {
|
if (!strchr(file, '.') && !strchr(file, ';')) {
|
||||||
/* force some punctuation to be present to make sure that
|
/* force some punctuation to be present to make sure that
|
||||||
the file name can't accidentally match a logical name */
|
the file name can't accidentally match a logical name */
|
||||||
file = strcat(strcpy(filnambuf, file), ";0");
|
file = strcat(strcpy(filnambuf, file), ";0");
|
||||||
@@ -163,7 +163,7 @@ vms_fopen(const char *file, const char *mode)
|
|||||||
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
char filnambuf[BUFSIZ]; /*(not BUFSZ)*/
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (!index(file, '.') && !index(file, ';')) {
|
if (!strchr(file, '.') && !strchr(file, ';')) {
|
||||||
/* force some punctuation to be present to make sure that
|
/* force some punctuation to be present to make sure that
|
||||||
the file name can't accidentally match a logical name */
|
the file name can't accidentally match a logical name */
|
||||||
file = strcat(strcpy(filnambuf, file), ";0");
|
file = strcat(strcpy(filnambuf, file), ";0");
|
||||||
|
|||||||
+2
-2
@@ -392,8 +392,8 @@ check_user_string(const char *userlist)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
/* doesn't match full word, but maybe we got a false hit when
|
/* doesn't match full word, but maybe we got a false hit when
|
||||||
looking for "jane" in the list "janedoe jane" so keep going */
|
looking for "jane" in the list "janedoe jane" so keep going */
|
||||||
p = index(sptr + 1, ' ');
|
p = strchr(sptr + 1, ' ');
|
||||||
q = index(sptr + 1, ',');
|
q = strchr(sptr + 1, ',');
|
||||||
if (!p || (q && q < p))
|
if (!p || (q && q < p))
|
||||||
p = q;
|
p = q;
|
||||||
if (!p)
|
if (!p)
|
||||||
|
|||||||
@@ -1962,7 +1962,7 @@ map_subkeyvalue(char* op)
|
|||||||
|
|
||||||
idx = -1;
|
idx = -1;
|
||||||
val = -1;
|
val = -1;
|
||||||
kp = index(op, '/');
|
kp = strchr(op, '/');
|
||||||
if (kp) {
|
if (kp) {
|
||||||
*kp = '\0';
|
*kp = '\0';
|
||||||
kp++;
|
kp++;
|
||||||
@@ -1970,14 +1970,14 @@ map_subkeyvalue(char* op)
|
|||||||
if (length < 1 || length > 3)
|
if (length < 1 || length > 3)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
if (!index(digits, kp[i]))
|
if (!strchr(digits, kp[i]))
|
||||||
return;
|
return;
|
||||||
val = atoi(kp);
|
val = atoi(kp);
|
||||||
length = strlen(op);
|
length = strlen(op);
|
||||||
if (length < 1 || length > 3)
|
if (length < 1 || length > 3)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
if (!index(digits, op[i]))
|
if (!strchr(digits, op[i]))
|
||||||
return;
|
return;
|
||||||
idx = atoi(op);
|
idx = atoi(op);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ build_environment_path(
|
|||||||
|
|
||||||
strcpy_s(path, path_size, root_path);
|
strcpy_s(path, path_size, root_path);
|
||||||
|
|
||||||
char * colon = index(path, ';');
|
char * colon = strchr(path, ';');
|
||||||
if (colon != NULL) path[0] = '\0';
|
if (colon != NULL) path[0] = '\0';
|
||||||
|
|
||||||
if (strlen(path) == 0) return;
|
if (strlen(path) == 0) return;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ chdrive(char* str)
|
|||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
char drive;
|
char drive;
|
||||||
if ((ptr = index(str, ':')) != (char *) 0) {
|
if ((ptr = strchr(str, ':')) != (char *) 0) {
|
||||||
drive = toupper((uchar) *(ptr - 1));
|
drive = toupper((uchar) *(ptr - 1));
|
||||||
_chdrive((drive - 'A') + 1);
|
_chdrive((drive - 'A') + 1);
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-7
@@ -931,7 +931,7 @@ padline(char *line, unsigned padlength)
|
|||||||
unsigned len = (unsigned) strlen(line); /* includes newline */
|
unsigned len = (unsigned) strlen(line); /* includes newline */
|
||||||
|
|
||||||
if (len <= padlength) {
|
if (len <= padlength) {
|
||||||
endp = index(line, '\n'); /* fgetline() guarantees a newline even if
|
endp = strchr(line, '\n'); /* fgetline() guarantees a newline even if
|
||||||
* the input file's last line lacks one */
|
* the input file's last line lacks one */
|
||||||
|
|
||||||
/* this is safe provided that padlength+1 is less than the allocation
|
/* this is safe provided that padlength+1 is less than the allocation
|
||||||
@@ -1021,7 +1021,7 @@ do_rnd_access_file(
|
|||||||
matches a regular entry (bogusmon "grue"), that entry will become
|
matches a regular entry (bogusmon "grue"), that entry will become
|
||||||
more likely to be picked than normal but it's nothing to worry about */
|
more likely to be picked than normal but it's nothing to worry about */
|
||||||
Strcpy(buf, deflt_content);
|
Strcpy(buf, deflt_content);
|
||||||
if (!index(buf, '\n')) /* lines from the file include trailing newline +*/
|
if (!strchr(buf, '\n')) /* lines from the file include trailing newline +*/
|
||||||
Strcat(buf, "\n"); /* so make sure that the default one does too */
|
Strcat(buf, "\n"); /* so make sure that the default one does too */
|
||||||
(void) fputs(xcrypt(padline(buf, padlength)), ofp);
|
(void) fputs(xcrypt(padline(buf, padlength)), ofp);
|
||||||
|
|
||||||
@@ -1259,7 +1259,7 @@ do_date(void)
|
|||||||
Strcpy(cbuf, ctime(&clocktim));
|
Strcpy(cbuf, ctime(&clocktim));
|
||||||
#endif /* REPRODUCIBLE_BUILD */
|
#endif /* REPRODUCIBLE_BUILD */
|
||||||
|
|
||||||
if ((c = index(cbuf, '\n')) != 0)
|
if ((c = strchr(cbuf, '\n')) != 0)
|
||||||
*c = '\0'; /* strip off the '\n' */
|
*c = '\0'; /* strip off the '\n' */
|
||||||
#ifdef NHSTDC
|
#ifdef NHSTDC
|
||||||
ul_sfx = "UL";
|
ul_sfx = "UL";
|
||||||
@@ -1360,14 +1360,14 @@ get_gitinfo(char *githash, char *gitbranch)
|
|||||||
|
|
||||||
/* read the gitinfo file */
|
/* read the gitinfo file */
|
||||||
while ((line = fgetline(gifp)) != 0) {
|
while ((line = fgetline(gifp)) != 0) {
|
||||||
strval = index(line, '=');
|
strval = strchr(line, '=');
|
||||||
if (strval && strlen(strval) < (BUFSZ-1)) {
|
if (strval && strlen(strval) < (BUFSZ-1)) {
|
||||||
opt = line;
|
opt = line;
|
||||||
*strval++ = '\0';
|
*strval++ = '\0';
|
||||||
/* strip off the '\n' */
|
/* strip off the '\n' */
|
||||||
if ((c = index(strval, '\n')) != 0)
|
if ((c = strchr(strval, '\n')) != 0)
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
if ((c = index(opt, '\n')) != 0)
|
if ((c = strchr(opt, '\n')) != 0)
|
||||||
*c = '\0';
|
*c = '\0';
|
||||||
/* strip leading and trailing white space */
|
/* strip leading and trailing white space */
|
||||||
while (*strval == ' ' || *strval == '\t')
|
while (*strval == ' ' || *strval == '\t')
|
||||||
@@ -2222,7 +2222,7 @@ fgetline(FILE *fd)
|
|||||||
free((genericptr_t) c), c = NULL;
|
free((genericptr_t) c), c = NULL;
|
||||||
}
|
}
|
||||||
break; /* either with or without added newline, we're done */
|
break; /* either with or without added newline, we're done */
|
||||||
} else if (index(c, '\n')) {
|
} else if (strchr(c, '\n')) {
|
||||||
/* normal case: we have a full line */
|
/* normal case: we have a full line */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -151,7 +151,7 @@ set_levelfile_name(int lev)
|
|||||||
{
|
{
|
||||||
char *tf;
|
char *tf;
|
||||||
|
|
||||||
tf = rindex(lock, '.');
|
tf = strrchr(lock, '.');
|
||||||
if (!tf)
|
if (!tf)
|
||||||
tf = lock + strlen(lock);
|
tf = lock + strlen(lock);
|
||||||
(void) sprintf(tf, ".%d", lev);
|
(void) sprintf(tf, ".%d", lev);
|
||||||
|
|||||||
+7
-7
@@ -815,7 +815,7 @@ load_default_resources(void)
|
|||||||
++numdefs;
|
++numdefs;
|
||||||
}
|
}
|
||||||
linelen += strlen(inbuf);
|
linelen += strlen(inbuf);
|
||||||
if (!index(inbuf, '\n'))
|
if (!strchr(inbuf, '\n'))
|
||||||
continue;
|
continue;
|
||||||
if (linelen > longlen)
|
if (linelen > longlen)
|
||||||
longlen = linelen;
|
longlen = linelen;
|
||||||
@@ -2128,7 +2128,7 @@ yn_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!yn_choices /* accept any input */
|
if (!yn_choices /* accept any input */
|
||||||
|| (yn_no_default && (ch == '\033' || index(yn_quitchars, ch)))) {
|
|| (yn_no_default && (ch == '\033' || strchr(yn_quitchars, ch)))) {
|
||||||
yn_return = ch;
|
yn_return = ch;
|
||||||
} else {
|
} else {
|
||||||
if (!yn_preserve_case)
|
if (!yn_preserve_case)
|
||||||
@@ -2137,9 +2137,9 @@ yn_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
if (ch == '\033') {
|
if (ch == '\033') {
|
||||||
yn_getting_num = FALSE;
|
yn_getting_num = FALSE;
|
||||||
yn_return = yn_esc_map;
|
yn_return = yn_esc_map;
|
||||||
} else if (index(yn_quitchars, ch)) {
|
} else if (strchr(yn_quitchars, ch)) {
|
||||||
yn_return = yn_def;
|
yn_return = yn_def;
|
||||||
} else if (index(yn_choices, ch)) {
|
} else if (strchr(yn_choices, ch)) {
|
||||||
if (ch == '#') {
|
if (ch == '#') {
|
||||||
if (yn_getting_num) { /* don't select again */
|
if (yn_getting_num) { /* don't select again */
|
||||||
X11_nhbell();
|
X11_nhbell();
|
||||||
@@ -2235,7 +2235,7 @@ X11_yn_function_core(
|
|||||||
yn_preserve_case = TRUE;
|
yn_preserve_case = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((cb = index(choicebuf, '\033')) != 0)
|
if ((cb = strchr(choicebuf, '\033')) != 0)
|
||||||
*cb = '\0';
|
*cb = '\0';
|
||||||
/* ques [choices] (def) */
|
/* ques [choices] (def) */
|
||||||
int ln = ((int) strlen(ques) /* prompt text */
|
int ln = ((int) strlen(ques) /* prompt text */
|
||||||
@@ -2252,8 +2252,8 @@ X11_yn_function_core(
|
|||||||
Strcat(buf, " ");
|
Strcat(buf, " ");
|
||||||
|
|
||||||
/* escape maps to 'q' or 'n' or default, in that order */
|
/* escape maps to 'q' or 'n' or default, in that order */
|
||||||
yn_esc_map = (index(choices, 'q') ? 'q'
|
yn_esc_map = (strchr(choices, 'q') ? 'q'
|
||||||
: index(choices, 'n') ? 'n'
|
: strchr(choices, 'n') ? 'n'
|
||||||
: def);
|
: def);
|
||||||
} else {
|
} else {
|
||||||
int ln = ((int) strlen(ques) /* prompt text */
|
int ln = ((int) strlen(ques) /* prompt text */
|
||||||
|
|||||||
+5
-5
@@ -275,7 +275,7 @@ menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
some menus use digits as potential group accelerators
|
some menus use digits as potential group accelerators
|
||||||
but their entries don't rely on counts */
|
but their entries don't rely on counts */
|
||||||
if (!menu_info->counting
|
if (!menu_info->counting
|
||||||
&& index(menu_info->curr_menu.gacc, ch))
|
&& strchr(menu_info->curr_menu.gacc, ch))
|
||||||
goto group_accel;
|
goto group_accel;
|
||||||
menu_info->menu_count *= 10L;
|
menu_info->menu_count *= 10L;
|
||||||
menu_info->menu_count += (long) (ch - '0');
|
menu_info->menu_count += (long) (ch - '0');
|
||||||
@@ -338,7 +338,7 @@ menu_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
XtCallCallbacks(hbar, XtNjumpProc, &left);
|
XtCallCallbacks(hbar, XtNjumpProc, &left);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (index(menu_info->curr_menu.gacc, ch)) {
|
} else if (strchr(menu_info->curr_menu.gacc, ch)) {
|
||||||
group_accel:
|
group_accel:
|
||||||
/* matched a group accelerator */
|
/* matched a group accelerator */
|
||||||
if (menu_info->how == PICK_ANY || menu_info->how == PICK_ONE) {
|
if (menu_info->how == PICK_ANY || menu_info->how == PICK_ONE) {
|
||||||
@@ -758,7 +758,7 @@ x11_scroll_perminv(int arg UNUSED) /* arg is always 1 */
|
|||||||
this loop, so handle only one character at a time for !slow */
|
this loop, so handle only one character at a time for !slow */
|
||||||
if (!appResources.slow)
|
if (!appResources.slow)
|
||||||
break;
|
break;
|
||||||
} while (ch && !index(quitchars, ch));
|
} while (ch && !strchr(quitchars, ch));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -940,11 +940,11 @@ X11_select_menu(winid window, int how, menu_item **menu_list)
|
|||||||
if (n > 0) /* at least one group accelerator found */
|
if (n > 0) /* at least one group accelerator found */
|
||||||
for (ap = gacc, curr = menu_info->new_menu.base; curr;
|
for (ap = gacc, curr = menu_info->new_menu.base; curr;
|
||||||
curr = curr->next)
|
curr = curr->next)
|
||||||
if (curr->gselector && !index(gacc, curr->gselector)
|
if (curr->gselector && !strchr(gacc, curr->gselector)
|
||||||
&& (menu_info->how == PICK_ANY
|
&& (menu_info->how == PICK_ANY
|
||||||
|| gcnt[GSELIDX(curr->gselector)] == 1)) {
|
|| gcnt[GSELIDX(curr->gselector)] == 1)) {
|
||||||
*ap++ = curr->gselector;
|
*ap++ = curr->gselector;
|
||||||
*ap = '\0'; /* re-terminate for index() */
|
*ap = '\0'; /* re-terminate for strchr() */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu_info->new_menu.gacc = copy_of(gacc);
|
menu_info->new_menu.gacc = copy_of(gacc);
|
||||||
|
|||||||
+25
-25
@@ -24,7 +24,7 @@
|
|||||||
#include <X11/Xaw/Viewport.h>
|
#include <X11/Xaw/Viewport.h>
|
||||||
#include <X11/Xaw/Cardinals.h>
|
#include <X11/Xaw/Cardinals.h>
|
||||||
#include <X11/Xaw/List.h>
|
#include <X11/Xaw/List.h>
|
||||||
#include <X11/Xos.h> /* for index() */
|
#include <X11/Xos.h> /* for strchr() */
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
#ifdef PRESERVE_NO_SYSV
|
#ifdef PRESERVE_NO_SYSV
|
||||||
@@ -181,13 +181,13 @@ ps_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
nhUse(params);
|
nhUse(params);
|
||||||
nhUse(num_params);
|
nhUse(num_params);
|
||||||
|
|
||||||
(void) memset(rolechars, '\0', sizeof rolechars); /* for index() */
|
(void) memset(rolechars, '\0', sizeof rolechars); /* for strchr() */
|
||||||
for (i = 0; roles[i].name.m; ++i) {
|
for (i = 0; roles[i].name.m; ++i) {
|
||||||
ch = lowc(*roles[i].name.m);
|
ch = lowc(*roles[i].name.m);
|
||||||
/* if (flags.female && roles[i].name.f) ch = lowc(*roles[i].name.f);
|
/* if (flags.female && roles[i].name.f) ch = lowc(*roles[i].name.f);
|
||||||
*/
|
*/
|
||||||
/* this supports at most two roles with the same first letter */
|
/* this supports at most two roles with the same first letter */
|
||||||
if (index(rolechars, ch))
|
if (strchr(rolechars, ch))
|
||||||
ch = highc(ch);
|
ch = highc(ch);
|
||||||
rolechars[i] = ch;
|
rolechars[i] = ch;
|
||||||
}
|
}
|
||||||
@@ -196,15 +196,15 @@ ps_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
/* don't beep */
|
/* don't beep */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mark = index(rolechars, ch);
|
mark = strchr(rolechars, ch);
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(rolechars, lowc(ch));
|
mark = strchr(rolechars, lowc(ch));
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(rolechars, highc(ch));
|
mark = strchr(rolechars, highc(ch));
|
||||||
if (!mark) {
|
if (!mark) {
|
||||||
if (index(ps_randchars, ch))
|
if (strchr(ps_randchars, ch))
|
||||||
ps_selected = PS_RANDOM;
|
ps_selected = PS_RANDOM;
|
||||||
else if (index(ps_quitchars, ch))
|
else if (strchr(ps_quitchars, ch))
|
||||||
ps_selected = PS_QUIT;
|
ps_selected = PS_QUIT;
|
||||||
else {
|
else {
|
||||||
X11_nhbell(); /* no such class */
|
X11_nhbell(); /* no such class */
|
||||||
@@ -227,11 +227,11 @@ race_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
nhUse(params);
|
nhUse(params);
|
||||||
nhUse(num_params);
|
nhUse(num_params);
|
||||||
|
|
||||||
(void) memset(racechars, '\0', sizeof racechars); /* for index() */
|
(void) memset(racechars, '\0', sizeof racechars); /* for strchr() */
|
||||||
for (i = 0; races[i].noun; ++i) {
|
for (i = 0; races[i].noun; ++i) {
|
||||||
ch = lowc(*races[i].noun);
|
ch = lowc(*races[i].noun);
|
||||||
/* this supports at most two races with the same first letter */
|
/* this supports at most two races with the same first letter */
|
||||||
if (index(racechars, ch))
|
if (strchr(racechars, ch))
|
||||||
ch = highc(ch);
|
ch = highc(ch);
|
||||||
racechars[i] = ch;
|
racechars[i] = ch;
|
||||||
}
|
}
|
||||||
@@ -240,15 +240,15 @@ race_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
/* don't beep */
|
/* don't beep */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mark = index(racechars, ch);
|
mark = strchr(racechars, ch);
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(racechars, lowc(ch));
|
mark = strchr(racechars, lowc(ch));
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(racechars, highc(ch));
|
mark = strchr(racechars, highc(ch));
|
||||||
if (!mark) {
|
if (!mark) {
|
||||||
if (index(ps_randchars, ch))
|
if (strchr(ps_randchars, ch))
|
||||||
ps_selected = PS_RANDOM;
|
ps_selected = PS_RANDOM;
|
||||||
else if (index(ps_quitchars, ch))
|
else if (strchr(ps_quitchars, ch))
|
||||||
ps_selected = PS_QUIT;
|
ps_selected = PS_QUIT;
|
||||||
else {
|
else {
|
||||||
X11_nhbell(); /* no such race */
|
X11_nhbell(); /* no such race */
|
||||||
@@ -275,13 +275,13 @@ gend_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
/* don't beep */
|
/* don't beep */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mark = index(gendchars, ch);
|
mark = strchr(gendchars, ch);
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(gendchars, lowc(ch));
|
mark = strchr(gendchars, lowc(ch));
|
||||||
if (!mark) {
|
if (!mark) {
|
||||||
if (index(ps_randchars, ch))
|
if (strchr(ps_randchars, ch))
|
||||||
ps_selected = PS_RANDOM;
|
ps_selected = PS_RANDOM;
|
||||||
else if (index(ps_quitchars, ch))
|
else if (strchr(ps_quitchars, ch))
|
||||||
ps_selected = PS_QUIT;
|
ps_selected = PS_QUIT;
|
||||||
else {
|
else {
|
||||||
X11_nhbell(); /* no such gender */
|
X11_nhbell(); /* no such gender */
|
||||||
@@ -308,13 +308,13 @@ algn_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
/* don't beep */
|
/* don't beep */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mark = index(algnchars, ch);
|
mark = strchr(algnchars, ch);
|
||||||
if (!mark)
|
if (!mark)
|
||||||
mark = index(algnchars, highc(ch));
|
mark = strchr(algnchars, highc(ch));
|
||||||
if (!mark) {
|
if (!mark) {
|
||||||
if (index(ps_randchars, ch))
|
if (strchr(ps_randchars, ch))
|
||||||
ps_selected = PS_RANDOM;
|
ps_selected = PS_RANDOM;
|
||||||
else if (index(ps_quitchars, ch))
|
else if (strchr(ps_quitchars, ch))
|
||||||
ps_selected = PS_QUIT;
|
ps_selected = PS_QUIT;
|
||||||
else {
|
else {
|
||||||
X11_nhbell(); /* no such alignment */
|
X11_nhbell(); /* no such alignment */
|
||||||
@@ -1787,7 +1787,7 @@ ec_key(Widget w, XEvent *event, String *params, Cardinal *num_params)
|
|||||||
} else if (ch == '?') {
|
} else if (ch == '?') {
|
||||||
extend_help((Widget) 0, (XtPointer) 0, (XtPointer) 0);
|
extend_help((Widget) 0, (XtPointer) 0, (XtPointer) 0);
|
||||||
return;
|
return;
|
||||||
} else if (index("\033\n\r", ch)) {
|
} else if (strchr("\033\n\r", ch)) {
|
||||||
if (ch == '\033') {
|
if (ch == '\033') {
|
||||||
/* unselect while still visible */
|
/* unselect while still visible */
|
||||||
if (extended_cmd_selected >= 0)
|
if (extended_cmd_selected >= 0)
|
||||||
@@ -2191,7 +2191,7 @@ make_menu(const char *popup_name, const char *popup_label,
|
|||||||
XSetWMProtocols(XtDisplay(popup), XtWindow(popup), &wm_delete_window, 1);
|
XSetWMProtocols(XtDisplay(popup), XtWindow(popup), &wm_delete_window, 1);
|
||||||
|
|
||||||
/* during role selection, highlight "random" as pre-selected choice */
|
/* during role selection, highlight "random" as pre-selected choice */
|
||||||
if (right_callback == ps_random && index(ps_randchars, '\n'))
|
if (right_callback == ps_random && strchr(ps_randchars, '\n'))
|
||||||
swap_fg_bg(right);
|
swap_fg_bg(right);
|
||||||
|
|
||||||
return popup;
|
return popup;
|
||||||
|
|||||||
+2
-2
@@ -384,7 +384,7 @@ append_text_buffer(struct text_buffer *tb, const char *str, boolean concat)
|
|||||||
if (tb->num_lines) { /* not first --- append a newline */
|
if (tb->num_lines) { /* not first --- append a newline */
|
||||||
char appchar = '\n';
|
char appchar = '\n';
|
||||||
|
|
||||||
if (concat && !index("!.?'\")", tb->text[tb->text_last - 1])) {
|
if (concat && !strchr("!.?'\")", tb->text[tb->text_last - 1])) {
|
||||||
appchar = ' ';
|
appchar = ' ';
|
||||||
tb->num_lines--; /* offset increment at end of function */
|
tb->num_lines--; /* offset increment at end of function */
|
||||||
}
|
}
|
||||||
@@ -398,7 +398,7 @@ append_text_buffer(struct text_buffer *tb, const char *str, boolean concat)
|
|||||||
if (length) {
|
if (length) {
|
||||||
/* Remove all newlines. Otherwise we have a confused line count. */
|
/* Remove all newlines. Otherwise we have a confused line count. */
|
||||||
copy = (tb->text + tb->text_last);
|
copy = (tb->text + tb->text_last);
|
||||||
while ((copy = index(copy, '\n')) != (char *) 0)
|
while ((copy = strchr(copy, '\n')) != (char *) 0)
|
||||||
*copy = ' ';
|
*copy = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ curses_line_input_dialog(
|
|||||||
[Note: wgetnstr() treats <escape> as an ordinary character
|
[Note: wgetnstr() treats <escape> as an ordinary character
|
||||||
so user has to type <escape><return> for it to behave the
|
so user has to type <escape><return> for it to behave the
|
||||||
way we want it to.] */
|
way we want it to.] */
|
||||||
if (input[0] != '\033' && index(input, '\033') != 0)
|
if (input[0] != '\033' && strchr(input, '\033') != 0)
|
||||||
input[0] = '\0';
|
input[0] = '\0';
|
||||||
} while (--trylim > 0 && !input[0]);
|
} while (--trylim > 0 && !input[0]);
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
@@ -344,7 +344,7 @@ curses_character_input_dialog(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (choices != NULL && answer != '\0' && index(choices, answer))
|
if (choices != NULL && answer != '\0' && strchr(choices, answer))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
curs_set(0);
|
curs_set(0);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype
|
|||||||
ret = '\n';
|
ret = '\n';
|
||||||
/* msgtype=stop should require space/enter rather than any key,
|
/* msgtype=stop should require space/enter rather than any key,
|
||||||
as we want to prevent YASD from direction keys. */
|
as we want to prevent YASD from direction keys. */
|
||||||
} while (!index(resp, (char) ret));
|
} while (!strchr(resp, (char) ret));
|
||||||
if (oldcrsr >= 0)
|
if (oldcrsr >= 0)
|
||||||
(void) curs_set(oldcrsr);
|
(void) curs_set(oldcrsr);
|
||||||
|
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ draw_horizontal(boolean border)
|
|||||||
case BL_SCORE:
|
case BL_SCORE:
|
||||||
#ifdef SCORE_ON_BOTL
|
#ifdef SCORE_ON_BOTL
|
||||||
if ((sho_score & 2) != 0) { /* strip "S:" prefix */
|
if ((sho_score & 2) != 0) { /* strip "S:" prefix */
|
||||||
if ((colon = index(text, ':')) != 0)
|
if ((colon = strchr(text, ':')) != 0)
|
||||||
text = strcat(strcpy(sbuf, " "), colon + 1);
|
text = strcat(strcpy(sbuf, " "), colon + 1);
|
||||||
else
|
else
|
||||||
sho_score = 0;
|
sho_score = 0;
|
||||||
@@ -857,7 +857,7 @@ draw_vertical(boolean border)
|
|||||||
/* most status_vals_long[] are "long-text : value" and
|
/* most status_vals_long[] are "long-text : value" and
|
||||||
unlike horizontal status's abbreviated "ab:value",
|
unlike horizontal status's abbreviated "ab:value",
|
||||||
we highlight just the value portion */
|
we highlight just the value portion */
|
||||||
p = (fld != BL_TITLE) ? index(text, ':') : 0;
|
p = (fld != BL_TITLE) ? strchr(text, ':') : 0;
|
||||||
p = !p ? text : p + 1;
|
p = !p ? text : p + 1;
|
||||||
while (*p == ' ')
|
while (*p == ' ')
|
||||||
++p;
|
++p;
|
||||||
@@ -872,7 +872,7 @@ draw_vertical(boolean border)
|
|||||||
*p = savedch;
|
*p = savedch;
|
||||||
text = p; /* rest of field */
|
text = p; /* rest of field */
|
||||||
if ((fld == BL_HPMAX || fld == BL_ENEMAX)
|
if ((fld == BL_HPMAX || fld == BL_ENEMAX)
|
||||||
&& (p = index(text, ')')) != 0) {
|
&& (p = strchr(text, ')')) != 0) {
|
||||||
savedch = *p;
|
savedch = *p;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
} else
|
} else
|
||||||
@@ -1152,7 +1152,7 @@ curs_vert_status_vals(int win_width)
|
|||||||
} else {
|
} else {
|
||||||
text = status_vals[fldidx];
|
text = status_vals[fldidx];
|
||||||
if (fldidx != BL_TITLE && fldidx != BL_LEVELDESC) {
|
if (fldidx != BL_TITLE && fldidx != BL_LEVELDESC) {
|
||||||
if ((colon = index(text, ':')) != 0)
|
if ((colon = strchr(text, ':')) != 0)
|
||||||
text = colon + 1;
|
text = colon + 1;
|
||||||
}
|
}
|
||||||
lbl = status_fieldnm[fldidx];
|
lbl = status_fieldnm[fldidx];
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ stdio_wait_synch(void)
|
|||||||
|
|
||||||
fprintf(stdout, "--More--");
|
fprintf(stdout, "--More--");
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
while (!index(valid, nhgetch()))
|
while (!strchr(valid, nhgetch()))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,7 @@ fopen_text_file(const char *filename, const char *type)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = rindex(filename, '/');
|
p = strrchr(filename, '/');
|
||||||
if (p)
|
if (p)
|
||||||
p++;
|
p++;
|
||||||
else
|
else
|
||||||
|
|||||||
+1
-1
@@ -224,7 +224,7 @@ xwaitforspace(register const char *s) /* chars allowed besides return */
|
|||||||
morc = '\033';
|
morc = '\033';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((s && index(s, c)) || c == x || (x == '\n' && c == '\r')) {
|
if ((s && strchr(s, c)) || c == x || (x == '\n' && c == '\r')) {
|
||||||
morc = (char) c;
|
morc = (char) c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-8
@@ -288,7 +288,7 @@ update_topl(register const char *bp)
|
|||||||
break;
|
break;
|
||||||
if (tl == otl) {
|
if (tl == otl) {
|
||||||
/* Eek! A huge token. Try splitting after it. */
|
/* Eek! A huge token. Try splitting after it. */
|
||||||
tl = index(otl, ' ');
|
tl = strchr(otl, ' ');
|
||||||
if (!tl)
|
if (!tl)
|
||||||
break; /* No choice but to spit it out whole. */
|
break; /* No choice but to spit it out whole. */
|
||||||
}
|
}
|
||||||
@@ -396,7 +396,7 @@ tty_yn_function(
|
|||||||
if (resp) {
|
if (resp) {
|
||||||
char *rb, respbuf[QBUFSZ];
|
char *rb, respbuf[QBUFSZ];
|
||||||
|
|
||||||
allow_num = (index(resp, '#') != 0);
|
allow_num = (strchr(resp, '#') != 0);
|
||||||
Strcpy(respbuf, resp);
|
Strcpy(respbuf, resp);
|
||||||
/* normally we force lowercase, but if any uppercase letters
|
/* normally we force lowercase, but if any uppercase letters
|
||||||
are present in the allowed response, preserve case;
|
are present in the allowed response, preserve case;
|
||||||
@@ -407,7 +407,7 @@ tty_yn_function(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* any acceptable responses that follow <esc> aren't displayed */
|
/* any acceptable responses that follow <esc> aren't displayed */
|
||||||
if ((rb = index(respbuf, '\033')) != 0)
|
if ((rb = strchr(respbuf, '\033')) != 0)
|
||||||
*rb = '\0';
|
*rb = '\0';
|
||||||
(void) strncpy(prompt, query, QBUFSZ - 1);
|
(void) strncpy(prompt, query, QBUFSZ - 1);
|
||||||
prompt[QBUFSZ - 1] = '\0';
|
prompt[QBUFSZ - 1] = '\0';
|
||||||
@@ -461,18 +461,18 @@ tty_yn_function(
|
|||||||
}
|
}
|
||||||
digit_ok = allow_num && digit(q);
|
digit_ok = allow_num && digit(q);
|
||||||
if (q == '\033') {
|
if (q == '\033') {
|
||||||
if (index(resp, 'q'))
|
if (strchr(resp, 'q'))
|
||||||
q = 'q';
|
q = 'q';
|
||||||
else if (index(resp, 'n'))
|
else if (strchr(resp, 'n'))
|
||||||
q = 'n';
|
q = 'n';
|
||||||
else
|
else
|
||||||
q = def;
|
q = def;
|
||||||
break;
|
break;
|
||||||
} else if (index(quitchars, q)) {
|
} else if (strchr(quitchars, q)) {
|
||||||
q = def;
|
q = def;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!index(resp, q) && !digit_ok) {
|
if (!strchr(resp, q) && !digit_ok) {
|
||||||
tty_nhbell();
|
tty_nhbell();
|
||||||
q = (char) 0;
|
q = (char) 0;
|
||||||
} else if (q == '#' || digit_ok) {
|
} else if (q == '#' || digit_ok) {
|
||||||
@@ -498,7 +498,7 @@ tty_yn_function(
|
|||||||
break; /* overflow: try again */
|
break; /* overflow: try again */
|
||||||
digit_string[0] = z;
|
digit_string[0] = z;
|
||||||
addtopl(digit_string), n_len++;
|
addtopl(digit_string), n_len++;
|
||||||
} else if (z == 'y' || index(quitchars, z)) {
|
} else if (z == 'y' || strchr(quitchars, z)) {
|
||||||
if (z == '\033')
|
if (z == '\033')
|
||||||
value = -1; /* abort */
|
value = -1; /* abort */
|
||||||
z = '\n'; /* break */
|
z = '\n'; /* break */
|
||||||
|
|||||||
+16
-16
@@ -637,9 +637,9 @@ tty_player_selection(void)
|
|||||||
tty_putstr(BASE_WINDOW, 0, prompt);
|
tty_putstr(BASE_WINDOW, 0, prompt);
|
||||||
do {
|
do {
|
||||||
pick4u = lowc(readchar());
|
pick4u = lowc(readchar());
|
||||||
if (index(quitchars, pick4u))
|
if (strchr(quitchars, pick4u))
|
||||||
pick4u = 'y';
|
pick4u = 'y';
|
||||||
} while (!index(ynaqchars, pick4u));
|
} while (!strchr(ynaqchars, pick4u));
|
||||||
if ((int) strlen(prompt) + 1 < CO) {
|
if ((int) strlen(prompt) + 1 < CO) {
|
||||||
/* Echo choice and move back down line */
|
/* Echo choice and move back down line */
|
||||||
tty_putsym(BASE_WINDOW, (int) strlen(prompt) + 1, echoline,
|
tty_putsym(BASE_WINDOW, (int) strlen(prompt) + 1, echoline,
|
||||||
@@ -2039,11 +2039,11 @@ process_menu_window(winid window, struct WinDesc *cw)
|
|||||||
accelerator; including it in gacc allows gold to
|
accelerator; including it in gacc allows gold to
|
||||||
be selected via group when not on current page */
|
be selected via group when not on current page */
|
||||||
|| curr->gselector == GOLD_SYM)
|
|| curr->gselector == GOLD_SYM)
|
||||||
&& !index(gacc, curr->gselector)
|
&& !strchr(gacc, curr->gselector)
|
||||||
&& (cw->how == PICK_ANY
|
&& (cw->how == PICK_ANY
|
||||||
|| gcnt[GSELIDX(curr->gselector)] == 1)) {
|
|| gcnt[GSELIDX(curr->gselector)] == 1)) {
|
||||||
*rp++ = curr->gselector;
|
*rp++ = curr->gselector;
|
||||||
*rp = '\0'; /* re-terminate for index() */
|
*rp = '\0'; /* re-terminate for strchr() */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp_len = 0; /* lint suppression */
|
resp_len = 0; /* lint suppression */
|
||||||
@@ -2101,7 +2101,7 @@ process_menu_window(winid window, struct WinDesc *cw)
|
|||||||
entries, so we don't rely on curr->identifier here) */
|
entries, so we don't rely on curr->identifier here) */
|
||||||
attr_n = 0; /* whole line */
|
attr_n = 0; /* whole line */
|
||||||
if (curr->str[0] && curr->str[1] == ' '
|
if (curr->str[0] && curr->str[1] == ' '
|
||||||
&& curr->str[2] && index("-+#", curr->str[2])
|
&& curr->str[2] && strchr("-+#", curr->str[2])
|
||||||
&& curr->str[3] == ' ')
|
&& curr->str[3] == ' ')
|
||||||
/* [0]=letter, [1]==space, [2]=[-+#], [3]=space */
|
/* [0]=letter, [1]==space, [2]=[-+#], [3]=space */
|
||||||
attr_n = 4; /* [4:N]=entry description */
|
attr_n = 4; /* [4:N]=entry description */
|
||||||
@@ -2198,7 +2198,7 @@ process_menu_window(winid window, struct WinDesc *cw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
really_morc = morc; /* (only used with MENU_EXPLICIT_CHOICE) */
|
really_morc = morc; /* (only used with MENU_EXPLICIT_CHOICE) */
|
||||||
if ((rp = index(resp, morc)) != 0 && rp < resp + resp_len)
|
if ((rp = strchr(resp, morc)) != 0 && rp < resp + resp_len)
|
||||||
/* explicit menu selection; don't override it if it also
|
/* explicit menu selection; don't override it if it also
|
||||||
happens to match a mapped menu command (such as ':' to
|
happens to match a mapped menu command (such as ':' to
|
||||||
look inside a container vs ':' to search) */
|
look inside a container vs ':' to search) */
|
||||||
@@ -2220,7 +2220,7 @@ process_menu_window(winid window, struct WinDesc *cw)
|
|||||||
/* special case: '0' is also the default ball class;
|
/* special case: '0' is also the default ball class;
|
||||||
some menus use digits as potential group accelerators
|
some menus use digits as potential group accelerators
|
||||||
but their entries don't rely on counts */
|
but their entries don't rely on counts */
|
||||||
if (!counting && index(gacc, morc))
|
if (!counting && strchr(gacc, morc))
|
||||||
goto group_accel;
|
goto group_accel;
|
||||||
|
|
||||||
count = (count * 10L) + (long) (morc - '0');
|
count = (count * 10L) + (long) (morc - '0');
|
||||||
@@ -2373,11 +2373,11 @@ process_menu_window(winid window, struct WinDesc *cw)
|
|||||||
morc = really_morc;
|
morc = really_morc;
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
default:
|
default:
|
||||||
if (cw->how == PICK_NONE || !index(resp, morc)) {
|
if (cw->how == PICK_NONE || !strchr(resp, morc)) {
|
||||||
/* unacceptable input received */
|
/* unacceptable input received */
|
||||||
tty_nhbell();
|
tty_nhbell();
|
||||||
break;
|
break;
|
||||||
} else if (index(gacc, morc)) {
|
} else if (strchr(gacc, morc)) {
|
||||||
group_accel:
|
group_accel:
|
||||||
/* group accelerator; for the PICK_ONE case, we know that
|
/* group accelerator; for the PICK_ONE case, we know that
|
||||||
it matches exactly one item in order to be in gacc[] */
|
it matches exactly one item in order to be in gacc[] */
|
||||||
@@ -2820,7 +2820,7 @@ compress_str(const char *str)
|
|||||||
/* compress out consecutive spaces if line is too long;
|
/* compress out consecutive spaces if line is too long;
|
||||||
topline wrapping converts space at wrap point into newline,
|
topline wrapping converts space at wrap point into newline,
|
||||||
we reverse that here */
|
we reverse that here */
|
||||||
if ((int) strlen(str) >= CO || index(str, '\n')) {
|
if ((int) strlen(str) >= CO || strchr(str, '\n')) {
|
||||||
const char *in_str = str;
|
const char *in_str = str;
|
||||||
char c, *outstr = cbuf, *outend = &cbuf[sizeof cbuf - 1];
|
char c, *outstr = cbuf, *outend = &cbuf[sizeof cbuf - 1];
|
||||||
boolean was_space = TRUE; /* True discards all leading spaces;
|
boolean was_space = TRUE; /* True discards all leading spaces;
|
||||||
@@ -2919,7 +2919,7 @@ tty_putstr(winid window, int attr, const char *str)
|
|||||||
*ob = '\0';
|
*ob = '\0';
|
||||||
if (!cw->cury && (int) strlen(str) >= CO) {
|
if (!cw->cury && (int) strlen(str) >= CO) {
|
||||||
/* the characters before "St:" are unnecessary */
|
/* the characters before "St:" are unnecessary */
|
||||||
nb = index(str, ':');
|
nb = strchr(str, ':');
|
||||||
if (nb && nb > str + 2)
|
if (nb && nb > str + 2)
|
||||||
str = nb - 2;
|
str = nb - 2;
|
||||||
}
|
}
|
||||||
@@ -3102,13 +3102,13 @@ tty_display_file(const char *fname, boolean complain)
|
|||||||
wins[datawin]->offy = 0;
|
wins[datawin]->offy = 0;
|
||||||
}
|
}
|
||||||
while (dlb_fgets(buf, BUFSZ, f)) {
|
while (dlb_fgets(buf, BUFSZ, f)) {
|
||||||
if ((cr = index(buf, '\n')) != 0)
|
if ((cr = strchr(buf, '\n')) != 0)
|
||||||
*cr = 0;
|
*cr = 0;
|
||||||
#ifdef MSDOS
|
#ifdef MSDOS
|
||||||
if ((cr = index(buf, '\r')) != 0)
|
if ((cr = strchr(buf, '\r')) != 0)
|
||||||
*cr = 0;
|
*cr = 0;
|
||||||
#endif
|
#endif
|
||||||
if (index(buf, '\t') != 0)
|
if (strchr(buf, '\t') != 0)
|
||||||
(void) tabexpand(buf);
|
(void) tabexpand(buf);
|
||||||
empty = FALSE;
|
empty = FALSE;
|
||||||
tty_putstr(datawin, 0, buf);
|
tty_putstr(datawin, 0, buf);
|
||||||
@@ -4838,7 +4838,7 @@ tty_status_update(int fldidx, genericptr_t ptr, int chg UNUSED, int percent,
|
|||||||
break;
|
break;
|
||||||
case BL_GOLD:
|
case BL_GOLD:
|
||||||
/* \GXXXXNNNN counts as 1 [moot since we use decode_mixed() above] */
|
/* \GXXXXNNNN counts as 1 [moot since we use decode_mixed() above] */
|
||||||
if ((p = index(status_vals[fldidx], '\\')) != 0 && p[1] == 'G')
|
if ((p = strchr(status_vals[fldidx], '\\')) != 0 && p[1] == 'G')
|
||||||
tty_status[NOW][fldidx].lth -= (10 - 1);
|
tty_status[NOW][fldidx].lth -= (10 - 1);
|
||||||
break;
|
break;
|
||||||
case BL_CAP:
|
case BL_CAP:
|
||||||
@@ -5139,7 +5139,7 @@ shrink_dlvl(int lvl)
|
|||||||
{
|
{
|
||||||
/* try changing Dlvl: to Dl: */
|
/* try changing Dlvl: to Dl: */
|
||||||
char buf[BUFSZ];
|
char buf[BUFSZ];
|
||||||
char *levval = index(status_vals[BL_LEVELDESC], ':');
|
char *levval = strchr(status_vals[BL_LEVELDESC], ':');
|
||||||
|
|
||||||
if (levval) {
|
if (levval) {
|
||||||
dlvl_shrinklvl = lvl;
|
dlvl_shrinklvl = lvl;
|
||||||
|
|||||||
+1
-1
@@ -405,7 +405,7 @@ MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
if (GetNHApp()->regNetHackMode && ((lParam & 1 << 29) != 0)) {
|
if (GetNHApp()->regNetHackMode && ((lParam & 1 << 29) != 0)) {
|
||||||
unsigned char c = (unsigned char) (wParam & 0xFF);
|
unsigned char c = (unsigned char) (wParam & 0xFF);
|
||||||
unsigned char scancode = (lParam >> 16) & 0xFF;
|
unsigned char scancode = (lParam >> 16) & 0xFF;
|
||||||
if (index(extendedlist, tolower(c)) != 0) {
|
if (strchr(extendedlist, tolower(c)) != 0) {
|
||||||
NHEVENT_KBD(M(tolower(c)));
|
NHEVENT_KBD(M(tolower(c)));
|
||||||
} else if (scancode == (SCANLO + SIZE(scanmap)) - 1) {
|
} else if (scancode == (SCANLO + SIZE(scanmap)) - 1) {
|
||||||
NHEVENT_KBD(M('?'));
|
NHEVENT_KBD(M('?'));
|
||||||
|
|||||||
+16
-16
@@ -362,9 +362,9 @@ prompt_for_player_selection(void)
|
|||||||
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
/* tty_putstr(BASE_WINDOW, 0, prompt); */
|
||||||
do {
|
do {
|
||||||
/* pick4u = lowc(readchar()); */
|
/* pick4u = lowc(readchar()); */
|
||||||
if (index(quitchars, pick4u))
|
if (strchr(quitchars, pick4u))
|
||||||
pick4u = 'y';
|
pick4u = 'y';
|
||||||
} while (!index(ynqchars, pick4u));
|
} while (!strchr(ynqchars, pick4u));
|
||||||
if ((int) strlen(prompt) + 1 < CO) {
|
if ((int) strlen(prompt) + 1 < CO) {
|
||||||
/* Echo choice and move back down line */
|
/* Echo choice and move back down line */
|
||||||
/* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
|
/* tty_putsym(BASE_WINDOW, (int)strlen(prompt)+1, echoline,
|
||||||
@@ -1555,10 +1555,10 @@ mswin_yn_function(const char *question, const char *choices, char def)
|
|||||||
if (choices) {
|
if (choices) {
|
||||||
char *cb, choicebuf[QBUFSZ];
|
char *cb, choicebuf[QBUFSZ];
|
||||||
|
|
||||||
allow_num = (index(choices, '#') != 0);
|
allow_num = (strchr(choices, '#') != 0);
|
||||||
|
|
||||||
Strcpy(choicebuf, choices);
|
Strcpy(choicebuf, choices);
|
||||||
if ((cb = index(choicebuf, '\033')) != 0) {
|
if ((cb = strchr(choicebuf, '\033')) != 0) {
|
||||||
/* anything beyond <esc> is hidden */
|
/* anything beyond <esc> is hidden */
|
||||||
*cb = '\0';
|
*cb = '\0';
|
||||||
}
|
}
|
||||||
@@ -1570,7 +1570,7 @@ mswin_yn_function(const char *question, const char *choices, char def)
|
|||||||
Strcat(message, " ");
|
Strcat(message, " ");
|
||||||
/* escape maps to 'q' or 'n' or default, in that order */
|
/* escape maps to 'q' or 'n' or default, in that order */
|
||||||
yn_esc_map =
|
yn_esc_map =
|
||||||
(index(choices, 'q') ? 'q' : (index(choices, 'n') ? 'n' : def));
|
(strchr(choices, 'q') ? 'q' : (strchr(choices, 'n') ? 'n' : def));
|
||||||
} else {
|
} else {
|
||||||
Strcpy(message, question);
|
Strcpy(message, question);
|
||||||
Strcat(message, " ");
|
Strcat(message, " ");
|
||||||
@@ -1597,17 +1597,17 @@ mswin_yn_function(const char *question, const char *choices, char def)
|
|||||||
|
|
||||||
digit_ok = allow_num && digit(ch);
|
digit_ok = allow_num && digit(ch);
|
||||||
if (ch == '\033') {
|
if (ch == '\033') {
|
||||||
if (index(choices, 'q'))
|
if (strchr(choices, 'q'))
|
||||||
ch = 'q';
|
ch = 'q';
|
||||||
else if (index(choices, 'n'))
|
else if (strchr(choices, 'n'))
|
||||||
ch = 'n';
|
ch = 'n';
|
||||||
else
|
else
|
||||||
ch = def;
|
ch = def;
|
||||||
break;
|
break;
|
||||||
} else if (index(quitchars, ch)) {
|
} else if (strchr(quitchars, ch)) {
|
||||||
ch = def;
|
ch = def;
|
||||||
break;
|
break;
|
||||||
} else if (!index(choices, ch) && !digit_ok) {
|
} else if (!strchr(choices, ch) && !digit_ok) {
|
||||||
mswin_nhbell();
|
mswin_nhbell();
|
||||||
ch = (char) 0;
|
ch = (char) 0;
|
||||||
/* and try again... */
|
/* and try again... */
|
||||||
@@ -1634,7 +1634,7 @@ mswin_yn_function(const char *question, const char *choices, char def)
|
|||||||
digit_string[0] = z;
|
digit_string[0] = z;
|
||||||
mswin_putstr_ex(WIN_MESSAGE, ATR_BOLD, digit_string, 1);
|
mswin_putstr_ex(WIN_MESSAGE, ATR_BOLD, digit_string, 1);
|
||||||
n_len++;
|
n_len++;
|
||||||
} else if (z == 'y' || index(quitchars, z)) {
|
} else if (z == 'y' || strchr(quitchars, z)) {
|
||||||
if (z == '\033')
|
if (z == '\033')
|
||||||
value = -1; /* abort */
|
value = -1; /* abort */
|
||||||
z = '\n'; /* break */
|
z = '\n'; /* break */
|
||||||
@@ -2705,29 +2705,29 @@ mswin_color_from_string(char *colorstring, HBRUSH *brushptr,
|
|||||||
if (strlen(++colorstring) != 6)
|
if (strlen(++colorstring) != 6)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
red_value = (int) (index(hexadecimals, tolower((uchar) *colorstring))
|
red_value = (int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
red_value *= 16;
|
red_value *= 16;
|
||||||
red_value += (int) (index(hexadecimals, tolower((uchar) *colorstring))
|
red_value += (int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|
||||||
green_value = (int) (index(hexadecimals,
|
green_value = (int) (strchr(hexadecimals,
|
||||||
tolower((uchar) *colorstring))
|
tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
green_value *= 16;
|
green_value *= 16;
|
||||||
green_value += (int) (index(hexadecimals,
|
green_value += (int) (strchr(hexadecimals,
|
||||||
tolower((uchar) *colorstring))
|
tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|
||||||
blue_value = (int) (index(hexadecimals, tolower((uchar) *colorstring))
|
blue_value = (int) (strchr(hexadecimals, tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
blue_value *= 16;
|
blue_value *= 16;
|
||||||
blue_value += (int) (index(hexadecimals,
|
blue_value += (int) (strchr(hexadecimals,
|
||||||
tolower((uchar) *colorstring))
|
tolower((uchar) *colorstring))
|
||||||
- hexadecimals);
|
- hexadecimals);
|
||||||
++colorstring;
|
++colorstring;
|
||||||
|
|||||||
Reference in New Issue
Block a user