[comp.os.minix] More cm= output formats for v1.3d termcap

cgs@umd5.umd.edu (Chris G. Sylvain) (06/06/89)

Here's a cdiff for lib:termcap.c to add "%." and "%>xy" output formats.
My (peculiar) terminals requires the use of the "%>xy" format, and not
having "%." seemed to be potentially annoying.

Also, "OOPS" really will be output if an unrecognized "%<fmt>" string
appears in the termcap file.

---------cut here---------

*** termcap.c.org	Tue Apr  4 20:43:38 1989
--- termcap.c	Tue May 23 21:17:02 1989
***************
*** 233,249 ****
  {
  	register char	*rp;
  	static char	ret[24];
! 	int		incr = 0;
! 	int 		argno = 0, numval;
  
  	for (rp = ret ; *cm ; cm++) {
  		switch(*cm) {
  		case '%' :
  			switch(*++cm) {
  			case '+' :
  				numval = (argno == 0 ? destline : destcol);
  				argno = 1 - argno;
! 				*rp++ = numval + incr + *++cm;
  				break;
  
  			case '%' :
--- 233,268 ----
  {
  	register char	*rp;
  	static char	ret[24];
! 	int		incr = 0, chkval = 0;
! 	int 		argno = 0, numval, addval;
  
  	for (rp = ret ; *cm ; cm++) {
  		switch(*cm) {
  		case '%' :
  			switch(*++cm) {
+ 			case '.' :
+ 				numval = (argno == 0 ? destline : destcol);
+ 				argno = 1 - argno;
+ 				*rp++ = numval + incr;
+ 				break;
+ 
+ 			case '>' :
+ 				chkval = *++cm;
+ 				addval = *++cm;
+ 				break;
+ 
  			case '+' :
  				numval = (argno == 0 ? destline : destcol);
  				argno = 1 - argno;
! 				if (chkval > 0) {
! 					*rp = numval + incr + *++cm;
! 					if (*rp > chkval)
! 						*rp += addval;
! 					rp++;
! 					chkval = 0;
! 				} else {
! 					*rp++ = numval + incr + *++cm;
! 				}
  				break;
  
  			case '%' :
***************
*** 265,270 ****
--- 284,293 ----
  			case 'r' :
  				argno = 1;
  				break;
+ 
+ 			default :
+ 				*rp++ = 'O'; *rp++ = 'O';
+ 				*rp++ = 'P'; *rp++ = 'S';
  			}
  
  			break;

-- 
--==---==---==--
.. Came whiffling through the tulgey wood, ..
   ARPA: cgs@umd5.UMD.EDU     BITNET: cgs%umd5@umd2
   UUCP: ..!uunet!umd5.umd.edu!cgs