Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Jul 2007 06:05:13 GMT
From:      Stephen Hurd <shurd@sasktel.net>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/114615: Fixes and extra functionality for emulators/doscmd
Message-ID:  <200707160605.l6G65DQq009033@www.freebsd.org>
Resent-Message-ID: <200707160610.l6G6A1m9075903@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         114615
>Category:       ports
>Synopsis:       Fixes and extra functionality for emulators/doscmd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 16 06:10:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Stephen Hurd
>Release:        6.2-RELEASE-p3
>Organization:
>Environment:
FreeBSD server.hurd.local 6.2-RELEASE-p3 FreeBSD 6.2-RELEASE-p3 #0: Sat Mar 17 22:02:20 PDT 2007     admin@server.hurd.local:/usr/obj/usr/src/sys/SERVER  i386
>Description:
A year or so ago I emailed these patches to the maintainer and didn't get any feedback.  Just rediscovered them so figured I should submit them before they get lost...

patch-bioscursor
    Fixes the BIOS cursor handling so that programs such as the DOS edit.com
    and qbasic.exe work correctly
patch-desqview-timeslice
    Allows INT15 timeslicing so that programs which support it can avoid 100%
    CPU utilization
patch-quitemode
    Adds a -Q option which suppresses all video IO.  Also helps optimize the
    input behavior especially when polling for input.
patch-fossil-support
    Adds a -F option which enables support for FOSSIL IO using stdio.

The extra two options have not been documented in the manpage as I lack proper
man-fu.
>How-To-Repeat:

