program crap; uses ipx,novapi; Type Switch_array=array[1..10] of string; var Message:string55; Connections_list:string; results,converted_list:string100; length_:integer; switches:Switch_array; procedure PrintDocs; begin writeln('Useage: asend ,,,<...etc> '); writeln(' Where IDn is a valid username or a valid connection number'); end; Procedure Parse_parameters(var Switches:switch_array; var connections_list:string; var message:string55); Procedure MakeMessage(var message:string55); var counter:integer; begin message:='Anon:'; for counter:=2 to 100 do begin if paramstr(counter) <> '' then message:=message+paramstr(counter)+' '; end; end; begin Connections_list:=paramstr(1); MakeMessage(message); end; Procedure ConvertList(Connections_list:string; var Converted:string100); var count:integer; name:string; connection:integer; procedure Retrieve_connection(Connections_list:string; var count:integer; var connection:integer); begin connection:=0; if (connections_list[count+1] <> ',') and (count+1 <= length(Connections_list)) then begin if (connections_list[count+2]<> ',') and (count+2 <= length(Connections_list)) then begin connection:=(ord(connections_list[count])-48)*100; inc (count); end; connection:=connection+(ord(Connections_list[count])-48)*10; inc(count); end; connection:=connection+ord(Connections_list[count])-48; inc(count); end; procedure Retrieve_Name(Connections_list:String100; var count:integer; var name:string); begin name:=''; while (Connections_list[count]<>',') and (count <= length(Connections_list)) do begin name:=name+connections_list[count]; inc (count); end; end; begin count:=1; name:=''; connection:=0; converted:=''; length_:=0; while count <= length(connections_list) do begin inc (length_); if connections_list[count]>='0' then if connections_list[count]<='9' then retrieve_connection(connections_list,count,connection) else begin retrieve_name(Connections_list,count,name); connection:=Get1stConnectionNumber(name); end; converted:=converted+chr(connection); inc(count); end; end; procedure PrintResults; var counter,temp,connection:integer; name:string47; ID:longint; ObjectType:integer; time:NetworkTimeRecord; begin for counter:=1 to length_ do begin temp:=ord(results[counter]); connection:=ord(converted_list[counter]); GetConnectionInformation(connection,ID,ObjectType,name,time); if temp = 0 then writeln('Message sent to:',name,'[',connection,']') else begin write('Message not send to:',name,'[',connection,']'); if temp = 255 then writeln(' [CASTING ERROR!]'); if temp = 252 then writeln(' [BUFFER ERROR!]'); if temp = 253 then writeln(' [SEARCH ERROR!]'); end; end; end; begin if paramstr(1)='' then PrintDocs else begin Parse_parameters(switches,connections_list,message); ConvertList(Connections_list,converted_list); sendBroadcastMessage(message,converted_list,results); PrintResults; end; end. ConvertList(Connections_list,converted_list); sendBroadcastMessage(message,converted_list,results); PrintResults; end; end.