.ad 8
.bm 8
.fm 4
.bt $Copyright by   Software AG, 1993$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $NME$Project Distributed Database System$VOS90CC$
.tt 2 $$$
.tt 3 $R.Roedling$STRT$1997-05-07$
***********************************************************
.nf


    ========== licence begin LGPL
    Copyright (C) 2002 SAP AG

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    ========== licence end

.fo
.nf
.sp
Module  :       START
=========
.sp
Purpose :
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :

.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :

.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :

.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  : R.Roedling
.sp
.cp 3
Created : 1992-10-10
.sp
.cp 3
Version : 1994-01-27
.sp
.cp 3
Release :  6.2 	 Date : 1997-05-07
.br
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:

.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:

.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:

.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
/* PRETTY */

/*
 * MODULE - XSTART
 */

/*
 * INCLUDE FILES
 */
#include           <stdarg.h>

/*
 *  DEFINES
 */
#define MOD__  "VOS90CC : "
#define MF__   MOD__"UNDEFINED"

#if defined(_WIN32)
 #define OPTION_STRING             "id:s:q:n:g"
#else
 #define OPTION_STRING             "d:s:q:a"
#endif

/*
 *  MACROS
 */


/*
 *  LOCAL TYPE AND STRUCT DEFINITIONS
 */


/*
 * EXTERNAL VARIABLES
 */
extern int        sql80_OptInd;
extern int        sql80_OptErr;
extern char*      sql80_OptArg;


/*
 *  EXPORTED VARIABLES
 */


/*
 * LOCAL VARIABLES
 */


/*
 * LOCAL FUNCTION PROTOTYPES
 */


/*
 * ========================== GLOBAL FUNCTIONS ================================
 */

INT _CDECL  main (INT     argc, CHAR   *argv[])
  {
  #undef  MF__
  #define MF__ MOD__"main"
  INT                       OptionChar;
  APIRET                    rc                    = NO_ERROR;
  PSZ                       pszServerDB           = NULL;
  PSZ                       pszNodeName           = NULL;
  BOOL                      fCommandError         = FALSE;
  PSZ                       pszDBRoot;
  ULONG                     ulKernelType          = KERNEL_TYPE_FAST;
  ULONG                     ulOptions             = 0;
  BOOL                      fGateway              = FALSE;

  DBGIN;

  while ( (OptionChar = sql80_GetOpt ( argc, argv, OPTION_STRING )) != -1 )
    {
    switch ( OptionChar )
      {
      case 'g' :
              fGateway    = TRUE;
              break;
      case 'd' :
              pszServerDB = sql80_OptArg;
              break;
      case 'n' :
              pszNodeName = sql80_OptArg;
              break;
      case 's' :
              if (!strcmp ( sql80_OptArg, "low" ) && ( pszNodeName == NULL ) )
                {
                ulKernelType = KERNEL_TYPE_SLOW;
                }
              else
                fCommandError = TRUE;
              break;
      case 'q' :
              if (!strcmp ( sql80_OptArg, "uick" ) && ( pszNodeName == NULL ) )
                {
                ulKernelType = KERNEL_TYPE_QUICK;
                }
              else
                fCommandError = TRUE;
              break;
      case 'a' :
              ulOptions  |= AUTOCLOSE;
              break;
      case 'i' :
              ulOptions  |= IGNORE_AUTORESTART;
              break;
      default :
              fCommandError = TRUE;
      }
    }

  if ( fGateway )
    {
    switch ( ulKernelType )
      {
      case KERNEL_TYPE_FAST :
        ulKernelType  = KERNEL_TYPE_FAST_ORA_GW;
        break;
      case KERNEL_TYPE_SLOW :
        ulKernelType  = KERNEL_TYPE_SLOW_ORA_GW;
        break;
      default:
        fCommandError = TRUE;
        break;
      }
   }

  if ( (argc - sql80_OptInd) || (fCommandError == TRUE) )
    {
    #if defined(_WIN32)
     if ( sql02_get_platform_id() == VER_PLATFORM_WIN32_NT )
       printf (XSTART_USAGE_NT);
     else
       printf (XSTART_USAGE);
    #else
     printf (XSTART_USAGE);
    #endif
    exit(0);
    }


  if ( pszServerDB == NULL)
    {
    if ( sql01c_get_serverdb ( &pszServerDB  ) == FALSE )
      {
      printf (XSTART_USAGE);
      DBGOUT;
      exit(1);
      }
    }

  #if defined(_WIN32)
   if ( sql02_get_platform_id() == VER_PLATFORM_WIN32_NT )
     {
     rc = sql90_start_db_gw_service ( pszNodeName, pszServerDB,
                                      ulOptions, ulKernelType );

     DBGOUT;
     return( rc );
     }
  #endif

  // --- get DBROOT from Environment
  if ( sql01c_get_dbroot (&pszDBRoot) == FALSE )
    {
    MSGCD(( ERR_DBROOT_NOT_SET ));
    DBGOUT;
    exit(1);
    }

  rc = sql90_start_serverdb( pszServerDB, pszDBRoot,
                             ulOptions, ulKernelType );

  DBGOUT;
  return( rc );
  }

/*
 * ========================== LOCAL FUNCTIONS =================================
 */

/*
 * =============================== END ========================================
 */

.CM *-END-* code ----------------------------------------
.SP 2
***********************************************************
*-PRETTY-*  statements    :         38
*-PRETTY-*  lines of code :             38               PRETTY  1.07
*-PRETTY-*  lines in file :        141            1989-01-20
.PA
