+
+int
+check_nat_name(char *cname)
+{
+ struct natstr *natp;
+ natid cn;
+ int nonb;
+ char *temp;
+
+ if (strlen(cname) >= sizeof(natp->nat_cnam)) {
+ pr("Country name too long\n");
+ return 0;
+ }
+
+ nonb = 0;
+ for (temp = cname; *temp != '\0'; temp++) {
+ if (iscntrl(*temp)) {
+ pr("No control characters allowed in country names!\n");
+ return 0;
+ } else if (!isspace(*temp))
+ nonb = 1;
+ }
+ if (!nonb) {
+ pr("Country name can't be all blank\n");
+ return 0;
+ }
+
+ for (cn = 0; NULL != (natp = getnatp(cn)); cn++) {
+ if (!strcmp(cname, natp->nat_cnam)) {
+ pr("Country #%d is already called `%s'\n", cn, cname);
+ return 0;
+ }
+ }
+ return 1;
+}