[Index for tmp_for_tar/imgio]
[Return to Master Index]
set_viewer
(tmp_for_tar/imgio/set_viewer.m)
Function Synopsis
vc = set_viewer( vc )
Help text
vc2 = set_viewer( [vc] )
vc : Either of
string : Viewer command, of the form "viewer_name options", to
which a stream of pnm data can be sent. Checks whether it
the viewer exists with the "which" command. If it does,
sets the global variable image_viewer is set to vc.
number : returns list of known viewers.
If no argument is given, checks for some standard viewers and sets the
global variable image_viewer to the first one that is found to exist.
vc2 is either the first viewer command that was found to work or the
empty string if none has been found.
The global variable image_viewer is set only if a working viewer was
found.
Last modified: Setembro 2002
Listing of function file tmp_for_tar/imgio/set_viewer.m
## vc2 = set_viewer( [vc] )
##
## vc : Either of
##
## string : Viewer command, of the form "viewer_name options", to
## which a stream of pnm data can be sent. Checks whether it
## the viewer exists with the "which" command. If it does,
## sets the global variable image_viewer is set to vc.
##
## number : returns list of known viewers.
##
##
## If no argument is given, checks for some standard viewers and sets the
## global variable image_viewer to the first one that is found to exist.
##
## vc2 is either the first viewer command that was found to work or the
## empty string if none has been found.
##
## The global variable image_viewer is set only if a working viewer was
## found.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: Setembro 2002
function vc = set_viewer( vc )
global image_viewer = "" ;
## List of image viewer commands. Add your own, if you want.
def = ["xv -";\
"display -";\
"xloadimage stdin > /dev/null"];
if nargin != 0 ,
if isstr (vc)
## Try only user-provided viewer
def = vc ;
else
vc = def ;
return
end
end
## Try available viewers until one works
for i = 1:rows (def),
# vc = viewer's command
vc = deblank (def(i,:));
## printf ("set_viewer : Trying '%s'\n",vc)
fb = min (find (vc==" ")); # First blank
# vn = viewer's name
if ! isempty (fb), vn = vc(1:fb-1);
else vn = vc ;
end
# Return 0 means success
## if ! system (["which ",vn," > /dev/null"]) (2),
[dum,status] = system (["which ",vn," > /dev/null"]);
if ! status ,
image_viewer = vc ;
return ;
end
end
image_viewer = vc = "" ;
endfunction
Produced by oct2html on Sat Sep 14 9:47:03 2002
Cross-Directory links are: ON