string.h File Reference

#include <stddef.h>
#include <bits/string.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_ONLY)
int __pure strnicmp (const char *s1, const char *s2, size_t len) __nonnull
 strnicmp - Case insensitive, length-limited string comparison : One string : The other string : the maximum number of characters to compare
char * strcpy (char *dest, const char *src) __nonnull
 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) __nonnull
 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) __nonnull
 strcat - Append one NUL-terminated string to another : The string to be appended to : The string to append to it
char * strncat (char *dest, const char *src, size_t count) __nonnull
 strncat - Append a length-limited, NUL-terminated string to another : The string to be appended to : The string to append to it : The maximum numbers of bytes to copy
int __pure strcmp (const char *cs, const char *ct) __nonnull
 strcmp - Compare two strings : One string : Another string
int __pure strncmp (const char *cs, const char *ct, size_t count) __nonnull
char *__pure strchr (const char *s, int c) __nonnull
 strchr - Find the first occurrence of a character in a string : The string to be searched : The character to search for
char *__pure strrchr (const char *s, int c) __nonnull
 strrchr - Find the last occurrence of a character in a string : The string to be searched : The character to search for
size_t __pure strlen (const char *s) __nonnull
size_t __pure strnlen (const char *s, size_t count) __nonnull
 strnlen - Find the length of a length-limited string : The string to be sized : The maximum number of bytes to search
size_t __pure strspn (const char *s, const char *accept) __nonnull
 strspn - Calculate the length of the initial substring of which only contain letters in : The string to be searched : The string to search for
size_t __pure strcspn (const char *s, const char *reject) __nonnull
 strcspn - Calculate the length of the initial substring of which only contain letters not in : The string to be searched : The string to search for
char *__pure strpbrk (const char *cs, const char *ct) __nonnull
 strpbrk - Find the first occurrence of a set of characters : The string to be searched : The characters to search for
char * strtok (char *s, const char *ct) __nonnull
 strtok - Split a string into tokens : The string to be searched : The characters to search for
char * strsep (char **s, const char *ct) __nonnull
 strsep - Split a string into tokens : The string to be searched : The characters to search for
void * memset (void *s, int c, size_t count) __nonnull
void * memmove (void *dest, const void *src, size_t count) __nonnull
int __pure memcmp (const void *cs, const void *ct, size_t count) __nonnull
 memcmp - Compare two areas of memory : One area of memory : Another area of memory : The size of the area.
void *__pure memscan (const void *addr, int c, size_t size) __nonnull
 memscan - Find a character in an area of memory.
char *__pure strstr (const char *s1, const char *s2) __nonnull
 strstr - Find the first substring in a NUL terminated string : The string to be searched : The string to search for
void *__pure memchr (const void *s, int c, size_t n) __nonnull
 memchr - Find a character in an area of memory.
char *__malloc strdup (const char *s) __nonnull
char *__malloc strndup (const char *s, size_t n) __nonnull
const char *__pure strerror (int errno)
 Retrieve string representation of error number.


Function Documentation

FILE_LICENCE ( GPL2_ONLY   ) 

int __pure strnicmp ( const char *  s1,
const char *  s2,
size_t  len 
)

strnicmp - Case insensitive, length-limited string comparison : One string : The other string : the maximum number of characters to compare

Definition at line 46 of file stringextra.c.

References tolower().

00047 {
00048         /* Yes, Virginia, it had better be unsigned */
00049         unsigned char c1, c2;
00050 
00051         c1 = 0; c2 = 0;
00052         if (len) {
00053                 do {
00054                         c1 = *s1; c2 = *s2;
00055                         s1++; s2++;
00056                         if (!c1)
00057                                 break;
00058                         if (!c2)
00059                                 break;
00060                         if (c1 == c2)
00061                                 continue;
00062                         c1 = tolower(c1);
00063                         c2 = tolower(c2);
00064                         if (c1 != c2)
00065                                 break;
00066                 } while (--len);
00067         }
00068         return (int)c1 - (int)c2;
00069 }

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 }

char* strncat ( char *  dest,
const char *  src,
size_t  count 
)

strncat - Append a length-limited, NUL-terminated string to another : The string to be appended to : The string to append to it : The maximum numbers of bytes to copy

