Cleaned up check_nat_name() function
No functional changes. Rename temp to p and nonb to allblank.
This commit is contained in:
parent
aa5861d10b
commit
afdd0b00c8
1 changed files with 8 additions and 8 deletions
|
@ -120,23 +120,23 @@ check_nat_name(char *cname)
|
||||||
{
|
{
|
||||||
struct natstr *natp;
|
struct natstr *natp;
|
||||||
natid cn;
|
natid cn;
|
||||||
int nonb;
|
int allblank;
|
||||||
char *temp;
|
char *p;
|
||||||
|
|
||||||
if (strlen(cname) >= sizeof(natp->nat_cnam)) {
|
if (strlen(cname) >= sizeof(natp->nat_cnam)) {
|
||||||
pr("Country name too long\n");
|
pr("Country name too long\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nonb = 0;
|
allblank = 1;
|
||||||
for (temp = cname; *temp != '\0'; temp++) {
|
for (p = cname; *p != '\0'; p++) {
|
||||||
if (iscntrl(*temp)) {
|
if (iscntrl(*p)) {
|
||||||
pr("No control characters allowed in country names!\n");
|
pr("No control characters allowed in country names!\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!isspace(*temp))
|
} else if (!isspace(*p))
|
||||||
nonb = 1;
|
allblank = 0;
|
||||||
}
|
}
|
||||||
if (!nonb) {
|
if (allblank) {
|
||||||
pr("Country name can't be all blank\n");
|
pr("Country name can't be all blank\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue