From ba83352b78b29ee8c624e8717a847567a899b5c3 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Mon, 14 Jun 1999 21:58:59 +0000 Subject: [PATCH] Support Alpha and -CURRENT in the "-r" option case. --- usr.sbin/pkg_install/add/main.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/usr.sbin/pkg_install/add/main.c b/usr.sbin/pkg_install/add/main.c index 002222fbada3..ee002c4fdc9b 100644 --- a/usr.sbin/pkg_install/add/main.c +++ b/usr.sbin/pkg_install/add/main.c @@ -1,6 +1,6 @@ #ifndef lint static const char rcsid[] = - "$Id: main.c,v 1.22 1999/01/26 22:31:23 billf Exp $"; + "$Id: main.c,v 1.23 1999/01/28 20:17:32 billf Exp $"; #endif /* @@ -26,6 +26,7 @@ static const char rcsid[] = #include #include +#include #include #include "lib.h" #include "add.h" @@ -187,18 +188,25 @@ static char * getpackagesite(char binform[1024]) { int reldate; + static char sitepath[MAXPATHLEN]; + struct utsname u; reldate = getosreldate(); - if (reldate == 300005) - return "i386/packages-3.0/"; - else if (300004 > reldate && reldate >= 300000) - return "i386/packages-3.0-aout/Latest/" ; - else if (300004 < reldate) - return !strcmp(binform, "elf") ? "i386/packages-3-stable/Latest/" : - "i386/packages-3.0-aout/Latest/"; + uname(&u); + strcpy(sitepath, u.machine); - return(""); + if (reldate == 300005) + strcat(sitepath, "/packages-3.0/"); + else if (300000 < reldate && reldate <= 300004) + strcat(sitepath, "/packages-3.0-aout/Latest/"); + else if (300004 < reldate && reldate < 400000) + strcat(sitepath, !strcmp(binform, "elf") ? "/packages-3-stable/Latest/" : + "/packages-3.0-aout/Latest/"); + else + strcat(sitepath, "/packages-current/Latest/"); + + return sitepath; }