Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ elf_strptr(3E) — Amiga System V Release 4 Version 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

elf(3E)



elf_strptr(3E)    MISC. REFERENCE MANUAL PAGES     elf_strptr(3E)



NAME
     elfstrptr - make a string pointer

SYNOPSIS
     cc [flag ...] file ...  -lelf [library ...]

     #include <libelf.h>

     char *elfstrptr(Elf *elf, sizet section, sizet offset);

DESCRIPTION
     This function converts a string section offset to  a  string
     pointer.   elf  identifies the file in which the string sec-
     tion resides, and section gives the section table index  for
     the  strings.   elfstrptr  normally  returns a pointer to a
     string, but it returns a null pointer when elf is null, sec-
     tion  is invalid or is not a section of type SHTSTRTAB, the
     section data cannot be obtained, offset is  invalid,  or  an
     error occurs.

EXAMPLE
     A prototype for retrieving section names appears below.  The
     file  header  specifies the section name string table in the
     eshstrndx member.  The following  code  loops  through  the
     sections, printing their names.
          if ((ehdr = elf32getehdr(elf)) == 0)
          {
                  /* handle the error */
                  return;
          }
          ndx = ehdr->eshstrndx;
          scn = 0;
          while ((scn = elfnextscn(elf, scn)) != 0)
          {
                  char    *name = 0;
                  if ((shdr = elf32getshdr(scn)) != 0)
                    name = elfstrptr(elf, ndx, (sizet)shdr->shname);
                  printf("'%s'\n", name? name: "(null)");
          }

SEE ALSO
     elf(3E), elfgetdata(3E), elfgetshdr(3E), elfxlate(3E).

NOTE
     A program may call elfgetdata to retrieve an entire string
     table section.  For some applications, that would be both
     more efficient and more convenient than using elfstrptr.








                    Last change: ELF Library                    1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026