Add standard checks to the assigning of a country name

Add check to ensure a country by that name does not exist.
Ensure the length is not too long.  Note this is a change
behaviour for edit and change commands which used to silently
truncate long names.  Enforce that a country name can not have
control characters in it.  Ensure that a country name is not
blank or just spaces.
This commit is contained in:
Ron Koenderink 2009-01-06 17:22:26 -06:00
parent 17ad9fc5f2
commit aa5861d10b
5 changed files with 44 additions and 28 deletions

View file

@ -84,12 +84,10 @@ add(void)
}
natp = getnatp(coun);
p = getstarg(player->argp[2], "Country Name? ", buf);
if (p == 0 || *p == 0)
if (p ==0)
return RET_SYN;
if (strlen(p) >= sizeof(cntryname)) {
pr("Country name too long\n");
if (!check_nat_name(p))
return RET_FAIL;
}
strcpy(cntryname, p);
p = getstarg(player->argp[3], "Representative? ", buf);
if (p == 0 || *p == 0)