mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 10:29:15 +00:00
Allow creation of absolute package names
typo index() --> rindex() in order to split correct suffix Fix @srcdir so it actually works Submitted by: adam
This commit is contained in:
parent
d007e3fbbb
commit
d70574cd96
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2389
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static const char *rcsid = "$Id: perform.c,v 1.8 1994/05/19 18:27:41 alm Exp $";
|
||||
static const char *rcsid = "$Id: perform.c,v 1.9 1994/05/25 06:24:41 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -55,7 +55,7 @@ pkg_perform(char **pkgs)
|
||||
plist.head = plist.tail = NULL;
|
||||
|
||||
/* Break the package name into base and desired suffix (if any) */
|
||||
if ((cp = index(pkg, '.')) != NULL) {
|
||||
if ((cp = rindex(pkg, '.')) != NULL) {
|
||||
suffix = cp + 1;
|
||||
*cp = '\0';
|
||||
}
|
||||
@ -142,7 +142,10 @@ make_dist(char *home, char *pkg, char *suffix, Package *plist)
|
||||
int ret;
|
||||
|
||||
args[0] = '\0';
|
||||
sprintf(tball, "%s/%s.%s", home, pkg, suffix);
|
||||
if (*pkg == '/')
|
||||
sprintf(tball, "%s.%s", pkg, suffix);
|
||||
else
|
||||
sprintf(tball, "%s/%s.%s", home, pkg, suffix);
|
||||
if (index(suffix, 'z')) /* Compress/gzip? */
|
||||
strcat(args, "z");
|
||||
if (Dereference)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static const char *rcsid = "$Id: pl.c,v 1.2 1993/09/03 23:00:57 jkh Exp $";
|
||||
static const char *rcsid = "$Id: pl.c,v 1.3 1994/08/28 14:15:23 jkh Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -40,6 +40,7 @@ check_list(char *home, Package *pkg)
|
||||
char cmd[FILENAME_MAX];
|
||||
char name[FILENAME_MAX];
|
||||
char *where = home;
|
||||
char *there = NULL;
|
||||
PackingList p = pkg->head;
|
||||
|
||||
while (p) {
|
||||
@ -47,11 +48,12 @@ check_list(char *home, Package *pkg)
|
||||
where = p->name;
|
||||
else if (p->type == PLIST_IGNORE)
|
||||
p = p->next;
|
||||
else if (p->type == PLIST_SRC)
|
||||
where = p->name;
|
||||
else if (p->type == PLIST_SRC) {
|
||||
there = p->name;
|
||||
}
|
||||
else if (p->type == PLIST_FILE) {
|
||||
cmd[0] = '\0';
|
||||
sprintf(name, "%s/%s", where, p->name);
|
||||
sprintf(name, "%s/%s", there ? there : where, p->name);
|
||||
/* gzip? */
|
||||
if ((suffix(name, "gz") || suffix(name, "z")) &&
|
||||
y_or_n(TRUE, QUERY_GZIP, name))
|
||||
@ -82,12 +84,13 @@ copy_plist(char *home, Package *plist)
|
||||
{
|
||||
PackingList p = plist->head;
|
||||
char *where = home;
|
||||
char *there = NULL;
|
||||
|
||||
while (p) {
|
||||
if (p->type == PLIST_CWD)
|
||||
where = p->name;
|
||||
else if (p->type == PLIST_SRC)
|
||||
where = p->name;
|
||||
there = p->name;
|
||||
else if (p->type == PLIST_IGNORE)
|
||||
p = p->next;
|
||||
else if (p->type == PLIST_FILE && !p->marked) {
|
||||
@ -101,7 +104,7 @@ copy_plist(char *home, Package *plist)
|
||||
* Otherwise, try along the actual extraction path..
|
||||
*/
|
||||
else
|
||||
copy_hierarchy(where, p->name, FALSE);
|
||||
copy_hierarchy(there ? there : where, p->name, FALSE);
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user