D_OPEN(1)

NAME
d_open - open a database

SYNOPSIS
#include <typhoon.h>
d_open(char *dbname, char *mode)

DESCRIPTION
d_open opens a database in either shared or exclusive mode. If the database does not already exist it is created without warning. The dbd-file must be placed in the path specified by d_dbdpath(1) and the database files must be placed in the path specified by d_dbfpath(1). dbname is the name of the dbd-file without extension. mode is "s" or "x" for shared and exclusive mode, respectively. If d_open returns S_OKAY the database becomes the current database. If the database has already been opened by another process in exclusive mode, d_open returns S_UNAVAIL.

DIAGNOSTICS
The status code returned by the function is also stored in the global variable db_status.

S_OKAY
    Database opened successfully.

S_NOMEM
    Out of memory.

S_INVDB
    Invalid database name.

S_IOFATAL
    Fatal file i/o error.

S_NOTAVAIL
    The database has been opened in exclusive mode by another process.

CURRENCY CHANGES
The opened database becomes the current database.

IDENTIFICATION
Author: Thomas B. Pedersen.
Copyright (c) 1994 Thomas B. Pedersen.

SEE ALSO
d_dbdpath(1), d_dbfpath(1), d_setfiles(1), d_close(1), d_destroy(1), d_dbget(1).