=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/lorder/lorder.sh,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- src/usr.bin/lorder/lorder.sh 1998/11/22 00:11:08 1.9 +++ src/usr.bin/lorder/lorder.sh 1999/05/21 01:24:04 1.10 @@ -1,6 +1,6 @@ #!/bin/sh - -# $OpenBSD: lorder.sh,v 1.9 1998/11/22 00:11:08 d Exp $ -# $NetBSD: lorder.sh,v 1.3 1995/04/24 07:38:52 cgd Exp $ +# $OpenBSD: lorder.sh,v 1.10 1999/05/21 01:24:04 espie Exp $ +# $NetBSD: lorder.sh.gnm,v 1.3 1995/12/20 04:45:11 cgd Exp $ # # Copyright (c) 1990, 1993 # The Regents of the University of California. All rights reserved. @@ -36,7 +36,7 @@ # @(#)lorder.sh 8.1 (Berkeley) 6/6/93 # -# only one argument is a special case, just output the name twice +# one argument can be optimized: put out the filename twice case $# in 0) echo "usage: lorder file ..."; @@ -62,23 +62,16 @@ # remove temporary files on HUP, INT, QUIT, PIPE, TERM trap "rm -rf $TDIR; trap 2 ; kill -2 $$" 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. +# make sure files depend on themselves +for file in "$@"; do echo "$file $file" ; done +# if the line has " T ", " D ", " G ", " R ", it's a globally defined +# symbol, put it into the symbol file. # -# if the line has " T " or " D " it's a globally defined symbol, put it -# into the symbol file. -# # if the line has " U " it's a globally undefined symbol, put it into # the reference file. ${NM:-nm} -go "$@" | sed " - /:$/ { - s/:// - s/.*/& &/ - p - d - } - / [TD] / { - s/:.* [TD] / / + / [TDGR] / { + s/:.* [TDGR] / / w $S d } @@ -90,7 +83,7 @@ " # sort symbols and references on the first field (the symbol) -# join on that field, and print out the file names. +# join on that field, and print out the file names (dependencies). sort +1 $R -o $R sort +1 $S -o $S join -j 2 -o 1.1 2.1 $R $S