#include <stdint.h>#include <stdlib.h>#include <string.h>#include <ctype.h>Go to the source code of this file.
Functions | |
| FILE_LICENCE (GPL2_ONLY) | |
| char * | strcpy (char *dest, const char *src) |
| strcpy - Copy a NUL terminated string : Where to copy the string to : Where to copy the string from | |
| char * | strncpy (char *dest, const char *src, size_t count) |
| strncpy - Copy a length-limited, NUL-terminated string : Where to copy the string to : Where to copy the string from : The maximum number of bytes to copy | |
| char * | strcat (char *dest, const char *src) |
| strcat - Append one NUL-terminated string to another : The string to be appended to : The string to append to it | |
| int | strcmp (const char *cs, const char *ct) |
| strcmp - Compare two strings : One string : Another string | |
| int | strcasecmp (const char *a, const char *b) |
| char * | strchr (const char *s, int c) |
strchr - Find the first occurrence of a character in a string : The string to be searched : The character to search for | |
| char * | strrchr (const char *s, int c) |
strrchr - Find the last occurrence of a character in a string : The string to be searched : The character to search for | |
| size_t | strnlen (const char *s, size_t count) |
| strnlen - Find the length of a length-limited string : The string to be sized : The maximum number of bytes to search | |
| int | memcmp (const void *cs, const void *ct, size_t count) |
| memcmp - Compare two areas of memory : One area of memory : Another area of memory : The size of the area. | |
| char * | strstr (const char *s1, const char *s2) |
| strstr - Find the first substring in a NUL terminated string : The string to be searched : The string to search for | |
| void * | memchr (const void *s, int c, size_t n) |
| memchr - Find a character in an area of memory. | |
| char * | strndup (const char *s, size_t n) |
| char * | strdup (const char *s) |
| FILE_LICENCE | ( | GPL2_ONLY | ) |
| char* strcpy | ( | char * | dest, | |
| const char * | src | |||
| ) |
strcpy - Copy a NUL terminated string : Where to copy the string to : Where to copy the string from
Definition at line 39 of file string.c.
Referenced by apply_iscsi_string_setting(), ib_srp_parse_root_path(), ibft_set_string(), iscsi_parse_root_path(), net80211_prepare_assoc(), net80211_probe_start(), net80211_probe_step(), parse_setting_name(), and tftp_send_error().
00040 { 00041 char *tmp = dest; 00042 00043 while ((*dest++ = *src++) != '\0') 00044 /* nothing */; 00045 return tmp; 00046 }
| char* strncpy | ( | char * | dest, | |
| const char * | src, | |||
| size_t | count | |||
| ) |
strncpy - Copy a length-limited, NUL-terminated string : Where to copy the string to : Where to copy the string from : The maximum number of bytes to copy
Note that unlike userspace strncpy, this does not NUL-pad the buffer. However, the result is not NUL-terminated if the source exceeds bytes.
Definition at line 60 of file string.c.
Referenced by efi_snp_driver_start(), image_set_name(), slk_set(), and undibus_probe().
00061 { 00062 char *tmp = dest; 00063 00064 while (count-- && (*dest++ = *src++) != '\0') 00065 /* nothing */; 00066 00067 return tmp; 00068 }
| char* strcat | ( | char * | dest, | |
| const char * | src | |||
| ) |
strcat - Append one NUL-terminated string to another : The string to be appended to : The string to append to it
Definition at line 77 of file string.c.
Referenced by _print_label().
00078 { 00079 char *tmp = dest; 00080 00081 while (*dest) 00082 dest++; 00083 while ((*dest++ = *src++) != '\0') 00084 ; 00085 00086 return tmp; 00087 }
| int strcmp | ( | const char * | cs, | |
| const char * | ct | |||
| ) |
strcmp - Compare two strings : One string : Another string
Definition at line 96 of file string.c.
Referenced by bzimage_parse_cmdline(), digest_exec(), execv(), find_child_settings(), find_gdb_transport(), find_image(), find_netdev(), find_setting(), find_setting_type(), iscsi_handle_authmethod_value(), iscsi_handle_chap_a_value(), iscsi_handle_chap_n_value(), net80211_check_settings_update(), net80211_probe_step(), netboot(), parse_settings_name(), setting_cmp(), sleep_exec(), test_parse_unparse(), test_resolve(), time_exec(), and xfer_open_uri().
00097 { 00098 register signed char __res; 00099 00100 while (1) { 00101 if ((__res = *cs - *ct++) != 0 || !*cs++) 00102 break; 00103 } 00104 00105 return __res; 00106 }
| int strcasecmp | ( | const char * | a, | |
| const char * | b | |||
| ) |
Definition at line 131 of file string.c.
Referenced by com32_identify(), comboot_identify(), http_rx_header(), sundance_probe(), and tftp_process_option().
00132 { 00133 while (*a && *b && (*a & ~0x20) == (*b & ~0x20)) {a++; b++; } 00134 return((*a & ~0x20) - (*b & ~0x20)); 00135 }
| char* strchr | ( | const char * | s, | |
| int | c | |||
| ) |
strchr - Find the first occurrence of a character in a string : The string to be searched : The character to search for
Definition at line 144 of file string.c.
References NULL.
Referenced by comboot_fetch_kernel(), dns_qualify_name(), http_rx_response(), iscsi_handle_targetaddress_value(), parse_setting_name(), parse_settings_name(), parse_uri(), slam_parse_multicast_address(), and tftp_process_multicast().
00145 { 00146 for(; *s != (char) c; ++s) 00147 if (*s == '\0') 00148 return NULL; 00149 return (char *) s; 00150 }
| char* strrchr | ( | const char * | s, | |
| int | c | |||
| ) |
strrchr - Find the last occurrence of a character in a string : The string to be searched : The character to search for
Definition at line 159 of file string.c.
References NULL, and strlen().
Referenced by basename(), com32_identify(), comboot_identify(), and dirname().
00160 { 00161 const char *p = s + strlen(s); 00162 do { 00163 if (*p == (char)c) 00164 return (char *)p; 00165 } while (--p >= s); 00166 return NULL; 00167 }
strnlen - Find the length of a length-limited string : The string to be sized : The maximum number of bytes to search
Definition at line 191 of file string.c.
Referenced by iscsi_handle_strings(), tftp_rx_oack(), and used_len_string().
00192 { 00193 const char *sc; 00194 00195 for (sc = s; count-- && *sc != '\0'; ++sc) 00196 /* nothing */; 00197 return sc - s; 00198 }
| int memcmp | ( | const void * | cs, | |
| const void * | ct, | |||
| size_t | count | |||
| ) |
memcmp - Compare two areas of memory : One area of memory : Another area of memory : The size of the area.
Definition at line 279 of file string.c.
Referenced by arp_find_entry(), ccmp_decrypt(), com32_identify(), eapol_key_rx(), efi_find_table(), elf_load(), elfboot_load(), eltorito_read_voldesc(), eth_probe(), find_ibdev(), ib_find_path_cache_entry(), ib_find_qp_mgid(), ib_mcast_detach(), ib_mi_handle(), ipoib_cache_peer(), ipv6_tx(), linda_verify_uc_ram(), mac_address_from_string_specs(), mtd_probe(), ne_probe(), net80211_rx(), nvs_verify(), script_load(), slam_pull_header(), strstr(), tftp_rx(), tkip_decrypt(), tkip_mix_1(), tls_new_ciphertext(), udp_demux(), wpa_check_pmkid(), wpa_derive_ptk(), wpa_handle_3_of_4(), and x509_rsa_public_key().
00280 { 00281 const unsigned char *su1, *su2; 00282 int res = 0; 00283 00284 for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) 00285 if ((res = *su1 - *su2) != 0) 00286 break; 00287 return res; 00288 }
| char* strstr | ( | const char * | s1, | |
| const char * | s2 | |||
| ) |
strstr - Find the first substring in a NUL terminated string : The string to be searched : The string to search for
Definition at line 297 of file string.c.
References memcmp(), NULL, and strlen().
Referenced by bzimage_parse_cmdline(), comboot_fetch_kernel(), expand_command(), and http_rx_header().
00298 { 00299 int l1, l2; 00300 00301 l2 = strlen(s2); 00302 if (!l2) 00303 return (char *) s1; 00304 l1 = strlen(s1); 00305 while (l1 >= l2) { 00306 l1--; 00307 if (!memcmp(s1,s2,l2)) 00308 return (char *) s1; 00309 s1++; 00310 } 00311 return NULL; 00312 }
| void* memchr | ( | const void * | s, | |
| int | c, | |||
| size_t | n | |||
| ) |
memchr - Find a character in an area of memory.
: The memory area : The byte to search for
: The size of the area.
returns the address of the first occurrence of , or NULL if is not found
Definition at line 325 of file string.c.
References NULL.
Referenced by line_buffer(), and trivial_memchr_user().
00326 { 00327 const unsigned char *p = s; 00328 while (n-- != 0) { 00329 if ((unsigned char)c == *p++) { 00330 return (void *)(p-1); 00331 } 00332 } 00333 return NULL; 00334 }
| char* strndup | ( | const char * | s, | |
| size_t | n | |||
| ) |
Definition at line 338 of file string.c.
References malloc(), memcpy, and strlen().
Referenced by strdup().
00339 { 00340 size_t len = strlen(s); 00341 char *new; 00342 00343 if (len>n) 00344 len = n; 00345 new = malloc(len+1); 00346 if (new) { 00347 new[len] = '\0'; 00348 memcpy(new,s,len); 00349 } 00350 return new; 00351 }
| char* strdup | ( | const char * | s | ) |
Definition at line 353 of file string.c.
References strndup().
Referenced by dns_qualify_name(), expand_command(), image_set_cmdline(), iscsi_handle_targetaddress_value(), iscsi_parse_root_path(), iscsi_set_auth(), readline(), and resolve_path().
00353 { 00354 return strndup(s, ~((size_t)0)); 00355 }
1.5.7.1