changeset 8794:f16aafdd99ca

__gnuplot_version__.m: don't use regexp to extract version number
author John W. Eaton <jwe@octave.org>
date Wed, 18 Feb 2009 01:10:43 -0500
parents 4c989d52f35c
children bb38a86efa1b
files scripts/ChangeLog scripts/plot/__gnuplot_version__.m
diffstat 2 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Wed Feb 18 01:06:46 2009 -0500
+++ b/scripts/ChangeLog	Wed Feb 18 01:10:43 2009 -0500
@@ -1,3 +1,8 @@
+2009-02-18  John W. Eaton  <jwe@octave.org>
+
+	* plot/__gnuplot_version__.m: Don't use regexp to extract version
+	number.
+
 2009-02-18  John W. Eaton  <jwe@octave.org>
 
 	* plot/gnuplot_drawnow.m (gnuplot_set_term):
--- a/scripts/plot/__gnuplot_version__.m	Wed Feb 18 01:06:46 2009 -0500
+++ b/scripts/plot/__gnuplot_version__.m	Wed Feb 18 01:10:43 2009 -0500
@@ -35,15 +35,11 @@
       ## asking us why plotting fails when gnuplot is not found.
       error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n");
     endif
-    pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
-    [d1, d2, d3, d4, matches] = regexp (output, pattern);
-    if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1}))
-      if (numel (matches{1}) == 2)
-	__version__ = sprintf ("%s.%s", matches{1}{:});
-      else
-	__version__ = matches{1}{1};
-      endif
-    endif
+    output = strrep (output, "gnuplot", "");
+    output = strrep (output, "patchlevel", ".");
+    output = strrep (output, "\n", "");
+    output = strrep (output, "\r", "");
+    __version__ = strrep (output, " ", "");
   endif
 
   version = __version__;