]> Chaos Git - corbenik/bdfe.git/commitdiff
Remove more useless code
authorchaoskagami <chaos.kagami@gmail.com>
Sun, 19 Jun 2016 01:34:57 +0000 (21:34 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Sun, 19 Jun 2016 01:34:57 +0000 (21:34 -0400)
Makefile
main.c
rterm.c [deleted file]
rterm.h [deleted file]

index c87c388f6484927be66f1efdf9978553b63df7db..89a6729af95c12d2d52dee79348d4a77e43f5f83 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,9 @@ CFLAGS += -g
 LIBS    =
 
 CORE = bdfe
-OBJS = main.o bdf.o rterm.o
-HFILES = Makefile rterm.h
-CFILES = bdf.c rterm.c main.c
+OBJS = main.o bdf.o
+HFILES = Makefile
+CFILES = bdf.c main.c
 
 all: $(CORE)
 
diff --git a/main.c b/main.c
index cdfa1d64ac01c8e0d489b7106925895cdde130b9..c7ac1e95c48557bf61bbbc62d12c34c005093f8c 100644 (file)
--- a/main.c
+++ b/main.c
@@ -35,7 +35,6 @@
 #include <unistd.h>
 
 #include "bdf.h"
-#include "rterm.h"
 
 #define DISPLAY_FONT 0x80000000
 
diff --git a/rterm.c b/rterm.c
deleted file mode 100644 (file)
index 4414d56..0000000
--- a/rterm.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*  BSD License
-    Copyright (c) 2014 Andrey Chilikin https://github.com/achilikin
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-    this list of conditions and the following disclaimer in the documentation
-    and/or other materials provided with the distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-       ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/**
-       Sets stdin to raw mode so read() can get chars one by one 
-       without waiting for the Enter
-*/
-#include <poll.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <signal.h>
-#include <unistd.h>
-#include <termios.h>
-
-#include "rterm.h"
-
-static int restore = 0;
-
-/** restore canonical mode ar exit */
-static void    mode_restore_proc(void)
-{
-       stdin_mode(TERM_MODE_CAN);
-}
-
-/** set terminal mode: RAW or CANonical */
-int stdin_mode(int mode)
-{
-       struct termios term_attr;
-
-       tcgetattr(STDIN_FILENO, &term_attr);
-       /* set the terminal to raw mode */
-       if (mode == TERM_MODE_RAW) {
-               term_attr.c_lflag &= ~(ECHO | ICANON);
-               term_attr.c_cc[VMIN] = 0;
-               if (!restore) {
-                       restore++;
-                       atexit(mode_restore_proc);
-               }
-       }
-       else {
-               term_attr.c_lflag |= (ECHO | ICANON);
-               term_attr.c_cc[VMIN] = 1;
-       }
-       tcsetattr(STDIN_FILENO, TCSANOW, &term_attr);
-
-       return mode;
-}
-
-/** read stdin with timeout in ms, or -1 until a key is pressed */
-int stdin_getch(int timeout)
-{
-       struct pollfd polls;
-       polls.fd = STDIN_FILENO;
-       polls.events = POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI;
-       polls.revents = 0;
-
-       if (poll(&polls, 1, timeout) < 0)
-               return -1;
-
-       int ch = 0;
-       if (polls.revents) {
-               if (read(STDIN_FILENO, &ch, 1) < 0)
-                       return -1;
-       }
-
-       return ch;
-}
diff --git a/rterm.h b/rterm.h
deleted file mode 100644 (file)
index d73f042..0000000
--- a/rterm.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*  BSD License
-    Copyright (c) 2014 Andrey Chilikin https://github.com/achilikin
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-    this list of conditions and the following disclaimer in the documentation
-    and/or other materials provided with the distribution.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-       ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
-       OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-       INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-       CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-       ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-       POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/**
-       Sets stdin to raw mode so read() can get chars one by one 
-       without waiting for the Enter
-*/
-#ifndef __RAW_STDIN_TERM_H__
-#define __RAW_STDIN_TERM_H__
-
-#define TERM_MODE_CAN 0 /*< canonical terminal mode */
-#define TERM_MODE_RAW 1 /*< raw terminal mode */
-
-/** set terminal mode: RAW or CANonical */
-int    stdin_mode(int mode);
-/** read stdin with timeout in ms, or -1 until a key is pressed */
-int stdin_getch(int timeout);
-
-#endif