Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rump_allserver Also support ld syntax in -l.



details:   https://anonhg.NetBSD.org/src/rev/0ded95ed158e
branches:  trunk
changeset: 759595:0ded95ed158e
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Dec 13 14:26:22 2010 +0000

description:
Also support ld syntax in -l.

was: -l librumpvfs.so
now: -lrumpvfs

diffstat:

 usr.bin/rump_allserver/rump_allserver.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r a60643bfc3d2 -r 0ded95ed158e usr.bin/rump_allserver/rump_allserver.c
--- a/usr.bin/rump_allserver/rump_allserver.c   Mon Dec 13 14:18:50 2010 +0000
+++ b/usr.bin/rump_allserver/rump_allserver.c   Mon Dec 13 14:26:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_allserver.c,v 1.7 2010/12/13 14:13:21 pooka Exp $ */
+/*     $NetBSD: rump_allserver.c,v 1.8 2010/12/13 14:26:22 pooka Exp $ */
 
 /*-
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: rump_allserver.c,v 1.7 2010/12/13 14:13:21 pooka Exp $");
+__RCSID("$NetBSD: rump_allserver.c,v 1.8 2010/12/13 14:26:22 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -87,9 +87,16 @@
        while ((ch = getopt(argc, argv, "l:m:s")) != -1) {
                switch (ch) {
                case 'l':
-                       if (dlopen(optarg, RTLD_LAZY|RTLD_GLOBAL) == NULL)
-                               errx(1, "dlopen %s failed: %s",
-                                   optarg, dlerror());
+                       if (dlopen(optarg, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
+                               char pb[MAXPATHLEN];
+                               /* try to mimic linker -l syntax */
+
+                               snprintf(pb, sizeof(pb), "lib%s.so", optarg);
+                               if (dlopen(pb, RTLD_LAZY|RTLD_GLOBAL) == NULL) {
+                                       errx(1, "dlopen %s failed: %s",
+                                           pb, dlerror());
+                               }
+                       }
                        break;
                case 'm':
                        if (nmods - curmod == 0) {



Home | Main Index | Thread Index | Old Index