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
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)