{$linesize:130,$symtab-,$title:'Integer File Dump'}
{$line+}
{$entry-}

program IDUMP( input, output );

function GetNextArg(var SwitchType,Numeric:boolean;var SwitchChar:char;
			var StringArg:lstring;var NumericArg:integer):boolean;external;
			{ returns next argument from command line }
			{ returns true if there was an argument }
			{ arguments are fields separated by spaces or a slash (/) }
{			SwitchType      true if argument begins with a slash
			Numeric         true if argument is an integer
			SwitchChar      char following / for switch type args
								 (SwitchChar is folded to upper case)
			StringArg       contains the ASCII argument (not the /)
			NumericArg      contains the value of arg, if applicable

			double quotes ("...") must be used to enclose an arg 
				containing a space or slash (/). 
}


const  
 nothing = 0;

var
	ch : char;
	i : integer;
	Count : integer;
	Inp : file of integer;
	SwitchType,Numeric : boolean;
	SwitchChar : char;
	StringArg : Lstring(80);
	NumericArg : integer;
	filestr : lstring(64);


{$subtitle:'MAIN PROGRAM'}
BEGIN															 { MAIN PROGRAM }
	writeln('Integer File Dump program -- output in base 10');writeln;

	if not GetNextArg(SwitchType,Numeric,SwitchChar,FileStr,NumericArg)
		then { null command line } begin { get file name from operator }
	   write('Enter input file name: ');
  		readln(filestr);
	end;

   assign(Inp,filestr);
   reset(Inp);
 Count := 0;

while not eof(Inp) do begin
	if (Count MOD 8) = 0 then begin
		writeln;  { new line }
		write(Count:5,'|  ');
	end;
	read(Inp,i);
	if (i < 32) or (i > 126) then ch := '.'
		else ch := chr(i);
	write(ch,i:6,'  ');
	Count := Count + 1;
end;

writeln; writeln;

end.			    { main }
