From 014be56fb0b12fd6200fdf4270502e6bac79e74c Mon Sep 17 00:00:00 2001 From: dtrg Date: Sun, 23 Jul 2006 20:01:02 +0000 Subject: [PATCH] Replaced calls to the custom strindex() and strrindex() functions with the exactly equivalent and standard strchr() and strrchr() functions instead. --- lang/basic/src/basic.lex | 4 ++-- lang/cem/cemcom.ansi/input.c | 6 +++--- lang/cem/cemcom.ansi/l_outdef.c | 4 ++-- lang/cem/cemcom.ansi/main.c | 6 +++--- lang/cem/cemcom/input.c | 6 +++--- lang/cem/cemcom/l_outdef.c | 4 ++-- lang/cem/cemcom/main.c | 6 +++--- lang/cem/cpp.ansi/input.c | 6 +++--- lang/cem/cpp.ansi/main.c | 6 +++--- lang/fortran/comp/string.h | 4 ++-- lang/m2/comp/defmodule.c | 4 ++-- lang/m2/comp/options.c | 4 ++-- lang/m2/m2mm/main.c | 22 +++++++++++----------- lang/m2/m2mm/program.g | 4 ++-- lang/pc/comp/options.c | 4 ++-- mach/i386/ce/as.c | 10 +++++----- mach/i86/ce/as.c | 10 +++++----- mach/m68020/ce/as.c | 4 ++-- mach/proto/top/top.c | 8 ++------ mach/sun3/ce/as.c | 4 ++-- mach/vax4/ce/as.c | 6 +++--- mach/vax4/top/table | 2 +- modules/src/system/lock.c | 4 ++-- util/ack/ack.h | 4 ++-- util/ack/main.c | 6 +++--- util/ack/run.c | 2 +- util/ack/scan.c | 2 +- util/ack/trans.c | 14 +++++++------- util/ceg/as_parser/help.c | 2 +- util/ceg/assemble/obj_assemble/assemble.c | 4 ++-- util/cpp/input.c | 6 +++--- util/cpp/main.c | 6 +++--- util/ego/em_ego/em_ego.c | 6 +++--- util/grind/commands.g | 4 ++-- util/grind/db_symtab.g | 6 +++--- util/grind/main.c | 4 ++-- util/grind/print.c | 10 +++++----- util/grind/symbol.c | 4 ++-- util/grind/tree.c | 4 ++-- util/led/main.c | 6 +++--- 40 files changed, 112 insertions(+), 116 deletions(-) diff --git a/lang/basic/src/basic.lex b/lang/basic/src/basic.lex index b1445233a..974768932 100644 --- a/lang/basic/src/basic.lex +++ b/lang/basic/src/basic.lex @@ -235,7 +235,7 @@ File *stream; } } -extern char *strindex(); +extern char *strchr(); getline() { @@ -244,7 +244,7 @@ getline() if ( our_fgets(inputline,MAXLINELENGTH,yyin) == 0) return(FALSE); yylineno ++; - if ( strindex(inputline,'\n') == 0) + if ( strchr(inputline,'\n') == 0) error("source line too long"); inputline[MAXLINELENGTH-1]=0; if ( listing) diff --git a/lang/cem/cemcom.ansi/input.c b/lang/cem/cemcom.ansi/input.c index 05193d2cd..e10aacb5a 100644 --- a/lang/cem/cemcom.ansi/input.c +++ b/lang/cem/cemcom.ansi/input.c @@ -34,12 +34,12 @@ getwdir(fn) register char *fn; { register char *p; - char *strrindex(); + char *strrchr(); - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); while (p && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); } if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ diff --git a/lang/cem/cemcom.ansi/l_outdef.c b/lang/cem/cemcom.ansi/l_outdef.c index 3df813be5..a88945f6e 100644 --- a/lang/cem/cemcom.ansi/l_outdef.c +++ b/lang/cem/cemcom.ansi/l_outdef.c @@ -38,7 +38,7 @@ extern char *bts2str(); extern char *symbol2str(); -extern char *strindex(); +extern char *strchr(); int stat_number = 9999; /* static scope number */ struct outdef OutDef; @@ -491,7 +491,7 @@ outargtype(tp) if (is_anon_idf(tp->tp_idf)) { /* skip the #, replace it by '#anonymous id' */ printf("#anonymous id%s", - strindex(tp->tp_idf->id_text, ' ') + strchr(tp->tp_idf->id_text, ' ') ); } else { diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom.ansi/main.c index 2746e561b..8efd6dfd3 100644 --- a/lang/cem/cemcom.ansi/main.c +++ b/lang/cem/cemcom.ansi/main.c @@ -139,7 +139,7 @@ main(argc, argv) #ifndef NOPP struct dependency *file_head; -extern char *strrindex(); +extern char *strrchr(); list_dependencies(source) char *source; @@ -147,7 +147,7 @@ char *source; register struct dependency *p = file_head; if (source) { - register char *s = strrindex(source, '.'); + register char *s = strrchr(source, '.'); if (s && *(s+1)) { s++; @@ -157,7 +157,7 @@ char *source; * object generated, so don't include the pathname * leading to it. */ - if (s = strrindex(source, '/')) { + if (s = strrchr(source, '/')) { source = s + 1; } } diff --git a/lang/cem/cemcom/input.c b/lang/cem/cemcom/input.c index 9131e9250..0490142c0 100644 --- a/lang/cem/cemcom/input.c +++ b/lang/cem/cemcom/input.c @@ -31,12 +31,12 @@ getwdir(fn) register char *fn; { register char *p; - char *strrindex(); + char *strrchr(); - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); while (p && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); } if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ diff --git a/lang/cem/cemcom/l_outdef.c b/lang/cem/cemcom/l_outdef.c index c9f174f12..0aaebe33c 100644 --- a/lang/cem/cemcom/l_outdef.c +++ b/lang/cem/cemcom/l_outdef.c @@ -37,7 +37,7 @@ extern char *bts2str(); extern char *symbol2str(); -extern char *strindex(); +extern char *strchr(); int stat_number = 9999; /* static scope number */ struct outdef OutDef; @@ -460,7 +460,7 @@ outargtype(tp) printf("%s ", symbol2str(tp->tp_fund)); if (is_anon_idf(tp->tp_idf)) { /* skip the #, 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); break; diff --git a/lang/cem/cemcom/main.c b/lang/cem/cemcom/main.c index 698bd0325..9b6707600 100644 --- a/lang/cem/cemcom/main.c +++ b/lang/cem/cemcom/main.c @@ -143,7 +143,7 @@ main(argc, argv) #ifndef NOPP struct idf *file_head; -extern char *strrindex(); +extern char *strrchr(); list_dependencies(source) char *source; @@ -151,7 +151,7 @@ char *source; register struct idf *p = file_head; if (source) { - register char *s = strrindex(source, '.'); + register char *s = strrchr(source, '.'); if (s && *(s+1)) { s++; @@ -161,7 +161,7 @@ char *source; * object generated, so don't include the pathname * leading to it. */ - if (s = strrindex(source, '/')) { + if (s = strrchr(source, '/')) { source = s + 1; } } diff --git a/lang/cem/cpp.ansi/input.c b/lang/cem/cpp.ansi/input.c index 960d5e523..8e7de52f4 100644 --- a/lang/cem/cpp.ansi/input.c +++ b/lang/cem/cpp.ansi/input.c @@ -22,12 +22,12 @@ getwdir(fn) register char *fn; { register char *p; - char *strrindex(); + char *strrchr(); - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); while (p && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); } if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ diff --git a/lang/cem/cpp.ansi/main.c b/lang/cem/cpp.ansi/main.c index f556cbf29..4c9a9b91e 100644 --- a/lang/cem/cpp.ansi/main.c +++ b/lang/cem/cpp.ansi/main.c @@ -95,7 +95,7 @@ compile(argc, argv) } struct idf *file_head; -extern char *strrindex(); +extern char *strrchr(); list_dependencies(source) char *source; @@ -103,7 +103,7 @@ list_dependencies(source) register struct idf *p = file_head; if (source) { - register char *s = strrindex(source, '.'); + register char *s = strrchr(source, '.'); if (s && *(s+1)) { s++; @@ -113,7 +113,7 @@ list_dependencies(source) * object generated, so don't include the pathname * leading to it. */ - if (s = strrindex(source, '/')) { + if (s = strrchr(source, '/')) { source = s + 1; } } diff --git a/lang/fortran/comp/string.h b/lang/fortran/comp/string.h index a11509d85..2bc621054 100644 --- a/lang/fortran/comp/string.h +++ b/lang/fortran/comp/string.h @@ -2,8 +2,8 @@ #define NULL 0 #endif -#define strchr strindex -#define strrchr strrindex +#define strchr strchr +#define strrchr strrchr extern char * strcat(); extern char * strchr(); diff --git a/lang/m2/comp/defmodule.c b/lang/m2/comp/defmodule.c index ce0c7d080..e327f309b 100644 --- a/lang/m2/comp/defmodule.c +++ b/lang/m2/comp/defmodule.c @@ -39,9 +39,9 @@ getwdir(fn) register char *fn; { register char *p; - char *strrindex(); + char *strrchr(); - while ((p = strrindex(fn,'/')) && *(p + 1) == '\0') { + while ((p = strrchr(fn,'/')) && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; } diff --git a/lang/m2/comp/options.c b/lang/m2/comp/options.c index 2fb671f4d..568101cb3 100644 --- a/lang/m2/comp/options.c +++ b/lang/m2/comp/options.c @@ -168,7 +168,7 @@ DoOption(text) char *t; while (c = *text++) { - char *strindex(); + char *strchr(); t = text; size = txt2int(&t); @@ -178,7 +178,7 @@ DoOption(text) algn = txt2int(&t); text = t; } - if (! strindex("wislfdpS", c)) { + if (! strchr("wislfdpS", c)) { error("-V: bad type indicator %c\n", c); } if (size != 0) switch (c) { diff --git a/lang/m2/m2mm/main.c b/lang/m2/m2mm/main.c index 694f5b545..8b951a8b8 100644 --- a/lang/m2/m2mm/main.c +++ b/lang/m2/m2mm/main.c @@ -27,7 +27,7 @@ int nDEF, mDEF; struct file_list *CurrentArg; extern int err_occurred; extern int Roption; -extern char *strrindex(); +extern char *strrchr(); extern char *strcpy(), *strcat(); char * @@ -35,7 +35,7 @@ basename(s) char *s; { static char buf[256]; - char *p = strrindex(s, '.'); + char *p = strrchr(s, '.'); if (p != 0) *p = 0; strcpy(buf, s); @@ -49,10 +49,10 @@ getwdir(fn) { register char *p; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); while (p && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); } if (p) { @@ -187,7 +187,7 @@ ProcessArgs() register struct file_list *a; f_walk(arglist, a) { - register char *p = strrindex(f_filename(a), '.'); + register char *p = strrchr(f_filename(a), '.'); CurrentArg = a; DEFPATH[0] = f_dir(a); @@ -241,7 +241,7 @@ find_dependencies() print("\nall:\t"); f_walk(arglist, arg) { char *fn = f_filename(arg); - char *dotspot = strrindex(fn, '.'); + char *dotspot = strrchr(fn, '.'); if (dotspot && strcmp(dotspot, ".mod") == 0) { register struct idf *id = f_idf(arg); @@ -260,7 +260,7 @@ find_dependencies() print("objects:\t"); f_walk(arglist, arg) { char *fn = f_filename(arg); - char *dotspot = strrindex(fn, '.'); + char *dotspot = strrchr(fn, '.'); if (dotspot && strcmp(dotspot, ".mod") == 0) { register struct idf *id = f_idf(arg); @@ -320,7 +320,7 @@ object(arg) register struct file_list *arg; { static char buf[512]; - char *dotp = strrindex(f_filename(arg), '.'); + char *dotp = strrchr(f_filename(arg), '.'); buf[0] = 0; /* @@ -353,7 +353,7 @@ print_dep() register struct file_list *arg; f_walk(arglist, arg) { - char *dotspot = strrindex(f_filename(arg), '.'); + char *dotspot = strrchr(f_filename(arg), '.'); if (dotspot && strcmp(dotspot, ".mod") == 0) { register struct idf *id = f_idf(arg); @@ -413,7 +413,7 @@ module_in_arglist(n) register struct file_list *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)) { *dotp = 0; @@ -459,7 +459,7 @@ programs() register struct file_list *a; f_walk(arglist, a) { - char *dotspot = strrindex(f_filename(a), '.'); + char *dotspot = strrchr(f_filename(a), '.'); if (dotspot && strcmp(dotspot, ".mod") == 0) { register struct idf *id = f_idf(a); diff --git a/lang/m2/m2mm/program.g b/lang/m2/m2mm/program.g index 735c0c6cf..930e2cd3b 100644 --- a/lang/m2/m2mm/program.g +++ b/lang/m2/m2mm/program.g @@ -125,7 +125,7 @@ import(register struct lnk **p;) DefinitionModule { struct idf *id; - extern char *strrindex(); + extern char *strrchr(); } : DEFINITION @@ -146,7 +146,7 @@ DefinitionModule else if (strcmp(id->id_dir, WorkingDir)) { 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; else (id->id_def)++; CurrentArg->a_idf = id; diff --git a/lang/pc/comp/options.c b/lang/pc/comp/options.c index 6f4846871..b80a98b72 100644 --- a/lang/pc/comp/options.c +++ b/lang/pc/comp/options.c @@ -90,7 +90,7 @@ DoOption(text) char c, *t; while( c = *text++ ) { - char *strindex(); + char *strchr(); t = text; size = txt2int(&t); @@ -100,7 +100,7 @@ DoOption(text) align = txt2int(&t); text = t; } - if( !strindex("wilfpS", c) ) + if( !strchr("wilfpS", c) ) error("-V: bad type indicator %c\n", c); if( size ) switch( c ) { diff --git a/mach/i386/ce/as.c b/mach/i386/ce/as.c index 5dd9f3230..b628adb9a 100644 --- a/mach/i386/ce/as.c +++ b/mach/i386/ce/as.c @@ -56,11 +56,11 @@ struct t_operand *op; * expr(reg) -> IS_MEM */ { - char *ptr, *strindex(); + char *ptr, *strchr(); op->type = UNKNOWN; if ( *last( str) == RIGHT) { - ptr = strindex( str, LEFT); + ptr = strchr( str, LEFT); *last( str) = '\0'; *ptr = '\0'; if ( is_reg( ptr+1, op)) { @@ -147,10 +147,10 @@ set_label( str, op) char *str; struct t_operand *op; { - char *ptr, *strindex(), *sprint(); + char *ptr, *strchr(), *sprint(); static char buf[256]; - ptr = strindex( str, '+'); + ptr = strchr( str, '+'); if ( ptr == 0) op->off = "0"; @@ -167,7 +167,7 @@ struct t_operand *op; } else { op->type = IS_LABEL; - if ( strindex( str, DOLLAR) != 0) + if ( strchr( str, DOLLAR) != 0) op->lab = str; else op->lab = sprint( buf, "\"%s\"", str); diff --git a/mach/i86/ce/as.c b/mach/i86/ce/as.c index b340e6088..6f6d63ada 100644 --- a/mach/i86/ce/as.c +++ b/mach/i86/ce/as.c @@ -68,11 +68,11 @@ struct t_operand *op; * expr(reg) -> IS_MEM */ { - char *ptr, *strindex(); + char *ptr, *strchr(); op->type = UNKNOWN; if ( *last( str) == RIGHT) { - ptr = strindex( str, LEFT); + ptr = strchr( str, LEFT); *last( str) = '\0'; *ptr = '\0'; if ( is_reg( ptr+1, op)) { @@ -184,10 +184,10 @@ set_label( str, op) char *str; struct t_operand *op; { - char *ptr, *strindex(), *sprint(); + char *ptr, *strchr(), *sprint(); static char buf[256]; - ptr = strindex( str, '+'); + ptr = strchr( str, '+'); if ( ptr == 0) op->off = "0"; @@ -204,7 +204,7 @@ struct t_operand *op; } else { op->type = IS_LABEL; - if ( strindex( str, DOLLAR) != 0) + if ( strchr( str, DOLLAR) != 0) op->lab = str; else /* nood oplossing */ diff --git a/mach/m68020/ce/as.c b/mach/m68020/ce/as.c index e9493b800..6aaf53840 100644 --- a/mach/m68020/ce/as.c +++ b/mach/m68020/ce/as.c @@ -21,7 +21,7 @@ process_operand( str, op) register char *str; register struct t_operand *op; { - char *glob_lbl(), *strindex(); + char *glob_lbl(), *strchr(); op->type = 0; @@ -46,7 +46,7 @@ register struct t_operand *op; op->lbl = NULL; break; - case '(' : if ( strindex( str+1, ',') == NULL) + case '(' : if ( strchr( str+1, ',') == NULL) if ( is_reg( str+1)) { op->reg = reg_val( str+1); diff --git a/mach/proto/top/top.c b/mach/proto/top/top.c index e44580af9..a82192a52 100644 --- a/mach/proto/top/top.c +++ b/mach/proto/top/top.c @@ -11,10 +11,6 @@ #include "top.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 *************/ extern char *lstrip(); @@ -358,8 +354,8 @@ bool operand(ip,n) p = ip->rest_line; while((*p != OP_SEPARATOR || nesting) && *p != '\n') { #ifdef PAREN_OPEN - if (strindex(PAREN_OPEN, *p) != 0) nesting++; - else if (strindex(PAREN_CLOSE, *p) != 0) nesting--; + if (strchr(PAREN_OPEN, *p) != 0) nesting++; + else if (strchr(PAREN_CLOSE, *p) != 0) nesting--; #endif p++; } diff --git a/mach/sun3/ce/as.c b/mach/sun3/ce/as.c index 177c75840..a9fa7eef2 100644 --- a/mach/sun3/ce/as.c +++ b/mach/sun3/ce/as.c @@ -21,7 +21,7 @@ process_operand( str, op) register char *str; register struct t_operand *op; { - char *glob_lbl(), *strindex(); + char *glob_lbl(), *strchr(); op->type = 0; @@ -46,7 +46,7 @@ register struct t_operand *op; op->lbl = NULL; break; - case '(' : if ( strindex( str+1, ',') == NULL) + case '(' : if ( strchr( str+1, ',') == NULL) if ( is_reg( str+1)) { op->reg = reg_val( str+1); diff --git a/mach/vax4/ce/as.c b/mach/vax4/ce/as.c index d1df1e38f..6d022ba4d 100644 --- a/mach/vax4/ce/as.c +++ b/mach/vax4/ce/as.c @@ -39,7 +39,7 @@ struct t_operand *arg; char lab_buf[4][256], ind_buf[4][256], - *match(), *lab(), *ind(), *end_arg(), *strindex(); + *match(), *lab(), *ind(), *end_arg(), *strchr(); static int n_index = -1; @@ -257,10 +257,10 @@ register struct t_operand *op; } break; case LABEL : @text1( 0xef); - if ( strindex( op->lab, DOLLAR)) { + if ( strchr( op->lab, DOLLAR)) { @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); } else { diff --git a/mach/vax4/top/table b/mach/vax4/top/table index c07c7d664..099e82203 100644 --- a/mach/vax4/top/table +++ b/mach/vax4/top/table @@ -19,7 +19,7 @@ REG {is_register(VAL)}; SREG {is_scratchreg(VAL)}; LAB,LAB2 {VAL[0] == LABEL_STARTER}; A,B {no_side_effects(VAL) }; -NO_INDEX {strindex(VAL, '[') == 0}; +NO_INDEX {strchr(VAL, '[') == 0}; X,Y,LOG {TRUE}; %%; diff --git a/modules/src/system/lock.c b/modules/src/system/lock.c index 5203fcb6d..0f6be5985 100644 --- a/modules/src/system/lock.c +++ b/modules/src/system/lock.c @@ -12,12 +12,12 @@ sys_lock(path) { char buf[1024]; char *tmpf = ".lockXXXXXX"; - char *strrindex(), *strcpy(), *mktemp(); + char *strrchr(), *strcpy(), *mktemp(); char *p; int ok, fd; strcpy(buf, path); - if (p = strrindex(buf, '/')) { + if (p = strrchr(buf, '/')) { ++p; strcpy(p, tmpf); } diff --git a/util/ack/ack.h b/util/ack/ack.h index 89b8ddcca..ede0df5a7 100644 --- a/util/ack/ack.h +++ b/util/ack/ack.h @@ -66,8 +66,8 @@ enum f_path { F_OK, F_NOMATCH, F_NOPATH } ; /* Library routines */ -extern char *strindex(); -extern char *strrindex(); +extern char *strchr(); +extern char *strrchr(); extern char *strcpy(); extern char *strcat(); extern int getpid(); diff --git a/util/ack/main.c b/util/ack/main.c index e70598928..009ad5586 100644 --- a/util/ack/main.c +++ b/util/ack/main.c @@ -117,7 +117,7 @@ char *srcvar() { } char *getsuffix() { - return strrindex(orig.p_path, SUFCHAR) ; + return strrchr(orig.p_path, SUFCHAR) ; } varinit() { @@ -250,7 +250,7 @@ vieuwargs(argc,argv) char **argv ; { firstarg(argp) register char *argp ; { register char *name ; - name=strrindex(argp,'/') ; + name=strrchr(argp,'/') ; if ( name && *(name+1) ) { name++ ; } else { @@ -269,7 +269,7 @@ process(arg) char *arg ; { #ifdef DEBUG if ( debug ) vprint("Processing %s\n",arg) ; #endif - p_suffix= strrindex(arg,SUFCHAR) ; + p_suffix= strrchr(arg,SUFCHAR) ; orig.p_keep= YES ; /* Don't throw away the original ! */ orig.p_keeps= NO; orig.p_path= arg ; diff --git a/util/ack/run.c b/util/ack/run.c index cff8cdb4c..bbc3820d4 100644 --- a/util/ack/run.c +++ b/util/ack/run.c @@ -36,7 +36,7 @@ int runphase(phase) register trf *phase ; { vprint("%s",phase->t_name) ; if ( !phase->t_combine ) { vprint(" %s%s\n",p_basename, - strrindex(in.p_path,SUFCHAR) ) ; + strrchr(in.p_path,SUFCHAR) ) ; } else { scanlist(l_first(phase->t_inputs), elem) { vprint(" %s",p_cont(*elem)->p_path); diff --git a/util/ack/scan.c b/util/ack/scan.c index 7d99f9b85..abf8313e5 100644 --- a/util/ack/scan.c +++ b/util/ack/scan.c @@ -191,7 +191,7 @@ int satisfy(trafo,suffix) register trf *trafo; char *suffix ; { fuerror("Illegal input suffix entry for %s", trafo->t_name) ; } - l_char=strindex(f_char+1,SUFCHAR); + l_char=strchr(f_char+1,SUFCHAR); if ( l_char ) *l_char = 0; if ( strcmp(f_char,suffix)==0 ) { if ( l_char ) *l_char = SUFCHAR; diff --git a/util/ack/trans.c b/util/ack/trans.c index b4b3a143e..135b4c151 100644 --- a/util/ack/trans.c +++ b/util/ack/trans.c @@ -159,9 +159,9 @@ set_Rflag(argp) register char *argp ; { register int length ; char *eq, *colon ; - eos= strindex(&argp[2],'-'); - eq= strindex(&argp[2],EQUAL) ; - colon= strindex(&argp[2],':'); + eos= strchr(&argp[2],'-'); + eq= strchr(&argp[2],EQUAL) ; + colon= strchr(&argp[2],':'); if ( !eos ) { eos= eq ; } else { @@ -470,7 +470,7 @@ int mapexpand(mapentry,cflag) register char *space ; int length ; - star=strindex(mapentry,STAR) ; + star=strchr(mapentry,STAR) ; space=firstblank(mapentry) ; if ( star >space ) star= (char *)0 ; if ( star ) { @@ -514,7 +514,7 @@ doassign(line,star,length) char *line, *star ; { for ( ; *ptr && *ptr!=SPACE && *ptr!=TAB && *ptr!=EQUAL ; ptr++ ) { gr_add(&name,*ptr) ; } - ptr= strindex(ptr,EQUAL) ; + ptr= strchr(ptr,EQUAL) ; if ( !ptr ) { error("Missing %c in assignment %s",EQUAL,line); return ; @@ -602,7 +602,7 @@ addargs(string) char *string ; { register char *temp, *repc ; register list_elem *elem ; - repc=strindex(string,C_IN) ; + repc=strchr(string,C_IN) ; if ( repc ) { /* INPUT FILE TOKEN seen, replace it and scan further */ if ( repc==string && string[1]==0 ) { @@ -629,7 +629,7 @@ addargs(string) char *string ; { } return ; } - repc=strindex(string,C_OUT) ; + repc=strchr(string,C_OUT) ; if ( repc ) { /* replace the outfile token as with the infile token */ #ifdef DEBUG diff --git a/util/ceg/as_parser/help.c b/util/ceg/as_parser/help.c index a72652f1f..e805bbddd 100644 --- a/util/ceg/as_parser/help.c +++ b/util/ceg/as_parser/help.c @@ -13,7 +13,7 @@ extern error(char *, ...); /* 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; } op_info[ MAX_OPERANDS] = { { 0, 0}}; diff --git a/util/ceg/assemble/obj_assemble/assemble.c b/util/ceg/assemble/obj_assemble/assemble.c index abd801798..70709d2df 100644 --- a/util/ceg/assemble/obj_assemble/assemble.c +++ b/util/ceg/assemble/obj_assemble/assemble.c @@ -160,9 +160,9 @@ char *skip_operand( ptr, instr) char *match_ch( c, str, instr) char c, *str, *instr; { - char *ptr, *strindex(); + char *ptr, *strchr(); - ptr = strindex( str, c); + ptr = strchr( str, c); if ( ptr == 0) { error( "syntax error in %s : %c expected\n", instr, c); return( str); diff --git a/util/cpp/input.c b/util/cpp/input.c index eaee781c2..ea3cf1c6b 100644 --- a/util/cpp/input.c +++ b/util/cpp/input.c @@ -20,12 +20,12 @@ getwdir(fn) char *fn; { register char *p; - char *strrindex(); + char *strrchr(); - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); while (p && *(p + 1) == '\0') { /* remove trailing /'s */ *p = '\0'; - p = strrindex(fn, '/'); + p = strrchr(fn, '/'); } if (fn[0] == '\0' || (fn[0] == '/' && p == &fn[0])) /* absolute path */ diff --git a/util/cpp/main.c b/util/cpp/main.c index 7e70d662c..3d9d347c4 100644 --- a/util/cpp/main.c +++ b/util/cpp/main.c @@ -93,7 +93,7 @@ compile(argc, argv) } struct idf *file_head; -extern char *strrindex(); +extern char *strrchr(); list_dependencies(source) char *source; @@ -101,7 +101,7 @@ list_dependencies(source) register struct idf *p = file_head; if (source) { - register char *s = strrindex(source, '.'); + register char *s = strrchr(source, '.'); if (s && *(s+1)) { s++; @@ -111,7 +111,7 @@ list_dependencies(source) * object generated, so don't include the pathname * leading to it. */ - if (s = strrindex(source, '/')) { + if (s = strrchr(source, '/')) { source = s + 1; } } diff --git a/util/ego/em_ego/em_ego.c b/util/ego/em_ego/em_ego.c index a11a7df79..9542b41e6 100644 --- a/util/ego/em_ego/em_ego.c +++ b/util/ego/em_ego/em_ego.c @@ -44,7 +44,7 @@ static char *phnames[] = { extern char *mktemp(); extern char *strcpy(), *strcat(); -extern char *strrindex(); +extern char *strrchr(); static char ddump[128] = TMP_DIR; /* data label dump file */ static char pdump[128] = TMP_DIR; /* procedure name dump file */ @@ -181,7 +181,7 @@ new_outfiles() register char **dst = &phargs[NTEMPS+1]; if (! Bindex) { - Bindex = strrindex(tmpbufs[0], 'B') - tmpbufs[0]; + Bindex = strrchr(tmpbufs[0], 'B') - tmpbufs[0]; } for (i = 1; i <= NTEMPS; i++) { *dst = tmpbufs[tmpindex]; @@ -404,7 +404,7 @@ main(argc, argv) for (i = 2*NTEMPS-1; i >= 1; i--) { (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[1][i] = 'd'; tmpbufs[NTEMPS+1][i] = 'd'; tmpbufs[2][i] = 'l'; tmpbufs[NTEMPS+2][i] = 'l'; diff --git a/util/grind/commands.g b/util/grind/commands.g index 2fbabebf0..eeb3332fa 100644 --- a/util/grind/commands.g +++ b/util/grind/commands.g @@ -19,7 +19,7 @@ #include "misc.h" extern char *Salloc(); -extern char *strindex(); +extern char *strchr(); extern char *strcpy(); extern void signal_child(); extern FILE *db_in; @@ -329,7 +329,7 @@ format_expression(p_tree *p;) expression(p, 0) [ '\\' name(&p1) { register char *c = p1->t_str; while (*c) { - if (! strindex("doshcax", *c)) { + if (! strchr("doshcax", *c)) { error("illegal format: %c", *c); break; } diff --git a/util/grind/db_symtab.g b/util/grind/db_symtab.g index dce7d105d..c16a9ed7d 100644 --- a/util/grind/db_symtab.g +++ b/util/grind/db_symtab.g @@ -18,7 +18,7 @@ #include "rd.h" #include "misc.h" -extern char *strindex(); +extern char *strchr(); extern long str2long(); extern double atof(); @@ -873,7 +873,7 @@ DbRead(f) break; #ifdef N_SCOPE case N_SCOPE: - if (n->on_mptr && strindex(n->on_mptr, ':')) { + if (n->on_mptr && strchr(n->on_mptr, ':')) { n = DbString(n); } break; @@ -898,7 +898,7 @@ DbRead(f) needs_newscope = 0; lbrac_required = 1; } - if (n->on_mptr && strindex(n->on_mptr, ':')) { + if (n->on_mptr && strchr(n->on_mptr, ':')) { n = DbString(n); } break; diff --git a/util/grind/main.c b/util/grind/main.c index afa3e6448..de0388351 100644 --- a/util/grind/main.c +++ b/util/grind/main.c @@ -27,7 +27,7 @@ FILE *db_out; FILE *db_in; int debug; extern struct tokenname tkidf[]; -extern char *strindex(); +extern char *strchr(); extern void signal_child(); extern void init_del(); extern void init_run(); @@ -56,7 +56,7 @@ main(argc, argv) db_in = stdin; progname = argv[0]; init_del(); - while (p = strindex(progname, '/')) { + while (p = strchr(progname, '/')) { progname = p + 1; } while (argv[1] && argv[1][0] == '-') { diff --git a/util/grind/print.c b/util/grind/print.c index 13842831a..13ef34506 100644 --- a/util/grind/print.c +++ b/util/grind/print.c @@ -14,7 +14,7 @@ #include "misc.h" extern FILE *db_out; -extern char *strindex(); +extern char *strchr(); extern char *malloc(); static @@ -24,7 +24,7 @@ print_unsigned(tp, v, format) register char *format; { while (format && *format) { - if (strindex("cdohx", *format)) break; + if (strchr("cdohx", *format)) break; format++; } switch(format == 0 ? 0 : *format) { @@ -87,7 +87,7 @@ print_integer(tp, v, format) register char *format; { while (format && *format) { - if (strindex("cdohx", *format)) break; + if (strchr("cdohx", *format)) break; 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); break; case T_ARRAY: - if ((!format || strindex(format, 'a') == 0) && + if ((!format || strchr(format, 'a') == 0) && (tp->ty_elements == char_type || tp->ty_elements == uchar_type)) { 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); 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)) { char *naddr = malloc(512); diff --git a/util/grind/symbol.c b/util/grind/symbol.c index 98c61bc91..fa4041622 100644 --- a/util/grind/symbol.c +++ b/util/grind/symbol.c @@ -98,7 +98,7 @@ Lookfromscope(id, class, sc) return (p_symbol) 0; } -extern char *strrindex(); +extern char *strrchr(); p_symbol add_file(s) @@ -112,7 +112,7 @@ add_file(s) sym->sy_file = new_file(); sym->sy_file->f_sym = sym; - p = strrindex(s, '.'); + p = strrchr(s, '.'); if (p) { char c = *p; p_symbol sym1; diff --git a/util/grind/tree.c b/util/grind/tree.c index f01ccc633..ec80ab2ad 100644 --- a/util/grind/tree.c +++ b/util/grind/tree.c @@ -25,7 +25,7 @@ extern FILE *db_out; t_lineno currline; t_lineno listline; -extern char *strrindex(); +extern char *strrchr(); extern int interrupted; #if __STDC__ @@ -465,7 +465,7 @@ newfile(id) listfile = add_file(id->id_text); listfile->sy_file->f_scope = FileScope; } - find_language(strrindex(id->id_text, '.')); + find_language(strrchr(id->id_text, '.')); } int in_wheninvoked; diff --git a/util/led/main.c b/util/led/main.c index 81fde572a..426438ec6 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -123,7 +123,7 @@ first_pass(argv) int sectno; int h; extern int atoi(); - extern char *strindex(); + extern char *strchr(); extern int hash(); extern struct outname *searchname(); @@ -144,7 +144,7 @@ first_pass(argv) * section
. */ sectno = atoi(++argp); - if ((argp = strindex(argp, ':')) == (char *)0) + if ((argp = strchr(argp, ':')) == (char *)0) fatal("usage: -a
:"); setlign(sectno, number(++argp)); break; @@ -157,7 +157,7 @@ first_pass(argv) *
. */ sectno = atoi(++argp); - if ((argp = strindex(argp, ':')) == (char *)0) + if ((argp = strchr(argp, ':')) == (char *)0) fatal("usage: -b
:"); setbase(sectno, number(++argp)); break;