Program Xfer;

Uses CRT,DOS;

{$I upstr.inc}

Var
  IFS,OFS:Text;
  IFN,OFN,PORT:String[255];
  BAUD:LongInt;
  ERR:Integer;

Procedure About;
Begin
  WriteLn(#$9b,'1;4mXFER v1.00 by Zebedee ©1997 Area 51 (31-Aug-97)',#$9b,'0m');
  WriteLn;
  WriteLn('Usage:   XFER <port> <baud>');
  WriteLn('Example: XFER SER: 9600');
  Halt(10);
End;

Procedure Error(ERRSTR:String;RETCODE:Integer);
Begin
  WriteLn(ParamStr(0),': ',ERRSTR);
  Halt(RETCODE)
End;

Begin
  If ParamCount=0 Then Error('required argument missing',20);
  If ParamCount<>2 Then About;
  PORT:=UpStr(ParamStr(1));
  Val(Copy(ParamStr(2),1,Length(ParamStr(2))),BAUD,ERR);
  If ERR<>0 Then Error('invalid baud rate',20);
  WriteLn('PORT: ',PORT);
  WriteLn('BAUD: ',BAUD);
  WriteLn('ERR : ',ERR);
End.