diff options
-rw-r--r-- | bin/ksh/sh.1 | 70 | ||||
-rw-r--r-- | bin/ksh/sh.1tbl | 70 | ||||
-rw-r--r-- | distrib/miniroot/install.sub | 75 |
3 files changed, 171 insertions, 44 deletions
diff --git a/bin/ksh/sh.1 b/bin/ksh/sh.1 index bcd826a4251..ac5dfe893e7 100644 --- a/bin/ksh/sh.1 +++ b/bin/ksh/sh.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sh.1,v 1.28 2001/09/02 14:05:58 aaron Exp $ +.\" $OpenBSD: sh.1,v 1.29 2002/05/04 22:21:21 krw Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -1370,6 +1370,74 @@ represent itself it must be quoted or appear later in the list. Like .Ic \&[ Ns No .. Ns Ic \&] , except it matches any character not inside the brackets. +.Sm on +Matches any string of characters that matches zero or more occurrences of the +specified patterns. +Example: The pattern +.Ic \&*(foo\&|bar) +matches the strings +.Dq , +.Dq foo , +.Dq bar , +.Dq foobarfoo , +etc. +.Sm off +.It Xo Ic \&+( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches any string of characters that matches one or more occurrences of the +specified patterns. +Example: The pattern +.Ic \&+(foo\&|bar) +matches the strings +.Dq foo , +.Dq bar , +.Dq foobar , +etc. +.Sm off +.It Xo Ic \&?( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches the empty string or a string that matches one of the specified +patterns. +Example: The pattern +.Ic \&?(foo\&|bar) +only matches the strings +.Dq , +.Dq foo +and +.Dq bar . +.Sm off +.It Xo Ic \&@( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches a string that matches one of the specified patterns. +Example: The pattern +.Ic \&@(foo\&|bar) +only matches the strings +.Dq foo +and +.Dq bar . +.Sm off +.It Xo Ic \&!( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches any string that does not match one of the specified patterns. +Examples: The pattern +.Ic \&!(foo\&|bar) +matches all strings except +.Dq foo +and +.Dq bar ; +the pattern +.Ic \&!(\&*) +matches no strings; the pattern +.Ic \&!(\&?)\&* +matches all strings (think about it). .El .Pp Note that diff --git a/bin/ksh/sh.1tbl b/bin/ksh/sh.1tbl index 2b3d5d56a3f..e50e0da89cb 100644 --- a/bin/ksh/sh.1tbl +++ b/bin/ksh/sh.1tbl @@ -1,4 +1,4 @@ -.\" $OpenBSD: sh.1tbl,v 1.28 2001/09/02 14:05:58 aaron Exp $ +.\" $OpenBSD: sh.1tbl,v 1.29 2002/05/04 22:21:21 krw Exp $ .\" .\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -1370,6 +1370,74 @@ represent itself it must be quoted or appear later in the list. Like .Ic \&[ Ns No .. Ns Ic \&] , except it matches any character not inside the brackets. +.Sm on +Matches any string of characters that matches zero or more occurrences of the +specified patterns. +Example: The pattern +.Ic \&*(foo\&|bar) +matches the strings +.Dq , +.Dq foo , +.Dq bar , +.Dq foobarfoo , +etc. +.Sm off +.It Xo Ic \&+( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches any string of characters that matches one or more occurrences of the +specified patterns. +Example: The pattern +.Ic \&+(foo\&|bar) +matches the strings +.Dq foo , +.Dq bar , +.Dq foobar , +etc. +.Sm off +.It Xo Ic \&?( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches the empty string or a string that matches one of the specified +patterns. +Example: The pattern +.Ic \&?(foo\&|bar) +only matches the strings +.Dq , +.Dq foo +and +.Dq bar . +.Sm off +.It Xo Ic \&@( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches a string that matches one of the specified patterns. +Example: The pattern +.Ic \&@(foo\&|bar) +only matches the strings +.Dq foo +and +.Dq bar . +.Sm off +.It Xo Ic \&!( Ar pattern Ic \&| No \ ...\ +.Ic \&| Ar pattern Ic \&) +.Xc +.Sm on +Matches any string that does not match one of the specified patterns. +Examples: The pattern +.Ic \&!(foo\&|bar) +matches all strings except +.Dq foo +and +.Dq bar ; +the pattern +.Ic \&!(\&*) +matches no strings; the pattern +.Ic \&!(\&?)\&* +matches all strings (think about it). .El .Pp Note that diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 0e968d4eda1..c8850473e96 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.217 2002/04/30 23:26:27 krw Exp $ +# $OpenBSD: install.sub,v 1.218 2002/05/04 22:21:21 krw Exp $ # $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $ # # Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback @@ -187,19 +187,6 @@ cutlast () { eval echo \$\{$#\} } -isnumeric() { - local _a=$1 - - while [ ${#_a} != 0 ]; do - case $_a in - [0-9]*) ;; - *) echo 0; return;; - esac - _a=${_a#?} - done - echo 1; return -} - # return available network devices get_ifdevs() { /sbin/ifconfig -a | egrep -v '^([[:space:]]|(lo|enc|gre|ppp|sl|tun|bridge)[[:digit:]])' | cutword -t: 1 @@ -1069,48 +1056,52 @@ __EOT # ftp.openbsd.org == 129.128.5.191 and will remain at # that address for the forseeable future. ftp ${_ftp_active} -V -a -o /tmp/ftplist ftp://129.128.5.191/pub/OpenBSD/${VERSION_MAJOR}.${VERSION_MINOR}/ftplist > /dev/null - cat /tmp/ftplist | grep "^${_url_type}:" | cat -n | less -XE + grep "^${_url_type}:" /tmp/ftplist | cat -n | less -XE ;; esac - # Get server IP address + # Get server IP address or hostname resp= while [ -z "$resp" ] ; do - if [ -f /tmp/ftplist ]; then - eval ask \"Server IP address, hostname, or list#?\" \"\$_${_url_type}_server_ip\" - else + if [ ! -f /tmp/ftplist ]; then eval ask \"Server IP address, or hostname?\" \"\$_${_url_type}_server_ip\" + continue; fi - if [ "$resp" = "?" -a -f /tmp/ftplist ]; then - cat /tmp/ftplist | grep "^${_url_type}:" | cat -n | less -XE + + eval ask \"Server IP address, hostname, or list#?\" \"\$_${_url_type}_server_ip\" + + case $resp in + "?") + grep "^${_url_type}:" /tmp/ftplist | cat -n | less -XE resp= - elif [ -n "$resp" \ - -a `isnumeric $resp` -eq 1 \ - -a ${resp:-0} -ge 1 \ - -a -f /tmp/ftplist ] - then + ;; + +([0-9])) maxlines=`grep "^${_url_type}:" /tmp/ftplist | sed -ne '$='` - if [ $maxlines -lt $resp ]; then + + if [ $maxlines -lt $resp -o $resp -lt 1 ]; then echo "There is no ${resp}th line in the list." - resp= - continue + else + tline=`grep "^${_url_type}:" /tmp/ftplist | sed -ne "${resp}p"` + url=`echo $tline | sed -e "s/^${_url_type}:\/\///" | + cutword -t' ' 1 | cutword -t' ' 1` + host=`echo $url | cutword -t/ 1` + path=`echo $url | sed -e "s/^${host}\///"` + path=${path}/${VERSION_MAJOR}.${VERSION_MINOR}/${ARCH} + eval _${_url_type}_server_ip=$host + eval _${_url_type}_server_dir=$path + echo "Using $tline" fi - tline=`grep "^${_url_type}:" /tmp/ftplist | sed -ne "${resp}p"` - url=`echo $tline | sed -e "s/^${_url_type}:\/\///" | - cutword -t' ' 1 | cutword -t' ' 1` - host=`echo $url | cutword -t/ 1` - path=`echo $url | sed -e "s/^${host}\///"` - path=${path}/${VERSION_MAJOR}.${VERSION_MINOR}/${ARCH} - eval _${_url_type}_server_ip=$host - eval _${_url_type}_server_dir=$path - # do it again, just to double check + + # Always do it again, just to double check resp= - echo "Using $tline" - else - eval _${_url_type}_server_ip=$resp - fi + ;; + *) + ;; + esac done + eval _${_url_type}_server_ip=$resp + # Get server directory if [ "$_url_type" = "ftp" -a -z "$_ftp_server_dir" ] ; then # Default ftp dir |