Note that in contrast to strncpy, strncat ensures the result is terminated.

Definition at line 84 of file stringextra.c.

00085 {
00086         char *tmp = dest;
00087 
00088         if (count) {
00089                 while (*dest)
00090                         dest++;
00091                 while ((*dest++ = *src++)) {
00092                         if (--count == 0) {
00093                                 *dest = '\0';
00094                                 break;
00095                         }
00096                 }
00097         }
00098 
00099         return tmp;
00100 }

int __pure 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 __pure strncmp ( const char *  cs,
const char *  ct,
size_t  count 
)

char* __pure 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* __pure 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 }

size_t __pure strlen ( const char *  s  ) 

size_t __pure 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

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 }

size_t __pure strspn ( const char *  s,
const char *  accept 
)

strspn - Calculate the length of the initial substring of which only contain letters in : The string to be searched : The string to search for

Definition at line 110 of file stringextra.c.

Referenced by strtok().

00111 {
00112         const char *p;
00113         const char *a;
00114         size_t count = 0;
00115 
00116         for (p = s; *p != '\0'; ++p) {
00117                 for (a = accept; *a != '\0'; ++a) {
00118                         if (*p == *a)
00119                                 break;
00120                 }
00121                 if (*a == '\0')
00122                         return count;
00123                 ++count;
00124         }
00125 
00126         return count;
00127 }

size_t __pure strcspn ( const char *  s,
const char *  reject 
)

strcspn - Calculate the length of the initial substring of which only contain letters not in : The string to be searched : The string to search for

Definition at line 137 of file stringextra.c.

References r.

00138 {
00139         const char *p;
00140         const char *r;
00141         size_t count = 0;
00142 
00143         for (p = s; *p != '\0'; ++p) {
00144                 for (r = reject; *r != '\0'; ++r) {
00145                         if (*p == *r)
00146                                 return count;
00147                 }
00148                 ++count;
00149         }
00150 
00151         return count;
00152 }

char* __pure strpbrk ( const char *  cs,
const char *  ct 
)

strpbrk - Find the first occurrence of a set of characters : The string to be searched : The characters to search for

Definition at line 161 of file stringextra.c.

References NULL.

Referenced by strsep(), and strtok().

00162 {
00163         const char *sc1,*sc2;
00164 
00165         for( sc1 = cs; *sc1 != '\0'; ++sc1) {
00166                 for( sc2 = ct; *sc2 != '\0'; ++sc2) {
00167                         if (*sc1 == *sc2)
00168                                 return (char *) sc1;
00169                 }
00170         }
00171         return NULL;
00172 }

char* strtok ( char *  s,
const char *  ct 
)

strtok - Split a string into tokens : The string to be searched : The characters to search for

WARNING: strtok is deprecated, use strsep instead.

Definition at line 183 of file stringextra.c.

References ___strtok, NULL, strpbrk(), and strspn().

00184 {
00185         char *sbegin, *send;
00186 
00187         sbegin  = s ? s : ___strtok;
00188         if (!sbegin) {
00189                 return NULL;
00190         }
00191         sbegin += strspn(sbegin,ct);
00192         if (*sbegin == '\0') {
00193                 ___strtok = NULL;
00194                 return( NULL );
00195         }
00196         send = strpbrk( sbegin, ct);
00197         if (send && *send != '\0')
00198                 *send++ = '\0';
00199         ___strtok = send;
00200         return (sbegin);
00201 }

char* strsep ( char **  s,
const char *  ct 
)

strsep - Split a string into tokens : The string to be searched : The characters to search for

strsep() updates to point after the token, ready for the next call.

It returns empty tokens, too, behaving exactly like the libc function of that name. In fact, it was stolen from glibc2 and de-fancy-fied. Same semantics, slimmer shape. ;)

Definition at line 216 of file stringextra.c.

References NULL, and strpbrk().

00217 {
00218         char *sbegin = *s, *end;
00219 
00220         if (sbegin == NULL)
00221                 return NULL;
00222 
00223         end = strpbrk(sbegin, ct);
00224         if (end)
00225                 *end++ = '\0';
00226         *s = end;
00227 
00228         return sbegin;
00229 }

