Crossfire Server, Branch 1.12  R12190
Data Structures | Defines | Typedefs | Functions | Variables
win32.h File Reference

Structures and types used to implement opendir/readdir/closedir on Windows 95/NT and set the loe level defines. More...

#include <windows.h>
#include <windowsx.h>
#include <mmsystem.h>
#include <winsock2.h>
#include <time.h>
#include <direct.h>
#include <math.h>
#include <sys/stat.h>
#include <io.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <process.h>
Include dependency graph for win32.h:

Go to the source code of this file.

Data Structures

struct  DIR
struct  dirent

Defines

#define __STDC__   1 /* something odd, CF want this, but don'T include it */
#define AFX_STDAFX_H__31666CA1_2474_11D5_AE6C_F07569C10000__INCLUDED_
#define BUNZIP   "/usr/bin/bunzip2"
#define BZIP   "/usr/bin/bzip2"
#define COMPRESS   "/usr/bin/compress"
#define CONFDIR   "share"
#define CS_LOGSTATS
#define DATADIR   "share"
#define F_OK   6
#define getpid()   _getpid()
#define GETTIMEOFDAY_TWO_ARGS
#define GUNZIP   "/bin/gunzip"
#define GZIP   "/bin/gzip"
#define HAVE_FCNTL_H
#define HAVE_SNPRINTF   1
#define HAVE_SRAND
#define HAVE_STDDEF_H
#define HAVE_STRERROR
#define HAVE_STRTOL
#define inline   __inline
#define LIBDIR   "share"
#define LOCALDIR   "var"
#define MAXPATHLEN   256
#define mkdir(__a, __b)   mkdir(__a)
#define NAMLEN(dirent)   strlen((dirent)->d_name)
#define pclose(__a)   _pclose(__a)
#define PLUGIN_SUFFIX   ".dll"
#define popen(__a, __b)   _popen(__a, __b)
#define PREFIXDIR   ""
#define R_OK   6 /* for __access() */
#define S_IRGRP   0000040
#define S_IROTH   0000400
#define S_IRUSR   0000004
#define S_ISDIR(x)   (((x)&S_IFMT) == S_IFDIR)
#define S_ISGID   0002000
#define S_ISREG(x)   (((x)&S_IFMT) == S_IFREG)
#define S_IWGRP   0000020
#define S_IWOTH   0000200
#define S_IWUSR   0000002
#define sleep(x)   Sleep(x*1000)
#define snprintf   _snprintf
#define socklen_t   int /* Doesn't exist, just a plain int */
#define strtok_r(x, y, z)   strtok(x, y)
#define UNCOMPRESS   "/usr/bin/uncompress"
#define unlink(__a)   _unlink(__a)
#define VERSION   "1.9.1 (trunk) snapshot 20061229"
#define vsnprintf   _vsnprintf
#define WEXITSTATUS(x)   x
#define WIFEXITED(x)   1
#define WIN32_LEAN_AND_MEAN

Typedefs

typedef struct dirent dirent

Functions

int closedir (DIR *)
 Dispose of a directory handle.
int gettimeofday (struct timeval *time_Info, struct timezone *timezone_Info)
 Gets the time of the day.
DIRopendir (const char *)
 Opens a directory for reading.
struct direntreaddir (DIR *)
 Returns the next file/directory for specified directory handle, obtained through a call to opendir().
void rewinddir (DIR *)
 Restart a directory listing from the beginning.
void service_handle ()
 Service entry point.
void service_register ()
 Registers the server to the service manager.
void service_unregister ()
 Removes the Crossfire service from the service manager.
int strcasecmp (const char *s1, const char *s2)
 Case-insensitive comparaison of strings.
int strncasecmp (const char *s1, const char *s2, int n)
 Case-insensitive comparaison of strings.

Variables

int bRunning
 Will be set to FALSE when the server should stop running because the service is turned off.

Detailed Description

Structures and types used to implement opendir/readdir/closedir on Windows 95/NT and set the loe level defines.

Also some Windows-specific includes and tweaks.

Definition in file win32.h.


Define Documentation

#define __STDC__   1 /* something odd, CF want this, but don'T include it */

Definition at line 43 of file win32.h.

Definition at line 13 of file win32.h.

#define BUNZIP   "/usr/bin/bunzip2"

Definition at line 121 of file win32.h.

#define BZIP   "/usr/bin/bzip2"

