Browse Source

Use our own string-routines "strindex" and "strrindex". At least we
know their name!

ceriel 38 years ago
parent
commit
11d442c0a0
3 changed files with 10 additions and 10 deletions
  1. 2 2
      util/ack/main.c
  2. 1 1
      util/ack/run.c
  3. 7 7
      util/ack/trans.c

+ 2 - 2
util/ack/main.c

@@ -251,7 +251,7 @@ vieuwargs(argc,argv) char **argv ; {
 firstarg(argp) register char *argp ; {
 	register char *name ;
 
-	name=rindex(argp,'/') ;
+	name=strrindex(argp,'/') ;
 	if ( name && *(name+1) ) {
 		name++ ;
 	} else {
@@ -270,7 +270,7 @@ process(arg) char *arg ; {
 #ifdef DEBUG
 	if ( debug ) vprint("Processing %s\n",arg) ;
 #endif
-	p_suffix= rindex(arg,SUFCHAR) ;
+	p_suffix= strrindex(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

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

+ 7 - 7
util/ack/trans.c

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