Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

elf_rand(3e) [hpux man page]

elf_rand(3E)															      elf_rand(3E)

NAME
elf_rand - random archive member access SYNOPSIS
[flag... ] file... [library] ... DESCRIPTION
and manipulate simple object files and archives. elf is an ELF descriptor previously returned from provides random archive processing, preparing elf to access an arbitrary archive member. elf must be a descriptor for the archive itself, not a member within the archive. offset gives the byte offset from the beginning of the archive to the archive header of the desired mem- ber. See elf_getarsym(3E) for more information about archive member offsets. When works, it returns offset. Otherwise it returns 0, because an error occurred, elf was null, or the file was not an archive (no archive member can have a zero offset). A program may mix ran- dom and sequential archive processing. EXAMPLES
An archive starts with a ``magic string'' that has bytes; the initial archive member follows immediately. An application could thus pro- vide the following function to rewind an archive (the function returns -1 for errors and 0 otherwise). #include <ar.h> #include <libelf.h> int rewindelf(Elf *elf) { if (elf_rand(elf, (size_t)SARMAG) == SARMAG) return 0; return -1; } SEE ALSO
ar(4), elf(3E), elf_begin(3E), elf_getarsym(3E), elf_next(3E). elf_rand(3E)

Check Out this Related Man Page

ELF_NEXT(3)						   BSD Library Functions Manual 					       ELF_NEXT(3)