>Fix:
Add patches to the files directory.
manpage should be updated too.

Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	files/patch-bioscursor
#	files/patch-desqview-timeslice
#	files/patch-fossil-support
#	files/patch-quietmode
#
echo x - files/patch-bioscursor
sed 's/^X//' >files/patch-bioscursor << 'END-of-files/patch-bioscursor'
X--- /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c	Mon May  1 18:38:07 2006
X+++ tty.c	Mon May  1 18:38:51 2006
X@@ -125,6 +125,7 @@
X #define	row (CursRow0)
X #define	col (CursCol0)
X 
X+
X /* Local functions */
X static void	_kbd_event(int, int, void *, regcontext_t *);
X static void	Failure(void *);
X@@ -1427,7 +1428,9 @@
X tty_move(int r, int c)
X {
X 	row = r;
X+	BIOS_CursRow0 = r;
X 	col = c;
X+	BIOS_CursCol0 = c;
X 	SetVREGCur();
X }
X 
X@@ -1459,6 +1462,7 @@
X 				vmem[(height - 1) * width + i] = vattr | ' ';
X 		}
X 	}
X+	BIOS_CursRow0 = row;	/* Sync back with row */
X 	SetVREGCur();
X }
X 
X@@ -1489,21 +1493,27 @@
X 	case 0x08:
X 		if (row > (height - 1) || col > width)
X 			break;
X-		if (col > 0)
X+		if (col > 0) {
X 			--col;
X+			BIOS_CursCol0 = col;
X+		}
X 		vmem[row * width + col] &= 0xff00;
X 		break;
X 	case '\t':
X-		if (row > (height - 1))
X+		if (row > (height - 1)) {
X 			row = 0;
X+			BIOS_CursRow0 = 0;
X+		}
X 		col = (col + 8) & ~0x07;
X 		if (col > width) {
X 			col = 0;
X 			tty_index(1);
X 		}
X+		BIOS_CursCol0 = col;
X 		break;
X 	case '\r':
X 		col = 0;
X+		BIOS_CursCol0 = col;
X 		break;
X 	case '\n':
X 		tty_index(1);
X@@ -1511,10 +1521,13 @@
X 	default:
X 		if (col >= width) {
X 			col = 0;
X+			BIOS_CursCol0 = 0;
X 			tty_index(1);
X 		}
X-		if (row > (height - 1))
X+		if (row > (height - 1)) {
X 			row = 0;
X+			BIOS_CursRow0 = 0;
X+		}
X 		if (attr >= 0)
X 			vmem[row * width + col] = attr & 0xff00;
X 		else
X@@ -1554,7 +1567,9 @@
X 	vmem[row * width + col++] |= c;
X     }
X     row = srow;
X+    BIOS_CursRow0 = srow;
X     col = scol;
X+    BIOS_CursCol0 = scol;
X     SetVREGCur();
X }
X 
X@@ -1582,7 +1597,9 @@
X 	col++;
X     }
X     row = srow;
X+    BIOS_CursRow0 = srow;
X     col = scol;
X+    BIOS_CursCol0 = scol;
X     SetVREGCur();
X 
X     return;
X--- /home/admin/doscmd-20040330/video.c	Mon May  1 17:41:16 2006
X+++ video.c	Mon May  1 18:08:12 2006
X@@ -167,14 +167,18 @@
X 	    cp &= 0xff;
X 	    cp |= value << 8;
X 	    row = cp / DpyCols;
X+	    BIOS_CursRow0 = row;
X 	    col = cp % DpyCols;
X+	    BIOS_CursCol0 = col;
X 	    break;
X 	case CRTC_CurLocLo:	/* Update cursor position in BIOS */
X 	    cp = row * DpyCols + col;
X 	    cp &= 0xff00;
X 	    cp |= value;
X 	    row = cp / DpyCols;
X+	    BIOS_CursRow0 = row;
X 	    col = cp % DpyCols;
X+	    BIOS_CursCol0 = col;
X 	    break;
X 	default:
X 	    debug(D_VIDEO, "VGA: outb 0x%04x, 0x%02x at index 0x%02x\n",
END-of-files/patch-bioscursor
echo x - files/patch-desqview-timeslice
sed 's/^X//' >files/patch-desqview-timeslice << 'END-of-files/patch-desqview-timeslice'
X--- /usr/ports/emulators/doscmd/work/doscmd-20040330/bios.c	Mon Mar 29 16:00:00 2004
X+++ bios.c	Mon May  1 18:39:31 2006
X@@ -31,6 +31,7 @@
X  */
X 
X #include <sys/cdefs.h>
X+#include <time.h>
X __FBSDID("$FreeBSD: projects/doscmd/bios.c,v 1.9 2002/03/07 12:52:26 obrien Exp $");
X 
X #include "doscmd.h"
X@@ -110,6 +111,7 @@
X static void
X int15(regcontext_t *REGS)
X {
X+    const struct timespec rqtp={0,1};
X     R_FLAGS &= ~PSL_C;
X 
X     switch (R_AH) {
X@@ -119,6 +121,17 @@
X 	break;
X     case 0x04:			/* Set ABIOS table */
X 	R_FLAGS |= PSL_C;	/* We don't support it */
X+	break;
X+    case 0x10:			/* DesqView */
X+	switch (R_AL) {
X+	    case 0x00:		/* Give up CPU time */
X+		nanosleep(&rqtp, NULL);
X+		break;
X+	    case 0x22:		/* Get version */
X+		R_BH = 0x0a;	/* Use v2.0 for timeslice support */
X+		R_BL = 0x01;
X+		break;
X+	}
X 	break;
X     case 0x4f:			/* Keyboard intercept */
X 	debug(D_TRAPS | 0x15, "BIOS: Keyboard intercept\n");
END-of-files/patch-desqview-timeslice
echo x - files/patch-fossil-support
sed 's/^X//' >files/patch-fossil-support << 'END-of-files/patch-fossil-support'
Xdiff -u /root/doscmd-20040330/bios.c ./bios.c
X--- /root/doscmd-20040330/bios.c	Fri May  5 19:34:31 2006
X+++ ./bios.c	Fri May  5 19:39:27 2006
X@@ -297,7 +297,10 @@
X     ivec[0x12] = vec;
X     register_callback(vec, int12, "int 12");
X 
X-    vec = insert_softint_trampoline();
X+    if(fossil)
X+	vec = insert_fossil_softint_trampoline();
X+    else
X+	vec = insert_softint_trampoline();
X     ivec[0x14] = vec;
X     register_callback(vec, int14, "int 14");
X 
Xdiff -u /root/doscmd-20040330/callback.c ./callback.c
X--- /root/doscmd-20040330/callback.c	Fri May  5 19:34:31 2006
X+++ ./callback.c	Fri May  5 19:39:27 2006
X@@ -76,6 +76,25 @@
X     2,
X     0,
X };
X+/*
X+ * From the FOSSIL spec:
X+ * The driver has a "signature" that can be used to determine whether it is
X+ * present in memory. At offset 6 in the INT 14h service routine is a word,
X+ * 1954h,  followed  by a  byte that  specifies the maximum function number
X+ * supported by the driver. This is to make it possible to determine when a
X+ * driver is present and what level of functionality it provides.
X+ */
X+u_char fossil_softint_trampoline[] = {
X+    0xf4,	/* HLT */
X+    0xfb,	/* STI */
X+    0xca,	/* RETF 2 */
X+    2,
X+    0,
X+    0,
X+    0x54,
X+    0x19,
X+    0x1b,	/* Max. Supported FOSSIL AH */
X+};
X u_char hardint_trampoline[] = {
X     0xf4,	/* HLT */
X     0xcf,	/* IRET */
X@@ -102,6 +121,13 @@
X {
X     return (insert_generic_trampoline(
X 	sizeof(softint_trampoline), softint_trampoline));
X+}
X+
X+u_long
X+insert_fossil_softint_trampoline(void)
X+{
X+    return (insert_generic_trampoline(
X+	sizeof(fossil_softint_trampoline), fossil_softint_trampoline));
X }
X 
X u_long
Xdiff -u /root/doscmd-20040330/callback.h ./callback.h
X--- /root/doscmd-20040330/callback.h	Fri May  5 19:34:31 2006
X+++ ./callback.h	Fri May  5 19:39:27 2006
X@@ -9,5 +9,6 @@
X callback_t	find_callback(u_long);
X u_long		insert_generic_trampoline(size_t, u_char *);
X u_long		insert_softint_trampoline(void);
X+u_long		insert_fossil_softint_trampoline(void);
X u_long		insert_hardint_trampoline(void);
X u_long		insert_null_trampoline(void);
Xdiff -u /root/doscmd-20040330/doscmd.c ./doscmd.c
X--- /root/doscmd-20040330/doscmd.c	Fri May  5 19:34:31 2006
X+++ ./doscmd.c	Fri May  5 19:39:27 2006
X@@ -511,7 +511,7 @@
X     FILE	*fp;
X     char 	*col;
X 
X-    while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
X+    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
X 	switch (c) {
X 	case '2':
X 	    debug_flags |= D_TRAPS2;
X@@ -551,6 +551,9 @@
X 	    break;
X 	case 'E':
X 	    debug_flags |= D_EXEC;
X+	    break;
X+	case 'F':
X+	    fossil = 1;
X 	    break;
X 	case 'G':
X 	    debug_flags |= D_VIDEO;
Xdiff -u /root/doscmd-20040330/doscmd.h ./doscmd.h
X--- /root/doscmd-20040330/doscmd.h	Fri May  5 19:34:31 2006
X+++ ./doscmd.h	Fri May  5 19:39:27 2006
X@@ -224,6 +224,9 @@
X extern int	search_floppy(int i);
X extern void	disk_bios_init(void);
X 
X+/* int14.c */
X+extern int	fossil;
X+
X /* int16.c */
X void	int16(regcontext_t *);
X 
Xdiff -u /root/doscmd-20040330/int14.c ./int14.c
X--- /root/doscmd-20040330/int14.c	Fri May  5 19:34:31 2006
X+++ ./int14.c	Fri May  5 20:23:09 2006
X@@ -46,6 +46,9 @@
X #include "AsyncIO.h"
X #include "com.h"
X 
X+/* exports */
X+int fossil = 0;
X+
X #define N_BYTES	1024
X 
X struct com_data_struct {
X@@ -58,7 +61,9 @@
X 	int		ids;            /* input data size */
X 	int		ods;            /* output data size */
X 	int		emptyint;
X+	int		fossil_mode;	/* FOSSIL has been enabled */
X 	struct termios	tty;
X+	unsigned char	param;		/* Copy of init params */
X 	unsigned char	div_latch[2];	/* mirror of 16550 R0':R1'
X 					   read/write */
X 	unsigned char	int_enable;	/* mirror of 16550 R1 read/write */
X@@ -257,7 +262,7 @@
X     struct com_data_struct *cdsp;
X     int i;
X 
X-    debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL);
X+    debug(D_PORT, "int14: ah = 0x%02X, dl = 0x%02X, al = 0x%02X.\n", R_AH, R_DL, R_AL);
X     if (R_DL >= N_COMS_MAX) {
X 	if (vflag)
X 	    dump_regs(REGS);
X@@ -269,16 +274,31 @@
X     case 0x00:	/* Initialize Serial Port */
X 	com_set_line(cdsp, R_DL + 1, R_AL);
X 	R_AH = get_status(cdsp);
X-	R_AL = 0;
X+	if (cdsp->fossil_mode) {
X+	    R_AL = 0x08;
X+	    R_AL |= 0x80;
X+	}
X+	else
X+	    R_AL = 0;
X 	break;
X 
X     case 0x01:	/* Write Character */
X     	if (write_char(cdsp, R_AL)) {
X-		R_AH = get_status(cdsp);
X+	    R_AH = get_status(cdsp);
X+	    if (cdsp->fossil_mode) {
X+		R_AL = 0x08;
X+		R_AL |= 0x80;
X+	    }
X+	    else
X 		R_AL = 0;
X 	} else {
X-		debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL);
X-		R_AH = LS_SW_TIME_OUT;
X+	    debug(D_PORT, "int14: lost output character 0x%02x\n", R_AL);
X+	    R_AH = LS_SW_TIME_OUT;
X+	    if (cdsp->fossil_mode) {
X+		R_AL = 0x08;
X+		R_AL |= 0x80;
X+	    }
X+	    else
X 		R_AL = 0;
X 	}
X 	break;
X@@ -296,28 +316,193 @@
X 
X     case 0x03:	/* Status Request */
X 	R_AH = get_status(cdsp);
X-	R_AL = 0;
X+	if (cdsp->fossil_mode) {
X+	    R_AL = 0x08;
X+	    R_AL |= 0x80;
X+	}
X+	else
X+	    R_AL = 0;
X 	break;
X 
X     case 0x04:	/* Extended Initialization */
X-	R_AX = (LS_SW_TIME_OUT) << 8;
X+	if (fossil) {
X+	    cdsp->fossil_mode = 1;
X+	    R_AX = 0x1954;
X+	    R_BL = 0x1b;	/* Max supported FOSSIL AH */
X+	    R_BH = 5;
X+	}
X+	else
X+	    R_AX = (LS_SW_TIME_OUT) << 8;
X 	break;
X 
X-    case 0x05:	/* Modem Control Register operations */
X-	switch (R_AH) {
X-	case 0x00:	/* Read Modem Control Register */
X+    case 0x05:	/* Modem Control Register operations/FOSSIL deinit */
X+	if (fossil && cdsp->fossil_mode)
X+	    cdsp->fossil_mode = 0;
X+	else {
X+	    switch (R_AH) {
X+	    case 0x00:	/* Read Modem Control Register */
X 		R_AX = (LS_SW_TIME_OUT) << 8;
X 		break;
X 
X-	case 0x01:	/* Write Modem Control Register */
X+	    case 0x01:	/* Write Modem Control Register */
X 		R_AX = (LS_SW_TIME_OUT) << 8;
X 		break;
X 
X-	default:
X+	    default:
X 		unknown_int3(0x14, 0x05, R_AL, REGS);
X 		break;
X+	    }
X 	}
X 	break;
X+
X+    case 0x06:	/* FOSSIL raise/lower DTR */
X+	if(cdsp->fossil_mode) {
X+	    switch (R_AL) {
X+	    case 0:
X+		ioctl(cdsp->fd, TIOCCDTR);
X+		break;
X+	    case 1:
X+		ioctl(cdsp->fd, TIOCSDTR);
X+		break;
X+	    }
X+	    break;
X+	}
X+
X+    case 0x08:	/* FOSSIL Flush output buffer */
X+	if(cdsp->fossil_mode) {
X+	    flush_out(cdsp);
X+	    break;
X+	}
X+
X+    case 0x09:	/* FOSSIL Purge output buffer */
X+	if(cdsp->fossil_mode) {
X+	    cdsp->ods = 0;
X+	    break;
X+	}
X+
X+    case 0x0a:	/* FOSSIL Purge input buffer */
X+	if(cdsp->fossil_mode) {
X+	    cdsp->ids = 0;
X+	    break;
X+	}
X+
X+    case 0x0b:	/* FOSSIL Transmit no wait */
X+	if(cdsp->fossil_mode) {
X+	    if (cdsp->ods < N_BYTES) {
X+		if (write_char(cdsp, R_AL))
X+		    R_AX = 1;
X+	        else
X+		    R_AX = 0;
X+	    }
X+	    else
X+		R_AX = 0;
X+	    break;
X+	}
X+
X+    case 0x0c:	/* FOSSIL Non-destructive read-ahead */
X+	if(cdsp->fossil_mode) {
X+	    if(cdsp->ods) {
X+		R_AH = 0;
X+		R_AL = cdsp->inbuf[0];
X+	    } else
X+		R_AX = 0xffff;
X+	    break;
X+	}
X+
X+    case 0x0f:	/* FOSSIL Set flow control */
X+	if(cdsp->fossil_mode) {
X+	    if(R_AL & 0x01)	/* Enable output Xon/Xoff */
X+		cdsp->tty.c_iflag |= IXON;
X+	    else
X+		cdsp->tty.c_iflag &= ~(IXON);
X+
X+	    if(R_AL & 0x02)	/* Enable CTR/RTS */
X+		cdsp->tty.c_cflag |= CCTS_OFLOW|CRTS_IFLOW;
X+	    else
X+		cdsp->tty.c_iflag &= ~(CCTS_OFLOW|CRTS_IFLOW);
X+
X+	    if(R_AL & 0x08)	/* Enable input Xon/Xoff */
X+		cdsp->tty.c_iflag |= IXOFF;
X+	    else
X+		cdsp->tty.c_iflag &= ~(IXOFF);
X+
X+	    tcsetattr(cdsp->fd, 0, &cdsp->tty);
X+	    break;
X+	}
X+
X+    case 0x18:	/* FOSSIL Read block */
X+	if(cdsp->fossil_mode) {
X+	    int rd = R_CX;
X+
X+ 	    input(cdsp, 0);
X+	    if(rd > cdsp->ids)
X+		rd=cdsp->ids;
X+	    if(rd) {
X+		memmove((char *)MAKEPTR(R_ES, R_DI), cdsp->inbuf, rd);
X+		if(rd < cdsp->ids)
X+		    memmove(cdsp->inbuf, cdsp->inbuf + rd, N_BYTES - rd);
X+		cdsp->ids -= rd;
X+		R_AX = rd;
X+	    } else
X+		R_AX = 0;
X+	    break;
X+	}
X+
X+    case 0x19:	/* FOSSIL Write block */
X+	if(cdsp->fossil_mode) {
X+	    int wr = R_CX;
X+	    if(wr > N_BYTES - cdsp->ods)
X+		wr=N_BYTES - cdsp->ods;
X+	    if(wr) {
X+		memcpy(cdsp->outbuf + cdsp->ods, (char *)MAKEPTR(R_ES, R_DI), wr);
X+		cdsp->ods += wr;
X+		output(cdsp);
X+		R_AX = wr;
X+	    } else
X+		R_AX = 0;
X+	    break;
X+	}
X+
X+    case 0x1a:	/* FOSSIL Break begin/end */
X+	if(cdsp->fossil_mode) {
X+	    switch(R_AL) {
X+	    case 0:
X+		ioctl(cdsp->fd, TIOCCBRK);
X+		break;
X+	    case 1:
X+		ioctl(cdsp->fd, TIOCSBRK);
X+		break;
X+	    }
X+	    break;
X+	}
X+
X+    case 0x1b:	/* FOSSIL Driver information */
X+	if(cdsp->fossil_mode) {
X+	    unsigned char *p;
X+	    int  bufpos=0;
X+	    int  info_size=19;
X+	    const char *id_string="doscmd FOSSIL";
X+	    p = (unsigned char *)MAKEPTR(R_ES, R_DI);
X+	    p[bufpos++]=info_size&0xff;
X+	    p[bufpos++]=(info_size>>8)&0xff;
X+	    p[bufpos++]=5;
X+	    p[bufpos++]=0;
X+	    PUTVEC(*(u_short *)p, *(ushort *)(p + sizeof(u_short)), (u_long)id_string);
X+	    bufpos+=sizeof(u_short)*2;
X+	    p[bufpos++]=N_BYTES & 0xff;
X+	    p[bufpos++]=(N_BYTES>>8) & 0xff;
X+	    p[bufpos++]=(N_BYTES - cdsp->ids) & 0xff;
X+	    p[bufpos++]=((N_BYTES - cdsp->ids) >> 8) & 0xff;
X+	    p[bufpos++]=N_BYTES & 0xff;
X+	    p[bufpos++]=(N_BYTES>>8) & 0xff;
X+	    p[bufpos++]=(N_BYTES - cdsp->ods) & 0xff;
X+	    p[bufpos++]=((N_BYTES - cdsp->ods) >> 8) & 0xff;
X+	    p[bufpos++]=80;
X+	    p[bufpos++]=25;
X+	    p[bufpos++]=cdsp->param & BITRATE_9600;
X+	    break;
X+	}
X+
X     default:
X 	unknown_int2(0x14, R_AH, REGS);
X 	break;
X@@ -353,6 +538,7 @@
X 	      port, cdsp->path);
X 	return;
X     }
X+    cdsp->param = param;
X     
X     cdsp->ids = cdsp->ods = cdsp->emptyint = 0;
X     cdsp->int_enable = 0;
X@@ -402,12 +588,24 @@
X     }
X     switch (param & BITRATE_9600) {
X     case BITRATE_110:
X-	speed = B110;
X-	spd = 110;
X+	if (fossil) {
X+	    speed = B19200;
X+	    spd = 19200;
X+	}
X+	else {
X+	    speed = B110;
X+	    spd = 110;
X+	}
X 	break;
X     case BITRATE_150:
X-	speed = B150;
X-	spd = 150;
X+	if (fossil) {
X+	    speed = B38400;
X+	    spd = 38400;
X+	}
X+	else {
X+	    speed = B150;
X+	    spd = 150;
X+	}
X 	break;
X     case BITRATE_300:
X 	speed = B300;
END-of-files/patch-fossil-support
echo x - files/patch-quietmode
sed 's/^X//' >files/patch-quietmode << 'END-of-files/patch-quietmode'
Xdiff -u ./debug.c /home/admin/doscmd.working/doscmd-20040330/debug.c
X--- ./debug.c	Mon Mar 29 16:00:00 2004
X+++ /home/admin/doscmd.working/doscmd-20040330/debug.c	Wed May  3 13:58:35 2006
X@@ -106,7 +106,7 @@
X 
X     dead = 1;
X 
X-    if (xmode) {
X+    if (xmode && !quietmode) {
X 	char buf[1024];
X 	const char *m;
X 
Xdiff -u ./dos.c /home/admin/doscmd.working/doscmd-20040330/dos.c
X--- ./dos.c	Mon Mar 29 16:00:00 2004
X+++ /home/admin/doscmd.working/doscmd-20040330/dos.c	Wed May  3 13:58:35 2006
X@@ -625,9 +625,12 @@
X {
X     int		n;
X     
X-    /* XXX this is pretty bogus, actually */
X-    if (!xmode) {
X-	R_AL = 0xff;		/* no X mode, always claim data available */
X+    if (quietmode && !xmode) {
X+	const struct timespec rqtp={0,1};
X+
X+	/* In case of camping */
X+	nanosleep(&rqtp, NULL);
X+	R_AL = 0;
X 	return(0);
X     }
X     /* XXX tty_peek is broken */
Xdiff -u ./doscmd.c /home/admin/doscmd.working/doscmd-20040330/doscmd.c
X--- ./doscmd.c	Wed May  3 14:06:55 2006
X+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.c	Wed May  3 13:58:35 2006
X@@ -64,6 +64,7 @@
X int		capture_fd = -1;
X int		dead = 0;
X int		xmode = 0;
X+int		quietmode = 0;
X int		booting = 0;
X int		raw_kbd = 0;
X int		timer_disable = 0;
X@@ -226,7 +227,7 @@
X     kbd_init();
X     kbd_bios_init();
X     video_init();
X-    if (xmode)
X+    if (xmode || quietmode)
X 	mouse_init();
X     video_bios_init();
X     disk_bios_init();
X@@ -511,7 +512,7 @@
X     FILE	*fp;
X     char 	*col;
X 
X-    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
X+    while ((c = getopt(argc, argv, "234AbCc:Dd:EFGHIi:kLMOo:PpQ:RrS:TtU:vVxXYz")) != -1) {
X 	switch (c) {
X 	case '2':
X 	    debug_flags |= D_TRAPS2;
X@@ -620,6 +621,9 @@
X 		define_output_port_handler(p++, outb_port);
X 	    }
X 	    break;
X+	case 'Q':
X+	    quietmode = 1;
X+	    break;
X 	case 'R':
X 	    debug_flags |= D_REDIR;
X 	    break;
X@@ -826,7 +830,7 @@
X done(regcontext_t *REGS, int val)
X {
X     if (curpsp < 2) {
X-	if (xmode) {
X+	if (xmode && !quietmode) {
X 	    const char *m;
X 
X 	    tty_move(24, 0);
X@@ -861,7 +865,7 @@
X 	coq = coq->next;
X 	c->func(c->arg);
X     }
X-    if (!xmode)		/* XXX not for bootmode */
X+    if (!(xmode || quietmode))		/* XXX not for bootmode */
X 	puts("\n");
X     exit(status);
X }
Xdiff -u ./doscmd.h /home/admin/doscmd.working/doscmd-20040330/doscmd.h
X--- ./doscmd.h	Wed May  3 14:06:55 2006
X+++ /home/admin/doscmd.working/doscmd-20040330/doscmd.h	Wed May  3 13:58:35 2006
X@@ -175,6 +175,7 @@
X extern int		capture_fd;
X extern int		dead;
X extern int		xmode;
X+extern int		quietmode;
X extern int		booting;
X extern int		raw_kbd;
X extern int		timer_disable;
Xdiff -u ./int10.c /home/admin/doscmd.working/doscmd-20040330/int10.c
X--- ./int10.c	Mon Mar 29 16:00:00 2004
X+++ /home/admin/doscmd.working/doscmd-20040330/int10.c	Wed May  3 13:58:35 2006
X@@ -57,7 +57,7 @@
X 
X 	switch (R_AH) {
X 	case 0x00:		/* Set display mode */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		init_mode(R_AL);
X 		break;
X@@ -94,12 +94,12 @@
X 		break;
X 	}
X 	case 0x02:		/* Position cursor */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		tty_move(R_DH, R_DL);
X 		break;
X 	case 0x03:		/* Read cursor position */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		tty_report(&i, &j);
X 		R_DH = i;
X@@ -111,7 +111,7 @@
X 		debug(D_VIDEO, "Select current display page %d\n", R_AL);
X 		break;
X 	case 0x06:		/* initialize window/scroll text upward */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		if (R_AL == 0)		/* clear screen */
X 			R_AL = DpyRows + 1;
X@@ -120,7 +120,7 @@
X 		    R_AL, R_BH << 8);
X 		break;
X 	case 0x07:		/* initialize window/scroll text downward */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		if (R_AL == 0)		/* clear screen */
X 			R_AL = DpyRows + 1;
X@@ -129,24 +129,24 @@
X 		    R_AL, R_BH << 8);
X 		break;
X 	case 0x08:		/* read character/attribute */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		i = tty_char(-1, -1);
X 		R_AX = i;
X 		break;
X 	case 0x09:		/* write character/attribute */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		tty_rwrite(R_CX, R_AL, R_BL << 8);
X 		break;
X 	case 0x0a:		/* write character */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		debug(D_HALF, "Int 10:0a: Write char: %02x\n", R_AL);
X 		tty_rwrite(R_CX, R_AL, -1);
X 		break;
X 	case 0x0b:		/* set border color */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		video_setborder(R_BL);
X 		break;
X@@ -165,7 +165,7 @@
X 		R_BH = 0;/*ActivePage *//* display page */
X 		break;
X 	case 0x10:
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		switch (R_AL) {
X 		case 0x00:		/* Set single palette register */
X@@ -350,7 +350,7 @@
X 		}
X 		break;
X 	case 0x12:		/* Alternate function select */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		switch (R_BL) {
X 		case 0x10:	/* Read EGA/VGA config */
X@@ -372,7 +372,7 @@
X 		}
X 		break;
X 	case 0x13: /* write character string */
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X                 addr = (char *)MAKEPTR(R_ES, R_BP);
X 		switch (R_AL & 0x03) {
X@@ -407,7 +407,7 @@
X 		}
X 		break;
X 	case 0x1a:
X-		if (!xmode)
X+		if (!(xmode || quietmode))
X 			goto unsupported;
X 		R_AL = 0x1a;		/* I am VGA */
X 		R_BL = 8;		/* Color VGA */
Xdiff -u ./int16.c /home/admin/doscmd.working/doscmd-20040330/int16.c
X--- ./int16.c	Mon Mar 29 16:00:00 2004
X+++ /home/admin/doscmd.working/doscmd-20040330/int16.c	Wed May  3 13:58:35 2006
X@@ -78,7 +78,7 @@
X void
X int16(regcontext_t *REGS)
X {               
X-    if (!xmode && !raw_kbd) {
X+    if (!(xmode || raw_kbd || quietmode)) {
X 	if (vflag) dump_regs(REGS);
X 	fatal ("int16 func 0x%x only supported in X mode\n", R_AH);
X     }
Xdiff -u ./tty.c /home/admin/doscmd.working/doscmd-20040330/tty.c
X--- ./tty.c	Wed May  3 14:06:55 2006
X+++ /home/admin/doscmd.working/doscmd-20040330/tty.c	Wed May  3 13:58:35 2006
X@@ -34,6 +34,7 @@
X __FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $");
X 
X #include <sys/ioctl.h>
X+#include <sys/select.h>
X #include <sys/time.h>
X #include <sys/types.h>
X #include <sys/mman.h>
X@@ -1471,7 +1472,8 @@
X {
X     	if (attr == TTYF_REDIRECT) {
X 		if (redirect1) {
X-		    write(1, &c, 1);
X+		    if(!quietmode)
X+			write(1, &c, 1);
X 		    return;
X 		}
X 		attr = -1;
X@@ -1487,8 +1489,10 @@
X #ifndef NO_X
X 			XBell(dpy, 0);
X #endif
X-		} else
X+		} else {
X+		    if(!quietmode)
X 			write(1, "\007", 1);
X+		}
X 		break;
X 	case 0x08:
X 		if (row > (height - 1) || col > width)
X@@ -1658,20 +1662,14 @@
X {
X     int r;
X 
X+    if(quietmode && !xmode)
X+	return(0);
X+
X     if ((r = nextchar) != 0) {
X 	nextchar = 0;
X 	return(r & 0xff);
X     }
X 
X-    if ((flag & TTYF_REDIRECT) && redirect0) {
X-	char c;
X-    	if (read(STDIN_FILENO, &c, 1) != 1)
X-	    return(-1);
X-	if (c == '\n')
X-	    c = '\r';
X-	return(c);
X-    }
X-
X     if (KbdEmpty()) {
X 	if (flag & TTYF_BLOCK) {
X 	    while (KbdEmpty())
X@@ -1858,6 +1856,22 @@
X int
X KbdEmpty()
X {
X+	if(!xmode) {
X+	    fd_set rd;
X+	    struct timeval tv;
X+
X+	    FD_ZERO(&rd);
X+	    FD_SET(STDIN_FILENO, &rd);
X+	    tv.tv_sec=0;
X+	    tv.tv_usec=0;
X+	    if(select(STDIN_FILENO+1, &rd, NULL, NULL, &tv)==1) {
X+		char ch=0;
X+		read(STDIN_FILENO, &ch, 1);
X+		if(ch == '\n')
X+			ch = '\r';
X+		KbdWrite(ch);
X+	    }
X+	}
X 	return(K_NEXT == K_FREE);
X }
X 
Xdiff -u ./video.c /home/admin/doscmd.working/doscmd-20040330/video.c
X--- ./video.c	Wed May  3 14:06:55 2006
X+++ /home/admin/doscmd.working/doscmd-20040330/video.c	Wed May  3 13:58:35 2006
X@@ -276,9 +276,9 @@
X 	define_output_port_handler(GDC_DataPort, video_outb);
X     }
X 	
X-    redirect0 = isatty(0) == 0 || !xmode ;
X-    redirect1 = isatty(1) == 0 || !xmode ;
X-    redirect2 = isatty(2) == 0 || !xmode ;
X+    redirect0 = isatty(0) == 0 || !(xmode || quietmode);
X+    redirect1 = isatty(1) == 0 || !(xmode || quietmode);
X+    redirect2 = isatty(2) == 0 || !(xmode || quietmode);
X 
X     return;
X }
END-of-files/patch-quietmode
exit



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707160605.l6G65DQq009033>