[net.sources.games] Patch to make robots work on Pyramids.

clewis@mnetor.UUCP (Chris Lewis) (06/28/85)

There is a problem with Robot's useage of _doprnt on a Pyramid in the
Berkeley universe.  The Pyramid's doprnt is closer to System V.
Symptom: the program core dumps while it is trying to tell you that
you've won.

Apply the following patch:

*** robots.old.c	Thu Jun 27 22:47:12 1985
--- robots.c	Thu Jun 27 23:00:00 1985
***************
*** 853,858
  	return(x > 0);
  }
  
  msg(message,args)
  	char *message;
  	int args;

--- 853,859 -----
  	return(x > 0);
  }
  
+ #ifndef	pyr
  msg(message,args)
  	char *message;
  	int args;
***************
*** 869,874
  	clrtoeol();
  	refresh();
  }
  
  interrupt()
  {

--- 870,901 -----
  	clrtoeol();
  	refresh();
  }
+ #else
+ #include <varargs.h>
+ msg(format, va_alist)
+ char *format;
+ va_dcl
+ {
+ 	register int count;
+ 	FILE siop;
+ 	va_list ap;
+ 	unsigned char	buf[5000];		/* data storage */
+ 
+ 	siop._cnt = sizeof(buf) ;
+ 	siop._base = siop._ptr = &buf[0] ;
+ 	siop._flag = _IOWRT;
+ 	siop._file = _NFILE;
+ 	va_start(ap);
+ 	count = _doprnt(format, ap, &siop);
+ 	va_end(ap);
+ 	*siop._ptr = '\0'; /* plant terminating null character */
+ 	putc(0,&siop);
+ 	mvaddstr(LINES-1,MSGPOS,buf);
+ 	clrtoeol();
+ 	refresh();
+ 
+ }
+ #endif	pyr
  
  interrupt()
  {
-- 
Chris Lewis,
UUCP: {allegra, linus, ihnp4}!utzoo!mnetor!clewis
BELL: (416)-475-8980 ext. 321