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 / LANGUAGS / PASCAL / PPAS80.LBR / ARGTEST.PAS < prev    next >
Pascal/Delphi Source File  |  2000-06-30  |  768b  |  24 lines

  1. program ArgTest (f, output);
  2. (* test ArgLib module, used to get file names from command line *)
  3. const maxarg = 20;
  4. var f: text;
  5. (*$I arglib.pas   IMPORT argc, argv, ArgStrType *)
  6.  
  7. procedure GetArguments;
  8. var
  9.   nFiles,j : integer;
  10.   arga: array [0..maxarg] of ArgStrType;
  11. begin
  12.   nFiles := argc-1;  if nFiles > maxarg then nFiles := maxarg;
  13.   for j := 0 to nFiles do argv(j,arga[j]);
  14.   writeln('argc=',(nFiles+1):1,'    file arguments=',nFiles:1);
  15.   for j:= 0 to nFiles do
  16.    begin write( j:2, ' = ',arga[j]);
  17.     if  resetOK(f,arga[j]) then writeln(' exists') else writeln(' empty');
  18.    end;
  19. end;
  20.  
  21. begin (* ArgTest *)
  22.  GetArguments
  23. end.
  24.