I wrote: > Alvaro proposes nearby that we ought to have a src/common/ function > to slurp an indefinitely long line from a file [1]. If we do that, > it'd be entirely reasonable to make this code use that. So maybe > the right comment is "XXX FIXME later".
Actually, on further thought, the obviously right thing to do here is to refactor simple_prompt into two functions: the inner one is basically like fgets except it returns a malloc'd, variable-size string, and then the outer one does the other stuff simple_prompt needs such as prompting and opening /dev/tty. The inner function would serve initdb's need directly, and it would also have uses elsewhere, as per the other thread. I'll go make that happen. regards, tom lane