exactly equivalent and standard strchr() and strrchr() functions instead.
}
}
-extern char *strindex();
+extern char *strchr();
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)
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 */
extern char *bts2str();
extern char *symbol2str();
-extern char *strindex();
+extern char *strchr();
int stat_number = 9999; /* static scope number */
struct outdef OutDef;
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 {
#ifndef NOPP
struct dependency *file_head;
-extern char *strrindex();
+extern char *strrchr();
list_dependencies(source)
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++;
* object generated, so don't include the pathname
* leading to it.
*/
- if (s = strrindex(source, '/')) {
+ if (s = strrchr(source, '/')) {
source = s + 1;
}
}
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 */
extern char *bts2str();
extern char *symbol2str();
-extern char *strindex();
+extern char *strchr();
int stat_number = 9999; /* static scope number */
struct outdef OutDef;
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;
#ifndef NOPP
struct idf *file_head;
-extern char *strrindex();
+extern char *strrchr();
list_dependencies(source)
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++;
* object generated, so don't include the pathname
* leading to it.
*/
- if (s = strrindex(source, '/')) {
+ if (s = strrchr(source, '/')) {
source = s + 1;
}
}
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 */
}
struct idf *file_head;
-extern char *strrindex();
+extern char *strrchr();
list_dependencies(source)
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++;
* object generated, so don't include the pathname
* leading to it.
*/
- if (s = strrindex(source, '/')) {
+ if (s = strrchr(source, '/')) {
source = s + 1;
}
}
#define NULL 0
#endif
-#define strchr strindex
-#define strrchr strrindex
+#define strchr strchr
+#define strrchr strrchr
extern char * strcat();
extern char * strchr();
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';
}
char *t;
while (c = *text++) {
- char *strindex();
+ char *strchr();
t = text;
size = txt2int(&t);
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) {
struct file_list *CurrentArg;
extern int err_occurred;
extern int Roption;
-extern char *strrindex();
+extern char *strrchr();
extern char *strcpy(), *strcat();
char *
char *s;
{
static char buf[256];
- char *p = strrindex(s, '.');
+ char *p = strrchr(s, '.');
if (p != 0) *p = 0;
strcpy(buf, s);
{
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) {
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);
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);
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);
register struct file_list *arg;
{
static char buf[512];
- char *dotp = strrindex(f_filename(arg), '.');
+ char *dotp = strrchr(f_filename(arg), '.');
buf[0] = 0;
/*
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);
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;
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);
DefinitionModule
{
struct idf *id;
- extern char *strrindex();
+ extern char *strrchr();
}
:
DEFINITION
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;
char c, *t;
while( c = *text++ ) {
- char *strindex();
+ char *strchr();
t = text;
size = txt2int(&t);
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 ) {
* 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)) {
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";
}
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);
* 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)) {
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";
}
else {
op->type = IS_LABEL;
- if ( strindex( str, DOLLAR) != 0)
+ if ( strchr( str, DOLLAR) != 0)
op->lab = str;
else
/* nood oplossing */
register char *str;
register struct t_operand *op;
{
- char *glob_lbl(), *strindex();
+ char *glob_lbl(), *strchr();
op->type = 0;
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);
#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();
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++;
}
register char *str;
register struct t_operand *op;
{
- char *glob_lbl(), *strindex();
+ char *glob_lbl(), *strchr();
op->type = 0;
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);
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;
}
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 {
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};
%%;
{
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);
}
/* Library routines */
-extern char *strindex();
-extern char *strrindex();
+extern char *strchr();
+extern char *strrchr();
extern char *strcpy();
extern char *strcat();
extern int getpid();
}
char *getsuffix() {
- return strrindex(orig.p_path, SUFCHAR) ;
+ return strrchr(orig.p_path, SUFCHAR) ;
}
varinit() {
firstarg(argp) register char *argp ; {
register char *name ;
- name=strrindex(argp,'/') ;
+ name=strrchr(argp,'/') ;
if ( name && *(name+1) ) {
name++ ;
} else {
#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 ;
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);
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;
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 {
register char *space ;
int length ;
- star=strindex(mapentry,STAR) ;
+ star=strchr(mapentry,STAR) ;
space=firstblank(mapentry) ;
if ( star >space ) star= (char *)0 ;
if ( 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 ;
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 ) {
}
return ;
}
- repc=strindex(string,C_OUT) ;
+ repc=strchr(string,C_OUT) ;
if ( repc ) {
/* replace the outfile token as with the infile token */
#ifdef DEBUG
/* 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}};
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);
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 */
}
struct idf *file_head;
-extern char *strrindex();
+extern char *strrchr();
list_dependencies(source)
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++;
* object generated, so don't include the pathname
* leading to it.
*/
- if (s = strrindex(source, '/')) {
+ if (s = strrchr(source, '/')) {
source = s + 1;
}
}
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 */
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];
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';
#include "misc.h"
extern char *Salloc();
-extern char *strindex();
+extern char *strchr();
extern char *strcpy();
extern void signal_child();
extern FILE *db_in;
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;
}
#include "rd.h"
#include "misc.h"
-extern char *strindex();
+extern char *strchr();
extern long str2long();
extern double atof();
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;
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;
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();
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] == '-') {
#include "misc.h"
extern FILE *db_out;
-extern char *strindex();
+extern char *strchr();
extern char *malloc();
static
register char *format;
{
while (format && *format) {
- if (strindex("cdohx", *format)) break;
+ if (strchr("cdohx", *format)) break;
format++;
}
switch(format == 0 ? 0 : *format) {
register char *format;
{
while (format && *format) {
- if (strindex("cdohx", *format)) break;
+ if (strchr("cdohx", *format)) break;
format++;
}
switch(format == 0 ? 0 : *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);
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);
return (p_symbol) 0;
}
-extern char *strrindex();
+extern char *strrchr();
p_symbol
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;
extern FILE *db_out;
t_lineno currline;
t_lineno listline;
-extern char *strrindex();
+extern char *strrchr();
extern int interrupted;
#if __STDC__
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;
int sectno;
int h;
extern int atoi();
- extern char *strindex();
+ extern char *strchr();
extern int hash();
extern struct outname *searchname();
* 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;
* <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;