/* $OpenPackages$ */
-/* $OpenBSD: arch.c,v 1.77 2010/02/03 20:45:44 miod Exp $ */
+/* $OpenBSD: arch.c,v 1.78 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: arch.c,v 1.17 1996/11/06 17:58:59 christos Exp $ */
/*
#ifndef ARCH_H
#define ARCH_H
/* $OpenPackages$ */
-/* $OpenBSD: arch.h,v 1.4 2007/09/17 10:12:35 espie Exp $ */
+/* $OpenBSD: arch.h,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: buf.c,v 1.21 2007/07/24 21:09:07 espie Exp $ */
+/* $OpenBSD: buf.c,v 1.22 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: buf.c,v 1.9 1996/12/31 17:53:21 christos Exp $ */
/*
#define _BUF_H
/* $OpenPackages$ */
-/* $OpenBSD: buf.h,v 1.17 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: buf.h,v 1.18 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: buf.h,v 1.7 1996/12/31 17:53:22 christos Exp $ */
/*
/* $OpenPackages$ */
-/* $OpenBSD: cmd_exec.c,v 1.6 2007/07/24 21:09:07 espie Exp $ */
+/* $OpenBSD: cmd_exec.c,v 1.7 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
#ifndef CMD_EXEC_H
#define CMD_EXEC_H
/* $OpenPackages$ */
-/* $OpenBSD: cmd_exec.h,v 1.2 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: cmd_exec.h,v 1.3 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef COMPAT_H
#define COMPAT_H
/* $OpenPackages$ */
-/* $OpenBSD: compat.h,v 1.1 2001/05/23 12:34:41 espie Exp $ */
+/* $OpenBSD: compat.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef COND_H
#define COND_H
/* $OpenPackages$ */
-/* $OpenBSD: cond.h,v 1.3 2007/07/08 17:44:20 espie Exp $ */
+/* $OpenBSD: cond.h,v 1.4 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: cond_int.h,v 1.4 2007/07/08 17:44:20 espie Exp $ */
+/* $OpenBSD: cond_int.h,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/* List of all keywords recognized by the make parser */
#define COND_IF "if"
#define CONFIG_H
/* $OpenPackages$ */
-/* $OpenBSD: config.h,v 1.16 2007/09/16 09:49:24 espie Exp $ */
+/* $OpenBSD: config.h,v 1.17 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: config.h,v 1.7 1996/11/06 17:59:03 christos Exp $ */
/*
#define DEFINES_H
/* $OpenPackages$ */
-/* $OpenBSD: defines.h,v 1.7 2008/11/04 07:22:35 espie Exp $ */
+/* $OpenBSD: defines.h,v 1.8 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: dir.c,v 1.57 2009/08/16 09:53:43 espie Exp $ */
+/* $OpenBSD: dir.c,v 1.58 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: dir.c,v 1.14 1997/03/29 16:51:26 christos Exp $ */
/*
#define DIR_H
/* $OpenPackages$ */
-/* $OpenBSD: dir.h,v 1.24 2008/11/04 07:22:35 espie Exp $ */
+/* $OpenBSD: dir.h,v 1.25 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: dir.h,v 1.4 1996/11/06 17:59:05 christos Exp $ */
/*
-/* $OpenBSD: direxpand.c,v 1.4 2007/09/17 12:22:52 espie Exp $ */
+/* $OpenBSD: direxpand.c,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1999,2007 Marc Espie.
*
#ifndef DIREXPAND_H
#define DIREXPAND_H
-/* $OpenBSD: direxpand.h,v 1.1 2007/09/16 10:14:26 espie Exp $ */
+/* $OpenBSD: direxpand.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
* Copyright (c) 1988, 1989 by Adam de Boor
#ifndef ENGINE_H
#define ENGINE_H
-/* $OpenBSD: engine.h,v 1.8 2009/05/10 11:07:37 espie Exp $ */
+/* $OpenBSD: engine.h,v 1.9 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
/* $OpenPackages$ */
-/* $OpenBSD: error.c,v 1.17 2008/11/04 07:22:35 espie Exp $ */
+/* $OpenBSD: error.c,v 1.18 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef ERROR_H
#define ERROR_H
/* $OpenPackages$ */
-/* $OpenBSD: error.h,v 1.9 2008/11/04 07:22:35 espie Exp $ */
+/* $OpenBSD: error.h,v 1.10 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#define EXTERN_H
/* $OpenPackages$ */
-/* $OpenBSD: extern.h,v 1.41 2007/09/17 12:42:09 espie Exp $ */
+/* $OpenBSD: extern.h,v 1.42 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */
/*-
#ifndef FOR_H
#define FOR_H
/* $OpenPackages$ */
-/* $OpenBSD: for.h,v 1.3 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: for.h,v 1.4 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
#define GARRAY_H
/* $OpenPackages$ */
-/* $OpenBSD: garray.h,v 1.4 2007/12/01 15:14:34 espie Exp $ */
+/* $OpenBSD: garray.h,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/* Growable array implementation */
/*
/* $OpenPackages$ */
-/* $OpenBSD: generate.c,v 1.10 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: generate.c,v 1.11 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef GNODE_H
#define GNODE_H
/* $OpenPackages$ */
-/* $OpenBSD: gnode.h,v 1.15 2009/08/16 09:51:12 espie Exp $ */
+/* $OpenBSD: gnode.h,v 1.16 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: init.c,v 1.4 2007/09/17 12:42:09 espie Exp $ */
+/* $OpenBSD: init.c,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef INIT_H
#define INIT_H
/* $OpenPackages$ */
-/* $OpenBSD: init.h,v 1.1 2001/05/23 12:34:44 espie Exp $ */
+/* $OpenBSD: init.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#define _JOB_H_
/* $OpenPackages$ */
-/* $OpenBSD: job.h,v 1.23 2009/05/10 11:07:37 espie Exp $ */
+/* $OpenBSD: job.h,v 1.24 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: job.h,v 1.5 1996/11/06 17:59:10 christos Exp $ */
/*
#define LOWPARSE_H
/* $OpenPackages$ */
-/* $OpenBSD: lowparse.h,v 1.5 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: lowparse.h,v 1.6 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie.
#define _LST_H_
/* $OpenPackages$ */
-/* $OpenBSD: lst.h,v 1.27 2008/01/12 13:08:59 espie Exp $ */
+/* $OpenBSD: lst.h,v 1.28 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: lst.h,v 1.7 1996/11/06 17:59:12 christos Exp $ */
/*
/* $OpenPackages$ */
-/* $OpenBSD: lst_t.h,v 1.1 2001/05/23 12:34:46 espie Exp $ */
+/* $OpenBSD: lst_t.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef MAIN_H
#define MAIN_H
/* $OpenPackages$ */
-/* $OpenBSD: main.h,v 1.3 2007/09/17 12:42:09 espie Exp $ */
+/* $OpenBSD: main.h,v 1.4 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#define _MAKE_H_
/* $OpenPackages$ */
-/* $OpenBSD: make.h,v 1.36 2007/12/01 15:14:34 espie Exp $ */
+/* $OpenBSD: make.h,v 1.37 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: make.h,v 1.15 1997/03/10 21:20:00 christos Exp $ */
/*
/* $OpenPackages$ */
-/* $OpenBSD: memory.c,v 1.6 2008/03/24 18:03:53 espie Exp $ */
+/* $OpenBSD: memory.c,v 1.7 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
#define MEMORY_H
/* $OpenPackages$ */
-/* $OpenBSD: memory.h,v 1.5 2008/03/24 18:03:53 espie Exp $ */
+/* $OpenBSD: memory.h,v 1.6 2010/07/19 19:30:37 espie Exp $ */
/*-
* Copyright (c) 1988, 1989, 1990, 1993
-/* $OpenBSD: node_int.h,v 1.1 2007/09/16 10:20:17 espie Exp $ */
+/* $OpenBSD: node_int.h,v 1.2 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2007 Marc Espie.
#ifndef PARSE_H
#define PARSE_H
/* $OpenPackages$ */
-/* $OpenBSD: parse.h,v 1.3 2007/09/17 11:11:30 espie Exp $ */
+/* $OpenBSD: parse.h,v 1.4 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
/* $OpenPackages$ */
-/* $OpenBSD: parsevar.c,v 1.12 2007/09/17 11:14:38 espie Exp $ */
+/* $OpenBSD: parsevar.c,v 1.13 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: parse.c,v 1.29 1997/03/10 21:20:04 christos Exp $ */
/*
#ifndef PARSEVAR_H
#define PARSEVAR_H
/* $OpenPackages$ */
-/* $OpenBSD: parsevar.h,v 1.3 2007/09/17 11:14:38 espie Exp $ */
+/* $OpenBSD: parsevar.h,v 1.4 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
/* $OpenPackages$ */
-/* $OpenBSD: pathnames.h,v 1.10 2003/06/03 02:56:12 millert Exp $ */
+/* $OpenBSD: pathnames.h,v 1.11 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: pathnames.h,v 1.6 1996/11/06 17:59:21 christos Exp $ */
/*
/* $OpenPackages$ */
-/* $OpenBSD: regress.c,v 1.5 2004/04/07 13:11:36 espie Exp $ */
+/* $OpenBSD: regress.c,v 1.6 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: stats.c,v 1.8 2004/05/05 09:10:47 espie Exp $ */
+/* $OpenBSD: stats.c,v 1.9 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie.
#ifndef STAT_H
#define STAT_H
/* $OpenPackages$ */
-/* $OpenBSD: stats.h,v 1.4 2004/05/05 09:10:47 espie Exp $ */
+/* $OpenBSD: stats.h,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: str.c,v 1.25 2007/09/17 09:44:20 espie Exp $ */
+/* $OpenBSD: str.c,v 1.26 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */
/*-
#ifndef SUFF_H
#define SUFF_H
/* $OpenPackages$ */
-/* $OpenBSD: suff.h,v 1.4 2007/11/24 15:41:01 espie Exp $ */
+/* $OpenBSD: suff.h,v 1.5 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#ifndef SYMTABLE_H
#define SYMTABLE_H
/* $OpenPackages$ */
-/* $OpenBSD: symtable.h,v 1.2 2007/11/17 16:39:45 espie Exp $ */
+/* $OpenBSD: symtable.h,v 1.3 2010/07/19 19:30:37 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: targ.c,v 1.60 2010/04/25 13:59:53 espie Exp $ */
+/* $OpenBSD: targ.c,v 1.61 2010/07/19 19:30:37 espie Exp $ */
/* $NetBSD: targ.c,v 1.11 1997/02/20 16:51:50 christos Exp $ */
/*
{
return &targets;
}
+
+GNode *
+Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags)
+{
+ return Targ_FindNodeih(name, name + n - 1, hv, flags);
+}
#ifndef TARG_H
#define TARG_H
/* $OpenPackages$ */
-/* $OpenBSD: targ.h,v 1.7 2008/11/04 07:22:36 espie Exp $ */
+/* $OpenBSD: targ.h,v 1.8 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: timestamp.c,v 1.4 2009/08/16 09:53:43 espie Exp $ */
+/* $OpenBSD: timestamp.c,v 1.5 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
#define TIMESTAMP_H
/* $OpenPackages$ */
-/* $OpenBSD: timestamp.h,v 1.4 2007/09/17 09:44:20 espie Exp $ */
+/* $OpenBSD: timestamp.h,v 1.5 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: timestamp_t.h,v 1.1 2001/05/23 12:34:51 espie Exp $ */
+/* $OpenBSD: timestamp_t.h,v 1.2 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: util.c,v 1.23 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: util.c,v 1.24 2010/07/19 19:30:38 espie Exp $ */
/* $NetBSD: util.c,v 1.10 1996/12/31 17:56:04 christos Exp $ */
/*
/* $OpenPackages$ */
-/* $OpenBSD: varmodifiers.c,v 1.25 2007/11/03 15:42:11 deraadt Exp $ */
+/* $OpenBSD: varmodifiers.c,v 1.26 2010/07/19 19:30:38 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
static char *VarModify(char *, bool (*)(struct Name *, bool, Buffer, void *), void *);
static void *check_empty(const char **, SymTable *, bool, int);
+static void *check_quote(const char **, SymTable *, bool, int);
static char *do_upper(const char *, const struct Name *, void *);
static char *do_lower(const char *, const struct Name *, void *);
static void *check_shcmd(const char **, SymTable *, bool, int);
#ifndef MAKE_BOOTSTRAP
resubst_mod = {false, get_patternarg, do_regex, NULL, free_patternarg},
#endif
- quote_mod = {false, check_empty, VarQuote, NULL , NULL},
+ quote_mod = {false, check_quote, VarQuote, NULL , free},
tail_mod = {false, check_empty, NULL, VarTail, NULL},
head_mod = {false, check_empty, NULL, VarHead, NULL},
suffix_mod = {false, check_empty, NULL, VarSuffix, NULL},
}
void *
-get_sysvpattern(const char **p, SymTable *ctxt UNUSED, bool err UNUSED,
- int endc)
+get_sysvpattern(const char **p, SymTable *ctxt UNUSED, bool err, int endc)
{
VarPattern *pattern;
const char *cp, *cp2;
+ BUFFER buf;
int cnt = 0;
char startc = endc == ')' ? '(' : '{';
-
for (cp = *p;; cp++) {
if (*cp == '=' && cnt == 0)
break;
return NULL;
}
}
+ Buf_Init(&buf, 0);
for (cp2 = cp+1;; cp2++) {
if ((*cp2 == ':' || *cp2 == endc) && cnt == 0)
break;
- if (*cp2 == '\0')
+ if (*cp2 == '\0') {
+ Buf_Destroy(&buf);
return NULL;
+ }
if (*cp2 == startc)
cnt++;
else if (*cp2 == endc) {
cnt--;
- if (cnt < 0)
+ if (cnt < 0) {
+ Buf_Destroy(&buf);
return NULL;
+ }
+ } else if (*cp2 == '$') {
+ if (cp2[1] == '$')
+ cp2++;
+ else {
+ size_t len;
+ (void)Var_ParseBuffer(&buf, cp2, ctxt, err,
+ &len);
+ cp2 += len - 1;
+ continue;
+ }
}
+ Buf_AddChar(&buf, *cp2);
}
pattern = (VarPattern *)emalloc(sizeof(VarPattern));
pattern->lbuffer = pattern->lhs = Str_dupi(*p, cp);
pattern->leftLen = cp - *p;
- pattern->rhs = Str_dupi(cp+1, cp2);
- pattern->rightLen = cp2 - (cp+1);
+ pattern->rhs = Buf_Retrieve(&buf);
+ pattern->rightLen = Buf_Size(&buf);
pattern->flags = 0;
*p = cp2;
return pattern;
*-----------------------------------------------------------------------
*/
static char *
-VarQuote(const char *str, const struct Name *n UNUSED, void *dummy UNUSED)
+VarQuote(const char *str, const struct Name *n UNUSED, void *islistp)
{
+ int islist = *((int *)islistp);
BUFFER buf;
/* This should cover most shells :-( */
static char meta[] = "\n \t'`\";&<>()|*?{}[]\\$!#^~";
+ char *rep = meta;
+ if (islist)
+ rep += 3;
Buf_Init(&buf, MAKE_BSIZE);
for (; *str; str++) {
- if (strchr(meta, *str) != NULL)
+ if (strchr(rep, *str) != NULL)
Buf_AddChar(&buf, '\\');
Buf_AddChar(&buf, *str);
}
return NULL;
}
+static void *
+check_quote(const char **p, SymTable *ctxt UNUSED, bool b UNUSED, int endc)
+{
+ int *qargs = emalloc(sizeof(int));
+ *qargs = 0;
+ if ((*p)[1] == 'L') {
+ *qargs = 1;
+ (*p)++;
+ }
+ if ((*p)[1] == endc || (*p)[1] == ':') {
+ (*p)++;
+ return qargs;
+ } else
+ return NULL;
+}
+
static void *
check_shcmd(const char **p, SymTable *ctxt UNUSED, bool b UNUSED, int endc)
{
#define VARMODIFIERS_H
/* $OpenPackages$ */
-/* $OpenBSD: varmodifiers.h,v 1.10 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: varmodifiers.h,v 1.11 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 1999 Marc Espie.
/* $OpenPackages$ */
-/* $OpenBSD: varname.c,v 1.3 2007/07/09 12:29:45 espie Exp $ */
+/* $OpenBSD: varname.c,v 1.4 2010/07/19 19:30:38 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
*
-/* $OpenBSD: varname.h,v 1.3 2007/09/17 09:28:36 espie Exp $ */
+/* $OpenBSD: varname.h,v 1.4 2010/07/19 19:30:38 espie Exp $ */
#ifndef VARNAME_H
#define VARNAME_H
/*