Commit 113d358c authored by Jiří Klimeš's avatar Jiří Klimeš Committed by Dan Winship

cli: make 'value' in NmcOutputField non const

parent 6ff924f8
......@@ -159,12 +159,12 @@ print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix)
wins_arr[i] = NULL;
}
set_val_str (nmc->allowed_fields, 0, group_prefix);
set_val_arr (nmc->allowed_fields, 1, (const char **) addr_arr);
set_val_arr (nmc->allowed_fields, 2, (const char **) route_arr);
set_val_arr (nmc->allowed_fields, 3, (const char **) dns_arr);
set_val_arr (nmc->allowed_fields, 4, (const char **) domain_arr);
set_val_arr (nmc->allowed_fields, 5, (const char **) wins_arr);
set_val_str (nmc->allowed_fields, 0, (char *) group_prefix);
set_val_arr (nmc->allowed_fields, 1, addr_arr);
set_val_arr (nmc->allowed_fields, 2, route_arr);
set_val_arr (nmc->allowed_fields, 3, dns_arr);
set_val_arr (nmc->allowed_fields, 4, domain_arr);
set_val_arr (nmc->allowed_fields, 5, wins_arr);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......@@ -257,11 +257,11 @@ print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix)
domain_arr[i] = NULL;
}
set_val_str (nmc->allowed_fields, 0, group_prefix);
set_val_arr (nmc->allowed_fields, 1, (const char **) addr_arr);
set_val_arr (nmc->allowed_fields, 2, (const char **) route_arr);
set_val_arr (nmc->allowed_fields, 3, (const char **) dns_arr);
set_val_arr (nmc->allowed_fields, 4, (const char **) domain_arr);
set_val_str (nmc->allowed_fields, 0, (char *) group_prefix);
set_val_arr (nmc->allowed_fields, 1, addr_arr);
set_val_arr (nmc->allowed_fields, 2, route_arr);
set_val_arr (nmc->allowed_fields, 3, dns_arr);
set_val_arr (nmc->allowed_fields, 4, domain_arr);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......@@ -303,8 +303,8 @@ print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix)
options_arr[i++] = g_strdup_printf ("%s = %s", (char *) key, (char *) value);
options_arr[i] = NULL;
set_val_str (nmc->allowed_fields, 0, group_prefix);
set_val_arr (nmc->allowed_fields, 1, (const char **) options_arr);
set_val_str (nmc->allowed_fields, 0, (char *) group_prefix);
set_val_arr (nmc->allowed_fields, 1, options_arr);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......@@ -345,8 +345,8 @@ print_dhcp6_config (NMDHCP6Config *dhcp6, NmCli *nmc, const char *group_prefix)
options_arr[i++] = g_strdup_printf ("%s = %s", (char *) key, (char *) value);
options_arr[i] = NULL;
set_val_str (nmc->allowed_fields, 0, group_prefix);
set_val_arr (nmc->allowed_fields, 1, (const char **) options_arr);
set_val_str (nmc->allowed_fields, 0, (char *) group_prefix);
set_val_arr (nmc->allowed_fields, 1, options_arr);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......
......@@ -310,14 +310,14 @@ show_connection (NMConnection *data, gpointer user_data)
timestamp_real = timestamp;
strftime (timestamp_real_str, sizeof (timestamp_real_str), "%c", localtime (&timestamp_real));
nmc->allowed_fields[0].value = nm_setting_connection_get_id (s_con);
nmc->allowed_fields[1].value = nm_setting_connection_get_uuid (s_con);
nmc->allowed_fields[2].value = nm_setting_connection_get_connection_type (s_con);
nmc->allowed_fields[0].value = (char *) nm_setting_connection_get_id (s_con);
nmc->allowed_fields[1].value = (char *) nm_setting_connection_get_uuid (s_con);
nmc->allowed_fields[2].value = (char *) nm_setting_connection_get_connection_type (s_con);
nmc->allowed_fields[3].value = timestamp_str;
nmc->allowed_fields[4].value = timestamp ? timestamp_real_str : _("never");
nmc->allowed_fields[5].value = nm_setting_connection_get_autoconnect (s_con) ? _("yes") : _("no");
nmc->allowed_fields[6].value = nm_setting_connection_get_read_only (s_con) ? _("yes") : _("no");
nmc->allowed_fields[7].value = nm_connection_get_path (connection);
nmc->allowed_fields[7].value = (char *) nm_connection_get_path (connection);
nmc->print_fields.flags &= ~NMC_PF_FLAG_MAIN_HEADER_ADD & ~NMC_PF_FLAG_MAIN_HEADER_ONLY & ~NMC_PF_FLAG_FIELD_NAMES; /* Clear header flags */
print_fields (nmc->print_fields, nmc->allowed_fields);
......@@ -544,19 +544,19 @@ fill_in_fields_con_status (NMActiveConnection *active, GSList *con_list)
g_string_truncate (dev_str, dev_str->len - 1); /* Cut off last ',' */
/* Fill field values */
nmc_fields_con_status[0].value = nmc_fields_status_details_groups[0].name;
nmc_fields_con_status[0].value = (char *) nmc_fields_status_details_groups[0].name;
nmc_fields_con_status[1].value = _("N/A");
nmc_fields_con_status[2].value = nm_active_connection_get_uuid (active);
nmc_fields_con_status[2].value = (char *) nm_active_connection_get_uuid (active);
nmc_fields_con_status[3].value = dev_str->str;
nmc_fields_con_status[4].value = active_connection_state_to_string (state);
nmc_fields_con_status[4].value = (char *) active_connection_state_to_string (state);
nmc_fields_con_status[5].value = nm_active_connection_get_default (active) ? _("yes") : _("no");
nmc_fields_con_status[6].value = nm_active_connection_get_default6 (active) ? _("yes") : _("no");
nmc_fields_con_status[7].value = nm_active_connection_get_specific_object (active);
nmc_fields_con_status[7].value = (char *) nm_active_connection_get_specific_object (active);
nmc_fields_con_status[8].value = NM_IS_VPN_CONNECTION (active) ? _("yes") : _("no");
nmc_fields_con_status[9].value = nm_object_get_path (NM_OBJECT (active));
nmc_fields_con_status[10].value = nm_active_connection_get_connection (active);
nmc_fields_con_status[9].value = (char *) nm_object_get_path (NM_OBJECT (active));
nmc_fields_con_status[10].value = (char *) nm_active_connection_get_connection (active);
nmc_fields_con_status[11].value = _("N/A");
nmc_fields_con_status[12].value = nm_active_connection_get_master (active);
nmc_fields_con_status[12].value = (char *) nm_active_connection_get_master (active);
for (iter = con_list; iter; iter = g_slist_next (iter)) {
NMConnection *connection = (NMConnection *) iter->data;
......@@ -568,8 +568,8 @@ fill_in_fields_con_status (NMActiveConnection *active, GSList *con_list)
g_assert (s_con != NULL);
/* Fill field values that depend on NMConnection */
nmc_fields_con_status[1].value = nm_setting_connection_get_id (s_con);
nmc_fields_con_status[11].value = nm_setting_connection_get_zone (s_con);
nmc_fields_con_status[1].value = (char *) nm_setting_connection_get_id (s_con);
nmc_fields_con_status[11].value = (char *) nm_setting_connection_get_zone (s_con);
success = TRUE;
break;
......@@ -859,13 +859,13 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
vpn_state_str = g_strdup_printf ("%d - %s", vpn_state, vpn_connection_state_to_string (vpn_state));
/* Print values */
set_val_str (nmc->allowed_fields, 0, nmc_fields_status_details_groups[2].name);
set_val_str (nmc->allowed_fields, 0, (char *) nmc_fields_status_details_groups[2].name);
set_val_str (nmc->allowed_fields, 1, type_str);
set_val_str (nmc->allowed_fields, 2, username ? username : get_vpn_data_item (con, VPN_DATA_ITEM_USERNAME));
set_val_str (nmc->allowed_fields, 3, get_vpn_data_item (con, VPN_DATA_ITEM_GATEWAY));
set_val_str (nmc->allowed_fields, 2, (char *) (username ? username : get_vpn_data_item (con, VPN_DATA_ITEM_USERNAME)));
set_val_str (nmc->allowed_fields, 3, (char *) get_vpn_data_item (con, VPN_DATA_ITEM_GATEWAY));
set_val_str (nmc->allowed_fields, 4, banner_str);
set_val_str (nmc->allowed_fields, 5, vpn_state_str);
set_val_arr (nmc->allowed_fields, 6, (const char **) vpn_data_array);
set_val_arr (nmc->allowed_fields, 6, vpn_data_array);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields);
......
......@@ -444,7 +444,7 @@ detail_access_point (gpointer data, gpointer user_data)
ap_name = g_strdup_printf ("AP[%d]", info->index++); /* AP */
info->nmc->allowed_fields[0].value = ap_name;
info->nmc->allowed_fields[1].value = ssid_str;
info->nmc->allowed_fields[2].value = bssid;
info->nmc->allowed_fields[2].value = (char *) bssid;
info->nmc->allowed_fields[3].value = mode == NM_802_11_MODE_ADHOC ? _("Ad-Hoc")
: mode == NM_802_11_MODE_INFRA ? _("Infrastructure")
: _("Unknown");
......@@ -454,9 +454,9 @@ detail_access_point (gpointer data, gpointer user_data)
info->nmc->allowed_fields[7].value = security_str->str;
info->nmc->allowed_fields[8].value = wpa_flags_str;
info->nmc->allowed_fields[9].value = rsn_flags_str;
info->nmc->allowed_fields[10].value = info->device;
info->nmc->allowed_fields[10].value = (char *) info->device;
info->nmc->allowed_fields[11].value = active ? _("yes") : _("no");
info->nmc->allowed_fields[12].value = nm_object_get_path (NM_OBJECT (ap));
info->nmc->allowed_fields[12].value = (char *) nm_object_get_path (NM_OBJECT (ap));
info->nmc->print_fields.flags &= ~NMC_PF_FLAG_MAIN_HEADER_ADD & ~NMC_PF_FLAG_MAIN_HEADER_ONLY & ~NMC_PF_FLAG_FIELD_NAMES; /* Clear header flags */
print_fields (info->nmc->print_fields, info->nmc->allowed_fields);
......@@ -504,12 +504,12 @@ detail_wimax_nsp (NMWimaxNsp *nsp, NmCli *nmc, NMDevice *dev, int idx)
nsp_name = g_strdup_printf ("NSP[%d]", idx); /* NSP */
nmc->allowed_fields[0].value = nsp_name;
nmc->allowed_fields[1].value = nm_wimax_nsp_get_name (nsp);
nmc->allowed_fields[1].value = (char *) nm_wimax_nsp_get_name (nsp);
nmc->allowed_fields[2].value = quality_str;
nmc->allowed_fields[3].value = ntype;
nmc->allowed_fields[4].value = nm_device_get_iface (dev);
nmc->allowed_fields[3].value = (char *) ntype;
nmc->allowed_fields[4].value = (char *) nm_device_get_iface (dev);
nmc->allowed_fields[5].value = active ? _("yes") : _("no");
nmc->allowed_fields[6].value = nm_object_get_path (NM_OBJECT (nsp));
nmc->allowed_fields[6].value = (char *) nm_object_get_path (NM_OBJECT (nsp));
nmc->print_fields.flags &= ~NMC_PF_FLAG_MAIN_HEADER_ADD & ~NMC_PF_FLAG_MAIN_HEADER_ONLY & ~NMC_PF_FLAG_FIELD_NAMES; /* Clear header flags */
print_fields (nmc->print_fields, nmc->allowed_fields);
......@@ -613,24 +613,24 @@ show_device_info (gpointer data, gpointer user_data)
state_str = g_strdup_printf ("%d (%s)", state, nmc_device_state_to_string (state));
reason_str = g_strdup_printf ("%d (%s)", reason, nmc_device_reason_to_string (reason));
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[0].name; /* "GENERAL"*/
nmc->allowed_fields[1].value = nm_device_get_iface (device);
nmc->allowed_fields[2].value = device_type_to_string (device);
nmc->allowed_fields[3].value = nm_device_get_vendor (device);
nmc->allowed_fields[4].value = nm_device_get_product (device);
nmc->allowed_fields[5].value = nm_device_get_driver (device) ? nm_device_get_driver (device) : _("(unknown)");
nmc->allowed_fields[6].value = nm_device_get_driver_version (device);
nmc->allowed_fields[7].value = nm_device_get_firmware_version (device);
nmc->allowed_fields[8].value = hwaddr ? hwaddr : _("(unknown)");
nmc->allowed_fields[9].value = state_str;
nmc->allowed_fields[10].value = reason_str;
nmc->allowed_fields[11].value = nm_device_get_udi (device);
nmc->allowed_fields[12].value = nm_device_get_ip_iface (device);
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[0].name; /* "GENERAL"*/
nmc->allowed_fields[1].value = (char *) nm_device_get_iface (device);
nmc->allowed_fields[2].value = (char *) device_type_to_string (device);
nmc->allowed_fields[3].value = (char *) nm_device_get_vendor (device);
nmc->allowed_fields[4].value = (char *) nm_device_get_product (device);
nmc->allowed_fields[5].value = (char *) (nm_device_get_driver (device) ? nm_device_get_driver (device) : _("(unknown)"));
nmc->allowed_fields[6].value = (char *) nm_device_get_driver_version (device);
nmc->allowed_fields[7].value = (char *) nm_device_get_firmware_version (device);
nmc->allowed_fields[8].value = (char *) (hwaddr ? hwaddr : _("(unknown)"));
nmc->allowed_fields[9].value = (char *) state_str;
nmc->allowed_fields[10].value = (char *) reason_str;
nmc->allowed_fields[11].value = (char *) nm_device_get_udi (device);
nmc->allowed_fields[12].value = (char *) nm_device_get_ip_iface (device);
nmc->allowed_fields[13].value = nm_device_get_managed (device) ? _("yes") : _("no");
nmc->allowed_fields[14].value = nm_device_get_autoconnect (device) ? _("yes") : _("no");
nmc->allowed_fields[15].value = nm_device_get_firmware_missing (device) ? _("yes") : _("no");
nmc->allowed_fields[16].value = (acon = nm_device_get_active_connection (device)) ?
nm_object_get_path (NM_OBJECT (acon)) : _("not connected");
nmc->allowed_fields[16].value = (char *) ((acon = nm_device_get_active_connection (device)) ?
nm_object_get_path (NM_OBJECT (acon)) : _("not connected"));
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......@@ -659,7 +659,7 @@ show_device_info (gpointer data, gpointer user_data)
if (speed)
speed_str = g_strdup_printf (_("%u Mb/s"), speed);
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[1].name; /* "CAPABILITIES" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[1].name; /* "CAPABILITIES" */
nmc->allowed_fields[1].value = (caps & NM_DEVICE_CAP_CARRIER_DETECT) ? _("yes") : _("no");
nmc->allowed_fields[2].value = speed_str ? speed_str : _("unknown");
......@@ -686,7 +686,7 @@ show_device_info (gpointer data, gpointer user_data)
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_LIST_WIFI_PROP_ALL, nmc->allowed_fields, NULL);
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[2].name; /* "WIFI-PROPERTIES" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[2].name; /* "WIFI-PROPERTIES" */
nmc->allowed_fields[1].value = (wcaps & (NM_WIFI_DEVICE_CAP_CIPHER_WEP40 | NM_WIFI_DEVICE_CAP_CIPHER_WEP104)) ? _("yes") : _("no");
nmc->allowed_fields[2].value = (wcaps & NM_WIFI_DEVICE_CAP_WPA) ? _("yes") : _("no");
nmc->allowed_fields[3].value = (wcaps & NM_WIFI_DEVICE_CAP_RSN) ? _("yes") : _("no");
......@@ -732,7 +732,7 @@ show_device_info (gpointer data, gpointer user_data)
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_LIST_WIRED_PROP_ALL, nmc->allowed_fields, NULL);
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[4].name; /* "WIRED-PROPERTIES" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[4].name; /* "WIRED-PROPERTIES" */
nmc->allowed_fields[1].value = (nm_device_ethernet_get_carrier (NM_DEVICE_ETHERNET (device))) ? _("on") : _("off");
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
......@@ -747,14 +747,14 @@ show_device_info (gpointer data, gpointer user_data)
char *cfreq = NULL, *rssi = NULL, *cinr = NULL, *txpow = NULL;
guint tmp_uint;
gint tmp_int;
const char *bsid;
char *bsid;
nmc->allowed_fields = nmc_fields_dev_list_wimax_prop;
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_FIELD_NAMES;
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_LIST_WIMAX_PROP_ALL, nmc->allowed_fields, NULL);
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[5].name; /* "WIMAX-PROPERTIES" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[5].name; /* "WIMAX-PROPERTIES" */
/* Center frequency */
tmp_uint = nm_device_wimax_get_center_frequency (NM_DEVICE_WIMAX (device));
......@@ -781,7 +781,7 @@ show_device_info (gpointer data, gpointer user_data)
nmc->allowed_fields[4].value = txpow ? txpow : "";
/* BSID */
bsid = nm_device_wimax_get_bsid (NM_DEVICE_WIMAX (device));
bsid = (char *) nm_device_wimax_get_bsid (NM_DEVICE_WIMAX (device));
nmc->allowed_fields[5].value = bsid ? bsid : "";
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
......@@ -862,7 +862,7 @@ show_device_info (gpointer data, gpointer user_data)
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_LIST_BOND_PROP_ALL, nmc->allowed_fields, NULL);
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[11].name; /* "BOND" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[11].name; /* "BOND" */
nmc->allowed_fields[1].value = bond_slaves_str->str;
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
......@@ -883,7 +883,7 @@ show_device_info (gpointer data, gpointer user_data)
nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_LIST_VLAN_PROP_ALL, nmc->allowed_fields, NULL);
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nmc_fields_dev_list_sections[12].name; /* "VLAN" */
nmc->allowed_fields[0].value = (char *) nmc_fields_dev_list_sections[12].name; /* "VLAN" */
nmc->allowed_fields[1].value = vlan_id_str;
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
......@@ -930,9 +930,9 @@ show_device_info (gpointer data, gpointer user_data)
if (ac_paths_str->len > 0)
g_string_append_c (ac_paths_str, '}');
set_val_str (nmc->allowed_fields, 0, nmc_fields_dev_list_sections[13].name); /* "CONNECTIONS" */
set_val_str (nmc->allowed_fields, 0, (char *) nmc_fields_dev_list_sections[13].name); /* "CONNECTIONS" */
set_val_str (nmc->allowed_fields, 1, ac_paths_str->str);
set_val_arr (nmc->allowed_fields, 2, (const char **) ac_arr);
set_val_arr (nmc->allowed_fields, 2, ac_arr);
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
......@@ -950,10 +950,10 @@ show_device_info (gpointer data, gpointer user_data)
static void
show_device_status (NMDevice *device, NmCli *nmc)
{
nmc->allowed_fields[0].value = nm_device_get_iface (device);
nmc->allowed_fields[1].value = device_type_to_string (device);
nmc->allowed_fields[2].value = nmc_device_state_to_string (nm_device_get_state (device));
nmc->allowed_fields[3].value = nm_object_get_path (NM_OBJECT (device));
nmc->allowed_fields[0].value = (char *) nm_device_get_iface (device);
nmc->allowed_fields[1].value = (char *) device_type_to_string (device);
nmc->allowed_fields[2].value = (char *) nmc_device_state_to_string (nm_device_get_state (device));
nmc->allowed_fields[3].value = (char *) nm_object_get_path (NM_OBJECT (device));
nmc->print_fields.flags &= ~NMC_PF_FLAG_MAIN_HEADER_ADD & ~NMC_PF_FLAG_MAIN_HEADER_ONLY & ~NMC_PF_FLAG_FIELD_NAMES; /* Clear header flags */
print_fields (nmc->print_fields, nmc->allowed_fields);
......
......@@ -194,16 +194,16 @@ show_nm_status (NmCli *nmc)
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print header */
nmc->allowed_fields[0].value = nm_running ? _("running") : _("not running");
nmc->allowed_fields[1].value = nm_running ? nm_client_get_version (nmc->client) : _("unknown");
nmc->allowed_fields[2].value = nm_state_to_string (state);
nmc->allowed_fields[3].value = net_enabled_str;
nmc->allowed_fields[4].value = wireless_hw_enabled_str;
nmc->allowed_fields[5].value = wireless_enabled_str;
nmc->allowed_fields[6].value = wwan_hw_enabled_str;
nmc->allowed_fields[7].value = wwan_enabled_str;
nmc->allowed_fields[1].value = nm_running ? (char *) nm_client_get_version (nmc->client) : _("unknown");
nmc->allowed_fields[2].value = (char *) nm_state_to_string (state);
nmc->allowed_fields[3].value = (char *) net_enabled_str;
nmc->allowed_fields[4].value = (char *) wireless_hw_enabled_str;
nmc->allowed_fields[5].value = (char *) wireless_enabled_str;
nmc->allowed_fields[6].value = (char *) wwan_hw_enabled_str;
nmc->allowed_fields[7].value = (char *) wwan_enabled_str;
#if WITH_WIMAX
nmc->allowed_fields[8].value = wimax_hw_enabled_str;
nmc->allowed_fields[9].value = wimax_enabled_str;
nmc->allowed_fields[8].value = (char *) wimax_hw_enabled_str;
nmc->allowed_fields[9].value = (char *) wimax_enabled_str;
#endif
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag;
......@@ -327,8 +327,8 @@ show_nm_permissions (NmCli *nmc)
for (perm = NM_CLIENT_PERMISSION_NONE + 1; perm <= NM_CLIENT_PERMISSION_LAST; perm++) {
NMClientPermissionResult perm_result = nm_client_get_permission_result (nmc->client, perm);
set_val_str (nmc->allowed_fields, 0, permission_to_string (perm));
set_val_str (nmc->allowed_fields, 1, permission_result_to_string (perm_result));
set_val_str (nmc->allowed_fields, 0, (char *) permission_to_string (perm));
set_val_str (nmc->allowed_fields, 1, (char *) permission_result_to_string (perm_result));
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag;
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
}
......
......@@ -72,7 +72,7 @@ typedef struct {
const char *name; /* Field's name */
const char *name_l10n; /* Field's name for translation */
int width; /* Width in screen columns */
const void *value; /* Value of current field - char* or char** */
void *value; /* Value of current field - char* or char** */
guint32 flags; /* Flags */
} NmcOutputField;
......
This diff is collapsed.
......@@ -189,14 +189,14 @@ nmc_string_screen_width (const char *start, const char *end)
}
void
set_val_str (NmcOutputField fields_array[], guint32 idx, const char *value)
set_val_str (NmcOutputField fields_array[], guint32 idx, char *value)
{
fields_array[idx].flags = 0;
fields_array[idx].value = value;
}
void
set_val_arr (NmcOutputField fields_array[], guint32 idx, const char **value)
set_val_arr (NmcOutputField fields_array[], guint32 idx, char **value)
{
fields_array[idx].flags = NMC_OF_FLAG_ARRAY;
fields_array[idx].value = value;
......
......@@ -33,8 +33,8 @@ char *nmc_ip6_address_as_string (const struct in6_addr *ip, GError **error);
void nmc_terminal_erase_line (void);
void nmc_terminal_show_progress (const char *str);
int nmc_string_screen_width (const char *start, const char *end);
void set_val_str (NmcOutputField fields_array[], guint32 index, const char *value);
void set_val_arr (NmcOutputField fields_array[], guint32 index, const char **value);
void set_val_str (NmcOutputField fields_array[], guint32 index, char *value);
void set_val_arr (NmcOutputField fields_array[], guint32 index, char **value);
GArray *parse_output_fields (const char *fields_str, const NmcOutputField fields_array[], GError **error);
gboolean nmc_terse_option_check (NMCPrintOutput print_output, const char *fields, GError **error);
void print_fields (const NmcPrintFields fields, const NmcOutputField field_values[]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment