edit: Treat blank interactive input like empty input

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2013-01-20 23:38:40 +01:00
parent 4c1866285b
commit 33456b3371
3 changed files with 23 additions and 3 deletions

View file

@ -405,11 +405,9 @@ getin(char *buf, char **valp)
p = getstarg(NULL, "%c xxxxx -- thing value : ", buf); p = getstarg(NULL, "%c xxxxx -- thing value : ", buf);
if (!p) if (!p)
return -1; return -1;
if (!*p)
return 0;
for (; isspace(*p); p++) ; for (; isspace(*p); p++) ;
if (!*p) if (!*p)
return -1; return 0;
thing = *p; thing = *p;
for (; *p && !isspace(*p); p++) ; for (; *p && !isspace(*p); p++) ;
for (; isspace(*p); p++) ; for (; isspace(*p); p++) ;

View file

@ -207,6 +207,7 @@ edit('sect', '1,5', 'm', 1, 'a', 1);
# interactive edit # interactive edit
iedit('sect', '3,5', 'm 2', 'a 1'); iedit('sect', '3,5', 'm 2', 'a 1');
iedit('sect', '5,5', ' ');
# give # give
give('2,6', 'l', $INT_MIN); give('2,6', 'l', $INT_MIN);

View file

@ -750,6 +750,27 @@
Play#0 output Play#0 1 Mines <M>: 0 Play#0 output Play#0 1 Mines <M>: 0
Play#0 output Play#0 1 Road % <R>: 0 Rail % <r>: 0 Defense % <d>: 0 Play#0 output Play#0 1 Road % <R>: 0 Rail % <r>: 0 Defense % <d>: 0
Play#0 output Play#0 6 0 640 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 <L>: 5,5 Distribution sector <D>: 5,5
Play#0 output Play#0 1 Designation <s>: - New designation <S>: -
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 <M>: 0
Play#0 output Play#0 1 Road % <R>: 0 Rail % <r>: 0 Defense % <d>: 0
Play#0 output Play#0 4 %c xxxxx -- thing value :
Play#0 input
Play#0 output Play#0 1 Location <L>: 5,5 Distribution sector <D>: 5,5
Play#0 output Play#0 1 Designation <s>: - New designation <S>: -
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 <M>: 0
Play#0 output Play#0 1 Road % <R>: 0 Rail % <r>: 0 Defense % <d>: 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 input give l 2,6 -2147483648
Play#0 command give Play#0 command give
Play#0 output Play#0 1 Only 0 given in 2,6 Play#0 output Play#0 1 Only 0 given in 2,6