function subscribe
%SUBSCRIBE Subscribe to the MathWorks Newsletter.
%   Execute SUBSCRIBE to become a Subscribing User of MATLAB.
%   Subscribing users receive the MathWorks Newsletter and other
%   information to keep you up-to-date on the latest MATLAB
%   developments.  Anybody who uses MATLAB can become a Subscribing
%   User at no cost and you do NOT need to be a registered user to
%   receive the information.  Subscribing Users are entitled to:
%
%     - Receive a subscription to the MathWorks Newsletter by regular mail
%     - Receive an email subscription to the MATLAB News Digest
%     - Obtain technical support
%
%   SUBSCRIBE  will prompt you for your name and address.  If you are
%   on a Unix system, it will email your subscription to MathWorks.
%   If you are not, it will create a log file that you can print out
%   and FAX or mail to MathWorks.

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 5.14 $  $Date: 2000/06/15 00:44:03 $

disp(' ')
disp('Join the MATLAB community by becoming a Subscribing User and keep')
disp('up-to-date on the latest MATLAB developments! Anybody who uses')
disp('MATLAB can become a Subscribing User at no cost -- you do NOT')
disp('have to be a registered user. Subscribing Users are entitled to:')
disp(' ')
disp('  - Receive a subscription to the MathWorks Newsletter by regular mail')
disp('  - Receive an email subscription to the MATLAB News Digest')
disp('  - Obtain technical support')
disp(' ')
com = computer;
if com(1:2) == 'PC' | com(1:2) == 'MA'
   yn = 'n';
else
   yn = input('Do you wish to subscribe via email (y/n) [y]? ','s');
end
if isempty(yn)
   yn = 'y';
end
ynf = 'y';
if lower(yn(1)) == 'n'
   ynf = input('Do you wish to subscribe by fax or regular mail (y/n) [y]? ','s');
   if isempty(ynf)
      ynf = 'y';
   end
end
if lower(yn(1)) == 'y' | lower(ynf(1)) == 'y'
   fid = fopen('subscribe.log','w');
   if fid==-1, 
      disp(sprintf(['\nError: Trouble opening a file in the current directory. ',...
            'Please CD to \n       a writable directory and try SUBSCRIBE again.']));
      return
   end
   fprintf(fid,'%s\n','Please register me as a subscribing user!');
   s = input('Please enter your name:  ','s');
   fprintf(fid,'%s\n',s);
   s = input('Your Organization:  ','s');
   fprintf(fid,'%s\n',s);
   s = input('Street Address:  ','s');
   fprintf(fid,'%s\n',s);
   while ~isempty(s)
      if strcmp(deblank(fliplr(deblank(s))),'.')
         break
      end
      s = input('More address:  ','s');
      fprintf(fid,'%s\n',s);
   end
   s = input('E-mail address:  ','s');
   fprintf(fid,'%s\n',s);
   s = ['Computer:  ', com];
   fprintf(fid,'%s\n',s);
   if (strcmp(com(1:2),'PC') | strcmp(com(1:2),'MA'))
      s = ['MATLAB License Number:  ',license];
      fprintf(fid,'%s\n',s);
   else
      s = ['MATLAB License Number:  ',license];
      fprintf(fid,'%s\n',s);
      list = hostid;
      s = ['MATLAB server hostid:  ',list{1}];
      fprintf(fid,'%s\n',s);
   end
   fclose(fid);
   disp(' ')
   disp('Here''s the message you''ve created.')
   disp('--------------------------------------------')
   type subscribe.log
   disp('--------------------------------------------')
   disp(' ')
   if lower(yn(1)) == 'y'
      s = input('Is the message okay to send now (y/n) [y]? ','s');
   end
   if isempty(s)
      s = 'y';
   end
   if lower(s(1)) == 'y'
      if isunix
         if( strcmp(com,'HPUX') | strcmp(com,'HP700'))
            eval('!mailx -s Subscribe subscribe@mathworks.com < subscribe.log');
         else
            eval('!mail -s Subscribe subscribe@mathworks.com < subscribe.log');
         end
      end
   else
      disp('Output saved in the file subscribe.log.  Please print and')
      disp('send to MathWorks at:')
      disp(' ')
      disp('  FAX:   508-647-7001')
      disp('  Mail:  The MathWorks, Inc.')
      disp('         3 Apple Hill Drive')
      disp('         Natick, MA 01760-2098')
      disp('  Email: subscribe@mathworks.com')
      disp(' ')
   end
end
