1/**
2 * \file
3 * \brief Set of default triggers for the terminal client library.
4 */
5
6/*
7 * Copyright (c) 2012, ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, CAB F.78, Universitaetstrasse 6, CH-8092 Zurich,
13 * Attn: Systems Group.
14 */
15
16#include <barrelfish/barrelfish.h>
17#include <barrelfish/waitset.h>
18#include <if/terminal_config_defs.h>
19#include <term/client/default_triggers.h>
20
21static void term_trigger_kill_handler(void *arg)
22{
23    fprintf(stderr, "User hit Ctrl+\\.\n");
24    exit(EXIT_FAILURE);
25}
26
27static void term_trigger_int_handler(void *arg)
28{
29    fprintf(stderr, "User hit Ctrl+C.\n");
30    exit(EXIT_FAILURE);
31}
32
33struct term_trigger term_trigger_kill = {
34    .closure = {
35        .handler = term_trigger_kill_handler,
36        .arg = NULL,
37    },
38    .trigger_character = CTRL('\\'),
39};
40
41struct term_trigger term_trigger_int = {
42    .closure = {
43        .handler = term_trigger_int_handler,
44        .arg = NULL,
45    },
46    .trigger_character = CTRL('C'),
47};
48