Those of you who waste large amounts of time on IRC, esp. on The Channel Which
Shall Rename Nameless will appreciate this:

figlet is this nifty little ASCII art tool that Alfred likes to use a lot.  He
has since gotten several other people hooked on using it, and a sort of running
joke has been to get figlet into the kernel.  (Imagine ASCII part panic
messages for example.)  Mike Smith ported the figlet program as a filter on the
low-level console output by taking over v_putc a while ago but it had an
annoying bug where it only printed one char out at a time.  During some down
time tonight during which my brain was vegging, I picked up the code, tracked
down the bug and added some features:

- Originally, once figlet was initialized, it was turned on until you rebooted.
  Now it defaults to being off, but you can change that via a loader tunable
  (kern.figlet_enable).  Also, there is an escape character that you can use to
  send commands to the figlet filter.  Right now the only commands are to turn
  on figlet output; adjust the justification of the outputted text as either
  left, center, or right aligned; or turn off figlet output and revert to
  normal output.  When figlet is turned off, the justification is reset to the
  default of left.
- figlet is not a psuedo device that can be conditionally compiled into the
  kernel by putting 'device figlet' in your kernel config file
- a spin lock has been added to protect the state machine variables so that
  it is SMPng safe.
- a new console API function cnsetputc() has been added so that v_putc can be
  changed at runtime.  This isn't quite right as v_putc really needs a lock now.

Currently figlet isn't a kernel module, but one could make it so without too
much additional work.  To play with this, first download and apply the patch at

Then compile a kernel with 'device figlet'.  You will need to load a figlet
font file in the loader when you boot.  You can get font files from either the
figlet or figlet-fonts ports.  For example, if you copy
/usr/local/share/figlet/standard.flf (the default font) to /boot, then you
would need to either use 'load -t figlet_font /boot/standard.flf' prior to
booting the kernel or add the following to /boot/loader.conf:


The patch includes a sample SYSINIT at the bottom of subr_figlet.c that
demonstrates sending commands to the filter.

So who's going to do subr_jive.c next? :)


John Baldwin <[EMAIL PROTECTED]>  <><
"Power Users Use the Power to Serve!"  -

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to