2 * test_console - Test VT Layer
4 * Copyright (c) 2011 David Herrmann <dh.herrmann@googlemail.com>
5 * Copyright (c) 2011 University of Tuebingen
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files
9 * (the "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * This opens a new VT and prints some text on it. You can then change the VT
30 * and change back. This is only to test the VT subsystem and event engine.
44 static bool terminate;
46 static void sig_term(struct kmscon_signal *sig, int signum, void *data)
51 int main(int argc, char **argv)
54 struct kmscon_eloop *loop;
56 struct kmscon_signal *sig;
58 ret = kmscon_eloop_new(&loop);
60 log_err("Cannot create eloop\n");
64 ret = kmscon_eloop_new_signal(loop, &sig, SIGINT, sig_term, NULL);
66 log_err("Cannot add signal\n");
70 ret = kmscon_vt_new(&vt, NULL, NULL);
72 log_err("Cannot create vt\n");
76 ret = kmscon_vt_open(vt, KMSCON_VT_NEW);
78 log_err("Cannot open VT\n");
82 ret = kmscon_vt_connect_eloop(vt, loop);
84 log_err("Cannot connect VT\n");
89 ret = kmscon_eloop_dispatch(loop, -1);
91 log_err("Dispatcher failed\n");
99 kmscon_eloop_rm_signal(sig);
101 kmscon_eloop_unref(loop);