Commit | Line | Data |
---|---|---|
2a50b0b4 KB |
1 | #!/bin/sh - |
2 | # | |
3 | # Copyright (c) 1988 Regents of the University of California. | |
4 | # All rights reserved. The Berkeley software License Agreement | |
5 | # specifies the terms and conditions for redistribution. | |
6 | # | |
7 | # @(#)lorder.sh 5.1 (Berkeley) %G% | |
8 | # | |
9 | ||
10 | trap "rm -f $$sym?ef; exit" 0 1 2 13 15 | |
11 | case $# in | |
12 | 0) echo usage: lorder file ... | |
13 | exit ;; | |
14 | 1) case $1 in | |
15 | *.o) set $1 $1 | |
16 | esac | |
17 | esac | |
18 | nm -g $* | sed ' | |
19 | /^$/d | |
20 | /:$/{ | |
21 | /\.o:/!d | |
22 | s/:// | |
23 | h | |
24 | s/.*/& &/ | |
25 | p | |
26 | d | |
27 | } | |
28 | /[TD] /{ | |
29 | s/.* // | |
30 | G | |
31 | s/\n/ / | |
32 | w '$$symdef' | |
33 | d | |
34 | } | |
35 | s/.* // | |
36 | G | |
37 | s/\n/ / | |
38 | w '$$symref' | |
39 | d | |
40 | ' | |
41 | sort $$symdef -o $$symdef | |
42 | sort $$symref -o $$symref | |
43 | join $$symref $$symdef | sed 's/[^ ]* *//' |