* Re: Weird message.
@ 2003-07-20 11:07 Stas Sergeev
0 siblings, 0 replies; 2+ messages in thread
From: Stas Sergeev @ 2003-07-20 11:07 UTC (permalink / raw)
To: linux-msdos
[-- Attachment #1: Type: text/plain, Size: 179 bytes --]
Hello.
hector Colina wrote:
> Well, when starting dosemu, i get the message: "no
> console". What is it?
Try the updated getfd code (here is the patch)
and maybe that will help?
[-- Attachment #2: dosemu_console.diff --]
[-- Type: text/plain, Size: 3785 bytes --]
diff -urN dosemu-1.1.5.5/src/plugin/kbd_unicode/Makefile dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/Makefile
--- dosemu-1.1.5.5/src/plugin/kbd_unicode/Makefile Sun Jul 20 14:25:40 2003
+++ dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/Makefile Sun Jul 20 14:31:19 2003
@@ -21,7 +21,7 @@
CFILES:=dosemu_keys.c keynum.c
-CFILES := serv_xlat.c serv_backend.c serv_8042.c keymaps.c keyb_raw.c \
+CFILES := serv_xlat.c serv_backend.c serv_8042.c keymaps.c keyb_raw.c getfd.c \
keyb_clients.c prestroke.c $(X_CFILES) keyb_none.c keyboard.c \
$(CFILES)
diff -urN dosemu-1.1.5.5/src/plugin/kbd_unicode/getfd.c dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/getfd.c
--- dosemu-1.1.5.5/src/plugin/kbd_unicode/getfd.c Thu Jan 1 03:00:00 1970
+++ dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/getfd.c Sun Jul 20 14:38:13 2003
@@ -0,0 +1,67 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <linux/kd.h>
+#include <sys/ioctl.h>
+#include "getfd.h"
+
+/*
+ * getfd.c
+ *
+ * Get an fd for use with kbd/console ioctls.
+ * We try several things because opening /dev/console will fail
+ * if someone else used X (which does a chown on /dev/console).
+ */
+
+static int
+is_a_console(int fd) {
+ char arg;
+
+ arg = 0;
+ return (ioctl(fd, KDGKBTYPE, &arg) == 0
+ && ((arg == KB_101) || (arg == KB_84)));
+}
+
+static int
+open_a_console(char *fnam) {
+ int fd;
+
+ fd = open(fnam, O_RDONLY);
+ if (fd < 0 && errno == EACCES)
+ fd = open(fnam, O_WRONLY);
+ if (fd < 0)
+ return -1;
+ if (!is_a_console(fd)) {
+ close(fd);
+ return -1;
+ }
+ return fd;
+}
+
+int getfd() {
+ int fd;
+
+ fd = open_a_console("/dev/tty");
+ if (fd >= 0)
+ return fd;
+
+ fd = open_a_console("/dev/tty0");
+ if (fd >= 0)
+ return fd;
+
+ fd = open_a_console("/dev/vc/0");
+ if (fd >= 0)
+ return fd;
+
+ fd = open_a_console("/dev/console");
+ if (fd >= 0)
+ return fd;
+
+ for (fd = 0; fd < 3; fd++)
+ if (is_a_console(fd))
+ return fd;
+
+ return -1;
+}
diff -urN dosemu-1.1.5.5/src/plugin/kbd_unicode/getfd.h dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/getfd.h
--- dosemu-1.1.5.5/src/plugin/kbd_unicode/getfd.h Thu Jan 1 03:00:00 1970
+++ dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/getfd.h Fri Oct 11 15:09:01 2002
@@ -0,0 +1 @@
+extern int getfd(void);
diff -urN dosemu-1.1.5.5/src/plugin/kbd_unicode/keymaps.c dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/keymaps.c
--- dosemu-1.1.5.5/src/plugin/kbd_unicode/keymaps.c Sat Jun 7 12:10:12 2003
+++ dosemu-1.1.5.5-kbd/src/plugin/kbd_unicode/keymaps.c Sun Jul 20 14:28:59 2003
@@ -20,10 +20,8 @@
#include "keymaps.h"
#include "keyb_clients.h"
#include "keynum.h"
+#include "getfd.h"
-static int is_a_console(int);
-static int open_a_console(char *);
-static int getfd(void);
static int read_kbd_table(struct keytable_entry *);
@@ -2099,43 +2097,6 @@
{0}
};
-
-/*
- * Look for a console. This is based on code in getfd.c from the kbd-0.99 package
- * (see loadkeys(1)).
- */
-
-static int is_a_console(int fd)
-{
- char arg = 0;
-
- return ioctl(fd, KDGKBTYPE, &arg) == 0 && (arg == KB_101 || arg == KB_84);
-}
-
-static int open_a_console(char *fnam)
-{
- int fd;
-
- fd = open(fnam, O_RDONLY);
- if(fd < 0 && errno == EACCES) fd = open(fnam, O_WRONLY);
- if(fd < 0 || ! is_a_console(fd)) return -1;
-
- return fd;
-}
-
-static int getfd()
-{
- int fd, i;
- char *t[] = { "", "", "", "/dev/tty", "/dev/tty0", "/dev/console" };
-
- for(i = 0; i < sizeof t / sizeof *t; i++) {
- if(!*t[i] && is_a_console(i)) return i;
- if(*t[i] && (fd = open_a_console(t[i])) >= 0) return fd;
- }
-
- return -1;
-}
-
#if 0
static char* pretty_keysym(t_keysym d)
{
^ permalink raw reply [flat|nested] 2+ messages in thread
* Weird message.
@ 2003-07-19 20:05 hector Colina
0 siblings, 0 replies; 2+ messages in thread
From: hector Colina @ 2003-07-19 20:05 UTC (permalink / raw)
To: linux-msdos
Hi. I'm using dosemu 1.1.5.5 and FreeDOS kernel version 1.1.28 (Build 2028).
Well, when starting dosemu, i get the message: "no console". What is it?
Thank
_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger:
http://messenger.yupimsn.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-07-20 11:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-20 11:07 Weird message Stas Sergeev
-- strict thread matches above, loose matches on Subject: below --
2003-07-19 20:05 hector Colina
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.