diff --git a/ChangeLog b/ChangeLog index 8d9b501cb..e1945d03f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2012-02-06 Robert Larice + * src/frontend/com_compose.c , + * src/frontend/define.c , + * src/frontend/device.c , + * src/frontend/inpcom.c , + * src/frontend/parse.c , + * src/frontend/vectors.c , + * src/frontend/parser/complete.c , + * src/frontend/parser/unixcom.c , + * src/frontend/wdisp/windisp.c , + * src/include/ngspice/ngspice.h , + * src/spicelib/parser/inpptree.c : + use strchr() instead of index() + which is depreciated + ============================ ngspice-24 ================================== 2012-01-30 Dietmar Warning * src/spicelib/devices/dio/diotemp.c: Add temperature dependent diff --git a/src/frontend/com_compose.c b/src/frontend/com_compose.c index e0041919f..1a851d7e1 100644 --- a/src/frontend/com_compose.c +++ b/src/frontend/com_compose.c @@ -218,7 +218,7 @@ com_compose(wordlist *wl) var = wl->wl_word; val = s + 1; wl = wl->wl_next; - } else if (index(wl->wl_word, '=')) { + } else if (strchr(wl->wl_word, '=')) { /* This is var= val. */ *s = '\0'; var = wl->wl_word; diff --git a/src/frontend/define.c b/src/frontend/define.c index b486aea2a..8c533fcb7 100644 --- a/src/frontend/define.c +++ b/src/frontend/define.c @@ -57,7 +57,7 @@ com_define(wordlist *wlist) * to try really hard to break this here. */ buf[0] = '\0'; - for (wl = wlist; wl && (index(wl->wl_word, /* ( */ ')') == NULL); + for (wl = wlist; wl && (strchr(wl->wl_word, /* ( */ ')') == NULL); wl = wl->wl_next) (void) strcat(buf, wl->wl_word); if (wl) { diff --git a/src/frontend/device.c b/src/frontend/device.c index 3e139eefb..23c70c5b4 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -1353,7 +1353,7 @@ devexpand(char *name) { wordlist *wl, *devices, *tw; - if (index(name, '*') ||strchr(name, '[') ||strchr(name, '?')) { + if (strchr(name, '*') || strchr(name, '[') || strchr(name, '?')) { devices = cp_cctowl(ft_curckt->ci_devices); for (wl = NULL; devices; devices = devices->wl_next) if (cp_globmatch(name, devices->wl_word)) { diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c640947ae..e08d23ec9 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -801,7 +801,7 @@ inp_pathopen(char *name, char *mode) char buf2[BSIZE_SP]; /* search in the path where the source (input) file has been found, but only if "name" is just a file name */ - if (!(index(name, DIR_TERM)) && !(index(name, DIR_TERM_LINUX)) && cp_getvar("sourcefile", CP_STRING, buf2)) { + if (!strchr(name, DIR_TERM) && !strchr(name, DIR_TERM_LINUX) && cp_getvar("sourcefile", CP_STRING, buf2)) { /* If pathname is found, get path. (char *dirname(const char *name) might have been used here) */ if (substring(DIR_PATHSEP, buf2) || substring(DIR_PATHSEP_LINUX, buf2)) { @@ -821,7 +821,7 @@ inp_pathopen(char *name, char *mode) /* If this is an abs pathname, or there is no sourcepath var, just * do an fopen. */ - if (index(name, DIR_TERM) || index(name, DIR_TERM_LINUX) + if (strchr(name, DIR_TERM) || strchr(name, DIR_TERM_LINUX) || !cp_getvar("sourcepath", CP_LIST, &v)) return (fopen(name, mode)); #else @@ -830,7 +830,7 @@ inp_pathopen(char *name, char *mode) /* If this is an abs pathname, or there is no sourcepath var, just * do an fopen. */ - if (index(name, DIR_TERM) + if (strchr(name, DIR_TERM) || !cp_getvar("sourcepath", CP_LIST, &v)) return (fopen(name, mode)); #endif diff --git a/src/frontend/parse.c b/src/frontend/parse.c index 48bc6561d..c44614d14 100644 --- a/src/frontend/parse.c +++ b/src/frontend/parse.c @@ -672,7 +672,7 @@ PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line) * name, and otherwise it isn't. * va, ']' too */ - for (; *sbuf && !index(specials, *sbuf); sbuf++) + for (; *sbuf && !strchr(specials, *sbuf); sbuf++) if (*sbuf == '@') atsign = 1; else if (!atsign && ( *sbuf == '[' || *sbuf == ']' )) diff --git a/src/frontend/parser/complete.c b/src/frontend/parser/complete.c index aa6166a77..2f9573ce1 100644 --- a/src/frontend/parser/complete.c +++ b/src/frontend/parser/complete.c @@ -106,7 +106,7 @@ cp_ccom(wordlist *wlist, char *buf, bool esc) pmatches = ccfilec(buf); s =strrchr(buf, '/'); i = (int) strlen(s ? s + 1 : buf); - if ((*buf == '~') && !index(buf, '/')) + if ((*buf == '~') && !strchr(buf, '/')) i--; } diff --git a/src/frontend/parser/unixcom.c b/src/frontend/parser/unixcom.c index f9f337f57..bc0d473f4 100644 --- a/src/frontend/parser/unixcom.c +++ b/src/frontend/parser/unixcom.c @@ -162,7 +162,7 @@ cp_unixcom(wordlist *wl) wl_print(wl, stdout); printf(".\n"); } - if (index(name, '/')) + if (strchr(name, '/')) return (tryexec(name, argv)); i = hash(name); for (hh = hashtab[i]; hh; hh = hh->h_next) { diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index bc217daa7..7c394e41a 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -365,7 +365,7 @@ vec_get(const char *vec_name) wd = word = copy(vec_name); /* Gets mangled below... */ - if (index(word, '.')) { + if (strchr(word, '.')) { /* Snag the plot... */ for (i = 0, s = word; *s != '.'; i++, s++) buf[i] = *s; @@ -854,7 +854,7 @@ vec_basename(struct dvec *v) char buf[BSIZE_SP], *t, *s; int i; - if (index(v->v_name, '.')) { + if (strchr(v->v_name, '.')) { for (t = v->v_name, i = 0; *t; t++) buf[i++] = *t; buf[i] = '\0'; diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index b20f19422..8d0818861 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -481,7 +481,7 @@ LRESULT CALLBACK PlotWindowProc( HWND hwnd, WIN_ScreentoData(gr, xe, ye, &fxe, &fye); strncpy(buf2, gr->plotname, sizeof(buf2)); - if ((t = index(buf2, ':')) != NULL) /* strchr */ + if ((t = strchr(buf2, ':')) != NULL) *t = 0; if (!eq(plot_cur->pl_typename, buf2)) { diff --git a/src/include/ngspice/ngspice.h b/src/include/ngspice/ngspice.h index b92ca86ed..526c3c7bb 100644 --- a/src/include/ngspice/ngspice.h +++ b/src/include/ngspice/ngspice.h @@ -192,14 +192,9 @@ #define WaGauss #define RR_MAX RAND_MAX -#ifdef HAVE_INDEX +#if !defined(HAVE_STRCHR) && defined(HAVE_INDEX) # define strchr index # define strrchr rindex -#else /* va: no index, but strchr */ -# ifdef HAVE_STRCHR -# define index strchr -# define rindex strrchr -# endif /* va: no index, but strchr */ #endif /* added for CYGWIN */ diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index 24b001223..802fa2b16 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -1194,7 +1194,7 @@ int PTlex (YYSTYPE *lvalp, char **line) char *tmp; token = TOK_STR; for (s = sbuf; *s; s++) - if (index(specials, *s)) + if (strchr(specials, *s)) break; tmp = TMALLOC(char, s - sbuf + 1); strncpy(tmp, sbuf, (size_t) (s - sbuf));