zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: is-at-least
Date: Thu, 10 Aug 2000 17:48:15 +0100	[thread overview]
Message-ID: <0FZ300DRS5CF3H@la-la.cambridgesiliconradio.com> (raw)

Minor tinkering with is-at-least so that the first argument can be in the
same format as the second (i.e. you can do `is-at-least 3.1.9-dev-4'
instead of `3.1.9-4').  I also made the syntax more standard (I think).

Index: Functions/Misc/is-at-least
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/Misc/is-at-least,v
retrieving revision 1.3
diff -u -r1.3 is-at-least
--- Functions/Misc/is-at-least	2000/05/16 16:21:34	1.3
+++ Functions/Misc/is-at-least	2000/08/10 16:45:34
@@ -12,6 +12,7 @@
 # is-at-least 3.1.6-15 && setopt NO_GLOBAL_RCS
 # is-at-least 3.1.0 && setopt HIST_REDUCE_BLANKS
 # is-at-least 586 $MACHTYPE && echo 'You could be running Mandrake!'
+# is-at-least $ZSH_VERSION || print 'Something fishy here.'
 
 function is-at-least()
 {
@@ -19,14 +20,17 @@
     local IFS=".-" min_cnt=0 ver_cnt=0 part min_ver version
     min_ver=(${=1})
     version=(${=2:-$ZSH_VERSION} 0)
-    while (( $min_cnt <= ${#min_ver} )) {
-	while [[ "$part" != <-> ]] {
-	    [[ $[++ver_cnt] > ${#version} ]] && return 0
+    while (( $min_cnt <= ${#min_ver} )); do
+	while [[ "$part" != <-> ]]; do
+	    (( ++ver_cnt > ${#version} )) && return 0
 	    part=${version[ver_cnt]##*[^0-9]}
-	}
-	[[ $[++min_cnt] > ${#min_ver} ]] && return 0
+	done
+	while true; do
+	  (( ++min_cnt > ${#min_ver} )) && return 0
+	  [[ ${min_ver[min_cnt]} = <-> ]] && break
+	done
 	(( part > min_ver[min_cnt] )) && return 0
 	(( part < min_ver[min_cnt] )) && return 1
 	part=''
-    }
+    done
 }


-- 
Peter Stephenson <pws@csr.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


                 reply	other threads:[~2000-08-10 16:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0FZ300DRS5CF3H@la-la.cambridgesiliconradio.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).