Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
AFOPEN(3)			    Amberfish			       AFOPEN(3)

NAME
     afopen - open a database

SYNOPSIS
     #include af.h

     int afopen(const Afopen *r, Afopen_r *rr);

DESCRIPTION
     The afopen function opens a database so that it can be accessed for search-
     ing, updating, etc.

     The  argument  r specifies a set of options defined by the following struc-
     ture:

     typedef struct {
	  char *dbpath;
	  char *mode;
	  int phrase;
	  int stem;
     } Afopen;

     The dbpath option specifies the database to be opened, consisting of a path
     name.  The file names that make up the database are constructed by  append-
     ing suffixes to this path name.

     The mode option specifies how the database will be accessed:

     r	    Open  database  for  reading.   This  opens  the  database files for
	    searching or other read-only access.

     r+     Open database for reading and writing.  This is commonly used to add
	    to or modify an existing database.

     w+     Open database for reading and writing; the database is created if it
	    does not exist, and otherwise its contents are erased.

RETURN VALUE
     This function returns 0 if it exited normally.  If an  error  occurred,  it
     returns -1 and aferrno is set.

     If  the  function exited normally, the structure pointed to by rr is filled
     in with the following values:

     typedef struct {
	  Uint2 dbid;
     } Afopen_r;

     The dbid value is a database descriptor that can be used to  refer  to  the
     database while it remains open.

ERRORS
     In addition to the set of "core" errors, this function can return:

     AFEDBLOCK
	    The database is locked.

     AFEOPENLIM
	    Too many open databases.

     AFEVERSION
	    The  database  was	created with an earlier, incompatible version of
	    this library.

								       AFOPEN(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=afopen&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help