I suppose it's because I've spent quite a lot of time in the GNU Readline source that this function doesn't seem that bad. Not that I'm wanting to endorse it as great code, of course.
I find it fascinating to look at how old but very well used software develops (often, but not always) in ways that seem completely ghastly.
I find it fascinating to look at how old but very well used software develops (often, but not always) in ways that seem completely ghastly.