function logp(varargin)
%------------------------------------------------------------------
% NAME
%
%   logp - Log information in ascii log file
%
% SYNOPSIS
%
%   logp(mode, hdr)
%
% PARAMETERS
%
%   mode
%      Access mode to ascii logfile. Possible values are:
%
%         0 : non-interactive, just print the log separation and the header
%             if present.
%
%         1 : interactive mode. Additionnal lines can be input
%             interactively (default).
%
%        10 : as 0, but print a separation line
%
%        11 : as 1, but print a separation line
%
%   hdr
%      Header string to output.
%
%------------------------------------------------------------------
%Time:<Last updated on 98/10/10 at 20:45:40 by veins@TORSK>
%File:<c:/codas3/gfi/matlab/matlab50/scan_bin/logp.m>

scanglob;

%--- Defaults:
hdr  = [];
mode = 1;

%--- Arguments:
if nargin > 0,
  mode = varargin{1};
end
if nargin > 1,
  hdr = varargin{2};
end

%--- Check file name:
if isempty(ASCFILE),
  return;
end
fid = fopen(ASCFILE, 'a');

%--- Separation:
if mode >= 10,
  fprintf(fid, '\n');
  for i=1:75,
	 fprintf(fid, '%s', '-');
  end
  fprintf(fid, '\n\n');
  mode = mode - 10;
end

%--- Header string:
if ~isempty(hdr),
  fprintf(fid, '%s', hdr);
end

%--- Interactive input:
if mode == 1,
  fprintf(fid, '\n\n COMMENTS:');
  fprintf('\n\n%s\n\n', ...
		'Enter comments and exit by typing  `return''');
  r = '';
  while ~strcmp(r, 'return'),
	 fprintf(fid, '\n\t%s', r);
	 r = input('COMMENT: ', 's');
  end 
end

%--- Done:
fclose(fid);

return;
