retreat: Reject invalid retreat paths
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 22 Jan 2014 18:26:24 +0000 (19:26 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 16 Feb 2014 12:19:26 +0000 (13:19 +0100)
commit40ec33b09958cd846bf5640ae990f9dd478a2135
tree5b49b01607a135256f28c0e97ec8795c4ed17e5c
parent1e3b7773d4e53cd94349c20c6145eafb1c4bb0cb
retreat: Reject invalid retreat paths

Undocumented misfeature: retreat and lretreat accept anything as
retreat path.  The paths' actual consumers retreat_ship1() and
retread_land1() silently ignore invalid direction characters.

The retreat paths are in xdump, and invalid ones could conceivably
confuse smart clients.

Change the commands to reject invalid paths, and the consumers to oops
on invalid direction characters.

Note that invalid paths get rejected even when they're not actually
used because the conditions argument contains a "c" for "cancel".
Requiring the user give a new path so he can cancel the old one is
comically bad design.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/retr.c
src/lib/subs/retreat.c
tests/retreat/01-retreat-1
tests/retreat/final.xdump
tests/retreat/journal.log