diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-06-23 18:53:25 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2000-06-23 18:53:25 +0000 |
commit | f66e691f9fd13033727195f6865dec32501a22ef (patch) | |
tree | f2504833da95ea9fd65a81192aadea0f18c4eded /distrib/miniroot | |
parent | c9c47f4d245baa03a7825335f85432cfc2cd05fe (diff) |
implement bubble sort in ksh instead of using sort(1).
i think i'll fix sparc next week to use it.
Diffstat (limited to 'distrib/miniroot')
-rw-r--r-- | distrib/miniroot/install.sub | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 2c2d6914e6f..a2677728487 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: install.sub,v 1.154 2000/06/16 03:19:42 deraadt Exp $ +# $OpenBSD: install.sub,v 1.155 2000/06/23 18:53:24 mickey Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997,1998 Todd Miller, Theo de Raadt @@ -265,6 +265,33 @@ get_ifdevs() { /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|gre|ppp|sl|tun|bridge)[[:digit:]])' | cutword -t: 1 } +bsort() { + local _a=$1 + + if [ $# == 0 ]; then + return + fi + + if [ $# == 1 ]; then + echo $1; return + fi + + shift + while [ $# != 0 ]; do + local _b=$1 + if [[ "$_a" != "$_b" ]] ; then + if [[ "$_a" > "$_b" ]] ; then + _l="$_a $_l"; _a=$_b + else + _l="$_b $_l" + fi + fi + shift + done + + echo -n "$_a "; bsort $_l +} + dir_has_sets() { # return true when the directory $1 contains a set for $2...$n local _dir=$1 _file |