rtems dhcp: remove strncmp on environment vars in favor of strcmp
This commit is contained in:
@@ -715,52 +715,43 @@ dhcpcd_hook_handler(rtems_dhcpcd_hook *hook, char *const *env)
|
||||
sprintf(ifnamebuf, "%s", getPrimaryNetworkInterface());
|
||||
|
||||
while (*env != NULL) {
|
||||
char const * interface = "interface";
|
||||
char const * reason = "reason";
|
||||
char const * bound_str = "BOUND";
|
||||
|
||||
name = strtok_r(*env,"=", &env_position);
|
||||
value = strtok_r(NULL,"=", &env_position);
|
||||
printf("all out ---> %s = %s\n", name, value);
|
||||
|
||||
if (!strncmp(name, interface, strlen(interface)) &&
|
||||
if (!strcmp(name, "interface") &&
|
||||
!strcmp(value, ifnamebuf)) {
|
||||
snprintf(iName, sizeof(iName), "%s", value);
|
||||
}
|
||||
|
||||
if (!strncmp(name, reason, strlen(reason)) &&
|
||||
!strncmp(value, bound_str, strlen(bound_str))) {
|
||||
printf ("Interface %s bounded\n", iName);
|
||||
bound = 1;
|
||||
if (!strcmp(name, "if_up") && !strcmp(value, "true")) {
|
||||
printf ("Interface %s is up\n", iName);
|
||||
bound = true;
|
||||
}
|
||||
|
||||
if (bound) {
|
||||
// as there is no ntp-support in rtems-libbsd, we call our own client
|
||||
char const * new_ntp_servers = "new_ntp_servers";
|
||||
char const * new_host_name = "new_host_name";
|
||||
char const * new_tftp_server_name = "new_tftp_server_name";
|
||||
|
||||
if (!strncmp(name, new_ntp_servers, strlen(new_ntp_servers)))
|
||||
if (!strcmp(name, "new_ntp_servers"))
|
||||
snprintf(rtemsInit_NTP_server_ip,
|
||||
sizeof(rtemsInit_NTP_server_ip),
|
||||
"%s", value);
|
||||
|
||||
if (!strncmp(name, new_host_name, strlen(new_host_name)))
|
||||
if (!strcmp(name, "new_host_name"))
|
||||
sethostname (value, strlen (value));
|
||||
|
||||
if (!strncmp(name, new_tftp_server_name, strlen(new_tftp_server_name))){
|
||||
if (!strcmp(name, "new_tftp_server_name")) {
|
||||
snprintf(rtems_bsdnet_bootp_server_name,
|
||||
sizeof(bootp_server_name_init),
|
||||
"%s", value);
|
||||
printf(" rtems_bsdnet_bootp_server_name : %s\n", rtems_bsdnet_bootp_server_name);
|
||||
}
|
||||
if(!strncmp(name, "new_bootfile_name", 20)){
|
||||
if(!strcmp(name, "new_bootfile_name")){
|
||||
snprintf(rtems_bsdnet_bootp_boot_file_name,
|
||||
sizeof(bootp_boot_file_name_init),
|
||||
"%s", value);
|
||||
printf(" rtems_bsdnet_bootp_boot_file_name : %s\n", rtems_bsdnet_bootp_boot_file_name);
|
||||
}
|
||||
if(!strncmp(name, "new_rtems_cmdline", 20)){
|
||||
if(!strcmp(name, "new_rtems_cmdline")){
|
||||
snprintf(rtems_bsdnet_bootp_cmdline,
|
||||
sizeof(bootp_cmdline_init),
|
||||
"%s", value);
|
||||
|
||||
Reference in New Issue
Block a user