summaryrefslogtreecommitdiff
path: root/smart-clib-sym
blob: fab7de414cfd74fa7da904a262a2f430d00d5a89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/csh -f
#
# Summary:      Test whether symbol appears within a set of C libraries.
# Usage:        <script-name> <symbol-string>
#
# Author:       Bob Weiner
#
# Orig-Date:     5-Oct-91 at 03:29:05
# Last-Mod:     24-Jan-22 at 00:52:07 by Bob Weiner
#
# Copyright (C) 1991-2016  Free Software Foundation, Inc.
# See the "HY-COPY" file for license information.
#
# This file is part of GNU Hyperbole.
#
# Commentary:
#
#   Create the file given by the variable 'clib_list' below, and place in that
#   file the full path for each C, C++ or Objective-C library that you want
#   scanned for symbol names.  One filename per line.  Do not quote the
#   filenames.
#
#   Handles exact name matches only.  Echos and exits with same output value.
#   Either 1 if symbol is found or 0 if not.

# Code:

# Create this file and place in the file the full path for each C, C++ or
# Objective-C library that you want scanned for symbol names.  One filename
# per line.  Do not quote the filenames.
#
set clib_list = "~/.CLIBS-LIST"


# This file will automatically be created to cache the symbol names.
# Remove it if you ever want to rebuild the symbol table.
#
set clib_symbols = "~/.clibs-symbols"

set st = 0 rebuild = 0
if (-e $clib_list) then
   if (! -e $clib_symbols || -z $clib_symbols) set rebuild = 1
   if ($rebuild || (-M $clib_list) > (-M $clib_symbols)) then
      nm -g `cat $clib_list` | grep '^[0-9 ].* _[A-Za-z]' | sed -e 's/^[^_][^_]*_//g' | sort | uniq > $clib_symbols
   endif
   fgrep -sx $1 $clib_symbols >& /dev/null
   @ st = ! $status
endif

echo $st
exit $st