.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$vos14uc$
.tt 2 $$$
.tt 3 $$ N A M E $1997-01-31$
***********************************************************
.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  :
=========
.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  :
.sp
.cp 3
Created :
.sp
.cp 3
Version :
.sp
.cp 3
Release :  6.2 	 Date : 1997-01-31
.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 - SQLTERMID
//


//
//  INCLUDE FILES
//


//
//  DEFINES
//

#define MOD__  "VOS14UC : "
#define MF__   MOD__"UNDEFINED"

#define TERMID                  C18


//
//  MACROS
//


//
//  LOCAL TYPE AND STRUCT DEFINITIONS
//


//
//  EXTERNAL VARIABLES
//
extern SQL_NODEIDC                szLocalNodeName;   // --- VEN03UC


//
//  EXPORTED VARIABLES
//


//
//  LOCAL VARIABLES
//


//
//  LOCAL FUNCTION PROTOTYPES
//


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

VOID    sqltermid   (   TERMID  acTerminalId    )
  {
  #undef  MF__
  #define MF__ MOD__"sqltermid"

  CHAR         szPid[10];
  CHAR         szTermid[sizeof (TERMID) + 1];
  PID          pid;
  SQL_NODEIDC  szHostName;
  PSZ          pszNode;
  LONG         rc;

  DBGPAS;

  memset ( szTermid, 0, sizeof (szTermid));

  GETPROCESSID(&pid);
  _ultoa ( pid, szPid, 16 );
  strupr ( szPid );

  if ( szLocalNodeName[0] == '\0' )
    {
    rc = sql43c_get_my_host_name ( szHostName, sizeof(szHostName) );

    if ( rc == NO_ERROR )
      pszNode = szHostName;
    else
      pszNode = NULL;
    }
  else
    pszNode = szLocalNodeName;

  if ( pszNode == NULL )
    {
    strcpy ( szTermid, "PID:" );
    }
  else if ( strlen (pszNode) + strlen (szPid)  > sizeof (TERMID) - 1)
    {
    strncpy ( szTermid, pszNode, sizeof (TERMID) - strlen (szPid) - 2 );
    strcat  ( szTermid, "..");
    }
  else
    {
    strcpy ( szTermid, pszNode );
    strcat ( szTermid, " ");
    }

  strcat ( szTermid, szPid);

  sql47c_ctop ( acTerminalId, szTermid, sizeof ( TERMID ));
  }

// ----------------------------------------------------------------------------


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


//
// =============================== END ========================================
//
.CM *-END-* code ----------------------------------------
.SP 2
***********************************************************
.PA
