This is mrcv.c in view mode; [Download] [Up]
#include <stdio.h> #include <stdlib.h> #include <mach.h> #include <servers/netname.h> #include <sys/message.h> #include <net/etherdefs.h> #include <sys/errno.h> #include <string.h> #include "eniutils.h" #include "libeni.h" char *prog ; int main(int ac, char *av[]) { char dstr[ADDR_STR_LEN] ; char sstr[ADDR_STR_LEN] ; int len ; int r ; unsigned char pack[ENI_PACKET_SIZE + 1] ; unsigned short type ; prog = av[0] ; if(eni_init() == -1) { fprintf(stderr, "%s: eni_init() failed.\n", prog) ; exit(1) ; } ; while((r = eni_get_packet(pack, &len)) != -1) { bcopy(pack + TYPE_OFFSET, (char *)&type, sizeof type) ; printf("%s: from %s, to %s, type is %d, data length is %d\n\tdata is [%s]\n", prog, addr_to_hex(pack + SADDR_OFFSET, sstr), addr_to_hex(pack + DADDR_OFFSET, dstr), (int)type, len, pack + DATA_OFFSET) ; } fprintf(stderr, "%s: eni_get_packet() returned %d.\n", prog, r) ; exit(0) ; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.