Within cal there is called setupterm(3ncurses) from libtinfo even if stdin is not connected to a terminal: werner@linux:~> TERM= cal Segmentation fault werner@linux:~> unset TERM werner@linux:~> cal Segmentation fault