X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fcal.c;h=12c46b14ffa6a5f359f7bcbbc789811a63fd511b;hb=2a17fbe88a0cc064248db4ce8939f0fbc357922d;hp=f18c161206ad8118660ce0bf379427d7987f539d;hpb=dc7e5c46b0204bc3489ee961a631fb00533ae597;p=oweals%2Fbusybox.git diff --git a/coreutils/cal.c b/coreutils/cal.c index f18c16120..12c46b14f 100644 --- a/coreutils/cal.c +++ b/coreutils/cal.c @@ -16,6 +16,14 @@ * * Major size reduction... over 50% (>1.5k) on i386. */ + +//usage:#define cal_trivial_usage +//usage: "[-jy] [[MONTH] YEAR]" +//usage:#define cal_full_usage "\n\n" +//usage: "Display a calendar\n" +//usage: "\n -j Use julian dates" +//usage: "\n -y Display the entire year" + #include "libbb.h" #include "unicode.h" @@ -35,7 +43,7 @@ static const unsigned char days_in_month[] ALIGN1 = { }; static const unsigned char sep1752[] ALIGN1 = { - 1, 2, 14, 15, 16, + 1, 2, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 }; @@ -157,10 +165,10 @@ int cal_main(int argc UNUSED_PARAM, char **argv) char lineout[30]; day_array(month, year, dp); - len = sprintf(lineout, "%s %d", month_names[month - 1], year); + len = sprintf(lineout, "%s %u", month_names[month - 1], year); printf("%*s%s\n%s\n", - ((7*julian + WEEK_LEN) - len) / 2, "", - lineout, day_headings); + ((7*julian + WEEK_LEN) - len) / 2, "", + lineout, day_headings); for (row = 0; row < 6; row++) { build_row(lineout, dp)[0] = '\0'; dp += 7; @@ -173,10 +181,11 @@ int cal_main(int argc UNUSED_PARAM, char **argv) sprintf(lineout, "%u", year); center(lineout, - (WEEK_LEN * 3 + HEAD_SEP * 2) - + julian * (J_WEEK_LEN * 2 + HEAD_SEP - - (WEEK_LEN * 3 + HEAD_SEP * 2)), - 0); + (WEEK_LEN * 3 + HEAD_SEP * 2) + + julian * (J_WEEK_LEN * 2 + HEAD_SEP + - (WEEK_LEN * 3 + HEAD_SEP * 2)), + 0 + ); puts("\n"); /* two \n's */ for (i = 0; i < 12; i++) { day_array(i + 1, year, days[i]);