summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-09-24 06:39:08 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-09-24 06:39:08 +0000
commitfbfd257627ff1c85af70d9c1c64389bc326efe0a (patch)
tree712cba1d931d0a70179482c7705b5787eac170e0 /distrib/miniroot
parentb655413ed632e6b00667274be5b7f095ea97f557 (diff)
Make cutword operate on all lines of a file, not just the first,
so we can use it like cut(1). Also fix a typo.
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/install.sub14
1 files changed, 8 insertions, 6 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 61b5f8d7327..738f79d7b40 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: install.sub,v 1.95 1998/09/24 06:13:09 millert Exp $
+# $OpenBSD: install.sub,v 1.96 1998/09/24 06:39:07 millert 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
@@ -166,7 +166,7 @@ rmel() {
}
cutword () {
-# read a line of data, return Nth element.
+# read lines on stdin, return Nth element of each line, like cut(1)
local _a
local _n
local _oifs
@@ -178,10 +178,12 @@ cutword () {
esac
_n=$1
- read _a; set -- $_a
+ while read _a; do
+ set -- $_a
+ test "$1" = "" && break
+ eval echo \$$_n
+ done
IFS="$_oifs"
- if [ "$1" = "" ]; then return; fi
- eval echo \$$_n
}
cutlast () {
@@ -225,7 +227,7 @@ basename () {
get_ifdevs() {
# return available network devices
- /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|ppp|sl|tun)[[:digit:]])' | cutword -t: 1`
+ /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|ppp|sl|tun)[[:digit:]])' | cutword -t: 1
}
dir_has_sets() {