make needshell customizable, so that xinstall can use it.

This commit is contained in:
christos 2015-06-19 14:32:04 +00:00
parent 3f6f33cbde
commit 0002ddbc7d
2 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $ */
/* $NetBSD: compat.c,v 1.100 2015/06/19 14:32:04 christos Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
static char rcsid[] = "$NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $";
static char rcsid[] = "$NetBSD: compat.c,v 1.100 2015/06/19 14:32:04 christos Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
__RCSID("$NetBSD: compat.c,v 1.99 2015/06/19 14:25:34 christos Exp $");
__RCSID("$NetBSD: compat.c,v 1.100 2015/06/19 14:32:04 christos Exp $");
#endif
#endif /* not lint */
#endif
@ -280,7 +280,7 @@ CompatRunCommand(void *cmdp, void *gnp)
* meta characters as documented in make(1).
*/
useShell = needshell(cmd);
useShell = needshell(cmd, FALSE);
#endif
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: metachar.h,v 1.2 2015/06/19 14:25:34 christos Exp $ */
/* $NetBSD: metachar.h,v 1.3 2015/06/19 14:32:04 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -32,6 +32,7 @@
#define _METACHAR_H
#include <sys/cdefs.h>
#include <ctype.h>
__BEGIN_DECLS
extern unsigned char _metachar[];
@ -48,10 +49,13 @@ hasmeta(const char *cmd)
}
static inline int
needshell(const char *cmd)
needshell(const char *cmd, int white)
{
while (!ismeta(*cmd) && *cmd != ':' && *cmd != '=')
while (!ismeta(*cmd) && *cmd != ':' && *cmd != '=') {
if (white && isspace((unsigned char)*cmd))
break;
cmd++;
}
return *cmd != '\0';
}