diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index e6d7ac28a2..18322465b0 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/confgen/keygen.c b/bin/confgen/keygen.c index a172f8c7ce..b418042074 100644 --- a/bin/confgen/keygen.c +++ b/bin/confgen/keygen.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -192,4 +191,3 @@ write_key_file(const char *keyfile, const char *user, fatal("fclose(%s) failed\n", keyfile); fprintf(stderr, "wrote key file \"%s\"\n", keyfile); } - diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index af03f2d08b..fd50af135f 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/bin/tests/optional/Makefile.in b/bin/tests/optional/Makefile.in index bc08749f84..8e3e4f3248 100644 --- a/bin/tests/optional/Makefile.in +++ b/bin/tests/optional/Makefile.in @@ -52,7 +52,6 @@ XTARGETS = adb_test@EXEEXT@ \ hash_test@EXEEXT@ \ fsaccess_test@EXEEXT@ \ inter_test@EXEEXT@ \ - keyboard_test@EXEEXT@ \ lex_test@EXEEXT@ \ lfsr_test@EXEEXT@ \ log_test@EXEEXT@ \ @@ -83,7 +82,6 @@ XSRCS = adb_test.c \ fsaccess_test.c \ gsstest.c \ inter_test.c \ - keyboard_test.c \ lex_test.c \ lfsr_test.c \ log_test.c \ @@ -241,10 +239,6 @@ inter_test@EXEEXT@: inter_test.@O@ ${ISCDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ inter_test.@O@ \ ${ISCLIBS} ${LIBS} -keyboard_test@EXEEXT@: keyboard_test.@O@ ${ISCDEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ keyboard_test.@O@ \ - ${ISCLIBS} ${LIBS} - sig0_test@EXEEXT@: sig0_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ sig0_test.@O@ \ ${DNSLIBS} ${ISCLIBS} ${LIBS} diff --git a/bin/tests/optional/keyboard_test.c b/bin/tests/optional/keyboard_test.c deleted file mode 100644 index 085b314e02..0000000000 --- a/bin/tests/optional/keyboard_test.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - -/*! \file */ -#include - -#include -#include - -#include -#include -#include - -static void -CHECK(const char *msg, isc_result_t result) { - if (result != ISC_R_SUCCESS) { - printf("FAILURE: %s: %s\n", msg, isc_result_totext(result)); - exit(1); - } -} - -int -main(int argc, char **argv) { - isc_keyboard_t kbd; - unsigned char c; - isc_result_t res; - unsigned int count; - - UNUSED(argc); - UNUSED(argv); - - printf("Type Q to exit.\n"); - - res = isc_keyboard_open(&kbd); - CHECK("isc_keyboard_open()", res); - - c = 'x'; - count = 0; - while (res == ISC_R_SUCCESS && c != 'Q') { - res = isc_keyboard_getchar(&kbd, &c); - printf("."); - fflush(stdout); - count++; - if (count % 64 == 0) - printf("\r\n"); - } - printf("\r\n"); - if (res != ISC_R_SUCCESS) { - printf("FAILURE: keyboard getchar failed: %s\r\n", - isc_result_totext(res)); - goto errout; - } - - errout: - res = isc_keyboard_close(&kbd, 3); - CHECK("isc_keyboard_close()", res); - - return (0); -} diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index afec60314b..2e9fedfca8 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -28,7 +28,7 @@ CWARNINGS = UNIXOBJS = unix/pk11_api.@O@ \ unix/app.@O@ unix/dir.@O@ unix/errno.@O@ \ unix/errno2result.@O@ unix/file.@O@ unix/fsaccess.@O@ \ - unix/interfaceiter.@O@ unix/keyboard.@O@ unix/meminfo.@O@ \ + unix/interfaceiter.@O@ unix/meminfo.@O@ \ unix/net.@O@ unix/os.@O@ unix/resource.@O@ unix/socket.@O@ \ unix/stdio.@O@ unix/stdtime.@O@ \ unix/syslog.@O@ unix/time.@O@ diff --git a/lib/isc/unix/Makefile.in b/lib/isc/unix/Makefile.in index 80e8bc6e55..be05fc05bd 100644 --- a/lib/isc/unix/Makefile.in +++ b/lib/isc/unix/Makefile.in @@ -24,14 +24,14 @@ CWARNINGS = OBJS = pk11_api.@O@ \ app.@O@ dir.@O@ errno.@O@ errno2result.@O@ \ file.@O@ fsaccess.@O@ interfaceiter.@O@ \ - keyboard.@O@ meminfo.@O@ \ + meminfo.@O@ \ net.@O@ os.@O@ resource.@O@ socket.@O@ stdio.@O@ stdtime.@O@ \ syslog.@O@ time.@O@ # Alphabetically SRCS = pk11_api.c \ app.c dir.c errno.c errno2result.c \ - file.c fsaccess.c interfaceiter.c keyboard.c meminfo.c \ + file.c fsaccess.c interfaceiter.c meminfo.c \ net.c os.c resource.c socket.c stdio.c stdtime.c \ syslog.c time.c diff --git a/lib/isc/unix/include/isc/Makefile.in b/lib/isc/unix/include/isc/Makefile.in index 46c75c1e60..8f0e76fda6 100644 --- a/lib/isc/unix/include/isc/Makefile.in +++ b/lib/isc/unix/include/isc/Makefile.in @@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@ VERSION=@BIND9_VERSION@ -HEADERS = dir.h keyboard.h net.h netdb.h offset.h stat.h \ +HEADERS = dir.h net.h netdb.h offset.h stat.h \ stdtime.h strerror.h syslog.h time.h SUBDIRS = diff --git a/lib/isc/unix/include/isc/keyboard.h b/lib/isc/unix/include/isc/keyboard.h deleted file mode 100644 index e66352aca1..0000000000 --- a/lib/isc/unix/include/isc/keyboard.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_KEYBOARD_H -#define ISC_KEYBOARD_H 1 - -/*! \file */ - -#include -#include - -#include -#include - -ISC_LANG_BEGINDECLS - -typedef struct { - int fd; - struct termios saved_mode; - isc_result_t result; -} isc_keyboard_t; - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard); - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); - -bool -isc_keyboard_canceled(isc_keyboard_t *keyboard); - -ISC_LANG_ENDDECLS - -#endif /* ISC_KEYBOARD_H */ diff --git a/lib/isc/unix/keyboard.c b/lib/isc/unix/keyboard.c deleted file mode 100644 index cb5f11630e..0000000000 --- a/lib/isc/unix/keyboard.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#include - -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard) { - int fd; - isc_result_t ret; - struct termios current_mode; - - REQUIRE(keyboard != NULL); - - fd = open("/dev/tty", O_RDONLY, 0); - if (fd < 0) - return (ISC_R_IOERROR); - - keyboard->fd = fd; - - if (tcgetattr(fd, &keyboard->saved_mode) < 0) { - ret = ISC_R_IOERROR; - goto errout; - } - - current_mode = keyboard->saved_mode; - - current_mode.c_iflag &= - ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - current_mode.c_oflag &= ~OPOST; - current_mode.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - current_mode.c_cflag &= ~(CSIZE|PARENB); - current_mode.c_cflag |= CS8; - - current_mode.c_cc[VMIN] = 1; - current_mode.c_cc[VTIME] = 0; - if (tcsetattr(fd, TCSAFLUSH, ¤t_mode) < 0) { - ret = ISC_R_IOERROR; - goto errout; - } - - keyboard->result = ISC_R_SUCCESS; - - return (ISC_R_SUCCESS); - - errout: - close (fd); - - return (ret); -} - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) { - REQUIRE(keyboard != NULL); - - if (sleeptime > 0 && keyboard->result != ISC_R_CANCELED) - (void)sleep(sleeptime); - - (void)tcsetattr(keyboard->fd, TCSAFLUSH, &keyboard->saved_mode); - (void)close(keyboard->fd); - - keyboard->fd = -1; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) { - ssize_t cc; - unsigned char c; - cc_t *controlchars; - - REQUIRE(keyboard != NULL); - REQUIRE(cp != NULL); - - cc = read(keyboard->fd, &c, 1); - if (cc < 0) { - keyboard->result = ISC_R_IOERROR; - return (keyboard->result); - } - - controlchars = keyboard->saved_mode.c_cc; - if (c == controlchars[VINTR] || c == controlchars[VQUIT]) { - keyboard->result = ISC_R_CANCELED; - return (keyboard->result); - } - - *cp = c; - - return (ISC_R_SUCCESS); -} - -bool -isc_keyboard_canceled(isc_keyboard_t *keyboard) { - return (keyboard->result == ISC_R_CANCELED); -} diff --git a/lib/isc/win32/include/isc/Makefile.in b/lib/isc/win32/include/isc/Makefile.in index 1080619153..d4316288e9 100644 --- a/lib/isc/win32/include/isc/Makefile.in +++ b/lib/isc/win32/include/isc/Makefile.in @@ -13,7 +13,7 @@ top_srcdir = @top_srcdir@ VERSION=@BIND9_VERSION@ -HEADERS = dir.h keyboard.h mutex.h net.h netdb.h once.h \ +HEADERS = dir.h mutex.h net.h netdb.h once.h \ stat.h stdtime.h thread.h time.h SUBDIRS = diff --git a/lib/isc/win32/include/isc/keyboard.h b/lib/isc/win32/include/isc/keyboard.h deleted file mode 100644 index 009523a48b..0000000000 --- a/lib/isc/win32/include/isc/keyboard.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#ifndef ISC_KEYBOARD_H -#define ISC_KEYBOARD_H 1 - -#include - -#include -#include - -ISC_LANG_BEGINDECLS - -typedef struct { - int fd; - isc_result_t result; -} isc_keyboard_t; - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard); - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleepseconds); - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp); - -bool -isc_keyboard_canceled(isc_keyboard_t *keyboard); - -ISC_LANG_ENDDECLS - -#endif /* ISC_KEYBOARD_H */ diff --git a/lib/isc/win32/keyboard.c b/lib/isc/win32/keyboard.c deleted file mode 100644 index 1fe8820f12..0000000000 --- a/lib/isc/win32/keyboard.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) Internet Systems Consortium, Inc. ("ISC") - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * See the COPYRIGHT file distributed with this work for additional - * information regarding copyright ownership. - */ - - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -isc_result_t -isc_keyboard_open(isc_keyboard_t *keyboard) { - int fd; - - REQUIRE(keyboard != NULL); - - fd = _fileno(stdin); - if (fd < 0) - return (ISC_R_IOERROR); - - keyboard->fd = fd; - - keyboard->result = ISC_R_SUCCESS; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_keyboard_close(isc_keyboard_t *keyboard, unsigned int sleeptime) { - REQUIRE(keyboard != NULL); - - if (sleeptime > 0 && keyboard->result != ISC_R_CANCELED) - (void)Sleep(sleeptime*1000); - - keyboard->fd = -1; - - return (ISC_R_SUCCESS); -} - -isc_result_t -isc_keyboard_getchar(isc_keyboard_t *keyboard, unsigned char *cp) { - ssize_t cc; - unsigned char c; - - REQUIRE(keyboard != NULL); - REQUIRE(cp != NULL); - - cc = read(keyboard->fd, &c, 1); - if (cc < 0) { - keyboard->result = ISC_R_IOERROR; - return (keyboard->result); - } - - *cp = c; - - return (ISC_R_SUCCESS); -} - -bool -isc_keyboard_canceled(isc_keyboard_t *keyboard) { - return (keyboard->result == ISC_R_CANCELED); -} - diff --git a/lib/isc/win32/libisc.def.in b/lib/isc/win32/libisc.def.in index ee57167541..d033611bee 100644 --- a/lib/isc/win32/libisc.def.in +++ b/lib/isc/win32/libisc.def.in @@ -318,10 +318,6 @@ isc_interfaceiter_next isc_interval_iszero isc_interval_set isc_iterated_hash -isc_keyboard_canceled -isc_keyboard_close -isc_keyboard_getchar -isc_keyboard_open isc_lex_close isc_lex_create isc_lex_destroy diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 167eb5b0a8..e1ff0c73fa 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -313,9 +313,6 @@ Win32 Header Files - - Win32 Header Files - Win32 Header Files @@ -422,9 +419,6 @@ Win32 Source Files - - Win32 Source Files - Win32 Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index 325ce44d85..bc4fa9f4cc 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -388,7 +388,6 @@ copy InstallFiles ..\Build\Release\ - @@ -488,7 +487,6 @@ copy InstallFiles ..\Build\Release\ - diff --git a/util/copyrights b/util/copyrights index 8a1827e14d..f2f0fa150c 100644 --- a/util/copyrights +++ b/util/copyrights @@ -314,7 +314,6 @@ ./bin/tests/optional/gsstest.c C 2018 ./bin/tests/optional/hash_test.c C 2000,2001,2004,2005,2006,2007,2014,2015,2016,2017,2018 ./bin/tests/optional/inter_test.c C 2000,2001,2003,2004,2005,2007,2008,2015,2016,2018 -./bin/tests/optional/keyboard_test.c C 2000,2001,2004,2005,2007,2015,2016,2018 ./bin/tests/optional/lex_test.c C 1998,1999,2000,2001,2004,2005,2007,2015,2016,2018 ./bin/tests/optional/lfsr_test.c C 1999,2000,2001,2004,2005,2007,2015,2016,2018 ./bin/tests/optional/log_test.c C 1999,2000,2001,2004,2007,2011,2014,2015,2016,2018 @@ -3497,7 +3496,6 @@ ./lib/isc/unix/fsaccess.c C 2000,2001,2004,2005,2006,2007,2016,2018 ./lib/isc/unix/ifiter_getifaddrs.c C 2003,2004,2005,2007,2008,2009,2014,2016,2018 ./lib/isc/unix/include/isc/dir.h C 1999,2000,2001,2004,2005,2007,2016,2018 -./lib/isc/unix/include/isc/keyboard.h C 2000,2001,2004,2005,2007,2016,2018 ./lib/isc/unix/include/isc/net.h C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2013,2014,2016,2017,2018 ./lib/isc/unix/include/isc/netdb.h C 1999,2000,2001,2004,2005,2007,2016,2018 ./lib/isc/unix/include/isc/offset.h C 2000,2001,2004,2005,2007,2008,2016,2018 @@ -3507,7 +3505,6 @@ ./lib/isc/unix/include/isc/time.h C 1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2012,2014,2015,2016,2017,2018 ./lib/isc/unix/include/pkcs11/cryptoki.h X 2014,2018 ./lib/isc/unix/interfaceiter.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2014,2016,2017,2018 -./lib/isc/unix/keyboard.c C 2000,2001,2004,2007,2016,2018 ./lib/isc/unix/meminfo.c C 2015,2016,2018 ./lib/isc/unix/net.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2013,2014,2015,2016,2017,2018 ./lib/isc/unix/os.c C 2000,2001,2004,2005,2007,2016,2018 @@ -3536,7 +3533,6 @@ ./lib/isc/win32/include/isc/condition.h C 1998,1999,2000,2001,2004,2007,2016,2018 ./lib/isc/win32/include/isc/dir.h C 1999,2000,2001,2004,2007,2016,2018 ./lib/isc/win32/include/isc/ipv6.h C 1999,2000,2001,2002,2004,2005,2007,2011,2012,2016,2018 -./lib/isc/win32/include/isc/keyboard.h C 2000,2001,2004,2007,2016,2018 ./lib/isc/win32/include/isc/mutex.h C 1998,1999,2000,2001,2004,2007,2008,2009,2016,2018 ./lib/isc/win32/include/isc/net.h C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2012,2013,2016,2017,2018 ./lib/isc/win32/include/isc/netdb.h C 1999,2000,2001,2004,2007,2016,2018 @@ -3555,7 +3551,6 @@ ./lib/isc/win32/include/pkcs11/cryptoki.h X 2014,2018 ./lib/isc/win32/interfaceiter.c C 1999,2000,2001,2004,2007,2008,2009,2013,2014,2015,2016,2018 ./lib/isc/win32/ipv6.c C 1999,2000,2001,2004,2007,2016,2018 -./lib/isc/win32/keyboard.c C 2000,2001,2004,2007,2016,2018 ./lib/isc/win32/libgen.h C 2009,2016,2018 ./lib/isc/win32/libisc.def.exclude X 2015,2017,2018 ./lib/isc/win32/libisc.def.in X 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018