[PATCH 04/10] cal: simplify ascii_wnum() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Either the week is or isn't highlighted, there is no need to over
complicate printing of that.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 misc-utils/cal.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index f8e3714..44c1af1 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -970,12 +970,9 @@ static char *ascii_day(char *p, int day, const struct cal_control *ctl)
 static char *ascii_wnum(char *p, int wnum, const struct cal_control *ctl)
 {
 	if ((ctl->wflag & WEEK_NUM_MASK) == wnum)
-		p += sprintf(p,"%s",Senter);
-	p += sprintf(p,"%2d",wnum);
-	if ((ctl->wflag & WEEK_NUM_MASK) == wnum)
-		p += sprintf(p,"%s ",Sexit);
+		p += sprintf(p, "%s%2d%s ", Senter, wnum, Sexit);
 	else
-		p += sprintf(p," ");
+		p += sprintf(p, "%2d ", wnum);
 	return p;
 }
 
-- 
1.8.4.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux