function id = hostid
%HOSTID MATLAB server host identification number.

%       Copyright (c) 1984-93 by The MathWorks, Inc.

com = computer;
if com(1:2) == 'MA'
   s9 = system_dependent(1009);
elseif strcmp(com(1:2),'PC')
   eval('s9 = siteid;');
else % Unix or VMS
   rt = getenv('MATLAB');
   u = 1;
   if com(1:2) == 'VA'
      if com(3:6) == 'XVMS'
         u = 0;
      end
   end
   if u == 1
      rt = [rt '/etc/license.dat'];
   else
      rt = [rt];
   end
   fid = fopen(rt,'r');
   s = fgets(fid); 
   s = fgetl(fid);
   % get third entity from this string which is the MATLAB ID
   b = find(s == ' ');
   if length(b) < 3
      s = [s ' P'];
      b = [b length(s)-1];
   end
   s9 = s(b(2)+1:b(3)-1);
end
if nargout == 0
   disp(s9)
else
   id = s9;
end

