1*d4e67a97Sbluhm /* $OpenBSD: glue.c,v 1.4 2017/07/05 15:31:45 bluhm Exp $ */
2cc51b90fSschwarze /*
3cc51b90fSschwarze * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4cc51b90fSschwarze *
5cc51b90fSschwarze * Permission to use, copy, modify, and distribute this software for any
6cc51b90fSschwarze * purpose with or without fee is hereby granted, provided that the above
7cc51b90fSschwarze * copyright notice and this permission notice appear in all copies.
8cc51b90fSschwarze *
9cc51b90fSschwarze * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10cc51b90fSschwarze * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11cc51b90fSschwarze * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12cc51b90fSschwarze * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13cc51b90fSschwarze * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14cc51b90fSschwarze * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15cc51b90fSschwarze * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16cc51b90fSschwarze */
17cc51b90fSschwarze
18cc51b90fSschwarze /*
19cc51b90fSschwarze * Glue for unit tests of libedit/read.c.
20cc51b90fSschwarze * Rather than linking in all the various libedit modules,
21cc51b90fSschwarze * provide dummies for those functions called in read.c.
22cc51b90fSschwarze */
23cc51b90fSschwarze
24cc51b90fSschwarze #define EL EditLine *el __attribute__((__unused__))
25cc51b90fSschwarze #define UU __attribute__((__unused__))
26cc51b90fSschwarze
ch_enlargebufs(EL,size_t addlen UU)27cc51b90fSschwarze int ch_enlargebufs(EL, size_t addlen UU) { return 1; }
ch_reset(EL)28ca6c7727Sschwarze void ch_reset(EL) { }
el_resize(EL)29cc51b90fSschwarze void el_resize(EL) { }
el_set(EL,int op UU,...)30cc51b90fSschwarze int el_set(EL, int op UU, ...) { return 0; }
el_wset(EL,int op UU,...)31cc51b90fSschwarze int el_wset(EL, int op UU, ...) { return 0; }
re_clear_display(EL)32cc51b90fSschwarze void re_clear_display(EL) { }
re_clear_lines(EL)33cc51b90fSschwarze void re_clear_lines(EL) { }
re_refresh(EL)34cc51b90fSschwarze void re_refresh(EL) { }
re_refresh_cursor(EL)35cc51b90fSschwarze void re_refresh_cursor(EL) { }
sig_clr(EL)36cc51b90fSschwarze void sig_clr(EL) { }
sig_set(EL)37cc51b90fSschwarze void sig_set(EL) { }
terminal__flush(EL)38cc51b90fSschwarze void terminal__flush(EL) { }
terminal_beep(EL)39cc51b90fSschwarze void terminal_beep(EL) { }
tty_cookedmode(EL)40cc51b90fSschwarze int tty_cookedmode(EL) { return 0; }
tty_rawmode(EL)41cc51b90fSschwarze int tty_rawmode(EL) { return 0; }
42cc51b90fSschwarze
43cc51b90fSschwarze int
keymacro_get(EL,wchar_t * ch,keymacro_value_t * val)44ee3b4c9dSschwarze keymacro_get(EL, wchar_t *ch, keymacro_value_t *val)
45cc51b90fSschwarze {
46ee3b4c9dSschwarze static wchar_t value[] = L"ic";
47cc51b90fSschwarze
48cc51b90fSschwarze switch (*ch) {
49cc51b90fSschwarze case L'c':
50cc51b90fSschwarze val->cmd = ED_COMMAND;
51cc51b90fSschwarze return XK_CMD;
52cc51b90fSschwarze case L's':
53cc51b90fSschwarze val->str = value;
54cc51b90fSschwarze return XK_STR;
55cc51b90fSschwarze default:
56cc51b90fSschwarze val->str = NULL;
57cc51b90fSschwarze *ch = '\0';
58cc51b90fSschwarze return XK_STR;
59cc51b90fSschwarze }
60cc51b90fSschwarze }
61cc51b90fSschwarze
62cc51b90fSschwarze #undef EL
63cc51b90fSschwarze #undef UU
64