NetBSD re-synchronization of the source tree

This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
This commit is contained in:
2015-10-15 17:01:16 +02:00
parent 8933525b85
commit 0a6a1f1d05
32425 changed files with 2998623 additions and 1342348 deletions

View File

@@ -1,7 +1,7 @@
/*
* $OpenBSD: backupfile.c,v 1.19 2006/03/11 19:41:30 otto Exp $
* $DragonFly: src/usr.bin/patch/backupfile.c,v 1.5 2008/08/11 00:05:06 joerg Exp $
* $NetBSD: backupfile.c,v 1.14 2008/09/19 18:33:34 joerg Exp $
* $NetBSD: backupfile.c,v 1.15 2014/04/11 17:30:03 christos Exp $
*/
/*
@@ -22,7 +22,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: backupfile.c,v 1.14 2008/09/19 18:33:34 joerg Exp $");
__RCSID("$NetBSD: backupfile.c,v 1.15 2014/04/11 17:30:03 christos Exp $");
#include <ctype.h>
#include <dirent.h>
@@ -227,11 +227,11 @@ invalid_arg(const char *kind, const char *value, int problem)
}
static const char *backup_args[] = {
"never", "simple", "nil", "existing", "t", "numbered", 0
"none", "never", "simple", "nil", "existing", "t", "numbered", 0
};
static enum backup_type backup_types[] = {
simple, simple, numbered_existing,
none, simple, simple, numbered_existing,
numbered_existing, numbered, numbered
};

View File

@@ -1,7 +1,7 @@
/*
* $OpenBSD: common.h,v 1.26 2006/03/11 19:41:30 otto Exp $
* $DragonFly: src/usr.bin/patch/common.h,v 1.5 2008/08/10 23:50:12 joerg Exp $
* $NetBSD: common.h,v 1.19 2008/09/19 18:33:34 joerg Exp $
* $NetBSD: common.h,v 1.21 2015/07/24 18:56:44 christos Exp $
*/
/*
@@ -43,6 +43,7 @@
#define INITHUNKMAX 125 /* initial dynamic allocation size */
#define MAXLINELEN 8192
#define BUFFERSIZE 1024
#define LINENUM_MAX LONG_MAX
#define SCCSPREFIX "s."
#define GET "get -e %s"

View File

@@ -1,6 +1,6 @@
.\" $OpenBSD: patch.1,v 1.22 2008/06/06 20:44:00 jmc Exp $
.\" $DragonFly: src/usr.bin/patch/patch.1,v 1.10 2008/08/18 19:15:55 joerg Exp $
.\" $NetBSD: patch.1,v 1.16 2013/01/29 09:30:11 wiz Exp $
.\" $NetBSD: patch.1,v 1.19 2015/08/02 12:19:12 wiz Exp $
.\" Copyright 1986, Larry Wall
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -21,7 +21,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 18, 2008
.Dd August 2, 2015
.Dt PATCH 1
.Os
.Sh NAME
@@ -38,7 +38,7 @@
.Op Fl o Ar out-file
.Op Fl p Ar strip-count
.Op Fl r Ar rej-name
.Op Fl V Cm t | nil | never
.Op Fl V Cm t | nil | never | none
.Op Fl x Ar number
.Op Fl z Ar backup-ext
.Op Fl Fl posix
@@ -266,7 +266,7 @@ and assume that patches are reversed if they look like they are.
Forces
.Nm
to interpret the patch file as a unified context diff (a unidiff).
.It Fl V Cm t | nil | never , Fl Fl version-control Cm t | nil | never
.It Fl V Cm t | nil | never | none , Fl Fl version-control Cm t | nil | never | none
Causes the next argument to be interpreted as a method for creating
backup file names.
The type of backups made can also be given in the
@@ -445,9 +445,8 @@ the shortest basename, and the shortest total file name length (in that order).
.It
If no file exists,
.Nm
checks for the existence of the files in an SCCS or RCS directory
(using the appropriate prefix or suffix) using the criteria specified
above.
checks for the existence of the files in an RCS directory using the criteria
specified above.
If found,
.Nm
will attempt to get or check out the file.

View File

