=pod

=head1 NAME

unibi_from_mem - construct a terminal object from a compiled terminfo entry

=head1 SYNOPSIS

 #include <unibilium.h>
 
 unibi_term *unibi_from_mem(const char *p, size_t n);

=head1 DESCRIPTION

This function parses a compiled terminfo entry that starts at I<p> and is I<n>
bytes long, and constructs a C<unibi_term> object from it. When you're done
with this object, you should call C<unibi_destroy> to free it.

C<unibi_from_mem> parses both the traditional ncurses terminfo format (starting
with the bytes C<1A 01>) and the newer "wide integer" format (starting with the
bytes C<1E 02>).

=head1 RETURN VALUE

A pointer to a new C<unibi_term>. In case of failure, C<NULL> is returned and
C<errno> is set.

=head1 ERRORS

=over

=item C<EINVAL>

The bytes I<p> points at don't look like a valid terminfo entry.

=item C<EFAULT>

I<n> is too small for a valid terminfo entry.

=back

=head1 SEE ALSO

L<unibilium.h(3)>,
L<unibi_dump(3)>,
L<unibi_destroy(3)>,
L<unibi_from_fp(3)>,
L<unibi_from_fd(3)>,
L<unibi_from_file(3)>,
L<unibi_from_term(3)>,
L<unibi_from_env(3)>

=cut
