mirror of
https://github.com/samhocevar/rinetd.git
synced 2024-12-25 20:30:23 +08:00
Allow to build application with Visual Studio.
This commit is contained in:
parent
7e287f5913
commit
5a70f2bf4e
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
.auto
|
||||
.deps
|
||||
.dirstamp
|
||||
Makefile
|
||||
Makefile.in
|
||||
stamp-*
|
||||
@ -13,4 +14,8 @@ configure
|
||||
|
||||
*.o
|
||||
rinetd
|
||||
rinetd.exe
|
||||
|
||||
*.vcxproj.user
|
||||
Debug
|
||||
Release
|
||||
|
@ -21,6 +21,8 @@ AC_CHECK_HEADERS([arpa/inet.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h stri
|
||||
AC_C_CONST
|
||||
AC_HEADER_TIME
|
||||
AC_STRUCT_TM
|
||||
AC_CHECK_TYPES(ssize_t, [], [],
|
||||
[#include <sys/types.h>])
|
||||
AC_CHECK_TYPES(socklen_t, [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
107
rinetd.vcxproj
Normal file
107
rinetd.vcxproj
Normal file
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\getopt.c" />
|
||||
<ClCompile Include="src\match.c" />
|
||||
<ClCompile Include="src\net.c" />
|
||||
<ClCompile Include="src\parse.c" />
|
||||
<ClCompile Include="src\rinetd.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\getopt.h" />
|
||||
<ClInclude Include="src\match.h" />
|
||||
<ClInclude Include="src\net.h" />
|
||||
<ClInclude Include="src\parse.h" />
|
||||
<ClInclude Include="src\rinetd.h" />
|
||||
<ClInclude Include="src\types.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{3F1D9D58-3205-48E9-9C93-557291A45D74}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>rinetd</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>_CONSOLE;PACKAGE_VERSION="0.70";_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -1,6 +1,6 @@
|
||||
/* Copyright © 1997—1999 Thomas Boutell <boutell@boutell.com>
|
||||
and Boutell.Com, Inc.
|
||||
© 2003—2017 Sam Hocevar <sam@hocevar.net>
|
||||
© 2003—2021 Sam Hocevar <sam@hocevar.net>
|
||||
|
||||
This software is released for free use under the terms of
|
||||
the GNU Public License, version 2 or higher. NO WARRANTY
|
||||
@ -36,6 +36,12 @@
|
||||
# include <sys/filio.h>
|
||||
#endif /* FIONBIO */
|
||||
|
||||
#if HAVE_SSIZE_T
|
||||
# define SSIZE_T ssize_t
|
||||
#else
|
||||
# define SSIZE_T int
|
||||
#endif
|
||||
|
||||
#if HAVE_SOCKLEN_T
|
||||
# define SOCKLEN_T socklen_t
|
||||
#else
|
||||
|
11
src/rinetd.c
11
src/rinetd.c
@ -14,6 +14,10 @@
|
||||
# define RETSIGTYPE void
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
# include "getopt.h"
|
||||
#else
|
||||
@ -439,7 +443,12 @@ static void selectPass(void)
|
||||
timeout.tv_sec = timeout.tv_usec = 0;
|
||||
time_t now = time(NULL);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
fd_set* readfds = (fd_set*)alloca(sizeof(*readfds) * fdSetCount);
|
||||
fd_set* writefds = (fd_set*)alloca(sizeof(*writefds) * fdSetCount);
|
||||
#else
|
||||
fd_set readfds[fdSetCount], writefds[fdSetCount];
|
||||
#endif
|
||||
FD_ZERO_EXT(readfds);
|
||||
FD_ZERO_EXT(writefds);
|
||||
/* Server sockets */
|
||||
@ -657,7 +666,7 @@ static void handleAccept(ServerInfo const *srv)
|
||||
to read a lot of data otherwise the datagram contents
|
||||
may be lost later. */
|
||||
nfd = srv->fd;
|
||||
ssize_t ret = recvfrom(nfd, globalUdpBuffer,
|
||||
SSIZE_T ret = recvfrom(nfd, globalUdpBuffer,
|
||||
sizeof(globalUdpBuffer), 0, &addr, &addrlen);
|
||||
if (ret < 0) {
|
||||
if (GetLastError() == WSAEWOULDBLOCK) {
|
||||
|
Loading…
Reference in New Issue
Block a user