.ad 8
.bm 8
.fm 4
.bt $Copyright (c) 1995-2005 SAP AG$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Datensicherung$vox00c$
.tt 2 $$$
.tt 3 $$BACKUP$$1998-03-10$
***********************************************************
.nf

.nf

.nf

    ========== licence begin  GPL
    Copyright (c) 1995-2005 SAP AG

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

    This program 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 General Public License for more details.

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


.fo


.fo
.nf
.sp
Module  :      BACKUP 
=========
.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 : 1998-03-10
.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 */


#ifndef VOX00_H
#define VOX00_H

#include	<windows.h>
#include	<stdio.h>
#include	<string.h>
#include	<time.h>
#include	<io.h>

#include	<sys/types.h>
#include	<sys/stat.h>


#if defined(WIN32)
	// WIN32 specific code
#elif defined(OS2)
	// OS2 specific code
	#error OS/2 not yet implemeted
#else
	// No OS version defined -> force a compiler error
	#error OS version required (f.e. WIN32)
#endif

/******************************************************************************/
// Some usefull constants

#ifndef PATH_MAX
#define	PATH_MAX		255
#endif

#ifndef ERROR_EXIT
#define	ERROR_EXIT		9		// Don't ask me why
#endif

#ifndef F_OK
#define F_OK			00
#endif

/******************************************************************************/
// Some usefull types

/******************************************************************************/
// Some usefull macros

#define	BOOLSTR(bval) (bval == TRUE ? "TRUE" : "FALSE")

// ATTENTION: Using PSTRING DO NOT increment psz !!!
#define PSTRING(psz) (psz == NULL ? "(NULL)" : psz )


// Output macros and routines

#define	FNAME	vox12_BaseName(__FILE__)
#define	FLINE	__LINE__

#ifdef DEBUG

	#define	ERROUT0(format)			vox11_ErrOut(FNAME,FLINE,format);
	#define	ERROUT1(format,a)		vox11_ErrOut(FNAME,FLINE,format,a);
	#define	ERROUT2(format,a,b)		vox11_ErrOut(FNAME,FLINE,format,a,b);
	#define	ERROUT3(format,a,b,c)	vox11_ErrOut(FNAME,FLINE,format,a,b,c);
	#define	ERROUT4(format,a,b,c,d)	vox11_ErrOut(FNAME,FLINE,format,a,b,c,d);
	

#else

	#define	ERROUT0(format)			vox11_FileOut(stdout,format);
	#define	ERROUT1(format,a)		vox11_FileOut(stdout,format,a);
	#define	ERROUT2(format,a,b)		vox11_FileOut(stdout,format,a,b);
	#define	ERROUT3(format,a,b,c)	vox11_FileOut(stdout,format,a,b,c);
	#define	ERROUT4(format,a,b,c,d)	vox11_FileOut(stdout,format,a,b,c,d);

#endif


#define	PROCOUT0(format)		if ( vox11_bQuiet == FALSE ) vox11_FileOut(stdout,format)
#define	PROCOUT1(format,a)		if ( vox11_bQuiet == FALSE ) vox11_FileOut(stdout,format,a)
#define	PROCOUT2(format,a,b)	if ( vox11_bQuiet == FALSE ) vox11_FileOut(stdout,format,a,b)
#define	PROCOUT3(format,a,b,c)	if ( vox11_bQuiet == FALSE ) vox11_FileOut(stdout,format,a,b,c)

#define	VERBOSE0(format)		if ( vox11_bVerbose == TRUE ) vox11_FileOut(stdout,format)
#define	VERBOSE1(format,a)		if ( vox11_bVerbose == TRUE ) vox11_FileOut(stdout,format,a)
#define	VERBOSE2(format,a,b)	if ( vox11_bVerbose == TRUE ) vox11_FileOut(stdout,format,a,b)
#define	VERBOSE3(format,a,b,c)	if ( vox11_bVerbose == TRUE ) vox11_FileOut(stdout,format,a,b,c)

