Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hanoi2005
redis
提交
21fafdc6
R
redis
项目概览
hanoi2005
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21fafdc6
编写于
6月 01, 2014
作者:
J
jonathan pickett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
issue 111: ANSI escape sequences not rendering on Windows terminal
上级
88606c12
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
833 addition
and
6 deletion
+833
-6
deps/linenoise/linenoise.c
deps/linenoise/linenoise.c
+1
-0
src/Win32_Interop/Win32_ANSI.c
src/Win32_Interop/Win32_ANSI.c
+749
-0
src/Win32_Interop/Win32_ANSI.h
src/Win32_Interop/Win32_ANSI.h
+40
-0
src/Win32_Interop/Win32_FDAPI.cpp
src/Win32_Interop/Win32_FDAPI.cpp
+23
-4
src/Win32_Interop/Win32_Interop.vcxproj
src/Win32_Interop/Win32_Interop.vcxproj
+2
-0
src/memtest.c
src/memtest.c
+1
-0
src/redis-cli.c
src/redis-cli.c
+17
-2
未找到文件。
deps/linenoise/linenoise.c
浏览文件 @
21fafdc6
...
...
@@ -110,6 +110,7 @@
#ifdef _WIN32
#include "../../src/win32_Interop/win32fixes.h"
#define REDIS_NOTUSED(V) ((void) V)
#include "../../src/win32_Interop/win32_ANSI.h"
#endif
#define LINENOISE_DEFAULT_HISTORY_MAX_LEN 100
...
...
src/Win32_Interop/Win32_ANSI.c
0 → 100644
浏览文件 @
21fafdc6
此差异已折叠。
点击以展开。
src/Win32_Interop/Win32_ANSI.h
0 → 100644
浏览文件 @
21fafdc6
/*
* Copyright (c), Microsoft Open Technologies, Inc.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
#include <Windows.h>
#ifdef __cplusplus
extern
"C"
{
#endif
BOOL
ParseAndPrintANSIString
(
HANDLE
hDev
,
LPCVOID
lpBuffer
,
DWORD
nNumberOfBytesToWrite
,
LPDWORD
lpNumberOfBytesWritten
);
void
ANSI_printf
(
char
*
format
,
...);
// include this file after stdio.h in order to redirect printf to the one that supports ANSI escape sequences
#define printf ANSI_printf
#ifdef __cplusplus
}
#endif
src/Win32_Interop/Win32_FDAPI.cpp
浏览文件 @
21fafdc6
...
...
@@ -27,6 +27,7 @@
#include <sys/stat.h>
#include "Win32_fdapi_crt.h"
#include "Win32_variadicFunctor.h"
#include "Win32_ANSI.h"
#include <string>
using
namespace
std
;
...
...
@@ -516,11 +517,29 @@ ssize_t redis_write_impl(int fd, const void *buf, size_t count) {
}
else
{
int
posixFD
=
RFDMap
::
getInstance
().
lookupPosixFD
(
fd
);
if
(
posixFD
!=
-
1
)
{
int
retval
=
crt_write
(
posixFD
,
buf
,(
unsigned
int
)
count
);
if
(
retval
==
-
1
)
{
errno
=
GetLastError
();
if
(
posixFD
==
fileno
(
stdout
))
{
DWORD
bytesWritten
=
0
;
if
(
FALSE
!=
ParseAndPrintANSIString
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
buf
,
count
,
&
bytesWritten
))
{
return
(
int
)
bytesWritten
;
}
else
{
errno
=
GetLastError
();
return
0
;
}
}
else
if
(
posixFD
==
fileno
(
stderr
))
{
DWORD
bytesWritten
=
0
;
if
(
FALSE
!=
ParseAndPrintANSIString
(
GetStdHandle
(
STD_ERROR_HANDLE
),
buf
,
count
,
&
bytesWritten
))
{
return
(
int
)
bytesWritten
;
}
else
{
errno
=
GetLastError
();
return
0
;
}
}
else
{
int
retval
=
crt_write
(
posixFD
,
buf
,
(
unsigned
int
)
count
);
if
(
retval
==
-
1
)
{
errno
=
GetLastError
();
}
return
retval
;
}
return
retval
;
}
else
{
errno
=
EBADF
;
...
...
src/Win32_Interop/Win32_Interop.vcxproj
浏览文件 @
21fafdc6
...
...
@@ -21,6 +21,7 @@
<ItemGroup>
<ClCompile
Include=
"..\RedisLog.c"
/>
<ClCompile
Include=
"win32fixes.c"
/>
<ClCompile
Include=
"Win32_ANSI.c"
/>
<ClCompile
Include=
"Win32_dlmalloc.c"
/>
<ClCompile
Include=
"Win32_EventLog.cpp"
/>
<ClCompile
Include=
"Win32_FDAPI.cpp"
/>
...
...
@@ -35,6 +36,7 @@
<ItemGroup>
<ClInclude
Include=
"..\redisLog.h"
/>
<ClInclude
Include=
"win32fixes.h"
/>
<ClInclude
Include=
"Win32_ANSI.h"
/>
<ClInclude
Include=
"Win32_dlmalloc.h"
/>
<ClInclude
Include=
"Win32_EventLog.h"
/>
<ClInclude
Include=
"Win32_FDAPI.h"
/>
...
...
src/memtest.c
浏览文件 @
21fafdc6
...
...
@@ -38,6 +38,7 @@
#include <sys/ioctl.h>
#else
#include "win32_Interop/win32fixes.h"
#include "win32_Interop/win32_ANSI.h"
#endif
#include "config.h"
...
...
src/redis-cli.c
浏览文件 @
21fafdc6
...
...
@@ -51,6 +51,7 @@
#define STDIN_FILENO (_fileno(stdin))
#endif
#include "win32_Interop/win32fixes.h"
#include "win32_Interop/Win32_ANSI.h"
#include <windows.h>
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
...
...
@@ -64,8 +65,6 @@
#ifndef STDIN_FILENO
#define STDIN_FILENO (_fileno(stdin))
#endif
#include "win32_Interop/win32fixes.h"
#include <windows.h>
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strtoull _strtoui64
...
...
@@ -237,6 +236,21 @@ static void cliOutputCommandHelp(struct commandHelp *help, int group) {
/* Print generic help. */
static
void
cliOutputGenericHelp
()
{
sds
version
=
cliVersion
();
#ifdef _WIN32
int
i
=
0
;
int
groupslen
=
sizeof
(
commandGroups
)
/
sizeof
(
char
*
);
printf
(
"
\x1b
[0mredis-cli %s
\r\n
"
"Type:
\"
help @<group>
\"
to get a list of commands in <group>
\r\n
"
,
version
);
printf
(
" Where <group> is one of:
\n
"
);
for
(
i
=
0
;
i
<
groupslen
;
i
++
)
{
printf
(
"
\x1b
[1m%s
\x1b
[0m
\n
"
,
commandGroups
[
i
]);
}
printf
(
"
\"
help <command>
\"
for help on <command>
\r\n
"
"
\"
quit
\"
to exit
\r\n
"
);
#else
printf
(
"redis-cli %s
\r\n
"
"Type:
\"
help @<group>
\"
to get a list of commands in <group>
\r\n
"
...
...
@@ -245,6 +259,7 @@ static void cliOutputGenericHelp() {
"
\"
quit
\"
to exit
\r\n
"
,
version
);
#endif
sdsfree
(
version
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录