未验证 提交 4f117516 编写于 作者: 羽飞's avatar 羽飞 提交者: GitHub

Merge pull request #45 from hnwyllmm/main

print prompt in client on platform without readline
......@@ -26,7 +26,9 @@ public:
~DeferHelper()
{
defer_();
if (defer_) {
defer_();
}
}
private:
......@@ -35,8 +37,5 @@ private:
} // namespace common
#define AA(B, C) B##C
#define BB(B, C) AA(B,C)
#define DEFER(callback) common::DeferHelper BB(defer_helper_, __LINE__)(callback)
#undef AA
#undef BB
#define DERFER_NAME(suffix) defer_helper_##suffix
#define DEFER(callback) common::DeferHelper DERFER_NAME(__LINE__)(callback)
......@@ -51,6 +51,7 @@ char *my_readline(const char *prompt)
fprintf(stderr, "failed to alloc line buffer");
return nullptr;
}
fprintf(stdout, prompt);
char *s = fgets(buffer, MAX_MEM_BUFFER_SIZE, stdin);
if (nullptr == s) {
fprintf(stderr, "failed to read message from console");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册