Skip to content
Snippets Groups Projects
Commit a172a8fc authored by rswindell's avatar rswindell
Browse files

Switched from #ifdef to #if defined.

parent 5d9d2135
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,7 @@
#include <string.h> /* strrchr */
#ifdef _WIN32
#if defined(_WIN32)
#include <windows.h> /* WINAPI, etc */
#include <io.h> /* _findfirst */
......@@ -48,7 +48,7 @@
#include <fcntl.h> /* O_NOCCTY */
#include <ctype.h> /* toupper */
#ifdef __FreeBSD__
#if defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/kbio.h>
......@@ -56,7 +56,7 @@
#include <sys/ioctl.h> /* ioctl */
#ifdef __GLIBC__ /* actually, BSD, but will work for now */
#if defined(__GLIBC__) /* actually, BSD, but will work for now */
#include <sys/vfs.h> /* statfs() */
#endif
......@@ -99,7 +99,7 @@ static int glob_compare( const void *arg1, const void *arg2 )
return stricmp( * ( char** ) arg1, * ( char** ) arg2 );
}
#ifdef __BORLANDC__
#if defined(__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 defined(__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 defined(_WIN32)
long handle;
struct _finddata_t f;
......@@ -369,7 +369,7 @@ BOOL DLLCALL isdir(char *filename)
/****************************************************************************/
int DLLCALL getfattr(char* filename)
{
#ifdef _WIN32
#if defined(_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 defined(_WIN32)
typedef BOOL(WINAPI * GetDiskFreeSpaceEx_t)
(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
#endif
ulong DLLCALL getfreediskspace(char* path)
{
#ifdef _WIN32
#if defined(_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 defined(_ANONYMOUS_STRUCT)
if(avail.HighPart)
#else
if(avail.u.HighPart)
#endif
return(0xffffffff); /* 4GB max */
#ifdef _ANONYMOUS_STRUCT
#if defined(_ANONYMOUS_STRUCT)
return(avail.LowPart);
#else
return(avail.u.LowPart);
......
......@@ -40,20 +40,20 @@
#include "gen_defs.h" /* ulong */
#ifdef DLLEXPORT
#if defined(DLLEXPORT)
#undef DLLEXPORT
#endif
#ifdef DLLCALL
#if defined(DLLCALL)
#undef DLLCALL
#endif
#ifdef _WIN32
#ifdef WRAPPER_DLL
#if defined(_WIN32)
#if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __BORLANDC__
#if defined(__BORLANDC__)
#define DLLCALL __stdcall
#else
#define DLLCALL
......@@ -63,21 +63,15 @@
#define DLLCALL
#endif
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
#ifdef _MSC_VER
#include "msdirent.h"
#else
#include <dirent.h> /* POSIX directory functions */
#endif
/****************/
/* RTL-specific */
/****************/
#ifdef __unix__
#if defined(__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 defined(__cplusplus)
}
#endif
......
......@@ -82,20 +82,20 @@
/* Prototypes */
/**************/
#ifdef DLLEXPORT
#if defined(DLLEXPORT)
#undef DLLEXPORT
#endif
#ifdef DLLCALL
#if defined(DLLCALL)
#undef DLLCALL
#endif
#ifdef _WIN32
#ifdef WRAPPER_DLL
#if defined(_WIN32)
#if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __BORLANDC__
#if defined(__BORLANDC__)
#define DLLCALL __stdcall
#else
#define DLLCALL
......@@ -105,7 +105,7 @@
#define DLLCALL
#endif
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -121,7 +121,7 @@ extern "C" {
DLLEXPORT time_t DLLCALL filetime(int fd);
#ifdef __cplusplus
#if defined(__cplusplus)
}
#endif
......
......@@ -38,7 +38,7 @@
#ifndef _GEN_DEFS_H
#define _GEN_DEFS_H
#ifdef _WIN32
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN /* Don't bring in excess baggage */
#include <windows.h>
#endif
......@@ -88,7 +88,7 @@ enum {
};
#ifndef MAX_PATH
#ifdef MAXPATHLEN
#if defined MAXPATHLEN
#define MAX_PATH MAXPATHLEN /* clib.h */
#elif defined PATH_MAX
#define MAX_PATH PATH_MAX
......
......@@ -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__
#if defined(__unix__)
/* KIOCSOUND */
#if defined(__FreeBSD__)
#include <sys/kbio.h>
#endif
#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 defined(__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 defined(__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 */
/****************************************************************************/
#ifndef __BORLANDC__
#if !defined(__BORLANDC__j)
int DLLCALL xp_random(int n)
{
float f;
......
......@@ -41,20 +41,20 @@
#include <stdio.h> /* sprintf */
#include "gen_defs.h" /* ulong */
#ifdef DLLEXPORT
#if defined(DLLEXPORT)
#undef DLLEXPORT
#endif
#ifdef DLLCALL
#if defined(DLLCALL)
#undef DLLCALL
#endif
#ifdef _WIN32
#ifdef WRAPPER_DLL
#if defined(_WIN32)
#if defined(WRAPPER_DLL)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __BORLANDC__
#if defined(__BORLANDC__)
#define DLLCALL __stdcall
#else
#define DLLCALL
......@@ -64,7 +64,7 @@
#define DLLCALL
#endif
#ifdef __cplusplus
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -167,11 +167,11 @@ extern "C" {
#endif
#ifdef __BORLANDC__
#if defined(__BORLANDC__)
#define xp_random random
#endif
#ifdef __cplusplus
#if defined(__cplusplus)
}
#endif
......
......@@ -68,7 +68,7 @@
/**********************************/
/* Socket Implementation-specific */
/**********************************/
#ifdef _WINSOCKAPI_
#if defined(_WINSOCKAPI_)
#undef EINTR
#define EINTR (WSAEINTR-WSABASEERR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment