Replace the local rname' with the cannonical
basename'.
This commit is contained in:
parent
3c5bf66cec
commit
9ebd5897b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=80285
@ -51,6 +51,7 @@ static const char sccsid[] = "@(#)ar.c 8.3 (Berkeley) 4/2/94";
|
||||
#include <ar.h>
|
||||
#include <dirent.h>
|
||||
#include <err.h>
|
||||
#include <libgen.h>
|
||||
#include <paths.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -178,7 +179,7 @@ main(argc, argv)
|
||||
warnx("no position operand specified");
|
||||
usage();
|
||||
}
|
||||
posname = rname(posarg);
|
||||
posname = basename(posarg);
|
||||
}
|
||||
/* -d only valid with -Tv. */
|
||||
if (options & AR_D && options & ~(AR_D|AR_TR|AR_V))
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)archive.c 8.3 (Berkeley) 4/2/94";
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -46,6 +48,7 @@ static const char sccsid[] = "@(#)archive.c 8.3 (Berkeley) 4/2/94";
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -210,7 +213,7 @@ put_arobj(cfp, sb)
|
||||
* the last header read.
|
||||
*/
|
||||
if (sb) {
|
||||
name = rname(cfp->rname);
|
||||
name = basename(cfp->rname);
|
||||
(void)fstat(cfp->rfd, sb);
|
||||
|
||||
/*
|
||||
|
@ -31,6 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)extern.h 8.3 (Berkeley) 4/2/94
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
int append __P((char **));
|
||||
@ -45,7 +46,6 @@ int move __P((char **));
|
||||
void orphans __P((char **argv));
|
||||
int print __P((char **));
|
||||
int replace __P((char **));
|
||||
char *rname __P((char *));
|
||||
int tmp __P((void));
|
||||
|
||||
extern char *archive;
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#ifndef lint
|
||||
static const char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
|
||||
static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -43,6 +45,7 @@ static const char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
|
||||
#include <dirent.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -113,21 +116,12 @@ orphans(argv)
|
||||
warnx("%s: not found in archive", *argv);
|
||||
}
|
||||
|
||||
char *
|
||||
rname(path)
|
||||
char *path;
|
||||
{
|
||||
char *ind;
|
||||
|
||||
return ((ind = strrchr(path, '/')) ? ind + 1 : path);
|
||||
}
|
||||
|
||||
int
|
||||
compare(dest)
|
||||
char *dest;
|
||||
{
|
||||
int maxname = (options & AR_TR) ? OLDARMAXNAME : MAXNAMLEN;
|
||||
return (!strncmp(chdr.name, rname(dest), maxname));
|
||||
return (!strncmp(chdr.name, basename(dest), maxname));
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user