void* memset ( void *  s,
int  c,
size_t  count 
)

Referenced by __vxge_hw_fifo_create(), __vxge_hw_vp_initialize(), __vxge_hw_vp_terminate(), _print_label(), a3c90x_probe(), a3c90x_setup_tx_ring(), add_ndp_entry(), add_tls(), aes_wrap(), amd8111e_probe(), amd8111e_transmit(), ansiesc_process(), aoe_send_command(), aout_download(), arbel_alloc_icm(), arbel_cmd(), arbel_complete(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_create_recv_wq(), arbel_create_send_wq(), arbel_destroy_eq(), arbel_mcast_detach(), arbel_modify_qp(), arbel_open(), arbel_post_send(), arbel_probe(), arbel_setup_mpt(), arbel_start_firmware(), arp_resolve(), ata_identify(), ata_read(), ata_write(), ath5k_attach(), ath5k_config(), ath5k_desc_alloc(), ath5k_handle_rx(), ath5k_hw_attach(), ath5k_hw_setup_2word_tx_desc(), ath5k_hw_setup_4word_tx_desc(), ath5k_hw_setup_rx_desc(), ath5k_hw_setup_tx_queue(), ath5k_hw_txpower(), ath5k_tx_processq(), atl1e_clean_rx_ring(), atl1e_clean_tx_ring(), atl1e_get_tpd(), atl1e_setup_ring_resources(), b44_init_rx_ring(), b44_init_tx_ring(), b44_probe(), bi_divide(), bi_export(), bi_import(), bi_int_multiply(), bnx2_alloc_mem(), bnx2_init_rx_ring(), bnx2_probe(), bnx2_transmit(), bzimage_load_initrd(), bzimage_parse_header(), ccmp_cbc_mac(), chap_finish(), dhcp_create_packet(), dhcppkt_store(), draw_editbox(), draw_setting(), e1000_probe(), e1000_process_rx_packets(), e1000_process_tx_packets(), e1000_setup_rx_resources(), e1000_setup_tx_resources(), e1000_update_mc_addr_list_generic(), e1000e_probe(), e1000e_process_rx_packets(), e1000e_process_tx_packets(), e1000e_setup_rx_resources(), e1000e_setup_tx_resources(), e1000e_update_mc_addr_list_generic(), eapol_key_rx(), efab_alloc_resources(), efab_free_resources(), efab_probe(), efi_snp_driver_start(), efi_snp_statistics(), eisabus_probe(), eltorito_exec(), enable_multicast(), eth_probe(), fetch_setting(), fetch_string_setting(), fnrec_reset(), ftp_open(), gdbudp_send(), get_cached_dhcpack(), get_cpuinfo(), get_memmap(), get_random_NZ(), hermon_alloc_icm(), hermon_alloc_mtt(), hermon_cmd(), hermon_complete(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_destroy_eq(), hermon_dump_qpctx(), hermon_free_icm(), hermon_map_vpm(), hermon_mcast_detach(), hermon_modify_qp(), hermon_open(), hermon_post_send(), hermon_probe(), hermon_setup_mpt(), hmac_final(), hmac_init(), http_open_filter(), ib_cached_path_complete(), ib_cm_path_complete(), ib_cm_send_rtu(), ib_create_conn(), ib_create_path(), ib_mcast_mad(), ib_pull(), ib_resolve_path(), ib_sma_guid_info(), ib_sma_node_desc(), ib_sma_node_info(), ib_sma_pkey_table(), ib_sma_port_info(), ib_smc_get_guid_info(), ib_smc_get_pkey_table(), ib_smc_get_port_info(), ibft_set_ipaddr(), icmp6_send_solicit(), ifec_pci_probe(), igb_probe(), igb_process_rx_packets(), igb_process_tx_packets(), igb_setup_rx_resources(), igb_setup_tx_resources(), igb_update_mc_addr_list_generic(), ignore_job_progress(), init_editbox(), init_setting(), iob_pad(), ipoib_cache_peer(), ipoib_init_addr(), ipoib_probe(), ipoib_transmit(), ipv4_rx(), ipv4_tx(), ipv6_rx(), ipv6_tx(), ipv6_tx_csum(), isabus_probe(), isapnp_try_isolate(), isapnpbus_probe(), iscsi_open_connection(), iscsi_start_tx(), legacy_probe(), linda_complete_recv(), linda_create_recv_wq(), linda_fini_send(), linda_ib_epb_read(), linda_ib_epb_release(), linda_ib_epb_request(), linda_ib_epb_write(), linda_init_ib_serdes(), linda_init_recv(), linda_init_send(), linda_poll_eq(), linda_poll_recv_wq(), linda_post_recv(), linda_post_send(), linebuf_test(), mcabus_probe(), md5_final(), meme820(), more_comps(), mtnic_alloc_cq(), mtnic_alloc_eq(), mtnic_alloc_ring(), mtnic_CONFIG_CQ(), mtnic_CONFIG_EQ(), mtnic_CONFIG_PORT_RSS_STEER(), mtnic_CONFIG_RX(), mtnic_CONFIG_RX_RING(), mtnic_CONFIG_TX_RING(), mtnic_map_cmd(), mtnic_OPEN_NIC(), mtnic_probe(), mtnic_QUERY_CAP(), mtnic_RELEASE_RESOURCE(), mtnic_SET_PORT_DEFAULT_RING(), mtnic_SET_PORT_MTU(), mtnic_SET_PORT_RSS_INDIRECTION(), mtnic_SET_RX_RING_ADDR(), multiboot_build_memmap(), multiboot_exec(), myri10ge_net_close(), myri10ge_net_open(), natsemi_probe(), net80211_ll_push(), nvo_init_dhcpopts(), parse_setting_name(), pbkdf2_sha1_f(), pcibus_probe(), phantom_clp_cmd(), phantom_create_rx_ctx(), phantom_create_tx_ctx(), phantom_open(), phantom_poll(), phantom_probe(), phantom_refill_rx_ring(), phantom_transmit(), phantom_update_macaddr(), prism2_probe(), prism2_transmit(), pxe_menu_parse(), pxe_tftp_open(), pxenv_udp_write(), pxenv_undi_clear_statistics(), pxenv_undi_get_iface_info(), pxenv_undi_get_nic_type(), readline(), regular_multiply(), RSA_decrypt(), RSA_encrypt(), rtl8169_populate_rx_descriptor(), rtl8169_probe(), rtl8169_process_rx_packets(), rtl8169_process_tx_packets(), rtl8169_setup_rx_resources(), rtl8169_setup_tx_resources(), rtl818x_init_rx_ring(), rtl818x_init_tx_ring(), rtl_probe(), rtl_reset(), scsi_parse_lun(), scsi_read_10(), scsi_read_16(), scsi_read_capacity_10(), scsi_read_capacity_16(), scsi_write_10(), scsi_write_16(), set_multicast(), set_rx_mode(), SHA1Final(), sis190_init_board(), sis190_init_ring(), sis630e_get_mac_addr(), skge_up(), sky2_probe(), sky2_reset(), sky2_rx_clean(), sky2_set_multicast(), sky2_up(), slam_mc_socket_deliver(), slam_open(), slam_pull_header(), srp_cmd(), srp_login(), t509bus_probe(), tcp_open_uri(), tcp_rx_opts(), tcp_xmit(), tcp_xmit_reset(), tftp_reopen(), tftp_rx_data(), tftp_timer_expired(), tg3_abort_hw(), tg3_init_rings(), tg3_probe(), tg3_setup_fiber_phy(), tg3_transmit(), tls_assemble_block(), tls_clear_cipher(), tls_generate_random(), tls_send_client_hello(), tls_send_client_key_exchange(), tls_send_finished(), tls_set_cipher(), trivial_memset_user(), udp_open_uri(), udp_rx(), undi_load(), undi_unload(), undinet_open(), undinet_probe(), undinet_remove(), undinet_transmit(), undipci_probe(), velocity_init_cam_filter(), velocity_init_info(), velocity_init_rings(), velocity_transmit(), virtnet_probe(), vxge_device_register(), vxge_hw_device_hw_info_get(), vxge_xmit_compl(), wpa_alloc_frame(), wpa_send_eapol(), wpa_send_final(), and zalloc().

void* memmove ( void *  dest,
const void *  src,
size_t  count 
)

int __pure 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 }

void* __pure memscan ( const void *  addr,
int  c,
size_t  size 
)

memscan - 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 1 byte past the area if is not found

Definition at line 261 of file stringextra.c.

00262 {
00263         unsigned char * p = (unsigned char *) addr;
00264 
00265         while (size) {
00266                 if (*p == c)
00267                         return (void *) p;
00268                 p++;
00269                 size--;
00270         }
00271         return (void *) p;
00272 }

char* __pure 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* __pure 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* __malloc 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 }

