Hi,

I would like to enable librelib to support multiple locations in
LIBRETOOLS_LIBDIR. A patch to add that functionality is attached.

comments?

Thanks,
-A

---
 src/lib/librelib | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/lib/librelib b/src/lib/librelib
index 004c8b1..9b6c743 100755
--- a/src/lib/librelib
+++ b/src/lib/librelib
@@ -73,11 +73,17 @@ main() {
        lib=${lib#libre}
        lib=${lib%.sh}
 
-       for file in ${lib} libre${lib} ${lib}.sh libre${lib}.sh; do
-               if [[ -f "$LIBRETOOLS_LIBDIR/$file" ]]; then
-                       printf '%s\n' "$LIBRETOOLS_LIBDIR/$file"
-                       return 0 # $EXIT_SUCCESS
-               fi
+  local libdir_array
+  IFS=: read -ra libdir_array <<< "$LIBRETOOLS_LIBDIR"
+
+  local librelib_dir
+  for librelib_dir in "${libdir_array[@]}"; do
+         for file in ${lib} libre${lib} ${lib}.sh libre${lib}.sh; do
+                 if [[ -f "$librelib_dir/$file" ]]; then
+                         printf '%s\n' "$librelib_dir/$file"
+                         return 0 # $EXIT_SUCCESS
+                 fi
+    done
        done
        _l print '%s: could not find library: %s' "$cmd" "$lib" >&2
        return 1 # $EXIT_FAILURE
-- 
2.26.0


-- 

------------------------------------------------------------------------------
Andreas Grapentin, M.Sc.          Research Assistant @ Hasso-Plattner-Institut
Operating Systems and Middleware Group              www.dcl.hpi.uni-potsdam.de
Phone: +49 (0) 331 55 09-238                        Fax: +49 (0) 331 55 09-229
my GPG Public Key:                 https://files.grapentin.org/.gpg/public.key
------------------------------------------------------------------------------

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Dev mailing list
[email protected]
https://lists.parabola.nu/mailman/listinfo/dev

Reply via email to