misc.h 2.17 KB
Newer Older
1 2 3 4 5 6 7 8

/* File:            misc.h
 *
 * Description:     See "misc.c"
 *
 * Comments:        See "notice.txt" for copyright and license information.
 *
 */
9 10 11 12

#ifndef __MISC_H__
#define __MISC_H__

Byron Nikolaidis's avatar
Byron Nikolaidis committed
13
#ifdef HAVE_CONFIG_H
14
#include "config.h"
Byron Nikolaidis's avatar
Byron Nikolaidis committed
15 16
#endif

17
#ifndef WIN32
Byron Nikolaidis's avatar
Byron Nikolaidis committed
18 19 20 21
#include "gpps.h"
#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
#endif

22 23 24 25 26 27 28
#include <stdio.h>

/*	Uncomment MY_LOG define to compile in the mylog() statements.
	Then, debug logging will occur if 'Debug' is set to 1 in the ODBCINST.INI
	portion of the registry.  You may have to manually add this key.
	This logfile is intended for development use, not for an end user!
*/
29
#define MY_LOG
30 31 32 33 34


/*	Uncomment Q_LOG to compile in the qlog() statements (Communications log, i.e. CommLog).
	This logfile contains serious log statements that are intended for an
	end user to be able to read and understand.  It is controlled by the
35
	'CommLog' flag in the ODBCINST.INI portion of the registry (see above),
36 37 38 39 40 41
	which is manipulated on the setup/connection dialog boxes.
*/
#define Q_LOG


#ifdef MY_LOG
42 43 44 45 46 47
  #define MYLOGFILE	"mylog_"
  #ifndef WIN32
    #define MYLOGDIR	"/tmp"
  #else
    #define MYLOGDIR	"c:"
  #endif
Tom Lane's avatar
Tom Lane committed
48
  extern void mylog(char * fmt, ...);
49
#else
50 51 52
  #ifndef WIN32
    #define mylog(args...)	/* GNU convention for variable arguments */
  #else
53
    #define mylog    /* mylog */
54
  #endif
55 56 57
#endif

#ifdef Q_LOG
58 59 60 61 62 63
  #define QLOGFILE	"psqlodbc_"
  #ifndef WIN32
    #define QLOGDIR		"/tmp"
  #else
    #define QLOGDIR		"c:"
  #endif
Tom Lane's avatar
Tom Lane committed
64
  extern void qlog(char * fmt, ...);
65
#else
66 67 68
  #ifndef WIN32
    #define qlog(args...)	/* GNU convention for variable arguments */
  #else
69
    #define qlog    /* qlog */
70
  #endif
71 72
#endif

73
#ifndef WIN32
74
#define DIRSEPARATOR	"/"
75
#else
76
#define DIRSEPARATOR	"\\"
77 78
#endif

79
void remove_newlines(char *string);
80
char *strncpy_null(char *dst, const char *src, int len);
81 82 83 84 85 86 87 88 89 90
char *trim(char *string);
char *make_string(char *s, int len, char *buf);
char *my_strcat(char *buf, char *fmt, char *s, int len);

/* defines for return value of my_strcpy */
#define STRCPY_SUCCESS		1
#define STRCPY_FAIL			0
#define STRCPY_TRUNCATED	-1
#define STRCPY_NULL			-2

91
int my_strcpy(char *dst, int dst_len, char *src, int src_len);
92 93

#endif