From 79e970eddeef35dcbc1e45f6adc0e2d089f4c18e Mon Sep 17 00:00:00 2001 From: Chris Piazza Date: Thu, 18 Nov 1999 23:32:43 +0000 Subject: [PATCH] Make `pkg_add -r package1 package2 package3 ...` work correctly. Reviewed by: billf --- usr.sbin/pkg_install/add/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 174479ce1752..f96940e890c0 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -62,7 +62,8 @@ main(int argc, char **argv) char *cp; char *remotepkg = NULL, *ptr; - static char packageroot[MAXPATHLEN] = "ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/"; + static const char packageroot[MAXPATHLEN] = "ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/"; + static char temppackageroot[MAXPATHLEN]; start = argv; while ((ch = getopt(argc, argv, Options)) != -1) { @@ -129,11 +130,12 @@ main(int argc, char **argv) /* Get all the remaining package names, if any */ for (ch = 0; *argv; ch++, argv++) { if (Remote) { + strcpy(temppackageroot, packageroot); if (getenv("PACKAGESITE") == NULL) - strcat(packageroot, getpackagesite()); + strcat(temppackageroot, getpackagesite()); else - strcpy(packageroot, (getenv("PACKAGESITE"))); - remotepkg = strcat(packageroot, *argv); + strcpy(temppackageroot, (getenv("PACKAGESITE"))); + remotepkg = strcat(temppackageroot, *argv); if (!((ptr = strrchr(remotepkg, '.')) && ptr[1] == 't' && ptr[2] == 'g' && ptr[3] == 'z' && !ptr[4])) strcat(remotepkg, ".tgz");