ADD_FLG(FLG_UNIQUE);
}
- if (o_ptr->tval == TV_CORPSE && strchr("pht", r_info[o_ptr->pval].d_char))
+ if (o_ptr->tval == TV_CORPSE && my_strchr("pht", r_info[o_ptr->pval].d_char))
{
ADD_FLG(FLG_HUMAN);
}
/*** Human corpse/skeletons (for Daemon magic) ***/
if (IS_FLG(FLG_HUMAN) &&
(o_ptr->tval != TV_CORPSE ||
- !strchr("pht", r_info[o_ptr->pval].d_char)))
+ !my_strchr("pht", r_info[o_ptr->pval].d_char)))
return FALSE;
/*** Unreadable spellbooks ***/
}
else
{
-#ifdef JP
- if (!strstr_j(o_name, ptr)) return FALSE;
-#else
- if (!strstr(o_name, ptr)) return FALSE;
-#endif
+ if (!my_strstr(o_name, ptr)) return FALSE;
}
/* TRUE when it need not to be 'collecting' */
{
if (o_ptr->tval == TV_CORPSE &&
o_ptr->sval == SV_CORPSE &&
- strchr("pht", r_info[o_ptr->pval].d_char))
+ my_strchr("pht", r_info[o_ptr->pval].d_char))
return FALSE;
}
{
strncat(buff, format("¤Ë¡Ö%s¡×", insc), 80);
- if (strstr(insc, "%%all"))
+ if (my_strstr(insc, "%%all"))
strcat(buff, "(%%all¤ÏÁ´Ç½ÎϤòɽ¤¹±Ñ»ú¤Îµ¹æ¤ÇÃÖ´¹)");
- else if (strstr(insc, "%all"))
+ else if (my_strstr(insc, "%all"))
strcat(buff, "(%all¤ÏÁ´Ç½ÎϤòɽ¤¹µ¹æ¤ÇÃÖ´¹)");
- else if (strstr(insc, "%%"))
+ else if (my_strstr(insc, "%%"))
strcat(buff, "(%%¤ÏÄɲÃǽÎϤòɽ¤¹±Ñ»ú¤Îµ¹æ¤ÇÃÖ´¹)");
- else if (strstr(insc, "%"))
+ else if (my_strstr(insc, "%"))
strcat(buff, "(%¤ÏÄɲÃǽÎϤòɽ¤¹µ¹æ¤ÇÃÖ´¹)");
strcat(buff, "¤È¹ï¤ó¤Ç");
{
strncat(buff, format("and inscribe \"%s\"", insc), 80);
- if (strstr(insc, "%all"))
+ if (my_strstr(insc, "%all"))
strcat(buff, ", replacing %all with code string representing all abilities,");
- else if (strstr(insc, "%"))
+ else if (my_strstr(insc, "%"))
strcat(buff, ", replacing % with code string representing extra random abilities,");
strcat(buff, " on ");
}
/* Look for the string pattern */
-#ifdef JP
- pos = strstr_j(tb->lines_list[i], search_str);
-#else
- pos = strstr(tb->lines_list[i], search_str);
-#endif
+ pos = my_strstr(tb->lines_list[i], search_str);
/* Not found! */
if (!pos) continue;
if (r_ptr->flags1 & (RF1_UNIQUE)) return FALSE;
- if (strchr("pht", r_ptr->d_char)) return TRUE;
+ if (my_strchr("pht", r_ptr->d_char)) return TRUE;
return FALSE;
}
if (isupper(temp2[xx])) temp2[xx] = tolower(temp2[xx]);
#ifdef JP
- if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp))
+ if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp))
#else
- if (strstr(temp2, temp))
+ if (my_strstr(temp2, temp))
#endif
who[n++] = i;
}
else if (ma_ptr->effect == MA_SLOW)
{
if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
- strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
+ my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
{
#ifdef JP
msg_format("%s¤Î¼ó¤Ë´ØÀá½³¤ê¤ò¤¯¤é¤ï¤·¤¿¡ª", m_name);
if (isupper(temp2[xx])) temp2[xx]=tolower(temp2[xx]);
#ifdef JP
- if (strstr(temp2, temp) || strstr_j(r_name + r_ptr->name, temp) )
+ if (my_strstr(temp2, temp) || my_strstr(r_name + r_ptr->name, temp) )
#else
- if (strstr(temp2, temp))
+ if (my_strstr(temp2, temp))
#endif
who[n++]=i;
}
cptr str = msg;
/* Display matches */
- while ((str = strstr(str, shower)) != NULL)
+ while ((str = my_strstr(str, shower)) != NULL)
{
int len = strlen(shower);
cptr msg = message_str(z);
/* Search for it */
- if (strstr(msg, finder))
+ if (my_strstr(msg, finder))
{
/* New location */
i = z;
else
{
/* Check for race in the group */
- if (!strchr(group_char, r_ptr->d_char)) continue;
+ if (!my_strchr(group_char, r_ptr->d_char)) continue;
}
/* Add the race */
{
int NameLen = strlen(Name);
- if (strstr(Name, "Disembodied hand"))
+ if (my_strstr(Name, "Disembodied hand"))
{
strcpy(Name, "Disembodied hands that strangled people");
}
- else if (strstr(Name, "Colour out of space"))
+ else if (my_strstr(Name, "Colour out of space"))
{
strcpy(Name, "Colours out of space");
}
- else if (strstr(Name, "stairway to hell"))
+ else if (my_strstr(Name, "stairway to hell"))
{
strcpy(Name, "stairways to hell");
}
- else if (strstr(Name, "Dweller on the threshold"))
+ else if (my_strstr(Name, "Dweller on the threshold"))
{
strcpy(Name, "Dwellers on the threshold");
}
- else if (strstr(Name, " of "))
+ else if (my_strstr(Name, " of "))
{
- cptr aider = strstr(Name, " of ");
+ cptr aider = my_strstr(Name, " of ");
char dummy[80];
int i = 0;
cptr ctr = Name;
strcpy(&(dummy[i+1]), aider);
strcpy(Name, dummy);
}
- else if (strstr(Name, "coins"))
+ else if (my_strstr(Name, "coins"))
{
char dummy[80];
strcpy(dummy, "piles of ");
strcpy(Name, dummy);
return;
}
- else if (strstr(Name, "Manes"))
+ else if (my_strstr(Name, "Manes"))
{
return;
}
{
#ifdef JP
/* p,t¤Ï¿Í¤È¿ô¤¨¤ë by ita*/
- if(strchr("pt",r_ptr->d_char))
+ if(my_strchr("pt",r_ptr->d_char))
fprintf(fff, " %3d ¿Í¤Î %s\n", This, r_name + r_ptr->name);
else
fprintf(fff, " %3d ɤ¤Î %s\n", This, r_name + r_ptr->name);
#else
if (This < 2)
{
- if (strstr(r_name + r_ptr->name, "coins"))
+ if (my_strstr(r_name + r_ptr->name, "coins"))
{
fprintf(fff, " 1 pile of %s\n", (r_name + r_ptr->name));
}
if (o_ptr->sval != SV_CORPSE) return (FALSE);
- if (strchr("pht", r_info[o_ptr->pval].d_char)) return (TRUE);
+ if (my_strchr("pht", r_info[o_ptr->pval].d_char)) return (TRUE);
/* Assume not okay */
return (FALSE);
else if ((prace_is_(RACE_DEMON) ||
(mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_DEMON)) &&
(o_ptr->tval == TV_CORPSE && o_ptr->sval == SV_CORPSE &&
- strchr("pht", r_info[o_ptr->pval].d_char)))
+ my_strchr("pht", r_info[o_ptr->pval].d_char)))
{
/* Drain vitality of humanoids */
char o_name[MAX_NLEN];
{
if (o_ptr->tval == TV_CORPSE &&
o_ptr->sval == SV_CORPSE &&
- strchr("pht", r_info[o_ptr->pval].d_char))
+ my_strchr("pht", r_info[o_ptr->pval].d_char))
return TRUE;
}
if (!o_ptr->inscription) return;
/* Find a '!' */
-#ifdef JP
- s = strchr_j(quark_str(o_ptr->inscription), '!');
-#else
- s = strchr(quark_str(o_ptr->inscription), '!');
-#endif
+ s = my_strchr(quark_str(o_ptr->inscription), '!');
/* Process notification request. */
while (s)
}
/* Keep looking for '!'s */
-#ifdef JP
- s = strchr_j(s + 1, '!');
-#else
- s = strchr(s + 1, '!');
-#endif
+ s = my_strchr(s + 1, '!');
}
}
{
monster_race *r_ptr = &r_info[r_idx];
- if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && strchr("Jjlw", r_ptr->d_char))
+ if ((r_ptr->flags7 & RF7_AQUATIC) && !(r_ptr->flags1 & RF1_UNIQUE) && my_strchr("Jjlw", r_ptr->d_char))
return TRUE;
else
return FALSE;
str = death_message;
if (strncmp(str, "¡Ö", 2) == 0) str += 2;
- str2 = strstr_j(str, "¡×");
+ str2 = my_strstr(str, "¡×");
if (str2 != NULL) *str2 = '\0';
i = 0;
while (i < 9)
{
- str2 = strstr_j(str, " ");
+ str2 = my_strstr(str, " ");
if (str2 == NULL) len = strlen(str);
else len = str2 - str;
extern size_t my_strcpy(char *buf, const char *src, size_t bufsize);
extern size_t my_strcat(char *buf, const char *src, size_t bufsize);
+extern char *my_strstr(const char *haystack, const char *needle);
+extern char *my_strchr(const char *ptr, char ch);
extern int inkey_special(void);
extern void jverb2( const char *in , char *out);
extern void jverb3( const char *in , char *out);
extern void jverb( const char *in , char *out , int flag);
-extern char* strstr_j(cptr str1, cptr str2);
-extern char *strchr_j(const char *ptr, char ch);
extern void sjis2euc(char *str);
extern void euc2sjis(char *str);
extern byte codeconv(char *str);
case 'Z':
{
/* Find the colon */
- char *t = strchr(buf + 2, ':');
+ char *t = my_strchr(buf + 2, ':');
/* Oops */
if (!t) return 1;
int i;
/* Accept all printables except spaces and brackets */
- for (i = 0; isprint(*s) && !strchr(" []", *s); i++)
+ for (i = 0; isprint(*s) && !my_strchr(" []", *s); i++)
b[i] = *s++;
/* Terminate */
}
/* Hack -- keep searching */
- if (find && !i && !strstr(lc_buf, find)) continue;
+ if (find && !i && !my_strstr(lc_buf, find)) continue;
/* Hack -- stop searching */
find = NULL;
cptr s2 = lc_buf;
/* Display matches */
- while ((s2 = strstr(s2, shower)) != NULL)
+ while ((s2 = my_strstr(s2, shower)) != NULL)
{
int len = strlen(shower);
}
#ifdef MSDOS
/* Convert space, dot, and underscore to underscore */
- else if (strchr(". _", c)) player_base[k++] = '_';
+ else if (my_strchr(". _", c)) player_base[k++] = '_';
#endif
else if (isprint(c)) player_base[k++] = c;
}
while (1)
{
cptr t;
- t = strstr(s, PATH_SEP);
+ t = my_strstr(s, PATH_SEP);
if (!t)
break;
s = t+1;
}
-#ifdef JP
-#undef strchr
-#define strchr strchr_j
-#endif
-
-
/*
* Creates a description of the item "o_ptr", and stores it in "out_val".
*
if (*str)
{
/* Find the '#' */
- cptr str = strchr(quark_str(o_ptr->inscription), '#');
+ cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
/* Add the false name */
t = object_desc_str(t,"¡Ø");
t = object_desc_str(t, e_name + e_ptr->name);
}
- if (o_ptr->inscription && strchr(quark_str(o_ptr->inscription), '#'))
+ if (o_ptr->inscription && my_strchr(quark_str(o_ptr->inscription), '#'))
{
/* Find the '#' */
- cptr str = strchr(quark_str(o_ptr->inscription), '#');
+ cptr str = my_strchr(quark_str(o_ptr->inscription), '#');
/* Add the false name */
t = object_desc_chr(t, ' ');
if ((abbrev_extra || abbrev_all) && (o_ptr->ident & IDENT_MENTAL))
{
- if (!o_ptr->inscription || !strchr(quark_str(o_ptr->inscription), '%'))
+ if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '%'))
{
bool kanji, all;
char buf[1024];
#include "angband.h"
-#ifdef JP
-#undef strchr
-#define strchr strchr_j
-#endif
/*
* This file is used to initialize various variables and arrays for the
* Angband game. Note the use of "fd_read()" and "fd_write()" to bypass
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
int xtra, type, first, weight;
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
stat = s;
/* Find the colon before the name */
- s = strchr(s, ':');
+ s = my_strchr(s, ':');
/* Verify that colon */
if (!s) return (1);
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
k_ptr->locale[i] = atoi(s+1);
/* Find the slash */
- t = strchr(s+1, '/');
+ t = my_strchr(s+1, '/');
/* Find the next colon */
- s = strchr(s+1, ':');
+ s = my_strchr(s+1, ':');
/* If the slash is "nearby", use it */
if (t && (!s || t < s))
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
if (buf[0] == 'N')
{
/* Find the colon before the name */
- s = strchr(buf+2, ':');
+ s = my_strchr(buf+2, ':');
/* Verify that colon */
if (!s) return (1);
index = atoi(s);
/* Find the colon after the building number */
- s = strchr(s, ':');
+ s = my_strchr(s, ':');
/* Verify that colon */
if (!s) return (1);
else
{
/* Accept all printables except spaces and brackets */
- while (isprint(*s) && !strchr(" []", *s)) ++s;
+ while (isprint(*s) && !my_strchr(" []", *s)) ++s;
/* Extract final and Terminate */
if ((f = *s) != '\0') *s++ = '\0';
}
}
-char* strstr_j(const char* s, const char* t)
-{
- int i, l1, l2;
-
- l1 = strlen(s);
- l2 = strlen(t);
- if (l1 >= l2) {
- for(i = 0; i <= l1 - l2; i++) {
- if(!strncmp(s + i, t, l2))
- return (char *)s + i;
- if (iskanji(*(s + i)))
- i++;
- }
- }
- return NULL;
-}
-
-
-char *strchr_j(const char *ptr, char ch)
-{
- for ( ; *ptr != '\0'; ++ptr)
- {
- if (*ptr == ch) return (char *)ptr;
- if (iskanji(*ptr)) ++ptr;
- }
-
- return NULL;
-}
-
/*
* Convert SJIS string to EUC string
}
/* Find first 'X' */
- s = strchr(p, 'X');
+ s = my_strchr(p, 'X');
/* Extract font width */
wid = atoi(p);
cptr s;
/* Find equal sign */
- s = strchr(info, '=');
+ s = my_strchr(info, '=');
/* Verify equal sign */
if (!s) quit_fmt("Try '-d<what>=<path>' not '-d%s'", info);
case SUMMON_ANIMAL_RANGER:
{
okay = ((r_ptr->flags3 & (RF3_ANIMAL)) &&
- (strchr("abcflqrwBCHIJKMRS", r_ptr->d_char)) &&
+ (my_strchr("abcflqrwBCHIJKMRS", r_ptr->d_char)) &&
!(r_ptr->flags3 & (RF3_DRAGON)) &&
!(r_ptr->flags3 & (RF3_EVIL)) &&
!(r_ptr->flags3 & (RF3_UNDEAD)) &&
/* Mushrooms, Eyes, Jellies, Molds, Vortices, Worms, Quylthulgs */
- if (strchr(",ejmvwQ", r_ptr->d_char))
+ if (my_strchr(",ejmvwQ", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95)
/* Fish */
- else if (strchr("l", r_ptr->d_char))
+ else if (my_strchr("l", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Golems, Walls, Doors, Stairs */
- else if (strchr("g#+<>", r_ptr->d_char))
+ else if (my_strchr("g#+<>", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Snakes, Hydrae, Reptiles, Mimics */
- else if (strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char))
+ else if (my_strchr("JMR", r_ptr->d_char) || !isalpha(r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Felines */
- else if (strchr("f", r_ptr->d_char))
+ else if (my_strchr("f", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Ants, Centipedes, Flies, Insects, Beetles, Spiders */
- else if (strchr("acFIKS", r_ptr->d_char))
+ else if (my_strchr("acFIKS", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Birds */
- else if (strchr("B", r_ptr->d_char))
+ else if (my_strchr("B", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Dragons, Demons, High Undead */
- else if (strchr("duDLUW", r_ptr->d_char))
+ else if (my_strchr("duDLUW", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Skeletons */
- else if (strchr("s", r_ptr->d_char))
+ else if (my_strchr("s", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Zombies */
- else if (strchr("z", r_ptr->d_char))
+ else if (my_strchr("z", r_ptr->d_char))
{
if (percentage > 95)
#ifdef JP
/* Ghosts */
- else if (strchr("G", r_ptr->d_char))
+ else if (my_strchr("G", r_ptr->d_char))
{
if (percentage > 95)
/* Dogs and Hounds */
- else if (strchr("CZ", r_ptr->d_char))
+ else if (my_strchr("CZ", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95)
}
/* One type of monsters (ignore,squeal,shriek) */
- else if (strchr("Xbilqrt", r_ptr->d_char))
+ else if (my_strchr("Xbilqrt", r_ptr->d_char))
{
#ifdef JP
if (percentage > 95)
}
-#ifdef JP
-#undef strchr
-#define strchr strchr_j
-#endif
-
-
/*
* Find the "first" inventory object with the given "tag".
*
if (!item_tester_okay(o_ptr)) continue;
/* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
+ s = my_strchr(quark_str(o_ptr->inscription), '@');
/* Process all tags */
while (s)
}
/* Find another '@' */
- s = strchr(s + 1, '@');
+ s = my_strchr(s + 1, '@');
}
}
if (!item_tester_okay(o_ptr)) continue;
/* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
+ s = my_strchr(quark_str(o_ptr->inscription), '@');
/* Process all tags */
while (s)
}
/* Find another '@' */
- s = strchr(s + 1, '@');
+ s = my_strchr(s + 1, '@');
}
}
if (!o_ptr->inscription) continue;
/* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
+ s = my_strchr(quark_str(o_ptr->inscription), '@');
/* Process all tags */
while (s)
}
/* Find another '@' */
- s = strchr(s + 1, '@');
+ s = my_strchr(s + 1, '@');
}
}
if (!o_ptr->inscription) continue;
/* Find a '@' */
- s = strchr(quark_str(o_ptr->inscription), '@');
+ s = my_strchr(quark_str(o_ptr->inscription), '@');
/* Process all tags */
while (s)
}
/* Find another '@' */
- s = strchr(s + 1, '@');
+ s = my_strchr(s + 1, '@');
}
}
if (!o_ptr->inscription) return (TRUE);
/* Find a '!' */
- s = strchr(quark_str(o_ptr->inscription), '!');
+ s = my_strchr(quark_str(o_ptr->inscription), '!');
/* Process preventions */
while (s)
}
/* Find another '!' */
- s = strchr(s + 1, '!');
+ s = my_strchr(s + 1, '!');
}
/* Allow it */
{
char *ret;
- ret = strstr(buf->data, str);
+ ret = my_strstr(buf->data, str);
if (!ret) return -1;
if (r_ptr->flags3 & (RF3_EVIL)) return (FALSE);
/* Require icky thing, jelly, mold, or mushroom */
- if (!strchr("ijm,", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("ijm,", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
if (!vault_monster_okay(r_idx)) return (FALSE);
/* Require a Zephyr Hound or a dog */
- if (!strchr("CZ", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("CZ", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
if (!vault_monster_okay(r_idx)) return (FALSE);
/* Require mimic */
- if (!strchr("!|$?=", r_ptr->d_char)) return (FALSE);
+ if (!my_strchr("!|$?=", r_ptr->d_char)) return (FALSE);
/* Okay */
return (TRUE);
c = s[randint0(strlen(s))];
/* Lookup this color */
- a = strchr(color_char, c) - color_char;
+ a = my_strchr(color_char, c) - color_char;
/* Invalid color (note check for < 0 removed, gave a silly
* warning because bytes are always >= 0 -- RG) */
if (distance(py, px, y, x) > range) continue;
/* Detect monsters with the same symbol */
- if (strchr(Match, r_ptr->d_char))
+ if (my_strchr(Match, r_ptr->d_char))
{
/* Update monster recall window */
if (p_ptr->monster_race_idx == m_ptr->r_idx)
if (r_ptr->flags3 & RF3_ANIMAL) break;
/* Accept mimics */
- if (strchr("?!", r_ptr->d_char)) break;
+ if (my_strchr("?!", r_ptr->d_char)) break;
}
}
case TV_POLEARM:
u = file+1;
/* Look for non-user portion of the file */
- s = strstr(u, PATH_SEP);
+ s = my_strstr(u, PATH_SEP);
/* Hack -- no long user names */
if (s && (s >= u + sizeof(user))) return (1);
if (path_parse(buf, 1024, file)) return (NULL);
#if defined(MACINTOSH) && defined(MAC_MPW)
- if (strchr(mode, 'w'))
+ if (my_strchr(mode, 'w'))
{
/* setting file type/creator */
tempfff = fopen(buf, mode);
/* Invalid trigger name? */
if (i == max_macrotrigger)
{
- str = strchr(str, ']');
+ str = my_strchr(str, ']');
if (str)
{
*s++ = (char)31;
switch(ch)
{
case '&':
- while ((tmp = strchr(macro_modifier_chr, *str)))
+ while ((tmp = my_strchr(macro_modifier_chr, *str)))
{
j = (int)(tmp - macro_modifier_chr);
tmp = macro_modifier_name[j];
if (always_repeat && (command_arg <= 0))
{
/* Hack -- auto repeat certain commands */
- if (strchr("TBDoc+", command_cmd))
+ if (my_strchr("TBDoc+", command_cmd))
{
/* Repeat 99 times */
command_arg = 99;
caretcmd = command_cmd;
#endif
-#ifdef JP
-#undef strchr
-#define strchr strchr_j
-#endif
-
/* Hack -- Scan equipment */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
s = quark_str(o_ptr->inscription);
/* Find a '^' */
- s = strchr(s, '^');
+ s = my_strchr(s, '^');
/* Process preventions */
while (s)
}
/* Find another '^' */
- s = strchr(s + 1, '^');
+ s = my_strchr(s + 1, '^');
}
}
int b_len, t_len, i_len;
/* Attempt to find the target (modify "buf") */
- buf = strstr(buf, target);
+ buf = my_strstr(buf, target);
/* No target found */
if (!buf) return (FALSE);
/*
+ * A copy of ANSI strstr()
+ *
+ * my_strstr() can handle Kanji strings correctly.
+ */
+char *my_strstr(const char *haystack, const char *needle)
+{
+ int i;
+ int l1 = strlen(haystack);
+ int l2 = strlen(needle);
+
+ if (l1 >= l2)
+ {
+ for(i = 0; i <= l1 - l2; i++)
+ {
+ if(!strncmp(haystack + i, needle, l2))
+ return (char *)haystack + i;
+
+#ifdef JP
+ if (iskanji(*(haystack + i))) i++;
+#endif
+ }
+ }
+
+ return NULL;
+}
+
+
+/*
+ * A copy of ANSI my_strchr()
+ *
+ * my_strchr() can handle Kanji strings correctly.
+ */
+char *my_strchr(const char *ptr, char ch)
+{
+ for ( ; *ptr != '\0'; ptr++)
+ {
+ if (*ptr == ch) return (char *)ptr;
+
+#ifdef JP
+ if (iskanji(*ptr)) ptr++;
+#endif
+ }
+
+ return NULL;
+}
+
+
+/*
* Get a keypress from the user.
* And interpret special keys as internal code.
*
}
-#ifdef JP
-#undef strchr
-#define strchr strchr_j
-#endif
-
-
/*
* Calculate the players current "state", taking into account
* not only race/class intrinsics, but also objects being worn
if (have_flag(flgs, TR_FREE_ACT)) p_ptr->free_act = TRUE;
if (have_flag(flgs, TR_HOLD_LIFE)) p_ptr->hold_life = TRUE;
if (have_flag(flgs, TR_WARNING)){
- if (!o_ptr->inscription || !(strchr(quark_str(o_ptr->inscription),'$')))
+ if (!o_ptr->inscription || !(my_strchr(quark_str(o_ptr->inscription),'$')))
p_ptr->warning = TRUE;
}
cptr insc = quark_str(o_ptr->inscription);
if (o_ptr->inscription &&
- (strchr(insc, '.') || strchr(insc, '%')))
+ (my_strchr(insc, '.') || my_strchr(insc, '%')))
{
/*
* {.} will stop random teleportation.