--- /dev/null
+Description: <short summary of the patch>
+ TODO: Put a short summary on the line above and replace this paragraph
+ with a longer explanation of this change. Complete the meta-information
+ with other relevant fields (see below for details). To make it easier, the
+ information below has been extracted from the changelog. Adjust it or drop
+ it.
+ .
+ pax (1:20090728-3) UNRELEASED; urgency=low
+ .
+ * switch to use of dh
+Author: Bdale Garbee <bdale@gag.com>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: http://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: <YYYY-MM-DD>
+
+--- pax-20090728.orig/pax.c
++++ pax-20090728/pax.c
+@@ -105,7 +105,7 @@ char *dirptr; /* destination dir in a c
+ char *ltmfrmt; /* -v locale time format (if any) */
+ char *argv0; /* root of argv[0] */
+ sigset_t s_mask; /* signal mask for cleanup critical sect */
+-FILE *listf = stderr; /* file pointer to print file list to */
++FILE *listf; /* file pointer to print file list to */
+ char *tempfile; /* tempfile to use for mkstemp(3) */
+ char *tempbase; /* basename of tempfile to use for mkstemp(3) */
+
+@@ -235,6 +235,12 @@ main(int argc, char **argv)
+ char *tmpdir;
+ size_t tdlen;
+
++ /*
++ * On some systems, stderr is not a constant, so we initialize listf
++ * immediately to emulate the behavior.
++ */
++ listf=stderr;
++
+ /*
+ * Keep a reference to cwd, so we can always come back home.
+ */
+--- pax-20090728.orig/ar_subs.c
++++ pax-20090728/ar_subs.c
+@@ -44,6 +44,7 @@ static const char rcsid[] = "$OpenBSD: a
+
+ #include <sys/types.h>
+ #include <sys/time.h>
++#include <time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <signal.h>
+--- pax-20090728.orig/cache.c
++++ pax-20090728/cache.c
+@@ -200,7 +200,11 @@ name_uid(uid_t uid, int frc)
+ * No entry for this uid, we will add it
+ */
+ if (!pwopn) {
++#ifdef DEBIAN
++ setpwent();
++#else
+ setpassent(1);
++#endif
+ ++pwopn;
+ }
+ if (ptr == NULL)
+@@ -266,7 +270,11 @@ name_gid(gid_t gid, int frc)
+ * No entry for this gid, we will add it
+ */
+ if (!gropn) {
++#ifdef DEBIAN
++ setgrent();
++#else
+ setgroupent(1);
++#endif
+ ++gropn;
+ }
+ if (ptr == NULL)
+@@ -333,7 +341,11 @@ uid_name(char *name, uid_t *uid)
+ }
+
+ if (!pwopn) {
++#ifdef DEBIAN
++ setpwent();
++#else
+ setpassent(1);
++#endif
+ ++pwopn;
+ }
+
+@@ -396,7 +408,11 @@ gid_name(char *name, gid_t *gid)
+ }
+
+ if (!gropn) {
++#ifdef DEBIAN
++ setgrent();
++#else
+ setgroupent(1);
++#endif
+ ++gropn;
+ }
+ if (ptr == NULL)
+--- pax-20090728.orig/pax.h
++++ pax-20090728/pax.h
+@@ -242,3 +242,8 @@ typedef struct oplist {
+ #define OCT 8
+ #define _PAX_ 1
+ #define _TFILE_BASE "paxXXXXXXXXXX"
++
++/* hack since we're pulling routines in from OpenBSD library to this dir */
++size_t strlcpy(char *, const char *, size_t);
++char * vis(char *, int, int, int);
++
+--- pax-20090728.orig/sel_subs.c
++++ pax-20090728/sel_subs.c
+@@ -44,6 +44,7 @@ static const char rcsid[] = "$OpenBSD: s
+
+ #include <sys/types.h>
+ #include <sys/time.h>
++#include <time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <ctype.h>
+@@ -52,12 +53,14 @@ static const char rcsid[] = "$OpenBSD: s
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <tzfile.h>
++#include <time.h>
+ #include <unistd.h>
+ #include "pax.h"
+ #include "sel_subs.h"
+ #include "extern.h"
+
++#define TM_YEAR_BASE 1900
++
+ static int str_sec(const char *, time_t *);
+ static int usr_match(ARCHD *);
+ static int grp_match(ARCHD *);
+--- /dev/null
++++ pax-20090728/types.h
+@@ -0,0 +1,169 @@
++/*-
++ * Copyright (c) 1982, 1986, 1991, 1993
++ * The Regents of the University of California. All rights reserved.
++ * (c) UNIX System Laboratories, Inc.
++ * All or some portions of this file are derived from material licensed
++ * to the University of California by American Telephone and Telegraph
++ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
++ * the permission of UNIX System Laboratories, Inc.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)types.h 8.4 (Berkeley) 1/21/94
++ * $Id: types.h,v 1.1 2001-07-23 05:20:01 bdale Exp $
++ */
++
++#ifndef _SYS_TYPES_H_
++#define _SYS_TYPES_H_
++
++#include <sys/cdefs.h>
++
++/* Machine type dependent parameters. */
++#include <machine/endian.h>
++
++#ifndef _POSIX_SOURCE
++typedef unsigned char u_char;
++typedef unsigned short u_short;
++typedef unsigned int u_int;
++typedef unsigned long u_long;
++typedef unsigned short ushort; /* Sys V compatibility */
++typedef unsigned int uint; /* Sys V compatibility */
++#endif
++
++typedef unsigned long long u_quad_t; /* quads */
++typedef long long quad_t;
++typedef quad_t * qaddr_t;
++
++typedef char * caddr_t; /* core address */
++typedef long daddr_t; /* disk address */
++typedef unsigned long dev_t; /* device number */
++typedef unsigned long fixpt_t; /* fixed point number */
++typedef unsigned long gid_t; /* group id */
++typedef unsigned long ino_t; /* inode number */
++typedef unsigned short mode_t; /* permissions */
++typedef unsigned short nlink_t; /* link count */
++typedef quad_t off_t; /* file offset */
++typedef long pid_t; /* process id */
++typedef long segsz_t; /* segment size */
++typedef long swblk_t; /* swap offset */
++typedef unsigned long uid_t; /* user id */
++
++/*
++ * This belongs in unistd.h, but is placed here to ensure that programs
++ * casting the second parameter of lseek to off_t will get the correct
++ * version of lseek.
++ */
++#ifndef KERNEL
++__BEGIN_DECLS
++off_t lseek __P((int, off_t, int));
++__END_DECLS
++#endif
++
++#ifndef _POSIX_SOURCE
++/*
++ * minor() gives a cookie instead of an index since we don't want to
++ * change the meanings of bits 0-15 or waste time and space shifting
++ * bits 16-31 for devices that don't use them.
++ */
++#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
++#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
++#define makedev(x,y) ((dev_t)(((x)<<8) | (y))) /* create dev_t */
++#endif
++
++#include <machine/ansi.h>
++#include <machine/types.h>
++
++#ifdef _BSD_CLOCK_T_
++typedef _BSD_CLOCK_T_ clock_t;
++#undef _BSD_CLOCK_T_
++#endif
++
++#ifdef _BSD_SIZE_T_
++typedef _BSD_SIZE_T_ size_t;
++#undef _BSD_SIZE_T_
++#endif
++
++#ifdef _BSD_SSIZE_T_
++typedef _BSD_SSIZE_T_ ssize_t;
++#undef _BSD_SSIZE_T_
++#endif
++
++#ifdef _BSD_TIME_T_
++typedef _BSD_TIME_T_ time_t;
++#undef _BSD_TIME_T_
++#endif
++
++#ifndef _POSIX_SOURCE
++#define NBBY 8 /* number of bits in a byte */
++
++/*
++ * Select uses bit masks of file descriptors in longs. These macros
++ * manipulate such bit fields (the filesystem macros use chars).
++ * FD_SETSIZE may be defined by the user, but the default here should
++ * be enough for most uses.
++ */
++#ifndef FD_SETSIZE
++#define FD_SETSIZE 256
++#endif
++
++typedef long fd_mask;
++#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
++
++#ifndef howmany
++#define howmany(x, y) (((x)+((y)-1))/(y))
++#endif
++
++typedef struct fd_set {
++ fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
++} fd_set;
++
++#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
++#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
++#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
++#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f)))
++#define FD_ZERO(p) bzero(p, sizeof(*(p)))
++
++#if defined(__STDC__) && defined(KERNEL)
++/*
++ * Forward structure declarations for function prototypes. We include the
++ * common structures that cross subsystem boundaries here; others are mostly
++ * used in the same place that the structure is defined.
++ */
++struct proc;
++struct pgrp;
++struct ucred;
++struct rusage;
++struct file;
++struct buf;
++struct tty;
++struct uio;
++#endif
++
++#endif /* !_POSIX_SOURCE */
++#endif /* !_SYS_TYPES_H_ */
+--- /dev/null
++++ pax-20090728/strmode.h
+@@ -0,0 +1,34 @@
++/*-
++ * Copyright (c) 1990, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++void strmode(mode_t mode, char *p);
+--- pax-20090728.orig/tar.c
++++ pax-20090728/tar.c
+@@ -43,6 +43,7 @@ static const char rcsid[] = "$OpenBSD: t
+ #endif /* not lint */
+
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+@@ -763,6 +764,12 @@ ustar_rd(ARCHD *arcn, char *buf)
+ /*
+ * see if the filename is split into two parts. if, so joint the parts.
+ * we copy the prefix first and add a / between the prefix and name.
++ *
++ * the length passed to l_strncpy must be the length of the field
++ * being copied *from*, since these fields are NOT null terminated
++ * when full. the destination buffer is plenty big enough to hold
++ * the longest supported ustar path length, so there's no need
++ * to check against that.
+ */
+ dest = arcn->name;
+ if (*(hd->prefix) != '\0') {
+@@ -1072,6 +1079,15 @@ ustar_wr(ARCHD *arcn)
+ strncpy(hd->uname, name_uid(arcn->sb.st_uid, 0), sizeof(hd->uname));
+ strncpy(hd->gname, name_gid(arcn->sb.st_gid, 0), sizeof(hd->gname));
+
++ /*
++ * Always add devmajor and devminor
++ */
++ if (ul_oct ((u_long) MAJOR (arcn->sb.st_rdev), hd->devmajor,
++ sizeof (hd->devmajor), 3) ||
++ ul_oct ((u_long) MINOR (arcn->sb.st_rdev), hd->devminor,
++ sizeof (hd->devminor), 3))
++ goto out;
++
+ /*
+ * calculate and store the checksum write the header to the archive
+ * return 0 tells the caller to now write the file data, 1 says no data
+--- /dev/null
++++ pax-20090728/strmode.c
+@@ -0,0 +1,147 @@
++/*-
++ * Copyright (c) 1990, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#if defined(LIBC_SCCS) && !defined(lint)
++static char sccsid[] = "@(#)strmode.c 8.1 (Berkeley) 6/4/93";
++#endif /* LIBC_SCCS and not lint */
++
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <string.h>
++
++void
++strmode(mode, p)
++ register mode_t mode;
++ register char *p;
++{
++ /* print type */
++ switch (mode & S_IFMT) {
++ case S_IFDIR: /* directory */
++ *p++ = 'd';
++ break;
++ case S_IFCHR: /* character special */
++ *p++ = 'c';
++ break;
++ case S_IFBLK: /* block special */
++ *p++ = 'b';
++ break;
++ case S_IFREG: /* regular */
++ *p++ = '-';
++ break;
++ case S_IFLNK: /* symbolic link */
++ *p++ = 'l';
++ break;
++ case S_IFSOCK: /* socket */
++ *p++ = 's';
++ break;
++#ifdef S_IFIFO
++ case S_IFIFO: /* fifo */
++ *p++ = 'p';
++ break;
++#endif
++ default: /* unknown */
++ *p++ = '?';
++ break;
++ }
++ /* usr */
++ if (mode & S_IRUSR)
++ *p++ = 'r';
++ else
++ *p++ = '-';
++ if (mode & S_IWUSR)
++ *p++ = 'w';
++ else
++ *p++ = '-';
++ switch (mode & (S_IXUSR | S_ISUID)) {
++ case 0:
++ *p++ = '-';
++ break;
++ case S_IXUSR:
++ *p++ = 'x';
++ break;
++ case S_ISUID:
++ *p++ = 'S';
++ break;
++ case S_IXUSR | S_ISUID:
++ *p++ = 's';
++ break;
++ }
++ /* group */
++ if (mode & S_IRGRP)
++ *p++ = 'r';
++ else
++ *p++ = '-';
++ if (mode & S_IWGRP)
++ *p++ = 'w';
++ else
++ *p++ = '-';
++ switch (mode & (S_IXGRP | S_ISGID)) {
++ case 0:
++ *p++ = '-';
++ break;
++ case S_IXGRP:
++ *p++ = 'x';
++ break;
++ case S_ISGID:
++ *p++ = 'S';
++ break;
++ case S_IXGRP | S_ISGID:
++ *p++ = 's';
++ break;
++ }
++ /* other */
++ if (mode & S_IROTH)
++ *p++ = 'r';
++ else
++ *p++ = '-';
++ if (mode & S_IWOTH)
++ *p++ = 'w';
++ else
++ *p++ = '-';
++ switch (mode & (S_IXOTH | S_ISVTX)) {
++ case 0:
++ *p++ = '-';
++ break;
++ case S_IXOTH:
++ *p++ = 'x';
++ break;
++ case S_ISVTX:
++ *p++ = 'T';
++ break;
++ case S_IXOTH | S_ISVTX:
++ *p++ = 't';
++ break;
++ }
++ *p++ = ' '; /* will be a '+' if ACL's implemented */
++ *p = '\0';
++}
+--- pax-20090728.orig/Makefile
++++ pax-20090728/Makefile
+@@ -14,8 +14,25 @@
+ PROG= pax
+ SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c\
+ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\
+- tar.c tty_subs.c
+-MAN= pax.1 tar.1 cpio.1
+-LINKS= ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio
++ tar.c tty_subs.c fgetln.c strmode.c strlcpy.c vis.c
++OBJS= $(SRCS:.c=.o)
++MAN= pax.1
+
+-.include <bsd.prog.mk>
++CFLAGS= -Wall -O2 -g -DLONG_OFF_T\
++ -DNET2_STAT -D_PATH_DEFTAPE=\"/dev/rmt0\" -DDEBIAN -D_GNU_SOURCE
++
++prefix=/usr
++
++pax: $(OBJS)
++ $(CC) $(CFLAGS) $(OBJS) -o $@ $(LIBS)
++
++clean:
++ $(RM) *.o
++
++realclean: clean
++ $(RM) $(PROG)
++
++install:
++ install -d -m 755 $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/share/man/man1
++ install -s -m 755 $(PROG) $(DESTDIR)$(prefix)/bin
++ install -m 644 $(MAN) $(DESTDIR)$(prefix)/share/man/man1
+--- /dev/null
++++ pax-20090728/strlcpy.c
+@@ -0,0 +1,51 @@
++/* $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ */
++
++/*
++ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <sys/types.h>
++#include <string.h>
++
++/*
++ * Copy src to string dst of size siz. At most siz-1 characters
++ * will be copied. Always NUL terminates (unless siz == 0).
++ * Returns strlen(src); if retval >= siz, truncation occurred.
++ */
++size_t
++strlcpy(char *dst, const char *src, size_t siz)
++{
++ char *d = dst;
++ const char *s = src;
++ size_t n = siz;
++
++ /* Copy as many bytes as will fit */
++ if (n != 0) {
++ while (--n != 0) {
++ if ((*d++ = *s++) == '\0')
++ break;
++ }
++ }
++
++ /* Not enough room in dst, add NUL and traverse rest of src */
++ if (n == 0) {
++ if (siz != 0)
++ *d = '\0'; /* NUL-terminate dst */
++ while (*s++)
++ ;
++ }
++
++ return(s - src - 1); /* count does not include NUL */
++}
+--- pax-20090728.orig/ar_io.c
++++ pax-20090728/ar_io.c
+@@ -1248,8 +1248,9 @@ ar_next(void)
+
+ /*
+ * ar_start_gzip()
+- * starts the gzip compression/decompression process as a child, using magic
+- * to keep the fd the same in the calling function (parent).
++ * starts the compress, gzip or bzip2 compression/decompression process
++ * as a child, using magic to keep the fd the same in the calling function
++ * (parent).
+ */
+ void
+ ar_start_gzip(int fd, const char *gzip_program, int wr)
+--- /dev/null
++++ pax-20090728/Makefile.bsd
+@@ -0,0 +1,34 @@
++# $OpenBSD: Makefile,v 1.9 1997/09/21 11:35:28 deraadt Exp $
++
++# To install on versions prior to BSD 4.4 the following may have to be
++# defined with CFLAGS +=
++#
++# -DNET2_STAT Use NET2 or older stat structure. The version of the
++# stat structure is easily determined by looking at the
++# basic type of an off_t (often defined in the file:
++# /usr/include/sys/types.h). If off_t is a long (and is
++# NOT A quad) then you must define NET2_STAT.
++# This define is important, as if you do have a quad_t
++# off_t and define NET2_STAT, pax will compile but will
++# NOT RUN PROPERLY.
++#
++# -DNET2_FTS Use the older NET2 fts. To identify the version,
++# examine the file: /usr/include/fts.h. If FTS_COMFOLLOW
++# is not defined then you must define NET2_FTS.
++# Pax may not compile if this not (un)defined properly.
++#
++# -DNET2_REGEX Use the older regexp.h not regex.h. The regex version
++# is determined by looking at the value returned by
++# regexec() (man 3 regexec). If regexec return a 1 for
++# success (and NOT a 0 for success) you have the older
++# regex routines and must define NET2_REGEX.
++# Pax may not compile if this not (un)defined properly.
++
++PROG= pax
++SRCS= ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c\
++ gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c tables.c\
++ tar.c tty_subs.c
++MAN= pax.1 tar.1 cpio.1
++LINKS= ${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio
++
++.include <bsd.prog.mk>
+--- /dev/null
++++ pax-20090728/vis.c
+@@ -0,0 +1,219 @@
++/* $OpenBSD: vis.c,v 1.19 2005/09/01 17:15:49 millert Exp $ */
++/*-
++ * Copyright (c) 1989, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++#include <sys/types.h>
++#include <limits.h>
++#include <ctype.h>
++#include <string.h>
++#include "vis.h"
++
++#define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7')
++#define isvisible(c) \
++ (((u_int)(c) <= UCHAR_MAX && isascii((u_char)(c)) && \
++ (((c) != '*' && (c) != '?' && (c) != '[' && (c) != '#') || \
++ (flag & VIS_GLOB) == 0) && isgraph((u_char)(c))) || \
++ ((flag & VIS_SP) == 0 && (c) == ' ') || \
++ ((flag & VIS_TAB) == 0 && (c) == '\t') || \
++ ((flag & VIS_NL) == 0 && (c) == '\n') || \
++ ((flag & VIS_SAFE) && ((c) == '\b' || \
++ (c) == '\007' || (c) == '\r' || \
++ isgraph((u_char)(c)))))
++
++/*
++ * vis - visually encode characters
++ */
++char *
++vis(char *dst, int c, int flag, int nextc)
++{
++ if (isvisible(c)) {
++ *dst++ = c;
++ if (c == '\\' && (flag & VIS_NOSLASH) == 0)
++ *dst++ = '\\';
++ *dst = '\0';
++ return (dst);
++ }
++
++ if (flag & VIS_CSTYLE) {
++ switch(c) {
++ case '\n':
++ *dst++ = '\\';
++ *dst++ = 'n';
++ goto done;
++ case '\r':
++ *dst++ = '\\';
++ *dst++ = 'r';
++ goto done;
++ case '\b':
++ *dst++ = '\\';
++ *dst++ = 'b';
++ goto done;
++ case '\a':
++ *dst++ = '\\';
++ *dst++ = 'a';
++ goto done;
++ case '\v':
++ *dst++ = '\\';
++ *dst++ = 'v';
++ goto done;
++ case '\t':
++ *dst++ = '\\';
++ *dst++ = 't';
++ goto done;
++ case '\f':
++ *dst++ = '\\';
++ *dst++ = 'f';
++ goto done;
++ case ' ':
++ *dst++ = '\\';
++ *dst++ = 's';
++ goto done;
++ case '\0':
++ *dst++ = '\\';
++ *dst++ = '0';
++ if (isoctal(nextc)) {
++ *dst++ = '0';
++ *dst++ = '0';
++ }
++ goto done;
++ }
++ }
++ if (((c & 0177) == ' ') || (flag & VIS_OCTAL) ||
++ ((flag & VIS_GLOB) && (c == '*' || c == '?' || c == '[' || c == '#'))) {
++ *dst++ = '\\';
++ *dst++ = ((u_char)c >> 6 & 07) + '0';
++ *dst++ = ((u_char)c >> 3 & 07) + '0';
++ *dst++ = ((u_char)c & 07) + '0';
++ goto done;
++ }
++ if ((flag & VIS_NOSLASH) == 0)
++ *dst++ = '\\';
++ if (c & 0200) {
++ c &= 0177;
++ *dst++ = 'M';
++ }
++ if (iscntrl((u_char)c)) {
++ *dst++ = '^';
++ if (c == 0177)
++ *dst++ = '?';
++ else
++ *dst++ = c + '@';
++ } else {
++ *dst++ = '-';
++ *dst++ = c;
++ }
++done:
++ *dst = '\0';
++ return (dst);
++}
++
++/*
++ * strvis, strnvis, strvisx - visually encode characters from src into dst
++ *
++ * Dst must be 4 times the size of src to account for possible
++ * expansion. The length of dst, not including the trailing NULL,
++ * is returned.
++ *
++ * Strnvis will write no more than siz-1 bytes (and will NULL terminate).
++ * The number of bytes needed to fully encode the string is returned.
++ *
++ * Strvisx encodes exactly len bytes from src into dst.
++ * This is useful for encoding a block of data.
++ */
++int
++strvis(char *dst, const char *src, int flag)
++{
++ char c;
++ char *start;
++
++ for (start = dst; (c = *src);)
++ dst = vis(dst, c, flag, *++src);
++ *dst = '\0';
++ return (dst - start);
++}
++
++int
++strnvis(char *dst, const char *src, size_t siz, int flag)
++{
++ char *start, *end;
++ char tbuf[5];
++ int c, i;
++
++ i = 0;
++ for (start = dst, end = start + siz - 1; (c = *src) && dst < end; ) {
++ if (isvisible(c)) {
++ i = 1;
++ *dst++ = c;
++ if (c == '\\' && (flag & VIS_NOSLASH) == 0) {
++ /* need space for the extra '\\' */
++ if (dst < end)
++ *dst++ = '\\';
++ else {
++ dst--;
++ i = 2;
++ break;
++ }
++ }
++ src++;
++ } else {
++ i = vis(tbuf, c, flag, *++src) - tbuf;
++ if (dst + i <= end) {
++ memcpy(dst, tbuf, i);
++ dst += i;
++ } else {
++ src--;
++ break;
++ }
++ }
++ }
++ if (siz > 0)
++ *dst = '\0';
++ if (dst + i > end) {
++ /* adjust return value for truncation */
++ while ((c = *src))
++ dst += vis(tbuf, c, flag, *++src) - tbuf;
++ }
++ return (dst - start);
++}
++
++int
++strvisx(char *dst, const char *src, size_t len, int flag)
++{
++ char c;
++ char *start;
++
++ for (start = dst; len > 1; len--) {
++ c = *src;
++ dst = vis(dst, c, flag, *++src);
++ }
++ if (len)
++ dst = vis(dst, *src, flag, '\0');
++ *dst = '\0';
++ return (dst - start);
++}
+--- pax-20090728.orig/gen_subs.c
++++ pax-20090728/gen_subs.c
+@@ -43,19 +43,23 @@ static const char rcsid[] = "$OpenBSD: g
+ #endif /* not lint */
+
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <sys/time.h>
++#include <time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+ #include <stdio.h>
+-#include <tzfile.h>
++#include "tzfile.h"
+ #include <utmp.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <vis.h>
++#include "vis.h"
+ #include "pax.h"
+ #include "extern.h"
+
++#include "strmode.h"
++
+ /*
+ * a collection of general purpose subroutines used by pax
+ */
+@@ -65,6 +69,9 @@ static const char rcsid[] = "$OpenBSD: g
+ */
+ #define MODELEN 20
+ #define DATELEN 64
++#define DAYSPERNYEAR 365
++/* #define SECSPERDAY 86400 */
++/* #define VIS_CSTYLE 0 */
+ #define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
+ #define CURFRMT "%b %e %H:%M"
+ #define OLDFRMT "%b %e %Y"
+@@ -205,7 +212,7 @@ safe_print(const char *str, FILE *fp)
+ /*
+ * if printing to a tty, use vis(3) to print special characters.
+ */
+- if (isatty(fileno(fp))) {
++ if (0 && isatty(fileno(fp))) {
+ for (cp = str; *cp; cp++) {
+ (void)vis(visbuf, cp[0], VIS_CSTYLE, cp[1]);
+ (void)fputs(visbuf, fp);
+--- pax-20090728.orig/pax.1
++++ pax-20090728/pax.1
+@@ -1143,7 +1143,7 @@ completes it will exit with a non-zero e
+ The
+ .Nm
+ utility is compliant with the
+-.St -p1003.1-2008
++POSIX 1003.1-2008
+ specification.
+ .Pp
+ The flags
+--- /dev/null
++++ pax-20090728/fgetln.c
+@@ -0,0 +1,134 @@
++/* fgetline: Read one line of input and return a pointer to
++ that line. Necessary space is obtained from malloc.
++ (char *) NULL is returned on EOF.
++
++ Andy Dougherty doughera@lafcol.lafayette.edu
++ Dept. of Physics
++ Lafayette College, Easton PA 18042
++
++ Successive calls to fgetline() overwrite the original buffer.
++ If you want to preserve the data, you must do something like
++ the following (the +1's are for '\0' characters):
++
++ tmp = fgetline(fp);
++ ntmp = Ealloc(strlen(tmp)+1, sizeof(char));
++ strncpy(ntmp, tmp, strlen(tmp)+1);
++
++ A line is defined as all characters up to (and including) the next
++ newline character or end of file.
++ The string is terminated by a NULL character.
++
++ * Version 1.1 A. Dougherty 2/7/94
++ Don't call realloc() just to save a few bytes.
++ Check return value from realloc(). (NULL is allowed under POSIX,
++ though I've never hit it.)
++
++ * Version 1.0 A. Dougherty 2/27/91
++
++ This fgetline implementation was written by Andrew Dougherty
++ <doughera@lafayette.edu>. I hearby place it in the public domain.
++ As a courtesy, please leave my name attached to the source.
++
++ This code comes with no warranty whatsoever, and I take no
++ responsibility for any consequences of its use.
++*/
++
++/* Algorithm: A local static buffer "buf" is maintained. The current
++ length (space available) is in the static variable "avail".
++ Read in characters into this buffer. If need more space, call
++ malloc().
++
++ Aside: We have computed strlen(buf) in this function. It
++ seems a shame to throw it away.
++*/
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/types.h>
++
++#define LINELEN 128 /* A decent guess that should only rarely be
++ overwritten.
++ */
++#define OK_TO_WASTE 512 /* Don't bother trying to realloc() back to
++ a smaller buffer if you'd only end up
++ wasting OK_TO_WASTE bytes.
++ */
++
++void *Emalloc(size_t len) /* David */
++{
++ char *p;
++
++ p=malloc(len);
++ if (p == NULL) {
++ perror("out of memory (Emalloc)");
++ exit(2);
++
++ }
++ return p;
++}
++
++void *Erealloc(char *p, size_t len) /* David */
++{
++ p=realloc(p, len);
++ if (p == NULL) {
++ perror("out of memory (Erealloc)");
++ exit(2);
++
++ }
++ return p;
++}
++
++char *
++fgetln(FILE *fp, size_t *length)
++ {
++ static char *buf = NULL;
++ static size_t avail = 0;
++ int c;
++ char *p; /* Temporary used for reducing length. */
++ int len;
++
++ if (avail == 0)
++ {
++ buf = (char *) Emalloc(LINELEN * sizeof(char));
++ avail = LINELEN;
++ }
++
++ len = 0; /* Current length */
++
++ while ((c=getc(fp)) != EOF)
++ {
++ if (len >= avail) /* Need to ask for space */
++ {
++ avail += LINELEN; /* Maybe avail *= 2 would be better */
++ buf = (char *) Erealloc((void *) buf, avail * sizeof(char));
++ }
++ buf[len] = c;
++ len++;
++ if (c == '\n')
++ break;
++ }
++
++ if (c == EOF && len == 0)
++ return (char *) NULL;
++
++ /* Add terminating '\0' character */
++ if (len >= avail) /* Need 1 more space */
++ buf = (char *) Erealloc((void *) buf, (len+1) * sizeof(char));
++ buf[len] = '\0';
++
++ /* Should we bother to try reclaiming memory? (Otherwise, this
++ function will hold onto enough memory to hold the longest
++ line for the entire duration of the program.)
++ */
++ if (avail - len > OK_TO_WASTE)
++ {
++ p = (char *) Erealloc((void *) buf, (len+1) * sizeof(char));
++ if (p != NULL)
++ {
++ buf = p;
++ avail = len + 1;
++ }
++ }
++ *length=len-1;
++ return buf;
++ }
+--- pax-20090728.orig/cpio.c
++++ pax-20090728/cpio.c
+@@ -43,6 +43,7 @@ static const char rcsid[] = "$OpenBSD: c
+ #endif /* not lint */
+
+ #include <sys/types.h>
++#include <sys/sysmacros.h>
+ #include <sys/time.h>
+ #include <sys/stat.h>
+ #include <sys/param.h>
+--- /dev/null
++++ pax-20090728/tzfile.h
+@@ -0,0 +1,158 @@
++/*
++ * Ported to Linux's Second Extended File System as part of the
++ * dump and restore backup suit
++ * Remy Card <Remy.Card@freenix.fr>, 1994, 1995
++ *
++ */
++
++/*
++ * Copyright (c) 1988, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * This code is derived from software contributed to Berkeley by
++ * Arthur David Olson of the National Cancer Institute.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. All advertising materials mentioning features or use of this software
++ * must display the following acknowledgement:
++ * This product includes software developed by the University of
++ * California, Berkeley and its contributors.
++ * 4. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)tzfile.h 8.1 (Berkeley) 6/2/93
++ */
++
++#ifndef _TZFILE_H_
++#define _TZFILE_H_
++
++/*
++ * Information about time zone files.
++ */
++ /* Time zone object file directory */
++#define TZDIR "/usr/share/zoneinfo"
++#define TZDEFAULT "/etc/localtime"
++#define TZDEFRULES "posixrules"
++
++/*
++** Each file begins with. . .
++*/
++
++struct tzhead {
++ char tzh_reserved[24]; /* reserved for future use */
++ char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
++ char tzh_leapcnt[4]; /* coded number of leap seconds */
++ char tzh_timecnt[4]; /* coded number of transition times */
++ char tzh_typecnt[4]; /* coded number of local time types */
++ char tzh_charcnt[4]; /* coded number of abbr. chars */
++};
++
++/*
++** . . .followed by. . .
++**
++** tzh_timecnt (char [4])s coded transition times a la time(2)
++** tzh_timecnt (unsigned char)s types of local time starting at above
++** tzh_typecnt repetitions of
++** one (char [4]) coded GMT offset in seconds
++** one (unsigned char) used to set tm_isdst
++** one (unsigned char) that's an abbreviation list index
++** tzh_charcnt (char)s '\0'-terminated zone abbreviations
++** tzh_leapcnt repetitions of
++** one (char [4]) coded leap second transition times
++** one (char [4]) total correction after above
++** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
++** time is standard time, if FALSE,
++** transition time is wall clock time
++** if absent, transition times are
++** assumed to be wall clock time
++*/
++
++/*
++** In the current implementation, "tzset()" refuses to deal with files that
++** exceed any of the limits below.
++*/
++
++/*
++** The TZ_MAX_TIMES value below is enough to handle a bit more than a
++** year's worth of solar time (corrected daily to the nearest second) or
++** 138 years of Pacific Presidential Election time
++** (where there are three time zone transitions every fourth year).
++*/
++#define TZ_MAX_TIMES 370
++
++#define NOSOLAR /* 4BSD doesn't currently handle solar time */
++
++#ifndef NOSOLAR
++#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
++#else
++#define TZ_MAX_TYPES 10 /* Maximum number of local time types */
++#endif
++
++#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
++
++#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
++
++#define SECSPERMIN 60
++#define MINSPERHOUR 60
++#define HOURSPERDAY 24
++#define DAYSPERWEEK 7
++#define DAYSPERNYEAR 365
++#define DAYSPERLYEAR 366
++#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
++#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
++#define MONSPERYEAR 12
++
++#define TM_SUNDAY 0
++#define TM_MONDAY 1
++#define TM_TUESDAY 2
++#define TM_WEDNESDAY 3
++#define TM_THURSDAY 4
++#define TM_FRIDAY 5
++#define TM_SATURDAY 6
++
++#define TM_JANUARY 0
++#define TM_FEBRUARY 1
++#define TM_MARCH 2
++#define TM_APRIL 3
++#define TM_MAY 4
++#define TM_JUNE 5
++#define TM_JULY 6
++#define TM_AUGUST 7
++#define TM_SEPTEMBER 8
++#define TM_OCTOBER 9
++#define TM_NOVEMBER 10
++#define TM_DECEMBER 11
++
++#define TM_YEAR_BASE 1900
++
++#define EPOCH_YEAR 1970
++#define EPOCH_WDAY TM_THURSDAY
++
++/*
++** Accurate only for the past couple of centuries;
++** that will probably do.
++*/
++
++#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0)
++
++#endif /* !_TZFILE_H_ */
+--- /dev/null
++++ pax-20090728/vis.h
+@@ -0,0 +1,90 @@
++/* $OpenBSD: vis.h,v 1.11 2005/08/09 19:38:31 millert Exp $ */
++/* $NetBSD: vis.h,v 1.4 1994/10/26 00:56:41 cgd Exp $ */
++
++/*-
++ * Copyright (c) 1990 The Regents of the University of California.
++ * All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ *
++ * @(#)vis.h 5.9 (Berkeley) 4/3/91
++ */
++
++#ifndef _VIS_H_
++#define _VIS_H_
++
++/*
++ * to select alternate encoding format
++ */
++#define VIS_OCTAL 0x01 /* use octal \ddd format */
++#define VIS_CSTYLE 0x02 /* use \[nrft0..] where appropriate */
++
++/*
++ * to alter set of characters encoded (default is to encode all
++ * non-graphic except space, tab, and newline).
++ */
++#define VIS_SP 0x04 /* also encode space */
++#define VIS_TAB 0x08 /* also encode tab */
++#define VIS_NL 0x10 /* also encode newline */
++#define VIS_WHITE (VIS_SP | VIS_TAB | VIS_NL)
++#define VIS_SAFE 0x20 /* only encode "unsafe" characters */
++
++/*
++ * other
++ */
++#define VIS_NOSLASH 0x40 /* inhibit printing '\' */
++#define VIS_GLOB 0x100 /* encode glob(3) magics and '#' */
++
++/*
++ * unvis return codes
++ */
++#define UNVIS_VALID 1 /* character valid */
++#define UNVIS_VALIDPUSH 2 /* character valid, push back passed char */
++#define UNVIS_NOCHAR 3 /* valid sequence, no character produced */
++#define UNVIS_SYNBAD -1 /* unrecognized escape sequence */
++#define UNVIS_ERROR -2 /* decoder in unknown state (unrecoverable) */
++
++/*
++ * unvis flags
++ */
++#define UNVIS_END 1 /* no more characters */
++
++#include <sys/cdefs.h>
++
++__BEGIN_DECLS
++char *vis(char *, int, int, int);
++int strvis(char *, const char *, int);
++int strnvis(char *, const char *, size_t, int)
++ __attribute__ ((__bounded__(__string__,1,3)));
++int strvisx(char *, const char *, size_t, int)
++ __attribute__ ((__bounded__(__string__,1,3)));
++int strunvis(char *, const char *);
++int unvis(char *, char, int *, int);
++ssize_t strnunvis(char *, const char *, size_t)
++ __attribute__ ((__bounded__(__string__,1,3)));
++
++__END_DECLS
++
++#endif /* !_VIS_H_ */
+--- /dev/null
++++ pax-20090728/fgetln.h
+@@ -0,0 +1,17 @@
++/* fgetline: Read one line of input and return a pointer to
++ that line. Necessary space is obtained from malloc.
++ (char *) NULL is returned on EOF.
++
++ Andy Dougherty doughera@lafcol.lafayette.edu
++ Dept. of Physics
++ Lafayette College, Easton PA 18042
++
++ This fgetline implementation was written by Andrew Dougherty
++ <doughera@lafayette.edu>. I hearby place it in the public domain.
++ As a courtesy, please leave my name attached to the source.
++
++ This code comes with no warranty whatsoever, and I take no
++ responsibility for any consequences of its use.
++*/
++
++char *fgetln(FILE *fp, size_t *length);
+--- pax-20090728.orig/options.c
++++ pax-20090728/options.c
+@@ -60,6 +60,8 @@ static const char rcsid[] = "$OpenBSD: o
+ #include "tar.h"
+ #include "extern.h"
+
++#include "fgetln.h" /* added, David */
++
+ /*
+ * Routines which handle command line options
+ */
+@@ -72,7 +74,7 @@ static int no_op(void);
+ static void printflg(unsigned int);
+ static int c_frmt(const void *, const void *);
+ static off_t str_offt(char *);
+-static char *getline(FILE *fp);
++static char *bsd_getline(FILE *fp);
+ static void pax_options(int, char **);
+ static void pax_usage(void);
+ static void tar_options(int, char **);
+@@ -882,7 +884,7 @@ tar_options(int argc, char **argv)
+ paxwarn(1, "Unable to open file '%s' for read", file);
+ tar_usage();
+ }
+- while ((str = getline(fp)) != NULL) {
++ while ((str = bsd_getline(fp)) != NULL) {
+ if (pat_add(str, dir) < 0)
+ tar_usage();
+ sawpat = 1;
+@@ -961,7 +963,7 @@ tar_options(int argc, char **argv)
+ paxwarn(1, "Unable to open file '%s' for read", file);
+ tar_usage();
+ }
+- while ((str = getline(fp)) != NULL) {
++ while ((str = bsd_getline(fp)) != NULL) {
+ if (ftree_add(str, 0) < 0)
+ tar_usage();
+ }
+@@ -1183,7 +1185,7 @@ cpio_options(int argc, char **argv)
+ paxwarn(1, "Unable to open file '%s' for read", optarg);
+ cpio_usage();
+ }
+- while ((str = getline(fp)) != NULL) {
++ while ((str = bsd_getline(fp)) != NULL) {
+ pat_add(str, NULL);
+ }
+ fclose(fp);
+@@ -1282,7 +1284,7 @@ cpio_options(int argc, char **argv)
+ * no read errors allowed on updates/append operation!
+ */
+ maxflt = 0;
+- while ((str = getline(stdin)) != NULL) {
++ while ((str = bsd_getline(stdin)) != NULL) {
+ ftree_add(str, 0);
+ }
+ if (getline_error) {
+@@ -1459,7 +1461,7 @@ str_offt(char *val)
+ if ((num == LONG_MAX) || (num <= 0) || (expr == val))
+ # else
+ num = strtoq(val, &expr, 0);
+- if ((num == QUAD_MAX) || (num <= 0) || (expr == val))
++ if ((num == LLONG_MAX) || (num <= 0) || (expr == val))
+ # endif
+ return(0);
+
+@@ -1511,7 +1513,7 @@ str_offt(char *val)
+ }
+
+ char *
+-getline(FILE *f)
++bsd_getline(FILE *f)
+ {
+ char *name, *temp;
+ size_t len;