Replaced calls to the custom strindex() and strrindex() functions with the

exactly equivalent and standard strchr() and strrchr() functions instead.
This commit is contained in:
dtrg 2006-07-23 20:01:02 +00:00
parent babe9eafad
commit 014be56fb0
40 changed files with 112 additions and 116 deletions

View file

@ -235,7 +235,7 @@ File *stream;
} }
} }
extern char *strindex(); extern char *strchr();
getline() getline()
{ {
@ -244,7 +244,7 @@ getline()
if ( our_fgets(inputline,MAXLINELENGTH,yyin) == 0) if ( our_fgets(inputline,MAXLINELENGTH,yyin) == 0)
return(FALSE); return(FALSE);
yylineno ++; yylineno ++;
if ( strindex(inputline,'\n') == 0) if ( strchr(inputline,'\n') == 0)
error("source line too long"); error("source line too long");
inputline[MAXLINELENGTH-1]=0; inputline[MAXLINELENGTH-1]=0;
if ( listing) if ( listing)

View file

@ -34,12 +34,12 @@ getwdir(fn)
register char *fn; register char *fn;
{ {
register char *p; register char *p;
char *strrindex(); char *strrchr();
p = strrindex(fn, '/'); p = strrchr(fn, '/');
while (p && *(p + 1) == '\0') { /* remove trailing /'s */ while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0'; *p = '\0';
p = strrindex(fn, '/'); p = strrchr(fn, '/');
} }
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */

View file

@ -38,7 +38,7 @@
extern char *bts2str(); extern char *bts2str();
extern char *symbol2str(); extern char *symbol2str();
extern char *strindex(); extern char *strchr();
int stat_number = 9999; /* static scope number */ int stat_number = 9999; /* static scope number */
struct outdef OutDef; struct outdef OutDef;
@ -491,7 +491,7 @@ outargtype(tp)
if (is_anon_idf(tp->tp_idf)) { if (is_anon_idf(tp->tp_idf)) {
/* skip the #<num>, replace it by '#anonymous id' */ /* skip the #<num>, replace it by '#anonymous id' */
printf("#anonymous id%s", printf("#anonymous id%s",
strindex(tp->tp_idf->id_text, ' ') strchr(tp->tp_idf->id_text, ' ')
); );
} }
else { else {

View file

@ -139,7 +139,7 @@ main(argc, argv)
#ifndef NOPP #ifndef NOPP
struct dependency *file_head; struct dependency *file_head;
extern char *strrindex(); extern char *strrchr();
list_dependencies(source) list_dependencies(source)
char *source; char *source;
@ -147,7 +147,7 @@ char *source;
register struct dependency *p = file_head; register struct dependency *p = file_head;
if (source) { if (source) {
register char *s = strrindex(source, '.'); register char *s = strrchr(source, '.');
if (s && *(s+1)) { if (s && *(s+1)) {
s++; s++;
@ -157,7 +157,7 @@ char *source;
* object generated, so don't include the pathname * object generated, so don't include the pathname
* leading to it. * leading to it.
*/ */
if (s = strrindex(source, '/')) { if (s = strrchr(source, '/')) {
source = s + 1; source = s + 1;
} }
} }

View file

@ -31,12 +31,12 @@ getwdir(fn)
register char *fn; register char *fn;
{ {
register char *p; register char *p;
char *strrindex(); char *strrchr();
p = strrindex(fn, '/'); p = strrchr(fn, '/');
while (p && *(p + 1) == '\0') { /* remove trailing /'s */ while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0'; *p = '\0';
p = strrindex(fn, '/'); p = strrchr(fn, '/');
} }
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */

View file

@ -37,7 +37,7 @@
extern char *bts2str(); extern char *bts2str();
extern char *symbol2str(); extern char *symbol2str();
extern char *strindex(); extern char *strchr();
int stat_number = 9999; /* static scope number */ int stat_number = 9999; /* static scope number */
struct outdef OutDef; struct outdef OutDef;
@ -460,7 +460,7 @@ outargtype(tp)
printf("%s ", symbol2str(tp->tp_fund)); printf("%s ", symbol2str(tp->tp_fund));
if (is_anon_idf(tp->tp_idf)) { if (is_anon_idf(tp->tp_idf)) {
/* skip the #<num>, replace it by '#anonymous id' */ /* skip the #<num>, replace it by '#anonymous id' */
printf("#anonymous id%s", strindex(tp->tp_idf->id_text, ' ')); printf("#anonymous id%s", strchr(tp->tp_idf->id_text, ' '));
} }
else printf(tp->tp_idf->id_text); else printf(tp->tp_idf->id_text);
break; break;

View file

@ -143,7 +143,7 @@ main(argc, argv)
#ifndef NOPP #ifndef NOPP
struct idf *file_head; struct idf *file_head;
extern char *strrindex(); extern char *strrchr();
list_dependencies(source) list_dependencies(source)
char *source; char *source;
@ -151,7 +151,7 @@ char *source;
register struct idf *p = file_head; register struct idf *p = file_head;
if (source) { if (source) {
register char *s = strrindex(source, '.'); register char *s = strrchr(source, '.');
if (s && *(s+1)) { if (s && *(s+1)) {
s++; s++;
@ -161,7 +161,7 @@ char *source;
* object generated, so don't include the pathname * object generated, so don't include the pathname
* leading to it. * leading to it.
*/ */
if (s = strrindex(source, '/')) { if (s = strrchr(source, '/')) {
source = s + 1; source = s + 1;
} }
} }

View file

@ -22,12 +22,12 @@ getwdir(fn)
register char *fn; register char *fn;
{ {
register char *p; register char *p;
char *strrindex(); char *strrchr();
p = strrindex(fn, '/'); p = strrchr(fn, '/');
while (p && *(p + 1) == '\0') { /* remove trailing /'s */ while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0'; *p = '\0';
p = strrindex(fn, '/'); p = strrchr(fn, '/');
} }
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */

View file

@ -95,7 +95,7 @@ compile(argc, argv)
} }
struct idf *file_head; struct idf *file_head;
extern char *strrindex(); extern char *strrchr();
list_dependencies(source) list_dependencies(source)
char *source; char *source;
@ -103,7 +103,7 @@ list_dependencies(source)
register struct idf *p = file_head; register struct idf *p = file_head;
if (source) { if (source) {
register char *s = strrindex(source, '.'); register char *s = strrchr(source, '.');
if (s && *(s+1)) { if (s && *(s+1)) {
s++; s++;
@ -113,7 +113,7 @@ list_dependencies(source)
* object generated, so don't include the pathname * object generated, so don't include the pathname
* leading to it. * leading to it.
*/ */
if (s = strrindex(source, '/')) { if (s = strrchr(source, '/')) {
source = s + 1; source = s + 1;
} }
} }

View file

@ -2,8 +2,8 @@
#define NULL 0 #define NULL 0
#endif #endif
#define strchr strindex #define strchr strchr
#define strrchr strrindex #define strrchr strrchr
extern char * strcat(); extern char * strcat();
extern char * strchr(); extern char * strchr();

View file

@ -39,9 +39,9 @@ getwdir(fn)
register char *fn; register char *fn;
{ {
register char *p; register char *p;
char *strrindex(); char *strrchr();
while ((p = strrindex(fn,'/')) && *(p + 1) == '\0') { while ((p = strrchr(fn,'/')) && *(p + 1) == '\0') {
/* remove trailing /'s */ /* remove trailing /'s */
*p = '\0'; *p = '\0';
} }

View file

@ -168,7 +168,7 @@ DoOption(text)
char *t; char *t;
while (c = *text++) { while (c = *text++) {
char *strindex(); char *strchr();
t = text; t = text;
size = txt2int(&t); size = txt2int(&t);
@ -178,7 +178,7 @@ DoOption(text)
algn = txt2int(&t); algn = txt2int(&t);
text = t; text = t;
} }
if (! strindex("wislfdpS", c)) { if (! strchr("wislfdpS", c)) {
error("-V: bad type indicator %c\n", c); error("-V: bad type indicator %c\n", c);
} }
if (size != 0) switch (c) { if (size != 0) switch (c) {

View file

@ -27,7 +27,7 @@ int nDEF, mDEF;
struct file_list *CurrentArg; struct file_list *CurrentArg;
extern int err_occurred; extern int err_occurred;
extern int Roption; extern int Roption;
extern char *strrindex(); extern char *strrchr();
extern char *strcpy(), *strcat(); extern char *strcpy(), *strcat();
char * char *
@ -35,7 +35,7 @@ basename(s)
char *s; char *s;
{ {
static char buf[256]; static char buf[256];
char *p = strrindex(s, '.'); char *p = strrchr(s, '.');
if (p != 0) *p = 0; if (p != 0) *p = 0;
strcpy(buf, s); strcpy(buf, s);
@ -49,10 +49,10 @@ getwdir(fn)
{ {
register char *p; register char *p;
p = strrindex(fn, '/'); p = strrchr(fn, '/');
while (p && *(p + 1) == '\0') { /* remove trailing /'s */ while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0'; *p = '\0';
p = strrindex(fn, '/'); p = strrchr(fn, '/');
} }
if (p) { if (p) {
@ -187,7 +187,7 @@ ProcessArgs()
register struct file_list *a; register struct file_list *a;
f_walk(arglist, a) { f_walk(arglist, a) {
register char *p = strrindex(f_filename(a), '.'); register char *p = strrchr(f_filename(a), '.');
CurrentArg = a; CurrentArg = a;
DEFPATH[0] = f_dir(a); DEFPATH[0] = f_dir(a);
@ -241,7 +241,7 @@ find_dependencies()
print("\nall:\t"); print("\nall:\t");
f_walk(arglist, arg) { f_walk(arglist, arg) {
char *fn = f_filename(arg); char *fn = f_filename(arg);
char *dotspot = strrindex(fn, '.'); char *dotspot = strrchr(fn, '.');
if (dotspot && strcmp(dotspot, ".mod") == 0) { if (dotspot && strcmp(dotspot, ".mod") == 0) {
register struct idf *id = f_idf(arg); register struct idf *id = f_idf(arg);
@ -260,7 +260,7 @@ find_dependencies()
print("objects:\t"); print("objects:\t");
f_walk(arglist, arg) { f_walk(arglist, arg) {
char *fn = f_filename(arg); char *fn = f_filename(arg);
char *dotspot = strrindex(fn, '.'); char *dotspot = strrchr(fn, '.');
if (dotspot && strcmp(dotspot, ".mod") == 0) { if (dotspot && strcmp(dotspot, ".mod") == 0) {
register struct idf *id = f_idf(arg); register struct idf *id = f_idf(arg);
@ -320,7 +320,7 @@ object(arg)
register struct file_list *arg; register struct file_list *arg;
{ {
static char buf[512]; static char buf[512];
char *dotp = strrindex(f_filename(arg), '.'); char *dotp = strrchr(f_filename(arg), '.');
buf[0] = 0; buf[0] = 0;
/* /*
@ -353,7 +353,7 @@ print_dep()
register struct file_list *arg; register struct file_list *arg;
f_walk(arglist, arg) { f_walk(arglist, arg) {
char *dotspot = strrindex(f_filename(arg), '.'); char *dotspot = strrchr(f_filename(arg), '.');
if (dotspot && strcmp(dotspot, ".mod") == 0) { if (dotspot && strcmp(dotspot, ".mod") == 0) {
register struct idf *id = f_idf(arg); register struct idf *id = f_idf(arg);
@ -413,7 +413,7 @@ module_in_arglist(n)
register struct file_list *a; register struct file_list *a;
f_walk(arglist, a) { f_walk(arglist, a) {
char *dotp = strrindex(f_filename(a), '.'); char *dotp = strrchr(f_filename(a), '.');
if (dotp && strcmp(dotp, ".mod") == 0 && ! f_notfound(a)) { if (dotp && strcmp(dotp, ".mod") == 0 && ! f_notfound(a)) {
*dotp = 0; *dotp = 0;
@ -459,7 +459,7 @@ programs()
register struct file_list *a; register struct file_list *a;
f_walk(arglist, a) { f_walk(arglist, a) {
char *dotspot = strrindex(f_filename(a), '.'); char *dotspot = strrchr(f_filename(a), '.');
if (dotspot && strcmp(dotspot, ".mod") == 0) { if (dotspot && strcmp(dotspot, ".mod") == 0) {
register struct idf *id = f_idf(a); register struct idf *id = f_idf(a);

View file

@ -125,7 +125,7 @@ import(register struct lnk **p;)
DefinitionModule DefinitionModule
{ {
struct idf *id; struct idf *id;
extern char *strrindex(); extern char *strrchr();
} }
: :
DEFINITION DEFINITION
@ -146,7 +146,7 @@ DefinitionModule
else if (strcmp(id->id_dir, WorkingDir)) { else if (strcmp(id->id_dir, WorkingDir)) {
Gerror("definition and implementation of module %s reside in different directories", id->id_text); Gerror("definition and implementation of module %s reside in different directories", id->id_text);
} }
id->id_def = strrindex(FileName, '/'); id->id_def = strrchr(FileName, '/');
if (! id->id_def) id->id_def = FileName; if (! id->id_def) id->id_def = FileName;
else (id->id_def)++; else (id->id_def)++;
CurrentArg->a_idf = id; CurrentArg->a_idf = id;

View file

@ -90,7 +90,7 @@ DoOption(text)
char c, *t; char c, *t;
while( c = *text++ ) { while( c = *text++ ) {
char *strindex(); char *strchr();
t = text; t = text;
size = txt2int(&t); size = txt2int(&t);
@ -100,7 +100,7 @@ DoOption(text)
align = txt2int(&t); align = txt2int(&t);
text = t; text = t;
} }
if( !strindex("wilfpS", c) ) if( !strchr("wilfpS", c) )
error("-V: bad type indicator %c\n", c); error("-V: bad type indicator %c\n", c);
if( size ) if( size )
switch( c ) { switch( c ) {

View file

@ -56,11 +56,11 @@ struct t_operand *op;
* expr(reg) -> IS_MEM * expr(reg) -> IS_MEM
*/ */
{ {
char *ptr, *strindex(); char *ptr, *strchr();
op->type = UNKNOWN; op->type = UNKNOWN;
if ( *last( str) == RIGHT) { if ( *last( str) == RIGHT) {
ptr = strindex( str, LEFT); ptr = strchr( str, LEFT);
*last( str) = '\0'; *last( str) = '\0';
*ptr = '\0'; *ptr = '\0';
if ( is_reg( ptr+1, op)) { if ( is_reg( ptr+1, op)) {
@ -147,10 +147,10 @@ set_label( str, op)
char *str; char *str;
struct t_operand *op; struct t_operand *op;
{ {
char *ptr, *strindex(), *sprint(); char *ptr, *strchr(), *sprint();
static char buf[256]; static char buf[256];
ptr = strindex( str, '+'); ptr = strchr( str, '+');
if ( ptr == 0) if ( ptr == 0)
op->off = "0"; op->off = "0";
@ -167,7 +167,7 @@ struct t_operand *op;
} }
else { else {
op->type = IS_LABEL; op->type = IS_LABEL;
if ( strindex( str, DOLLAR) != 0) if ( strchr( str, DOLLAR) != 0)
op->lab = str; op->lab = str;
else else
op->lab = sprint( buf, "\"%s\"", str); op->lab = sprint( buf, "\"%s\"", str);

View file

@ -68,11 +68,11 @@ struct t_operand *op;
* expr(reg) -> IS_MEM * expr(reg) -> IS_MEM
*/ */
{ {
char *ptr, *strindex(); char *ptr, *strchr();
op->type = UNKNOWN; op->type = UNKNOWN;
if ( *last( str) == RIGHT) { if ( *last( str) == RIGHT) {
ptr = strindex( str, LEFT); ptr = strchr( str, LEFT);
*last( str) = '\0'; *last( str) = '\0';
*ptr = '\0'; *ptr = '\0';
if ( is_reg( ptr+1, op)) { if ( is_reg( ptr+1, op)) {
@ -184,10 +184,10 @@ set_label( str, op)
char *str; char *str;
struct t_operand *op; struct t_operand *op;
{ {
char *ptr, *strindex(), *sprint(); char *ptr, *strchr(), *sprint();
static char buf[256]; static char buf[256];
ptr = strindex( str, '+'); ptr = strchr( str, '+');
if ( ptr == 0) if ( ptr == 0)
op->off = "0"; op->off = "0";
@ -204,7 +204,7 @@ struct t_operand *op;
} }
else { else {
op->type = IS_LABEL; op->type = IS_LABEL;
if ( strindex( str, DOLLAR) != 0) if ( strchr( str, DOLLAR) != 0)
op->lab = str; op->lab = str;
else else
/* nood oplossing */ /* nood oplossing */

View file

@ -21,7 +21,7 @@ process_operand( str, op)
register char *str; register char *str;
register struct t_operand *op; register struct t_operand *op;
{ {
char *glob_lbl(), *strindex(); char *glob_lbl(), *strchr();
op->type = 0; op->type = 0;
@ -46,7 +46,7 @@ register struct t_operand *op;
op->lbl = NULL; op->lbl = NULL;
break; break;
case '(' : if ( strindex( str+1, ',') == NULL) case '(' : if ( strchr( str+1, ',') == NULL)
if ( is_reg( str+1)) { if ( is_reg( str+1)) {
op->reg = reg_val( str+1); op->reg = reg_val( str+1);

View file

@ -11,10 +11,6 @@
#include "top.h" #include "top.h"
#include "queue.h" #include "queue.h"
/* Defined in the string module, which has no header file. FIXME. */
extern char* strindex(char *s, int c);
/* STANDARD MACHINE-INDEPENT C CODE *************/ /* STANDARD MACHINE-INDEPENT C CODE *************/
extern char *lstrip(); extern char *lstrip();
@ -358,8 +354,8 @@ bool operand(ip,n)
p = ip->rest_line; p = ip->rest_line;
while((*p != OP_SEPARATOR || nesting) && *p != '\n') { while((*p != OP_SEPARATOR || nesting) && *p != '\n') {
#ifdef PAREN_OPEN #ifdef PAREN_OPEN
if (strindex(PAREN_OPEN, *p) != 0) nesting++; if (strchr(PAREN_OPEN, *p) != 0) nesting++;
else if (strindex(PAREN_CLOSE, *p) != 0) nesting--; else if (strchr(PAREN_CLOSE, *p) != 0) nesting--;
#endif #endif
p++; p++;
} }

View file

@ -21,7 +21,7 @@ process_operand( str, op)
register char *str; register char *str;
register struct t_operand *op; register struct t_operand *op;
{ {
char *glob_lbl(), *strindex(); char *glob_lbl(), *strchr();
op->type = 0; op->type = 0;
@ -46,7 +46,7 @@ register struct t_operand *op;
op->lbl = NULL; op->lbl = NULL;
break; break;
case '(' : if ( strindex( str+1, ',') == NULL) case '(' : if ( strchr( str+1, ',') == NULL)
if ( is_reg( str+1)) { if ( is_reg( str+1)) {
op->reg = reg_val( str+1); op->reg = reg_val( str+1);

View file

@ -39,7 +39,7 @@ struct t_operand *arg;
char lab_buf[4][256], char lab_buf[4][256],
ind_buf[4][256], ind_buf[4][256],
*match(), *lab(), *ind(), *end_arg(), *strindex(); *match(), *lab(), *ind(), *end_arg(), *strchr();
static int n_index = -1; static int n_index = -1;
@ -257,10 +257,10 @@ register struct t_operand *op;
} }
break; break;
case LABEL : @text1( 0xef); case LABEL : @text1( 0xef);
if ( strindex( op->lab, DOLLAR)) { if ( strchr( op->lab, DOLLAR)) {
@reloc4( %$(op->lab), %$(op->offset), PC_REL); @reloc4( %$(op->lab), %$(op->offset), PC_REL);
} }
else if ( strindex( op->lab, LEFT)) { else if ( strchr( op->lab, LEFT)) {
@reloc4( %$(op->lab), %$(op->offset), PC_REL); @reloc4( %$(op->lab), %$(op->offset), PC_REL);
} }
else { else {

View file

@ -19,7 +19,7 @@ REG {is_register(VAL)};
SREG {is_scratchreg(VAL)}; SREG {is_scratchreg(VAL)};
LAB,LAB2 {VAL[0] == LABEL_STARTER}; LAB,LAB2 {VAL[0] == LABEL_STARTER};
A,B {no_side_effects(VAL) }; A,B {no_side_effects(VAL) };
NO_INDEX {strindex(VAL, '[') == 0}; NO_INDEX {strchr(VAL, '[') == 0};
X,Y,LOG {TRUE}; X,Y,LOG {TRUE};
%%; %%;

View file

@ -12,12 +12,12 @@ sys_lock(path)
{ {
char buf[1024]; char buf[1024];
char *tmpf = ".lockXXXXXX"; char *tmpf = ".lockXXXXXX";
char *strrindex(), *strcpy(), *mktemp(); char *strrchr(), *strcpy(), *mktemp();
char *p; char *p;
int ok, fd; int ok, fd;
strcpy(buf, path); strcpy(buf, path);
if (p = strrindex(buf, '/')) { if (p = strrchr(buf, '/')) {
++p; ++p;
strcpy(p, tmpf); strcpy(p, tmpf);
} }

View file

@ -66,8 +66,8 @@ enum f_path { F_OK, F_NOMATCH, F_NOPATH } ;
/* Library routines */ /* Library routines */
extern char *strindex(); extern char *strchr();
extern char *strrindex(); extern char *strrchr();
extern char *strcpy(); extern char *strcpy();
extern char *strcat(); extern char *strcat();
extern int getpid(); extern int getpid();

View file

@ -117,7 +117,7 @@ char *srcvar() {
} }
char *getsuffix() { char *getsuffix() {
return strrindex(orig.p_path, SUFCHAR) ; return strrchr(orig.p_path, SUFCHAR) ;
} }
varinit() { varinit() {
@ -250,7 +250,7 @@ vieuwargs(argc,argv) char **argv ; {
firstarg(argp) register char *argp ; { firstarg(argp) register char *argp ; {
register char *name ; register char *name ;
name=strrindex(argp,'/') ; name=strrchr(argp,'/') ;
if ( name && *(name+1) ) { if ( name && *(name+1) ) {
name++ ; name++ ;
} else { } else {
@ -269,7 +269,7 @@ process(arg) char *arg ; {
#ifdef DEBUG #ifdef DEBUG
if ( debug ) vprint("Processing %s\n",arg) ; if ( debug ) vprint("Processing %s\n",arg) ;
#endif #endif
p_suffix= strrindex(arg,SUFCHAR) ; p_suffix= strrchr(arg,SUFCHAR) ;
orig.p_keep= YES ; /* Don't throw away the original ! */ orig.p_keep= YES ; /* Don't throw away the original ! */
orig.p_keeps= NO; orig.p_keeps= NO;
orig.p_path= arg ; orig.p_path= arg ;

View file

@ -36,7 +36,7 @@ int runphase(phase) register trf *phase ; {
vprint("%s",phase->t_name) ; vprint("%s",phase->t_name) ;
if ( !phase->t_combine ) { if ( !phase->t_combine ) {
vprint(" %s%s\n",p_basename, vprint(" %s%s\n",p_basename,
strrindex(in.p_path,SUFCHAR) ) ; strrchr(in.p_path,SUFCHAR) ) ;
} else { } else {
scanlist(l_first(phase->t_inputs), elem) { scanlist(l_first(phase->t_inputs), elem) {
vprint(" %s",p_cont(*elem)->p_path); vprint(" %s",p_cont(*elem)->p_path);

View file

@ -191,7 +191,7 @@ int satisfy(trafo,suffix) register trf *trafo; char *suffix ; {
fuerror("Illegal input suffix entry for %s", fuerror("Illegal input suffix entry for %s",
trafo->t_name) ; trafo->t_name) ;
} }
l_char=strindex(f_char+1,SUFCHAR); l_char=strchr(f_char+1,SUFCHAR);
if ( l_char ) *l_char = 0; if ( l_char ) *l_char = 0;
if ( strcmp(f_char,suffix)==0 ) { if ( strcmp(f_char,suffix)==0 ) {
if ( l_char ) *l_char = SUFCHAR; if ( l_char ) *l_char = SUFCHAR;

View file

@ -159,9 +159,9 @@ set_Rflag(argp) register char *argp ; {
register int length ; register int length ;
char *eq, *colon ; char *eq, *colon ;
eos= strindex(&argp[2],'-'); eos= strchr(&argp[2],'-');
eq= strindex(&argp[2],EQUAL) ; eq= strchr(&argp[2],EQUAL) ;
colon= strindex(&argp[2],':'); colon= strchr(&argp[2],':');
if ( !eos ) { if ( !eos ) {
eos= eq ; eos= eq ;
} else { } else {
@ -470,7 +470,7 @@ int mapexpand(mapentry,cflag)
register char *space ; register char *space ;
int length ; int length ;
star=strindex(mapentry,STAR) ; star=strchr(mapentry,STAR) ;
space=firstblank(mapentry) ; space=firstblank(mapentry) ;
if ( star >space ) star= (char *)0 ; if ( star >space ) star= (char *)0 ;
if ( star ) { if ( star ) {
@ -514,7 +514,7 @@ doassign(line,star,length) char *line, *star ; {
for ( ; *ptr && *ptr!=SPACE && *ptr!=TAB && *ptr!=EQUAL ; ptr++ ) { for ( ; *ptr && *ptr!=SPACE && *ptr!=TAB && *ptr!=EQUAL ; ptr++ ) {
gr_add(&name,*ptr) ; gr_add(&name,*ptr) ;
} }
ptr= strindex(ptr,EQUAL) ; ptr= strchr(ptr,EQUAL) ;
if ( !ptr ) { if ( !ptr ) {
error("Missing %c in assignment %s",EQUAL,line); error("Missing %c in assignment %s",EQUAL,line);
return ; return ;
@ -602,7 +602,7 @@ addargs(string) char *string ; {
register char *temp, *repc ; register char *temp, *repc ;
register list_elem *elem ; register list_elem *elem ;
repc=strindex(string,C_IN) ; repc=strchr(string,C_IN) ;
if ( repc ) { if ( repc ) {
/* INPUT FILE TOKEN seen, replace it and scan further */ /* INPUT FILE TOKEN seen, replace it and scan further */
if ( repc==string && string[1]==0 ) { if ( repc==string && string[1]==0 ) {
@ -629,7 +629,7 @@ addargs(string) char *string ; {
} }
return ; return ;
} }
repc=strindex(string,C_OUT) ; repc=strchr(string,C_OUT) ;
if ( repc ) { if ( repc ) {
/* replace the outfile token as with the infile token */ /* replace the outfile token as with the infile token */
#ifdef DEBUG #ifdef DEBUG

View file

@ -13,7 +13,7 @@ extern error(char *, ...);
/* All the functions in this file will be called by the parser. /* All the functions in this file will be called by the parser.
*/ */
extern char *strindex(); extern char *strchr();
static struct Op_info { char *name, *type; } static struct Op_info { char *name, *type; }
op_info[ MAX_OPERANDS] = { { 0, 0}}; op_info[ MAX_OPERANDS] = { { 0, 0}};

View file

@ -160,9 +160,9 @@ char *skip_operand( ptr, instr)
char *match_ch( c, str, instr) char *match_ch( c, str, instr)
char c, *str, *instr; char c, *str, *instr;
{ {
char *ptr, *strindex(); char *ptr, *strchr();
ptr = strindex( str, c); ptr = strchr( str, c);
if ( ptr == 0) { if ( ptr == 0) {
error( "syntax error in %s : %c expected\n", instr, c); error( "syntax error in %s : %c expected\n", instr, c);
return( str); return( str);

View file

@ -20,12 +20,12 @@ getwdir(fn)
char *fn; char *fn;
{ {
register char *p; register char *p;
char *strrindex(); char *strrchr();
p = strrindex(fn, '/'); p = strrchr(fn, '/');
while (p && *(p + 1) == '\0') { /* remove trailing /'s */ while (p && *(p + 1) == '\0') { /* remove trailing /'s */
*p = '\0'; *p = '\0';
p = strrindex(fn, '/'); p = strrchr(fn, '/');
} }
if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */

View file

@ -93,7 +93,7 @@ compile(argc, argv)
} }
struct idf *file_head; struct idf *file_head;
extern char *strrindex(); extern char *strrchr();
list_dependencies(source) list_dependencies(source)
char *source; char *source;
@ -101,7 +101,7 @@ list_dependencies(source)
register struct idf *p = file_head; register struct idf *p = file_head;
if (source) { if (source) {
register char *s = strrindex(source, '.'); register char *s = strrchr(source, '.');
if (s && *(s+1)) { if (s && *(s+1)) {
s++; s++;
@ -111,7 +111,7 @@ list_dependencies(source)
* object generated, so don't include the pathname * object generated, so don't include the pathname
* leading to it. * leading to it.
*/ */
if (s = strrindex(source, '/')) { if (s = strrchr(source, '/')) {
source = s + 1; source = s + 1;
} }
} }

View file

@ -44,7 +44,7 @@ static char *phnames[] = {
extern char *mktemp(); extern char *mktemp();
extern char *strcpy(), *strcat(); extern char *strcpy(), *strcat();
extern char *strrindex(); extern char *strrchr();
static char ddump[128] = TMP_DIR; /* data label dump file */ static char ddump[128] = TMP_DIR; /* data label dump file */
static char pdump[128] = TMP_DIR; /* procedure name dump file */ static char pdump[128] = TMP_DIR; /* procedure name dump file */
@ -181,7 +181,7 @@ new_outfiles()
register char **dst = &phargs[NTEMPS+1]; register char **dst = &phargs[NTEMPS+1];
if (! Bindex) { if (! Bindex) {
Bindex = strrindex(tmpbufs[0], 'B') - tmpbufs[0]; Bindex = strrchr(tmpbufs[0], 'B') - tmpbufs[0];
} }
for (i = 1; i <= NTEMPS; i++) { for (i = 1; i <= NTEMPS; i++) {
*dst = tmpbufs[tmpindex]; *dst = tmpbufs[tmpindex];
@ -404,7 +404,7 @@ main(argc, argv)
for (i = 2*NTEMPS-1; i >= 1; i--) { for (i = 2*NTEMPS-1; i >= 1; i--) {
(void) strcpy(tmpbufs[i], tmpbufs[0]); (void) strcpy(tmpbufs[i], tmpbufs[0]);
} }
i = strrindex(tmpbufs[0], 'A') - tmpbufs[0]; i = strrchr(tmpbufs[0], 'A') - tmpbufs[0];
tmpbufs[0][i] = 'p'; tmpbufs[NTEMPS+0][i] = 'p'; tmpbufs[0][i] = 'p'; tmpbufs[NTEMPS+0][i] = 'p';
tmpbufs[1][i] = 'd'; tmpbufs[NTEMPS+1][i] = 'd'; tmpbufs[1][i] = 'd'; tmpbufs[NTEMPS+1][i] = 'd';
tmpbufs[2][i] = 'l'; tmpbufs[NTEMPS+2][i] = 'l'; tmpbufs[2][i] = 'l'; tmpbufs[NTEMPS+2][i] = 'l';

View file

@ -19,7 +19,7 @@
#include "misc.h" #include "misc.h"
extern char *Salloc(); extern char *Salloc();
extern char *strindex(); extern char *strchr();
extern char *strcpy(); extern char *strcpy();
extern void signal_child(); extern void signal_child();
extern FILE *db_in; extern FILE *db_in;
@ -329,7 +329,7 @@ format_expression(p_tree *p;)
expression(p, 0) expression(p, 0)
[ '\\' name(&p1) { register char *c = p1->t_str; [ '\\' name(&p1) { register char *c = p1->t_str;
while (*c) { while (*c) {
if (! strindex("doshcax", *c)) { if (! strchr("doshcax", *c)) {
error("illegal format: %c", *c); error("illegal format: %c", *c);
break; break;
} }

View file

@ -18,7 +18,7 @@
#include "rd.h" #include "rd.h"
#include "misc.h" #include "misc.h"
extern char *strindex(); extern char *strchr();
extern long str2long(); extern long str2long();
extern double atof(); extern double atof();
@ -873,7 +873,7 @@ DbRead(f)
break; break;
#ifdef N_SCOPE #ifdef N_SCOPE
case N_SCOPE: case N_SCOPE:
if (n->on_mptr && strindex(n->on_mptr, ':')) { if (n->on_mptr && strchr(n->on_mptr, ':')) {
n = DbString(n); n = DbString(n);
} }
break; break;
@ -898,7 +898,7 @@ DbRead(f)
needs_newscope = 0; needs_newscope = 0;
lbrac_required = 1; lbrac_required = 1;
} }
if (n->on_mptr && strindex(n->on_mptr, ':')) { if (n->on_mptr && strchr(n->on_mptr, ':')) {
n = DbString(n); n = DbString(n);
} }
break; break;

View file

@ -27,7 +27,7 @@ FILE *db_out;
FILE *db_in; FILE *db_in;
int debug; int debug;
extern struct tokenname tkidf[]; extern struct tokenname tkidf[];
extern char *strindex(); extern char *strchr();
extern void signal_child(); extern void signal_child();
extern void init_del(); extern void init_del();
extern void init_run(); extern void init_run();
@ -56,7 +56,7 @@ main(argc, argv)
db_in = stdin; db_in = stdin;
progname = argv[0]; progname = argv[0];
init_del(); init_del();
while (p = strindex(progname, '/')) { while (p = strchr(progname, '/')) {
progname = p + 1; progname = p + 1;
} }
while (argv[1] && argv[1][0] == '-') { while (argv[1] && argv[1][0] == '-') {

View file

@ -14,7 +14,7 @@
#include "misc.h" #include "misc.h"
extern FILE *db_out; extern FILE *db_out;
extern char *strindex(); extern char *strchr();
extern char *malloc(); extern char *malloc();
static static
@ -24,7 +24,7 @@ print_unsigned(tp, v, format)
register char *format; register char *format;
{ {
while (format && *format) { while (format && *format) {
if (strindex("cdohx", *format)) break; if (strchr("cdohx", *format)) break;
format++; format++;
} }
switch(format == 0 ? 0 : *format) { switch(format == 0 ? 0 : *format) {
@ -87,7 +87,7 @@ print_integer(tp, v, format)
register char *format; register char *format;
{ {
while (format && *format) { while (format && *format) {
if (strindex("cdohx", *format)) break; if (strchr("cdohx", *format)) break;
format++; format++;
} }
switch(format == 0 ? 0 : *format) { switch(format == 0 ? 0 : *format) {
@ -203,7 +203,7 @@ print_val(tp, tp_sz, addr, compressed, indent, format)
print_val(tp->ty_base, tp_sz, addr, compressed, indent, format); print_val(tp->ty_base, tp_sz, addr, compressed, indent, format);
break; break;
case T_ARRAY: case T_ARRAY:
if ((!format || strindex(format, 'a') == 0) && if ((!format || strchr(format, 'a') == 0) &&
(tp->ty_elements == char_type || (tp->ty_elements == char_type ||
tp->ty_elements == uchar_type)) { tp->ty_elements == uchar_type)) {
print_val(string_type, tp_sz, addr, compressed, indent, format); print_val(string_type, tp_sz, addr, compressed, indent, format);
@ -292,7 +292,7 @@ print_val(tp, tp_sz, addr, compressed, indent, format)
t_addr a = get_int(addr, tp_sz, T_UNSIGNED); t_addr a = get_int(addr, tp_sz, T_UNSIGNED);
fprintf(db_out, currlang->addr_fmt, a); fprintf(db_out, currlang->addr_fmt, a);
if (format && strindex(format, 's') && if (format && strchr(format, 's') &&
(tp->ty_ptrto == char_type || tp->ty_ptrto == uchar_type)) { (tp->ty_ptrto == char_type || tp->ty_ptrto == uchar_type)) {
char *naddr = malloc(512); char *naddr = malloc(512);

View file

@ -98,7 +98,7 @@ Lookfromscope(id, class, sc)
return (p_symbol) 0; return (p_symbol) 0;
} }
extern char *strrindex(); extern char *strrchr();
p_symbol p_symbol
add_file(s) add_file(s)
@ -112,7 +112,7 @@ add_file(s)
sym->sy_file = new_file(); sym->sy_file = new_file();
sym->sy_file->f_sym = sym; sym->sy_file->f_sym = sym;
p = strrindex(s, '.'); p = strrchr(s, '.');
if (p) { if (p) {
char c = *p; char c = *p;
p_symbol sym1; p_symbol sym1;

View file

@ -25,7 +25,7 @@
extern FILE *db_out; extern FILE *db_out;
t_lineno currline; t_lineno currline;
t_lineno listline; t_lineno listline;
extern char *strrindex(); extern char *strrchr();
extern int interrupted; extern int interrupted;
#if __STDC__ #if __STDC__
@ -465,7 +465,7 @@ newfile(id)
listfile = add_file(id->id_text); listfile = add_file(id->id_text);
listfile->sy_file->f_scope = FileScope; listfile->sy_file->f_scope = FileScope;
} }
find_language(strrindex(id->id_text, '.')); find_language(strrchr(id->id_text, '.'));
} }
int in_wheninvoked; int in_wheninvoked;

View file

@ -123,7 +123,7 @@ first_pass(argv)
int sectno; int sectno;
int h; int h;
extern int atoi(); extern int atoi();
extern char *strindex(); extern char *strchr();
extern int hash(); extern int hash();
extern struct outname *searchname(); extern struct outname *searchname();
@ -144,7 +144,7 @@ first_pass(argv)
* section <section number>. * section <section number>.
*/ */
sectno = atoi(++argp); sectno = atoi(++argp);
if ((argp = strindex(argp, ':')) == (char *)0) if ((argp = strchr(argp, ':')) == (char *)0)
fatal("usage: -a<section number>:<alignment>"); fatal("usage: -a<section number>:<alignment>");
setlign(sectno, number(++argp)); setlign(sectno, number(++argp));
break; break;
@ -157,7 +157,7 @@ first_pass(argv)
* <section number>. * <section number>.
*/ */
sectno = atoi(++argp); sectno = atoi(++argp);
if ((argp = strindex(argp, ':')) == (char *)0) if ((argp = strchr(argp, ':')) == (char *)0)
fatal("usage: -b<section number>:<base>"); fatal("usage: -b<section number>:<base>");
setbase(sectno, number(++argp)); setbase(sectno, number(++argp));
break; break;