BERKST(3)

NAME
berkst - read in symbol and string tables in berkeley format

SYNOPSIS
#include <nlist.h>

berkst(objfile, symboltable, stringtable)
char *objfile;
struct nlist **symboltable;
char **stringtable;

berkstall(objfile, symboltable, stringtable)
char *objfile;
struct nlist **symboltable;
char **stringtable;

cc file.c -lconv

DESCRIPTION
Berkst reads in the symbol and string tables from the executable object file whose name is given in objfile and converts them to 4.2bsd format as defined by nlist.h(5). This function is similar to nlist(3), except that berkst provides a pointer to an array with a definition for every symbol in the symbol table.

The arguments symboltable and stringtable are the address of pointers that berkst will fill in with the location of the tables. Space for the tables is allocated with malloc(3).

Berkstall reads and converts every symbol in the symbol table, while Berkst reads and converts only symbol definitions.

RETURN VALUE
Returns the number of bytes of symbol table read or -1 if it could not read the tables. No memory will have been allocated if -1 is returned.

SEE ALSO
nlist(3), a.out(5), stab(5)

BUGS
Berkst will never create an entry whose n_type field is N_BSS. It considers all non-text symbols to be in the data segment. Use Berkstall to find out about bss symbols.