.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$vos10uc$
.tt 2 $$$
.tt 3 $$SQLREAD/SQLWRITE$1994-02-04$
***********************************************************
.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  : SQLREAD/SQLWRITE
=========
.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 : 28.9.92
.sp
.cp 3
Version :
.sp
.cp 3
Release :  6.1.1 	 Date : 1994-10-27
.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*/


//
// INCLUDE FILES
//


//
//  DEFINES
//

#define MOD__  "VOS10UC : "
#define MF__   MOD__"UNDEFINED"


//
//  MACROS
//


//
//  LOCAL TYPE AND STRUCT DEFINITIONS
//


//
//  EXTERNAL VARIABLES
//


//
//  EXPORTED VARIABLES
//


//
//  LOCAL VARIABLES
//


//
//  LOCAL FUNCTION PROTOTYPES
//


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


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


VOID sqlread ( C132  acLine, PBOOLEAN pbOk )
  {
  #undef  MF__
  #define MF__ MOD__"sqlread"
  APIRET  rc;
  ULONG   ulRead;
  C132C   acLineC;

  #if defined(_WIN32)
   HANDLE  StdIn;
  #endif

  DBGIN;

  //
  // --- Read string from stdin
  //
  #if defined(_WIN32)
   StdIn = GetStdHandle(STD_INPUT_HANDLE);

   if ( StdIn == INVALID_HANDLE_VALUE )
     rc = GetLastError();
   else if ( !ReadFile( StdIn, acLineC, sizeof ( C132C ), &ulRead, NULL ))
     rc = GetLastError();
  #else
   rc = DosRead ( STDIN, acLineC, sizeof ( C132C ), &ulRead );
  #endif


  if ((rc != NO_ERROR) || ( ulRead == 0 ))
    {
    *pbOk = FALSE;
    memset ( acLine,  ' ', sizeof ( C132  ));
    }
  else
    {
    *pbOk = TRUE;
    sql47c_ctop ( acLine, acLineC, sizeof ( C132 ));
    }

  DBGOUT;
  return;
  }


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


VOID sqlwrite ( C132 acLine )
  {
  #undef  MF__
  #define MF__ MOD__"sqlwrite"


  ULONG   ulWritten;
  char    acLineC [sizeof(C132C) + 2];


  DBGIN;

  acLineC[0]                  = '\0';
  sql47c_ptoc ( acLineC, acLine, sizeof ( C132 ));
  strcat ( acLineC, "\r\n" );

  //
  // --- Write string to stdout
  //
  #if defined(_WIN32)
   WriteFile( GetStdHandle(STD_OUTPUT_HANDLE),
              acLineC, strlen ( acLineC ), &ulWritten, NULL );
  #else
   DosWrite ( STDOUT, acLineC, strlen ( acLineC ), &ulWritten );
  #endif


  DBGOUT;
  return;
  }


//
// ================================= END ======================================
//

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