changeset 27148:224ce8329074

web.m: More Matlab compatibility. * scripts/web/web.m: Reduce code by using ifelse. Only return status, if (nargout > 0) to be compatible with Matlab.
author Guillaume Flandin <guillaume.offline@gmail.com>
date Wed, 05 Jun 2019 12:27:41 +0200
parents f0da934bca61
children 61226b7bd6b9
files scripts/web/web.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/web/web.m	Tue Jun 04 15:27:42 2019 -0700
+++ b/scripts/web/web.m	Wed Jun 05 12:27:41 2019 +0200
@@ -93,12 +93,8 @@
     url = ["file://" fname];
   endif
 
-  status = __open_with_system_app__ (url);
-  if (status == 1)
-    status = 0;
-  else
-    status = 2;
-  endif
+  sts = __open_with_system_app__ (url);
+  sts = ifelse (sts == 1, 0, 2);
 
   h = [];  # Empty handle, as we cannot control an external browser.
 
@@ -106,6 +102,10 @@
   if (any (strcmp (varargin, "-browser")))
     url = [];
   endif
+  
+  if (nargout > 0)
+    status = sts;
+  endif
 
 endfunction