#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <nlist.h>
#include "libtools.h"

#include "feptypes.h"

#include "triglbl.h"
#include "hou2mmap.h"
#include "debugcomm.h"

/*
 *	Convert a FEP symbol to an address
 */
ulong
fep_addr(char *fepfile, char *symname)
{
	struct nlist	symbol[2];
	ulong		addr;

	/*
	 *	Figure out the address we are interested in
	 */
	symbol[0].n_name = symname;
	symbol[1].n_name = NULL;
	nlist(fepfile, symbol);
	addr = symbol[0].n_value;

	if (addr == 0)
		addr = strtoul(symname, NULL, 16);

	return (addr);
}
