/*   
*     rarp.c
*/
#include "pcdefs.h"
#include "protocol.h"
#include "config.h"
#include "funcdef.h"
#include "../defs.h"

extern u_char myether[DADDLEN];
extern int neterrno;

int
rarp_process()
{
    int	i;
    u_long	end_time;

    for (i = 0; i < RARP_RETRIES; i++) {
	if (sendarp(myether, 0, htons(RARPQ)) < 0) {
		neterrno = NETERR_SYSTEM;
		return -1;
	}
	end_time = n_clicks() + 18L;
	while (n_clicks() < end_time) {
		netsleep();
		if (Scon.myip)
			return 0;
	}
    }
    neterrno = NETERR_TIMEOUT;
    return -1;
}
