%%% Version = 1.1 %% %% Echo.oz %% Prints arguments in all nodes %% Author: %% Kevin Glynn (glynn@info.ucl.ac.be) functor import Application System Connection Pickle define Args % record with the command arguments DefaultOzStoreTicketFile = 'http://www.info.ucl.ac.be/~glynn/OzStoreTicket' OzStoreTicket %% If argument is error then raise it as an exception %% If success then return content fun {GetS R} thread case R of error(E) then {System.show 'GetS: Operation failed, returning failed value: '#E} {Value.failed E} [] success(S) then S end end end Args = try {Application.getArgs record(network(single char:&n type:atom default:default) % P2P network name ozstoreticket(single type:atom default:DefaultOzStoreTicketFile) help(single char:[&? &h] default:false) )} catch E then {System.show 'Unrecognised arguments'(E)} optRec(help:true) end if Args.help then {System.showInfo 'Usage information (missing!)'} {Application.exit 0} end OzStoreTicket = {Pickle.load Args.ozstoreticket} {ForAll {GetS {Send {Connection.take OzStoreTicket} get(Args.network $)}} proc {$ Id#(IP#Port#Tick)} {System.showInfo Id#'\t'#IP#'\t'#Port#'\t'#Tick} end } {Application.exit 0} end