function s=tempnam(FirstName)
% TEMPNAM  Return a system temporary filename
% 	s=tempnam; returns a system temporary filename
%	s=tempnam('data'); returns a virtual system temporary filename,
%	like data.tmp.AAAa26747 The argument may be any string.

if nargin<1
  FirstName=[];
end

if isempty(FirstName)
  [dummy,s]=unix('tempnam');
  s=s(1:length(s)-1);
else
  [dummy,s]=unix('TMPDIR=".";export TMPDIR; tempnam');
  s=[FirstName s(3:length(s)-1)];
end
