From 33456b33716500463d5c8fda36f9ed0b78933295 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 20 Jan 2013 23:38:40 +0100 Subject: [PATCH] edit: Treat blank interactive input like empty input Signed-off-by: Markus Armbruster --- src/lib/commands/edit.c | 4 +--- tests/actofgod/geninput.pl | 1 + tests/actofgod/journal.log | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/lib/commands/edit.c b/src/lib/commands/edit.c index f003514f7..85103fa56 100644 --- a/src/lib/commands/edit.c +++ b/src/lib/commands/edit.c @@ -405,11 +405,9 @@ getin(char *buf, char **valp) p = getstarg(NULL, "%c xxxxx -- thing value : ", buf); if (!p) return -1; - if (!*p) - return 0; for (; isspace(*p); p++) ; if (!*p) - return -1; + return 0; thing = *p; for (; *p && !isspace(*p); p++) ; for (; isspace(*p); p++) ; diff --git a/tests/actofgod/geninput.pl b/tests/actofgod/geninput.pl index 24881d8b3..56c9895f1 100755 --- a/tests/actofgod/geninput.pl +++ b/tests/actofgod/geninput.pl @@ -207,6 +207,7 @@ edit('sect', '1,5', 'm', 1, 'a', 1); # interactive edit iedit('sect', '3,5', 'm 2', 'a 1'); +iedit('sect', '5,5', ' '); # give give('2,6', 'l', $INT_MIN); diff --git a/tests/actofgod/journal.log b/tests/actofgod/journal.log index 85a507646..bab150780 100644 --- a/tests/actofgod/journal.log +++ b/tests/actofgod/journal.log @@ -750,6 +750,27 @@ Play#0 output Play#0 1 Mines : 0 Play#0 output Play#0 1 Road % : 0 Rail % : 0 Defense % : 0 Play#0 output Play#0 6 0 640 + Play#0 input edit l 5,5 + Play#0 command edit + Play#0 output Play#0 1 Location : 5,5 Distribution sector : 5,5 + Play#0 output Play#0 1 Designation : - New designation : - + Play#0 output Play#0 1 own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail + Play#0 output Play#0 1 o O e m i g f c u w l x X p t F a + Play#0 output Play#0 1 1 1 0 0 0 0 0 0 0 100 0 0 0 0 0 0 0 + Play#0 output Play#0 1 Mines : 0 + Play#0 output Play#0 1 Road % : 0 Rail % : 0 Defense % : 0 + Play#0 output Play#0 4 %c xxxxx -- thing value : + Play#0 input + Play#0 output Play#0 1 Location : 5,5 Distribution sector : 5,5 + Play#0 output Play#0 1 Designation : - New designation : - + Play#0 output Play#0 1 own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail + Play#0 output Play#0 1 o O e m i g f c u w l x X p t F a + Play#0 output Play#0 1 1 1 0 0 0 0 0 0 0 100 0 0 0 0 0 0 0 + Play#0 output Play#0 1 Mines : 0 + Play#0 output Play#0 1 Road % : 0 Rail % : 0 Defense % : 0 + Play#0 output Play#0 6 0 640 + Play#0 input + Play#0 output Play#0 6 0 640 Play#0 input give l 2,6 -2147483648 Play#0 command give Play#0 output Play#0 1 Only 0 given in 2,6 -- 2.43.0