# Copyright (c) 1990 The Regents of the University of California.
# Redistribution and use in source and binary forms are permitted
# provided that the above copyright notice and this paragraph are
# duplicated in all such forms and that any documentation,
# advertising materials, and other materials related to such
# distribution and use acknowledge that the software was developed
# by the University of California, Berkeley. The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
# @(#)lorder.sh 5.2 (Berkeley) %G%
# only one argument is a special case, just output the name twice
echo "usage: lorder file ...";
# remove temporary files on HUP, INT, QUIT, PIPE, TERM
trap "rm -f $R $S; exit 1" 1 2 3 13 15
# if the line ends in a colon, assume it's the first occurrence of a new
# object file. Echo it twice, just to make sure it gets into the output.
# if the line has " T " or " D " it's a globally defined symbol, put it
# if the line has " U " it's a globally undefined symbol, put it into
# sort symbols and references on the first field (the symbol)
# join on that field, and print out the file names.
join -j 2 -o 1.1 2.1 $R $S