diff options
author | christos <christos@NetBSD.org> | 2020-11-11 19:55:33 +0000 |
---|---|---|
committer | christos <christos@NetBSD.org> | 2020-11-11 19:55:33 +0000 |
commit | 8501c01b33abba8d470d59e05105e7215f0a95a4 (patch) | |
tree | b5519f90a1b9caa879ab63d666219c9a01e14fcf /warp/intrp.c | |
parent | c0e5f1acfc272507c6625a5ca9ba723a6b0a7df8 (diff) | |
download | bsdgames-darwin-8501c01b33abba8d470d59e05105e7215f0a95a4.tar.gz bsdgames-darwin-8501c01b33abba8d470d59e05105e7215f0a95a4.tar.zst bsdgames-darwin-8501c01b33abba8d470d59e05105e7215f0a95a4.zip |
use strchr, strrchr, random, more lint removal, savefile in /var/games/warp
not /usr/share/games/warp...
Diffstat (limited to 'warp/intrp.c')
-rw-r--r-- | warp/intrp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/warp/intrp.c b/warp/intrp.c index 6b6b8be4..2b6df825 100644 --- a/warp/intrp.c +++ b/warp/intrp.c @@ -67,7 +67,7 @@ intrp_init(char *tcbuf) gethostname(buf,sizeof buf); hostname = savestr(buf); - if (index(hostname,'.')) + if (strchr(hostname,'.')) hostname = savestr(hostname); else { char hname[128]; @@ -191,7 +191,7 @@ static char * skipinterp(const char *pattern, const char *stoppers) { - while (*pattern && (!stoppers || !index(stoppers,*pattern))) { + while (*pattern && (!stoppers || !strchr(stoppers,*pattern))) { #ifdef DEBUGGING if (debug & 8) printf("skipinterp till %s at %s\r\n",stoppers?stoppers:"",pattern); @@ -276,7 +276,7 @@ dointerp(char *dest, size_t destsize, const char *pattern, const char *stoppers) bool lastcomp = false; int metabit = 0; - while (*pattern && (!stoppers || !index(stoppers,*pattern))) { + while (*pattern && (!stoppers || !strchr(stoppers,*pattern))) { #ifdef DEBUGGING if (debug & 8) printf("dointerp till %s at %s\r\n",stoppers?stoppers:"",pattern); @@ -294,7 +294,7 @@ dointerp(char *dest, size_t destsize, const char *pattern, const char *stoppers) break; case '{': pattern = cpytill(scrbuf,pattern+1,'}'); - if ((s = index(scrbuf,'-')) != NULL) + if ((s = strchr(scrbuf,'-')) != NULL) *s++ = '\0'; else s = nullstr; @@ -424,7 +424,7 @@ dointerp(char *dest, size_t destsize, const char *pattern, const char *stoppers) safecpy(scrbuf,s,(sizeof scrbuf)); s = scrbuf; } - if (upper || !(t=rindex(s,'/'))) + if (upper || !(t=strrchr(s,'/'))) t = s; while (*t && !isalpha((unsigned char)*t)) { t++; @@ -531,9 +531,9 @@ getrealname(uid_t uid) #ifdef BERKJUNK while (*s && !isalnum(*s) && *s != '&') s++; #endif - if ((c = index(s, ',')) != NULL) + if ((c = strchr(s, ',')) != NULL) *c = '\0'; - if ((c = index(s, ';')) != NULL) + if ((c = strchr(s, ';')) != NULL) *c = '\0'; s = cpytill(buf,s,'&'); if (*s == '&') { /* whoever thought this one up was */ @@ -544,9 +544,9 @@ getrealname(uid_t uid) *c = toupper((unsigned char)*c); /* gack and double gack */ } #else - if ((c = index(s, '(')) != NULL) + if ((c = strchr(s, '(')) != NULL) *c = '\0'; - if ((c = index(s, '-')) != NULL) + if ((c = strchr(s, '-')) != NULL) s = c; strcpy(buf,tmpbuf); #endif |