Definition at line 120 of file win32.h.

#define COMPRESS   "/usr/bin/compress"

Definition at line 116 of file win32.h.

#define CONFDIR   "share"

Definition at line 111 of file win32.h.

#define CS_LOGSTATS

Definition at line 52 of file win32.h.

#define DATADIR   "share"

Definition at line 109 of file win32.h.

#define F_OK   6

Definition at line 76 of file win32.h.

Referenced by tempnam_local().

#define getpid ( )    _getpid()

Definition at line 69 of file win32.h.

Referenced by become_daemon(), and tempnam_local().

Definition at line 60 of file win32.h.

#define GUNZIP   "/bin/gunzip"

Definition at line 119 of file win32.h.

#define GZIP   "/bin/gzip"

Definition at line 118 of file win32.h.

#define HAVE_FCNTL_H

Definition at line 55 of file win32.h.

#define HAVE_SNPRINTF   1

Definition at line 47 of file win32.h.

#define HAVE_SRAND

Definition at line 53 of file win32.h.

#define HAVE_STDDEF_H

Definition at line 58 of file win32.h.

#define HAVE_STRERROR

Definition at line 63 of file win32.h.

#define HAVE_STRTOL

Definition at line 62 of file win32.h.

#define inline   __inline

Definition at line 66 of file win32.h.

#define LIBDIR   "share"

Definition at line 110 of file win32.h.

Referenced by command_loadplugin(), initPlugins(), and main().

#define LOCALDIR   "var"

Definition at line 114 of file win32.h.

#define MAXPATHLEN   256

Definition at line 61 of file win32.h.

#define mkdir (   __a,
  __b 
)    mkdir(__a)

Definition at line 68 of file win32.h.

Referenced by make_path_to_file().

#define NAMLEN (   dirent)    strlen((dirent)->d_name)

Definition at line 135 of file win32.h.

#define pclose (   __a)    _pclose(__a)

Definition at line 71 of file win32.h.

Referenced by close_and_delete(), and save_map().

#define PLUGIN_SUFFIX   ".dll"

Definition at line 124 of file win32.h.

Referenced by initPlugins().

#define popen (   __a,
  __b 
)    _popen(__a, __b)

Definition at line 70 of file win32.h.

Referenced by open_and_uncompress_file(), and save_map().

#define PREFIXDIR   ""

Definition at line 78 of file win32.h.

#define R_OK   6 /* for __access() */

Definition at line 75 of file win32.h.

Referenced by load_unique_objects().

#define S_IRGRP   0000040

Definition at line 99 of file win32.h.

Referenced by check_path().

#define S_IROTH   0000400

Definition at line 96 of file win32.h.

Referenced by check_path().

#define S_IRUSR   0000004

Definition at line 102 of file win32.h.

Referenced by check_path(), and tempnam_secure().

#define S_ISDIR (   x)    (((x)&S_IFMT) == S_IFDIR)
#define S_ISGID   0002000

Definition at line 84 of file win32.h.

#define S_ISREG (   x)    (((x)&S_IFMT) == S_IFREG)

Definition at line 81 of file win32.h.

Referenced by check_path(), command_help(), and open_and_uncompress_file().

#define S_IWGRP   0000020

Definition at line 90 of file win32.h.

Referenced by check_path().

#define S_IWOTH   0000200

Definition at line 87 of file win32.h.

Referenced by check_path().

#define S_IWUSR   0000002

Definition at line 93 of file win32.h.

Referenced by check_path(), and tempnam_secure().

#define sleep (   x)    Sleep(x*1000)

Definition at line 167 of file win32.h.

Referenced by main(), and metaserver2_thread().

#define snprintf   _snprintf

Definition at line 49 of file win32.h.

#define socklen_t   int /* Doesn't exist, just a plain int */

Definition at line 148 of file win32.h.

Referenced by do_server(), and init_connection().

#define strtok_r (   x,
  y,
 
)    strtok(x, y)

Definition at line 73 of file win32.h.

Referenced by matches(), and parse_dialog_information().

#define UNCOMPRESS   "/usr/bin/uncompress"

Definition at line 117 of file win32.h.

#define unlink (   __a)    _unlink(__a)
#define VERSION   "1.9.1 (trunk) snapshot 20061229"

Definition at line 16 of file win32.h.

Referenced by start_info().

