1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
/*
* Copyright (c) mjh-EDV Beratung, 1996-1999
* mjh-EDV Beratung - 63263 Neu-Isenburg - Rosenstrasse 12
* Tel +49 6102 328279 - Fax +49 6102 328278
* Email info@mjh.teddy-net.com
*
* Author: Jordan Hrycaj <jordan@mjh.teddy-net.com>
*
* $Id: common-stuff.w32,v 1.7 2001/01/02 12:16:18 jordan Exp $
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* @(#) public _WIN32 defs from common-stuff.c
*/
#ifdef _WIN32
#ifndef __COMMON_STUFF_W32__
#define __COMMON_STUFF_W32__
#include <windows.h>
#include <stdio.h>
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_PROCESS_H
# include <process.h>
# ifdef HAVE__GETPID
# define getpid() _getpid ()
# endif
#endif
#ifdef HAVE_TIME_H
# include <time.h>
#endif
#undef OS_SEBD
#define OS_SEND(fd,buf,len,flg) __peks_nt_send (fd, buf, len, flg)
#undef OS_RECV
#define OS_RECV(fd,buf,len,flg) __peks_nt_recv (fd, buf, len, flg)
extern char * __peks_nt_getcwd (char *, unsigned);
extern time_t __peks_nt_mktime (struct tm *);
extern int __peks_nt_read (HANDLE fd, char *buf, unsigned len);
extern int __peks_nt_write (HANDLE fd, char *buf, unsigned len);
extern HANDLE __peks_nt_open (const char *, unsigned, unsigned);
extern int __peks_nt_close (HANDLE fd);
extern FILE * __peks_nt_fopen (const char *file, const char *mode);
extern int __peks_nt_rename (const char *old, const char *newf);
extern void __peks_nt_exit (int rcode);
extern int __peks_nt_printf (const char *format, ...);
extern int __peks_nt_fprintf (FILE *, const char *format, ...);
extern char * __peks_nt_getpass (char *prompt);
extern char * __peks_nt_fgets (char *buf, int len, FILE *);
extern char * __peks_nt_gets (char *buf);
extern void __peks_nt_setconsole (unsigned, unsigned, unsigned, unsigned);
extern int __peks_nt_send (SOCKET, const char *, int, int);
extern int __peks_nt_recv (SOCKET, char *, int, int);
extern unsigned long __peks_nt_wait_for_exit (unsigned long m) ;
#ifdef HAVE__STRICMP
# define strcasecmp(s,t) _stricmp(s,t)
# define strncasecmp(s,t,n) _strnicmp(s,t,n)
# undef HAVE_STRCASECMP
# define HAVE_STRCASECMP 1
#endif
#define getcwd(buf,size) __peks_nt_getcwd (buf, size)
#define mktime(x) __peks_nt_mktime (x)
#define open(file,mode) __peks_nt_open (file,mode,0)
#define open3(file,mode,msk) __peks_nt_open (file,mode,msk)
#define close(fd) __peks_nt_close (fd)
#define read(fd, buf, len) __peks_nt_read (fd, buf, len)
#define write(fd, buf, len) __peks_nt_write (fd, buf, len)
#define fopen(file, mode) __peks_nt_fopen (file, mode)
#define rename(old,newf) __peks_nt_rename (old, newf)
#define exit(rcode) __peks_nt_exit (rcode)
#define printf __peks_nt_printf
#define puts(txt) __peks_nt_printf ("%s\r\n", txt)
#undef putc
#define putc(c) __peks_nt_printf ("%c", c)
#define fprintf __peks_nt_fprintf
#define fputs(txt,fp) __peks_nt_fprintf (fp, "%s", txt)
#define fputc(c,fp) __peks_nt_fprintf (fp, "%c", c)
#define getpass(prompt) __peks_nt_getpass (prompt)
#define fgets(buf,len,fp) __peks_nt_fgets (buf,len,fp)
#define gets(buf) __peks_nt_gets (buf)
#define fflush(fp) 0 /* not used */
#define ntconsole(x,y,a,b) __peks_nt_setconsole (x,y,a,b)
#define M_HIDDEN 01000 /* creation mask, M$ only */
#define M_RDONLY 02000 /* M$ emulation, only */
#define OPEN_ERROR INVALID_HANDLE_VALUE
#ifndef O_RDONLY
# define O_RDONLY 1
# define O_WRONLY 2
# define O_RDWR 4 /* 3 would do, as well */
# define O_CREAT 8
# define O_TRUNC 16
# define O_EXCL 32
# define O_APPEND 64
#endif /* O_RDONLY */
#endif /* __COMMON_STUFF_W32__ */
#endif /* _WIN32 */
|