Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Main
Synchronet
Commits
a172a8fc
Commit
a172a8fc
authored
Apr 06, 2002
by
rswindell
Browse files
Switched from #ifdef to #if defined.
parent
5d9d2135
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
73 deletions
+69
-73
src/xpdev/dirwrap.c
src/xpdev/dirwrap.c
+23
-23
src/xpdev/dirwrap.h
src/xpdev/dirwrap.h
+13
-16
src/xpdev/filewrap.h
src/xpdev/filewrap.h
+9
-9
src/xpdev/gen_defs.h
src/xpdev/gen_defs.h
+4
-4
src/xpdev/genwrap.c
src/xpdev/genwrap.c
+9
-10
src/xpdev/genwrap.h
src/xpdev/genwrap.h
+10
-10
src/xpdev/sockwrap.h
src/xpdev/sockwrap.h
+1
-1
No files found.
src/xpdev/dirwrap.c
View file @
a172a8fc
...
...
@@ -37,28 +37,28 @@
#include <string.h>
/* strrchr */
#ifdef
_WIN32
#if
def
ined(
_WIN32
)
#include <windows.h>
/* WINAPI, etc */
#include <io.h>
/* _findfirst */
#include <windows.h>
/* WINAPI, etc */
#include <io.h>
/* _findfirst */
#elif defined __unix__
#include <unistd.h>
/* usleep */
#include <fcntl.h>
/* O_NOCCTY */
#include <ctype.h>
/* toupper */
#include <unistd.h>
/* usleep */
#include <fcntl.h>
/* O_NOCCTY */
#include <ctype.h>
/* toupper */
#ifdef
__FreeBSD__
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/kbio.h>
#endif
#if
def
ined(
__FreeBSD__
)
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/kbio.h>
#endif
#include <sys/ioctl.h>
/* ioctl */
#include <sys/ioctl.h>
/* ioctl */
#ifdef
__GLIBC__
/* actually, BSD, but will work for now */
#include <sys/vfs.h>
/* statfs() */
#endif
#if
def
ined(
__GLIBC__
)
/* actually, BSD, but will work for now */
#include <sys/vfs.h>
/* statfs() */
#endif
#endif
/* __unix__ */
...
...
@@ -99,7 +99,7 @@ static int glob_compare( const void *arg1, const void *arg2 )
return
stricmp
(
*
(
char
**
)
arg1
,
*
(
char
**
)
arg2
);
}
#ifdef
__BORLANDC__
#if
def
ined(
__BORLANDC__
)
#pragma argsused
#endif
...
...
@@ -256,7 +256,7 @@ time_t DLLCALL fdate(char *filename)
/****************************************************************************/
long
DLLCALL
flength
(
char
*
filename
)
{
#ifdef
__BORLANDC__
/* stat() doesn't work right */
#if
def
ined(
__BORLANDC__
)
/* stat() doesn't work right */
long
handle
;
struct
_finddata_t
f
;
...
...
@@ -293,7 +293,7 @@ long DLLCALL flength(char *filename)
/****************************************************************************/
BOOL
DLLCALL
fexist
(
char
*
filespec
)
{
#ifdef
_WIN32
#if
def
ined(
_WIN32
)
long
handle
;
struct
_finddata_t
f
;
...
...
@@ -369,7 +369,7 @@ BOOL DLLCALL isdir(char *filename)
/****************************************************************************/
int
DLLCALL
getfattr
(
char
*
filename
)
{
#ifdef
_WIN32
#if
def
ined(
_WIN32
)
long
handle
;
struct
_finddata_t
finddata
;
...
...
@@ -394,14 +394,14 @@ int DLLCALL getfattr(char* filename)
/****************************************************************************/
/* Return free disk space in bytes (up to a maximum of 4GB) */
/****************************************************************************/
#ifdef
_WIN32
#if
def
ined(
_WIN32
)
typedef
BOOL
(
WINAPI
*
GetDiskFreeSpaceEx_t
)
(
LPCTSTR
,
PULARGE_INTEGER
,
PULARGE_INTEGER
,
PULARGE_INTEGER
);
#endif
ulong
DLLCALL
getfreediskspace
(
char
*
path
)
{
#ifdef
_WIN32
#if
def
ined(
_WIN32
)
char
root
[
16
];
DWORD
TotalNumberOfClusters
;
DWORD
NumberOfFreeClusters
;
...
...
@@ -424,14 +424,14 @@ ulong DLLCALL getfreediskspace(char* path)
&
size
,
// receives the number of bytes on disk
NULL
))
// receives the free bytes on disk
return
(
0
);
#ifdef
_ANONYMOUS_STRUCT
#if
def
ined(
_ANONYMOUS_STRUCT
)
if
(
avail
.
HighPart
)
#else
if
(
avail
.
u
.
HighPart
)
#endif
return
(
0xffffffff
);
/* 4GB max */
#ifdef
_ANONYMOUS_STRUCT
#if
def
ined(
_ANONYMOUS_STRUCT
)
return
(
avail
.
LowPart
);
#else
return
(
avail
.
u
.
LowPart
);
...
...
src/xpdev/dirwrap.h
View file @
a172a8fc
...
...
@@ -40,20 +40,20 @@
#include "gen_defs.h"
/* ulong */
#ifdef
DLLEXPORT
#undef DLLEXPORT
#if
def
ined(
DLLEXPORT
)
#undef DLLEXPORT
#endif
#ifdef
DLLCALL
#undef DLLCALL
#if
def
ined(
DLLCALL
)
#undef DLLCALL
#endif
#ifdef
_WIN32
#ifdef
WRAPPER_DLL
#if
def
ined(
_WIN32
)
#if
def
ined(
WRAPPER_DLL
)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef
__BORLANDC__
#if
def
ined(
__BORLANDC__
)
#define DLLCALL __stdcall
#else
#define DLLCALL
...
...
@@ -63,21 +63,15 @@
#define DLLCALL
#endif
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
extern
"C"
{
#endif
#ifdef _MSC_VER
#include "msdirent.h"
#else
#include <dirent.h>
/* POSIX directory functions */
#endif
/****************/
/* RTL-specific */
/****************/
#ifdef
__unix__
#if
def
ined(
__unix__
)
#define ALLFILES "*"
/* matches all files in a directory */
#include <glob.h>
/* POSIX.2 directory pattern matching function */
...
...
@@ -159,8 +153,11 @@ extern "C" {
struct
dirent
*
readdir
(
DIR
*
__dir
);
int
closedir
(
DIR
*
__dir
);
void
rewinddir
(
DIR
*
__dir
);
#else
#include <dirent.h>
/* POSIX directory functions */
#endif
/**********/
/* Macros */
/**********/
...
...
@@ -205,7 +202,7 @@ DLLEXPORT char* DLLCALL getfname(char* path);
DLLEXPORT
int
DLLCALL
getfattr
(
char
*
filename
);
DLLEXPORT
ulong
DLLCALL
getfreediskspace
(
char
*
path
);
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
}
#endif
...
...
src/xpdev/filewrap.h
View file @
a172a8fc
...
...
@@ -82,20 +82,20 @@
/* Prototypes */
/**************/
#ifdef
DLLEXPORT
#undef DLLEXPORT
#if
def
ined(
DLLEXPORT
)
#undef DLLEXPORT
#endif
#ifdef
DLLCALL
#undef DLLCALL
#if
def
ined(
DLLCALL
)
#undef DLLCALL
#endif
#ifdef
_WIN32
#ifdef
WRAPPER_DLL
#if
def
ined(
_WIN32
)
#if
def
ined(
WRAPPER_DLL
)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef
__BORLANDC__
#if
def
ined(
__BORLANDC__
)
#define DLLCALL __stdcall
#else
#define DLLCALL
...
...
@@ -105,7 +105,7 @@
#define DLLCALL
#endif
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
extern
"C"
{
#endif
...
...
@@ -121,7 +121,7 @@ extern "C" {
DLLEXPORT
time_t
DLLCALL
filetime
(
int
fd
);
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
}
#endif
...
...
src/xpdev/gen_defs.h
View file @
a172a8fc
...
...
@@ -38,9 +38,9 @@
#ifndef _GEN_DEFS_H
#define _GEN_DEFS_H
#ifdef
_WIN32
#define WIN32_LEAN_AND_MEAN
/* Don't bring in excess baggage */
#include <windows.h>
#if
def
ined(
_WIN32
)
#define WIN32_LEAN_AND_MEAN
/* Don't bring in excess baggage */
#include <windows.h>
#endif
#include <sys/types.h>
...
...
@@ -88,7 +88,7 @@ enum {
};
#ifndef MAX_PATH
#ifdef MAXPATHLEN
#if
def
ined
MAXPATHLEN
#define MAX_PATH MAXPATHLEN
/* clib.h */
#elif defined PATH_MAX
#define MAX_PATH PATH_MAX
...
...
src/xpdev/genwrap.c
View file @
a172a8fc
...
...
@@ -39,13 +39,12 @@
#include <stdlib.h>
/* RAND_MAX */
#include <fcntl.h>
/* O_NOCTTY */
#ifdef __unix__
#ifndef __FreeBSD__
#include <sys/kd.h>
/* KIOCSOUND */
#endif
#ifdef __FreeBSD__
#include <sys/kbio.h>
#endif
#if defined(__unix__)
/* KIOCSOUND */
#if defined(__FreeBSD__)
#include <sys/kbio.h>
#else
#include <sys/kd.h>
#endif
/* __unix__ */
#include "genwrap.h"
/* Verify prototypes */
...
...
@@ -53,7 +52,7 @@
/****************************************************************************/
/* Convert ASCIIZ string to upper case */
/****************************************************************************/
#ifdef
__unix__
#if
def
ined(
__unix__
)
char
*
DLLCALL
strupr
(
char
*
str
)
{
char
*
p
=
str
;
...
...
@@ -95,7 +94,7 @@ char* strrev(char* str)
/* Generate a tone at specified frequency for specified milliseconds */
/* Thanks to Casey Martin for this code */
/****************************************************************************/
#ifdef
__unix__
#if
def
ined(
__unix__
)
void
DLLCALL
unix_beep
(
int
freq
,
int
dur
)
{
static
int
console_fd
=-
1
;
...
...
@@ -114,7 +113,7 @@ void DLLCALL unix_beep(int freq, int dur)
/****************************************************************************/
/* Return random number between 0 and n-1 */
/****************************************************************************/
#if
n
def
__BORLANDC__
#if
!
def
ined(
__BORLANDC__
j)
int
DLLCALL
xp_random
(
int
n
)
{
float
f
;
...
...
src/xpdev/genwrap.h
View file @
a172a8fc
...
...
@@ -41,20 +41,20 @@
#include <stdio.h>
/* sprintf */
#include "gen_defs.h"
/* ulong */
#ifdef
DLLEXPORT
#undef DLLEXPORT
#if
def
ined(
DLLEXPORT
)
#undef DLLEXPORT
#endif
#ifdef
DLLCALL
#undef DLLCALL
#if
def
ined(
DLLCALL
)
#undef DLLCALL
#endif
#ifdef
_WIN32
#ifdef
WRAPPER_DLL
#if
def
ined(
_WIN32
)
#if
def
ined(
WRAPPER_DLL
)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef
__BORLANDC__
#if
def
ined(
__BORLANDC__
)
#define DLLCALL __stdcall
#else
#define DLLCALL
...
...
@@ -64,7 +64,7 @@
#define DLLCALL
#endif
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
extern
"C"
{
#endif
...
...
@@ -167,11 +167,11 @@ extern "C" {
#endif
#ifdef
__BORLANDC__
#if
def
ined(
__BORLANDC__
)
#define xp_random random
#endif
#ifdef
__cplusplus
#if
def
ined(
__cplusplus
)
}
#endif
...
...
src/xpdev/sockwrap.h
View file @
a172a8fc
...
...
@@ -68,7 +68,7 @@
/**********************************/
/* Socket Implementation-specific */
/**********************************/
#ifdef
_WINSOCKAPI_
#if
def
ined(
_WINSOCKAPI_
)
#undef EINTR
#define EINTR (WSAEINTR-WSABASEERR)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment