--- util-linux-2.12q.orig/misc-utils/cal.c 2004-12-05 22:20:36 +0300 +++ util-linux-2.12q/misc-utils/cal.c 2005-05-14 22:31:00 +0400 @@ -234,6 +234,7 @@ void monthly(int, int, int); void monthly3(int, int, int); void trim_trailing_spaces(char *); +void trim_one_trailing_space(char *); void usage(void); void headers_init(void); extern char *__progname; @@ -445,7 +446,7 @@ for (col = 0, p = lineout; col < 7; col++) p = ascii_day(p, days[row * 7 + col]); *p = '\0'; - trim_trailing_spaces(lineout); + trim_one_trailing_space(lineout); sprintf(out->s[row+2], "%s", lineout); } } @@ -716,6 +717,18 @@ *p = '\0'; } +void +trim_one_trailing_space(s) + char *s; +{ + char *p; + + for (p = s; *p; ++p) + continue; + if (p > s && isspace(*--p)) + *p = '\0'; +} + /* * Center string, handling multibyte characters appropriately. * In addition if the string is too large for the width it's truncated.