-/* $OpenBSD: dol.c,v 1.22 2018/09/08 01:28:39 miko Exp $ */
+/* $OpenBSD: dol.c,v 1.23 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */
/*-
for (i = 0; Isdigit(*np); i = i * 10 + *np++ - '0')
continue;
- if ((i < 0 || i > upb) && !any("-*", *np)) {
+ if ((i < 0 || i > upb) && !strchr("-*", *np)) {
dolerror(vp->v_name);
return;
}
dolmod[dolnmod++] = delim;
if (!delim || letter(delim)
- || Isdigit(delim) || any(" \t\n", delim)) {
+ || Isdigit(delim) || strchr(" \t\n", delim)) {
seterror(ERR_BADSUBST);
break;
}
}
continue;
}
- if (!any("htrqxes", c))
+ if (!strchr("htrqxes", c))
stderror(ERR_BADMOD, c);
dolmod[dolnmod++] = c;
if (c == 'q')
delim = dolmod[++i];
if (!delim || letter(delim)
- || Isdigit(delim) || any(" \t\n", delim)) {
+ || Isdigit(delim) || strchr(" \t\n", delim)) {
seterror(ERR_BADSUBST);
break;
}
/* \ quotes \ $ ` here */
if (c == '\\') {
c = DgetC(0);
- if (!any("$\\`", c))
+ if (!strchr("$\\`", c))
unDgetC(c | QUOTE), c = '\\';
else
c |= QUOTE;
* If any ` in line do command substitution
*/
mbp = mbuf;
- if (any(short2str(mbp), '`')) {
+ if (strchr(short2str(mbp), '`')) {
/*
* 1 arg to dobackp causes substitution to be literal. Words are
* broken only at newlines so that all blanks and tabs are
-/* $OpenBSD: exec.c,v 1.19 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: exec.c,v 1.20 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: exec.c,v 1.9 1996/09/30 20:03:54 christos Exp $ */
/*-
blkfree(pv);
pexerr();
}
- slash = any(short2str(expath), '/');
+ slash = (bool) strchr(short2str(expath), '/');
/*
* Glob the argument list, if necessary. Otherwise trim off the quote bits.
Char **pv;
Char *sav;
struct varent *v;
- bool slash = any(short2str(name), '/');
+ bool slash = (bool) strchr(short2str(name), '/');
int hashval = 0, hashval1, i;
v = adrof(STRpath);
if ((i = iscommand(sp->word)) != 0) {
Char **pv;
struct varent *v;
- bool slash = any(short2str(sp->word), '/');
+ bool slash = (bool) strchr(short2str(sp->word), '/');
v = adrof(STRpath);
if (v == 0 || v->vec[0] == 0 || slash)
-/* $OpenBSD: exp.c,v 1.16 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: exp.c,v 1.17 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: exp.c,v 1.6 1995/03/21 09:02:51 cgd Exp $ */
/*-
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
+#include <string.h>
#include "csh.h"
#include "extern.h"
p1 = exp4(vp, ignore);
op = **vp;
- if (op && any("<>", op[0]) && op[0] == op[1]) {
+ if (op && strchr("<>", op[0]) && op[0] == op[1]) {
(*vp)++;
p2 = exp3a(vp, ignore);
if (op[0] == '<')
if (isa(**vp, ANYOP))
return (Strsave(STRNULL));
cp = *(*vp)++;
- if (*cp == '-' && any("erwxfdzopls", cp[1])) {
+ if (*cp == '-' && strchr("erwxfdzopls", cp[1])) {
struct stat stb;
if (cp[2] != '\0')
-/* $OpenBSD: extern.h,v 1.27 2018/09/15 12:15:32 miko Exp $ */
+/* $OpenBSD: extern.h,v 1.28 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: extern.h,v 1.8 1996/10/31 23:50:54 christos Exp $ */
/*-
/*
* misc.c
*/
-int any(char *, int);
Char **blkcat(Char **, Char **);
Char **blkcpy(Char **, Char **);
Char **blkend(Char **);
-/* $OpenBSD: lex.c,v 1.25 2017/08/30 07:54:54 anton Exp $ */
+/* $OpenBSD: lex.c,v 1.26 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */
/*-
np = name, *np++ = '$';
c = sc = getC(DOEXCL);
- if (any("\t \n", c)) {
+ if (strchr("\t \n", c)) {
ungetD(c);
ungetC('$' | QUOTE);
return;
*np++ = delim;
if (!delim || letter(delim)
- || Isdigit(delim) || any(" \t\n", delim)) {
+ || Isdigit(delim) || strchr(" \t\n", delim)) {
seterror(ERR_BADSUBST);
break;
}
}
c = 's';
}
- if (!any("htrqxes", c)) {
+ if (!strchr("htrqxes", c)) {
if ((amodflag || gmodflag) && c == '\n')
stderror(ERR_VARSYN); /* strike */
seterror(ERR_VARMOD, c);
goto subst;
}
c = getC(0);
- if (!any(":^$*-%", c))
+ if (!strchr(":^$*-%", c))
goto subst;
left = right = -1;
if (c == ':') {
case 's':
delim = getC(0);
- if (letter(delim) || Isdigit(delim) || any(" \t\n", delim)) {
+ if (letter(delim) || Isdigit(delim) || strchr(" \t\n", delim)) {
unreadc(delim);
lhsb[0] = 0;
seterror(ERR_BADSUBST);
case 'h':
case 't':
- if (!any(short2str(cp), '/'))
+ if (!strchr(short2str(cp), '/'))
return (type == 't' ? Strsave(cp) : 0);
wp = Strend(cp);
while (*--wp != '/')
if (first) {
c = getC(0);
unreadc(c);
- if (any("-$*", c))
+ if (strchr("-$*", c))
return (1);
}
if (*al > *ar || *ar > dol) {
/* FALLSTHROUGH */
default:
- if (any("(=~", c)) {
+ if (strchr("(=~", c)) {
unreadc(c);
ungetC(HIST);
return (0);
}
np = lhsb;
event = 0;
- while (!cmap(c, _ESC | _META | _QF | _QB) && !any("${}:", c)) {
+ while (!cmap(c, _ESC | _META | _QF | _QB) && !strchr("${}:", c)) {
if (event != -1 && Isdigit(c))
event = event * 10 + c - '0';
else
-/* $OpenBSD: misc.c,v 1.21 2018/09/15 12:15:32 miko Exp $ */
+/* $OpenBSD: misc.c,v 1.22 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: misc.c,v 1.6 1995/03/21 09:03:09 cgd Exp $ */
/*-
static int fdcmp(int);
static int renum(int, int);
-int
-any(char *s, int c)
-{
- if (!s)
- return (0); /* Check for nil pointer */
- while (*s)
- if (*s++ == c)
- return (1);
- return (0);
-}
-
char *
xstrdup(const char *s)
{
-/* $OpenBSD: parse.c,v 1.12 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: parse.c,v 1.13 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: parse.c,v 1.6 1995/03/21 09:03:10 cgd Exp $ */
/*-
asyntax(struct wordent *p1, struct wordent *p2)
{
while (p1 != p2)
- if (any(";&\n", p1->word[0]))
+ if (strchr(";&\n", p1->word[0]))
p1 = p1->next;
else {
asyn0(p1, p2);
{
while (p1 != p2)
- if (any(";&\n", p1->word[0]))
+ if (strchr(";&\n", p1->word[0]))
p1 = p1->next;
else
return (syn0(p1, p2, flags));
}
if (p->next == p2)
continue;
- if (any(RELPAR, p->next->word[0]))
+ if (strchr(RELPAR, p->next->word[0]))
continue;
n--;
continue;
continue;
}
p = p->next;
- if (any(RELPAR, p->word[0])) {
+ if (strchr(RELPAR, p->word[0])) {
seterror(ERR_MISRED);
continue;
}
continue;
}
p = p->next;
- if (any(RELPAR, p->word[0])) {
+ if (strchr(RELPAR, p->word[0])) {
seterror(ERR_MISRED);
continue;
}
-/* $OpenBSD: set.c,v 1.19 2015/12/26 13:48:38 mestre Exp $ */
+/* $OpenBSD: set.c,v 1.20 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: set.c,v 1.8 1995/03/21 18:35:52 mycroft Exp $ */
/*-
#include <sys/types.h>
#include <stdlib.h>
#include <stdarg.h>
+#include <string.h>
#include "csh.h"
#include "extern.h"
}
else {
c = *p++;
- if (any("+-", c)) {
+ if (strchr("+-", c)) {
if (c != op || *p)
stderror(ERR_NAME | ERR_UNKNOWNOP);
p = Strsave(STR1);
}
else {
- if (any("<>", op)) {
+ if (strchr("<>", op)) {
if (c != op)
stderror(ERR_NAME | ERR_UNKNOWNOP);
c = *p++;
-/* $OpenBSD: time.c,v 1.15 2017/07/22 09:37:21 anton Exp $ */
+/* $OpenBSD: time.c,v 1.16 2018/09/17 16:00:19 martijn Exp $ */
/* $NetBSD: time.c,v 1.7 1995/03/21 13:55:25 mycroft Exp $ */
/*-
#include <sys/types.h>
#include <stdarg.h>
+#include <string.h>
#include "csh.h"
#include "extern.h"
v++, cp = *v++;
if (cp == 0)
nval = 4;
- else if (*v == 0 && any("+-", cp[0]))
+ else if (*v == 0 && strchr("+-", cp[0]))
nval = getn(cp);
(void) setpriority(PRIO_PROCESS, 0, nval);
}