diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-10-27 06:45:15 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-10-27 06:45:15 +0000 |
commit | 945a3c5542ffa9426aacc8b7c4bf60fc8887616a (patch) | |
tree | a17c13ac6184acf715099794d24773de62f81dce /bin/pax/pat_rep.c | |
parent | 66e78bfe7e60a01de232231c5f38914d3d630f6e (diff) |
Initial cut -C support in paxtar. Exceeds GNU tar by quite a bit.
General pax still seems to work ok.
Diffstat (limited to 'bin/pax/pat_rep.c')
-rw-r--r-- | bin/pax/pat_rep.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bin/pax/pat_rep.c b/bin/pax/pat_rep.c index e961b10da28..d4755558738 100644 --- a/bin/pax/pat_rep.c +++ b/bin/pax/pat_rep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pat_rep.c,v 1.4 1996/08/27 03:53:16 tholo Exp $ */ +/* $OpenBSD: pat_rep.c,v 1.5 1996/10/27 06:45:12 downsj Exp $ */ /* $NetBSD: pat_rep.c,v 1.4 1995/03/21 09:07:33 cgd Exp $ */ /*- @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94"; #else -static char rcsid[] = "$OpenBSD: pat_rep.c,v 1.4 1996/08/27 03:53:16 tholo Exp $"; +static char rcsid[] = "$OpenBSD: pat_rep.c,v 1.5 1996/10/27 06:45:12 downsj Exp $"; #endif #endif /* not lint */ @@ -54,6 +54,7 @@ static char rcsid[] = "$OpenBSD: pat_rep.c,v 1.4 1996/08/27 03:53:16 tholo Exp $ #include <string.h> #include <unistd.h> #include <stdlib.h> +#include <errno.h> #ifdef NET2_REGEX #include <regexp.h> #else @@ -233,11 +234,12 @@ rep_add(str) #if __STDC__ int -pat_add(char *str) +pat_add(char *str, char *chdnam) #else int -pat_add(str) +pat_add(str, chdnam) char *str; + char *chdnam; #endif { register PATTERN *pt; @@ -265,6 +267,15 @@ pat_add(str) pt->plen = strlen(str); pt->fow = NULL; pt->flgs = 0; + if (chdnam != (char *)NULL) { + pt->chdnam = strdup(chdnam); + if (pt->chdnam == (char *)NULL) { + paxwarn(1, + "Unable to allocate memory for pattern string"); + return(-1); + } + } else + pt->chdnam = (char *)NULL; if (pathead == NULL) { pattail = pathead = pt; return(0); @@ -430,6 +441,8 @@ pat_sel(arcn) return(-1); } *ppt = pt->fow; + if (pt->chdnam != (char *)NULL) + (void)free(pt->chdnam); (void)free((char *)pt); arcn->pat = NULL; return(0); |