diff src/help.cc @ 6253:f1676652d808

[project @ 2007-01-24 20:43:36 by jwe]
author jwe
date Wed, 24 Jan 2007 20:43:37 +0000
parents 7924a9086c08
children 1f5de98984c3
line wrap: on
line diff
--- a/src/help.cc	Wed Jan 24 19:58:46 2007 +0000
+++ b/src/help.cc	Wed Jan 24 20:43:37 2007 +0000
@@ -43,6 +43,7 @@
 
 #include "cmd-edit.h"
 #include "file-ops.h"
+#include "file-stat.h"
 #include "oct-env.h"
 #include "str-vec.h"
 
@@ -1078,6 +1079,18 @@
     {
       if (h.length () > 0)
 	{
+	  // Strip extension
+	  size_t l = file.length ();
+	  if (l > 2 && file.substr (l-2) == ".m")
+	    {
+	      std::string tmp = file.substr (0, l - 2);
+
+	      if (file_stat (tmp + ".oct"))
+		file = tmp + ".oct";
+	      else if (file_stat (tmp + ".mex"))
+		file = tmp + ".mex";
+	    }
+
 	  os << nm << " is the file " << file << "\n\n";
 
 	  display_help_text (os, h);