getch.c renamed to cross_getch.c
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:49:12 +0200
changeset 53 6b3d7e3418c1
parent 52 1fa566e9d13f
child 54 c064ce9f40f5
getch.c renamed to cross_getch.c committer: Markus Bröker <mbroeker@largo.homelinux.org>
libConsole/Makefile
libConsole/cross_getch.c
libConsole/getch.c
--- a/libConsole/Makefile
+++ b/libConsole/Makefile
@@ -16,7 +16,7 @@
 	Console.java
 
 OBJECTS= \
-	getch.o
+	cross_getch.o
 
 .SUFFIXES: .java
 
new file mode 100644
--- /dev/null
+++ b/libConsole/cross_getch.c
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <jni.h>
+#include <Console.h>
+
+#ifdef WIN32
+#include <conio.h>
+
+int cross_getch ()
+{
+    int ch = -1;
+
+    while (!kbhit ()) {
+        ch = getch ();
+    }
+
+    return ch;
+}
+
+#else
+#include <termios.h>
+
+int cross_getch ()
+{
+    int ch = -1, fd = 0;
+    struct termios neu, alt;
+
+    fd = fileno (stdin);
+    tcgetattr (fd, &alt);
+    neu = alt;
+    neu.c_lflag &= ~(ICANON | ECHO);
+    tcsetattr (fd, TCSANOW, &neu);
+    ch = getchar ();
+    tcsetattr (fd, TCSANOW, &alt);
+    return ch;
+}
+#endif
+
+JNIEXPORT jint JNICALL Java_Console_getch (JNIEnv * env, jclass lass)
+{
+    return cross_getch ();
+}
deleted file mode 100644
--- a/libConsole/getch.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <stdio.h>
-#include <jni.h>
-#include <Console.h>
-
-#ifdef WIN32
-#include <conio.h>
-
-int cross_getch ()
-{
-    int ch = -1;
-
-    while (!kbhit ()) {
-        ch = getch ();
-    }
-
-    return ch;
-}
-
-#else
-#include <termios.h>
-
-int cross_getch ()
-{
-    int ch = -1, fd = 0;
-    struct termios neu, alt;
-
-    fd = fileno (stdin);
-    tcgetattr (fd, &alt);
-    neu = alt;
-    neu.c_lflag &= ~(ICANON | ECHO);
-    tcsetattr (fd, TCSANOW, &neu);
-    ch = getchar ();
-    tcsetattr (fd, TCSANOW, &alt);
-    return ch;
-}
-#endif
-
-JNIEXPORT jint JNICALL Java_Console_getch (JNIEnv * env, jclass lass)
-{
-    return cross_getch ();
-}