.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$VOS91CC$
.tt 2 $$$
.tt 3 $R.Roedling$STOP$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  :       STOP
=========
.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;.sp;.cp 3
AuthAuthor  : R.Roedling
.sp .sp
.cp .cp 3
CreaCreated : 1992-10-10
.sp .sp
.cp .cp 3
VersVersion : 1994-01-27
.sp .sp
.cp .cp 3
ReleRelease :  6.1.1         Date : 1994-09-23
.br .br
.sp .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 - XSTOP
 */

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


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


#if defined(_WIN32)
 #if defined(RUN_AS_SERVICE)
  #define OPTION_STRING             "d:n:p"
 #else
  #define OPTION_STRING             "d:p"
 #endif
#else
 #define OPTION_STRING             "d:p"
#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;
  BOOL                                   fDump                 = FALSE;
   BOOL                                  fStopService          = TRUE;

  DBGIN;

  while ( (OptionChar = sql80_GetOpt ( argc, argv, OPTION_STRING )) != -1 )
    {
    switch ( OptionChar )
      {
      case 'd' :
              pszServerDB = sql80_OptArg;
              break;
      case 'n' :
              if ( fDump == FALSE )
                pszNodeName   = sql80_OptArg;
              else
                fCommandError = TRUE;
              break;

      case 'p' :
              if ( pszNodeName == NULL )
                {
                fDump        = TRUE;
                fStopService = FALSE;
                }
              else
                fCommandError = TRUE;
              break;
      default :
              fCommandError = TRUE;
      }
    }

  if (( argc - sql80_OptInd )   ||
      ( fCommandError == TRUE ) ||
      ( pszServerDB   == NULL ))
    {
    #if defined(_WIN32)
     if (( sql02_get_platform_id() == VER_PLATFORM_WIN32_NT ))
       {
       printf (XSTOP_USAGE_NT);
       exit(0);
       }
    #endif

    printf (XSTOP_USAGE);
    exit(0);
    }

  #if defined(_WIN32)
  if (( sql02_get_platform_id() == VER_PLATFORM_WIN32_NT ) &&
      ( fStopService            == TRUE ))
     {
     rc = sql90_stop_db_gw_service ( pszNodeName, pszServerDB );
     DBGOUT;
     return( rc );
     }
  #endif

  rc = sql90_stop_serverdb ( pszServerDB, fDump );


  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
