[augeas-devel] Make augtool quiet in batch mode.

David Lutterkort lutter at redhat.com
Tue Mar 31 19:05:21 UTC 2009


On Tue, 2009-03-31 at 10:17 +0200, Raphaël Pinson wrote:
> This patch makes augtool silent in batch mode, i.e. when stdin is a tty.
> In order to avoid printing the prompt in batch mode, it uses getline in
> this case.

This looks good now.

> This patch makes augtest output series of "Unknown command '\n'", but
> all tests pass. I cannot reproduce this error by sending empty lines to
> augtool in the shell, either with 'echo -e "command\ncommand" |' or 'cat <<EOF |'.

I am not entirely sure why that happened, but cleanpath/cleanstr had an
off-by-one error. This

    while (e != path && (*e == sep || isspace(*e)))

should be 

    while (e >= path && (*e == sep || isspace(*e)))

i.e. we should enter the loop body for e == path, too, so that we reduce
the string "\n" to ""

David





More information about the augeas-devel mailing list