-
Notifications
You must be signed in to change notification settings - Fork 253
/
console.c
78 lines (67 loc) · 1.81 KB
/
console.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*
* Common pieces between the platform console frontend modules.
*/
#include <stdbool.h>
#include <stdarg.h>
#include "putty.h"
#include "misc.h"
#include "console.h"
const char console_abandoned_msg[] = "连接已放弃。\n";
const SeatDialogPromptDescriptions *console_prompt_descriptions(Seat *seat)
{
static const SeatDialogPromptDescriptions descs = {
.hk_accept_action = "输入 \"y\"",
.hk_connect_once_action = "输入 \"n\"",
.hk_cancel_action = "按回车",
.hk_cancel_action_Participle = "按回车",
.weak_accept_action = "输入 \"y\"",
.weak_cancel_action = "输入 \"n\"",
};
return &descs;
}
bool console_batch_mode = false;
/*
* Error message and/or fatal exit functions, all based on
* console_print_error_msg which the platform front end provides.
*/
void console_print_error_msg_fmt_v(
const char *prefix, const char *fmt, va_list ap)
{
char *msg = dupvprintf(fmt, ap);
console_print_error_msg(prefix, msg);
sfree(msg);
}
void console_print_error_msg_fmt(const char *prefix, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
console_print_error_msg_fmt_v(prefix, fmt, ap);
va_end(ap);
}
void modalfatalbox(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
console_print_error_msg_fmt_v("FATAL ERROR", fmt, ap);
va_end(ap);
cleanup_exit(1);
}
void nonfatal(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
console_print_error_msg_fmt_v("ERROR", fmt, ap);
va_end(ap);
}
void console_connection_fatal(Seat *seat, const char *msg)
{
console_print_error_msg("FATAL ERROR", msg);
cleanup_exit(1);
}
/*
* Console front ends redo their select() or equivalent every time, so
* they don't need separate timer handling.
*/
void timer_change_notify(unsigned long next)
{
}