|
iPXE
|
String functions. More...
#include <stddef.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include <strings.h>#include <ctype.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| void * | generic_memset (void *dest, int character, size_t len) |
| Fill memory region. More... | |
| void * | generic_memcpy (void *dest, const void *src, size_t len) |
| Copy memory region (forwards) More... | |
| void * | generic_memcpy_reverse (void *dest, const void *src, size_t len) |
| Copy memory region (backwards) More... | |
| void * | generic_memmove (void *dest, const void *src, size_t len) |
| Copy (possibly overlapping) memory region. More... | |
| int | memcmp (const void *first, const void *second, size_t len) |
| Compare memory regions. More... | |
| void * | memchr (const void *src, int character, size_t len) |
| Find character within a memory region. More... | |
| void * | memswap (void *first, void *second, size_t len) |
| Swap memory regions. More... | |
| int | strcmp (const char *first, const char *second) |
| Compare strings. More... | |
| int | strncmp (const char *first, const char *second, size_t max) |
| Compare strings. More... | |
| int | strcasecmp (const char *first, const char *second) |
| Compare case-insensitive strings. More... | |
| int | strncasecmp (const char *first, const char *second, size_t max) |
| Compare case-insensitive strings. More... | |
| size_t | strlen (const char *src) |
| Get length of string. More... | |
| size_t | strnlen (const char *src, size_t max) |
| Get length of string. More... | |
| char * | strchr (const char *src, int character) |
| Find character within a string. More... | |
| char * | strrchr (const char *src, int character) |
| Find rightmost character within a string. More... | |
| char * | strstr (const char *haystack, const char *needle) |
| Find substring. More... | |
| char * | stpcpy (char *dest, const char *src) |
| Copy string. More... | |
| char * | strcpy (char *dest, const char *src) |
| Copy string. More... | |
| char * | strncpy (char *dest, const char *src, size_t max) |
| Copy string. More... | |
| char * | strcat (char *dest, const char *src) |
| Concatenate string. More... | |
| char * | strdup (const char *src) |
| Duplicate string. More... | |
| char * | strndup (const char *src, size_t max) |
| Duplicate string. More... | |
| unsigned int | digit_value (unsigned int character) |
| Calculate digit value. More... | |
| static const char * | strtoul_pre (const char *string, int *negate, int *base) |
| Preprocess string for strtoul() or strtoull() More... | |
| unsigned long | strtoul (const char *string, char **endp, int base) |
| Convert string to numeric value. More... | |
| unsigned long long | strtoull (const char *string, char **endp, int base) |
| Convert string to numeric value. More... | |
String functions.
Definition in file string.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| void* generic_memset | ( | void * | dest, |
| int | character, | ||
| size_t | len | ||
| ) |
Fill memory region.
| dest | Destination region |
| character | Fill character |
| len | Length |
| dest | Destination region |
Definition at line 47 of file string.c.
| void* generic_memcpy | ( | void * | dest, |
| const void * | src, | ||
| size_t | len | ||
| ) |
Copy memory region (forwards)
| dest | Destination region |
| src | Source region |
| len | Length |
| dest | Destination region |
Definition at line 63 of file string.c.
References dest, len, and src.
Referenced by generic_memmove().
| void* generic_memcpy_reverse | ( | void * | dest, |
| const void * | src, | ||
| size_t | len | ||
| ) |
Copy memory region (backwards)
| dest | Destination region |
| src | Source region |
| len | Length |
| dest | Destination region |
Definition at line 80 of file string.c.
References dest, len, and src.
Referenced by generic_memmove().
| void* generic_memmove | ( | void * | dest, |
| const void * | src, | ||
| size_t | len | ||
| ) |
Copy (possibly overlapping) memory region.
| dest | Destination region |
| src | Source region |
| len | Length |
| dest | Destination region |
Definition at line 97 of file string.c.
References dest, generic_memcpy(), generic_memcpy_reverse(), len, and src.
| int memcmp | ( | const void * | first, |
| const void * | second, | ||
| size_t | len | ||
| ) |
Compare memory regions.
| first | First region |
| second | Second region |
| len | Length |
| diff | Difference |
Definition at line 114 of file string.c.
Referenced by acpimac_extract(), apply_syslog_settings(), asn1_compare(), asn1_okx(), base16_decode_okx(), base64_decode_okx(), bofm_en(), cachedhcp_apply(), cachedhcp_record(), ccmp_decrypt(), check_bios_interrupts(), cipher_decrypt_okx(), cipher_encrypt_okx(), cms_decrypt(), cms_decrypt_okx(), com32_identify(), cpio_okx(), deflate_okx(), dhcp_deliver(), dhcpv6_check_duid(), dhe_key_okx(), digest_frag_okx(), dns_copy_okx(), dns_encode_okx(), eapol_key_rx(), efi_block_match(), efi_file_get_info(), efi_find_table(), efi_guid_ntoa(), efi_path_net_probe(), efi_pxe_ip_filter(), efi_pxe_udp_read(), efi_shim_is_sbatlevel(), efi_veto_dhcp6(), efi_veto_hp_xhci(), efi_veto_ip4config(), efi_veto_vmware_uefipxebc(), efivars_find(), elf_load(), elfboot_probe(), elliptic_okx(), eoib_find(), eoib_find_peer(), eoib_rx_av(), eth_probe(), eth_slow_lacp_rx(), fc_els_logo_logout(), fc_peer_examine(), fc_peer_get_port_id(), fc_peer_get_wwn(), fc_peer_login(), fc_port_deliver(), fc_port_login(), fc_ulp_login(), fcels_exec(), fcoe_fip_rx(), fcoe_fip_rx_advertisement(), fcoe_rx(), fdt_match(), fdt_test_exec(), find_ibdev(), gzip_okx(), hmac_okx(), hvm_cpuid_base(), ib_find_path_cache_entry(), ib_find_qp_mgid(), ib_mcast_detach(), ib_mi_handle(), ib_path_complete(), inet6_aton_okx(), int13_parse_eltorito(), int13con_find(), ipair_key(), ipoib_find_remac(), ipoib_map_remac(), ipv6_has_addr(), ipv6_is_fragment(), ipv6_route_okx(), ipv6_table_okx(), is_autoboot_ll_addr(), iscsi_handle_chap_r_value(), linda_verify_uc_ram(), lldp_fetch(), loopback_wait(), mac_address_from_string_specs(), memcpy_test_speed(), mlx_memory_cmp_priv(), mschapv2_okx(), ne_probe(), neighbour_find(), net80211_rx(), netfront_net_probe(), ntlm_authenticate_okx(), ntlm_data_okx(), ntlm_key_okx(), nvs_verify(), ocsp_compare_responder_key_hash(), pcnet32_setup_mac_addr(), peerblk_done(), peerblk_parse_block(), peerdist_discovery_reply(), peerdist_info_block_okx(), peerdist_info_passphrase_okx(), peerdist_info_segment_okx(), pem_marker(), pixbuf_okx(), png_probe(), rsa_verify(), rsdp_find_rsdt_range(), sandev_parse_iso9660(), script_probe(), slam_pull_header(), string_test_exec(), strstr(), tftp_rx(), tkip_decrypt(), tkip_mix_1(), tls_new_ciphertext(), tls_new_finished(), tls_new_server_hello(), typeof(), ucode_exec(), udp_demux(), uuid_aton_okx(), vlan_probe(), vmbus_find_driver(), wpa_derive_ptk(), wpa_handle_3_of_4(), x25519_invert_okx(), x25519_key_okx(), x25519_multiply_okx(), x509_chain_okx(), x509_check_ipaddress(), x509_check_root(), x509_fingerprint_okx(), xcm_find(), xve_find(), and zlib_okx().
| void* memchr | ( | const void * | src, |
| int | character, | ||
| size_t | len | ||
| ) |
Find character within a memory region.
| src | Source region |
| character | Character to find |
| len | Length |
| found | Found character, or NULL if not found |
Definition at line 135 of file string.c.
References len, NULL, and src.
Referenced by line_buffer(), pem_next(), process_script(), rsa_decrypt(), and string_test_exec().
| void* memswap | ( | void * | first, |
| void * | second, | ||
| size_t | len | ||
| ) |
Swap memory regions.
| first | First region |
| second | Second region |
| len | Length |
| first | First region |
Definition at line 153 of file string.c.
Referenced by arp_rx(), gdbudp_recv(), string_test_exec(), and tls_change_cipher().
| int strcmp | ( | const char * | first, |
| const char * | second | ||
| ) |
Compare strings.
| first | First string |
| second | Second string |
| diff | Difference |
Definition at line 173 of file string.c.
References first, and strncmp().
Referenced by apply_syslogs_settings(), base16_encode_okx(), base64_encode_okx(), bzimage_parse_cmdline(), command_terminator(), dns_decode_okx(), dns_list_okx(), dt_find_driver(), editstring_okx(), efi_veto_hp_xhci(), efi_veto_ip4config(), efi_veto_vmware_uefipxebc(), execv(), fc_port_find(), fdt_test_exec(), fdtmem_update_node(), find_child_settings(), find_dynui(), find_gdb_transport(), find_image(), find_netdev(), find_netdev_configurator(), find_parameters(), find_setting(), find_setting_type(), goto_find_label(), gzip_okx(), have_pxe_menu(), http_connect(), inet6_ntoa_okx(), inet_ntoa_okx(), ipair_rx_pair_error(), ipair_rx_session_error(), iscsi_handle_authmethod_value(), iscsi_handle_chap_a_value(), iscsi_handle_chap_n_value(), iscsi_handle_string(), iseq_exec(), keymap_find(), linebuf_accumulated_okx(), linebuf_consume_okx(), list_check_contents(), net80211_check_settings_update(), net80211_probe_step(), nfs_mount_deliver(), peerdisc_discovered(), peerdisc_find(), setting_cmp(), show_menu(), smsc95xx_vm3_fetch_mac(), snprintf_okx(), string_test_exec(), testnet_set_okx(), tls_session(), uri_churi_okx(), uri_format_okx(), uri_params_list_okx(), uri_pxe_okx(), uri_resolve_okx(), uri_resolve_path_okx(), uristrcmp(), usbblk_find(), uuid_ntoa_okx(), xenbus_find_driver(), and zlib_okx().
| int strncmp | ( | const char * | first, |
| const char * | second, | ||
| size_t | max | ||
| ) |
Compare strings.
| first | First string |
| second | Second string |
| max | Maximum length to compare |
| diff | Difference |
Definition at line 186 of file string.c.
Referenced by dhcp_discovery_rx(), http_parse_status(), iscsi_handle_string(), match_long_option(), nfs_uri_symlink(), parse_uri(), peerdist_discovery_reply_tag(), strcmp(), string_test_exec(), and undinet_probe().
| int strcasecmp | ( | const char * | first, |
| const char * | second | ||
| ) |
Compare case-insensitive strings.
| first | First string |
| second | Second string |
| diff | Difference |
Definition at line 208 of file string.c.
References first, and strncasecmp().
Referenced by com32_identify(), comboot_identify(), efi_block_label(), efi_file_find(), efi_file_open(), efi_local_check_volume_name(), efi_snp_hii_fetch(), efi_snp_hii_store(), http_authentication(), http_digest_authenticate(), http_format_metadata_flavor(), http_parse_connection(), http_parse_content_encoding(), http_parse_digest_auth(), http_parse_header(), http_parse_transfer_encoding(), http_scheme(), parse_fc_els_handler(), string_test_exec(), sundance_probe(), tftp_process_option(), uart_find(), and xfer_uri_opener().
| int strncasecmp | ( | const char * | first, |
| const char * | second, | ||
| size_t | max | ||
| ) |
Compare case-insensitive strings.
| first | First string |
| second | Second string |
| max | Maximum length to compare |
| diff | Difference |
Definition at line 221 of file string.c.
References first, max, and toupper().
Referenced by efi_file_open(), strcasecmp(), string_test_exec(), and x509_check_dnsname().
| size_t strlen | ( | const char * | src | ) |
Get length of string.
| src | String |
| len | Length |
Definition at line 243 of file string.c.
References src, and strnlen().
Referenced by __attribute__(), _print_label(), acpimac_extract(), add_dynui_item(), add_parameter(), alloc_form(), autovivify_child_settings(), base16_decoded_max_len(), base16_encode_okx(), base64_decoded_max_len(), base64_encode_okx(), cmdline_init(), comboot_copy_cmdline(), concat_args(), create_dynui(), create_parameters(), cwuri_fetch_uri(), dns_decode_okx(), dns_list_okx(), draw_editbox(), draw_menu_item(), dt_find_driver(), edit_string(), editstring_okx(), efi_block_exec(), efi_block_filename(), efi_cmdline_init(), efi_file_varlen(), efi_ifr_package(), efi_image_path(), efi_iscsi_path(), efi_local_open_resolved(), efi_snp_hii_append(), efi_snp_hii_store(), efivars_fetch(), fdt_bootargs(), fdt_ensure_child(), fdt_insert_string(), fdt_match(), generic_settings_store(), guestinfo_fetch_type(), guestrpc_command(), http_digest_update(), http_format_basic_auth(), http_parse_headers(), http_parse_ntlm_auth(), ib_srp_parse_byte_string(), ibft_set_string(), image_argument(), init_editbox(), ipair_tag(), ipv6_sock_aton(), iscsi_handle_chap_c_value(), iscsi_handle_chap_i_value(), iscsi_handle_chap_r_value(), iwlist(), linebuf_accumulated_okx(), match_long_option(), mschapv2_challenge_hash(), net80211_marshal_request_info(), netdev_fetch_bustype(), netdev_fetch_chip(), netdev_fetch_ifname(), netdev_fetch_linktype(), nfs_uri_symlink(), parse_net_args(), parse_string_setting(), parse_uri(), peerblk_retrieval_uri(), peerdisc_create(), peerdisc_discovered(), peerdisc_socket_rx(), peerdisc_socket_tx(), peerdist_discovery_reply(), peerdist_discovery_reply_tag(), peerdist_discovery_reply_values(), pem_marker(), prf_sha1(), resolv(), resolv_setting(), resolve_path(), show_menu(), smbios_fetch(), smbios_string(), snprintf_okx(), strcat(), string_copy(), string_test_exec(), strstr(), sync_console(), testnet_set_okx(), tftp_send_error(), tftp_send_rrq(), tls_client_hello(), tls_session(), uri_copy_fields(), uri_decode_inplace(), uri_encode_string(), uri_format_okx(), uri_pxe_okx(), validator_start_download(), version_fetch(), wpa_psk_start(), x509_check_dnsname(), xenbus_probe(), xenbus_probe_device(), xenbus_probe_type(), xenstore_dump(), xenstore_request(), xenstore_response(), and xenstore_send_string().
Get length of string.
| src | String |
| max | Maximum length |
| len | Length |
Definition at line 255 of file string.c.
Referenced by efi_pecoff_debug_name(), fdt_describe(), gzip_extract(), iscsi_handle_strings(), string_test_exec(), strlen(), strndup(), tftp_rx_oack(), and used_len_string().
| char* strchr | ( | const char * | src, |
| int | character | ||
| ) |
Find character within a string.
| src | String |
| character | Character to find |
| found | Found character, or NULL if not found |
Definition at line 271 of file string.c.
Referenced by base64_decode(), bzimage_parse_cmdline(), cmdline_strip(), comboot_fetch_kernel(), dns_resolv(), efi_pecoff_debug_name(), fdt_path(), fdt_permitted(), http_parse_header(), ipv6_sock_aton(), iscsi_handle_string(), iscsi_handle_targetaddress_value(), netbios_domain(), nfs_uri_init(), parse_setting_name(), parse_settings_name(), parse_uri(), slam_parse_multicast_address(), string_test_exec(), testnet_set_okx(), tftp_process_multicast(), uri_character_escaped(), and x509_check_dnsname().
| char* strrchr | ( | const char * | src, |
| int | character | ||
| ) |
Find rightmost character within a string.
| src | String |
| character | Character to find |
| found | Found character, or NULL if not found |
Definition at line 289 of file string.c.
References NULL, src, and start.
Referenced by basename(), com32_identify(), comboot_identify(), dirname(), efi_file_open(), efi_pecoff_debug_name(), image_strip_suffix(), nfs_uri_next_mountpoint(), parse_uri(), and string_test_exec().
| char* strstr | ( | const char * | haystack, |
| const char * | needle | ||
| ) |
Find substring.
| haystack | String |
| needle | Substring |
| found | Found substring, or NULL if not found |
Definition at line 309 of file string.c.
References len, memcmp(), NULL, and strlen().
Referenced by cmdline_strip(), comboot_fetch_kernel(), image_argument(), ipair_tag(), parse_uri(), string_test_exec(), and ucode_exec().
| char* stpcpy | ( | char * | dest, |
| const char * | src | ||
| ) |
Copy string.
| dest | Destination string |
| src | Source string |
| dnul | Terminating NUL of destination string |
Definition at line 326 of file string.c.
Referenced by alloc_form(), strcpy(), and string_test_exec().
| char* strcpy | ( | char * | dest, |
| const char * | src | ||
| ) |
Copy string.
| dest | Destination string |
| src | Source string |
| dest | Destination string |
Definition at line 346 of file string.c.
References dest, src, and stpcpy().
Referenced by add_dynui_item(), add_parameter(), cmdline_strip(), create_dynui(), create_parameters(), efi_ifr_package(), fdt_insert_string(), ibft_set_string(), icert_encode(), inet6_ntoa(), net80211_prepare_assoc(), net80211_probe_start(), net80211_probe_step(), nfs_uri_symlink(), parse_uri(), peerdisc_discovered(), peerdist_discovery_reply(), resolv_setting(), strcat(), string_test_exec(), tftp_send_error(), and tls_session().
| char* strncpy | ( | char * | dest, |
| const char * | src, | ||
| size_t | max | ||
| ) |
Copy string.
| dest | Destination string |
| src | Source string |
| max | Maximum length |
| dest | Destination string |
Definition at line 360 of file string.c.
References dest, max, and src.
Referenced by buildarch_fetch(), cwuri_fetch_uri(), efi_block_install(), int13_install(), netdev_fetch_bustype(), netdev_fetch_chip(), netdev_fetch_ifname(), netdev_fetch_linktype(), platform_fetch(), slk_set(), string_test_exec(), and version_fetch().
| char* strcat | ( | char * | dest, |
| const char * | src | ||
| ) |
Concatenate string.
| dest | Destination string |
| src | Source string |
| dest | Destination string |
Definition at line 381 of file string.c.
References dest, src, strcpy(), and strlen().
Referenced by _print_label(), and string_test_exec().
| char* strdup | ( | const char * | src | ) |
Duplicate string.
| src | Source string |
| dup | Duplicated string, or NULL if allocation failed |
Definition at line 393 of file string.c.
References src, and strndup().
Referenced by cmdline_init(), expand_settings(), history_append(), history_store(), http_parse_ntlm_auth(), ib_srp_parse_root_path(), image_set_cmdline(), image_set_name(), ipv6_sock_aton(), iscsi_handle_targetaddress_value(), iscsi_parse_root_path(), nfs_parse_uri(), nfs_uri_init(), nfs_uri_next_mountpoint(), oncrpc_init_cred_sys(), parse_settings_name(), peerdisc_discovered(), resolve_path(), resolve_uri(), slam_parse_multicast_address(), string_test_exec(), and system().
| char* strndup | ( | const char * | src, |
| size_t | max | ||
| ) |
Duplicate string.
| src | Source string |
| max | Maximum length |
| dup | Duplicated string, or NULL if allocation failed |
Definition at line 405 of file string.c.
References len, malloc(), max, memcpy(), src, and strnlen().
Referenced by nfs_deliver(), strdup(), and string_test_exec().
| unsigned int digit_value | ( | unsigned int | character | ) |
Calculate digit value.
| character | Digit character |
| digit | Digit value |
Invalid digits will be returned as a value greater than or equal to the numeric base.
Definition at line 426 of file string.c.
Referenced by hex_decode(), string_test_exec(), strtoul(), and strtoull().
|
static |
Preprocess string for strtoul() or strtoull()
| string | String |
| negate | Final value should be negated |
| base | Numeric base |
| string | Remaining string |
Definition at line 445 of file string.c.
References base, isspace(), and string.
Referenced by strtoul(), and strtoull().
| unsigned long strtoul | ( | const char * | string, |
| char ** | endp, | ||
| int | base | ||
| ) |
Convert string to numeric value.
| string | String |
| endp | End pointer (or NULL) |
| base | Numeric base (or zero to autodetect) |
| value | Numeric value |
Definition at line 484 of file string.c.
References base, digit_value(), strtoul_pre(), and value.
Referenced by aoe_parse_uri(), bzimage_parse_cmdline(), cpio_parse_cmdline(), efi_snp_hii_store(), fc_aton(), fc_id_aton(), ftp_parse_value(), ftp_reply(), http_parse_content_length(), http_parse_retry_after(), http_parse_status(), http_rx_chunk_len(), ib_srp_parse_integer(), inet6_aton(), inet_aton(), iscsi_handle_chap_i_value(), iscsi_handle_maxburstlength_value(), iscsi_handle_targetaddress_value(), iscsi_parse_root_path(), mac_address_from_string_specs(), parse_int_setting(), parse_integer(), parse_setting_tag(), pnm_ascii(), scsi_parse_lun(), slam_parse_multicast_address(), string_test_exec(), tftp_process_blksize(), tftp_process_multicast(), tftp_process_tsize(), uart_find(), uri_decode(), uri_port(), and xenstore_read_num().
| unsigned long long strtoull | ( | const char * | string, |
| char ** | endp, | ||
| int | base | ||
| ) |
Convert string to numeric value.
| string | String |
| endp | End pointer (or NULL) |
| base | Numeric base (or zero to autodetect) |
| value | Numeric value |
Definition at line 519 of file string.c.
References base, digit_value(), strtoul_pre(), and value.
1.8.15