elf_strptr man page on Solaris

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
Solaris logo
[printable version]

elf_strptr(3ELF)	     ELF Library Functions	      elf_strptr(3ELF)

NAME
       elf_strptr - make a string pointer

SYNOPSIS
       cc [ flag ... ] file ... -lelf [ library ... ]
       #include <libelf.h>

       char *elf_strptr(Elf *elf, size_t section, size_t offset);

DESCRIPTION
       The  elf_strptr() function converts a string section offset to a string
       pointer. elf identifies the file in which the string  section  resides,
       and  section  identifies	 the  section  table  index  for  the strings.
       elf_strptr() normally returns a pointer to a string, but it  returns  a
       null  pointer  when elf is null, section is invalid or is not a section
       of type SHT_STRTAB, the section data  cannot  be	 obtained,  offset  is
       invalid, or an error occurs.

EXAMPLES
       Example 1 A sample program of calling elf_strptr() function.

       A prototype for retrieving section names appears below. The file header
       specifies the section name string table in the e_shstrndx  member.  The
       following code loops through the sections, printing their names.

	 /* handle the error */
	 if ((ehdr = elf32_getehdr(elf)) == 0) {
	      return;
	 }
	 ndx = ehdr->e_shstrndx;
	 scn = 0;
	 while ((scn = elf_nextscn(elf, scn)) != 0) {
	      char *name = 0;
	      if ((shdr = elf32_getshdr(scn)) != 0)
			 name = elf_strptr(elf, ndx, (size_t)shdr->sh_name);
	      printf("'%s'\n", name? name: "(null)");
	 }

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌─────────────────────────────┬─────────────────────────────┐
       │      ATTRIBUTE TYPE	     │	    ATTRIBUTE VALUE	   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Interface Stability	     │Committed			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │MT-Level		     │MT-Safe			   │
       └─────────────────────────────┴─────────────────────────────┘

SEE ALSO
       elf(3ELF),    elf32_getshdr(3ELF),    elf32_xlatetof(3ELF),    elf_get‐
       data(3ELF), libelf(3LIB), attributes(5)

NOTES
       A program may call elf_getdata() to retrieve  an	 entire	 string	 table
       section.	 For  some applications, that would be both more efficient and
       more convenient than using elf_strptr().

SunOS 5.10			  11 Jul 2001		      elf_strptr(3ELF)
[top]

List of man pages available for Solaris

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net