function out = cmopts(variableName)
%CMOPTS Version control settings.
%   CMOPTS returns the name of your version control system. To specify the
%   version control system, select Preferences from the File menu.
%
%   OUT=CMOPTS('VARIABLENAME') returns the setting for VARIABLENAME
%   as a string OUT.
%
%   See also CHECKIN, CHECKOUT, UNDOCHECKOUT, CUSTOMVERCTRL, CLEARCASE,
%   PVCS, SOURCESAFE, and RCS.

%   Author(s): Vaithilingam Senthil
%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.24 $  $Date: 2000/08/03 21:19:06 $

lerror = lasterr;
lwarn = lastwarn;
warnState = warning('off');
try
	objP = com.mathworks.services.Prefs;
	prefs = char(objP.getStringPref('EditorSourceControlSystem'));
catch
	prefs = 'None';
end
lasterr(lerror);
lastwarn(lwarn);
warning(warnState);

if (strcmp(prefs, 'None'))
	Source_Control_System = 'none';
elseif (strcmp(prefs, 'ClearCase (Rational Software Corporation)'))
	Source_Control_System = 'clearcase';
elseif (strcmp(prefs, 'PVCS (Merant)'))
	Source_Control_System = 'pvcs';
elseif (strcmp(prefs, 'RCS'))
	Source_Control_System = 'rcs';
elseif (strcmp(prefs, 'Microsoft Visual SourceSafe'))
	Source_Control_System = 'sourcesafe';
elseif (strcmp(prefs, 'Custom'))
	Source_Control_System = 'customverctrl';
else
	Source_Control_System = 'none';
end

if nargin == 0
	out = Source_Control_System;
	return;
else 
	try 
		out = eval(variableName);
	catch 
		error(['''' variableName '''' ' not defined.']);
	end
end