/******************************************************************************/

// vox11: Errorhandling

extern BOOL vox11_bVerbose;
extern BOOL vox11_bQuiet;

int vox11_Init ( char *prognane );

void vox11_ErrOut ( char *fname, int fline, char *format, ...);
void vox11_FileOut ( FILE *fp, char *format, ...);

void vox11_SetErrorCode ( int errorcode );
void vox11_SetErrorMsg ( char *errormsg );

int vox11_GetErrorCode();
char *vox11_GetErrorMsg();

extern int iErrorCode;
extern char szErrorMsg[];			// look at vox11c.c for more informations

/******************************************************************************/

// vox12: Some functions for file, directory checks, and other system dependent tools

#if defined(WIN32)
	typedef DWORD	TPID;		// Declaration of a common process-id type
	#define	TPID_ERROR		0L
#elif defined(OS2)
#else
#endif

int vox12_Init ( );

BOOL vox12_CheckFile ( char *filename );
BOOL vox12_CheckFiles ( unsigned num, ... );
BOOL vox12_CheckDir ( char *dirname );
BOOL vox12_CheckDirs ( unsigned num, ... );

char *vox12_BaseName ( char *filename );
char *vox12_DirName ( char *filename );		// Not yet implemented

char *vox12_GetTempDir();					// Get the current temporary directory
char *vox12_GetOSName();					// Get name of operating system
char *vox12_GetHostName();					// Get own hostname
TPID vox12_GetPID ( void );					// Get own process-id
char *vox12_GetEnv ( char *var );			// Get environment variable

int vox12_ChangeDir ( char *dir );			// Change the current directory

int vox12_RemoveFile ( char *filename );	// Remove a file

TPID vox12_ExecCommand ( char *cmd );		// similar to 'system()'
TPID vox12_VExecCommand ( char *format, ... );	// similar to 'system()' with variable argument list (like 'printf')
int vox12_WaitForProcess ( TPID pid );
int vox12_KillProcess ( TPID pid );

/******************************************************************************/

// vox13: Database informations

typedef enum { DB_OFFLINE, DB_COLD, DB_WARM } TDBState;

int vox13_Init ( );

char *vox13_DBStateStr ( TDBState dbstate );

int vox13_DBGetState ( char *dbroot, char *dbname, TDBState *dbstate );
int vox13_DBGetParam ( char *dbroot, char *dbname, char *param, char *value );

/******************************************************************************/

// vox14: Search in files and commandline analyzis

#define	LINE_LEN	255		// max. line len to be scanned by the following function

typedef struct
{
	unsigned	Num;
	char		**String;
} TStringArray;

int vox14_Init ( );

void vox14_StringArrayReset ( TStringArray *array );
char *vox14_StringArrayAppend ( TStringArray *array, char *pstring );

// Call 'StringArrayReset()' after using 'SearchInFile()' to free some memory allocated by 
// this function
int vox14_SearchInFile ( char *filename, char *searchstring, BOOL regex, TStringArray *lines );

// Format: param=value. Returns value or NULL
char *vox14_AssignmentGetValue ( char *string );	


// Command line analyzis

typedef struct
{
	char	cOption;			// In	Name of option
	BOOL	bRequired;			// In	Option must have a value ?	
	BOOL	bSet;				// Out	Option is set
	char	*pszValue;			// Out	Value of option
} TParam;

int vox14_ParamAnalyzis ( unsigned argc, char *argv[], TParam param[], char *usage[] );
int vox14_ParamGetIndex ( TParam param[], char option );
char *vox14_ParamGetValue ( TParam param[], char option );
BOOL vox14_ParamIsSet ( TParam param[], char option );	

/******************************************************************************/
// Console and Cursorhandling

int vox15_Init ( void );
int vox15_SetMutex ( void );
int vox15_ClearScreen ( void );
int vox15_PrintAtPos ( unsigned line, unsigned col, char *format, ... );

/******************************************************************************/

#endif

/*
 * =============================== 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
