home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / GENERAL.DI$ / HOSTID.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  810 b   |  41 lines

  1. function id = hostid
  2. %HOSTID MATLAB server host identification number.
  3.  
  4. %       Copyright (c) 1984-93 by The MathWorks, Inc.
  5.  
  6. com = computer;
  7. if com(1:2) == 'MA'
  8.    s9 = system_dependent(1009);
  9. elseif strcmp(com(1:2),'PC')
  10.    eval('s9 = siteid;');
  11. else % Unix or VMS
  12.    rt = getenv('MATLAB');
  13.    u = 1;
  14.    if com(1:2) == 'VA'
  15.       if com(3:6) == 'XVMS'
  16.          u = 0;
  17.       end
  18.    end
  19.    if u == 1
  20.       rt = [rt '/etc/license.dat'];
  21.    else
  22.       rt = [rt];
  23.    end
  24.    fid = fopen(rt,'r');
  25.    s = fgets(fid); 
  26.    s = fgetl(fid);
  27.    % get third entity from this string which is the MATLAB ID
  28.    b = find(s == ' ');
  29.    if length(b) < 3
  30.       s = [s ' P'];
  31.       b = [b length(s)-1];
  32.    end
  33.    s9 = s(b(2)+1:b(3)-1);
  34. end
  35. if nargout == 0
  36.    disp(s9)
  37. else
  38.    id = s9;
  39. end
  40.  
  41.