/* He удалось распознать имя. */
error(optarg, "invalid host name");
else
/* Введено правильное имя */
local_address.s_addr =
*((int*)(local_host_name->h_addr_list[0]));
}
break;
case 'h':
/* Пользователь ввёл -h или --help. */
print_usage(0);
case 'm':
/* Пользователь ввел -m или --module-dir. */
{
struct stat dir_info;
/* Проверка существования каталога */
if (access(optarg, F_OK) != 0)
error(optarg, "module directory does not exist");
/* Проверка доступности каталога. */
if (access(optarg, R_OK | X_OK) != 0)
error(optarg, "module directory is not accessible");
/* Проверка того, что это каталог. */
if (stat(optarg, &dir_info) != 0 || !S_ISDIR(dir_info.st_mode))
error(optarg, "not a directory");
/* Все правильно. */
module_dir = strdup(optarg);
}
break;
case 'p':
/* Пользователь ввел -p или --port. */