[comp.sources.bugs] mush enhancement

brianc@cognos.uucp (Brian Campbell) (09/25/87)

   mush, as distributed, doesn't understand right-justfication in its
header format string (which I immediately noticed when trying to make my
subjects line up -- try set hdr_format "%S %25f %7d %-4l/%5c %25s").  A
fix is included below.
   I've got another couple of problems that I haven't tracked down yet:
the q command in curses mode doesn't position the cursor to the end of
the screen, and mush doesn't compile properly if SUNTOOL is undefined.
Other than this mush is really great!  Thanks Dan.

*** /tmp/da7343	Thu Sep 24 17:20:01 1987
--- hdrs.c	Thu Sep 24 16:46:48 1987
***************
*** 349,357 ****
  	    }
  	else if (*p == '%') {
  	    int buffer_space = 0;
  	    register char *p2;
  
! 	    if (isdigit(*++p))
  		p = my_atoi(p, &buffer_space);
  	    switch (*p) {
  		case 'f': p2 = from;
--- 349,360 ----
  	    }
  	else if (*p == '%') {
  	    int buffer_space = 0;
+ 	    int sign = -1;
  	    register char *p2;
  
! 	    if (*++p == '-')
! 		sign = 1, p++;
! 	    if (isdigit(*p))
  		p = my_atoi(p, &buffer_space);
  	    switch (*p) {
  		case 'f': p2 = from;
***************
*** 372,378 ****
  	    }
  	    if (!buffer_space)
  		buffer_space = strlen(p2);
! 	    (void) sprintf(b, "%-*.*s", buffer_space, buffer_space, p2);
  	    cnt += buffer_space, b += buffer_space;
  	} else
  	    cnt++, *b++ = *p;
--- 375,381 ----
  	    }
  	    if (!buffer_space)
  		buffer_space = strlen(p2);
! 	    (void) sprintf(b, "%*.*s", sign * buffer_space, buffer_space, p2);
  	    cnt += buffer_space, b += buffer_space;
  	} else
  	    cnt++, *b++ = *p;
-- 
Brian Campbell        uucp: decvax!utzoo!dciem!nrcaer!cognos!brianc
Cognos Incorporated   mail: POB 9707, 3755 Riverside Drive, Ottawa, K1G 3Z4
(613) 738-1440        fido: sysop@163/8