function [plugin_exist, plugin_path] = is_crp_plugin
% IS_CRP_PLUGIN   Checks if extern plugin exist and is executable
%    Used by CRP Toolbox

% Copyright (c) 2005 by AMRON
% Norbert Marwan, Potsdam University, Germany
% http://www.agnld.uni-potsdam.de
%
% $Date$
% $Revision$
%
% $Log$
%
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or any later version.

global errcode

plugin_exist = 0;
plugin_path = '';

if exist('rp','file')
      plugin_exist = 0;
      plugin_path = fileparts(which('rp'));
      try
          [status dummy] = system([plugin_path,filesep,'rp -V > /tmp/1']);
      catch
          status = 1;
      end
      if ~status, plugin_exist = 1; end
end
