I wanted to add -5 and -7 to cal and I did. And it works. But it looks bad. Can anyone think of better implementation? Thanks.
+ case '5': + nmons = 5; + if (--month == 0) { + month = 12; + year--; + } + if (--month == -1) { + month = 11; + year--; + } + break; + case '7': + nmons = 7; + if (--month == 0) { + month = 12; + year--; + } + if (--month == -1) { + month = 11; + year--; + } + if (--month == -2) { + month = 10; + year--; + } + break;