home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / ZCPR33 / A-R / LISTCMD.PAS < prev    next >
Pascal/Delphi Source File  |  2000-06-30  |  3KB  |  114 lines

  1. program list_cmd;
  2.  
  3. (*----------------------------------------------------------------------------
  4. Ver 1.0 - Program to display internal ARUNZ commands from ARUNZ.CMD file on
  5.           current disk/user, or the alternate designated disk drive.
  6.  
  7.           3/30/88 - Al Heynneman
  8.  
  9.           70110,611 on Compuserve
  10.           HEYNNEMAN on Genie
  11.           CL0798 on the Source
  12. ----------------------------------------------------------------------------*)
  13.  
  14. const drive             = 'M:';
  15.       version           = '1.0';
  16.  
  17. var   end_of_first_word : integer;
  18.       cmdcount          : integer;
  19.       cmdfile           : text;
  20.       cmdline           : string[200];
  21.       command_is        : string[20];
  22.       exist             : boolean;
  23.       horz_pos          : integer;
  24.       vert_pos          : integer;
  25.  
  26. begin
  27.   if (paramcount > 0) then
  28.   begin
  29.     clrscr;
  30.     writeln('LIST_CMD Version ',version);
  31.     writeln;
  32.     writeln('LIST_CMD will display the internal ARUNZ commands that are found');
  33.     writeln('in ARUNZ.CMD in the currently logged in disk drive and user area,');
  34.     writeln('or alternatively on drive ',drive,' (current user area).');
  35.     writeln;
  36.     writeln('If commands are more than 18 characters long, they are truncated,');
  37.     writeln('shown in alternate video mode, and end in + to indicate truncation.');
  38.     writeln;
  39.     writeln('To change the default, alternate location of the ARUNZ.CMD file,');
  40.     writeln('you must first edit, and then recompile this program.');
  41.     exit;
  42.   end;
  43.  
  44.   assign(cmdfile,'alias.cmd');
  45.   (*$I-*)
  46.   reset(cmdfile);
  47.   (*$I+*)
  48.   exist := (IOresult = 0);
  49.  
  50.   if not exist then
  51.   begin
  52.     assign(cmdfile,drive + 'alias.cmd');
  53.     (*$I-*)
  54.     reset(cmdfile);
  55.     (*$I+*)
  56.     exist := (IOresult = 0);
  57.   end;
  58.  
  59.   if not exist then
  60.   begin
  61.     writeln;
  62.     writeln(chr(7),'ALIAS.CMD file not found on current drive,');
  63.     writeln('or on alternate drive ',drive,' (current user area).');
  64.     exit;
  65.   end;
  66.  
  67.   clrscr;
  68.   writeln('ARUNZ.CMD commands are:');
  69.   cmdcount := 0;
  70.   horz_pos := 1;
  71.   vert_pos := 3;
  72.  
  73.   while not EOF(cmdfile) do
  74.   begin
  75.     repeat
  76.       readln(cmdfile,cmdline);
  77.       end_of_first_word := pos(chr(9),cmdline);
  78.       if (end_of_first_word = 0) then end_of_first_word := pos(' ',cmdline);
  79.     until (end_of_first_word > 1) and (not (ord(cmdline[1]) in [9,32]));
  80.  
  81.     command_is := copy(cmdline,1,end_of_first_word - 1);
  82.     if (length(command_is) > 18) then
  83.     begin
  84.       command_is := copy(cmdline,1,18);
  85.       command_is[18] := '+';
  86.     end;
  87.  
  88.     cmdcount := cmdcount + 1;
  89.     gotoxy(horz_pos,vert_pos);
  90.     if (command_is[18] = '+') then lowvideo;
  91.     write(command_is);
  92.     fillchar(command_is,20,32);
  93.     normvideo;
  94.     horz_pos := horz_pos + 20;
  95.     if (cmdcount = 4) then
  96.     begin
  97.       cmdcount := 0;
  98.       horz_pos := 1;
  99.       vert_pos := vert_pos + 1;
  100.       writeln;
  101.       if (vert_pos = 23) then
  102.       begin
  103.         gotoxy(1,24);
  104.         write('Hit RETURN to continue display...');
  105.         repeat until keypressed;
  106.         horz_pos := 1;
  107.         vert_pos := 1;
  108.         clrscr;
  109.       end;
  110.     end;
  111.   end;
  112.  
  113.   close(cmdfile);
  114. end.