Linux `cal` utility in landscape mode
cal utility in Linux does not, unfortunately allow one to output the calendar in landscape mode (4 columns or more). The default
cal -y output mode will display 3 columns. Here’s a hack-around:
- Download the latest release of util-linux
- Extract and edit the misc-utils/cal.c file.
- Find the
- Add a
cal_month m4variable, which will hold the fourth column.
- A little lower find
m3.next = NULLand change it to
m3.next = m4;, add
m4.next = NULL;.
- Inside the
forloop change the
month += ...clause.
- If all went well the output of
./cal -yshould yield four columns instead of three.
You can probably make
cal output 2, 5 or 6 columns in a similar fashion. Crazy hack, eh?
Update 4th September, 2014: I have sent in a patch to the `util-linux` library with a new feature – landscape mode. `-l` and `–landscape` flags will stretch the year output as much as two times. Pull request can be accessed on their GitHub upstream mirror: https://github.com/karelzak/util-linux/pull/117