summaryrefslogtreecommitdiffstats
path: root/usr.bin/ar/ar.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2009-03-20 17:11:45 +0000
committerkientzle <kientzle@FreeBSD.org>2009-03-20 17:11:45 +0000
commit5d4c919934613f1067d0aa8447a095a31d6e608a (patch)
treebabfc8304fba24a53e1a0ad7d47180cc24f6d3c8 /usr.bin/ar/ar.c
parent1e419ef8ce4083bc65f371aa9ec4507d519b461e (diff)
downloadFreeBSD-src-5d4c919934613f1067d0aa8447a095a31d6e608a.zip
FreeBSD-src-5d4c919934613f1067d0aa8447a095a31d6e608a.tar.gz
Act like ranlib if our name ends in ranlib. In particular,
this works with some recent cross-building changes by Warner that install ranlib as, e.g., "arm-freebsd7.1-ranlib". Submitted by: John Hein
Diffstat (limited to 'usr.bin/ar/ar.c')
-rw-r--r--usr.bin/ar/ar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c
index e910e30..35a0380 100644
--- a/usr.bin/ar/ar.c
+++ b/usr.bin/ar/ar.c
@@ -108,8 +108,11 @@ main(int argc, char **argv)
if ((bsdar->progname = getprogname()) == NULL)
bsdar->progname = "ar";
- if (strcmp(bsdar->progname, "ranlib") == 0 ||
- strcmp(bsdar->progname, "bsdranlib") == 0) {
+ /* Act like ranlib if our name ends in "ranlib"; this
+ * accomodates arm-freebsd7.1-ranlib, bsdranlib, etc. */
+ len = strlen(bsdar->progname);
+ if (len >= strlen("ranlib") &&
+ strcmp(bsdar->progname + len - strlen("ranlib"), "ranlib") == 0) {
while ((opt = getopt_long(argc, argv, "tV", longopts,
NULL)) != -1) {
switch(opt) {
OpenPOWER on IntegriCloud