#!/bin/sh
## 
## Copyright 2018-2022, 2026 The Regents of the University of California
## All rights reserved.
## 
## This file is part of Spoofer.
## 
## Spoofer is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## 
## Spoofer is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with Spoofer.  If not, see <http://www.gnu.org/licenses/>.
## 

# `otool -L` sometimes prints an extra initial line corresponding to
# LC_ID_DYLIB.  Insteaad, we use `otool -l` and explicitly look for
# LC_LOAD_DYLIB cmds, and extract their names.

otool -l "$@" | sed -E -n -e '/^ *cmd LC_LOAD_DYLIB/,/^ *name/s/^ *name ([^()]*) \(.*\)/\1/p'
