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()
{
@@ -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)

View File

@@ -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 */

View File

@@ -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 {

View File

@@ -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;
}
}

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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 */

View File

@@ -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;
}
}

View File

@@ -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();

View File

@@ -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';
}

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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 ) {