char* __malloc 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 }

const char* __pure strerror ( int  errno  ) 

Retrieve string representation of error number.

Parameters:
errno/rc Error number or return status code
Return values:
strerror Pointer to error text
If the error is not found in the linked-in error tables, generates a generic "Error 0x<errno>" message.

The pointer returned by strerror() is valid only until the next call to strerror().

Definition at line 77 of file strerror.c.

References find_closest_error(), snprintf(), and errortab::text.

Referenced by aoeboot(), apply_settings(), arbel_alloc_icm(), arbel_close(), arbel_create_cq(), arbel_create_eq(), arbel_create_qp(), arbel_destroy_cq(), arbel_destroy_eq(), arbel_destroy_qp(), arbel_get_limits(), arbel_mad(), arbel_mcast_attach(), arbel_mcast_detach(), arbel_modify_qp(), arbel_open(), arbel_poll_cq(), arbel_probe(), arbel_setup_mpt(), arbel_start_firmware(), arbel_stop_firmware(), ata_command(), ath5k_handle_rx(), ath5k_hw_channel(), ath5k_reset(), ath5k_tx_processq(), bzimage_load(), clear_exec(), comboot_fetch_kernel(), comboot_load_image(), comboot_prepare_bounce_buffer(), comboot_prepare_segment(), config_exec(), create_fakedhcpack(), create_fakedhcpdiscover(), create_fakepxebsack(), dhcp_create_request(), dhcp_exec(), dhcp_proxy_rx(), dhcp_pxebs_rx(), dhcp_request_rx(), dhcp_tx(), dns_resolv(), eapol_key_rx(), efab_init_mac(), efi_snp_initialize(), efi_snp_mcast_ip_to_mac(), efi_snp_receive(), efi_snp_reset(), efi_snp_transmit(), elf_load_segment(), elfboot_load(), eltorito_exec(), eltorito_load_disk(), embedded_init(), ftp_control_close(), ftp_data_closed(), ftp_data_deliver_iob(), ftp_done(), ftp_open(), ftp_xfer_closed(), get_cached_dhcpack(), hermon_alloc_icm(), hermon_close(), hermon_configure_special_qps(), hermon_create_cq(), hermon_create_eq(), hermon_create_qp(), hermon_destroy_cq(), hermon_destroy_eq(), hermon_destroy_qp(), hermon_dump_qpctx(), hermon_get_cap(), hermon_mad(), hermon_map_vpm(), hermon_mcast_attach(), hermon_mcast_detach(), hermon_modify_qp(), hermon_open(), hermon_poll_cq(), hermon_probe(), hermon_sense_port_type(), hermon_setup_mpt(), hermon_start_firmware(), hermon_stop_firmware(), http_open_filter(), http_rx_location(), http_socket_close(), http_socket_deliver_iob(), http_xfer_close(), ib_cm_path_complete(), ib_cm_req_complete(), ib_cm_send_rtu(), ib_cmrc_changed(), ib_cmrc_complete_recv(), ib_cmrc_complete_send(), ib_cmrc_open(), ib_cmrc_xfer_close(), ib_cmrc_xfer_deliver_iob(), ib_create_cq(), ib_create_mi(), ib_create_qp(), ib_mcast_complete(), ib_mcast_join(), ib_mcast_leave(), ib_mi_complete_recv(), ib_mi_send(), ib_modify_qp(), ib_open(), ib_path_complete(), ib_post_recv(), ib_post_send(), ib_refill_recv(), ib_set_pkey_table(), ib_set_port_info(), ib_sma_guid_info(), ib_sma_node_desc(), ib_sma_node_info(), ib_sma_pkey_table(), ib_sma_port_info(), ib_sma_set_pkey_table(), ib_sma_set_port_info(), ib_smc_get_guid_info(), ib_smc_get_pkey_table(), ib_smc_get_port_info(), ib_srp_connect(), ib_srp_parse_root_path(), ib_srpboot(), ibft_fill_nic(), icmp_rx(), iflinkwait(), ifopen(), ifstat(), ifstat_errors(), image_exec(), image_load_type(), imgexec_exec(), imgfetch_core_exec(), imgload_exec(), init_i2c_bit_basher(), init_scsidev(), int13_boot(), int13_extended_rw(), int13_rw_sectors(), ipoib_join_broadcast_group(), ipoib_link_state_changed(), ipoib_open(), ipv4_rx(), ipv4_tx(), iscsi_handle_chap_i_value(), iscsi_handle_chap_r_value(), iscsi_handle_string(), iscsi_open_connection(), iscsi_rx_login_response(), iscsi_socket_close(), iscsi_socket_deliver_raw(), iscsi_tx_step(), iscsiboot(), iwlist(), linda_complete_recv(), linda_init_i2c(), linda_probe(), linda_program_uc_ram(), linda_read_eeprom(), linda_verify_uc_ram(), linebuf_test(), login_exec(), main_loop(), monojob_wait(), multiboot_load_elf(), multiboot_load_raw(), myri10ge_net_open(), myri10ge_pci_probe(), nbi_prepare_segment(), net80211_probe_step(), net80211_step_associate(), netboot(), netdev_rx_err(), netdev_tx_complete_err(), nvo_store(), phantom_create_rx_ctx(), phantom_create_tx_ctx(), phantom_destroy_rx_ctx(), phantom_destroy_tx_ctx(), phantom_fetch_setting(), phantom_issue_cmd(), phantom_probe(), phantom_store_setting(), pxe_deactivate(), pxe_load(), pxe_menu_parse(), pxe_tftp_open(), pxebs_exec(), pxenv_undi_get_mcast_address(), pxenv_undi_open(), pxenv_undi_reset_adapter(), pxenv_undi_transmit(), pxeparent_call(), register_ibdev(), register_netdev(), resolv_mux_try(), rootdev_probe(), sanboot_exec(), script_exec(), scsi_command(), set_exec(), show_exec(), slam_finished(), slam_mc_socket_close(), slam_open(), slam_pull_header(), slam_socket_close(), slam_xfer_close(), smbios_init(), srp_attach(), srp_cmd(), srp_login(), srp_xfer_close(), store_cached_dhcpack(), tcp_rx_data(), tcp_xmit(), tcp_xmit_reset(), test_parse_unparse(), test_resolve(), tftp_core_open(), tftp_done(), tftp_presize(), tftp_reopen(), tftp_reopen_mc(), tftp_rx_data(), tftp_xfer_close(), threewire_detect_address_len(), threewire_read(), threewire_write(), tls_generate_keys(), tls_new_certificate(), tls_new_change_cipher(), tls_send_plaintext(), tls_step(), udp_tx(), undi_load(), uri_test(), wpa_handle_1_of_2(), wpa_handle_3_of_4(), xfer_deliver_iob_meta(), xfer_deliver_raw(), and xfer_vredirect().

00077                                     {
00078         static char errbuf[64];
00079         struct errortab *errortab;
00080 
00081         /* Allow for strerror(rc) as well as strerror(errno) */
00082         if ( errno < 0 )
00083                 errno = -errno;
00084 
00085         /* Find the error description, if one exists */
00086         errortab = find_closest_error ( errno );
00087 
00088         /* Construct the error message */
00089         if ( errortab ) {
00090                 snprintf ( errbuf, sizeof ( errbuf ), "%s (%#08x)",
00091                            errortab->text, errno );
00092         } else {
00093                 snprintf ( errbuf, sizeof ( errbuf ), "Error %#08x", errno );
00094         }
00095 
00096         return errbuf;
00097 }


Generated on Tue Apr 6 20:01:53 2010 for gPXE by  doxygen 1.5.7.1