NAME
elf_next -- provide sequential access to the next archive member LIBRARY
ELF Access Library (libelf, -lelf) SYNOPSIS
#include <libelf.h> Elf_Cmd elf_next(Elf *elf); DESCRIPTION
The elf_next() function causes the ELF archive descriptor corresponding to argument elf to be adjusted to provide access to the next member in the archive on a subsequent call to elf_begin(). The return value of elf_next() is suitable for use in a loop invoking elf_begin(). RETURN VALUES
If successful, function elf_next() returns the value ELF_C_READ. Otherwise, if argument elf was not associated with an archive, or if it was NULL, or if any other error occurred, the value ELF_C_NULL is returned. EXAMPLES
To process all the members of an archive use: Elf_Cmd cmd; Elf *archive, *e; ... cmd = ELF_C_READ; archive = elf_begin(fd, cmd, NULL); while ((e = elf_begin(fd, cmd, archive)) != (Elf *) 0) { ... process `e' here ... cmd = elf_next(e); elf_end(e); } elf_end(archive); ERRORS
Function elf_next() may fail with the following error: [ELF_E_ARGUMENT] Argument elf was not associated with a containing ar(1) archive. SEE ALSO
elf(3), elf_begin(3), elf_end(3), elf_rand(3) BSD
June 17, 2006 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Receiving status code 39 when accessing files through program.

I'm working on a project to extract some information from archive file. I ran my program through MFCobol animator and I'm receiving a status code of 39(file not compatible) when opening the file for input. I have tried just about everything, rebuild, convert, etc. but I receive the same message.... (6 Replies)
Discussion started by: bigdawg
6 Replies

2. Shell Programming and Scripting

how to find some dir

hi everybody, i have dir structure like this, . ./processed ./results ./archive ./archive/processed ./archive/results ./archive/logs ./archive/decisions ./archive/error ./logs ./inbox ./decisions ./progress ./outbox ./config ./error (12 Replies)
Discussion started by: manas_ranjan
12 Replies

3. Shell Programming and Scripting

simple script to alert of archive logs filling

Hi all. I am not a DBA. But I do have responsibility for making sure the archive logs dont fill up and cause the database. This happend the other day while I was absent (sick) and I got a good ticking off for it. Needless to say I dont want this happen! Could anyone lend a hand to a... (8 Replies)
Discussion started by: Incremental
8 Replies

4. Shell Programming and Scripting

random script termination

I'm writing a script to archive data. First, the files are all rsync'd to the archive directory via NFS mounts(I know not the most efficient, but the only choice in this situation), then I use md5sum to validate the transfers. During execution of the script, it will exit for no apparent reason. It... (6 Replies)
Discussion started by: mph
6 Replies

5. UNIX for Dummies Questions & Answers

Tar Help

Hi Unix Gurus, I would like to seek some advises regarding tar. I've received this error: tar: The getwd subroutine failed. Cannot open the parent directory. when i try to tar some files in the directory. Is this something to do with the file permission of the parent... (8 Replies)
Discussion started by: lweegp
8 Replies

6. Shell Programming and Scripting

No. of files in Tar

Hi Frields, I would like to know the number of files present in a tar without using the command tar -tvf |wc -l Is their any command for this? (7 Replies)
Discussion started by: mr_manii
7 Replies

7. Shell Programming and Scripting

Problem to read archive

Dear all, I have this archive: cat file.txt archive test 02 sequence 03 02length 52 archive test 02 sequence 04 02length 52 archive test 02 sequence 05 02length 52 teste arquivo 06 sequencia 08 06 length 54 teste arquivo 06 sequencia 09 ... (8 Replies)
Discussion started by: cewa67
8 Replies

8. Shell Programming and Scripting

Extracting from archive | compressing to new archive

Hi there, I have one huge archive (it's a system image). I need sometime to create smaller archives with only one or two file from my big archive. So I'm looking for a command that extracts files from an archive and pipe them to another one. I tried the following : tar -xzOf oldarchive.tgz... (5 Replies)
Discussion started by: chebarbudo
5 Replies

9. Shell Programming and Scripting

need help archive script

Hi all, I am new to linux and scripting so please forgive me. I need to create a script that will archive files but the max size of the archive need to be 500mb or under. I know about the archiving with parts but i want all the archives as individual archives. Can anyone point me in the correct... (7 Replies)
Discussion started by: craig0
7 Replies

10. Shell Programming and Scripting

How archive the older than 30 day files to another unix server

I need to archive the older than 30 day file to another uinx server.I have wrote the below uinx script. for LOOK_DIR in /TempFiles do for FILE in `find ${LOOK_DIR} -mtime -30 -exec ls {} \;` do echo ${FILE} >> file_list ## This file will have the list of files copied and... (12 Replies)
Discussion started by: murari83.ds
12 Replies

11. UNIX for Advanced & Expert Users

Self extracting archive for Linux and windows

Is there a way to create a self extracting archive that works in both linux and windows? And if so how? Everything I have read on google only works in either Linux or Windows but not both. (6 Replies)
Discussion started by: cokedude
6 Replies

12. UNIX and Linux Applications

Ls command question

I am scratching my head right now. I am trying to archive a ton of files in a directory. I am attempting to tar them by year. On our development server if I type ls *_2008* it returns all of the files I am expecting to see. (The format of the filename includes xx_xx_xxx_2008-09-29_xxx.xxxx.xxxx)... (8 Replies)
Discussion started by: jmartin99
8 Replies

13. Programming

Extract part of an archive to a different file

I need to save part of a file to a different one, start and end offset bytes are provided by two counters in long format. If the difference is big, how should I do it to prevent buffer overflow in java? (7 Replies)
Discussion started by: Tribe
7 Replies

14. UNIX for Dummies Questions & Answers

Getting the lines with nth column non-null

Hi, I have a huge list of archives (.gz). Each archive is about 40MB. A file is generated every minute so if I want to analyze the data for 1 hour I get already 60 files for example. These are text files, ';' separated, each line having about 300 fields (columns). What I need to do is to... (11 Replies)
Discussion started by: Nenad
11 Replies

15. UNIX for Beginners Questions & Answers

Compiling UNIX System V

I tried to install UNIX system v R4, but the sources i've found(archive.org and WinWorldPC) are incomplete (missing cc, for example). Since archive.org has the source files i thought i could compile it and upload it for other users, but i cant get it to work. Any advice? (10 Replies)
Discussion started by: Parodper
10 Replies