j...@wxcvbn.org (Jérémie Courrèges-Anglas) writes:

> When I looked at the lorder script, I had trouble understanding the sort
> and join calls, since the syntax used is historical.
>
> I'm using this diff since a couple of months.  Could someone double
> check that I got the conversion right?

Is there any interest in this? :)

> Index: lorder.sh
> ===================================================================
> RCS file: /cvs/src/usr.bin/lorder/lorder.sh,v
> retrieving revision 1.14
> diff -u -p -r1.14 lorder.sh
> --- lorder.sh 2 Jul 2003 00:21:16 -0000       1.14
> +++ lorder.sh 26 Mar 2015 08:41:17 -0000
> @@ -55,7 +55,7 @@ trap "rm -f $R $S; exit 1" 1 2 3 13 15
>  
>  # 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 
> +# if the line has " T ", " D ", " G ", " R ",  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
> @@ -75,7 +75,7 @@ ${NM:-nm} -go "$@" | sed "
>  
>  # sort symbols and references on the first field (the symbol)
>  # 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
> +sort -k 2 -o $R $R
> +sort -k 2 -o $S $S
> +join -j 2 -o 1.1,2.1 $R $S
>  rm -f $R $S

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to