[syslinux] unify core printf()/dprintf(): thoughts?

Gene Cumm gene.cumm at gmail.com
Sun Sep 15 11:17:47 PDT 2013


If I understand correctly, the Linux kernel has a function printk()
designed for most printing functions where a string prefix determines
where the message is seen.

Would something like this be useful in Syslinux?  As I see it, there's
essentially 3 separate printing methods with an additional variation.

Goals:
- To keep data size smaller, avoid 2+ identical static strings (akin
to { printf(my_message); dprintf(my_message); } )
- To keep code size down, only output simple strings.  ANSI Escape
sequences should be passed through directly or stripped.

Rough pseudocode:

- Unless output to current console(VGA or serial) is forced by prefix,
determine on-screen dynamic debug status of calling function.
- Possibly parse parameters once to a string
- If prefix or dynamic debug allows output to current console, output message.
- If prefix or dynamic debug allows output to serial and current
console isn't serial, output to serial.

Although I can't think of a situation in which a message sent to the
current console is not also sent to the serial (assuming current isn't
serial), it might be good to allow for such a situation.

A message without a prefix must have a default prefix assumed, likely
either both output or serial debug, to ease transition.

-- 
-Gene


More information about the Syslinux mailing list