#include <zephyr/zephyr.h>


void main(int argc, char *argv[])
{
int i,ret,num=1;
ZNotice_t notice;

if(argc<2)
	{
	printf("usage: %s username [num]\n",argv[0]);
	exit(1);
	}
if(argc>=3)
	{
	sscanf(argv[2],"%d",&num);
	if (num<0 || num>1000) num=1;
	}

if ((ret=ZInitialize()) != ZERR_NONE)
	{
	com_err(argv[0],ret,"Initializing");
	exit(1);
	}

bzero((char*)&notice,sizeof(notice));
notice.z_kind=UNACKED;
notice.z_port=0;
notice.z_class="MESSAGE";
notice.z_class_inst="PERSONAL";
notice.z_opcode="PING";
notice.z_sender=(char*)NULL;
notice.z_recipient=argv[1];
notice.z_default_format="";
for(i=0;i<num;i++)
	if((ret=ZSendNotice(&notice,ZNOAUTH))!=ZERR_NONE)
		{
		com_err(argv[0],ret,"Sending");
		exit(1);
		}
}
