12de3b87aSKai Wang.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. 22de3b87aSKai Wang.\" 32de3b87aSKai Wang.\" Redistribution and use in source and binary forms, with or without 42de3b87aSKai Wang.\" modification, are permitted provided that the following conditions 52de3b87aSKai Wang.\" are met: 62de3b87aSKai Wang.\" 1. Redistributions of source code must retain the above copyright 72de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer. 82de3b87aSKai Wang.\" 2. Redistributions in binary form must reproduce the above copyright 92de3b87aSKai Wang.\" notice, this list of conditions and the following disclaimer in the 102de3b87aSKai Wang.\" documentation and/or other materials provided with the distribution. 112de3b87aSKai Wang.\" 122de3b87aSKai Wang.\" This software is provided by Joseph Koshy ``as is'' and 132de3b87aSKai Wang.\" any express or implied warranties, including, but not limited to, the 142de3b87aSKai Wang.\" implied warranties of merchantability and fitness for a particular purpose 152de3b87aSKai Wang.\" are disclaimed. in no event shall Joseph Koshy be liable 162de3b87aSKai Wang.\" for any direct, indirect, incidental, special, exemplary, or consequential 172de3b87aSKai Wang.\" damages (including, but not limited to, procurement of substitute goods 182de3b87aSKai Wang.\" or services; loss of use, data, or profits; or business interruption) 192de3b87aSKai Wang.\" however caused and on any theory of liability, whether in contract, strict 202de3b87aSKai Wang.\" liability, or tort (including negligence or otherwise) arising in any way 212de3b87aSKai Wang.\" out of the use of this software, even if advised of the possibility of 222de3b87aSKai Wang.\" such damage. 232de3b87aSKai Wang.\" 24*d003e0d7SEd Maste.\" $Id: elf_next.3 3698 2019-02-28 06:34:42Z jkoshy $ 252de3b87aSKai Wang.\" 26*d003e0d7SEd Maste.Dd February 27, 2019 272de3b87aSKai Wang.Dt ELF_NEXT 3 28ae500c1fSEd Maste.Os 292de3b87aSKai Wang.Sh NAME 302de3b87aSKai Wang.Nm elf_next 312de3b87aSKai Wang.Nd provide sequential access to the next archive member 322de3b87aSKai Wang.Sh LIBRARY 332de3b87aSKai Wang.Lb libelf 342de3b87aSKai Wang.Sh SYNOPSIS 352de3b87aSKai Wang.In libelf.h 362de3b87aSKai Wang.Ft Elf_Cmd 372de3b87aSKai Wang.Fn elf_next "Elf *elf" 382de3b87aSKai Wang.Sh DESCRIPTION 392de3b87aSKai WangThe 402de3b87aSKai Wang.Fn elf_next 412de3b87aSKai Wangfunction causes the ELF archive descriptor corresponding to argument 422de3b87aSKai Wang.Ar elf 432de3b87aSKai Wangto be adjusted to provide access to the next member in 442de3b87aSKai Wangthe archive on a subsequent call to 452de3b87aSKai Wang.Fn elf_begin . 462de3b87aSKai Wang.Pp 472de3b87aSKai WangThe return value of 482de3b87aSKai Wang.Fn elf_next 492de3b87aSKai Wangis suitable for use in a loop invoking 502de3b87aSKai Wang.Fn elf_begin . 512de3b87aSKai Wang.Sh RETURN VALUES 522de3b87aSKai WangIf successful, function 532de3b87aSKai Wang.Fn elf_next 542de3b87aSKai Wangreturns the value 552de3b87aSKai Wang.Dv ELF_C_READ . 562de3b87aSKai WangOtherwise, if argument 572de3b87aSKai Wang.Ar elf 582de3b87aSKai Wangwas not associated with an archive, or if it was 592de3b87aSKai Wang.Dv NULL , 602de3b87aSKai Wangor if any other error occurred, the value 612de3b87aSKai Wang.Dv ELF_C_NULL 622de3b87aSKai Wangis returned. 632de3b87aSKai Wang.Sh EXAMPLES 642de3b87aSKai WangTo process all the members of an archive use: 652de3b87aSKai Wang.Bd -literal -offset indent 662de3b87aSKai WangElf_Cmd cmd; 672de3b87aSKai WangElf *archive, *e; 682de3b87aSKai Wang\&... 692de3b87aSKai Wangcmd = ELF_C_READ; 702de3b87aSKai Wangarchive = elf_begin(fd, cmd, NULL); 712de3b87aSKai Wangwhile ((e = elf_begin(fd, cmd, archive)) != (Elf *) 0) 722de3b87aSKai Wang{ 732de3b87aSKai Wang ... process `e' here ... 742de3b87aSKai Wang 752de3b87aSKai Wang cmd = elf_next(e); 762de3b87aSKai Wang elf_end(e); 772de3b87aSKai Wang} 782de3b87aSKai Wangelf_end(archive); 792de3b87aSKai Wang.Ed 802de3b87aSKai Wang.Sh ERRORS 812de3b87aSKai WangFunction 822de3b87aSKai Wang.Fn elf_next 832de3b87aSKai Wangmay fail with the following error: 842de3b87aSKai Wang.Bl -tag -width "[ELF_E_RESOURCE]" 852de3b87aSKai Wang.It Bq Er ELF_E_ARGUMENT 862de3b87aSKai WangArgument 872de3b87aSKai Wang.Ar elf 882de3b87aSKai Wangwas not associated with a containing 892de3b87aSKai Wang.Xr ar 1 902de3b87aSKai Wangarchive. 91*d003e0d7SEd Maste.It Bq Er ELF_E_ARGUMENT 92*d003e0d7SEd MasteAn error was encountered while parsing the archive containing argument 93*d003e0d7SEd Maste.Ar elf . 942de3b87aSKai Wang.El 952de3b87aSKai Wang.Sh SEE ALSO 962de3b87aSKai Wang.Xr elf 3 , 972de3b87aSKai Wang.Xr elf_begin 3 , 982de3b87aSKai Wang.Xr elf_end 3 , 992de3b87aSKai Wang.Xr elf_rand 3 100