@@ -1,7 +1,7 @@
/*
* $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
* $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
* $NetBSD: pch.c,v 1.25 2013/01/29 09:30:11 wiz Exp $
* $NetBSD: pch.c,v 1.28 2015/07/30 21:47:51 christos Exp $
*/
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pch.c,v 1.25 2013/01/29 09:30:11 wiz Exp $");
__RCSID("$NetBSD: pch.c,v 1.28 2015/07/30 21:47:51 christos Exp $");
#include <sys/types.h>
#include <sys/stat.h>
@@ -455,6 +455,28 @@ malformed(void)
/* about as informative as "Syntax error" in C */
}
static LINENUM
getlinenum(const char *s)
{
LINENUM l = (LINENUM)atol(s);
if (l < 0) {
l = 0;
malformed();
}
return l;
}
static LINENUM
getskiplinenum(char **p)
{
char *s = *p;
LINENUM l = getlinenum(s);
while (isdigit((unsigned char)*s))
s++;
*p = s;
return l;
}
/*
* True if the line has been discarded (i.e., it is a line saying
* "\ No newline at end of file".)
@@ -582,21 +604,24 @@ another_hunk(void)
malformed();
if (strnEQ(s, "0,0", 3))
memmove(s, s + 2, strlen(s + 2) + 1);
p_first = (LINENUM) atol(s);
while (isdigit((unsigned char)*s))
s++;
p_first = getskiplinenum(&s);
if (*s == ',') {
for (; *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
p_ptrn_lines = ((LINENUM) atol(s)) - p_first + 1;
p_ptrn_lines = (getlinenum(s)) - p_first + 1;
if (p_ptrn_lines < 0)
malformed();
} else if (p_first)
p_ptrn_lines = 1;
else {
p_ptrn_lines = 0;
p_first = 1;
}
if (p_first >= LINENUM_MAX - p_ptrn_lines ||
p_ptrn_lines >= LINENUM_MAX - 6)
malformed();
/* we need this much at least */
p_max = p_ptrn_lines + 6;
@@ -649,22 +674,25 @@ another_hunk(void)
;
if (!*s)
malformed();
p_newfirst = (LINENUM) atol(s);
while (isdigit((unsigned char)*s))
s++;
p_newfirst = getskiplinenum(&s);
if (*s == ',') {
for (; *s && !isdigit((unsigned char)*s); s++)
;
if (!*s)
malformed();
p_repl_lines = ((LINENUM) atol(s)) -
p_repl_lines = (getlinenum(s)) -
p_newfirst + 1;
if (p_repl_lines < 0)
malformed();
} else if (p_newfirst)
p_repl_lines = 1;
else {
p_repl_lines = 0;
p_newfirst = 1;
}
if (p_newfirst >= LINENUM_MAX - p_repl_lines ||
p_repl_lines >= LINENUM_MAX - p_end)
malformed();
p_max = p_repl_lines + p_end;
if (p_max > MAXHUNKSIZE)
fatal("hunk too large (%ld lines) at line %ld: %s",
@@ -857,32 +885,32 @@ hunk_done:
s = buf + 4;
if (!*s)
malformed();
p_first = (LINENUM) atol(s);
while (isdigit((unsigned char)*s))
s++;
p_first = getskiplinenum(&s);
if (*s == ',') {
p_ptrn_lines = (LINENUM) atol(++s);
while (isdigit((unsigned char)*s))
s++;
s++;
p_ptrn_lines = getskiplinenum(&s);
} else
p_ptrn_lines = 1;
if (p_first >= LINENUM_MAX - p_ptrn_lines)
malformed();
if (*s == ' ')
s++;
if (*s != '+' || !*++s)
malformed();
p_newfirst = (LINENUM) atol(s);
while (isdigit((unsigned char)*s))
s++;
p_newfirst = getskiplinenum(&s);
if (*s == ',') {
p_repl_lines = (LINENUM) atol(++s);
while (isdigit((unsigned char)*s))
s++;
s++;
p_repl_lines = getskiplinenum(&s);
} else
p_repl_lines = 1;
if (*s == ' ')
s++;
if (*s != '@')
malformed();
if (p_first >= LINENUM_MAX - p_ptrn_lines ||
p_newfirst > LINENUM_MAX - p_repl_lines ||
p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
malformed();
if (!p_ptrn_lines)
p_first++; /* do append rather than insert */
p_max = p_ptrn_lines + p_repl_lines + 1;
@@ -1022,35 +1050,39 @@ hunk_done:
next_intuit_at(line_beginning, p_input_line);
return false;
}
p_first = (LINENUM) atol(buf);
for (s = buf; isdigit((unsigned char)*s); s++)
;
s = buf;
p_first = getskiplinenum(&s);
if (*s == ',') {
p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1;
while (isdigit((unsigned char)*s))
s++;
s++;
p_ptrn_lines = getskiplinenum(&s) - p_first + 1;
} else
p_ptrn_lines = (*s != 'a');
hunk_type = *s;
if (p_first >= LINENUM_MAX - p_ptrn_lines)
malformed();
hunk_type = *s++;
if (hunk_type == 'a')
p_first++; /* do append rather than insert */
min = (LINENUM) atol(++s);
for (; isdigit((unsigned char)*s); s++)
;
min = getskiplinenum(&s);
if (*s == ',')
max = (LINENUM) atol(++s);
max = getlinenum(++s);
else
max = min;
if (min < 0 || min > max || max - min == LINENUM_MAX)
malformed();
if (hunk_type == 'd')
min++;
p_end = p_ptrn_lines + 1 + max - min + 1;
p_newfirst = min;
p_repl_lines = max - min + 1;
if (p_newfirst > LINENUM_MAX - p_repl_lines ||
p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
malformed();
p_end = p_ptrn_lines + p_repl_lines + 1;
if (p_end > MAXHUNKSIZE)
fatal("hunk too large (%ld lines) at line %ld: %s",
p_end, p_input_line, buf);
while (p_end >= hunkmax)
grow_hunkmax();
p_newfirst = min;
p_repl_lines = max - min + 1;
snprintf(buf, buf_len, "*** %ld,%ld\n", p_first,
p_first + p_ptrn_lines - 1);
p_line[0] = savestr(buf);
@@ -1375,6 +1407,7 @@ do_ed_script(void)
char *t;
long beginning_of_this_line;
FILE *pipefp = NULL;
int continuation;
if (!skip_rest_of_patch) {
if (copy_file(filearg[0], TMPOUTNAME) < 0) {
@@ -1399,7 +1432,19 @@ do_ed_script(void)
*t == 'd' || *t == 'i' || *t == 's')) {
if (pipefp != NULL)
fputs(buf, pipefp);
if (*t != 'd') {
if (*t == 's') {
for (;;) {
continuation = 0;
t = strchr(buf, '\0') - 1;
while (--t >= buf && *t == '\\')
continuation = !continuation;
if (!continuation ||
pgets(buf, sizeof buf, pfp) == NULL)
break;
if (pipefp != NULL)
fputs(buf, pipefp);
}
} else if (*t != 'd') {
while (pgets(buf, buf_len, pfp) != NULL) {
p_input_line++;
if (pipefp != NULL)