Remove building with NOCRYPTO option
[minix.git] / external / bsd / bind / dist / bin / tests / keyboard_test.c
blobee59a181737ab2bbce859cd3cdc099aab32a5450
1 /* $NetBSD: keyboard_test.c,v 1.6 2014/12/10 04:37:53 christos Exp $ */
3 /*
4 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2000, 2001 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: keyboard_test.c,v 1.13 2007/06/19 23:46:59 tbox Exp */
22 /*! \file */
23 #include <config.h>
25 #include <stdio.h>
26 #include <stdlib.h>
28 #include <isc/keyboard.h>
29 #include <isc/util.h>
31 static void
32 CHECK(const char *msg, isc_result_t result) {
33 if (result != ISC_R_SUCCESS) {
34 printf("FAILURE: %s: %s\n", msg, isc_result_totext(result));
35 exit(1);
39 int
40 main(int argc, char **argv) {
41 isc_keyboard_t kbd;
42 unsigned char c;
43 isc_result_t res;
44 unsigned int count;
46 UNUSED(argc);
47 UNUSED(argv);
49 printf("Type Q to exit.\n");
51 res = isc_keyboard_open(&kbd);
52 CHECK("isc_keyboard_open()", res);
54 c = 'x';
55 count = 0;
56 while (res == ISC_R_SUCCESS && c != 'Q') {
57 res = isc_keyboard_getchar(&kbd, &c);
58 printf(".");
59 fflush(stdout);
60 count++;
61 if (count % 64 == 0)
62 printf("\r\n");
64 printf("\r\n");
65 if (res != ISC_R_SUCCESS) {
66 printf("FAILURE: keyboard getchar failed: %s\r\n",
67 isc_result_totext(res));
68 goto errout;
71 errout:
72 res = isc_keyboard_close(&kbd, 3);
73 CHECK("isc_keyboard_close()", res);
75 return (0);