Fix zzat compilation on Win32 and create a .vcxproj file for it.
This commit is contained in:
parent
6214fcb74c
commit
44d11b68e7
@ -32,7 +32,7 @@
|
||||
/* #undef HAVE_FGETC_UNLOCKED */
|
||||
/* #undef HAVE_FGETLN */
|
||||
/* #undef HAVE_FGETS_UNLOCKED */
|
||||
#define HAVE_FOPEN64 1
|
||||
/* #undef HAVE_FOPEN64 */
|
||||
/* #undef HAVE_FORK */
|
||||
/* #undef HAVE_FREAD_UNLOCKED */
|
||||
/* #undef HAVE_FREEBSD_FILE */
|
||||
|
||||
109
msvc/zzat.vcxproj
Normal file
109
msvc/zzat.vcxproj
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.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>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{83987482-7F82-427E-7832-809F80AB809C}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)zzat.exe</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)zzat.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)zzat.exe</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\src\mygetopt.c" />
|
||||
<ClCompile Include="..\src\zzat.c">
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
|
||||
<ObjectFileName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(FileName)1.obj</ObjectFileName>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\src\mygetopt.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -1,12 +1,14 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zzuf", "zzuf.vcxproj", "{2E5723ED-A886-45A9-AAAC-3D02F2EFC358}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzzuf", "libzzuf.vcxproj", "{E658DCE5-E1E5-41C8-910B-1CC2D73C435C}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zznop", "zznop.vcxproj", "{04486051-18D2-402D-91C0-3E0A8F2FD0D7}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zzat", "zzat.vcxproj", "{83987482-7F82-427E-7832-809F80AB809C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@ -25,6 +27,10 @@ Global
|
||||
{04486051-18D2-402D-91C0-3E0A8F2FD0D7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{04486051-18D2-402D-91C0-3E0A8F2FD0D7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{04486051-18D2-402D-91C0-3E0A8F2FD0D7}.Release|Win32.Build.0 = Release|Win32
|
||||
{83987482-7F82-427E-7832-809F80AB809C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{83987482-7F82-427E-7832-809F80AB809C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{83987482-7F82-427E-7832-809F80AB809C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{83987482-7F82-427E-7832-809F80AB809C}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
15
src/zzat.c
15
src/zzat.c
@ -25,6 +25,13 @@
|
||||
/* Needed for getc_unlocked() on OpenSolaris */
|
||||
#define __EXTENSIONS__
|
||||
|
||||
#if defined _MSC_VER
|
||||
# include <io.h>
|
||||
typedef int ssize_t;
|
||||
# define snprintf sprintf_s
|
||||
# define close _close
|
||||
#endif
|
||||
|
||||
#if defined HAVE_STDINT_H
|
||||
# include <stdint.h>
|
||||
#elif defined HAVE_INTTYPES_H
|
||||
@ -135,7 +142,7 @@ int main(int argc, char *argv[])
|
||||
number_lines = 1;
|
||||
break;
|
||||
case 'r': /* --repeat */
|
||||
repeat = atoi(optarg);
|
||||
repeat = atoi(myoptarg);
|
||||
break;
|
||||
case 's': /* --squeeze-blank */
|
||||
squeeze_lines = 1;
|
||||
@ -370,9 +377,9 @@ static int make_fmt(struct parser *p, char const *fmt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define PARSECMD(fmt, arg...) \
|
||||
#define PARSECMD(fmt, ...) \
|
||||
(make_fmt(&parser, fmt) == sscanf(sequence, parser.tmpfmt, \
|
||||
##arg, &parser.ch) \
|
||||
__VA_ARGS__, &parser.ch) \
|
||||
&& parser.ch == parser.lastch)
|
||||
|
||||
/*
|
||||
@ -577,7 +584,7 @@ static int run(char const *sequence, char const *file)
|
||||
ftell(f) >= 0 ? ftell(f) - retoff : 0);
|
||||
#endif
|
||||
else if (PARSECMD("rewind ( )"))
|
||||
MY_FSEEK(rewind(f), -retlen);
|
||||
MY_FSEEK(rewind(f), -(int)retlen);
|
||||
else if (PARSECMD("ungetc ( )"))
|
||||
MY_FSEEK(if(retoff) ungetc((unsigned char)retbuf[retoff - 1], f),
|
||||
retoff ? -1 : 0);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user