srv_init

Description

Initialize an Open Server application.

Syntax

SRV_SERVER *srv_init(scp, servernamep, namelen)
SRV_CONFIG       *scp;
CS_CHAR            *servernamep;
CS_INT               namelen;

Parameters

scp

The configuration structure that holds the values of all the Open Server configuration options. This argument is optional. It is included for backward compatibility.

servernamep

A pointer to the Open Server application name. The name you supply is looked up in the interfaces file to get the necessary network information. If you use (CS_CHAR *) NULL as the Open Server name, the value of DSLISTEN will be the server’s name. If DSLISTEN has not been explicitly set, the name defaults to the string “SYBASE”.

namelen

The length, in bytes, of the string in *servernamep. If the string is (CS_CHAR *) NULL, namelen is ignored. If the string is null terminated, namelen can be CS_NULLTERM.

Returns

Table 3-57: Return values (srv_init)

Returns

To indicate

SRV_SERVER pointer

The routine ran successfully.

(SRV_SERVER *) NULL

The routine failed.

Examples

Example 1

#include <ospublic.h>
/*
 ** Local prototype.
 */
SRV_SERVER    *ex_srv_init PROTOTYPE((
SRV_CONFIG    *scp
));
/*
 ** EX_SRV_INIT
**
**    Example routine to initialize an Open Server application.
**
** Arguments:
**    scp   -   A pointer to the configuration structure.
 **
** Returns:
**    On success, a pointer to a newly allocated SRV_SERVER
       structure.
**    On failure, NULL.
 **
 */
SRV_SERVER   *ex_srv_init(scp)
SRV_CONFIG   *scp;
{
    SRV_SERVER   *server;
    CS_CHAR      *servername = “EX_SERVER”;
    server = srv_init(scp, servername, CS_NULLTERM);
    return (server);
}

Usage

See also

srv_props, srv_run, srv_version