Making XWindows interfaces fallback to ncurses?
I'm trying to make a program that will present a nice XWindows interface when run on the desktop, but will fall back to a ncurses interface if X is not available. The idea is to have a nice interface when I can, but still provide a windowing interface on systems that don't have X installed. I know SuSE's YaST2 admin tool does this, and I'm wondering if there are any packages out there that provide this ability.
What I'd like ideally is a library which abstracts the UI, so I just write to one API and it takes care of deciding if it should use a graphical or a text interface. Does anyone know of such a library, or any projects that are trying to develop one?