Sfoglia il codice sorgente

Replaced calls to the custom strindex() and strrindex() functions with the
exactly equivalent and standard strchr() and strrchr() functions instead.

dtrg 18 anni fa
parent
commit
9c722420dd

+ 2 - 2
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)

+ 3 - 3
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 */

+ 2 - 2
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 #<num>, replace it by '#anonymous id' */
 			printf("#anonymous id%s",
-				strindex(tp->tp_idf->id_text, ' ')
+				strchr(tp->tp_idf->id_text, ' ')
 			);
 		}
 		else {

+ 3 - 3
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;
 	    }
 	}

+ 3 - 3
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 */

+ 2 - 2
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 #<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);
 		break;

+ 3 - 3
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;
 	    }
 	}

+ 3 - 3
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 */

+ 3 - 3
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;
                         }
 		}

+ 2 - 2
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();

+ 2 - 2
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';
 	}

+ 2 - 2
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)	{

+ 11 - 11
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);

+ 2 - 2
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;

+ 2 - 2
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 )	{

+ 5 - 5
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);

+ 5 - 5
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 */

+ 2 - 2
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);
 

+ 2 - 6
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++;
 	}

+ 2 - 2
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);
 

+ 3 - 3
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 {

+ 1 - 1
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};
 
 %%;

+ 2 - 2
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);
 	}

+ 2 - 2
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();

+ 3 - 3
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 ;

+ 1 - 1
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);

+ 1 - 1
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;

+ 7 - 7
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

+ 1 - 1
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}};

+ 2 - 2
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);

+ 3 - 3
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 */

+ 3 - 3
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;
                         }
 		}

+ 3 - 3
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';

+ 2 - 2
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;
 				}

+ 3 - 3
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;

+ 2 - 2
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] == '-') {

+ 5 - 5
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);
 

+ 2 - 2
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;

+ 2 - 2
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;

+ 3 - 3
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 <section number>.
 			 */
 			sectno = atoi(++argp);
-			if ((argp = strindex(argp, ':')) == (char *)0)
+			if ((argp = strchr(argp, ':')) == (char *)0)
 				fatal("usage: -a<section number>:<alignment>");
 			setlign(sectno, number(++argp));
 			break;
@@ -157,7 +157,7 @@ first_pass(argv)
 			 * <section number>.
 			 */
 			sectno = atoi(++argp);
-			if ((argp = strindex(argp, ':')) == (char *)0)
+			if ((argp = strchr(argp, ':')) == (char *)0)
 				fatal("usage: -b<section number>:<base>");
 			setbase(sectno, number(++argp));
 			break;