Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Sep 2011 06:50:08 GMT
From:      Stefan Walter <stefan@FreeBSD.org>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/160217: [Maintainer Update] emulators/doscmd update
Message-ID:  <201109010650.p816o81v031855@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/160217; it has been noted by GNATS.

From: Stefan Walter <stefan@FreeBSD.org>
To: GNATS <FreeBSD-gnats-submit@FreeBSD.org>,
	Stephen Hurd <shurd@sasktel.net>
Cc:  
Subject: Re: ports/160217: [Maintainer Update] emulators/doscmd update
Date: Thu, 1 Sep 2011 08:41:34 +0200

 --/NkBOFFp2J2Af1nK
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 [Patch re-attached for the PR record.]
 
 Stephen Hurd, 31.08.11, 16:35h CEST:
 
 > stefan@FreeBSD.org wrote:
 > > Please note that updates to existing ports should be sent in unified diff format
 > > (as produced by 'diff -u'), not as shar files, so changes to the port can be
 > > seen in the problem report. Could you send a followup with your update in
 > > unified diff format?
 > >    
 > 
 > Attached.  How should new and deleted files be sent for existing ports?
 
 The '-N' switch includes added and removed files in the diff. It's a good
 idea to also mention explicitly which files were added/removed. Also see
 [1].
 
 Since you asked - do you need to send another patch that also takes care
 of additions/removals, or is the last patch correct?
 
 Best regards,
 Stefan
 
 [1]: http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html#PORT-UPGRADING
 
 --/NkBOFFp2J2Af1nK
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="doscmd.patch"
 
 diff -u /usr/ports/emulators/doscmd/work/doscmd-20040330/doscmd.c doscmd.bbs/doscmd.c
 --- /usr/ports/emulators/doscmd/work/doscmd-20040330/doscmd.c	Mon Mar 29 16:00:00 2004
 +++ doscmd.bbs/doscmd.c	Mon Sep 23 21:42:31 2002
 @@ -31,7 +31,7 @@
   */
  
  #include <sys/cdefs.h>
 -__FBSDID("$FreeBSD: projects/doscmd/doscmd.c,v 1.25 2002/03/07 12:52:26 obrien Exp $");
 +__FBSDID("$FreeBSD: src/usr.bin/doscmd/doscmd.c,v 1.13.2.6 2002/04/25 11:04:51 tg Exp $");
  
  #include <sys/types.h>
  #include <sys/param.h>
 @@ -53,6 +53,7 @@
  #include <sys/proc.h>
  #include <machine/sysarch.h>
  #include <machine/vm86.h>
 +#include <termios.h>
  
  #include "doscmd.h"
  #include "cwd.h"
 @@ -67,6 +68,7 @@
  int		booting = 0;
  int		raw_kbd = 0;
  int		timer_disable = 0;
 +int		doormode = 0;
  struct timeval	boot_time;
  unsigned long	*ivec = (unsigned long *)0;
  
 @@ -510,8 +512,9 @@
      int 	i,c,p;
      FILE	*fp;
      char 	*col;
 +	struct termios tio_raw;
  
 -    while ((c = getopt(argc, argv, "234AbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
 +    while ((c = getopt(argc, argv, "234ABbCc:Dd:EGHIi:kLMOo:Pp:RrS:TtU:vVxXYz")) != -1) {
  	switch (c) {
  	case '2':
  	    debug_flags |= D_TRAPS2;
 @@ -527,6 +530,12 @@
  	    for (c = 0; c < 256; ++c)
  		debug_set(c);
  	    break;
 +	case 'B':	/* "BBS" mode */
 +		doormode = 1;
 +	tcgetattr(fileno(stdin),&tio_raw);
 +	cfmakeraw(&tio_raw);
 +	tcsetattr(fileno(stdin),TCSANOW,&tio_raw);
 +		break;
  	case 'b':
  	    booting = 1;
  	    break;
 @@ -823,7 +832,7 @@
  done(regcontext_t *REGS, int val)
  {
      if (curpsp < 2) {
 -	if (xmode) {
 +	if (xmode && !doormode) {
  	    const char *m;
  
  	    tty_move(24, 0);
 diff -u /usr/ports/emulators/doscmd/work/doscmd-20040330/doscmd.h doscmd.bbs/doscmd.h
 --- /usr/ports/emulators/doscmd/work/doscmd-20040330/doscmd.h	Mon Mar 29 16:00:00 2004
 +++ doscmd.bbs/doscmd.h	Mon Sep 23 21:42:31 2002
 @@ -29,7 +29,7 @@
   *
   *	BSDI doscmd.h,v 2.3 1996/04/08 19:32:32 bostic Exp
   *
 - * $FreeBSD: projects/doscmd/doscmd.h,v 1.14 2002/02/17 17:18:04 deischen Exp $
 + * $FreeBSD: src/usr.bin/doscmd/doscmd.h,v 1.7.2.1 2002/04/25 11:04:51 tg Exp $
   */
  
  
 @@ -178,6 +178,7 @@
  extern int		booting;
  extern int		raw_kbd;
  extern int		timer_disable;
 +extern int		doormode;
  extern char		cmdname[];
  extern struct timeval	boot_time;
  extern unsigned long	*ivec;
 diff -u /usr/ports/emulators/doscmd/work/doscmd-20040330/int14.c doscmd.bbs/int14.c
 --- /usr/ports/emulators/doscmd/work/doscmd-20040330/int14.c	Mon Mar 29 16:00:00 2004
 +++ doscmd.bbs/int14.c	Mon Sep 23 21:42:31 2002
 @@ -34,10 +34,11 @@
   */
  
  #include <sys/cdefs.h>
 -__FBSDID("$FreeBSD: projects/doscmd/int14.c,v 1.9 2002/03/30 13:51:40 dwmalone Exp $");
 +__FBSDID("$FreeBSD: src/usr.bin/doscmd/int14.c,v 1.2.2.1 2002/04/25 11:04:51 tg Exp $");
  
  #include <sys/ioctl.h>
  #include <sys/types.h>
 +#include <sys/time.h>
  #include <sys/uio.h>
  #include <termios.h>
  #include <unistd.h>
 @@ -113,7 +114,13 @@
  input(struct com_data_struct *cdsp, int force_read)
  {
   	int nbytes;
 +	fd_set	rfds;
 +	struct timeval timeout={0,0};
   
 +	if(doormode)  {
 +		cdsp->fd = STDIN_FILENO;
 +	}
 +	
   	if (cdsp->ids < N_BYTES && (force_read || !has_enough_data(cdsp))) {
   		nbytes = read(cdsp->fd, &cdsp->inbuf[cdsp->ids],
  		    N_BYTES - cdsp->ids);
 @@ -130,6 +137,10 @@
  {
   	int nbytes;
   
 + 	if(doormode)  {
 +		cdsp->fd = STDOUT_FILENO;
 +	}
 +	
   	if (cdsp->ods > 0) {
   		nbytes = write(cdsp->fd, &cdsp->outbuf[0], cdsp->ods);
   		debug(D_PORT, "write of fd %d on '%s' returned %d (%s)\n",
 @@ -206,13 +217,26 @@
  get_status(struct com_data_struct *cdsp)
  {
   	unsigned char s = (LS_X_DATA_E | LS_X_HOLD_E);
 - 	if (cdsp->ids > 0)
 - 		s |= LS_RCV_DATA_RD;
 - 	if (cdsp->ods > 0) {
 - 		s &= ~LS_X_DATA_E;
 - 		if (cdsp->ods >= N_BYTES)
 - 			s &= ~LS_X_HOLD_E;
 - 	}
 +	fd_set	rfds;
 +	struct timeval timeout={0,0};
 +	
 +	if (doormode)  {
 +		FD_ZERO(&rfds);
 +		FD_SET(STDIN_FILENO,&rfds);
 +		if(select(STDIN_FILENO+1,&rfds,NULL,NULL,&timeout)!=0)  {
 +			s |= LS_RCV_DATA_RD;
 +			debug(D_PORT,"READ away!");
 +		}
 +	}
 +	else  {
 + 		if (cdsp->ids > 0)
 + 			s |= LS_RCV_DATA_RD;
 + 		if (cdsp->ods > 0) {
 + 			s &= ~LS_X_DATA_E;
 + 			if (cdsp->ods >= N_BYTES)
 + 				s &= ~LS_X_HOLD_E;
 + 		}
 +	}
   	debug(D_PORT, "get_status: %x\n", (unsigned)s);
   	return s;
  }
 @@ -238,7 +262,7 @@
  }
   
  static void
 -com_async(int fd __unused, int cond, void *arg, regcontext_t *REGS __unused)
 +com_async(int fd, int cond, void *arg, regcontext_t *REGS)
  {
   	struct com_data_struct *cdsp = (struct com_data_struct*) arg;
   
 @@ -257,7 +281,7 @@
      struct com_data_struct *cdsp;
      int i;
  
 -    debug(D_PORT, "int14: dl = 0x%02X, al = 0x%02X.\n", R_DL, R_AL);
 +    debug(D_PORT, "int14: dl = 0x%02X, ah= 0x%02X, al = 0x%02X.\n", R_DL, R_AH, R_AL);
      if (R_DL >= N_COMS_MAX) {
  	if (vflag)
  	    dump_regs(REGS);
 @@ -267,9 +291,17 @@
  
      switch (R_AH) {
      case 0x00:	/* Initialize Serial Port */
 -	com_set_line(cdsp, R_DL + 1, R_AL);
 -	R_AH = get_status(cdsp);
 -	R_AL = 0;
 +	if (doormode)  {
 +	    R_AH=0x19;
 +	    R_AL=0x54;
 +	    R_BL=0x10;
 +	    R_BH=5;
 +	}
 +	else  {
 +	    com_set_line(cdsp, R_DL + 1, R_AL);
 +	    R_AH = get_status(cdsp);
 +	    R_AL = 0;
 +	}
  	break;
  
      case 0x01:	/* Write Character */
 @@ -295,8 +327,9 @@
  	break;
  
      case 0x03:	/* Status Request */
 +	cdsp->fd=STDIN_FILENO;
  	R_AH = get_status(cdsp);
 -	R_AL = 0;
 +	R_AL = 128;
  	break;
  
      case 0x04:	/* Extended Initialization */
 @@ -318,6 +351,19 @@
  		break;
  	}
  	break;
 +    case 0x08:	/* Flush output buffer */
 +	flush_out(cdsp);
 +    	break;
 +    case 0x09:	/* Purge output buffer */
 +	if (doormode)  {
 +		fpurge(stdout);
 +	}
 +    	break;
 +    case 0x0a:	/* Flush output buffer */
 +	if (doormode)  {
 +		fpurge(stdin);
 +	}
 +    	break;
      default:
  	unknown_int2(0x14, R_AH, REGS);
  	break;
 @@ -353,7 +399,7 @@
  	      port, cdsp->path);
  	return;
      }
 -    
 +
      cdsp->ids = cdsp->ods = cdsp->emptyint = 0;
      cdsp->int_enable = 0;
      cdsp->fifo_ctrl = 0;
 @@ -384,7 +430,7 @@
      } else {
  	cdsp->tty.c_cflag &= ~CSTOPB;
  	cdsp->line_ctrl &= ~LC_STOP_B;
 -    }    
 +    }
      switch (param & PARITY_EVEN) {
      case PARITY_ODD:
  	cdsp->tty.c_cflag |= (PARENB | PARODD);
 @@ -448,7 +494,7 @@
      ret_val = cfsetospeed(&cdsp->tty, speed);
      debug(D_PORT, "com_set_line: cfsetospeed returned 0x%X.\n", ret_val);
      errno = 0;
 -    ret_val = tcsetattr(cdsp->fd, 0, &cdsp->tty);
 +    ret_val = tcsetattr(cdsp->fd, 0, &cdsp->tty);	/* Causes an xterm to close */
      debug(D_PORT, "com_set_line: tcsetattr returned 0x%X (%s).\n",
  	ret_val, ret_val == -1 ? strerror(errno) : "");
      errno = 0;
 diff -u /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c doscmd.bbs/tty.c
 --- /usr/ports/emulators/doscmd/work/doscmd-20040330/tty.c	Mon Mar 29 16:00:00 2004
 +++ doscmd.bbs/tty.c	Mon Sep 23 21:42:32 2002
 @@ -31,7 +31,7 @@
   */
  
  #include <sys/cdefs.h>
 -__FBSDID("$FreeBSD: projects/doscmd/tty.c,v 1.25 2002/04/12 21:18:05 charnier Exp $");
 +__FBSDID("$FreeBSD: src/usr.bin/doscmd/tty.c,v 1.8.2.2 2002/04/25 11:04:51 tg Exp $");
  
  #include <sys/ioctl.h>
  #include <sys/time.h>
 @@ -124,22 +124,21 @@
  
  #define	row (CursRow0)
  #define	col (CursCol0)
 +#define BIOSrow (BIOS_CursRow0)
 +#define	BIOScol (BIOS_CursCol0)
 +
  
  /* Local functions */
  static void	_kbd_event(int, int, void *, regcontext_t *);
  static void	Failure(void *);
  static void	SetVREGCur(void);
 -#ifndef NO_X
  static void	debug_event(int, int, void *, regcontext_t *);
 -#endif
  static unsigned char	inb_port60(int);
  static int	inrange(int, int, int);
 -#ifndef NO_X
  static void	kbd_event(int, int, void *, regcontext_t *);
  static u_short	read_raw_kbd(int, u_short *);
  static void	setgc(u_short);
  static void	video_async_event(int, int, void *, regcontext_t *);
 -#endif
  
  #ifndef NO_X
  static void	dac2rgb(XColor *, int);
 @@ -197,8 +196,8 @@
  #define	K4_SLOCK_LED	0x01
  #define	K4_NLOCK_LED	0x02
  #define	K4_CLOCK_LED	0x04
 -#define	K4_ACK		0x10		/* ACK received from keyboard */
 -#define	K4_RESEND	0x20		/* RESEND received from keyboard */
 +#define	K4_ACK		0x10		/* ACK recieved from keyboard */
 +#define	K4_RESEND	0x20		/* RESEND recieved from keyboard */
  #define	K4_LED		0x40		/* LED update in progress */
  #define	K4_ERROR	0x80
  
 @@ -329,7 +328,7 @@
  }
  
  void
 -video_setborder(int color __unused)
 +video_setborder(int color)
  {
  #ifndef NO_X
  	XSetWindowBackground(dpy, win, pixels[color & 0xf]);
 @@ -341,10 +340,10 @@
  	blink = mode;
  }
  
 -#ifndef NO_X
  static void
  setgc(u_short attr)
  {
 +#ifndef NO_X
  	XGCValues v;
  	if (blink && !show && (attr & 0x8000))
  		v.foreground = pixels[(attr >> 12) & 0x07];
 @@ -353,8 +352,8 @@
  
  	v.background = pixels[(attr >> 12) & (blink ? 0x07 : 0x0f)];
  	XChangeGC(dpy, gc, GCForeground|GCBackground, &v);
 -}
  #endif
 +}
  
  void
  video_update(regcontext_t *REGS __unused)
 @@ -535,6 +534,7 @@
      
      return;
  }
 +#endif
  
  static u_short Ascii2Scan[] = {
   0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff,
 @@ -554,7 +554,6 @@
   0x0019, 0x0010, 0x0013, 0x001f, 0x0014, 0x0016, 0x002f, 0x0011,
   0x002d, 0x0015, 0x002c, 0x011a, 0x012b, 0x011b, 0x0129, 0xffff,
  };
 -#endif
  
  struct {
      u_short	base;
 @@ -653,9 +652,8 @@
      {	0x8600, 0x5888, 0x8a00, 0x8c00 }, /* key 88 - F12 */
  };
  
 -#ifndef NO_X
  void
 -debug_event(int fd __unused, int cond, void *arg __unused, regcontext_t *REGS)
 +debug_event(int fd, int cond, void *arg, regcontext_t *REGS)
  {
      static char ibuf[1024];
      static int icnt = 0;
 @@ -667,8 +665,8 @@
      
      if (!(cond & AS_RD))
      	return;
 -
 -    r = read(STDIN_FILENO, ibuf + icnt, sizeof(ibuf) - icnt);
 +    if(!doormode)
 +        r = read(STDIN_FILENO, ibuf + icnt, sizeof(ibuf) - icnt);
      if (r <= 0)
  	return;
  
 @@ -773,7 +771,6 @@
  	ibuf[icnt] = 0;
      }
  }
 -#endif
  
  unsigned char
  inb_port60(int port __unused)
 @@ -784,9 +781,8 @@
      return(r);
  }       
  
 -#ifndef NO_X
  void
 -kbd_event(int fd, int cond, void *arg __unused, regcontext_t *REGS __unused)
 +kbd_event(int fd, int cond, void *arg, regcontext_t *REGS)
  {
      if (!(cond & AS_RD))
         return;
 @@ -797,7 +793,6 @@
      if ((break_code = read_raw_kbd(fd, &scan_code)) != 0xffff)
  	hardint(0x01);
  }
 -#endif
  
  void
  int09(REGISTERS __unused)
 @@ -815,7 +810,6 @@
      send_eoi();
  }
  
 -#ifndef NO_X
  u_short
  read_raw_kbd(int fd, u_short *code)
  {
 @@ -987,12 +981,11 @@
  	return(0xffff);
      }
  }
 -#endif
  
 -#ifndef NO_X
  void
 -video_async_event(int fd, int cond, void *arg __unused, regcontext_t *REGS __unused)
 +video_async_event(int fd, int cond, void *arg, regcontext_t *REGS)
  {
 +#ifndef NO_X
      	int int9 = 0;
  
  	if (!(cond & AS_RD))
 @@ -1042,8 +1035,8 @@
                          break;
                  }
          }
 -}
  #endif
 +}
  
  #ifndef NO_X
  static int
 @@ -1427,7 +1420,9 @@
  tty_move(int r, int c)
  {
  	row = r;
 +	BIOSrow=r;
  	col = c;
 +	BIOScol=c;
  	SetVREGCur();
  }
  
 @@ -1449,10 +1444,13 @@
  {
  	int i;
  
 -	if (row > (height - 1))
 +	if (row > (height - 1))  {
  		row = 0;
 +		BIOSrow=0;
 +	}
  	else if (++row >= height) {
  		row = height - 1;
 +		BIOSrow = height = 1;
  		if (scroll) {
  			memcpy(vmem, &vmem[width], 2 * width * (height - 1));
  			for (i = 0; i < width; ++i)
 @@ -1494,16 +1492,21 @@
  		vmem[row * width + col] &= 0xff00;
  		break;
  	case '\t':
 -		if (row > (height - 1))
 +		if (row > (height - 1))  {
  			row = 0;
 +			BIOSrow = 0;
 +		}
  		col = (col + 8) & ~0x07;
 +		BIOScol = col;
  		if (col > width) {
  			col = 0;
 +			BIOScol = 0;
  			tty_index(1);
  		}
  		break;
  	case '\r':
  		col = 0;
 +		BIOScol = 0;
  		break;
  	case '\n':
  		tty_index(1);
 @@ -1511,10 +1514,13 @@
  	default:
  		if (col >= width) {
  			col = 0;
 +			BIOScol = 0;
  			tty_index(1);
  		}
 -		if (row > (height - 1))
 +		if (row > (height - 1))  {
  			row = 0;
 +			BIOSrow = 0;
 +		}
  		if (attr >= 0)
  			vmem[row * width + col] = attr & 0xff00;
  		else
 @@ -1543,10 +1549,13 @@
      while (n--) {
  	if (col >= width) {
  	    col = 0;
 +		BIOScol = 0;
  	    tty_index(0);
  	}
 -	if (row > (height - 1))
 +	if (row > (height - 1))  {
  	    row = 0;
 +		BIOSrow = 0;
 +	}
  	if (attr >= 0)
  	    vmem[row * width + col] = attr & 0xff00;
  	else
 @@ -1554,7 +1563,9 @@
  	vmem[row * width + col++] |= c;
      }
      row = srow;
 +	BIOSrow = srow;
      col = scol;
 +	BIOScol = scol;
      SetVREGCur();
  }
  
 @@ -1574,15 +1585,20 @@
      while (n--) {
  	if (col >= wd) {
  	    col = 0;
 +		BIOScol = 0;
  	    /* tty_index(0); *//* scroll up if last line is filled */
  	}
 -	if (row > (ht - 1))
 +	if (row > (ht - 1))  {
  	    row = 0;
 +		BIOSrow = 0;
 +	}
  	putchar_graphics(row * wd * CharHeight + col, c, attr);
  	col++;
      }
      row = srow;
 +	BIOSrow = 0;
      col = scol;
 +	BIOScol = scol;
      SetVREGCur();
  
      return;
 @@ -1641,6 +1657,8 @@
  {
      int r;
  
 +    if(doormode)
 +    	return(0);
      if ((r = nextchar) != 0) {
  	nextchar = 0;
  	return(r & 0xff);
 @@ -1648,7 +1666,7 @@
  
      if ((flag & TTYF_REDIRECT) && redirect0) {
  	char c;
 -    	if (read(STDIN_FILENO, &c, 1) != 1)
 +    	if (! doormode && read(STDIN_FILENO, &c, 1) != 1)
  	    return(-1);
  	if (c == '\n')
  	    c = '\r';
 @@ -2041,7 +2059,8 @@
  	font = XLoadQueryFont(dpy, FONTVGA);
  
      if (font == NULL)
 -	err(1, "Could not open font ``%s''\n", xfont);
 +//	err(1, "Could not open font ``%s''\n", xfont);
 +	font = XLoadQueryFont(dpy, "fixed");
  
      gcv.font = font->fid;
      XChangeGC(dpy, gc, GCFont, &gcv);
 
 --/NkBOFFp2J2Af1nK--



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