function [varargout]  = ctdcal(varargin)
% CTDCal - AOML/PhOD CTDO2 calibration toolbox
%
% This function (ctdcal/CTDCal.m)  is the main control/startup
% file for the ctdcal toolbox.  It also acts as a reference 
% source for information on the toolbox version, installation directory
% and other metadata that may be necessary from the Matlab prompt.
% 
% The ctdcal.m file is within the ctdcal directory, which must appear 
% somewhere on the MATLABPATH.  The most logical place is in the 
% user's matlab directory on linux and in the local toolbox directory 
% on a Windows PC.  The following line must then be added to the user's
% startup.m file or appended to the path in some other way.
%
% % Add ctdcal directory to the path on Derrick's linux computer
% path(fullfile('home','snowden','matlab','ctdcal'),path) % prepend ctdcal
%
% The line above adds the directory /home/snowden/matlab/ctdcal/ to 
% the beginning of my matlab path.
% 
% See the User's Guide for more information on installation and path management.
%
% USAGE: 
%	>> ctdcal % Displays installation_directory and version on the 
%		command line
%	>> [opts] = ctdcal % Returns a structure with fields 'path' and
%		'version'
%	>> ctdcal('version') % Displays the version on the commandline
%	>> ver = ctdcal('version') % Returns the version as a double
%		scalar array
%	>> ctdcal('path') % Displays the installation path on the command line.
%	>> pth = ctdcal('path') % Returns the installation path in a char array.
% 

% AUTHOR: 
%	Derrick Snowden and Carlos Fonseca
%	NOAA/AOML/PhOD
%	Thu Sep 16 13:47:28 EDT 2004
% 	
% 
% VERSION: 
%	$Revision: 1.4 $
%	$Date: 2008/01/19 19:23:43 $
%
% CHANGELOG:
%
% SEE ALSO: contents.m, version.m, 
% ctdcal/doc/howto/ctdcal.html - User's Guide
% ctdcal/doc/ctdcal/ctdcal.html - Matlab function documentation in html format
% http://doris/matlab/ctdcal on the AOML intranet.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%% CMDR
% This appears to do absolutely nothing (except write out the
% version number and/or the path) and take an inordinately
% longwinded way around doing it too...
%%%%%%%%%%%%%%%%%%%%% 2007/11/18 

% TODO: % Change hard coded version number this when the revision control 
%		system is implemented.
VERSION = 1.0;
[theFilePath,b,c] = fileparts(which(mfilename));

if nargin==0
	if nargout == 0
		disp('CTDCAL Toolbox')
		disp(['Version: ' num2str(VERSION)])
		disp(['Installation directory:  '])
		disp(theFilePath)
		disp(' ')
		return
	elseif nargout==1
		varargout{1} = struct('version',VERSION,'path',theFilePath);
		return
	end
end

% One output argument, see what the user wants.
if nargin == 1
	if ~ischar(varargin{1})
		error('input variable must be  a character array.')
	end
	theArg = varargin{1};
	switch lower(theArg(1:3))
		case 'ver'
			% version
			if nargout==0
				disp(['CTDCAL Toolbox Version: ' num2str(VERSION)])
				return
			else
				varargout{1} = VERSION;
				return
			end

		case 'pat'
			% installation path of ctdcal/
			if nargout==0
				disp(['CTDCAL Toolbox Path: ' theFilePath])
				return
			else
				varargout{1} = theFilePath;
				return
			end
		otherwise
			error('Invalid input switch.')
	end % End switch/case/end
end % if nargin == 1
return


