]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/ptyfwd.h
mkosi: update arch commit reference
[thirdparty/systemd.git] / src / shared / ptyfwd.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
4ba93280
LP
2#pragma once
3
c1ff5570 4#include <stdbool.h>
4ba93280 5
023fb90b
LP
6#include "sd-event.h"
7
a8fbdf54
TA
8#include "macro.h"
9
023fb90b
LP
10typedef struct PTYForward PTYForward;
11
ae3dde80 12typedef enum PTYForwardFlags {
d7c37242
LP
13 /* Only output to STDOUT, never try to read from STDIN */
14 PTY_FORWARD_READ_ONLY = 1 << 0,
ae3dde80
LP
15
16 /* Continue reading after hangup? */
d7c37242 17 PTY_FORWARD_IGNORE_VHANGUP = 1 << 1,
ae3dde80
LP
18
19 /* Continue reading after hangup but only if we never read anything else? */
d7c37242
LP
20 PTY_FORWARD_IGNORE_INITIAL_VHANGUP = 1 << 2,
21
22 /* Don't tint the background, or set window title */
23 PTY_FORWARD_DUMB_TERMINAL = 1 << 3,
ae3dde80
LP
24} PTYForwardFlags;
25
f2a3de01 26typedef int (*PTYForwardHandler)(PTYForward *f, int rcode, void *userdata);
2a453c2e 27
ae3dde80 28int pty_forward_new(sd_event *event, int master, PTYForwardFlags flags, PTYForward **f);
023fb90b
LP
29PTYForward *pty_forward_free(PTYForward *f);
30
0ec5543c
LP
31int pty_forward_get_last_char(PTYForward *f, char *ch);
32
da054c37 33int pty_forward_set_ignore_vhangup(PTYForward *f, bool ignore_vhangup);
2a453c2e
LP
34bool pty_forward_get_ignore_vhangup(PTYForward *f);
35
36bool pty_forward_is_done(PTYForward *f);
37
38void pty_forward_set_handler(PTYForward *f, PTYForwardHandler handler, void *userdata);
9b15b784 39
95f1d6bf
LP
40bool pty_forward_drain(PTYForward *f);
41
d147457c
LP
42int pty_forward_set_priority(PTYForward *f, int64_t priority);
43
d435a182
LP
44int pty_forward_set_width_height(PTYForward *f, unsigned width, unsigned height);
45
23d9fcc3 46int pty_forward_set_background_color(PTYForward *f, const char *color);
d4ece77f 47
ddba81d8
LP
48int pty_forward_set_title(PTYForward *f, const char *title);
49int pty_forward_set_titlef(PTYForward *f, const char *format, ...) _printf_(2,3);
23d9fcc3 50
d4ece77f
LP
51int pty_forward_set_title_prefix(PTYForward *f, const char *prefix);
52
27a25130
MM
53bool shall_set_terminal_title(void);
54
023fb90b 55DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free);