diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-05-04 22:21:22 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2002-05-04 22:21:22 +0000 |
commit | e83997051c103aa7d5596b705118923addaea95e (patch) | |
tree | 9fbe82cce6ebf9582e373ae70113671eeb80e16e /bin | |
parent | a1fb4e4b7740e6d4b48d151b9a0c73f41e408cbf (diff) |
Clean up the logic in install_url():
a) Eliminate extraneous cat invocations that are piped to
grep by simply calling grep with the file name.
b) Eliminate the only use of isnumeric() by using a ksh'ism
left exposed in sh: '+([0-9])'. Eliminate isnumeric().
c) Test for a http/ftp list index of '0' and treat as an out
of range error rather than an IP address.
d) Reorganize to make smaller and more clear.
Add documentation to sh(1) for ksh patterns that are available.
ok millert@, miod@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/sh.1 | 70 | ||||
-rw-r--r-- | bin/ksh/sh.1tbl | 70 |
2 files changed, 138 insertions, 2 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 |