#define vsnprintf   _vsnprintf
#define WEXITSTATUS (   x)    x

Definition at line 106 of file win32.h.

Referenced by open_and_uncompress_file().

#define WIFEXITED (   x)    1

Definition at line 105 of file win32.h.

Referenced by open_and_uncompress_file().

Definition at line 26 of file win32.h.


Typedef Documentation

typedef struct dirent dirent

Function Documentation

int closedir ( DIR dp)

Dispose of a directory handle.

Parameters:
dphandle to free. Will become invalid.
Returns:
0.

Definition at line 149 of file win32.c.

References DIR::dir, and DIR::handle.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

Here is the caller graph for this function:

int gettimeofday ( struct timeval *  time_Info,
struct timezone timezone_Info 
)

Gets the time of the day.

Parameters:
[out]time_Infowill receive the time of the day.
[out]timezone_Infowill receive the timezone info.
Returns:
0.

Definition at line 54 of file win32.c.

References timezone::tz_dsttime, and timezone::tz_minuteswest.

Referenced by generate_random_map(), and ready_map_name().

Here is the caller graph for this function:

DIR* opendir ( const char *  dir)

Opens a directory for reading.

The handle should be disposed through closedir().

Parameters:
dirdirectory path.
Returns:
directory handle, NULL if failure.

Definition at line 78 of file win32.c.

References DIR::dir, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

Here is the caller graph for this function:

struct dirent* readdir ( DIR dp) [read]

Returns the next file/directory for specified directory handle, obtained through a call to opendir().

Parameters:
dphandle.
Returns:
next file/directory, NULL if end reached.

Definition at line 116 of file win32.c.

References dirent::d_ino, dirent::d_name, dirent::d_off, dirent::d_reclen, DIR::dent, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

Referenced by command_players(), find_maps(), help_topics(), initPlugins(), load_dir(), and remove_directory().

Here is the caller graph for this function:

void rewinddir ( DIR dir_Info)

Restart a directory listing from the beginning.

Parameters:
dir_Infohandle to rewing.

Definition at line 167 of file win32.c.

References DIR::dir, DIR::fileinfo, DIR::finished, DIR::handle, and DIR::offset.

void service_handle ( )

Service entry point.

Definition at line 384 of file win32.c.

References SERVICE_NAME, and ServiceMain().

Here is the call graph for this function:

void service_register ( )

Registers the server to the service manager.

See also:
service_unregister().

Definition at line 221 of file win32.c.

References SERVICE_DESCRIPTION, SERVICE_DISPLAY, and SERVICE_NAME.

Removes the Crossfire service from the service manager.

See also:
service_register().

Definition at line 266 of file win32.c.

References SERVICE_NAME.

int strcasecmp ( const char *  s1,
const char *  s2 
)

Case-insensitive comparaison of strings.

This seems to be lacking on some system.

Parameters:
s1
s2strings to compare.
Returns:
  • -1 if s1 is less than s2
  • 0 if s1 equals s2
  • 1 if s1 is greater than s2

Definition at line 434 of file porting.c.

References tolower.

Referenced by cast_create_missile(), command_kill_pets(), compare_map_info(), dump_monster_treasure(), find_ingred_cost(), find_treasure_by_name(), get_god_for_race(), get_region_from_string(), item_matched_string(), load_settings(), metaserver2_init(), name_cmp(), shop_sort(), sort_archetypes(), sort_equipment(), sort_mapname(), sort_race(), sort_slaying(), sort_struct_map_in_quest(), and sortbyname().

Here is the caller graph for this function:

int strncasecmp ( const char *  s1,
const char *  s2,
int  n 
)

Case-insensitive comparaison of strings.

This seems to be lacking on some system.

Parameters:
s1
s2strings to compare.
nmaximum number of chars to compare.
Returns:
  • -1 if s1 is less than s2
  • 0 if s1 equals s2
  • 1 if s1 is greater than s2

Definition at line 402 of file porting.c.

References tolower.

Referenced by basic_emote(), examine(), find_player_partial_name(), find_skill_by_name(), init_experience(), item_matched_string(), learn_skill(), strcasestr_local(), and use_skill().

Here is the caller graph for this function:


Variable Documentation

int bRunning

Will be set to FALSE when the server should stop running because the service is turned off.

Definition at line 202 of file win32.c.

Referenced by server_main(), ServiceCtrlHandler(), and ServiceMain().