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:
@@ -183,7 +183,7 @@ curses_line_input_dialog(
|
||||
[Note: wgetnstr() treats <escape> as an ordinary character
|
||||
so user has to type <escape><return> for it to behave the
|
||||
way we want it to.] */
|
||||
if (input[0] != '\033' && index(input, '\033') != 0)
|
||||
if (input[0] != '\033' && strchr(input, '\033') != 0)
|
||||
input[0] = '\0';
|
||||
} while (--trylim > 0 && !input[0]);
|
||||
curs_set(0);
|
||||
@@ -344,7 +344,7 @@ curses_character_input_dialog(
|
||||
break;
|
||||
}
|
||||
|
||||
if (choices != NULL && answer != '\0' && index(choices, answer))
|
||||
if (choices != NULL && answer != '\0' && strchr(choices, answer))
|
||||
break;
|
||||
}
|
||||
curs_set(0);
|
||||
|
||||
@@ -234,7 +234,7 @@ curses_block(boolean noscroll) /* noscroll - blocking because of msgtype
|
||||
ret = '\n';
|
||||
/* msgtype=stop should require space/enter rather than any key,
|
||||
as we want to prevent YASD from direction keys. */
|
||||
} while (!index(resp, (char) ret));
|
||||
} while (!strchr(resp, (char) ret));
|
||||
if (oldcrsr >= 0)
|
||||
(void) curs_set(oldcrsr);
|
||||
|
||||
|
||||
@@ -552,7 +552,7 @@ draw_horizontal(boolean border)
|
||||
case BL_SCORE:
|
||||
#ifdef SCORE_ON_BOTL
|
||||
if ((sho_score & 2) != 0) { /* strip "S:" prefix */
|
||||
if ((colon = index(text, ':')) != 0)
|
||||
if ((colon = strchr(text, ':')) != 0)
|
||||
text = strcat(strcpy(sbuf, " "), colon + 1);
|
||||
else
|
||||
sho_score = 0;
|
||||
@@ -857,7 +857,7 @@ draw_vertical(boolean border)
|
||||
/* most status_vals_long[] are "long-text : value" and
|
||||
unlike horizontal status's abbreviated "ab:value",
|
||||
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;
|
||||
while (*p == ' ')
|
||||
++p;
|
||||
@@ -872,7 +872,7 @@ draw_vertical(boolean border)
|
||||
*p = savedch;
|
||||
text = p; /* rest of field */
|
||||
if ((fld == BL_HPMAX || fld == BL_ENEMAX)
|
||||
&& (p = index(text, ')')) != 0) {
|
||||
&& (p = strchr(text, ')')) != 0) {
|
||||
savedch = *p;
|
||||
*p = '\0';
|
||||
} else
|
||||
@@ -1152,7 +1152,7 @@ curs_vert_status_vals(int win_width)
|
||||
} else {
|
||||
text = status_vals[fldidx];
|
||||
if (fldidx != BL_TITLE && fldidx != BL_LEVELDESC) {
|
||||
if ((colon = index(text, ':')) != 0)
|
||||
if ((colon = strchr(text, ':')) != 0)
|
||||
text = colon + 1;
|
||||
}
|
||||
lbl = status_fieldnm[fldidx];
|
||||
|
||||
Reference in New Issue
Block a user