| 34 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
| 35 |
*/ |
*/ |
| 36 |
|
|
| 37 |
#ifndef lint |
#include <sys/param.h> |
|
#if 0 |
|
|
static const char sccsid[] = "@(#)pat_rep.c 8.2 (Berkeley) 4/18/94"; |
|
|
#else |
|
|
static const char rcsid[] = "$OpenBSD: pat_rep.c,v 1.30 2005/08/05 08:30:10 djm Exp $"; |
|
|
#endif |
|
|
#endif /* not lint */ |
|
|
|
|
|
#include <sys/types.h> |
|
| 38 |
#include <sys/time.h> |
#include <sys/time.h> |
| 39 |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
#include <sys/param.h> |
|
| 40 |
#include <stdio.h> |
#include <stdio.h> |
| 41 |
#include <string.h> |
#include <string.h> |
| 42 |
#include <unistd.h> |
#include <unistd.h> |
| 47 |
#include "pat_rep.h" |
#include "pat_rep.h" |
| 48 |
#include "extern.h" |
#include "extern.h" |
| 49 |
|
|
| 50 |
|
__SCCSID("@(#)pat_rep.c 8.2 (Berkeley) 4/18/94"); |
| 51 |
|
__RCSID("$MirOS: src/bin/pax/pat_rep.c,v 1.2 2007/02/17 04:52:41 tg Exp $"); |
| 52 |
|
|
| 53 |
/* |
/* |
| 54 |
* routines to handle pattern matching, name modification (regular expression |
* routines to handle pattern matching, name modification (regular expression |
| 55 |
* substitution and interactive renames), and destination name modification for |
* substitution and interactive renames), and destination name modification for |
| 211 |
*/ |
*/ |
| 212 |
|
|
| 213 |
int |
int |
| 214 |
pat_add(char *str, char *chdname) |
pat_add(char *str, char *chd_name) |
| 215 |
{ |
{ |
| 216 |
PATTERN *pt; |
PATTERN *pt; |
| 217 |
|
|
| 238 |
pt->plen = strlen(str); |
pt->plen = strlen(str); |
| 239 |
pt->fow = NULL; |
pt->fow = NULL; |
| 240 |
pt->flgs = 0; |
pt->flgs = 0; |
| 241 |
pt->chdname = chdname; |
pt->chdname = chd_name; |
| 242 |
|
|
| 243 |
if (pathead == NULL) { |
if (pathead == NULL) { |
| 244 |
pattail = pathead = pt; |
pattail = pathead = pt; |
| 744 |
tty_prnt("Processing continues, name changed to: %s\n", tmpname); |
tty_prnt("Processing continues, name changed to: %s\n", tmpname); |
| 745 |
res = add_name(arcn->name, arcn->nlen, tmpname); |
res = add_name(arcn->name, arcn->nlen, tmpname); |
| 746 |
arcn->nlen = strlcpy(arcn->name, tmpname, sizeof(arcn->name)); |
arcn->nlen = strlcpy(arcn->name, tmpname, sizeof(arcn->name)); |
| 747 |
if (arcn->nlen >= sizeof(arcn->name)) |
if ((size_t)arcn->nlen >= sizeof(arcn->name)) |
| 748 |
arcn->nlen = sizeof(arcn->name) - 1; /* XXX truncate? */ |
arcn->nlen = sizeof(arcn->name) - 1; /* XXX truncate? */ |
| 749 |
if (res < 0) |
if (res < 0) |
| 750 |
return(-1); |
return(-1); |