-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvterm_osc_DA.c
53 lines (43 loc) · 1.15 KB
/
vterm_osc_DA.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
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "vterm.h"
#include "vterm_private.h"
#include "vterm_osc_DA.h"
#include "strings.h"
#include "vterm_reply.h"
int
interpret_osc_DA(vterm_t *vterm, int param[], int pcount)
{
int verb;
if(pcount == 0) verb = 0;
else verb = param[0];
// linux behaves very poorly to DA replies. don't do it.
if(vterm->flags & VTERM_FLAG_LINUX) return 0;
/*
a valid inquiry is verb 0 and 1 (in extended mode which we're not
supporting right now.
*/
if(verb == 0)
{
memset(vterm->reply_buf, 0, sizeof(vterm->reply_buf));
if(vterm->flags & VTERM_FLAG_VT100)
{
vterm->reply_buf_sz = sizeof(OSC_DA_REPLY_VT100);
strncpy(vterm->reply_buf,
OSC_DA_REPLY_VT100,
vterm->reply_buf_sz);
}
else
{
vterm->reply_buf_sz = sizeof(OSC_DA_REPLY_XTERM);
strncpy(vterm->reply_buf,
OSC_DA_REPLY_XTERM,
vterm->reply_buf_sz);
}
vterm_reply_buffer(vterm);
}
return 0;
}