libiberty.html 230 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <title>GNU libiberty</title>
  6. <meta name="description" content="GNU libiberty">
  7. <meta name="keywords" content="GNU libiberty">
  8. <meta name="resource-type" content="document">
  9. <meta name="distribution" content="global">
  10. <meta name="Generator" content="makeinfo">
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  12. <link href="#Top" rel="start" title="Top">
  13. <link href="#Index" rel="index" title="Index">
  14. <link href="#SEC_Contents" rel="contents" title="Table of Contents">
  15. <style type="text/css">
  16. <!--
  17. a.summary-letter {text-decoration: none}
  18. blockquote.smallquotation {font-size: smaller}
  19. div.display {margin-left: 3.2em}
  20. div.example {margin-left: 3.2em}
  21. div.indentedblock {margin-left: 3.2em}
  22. div.lisp {margin-left: 3.2em}
  23. div.smalldisplay {margin-left: 3.2em}
  24. div.smallexample {margin-left: 3.2em}
  25. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  26. div.smalllisp {margin-left: 3.2em}
  27. kbd {font-style:oblique}
  28. pre.display {font-family: inherit}
  29. pre.format {font-family: inherit}
  30. pre.menu-comment {font-family: serif}
  31. pre.menu-preformatted {font-family: serif}
  32. pre.smalldisplay {font-family: inherit; font-size: smaller}
  33. pre.smallexample {font-size: smaller}
  34. pre.smallformat {font-family: inherit; font-size: smaller}
  35. pre.smalllisp {font-size: smaller}
  36. span.nocodebreak {white-space:nowrap}
  37. span.nolinebreak {white-space:nowrap}
  38. span.roman {font-family:serif; font-weight:normal}
  39. span.sansserif {font-family:sans-serif; font-weight:normal}
  40. ul.no-bullet {list-style: none}
  41. -->
  42. </style>
  43. </head>
  44. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  45. <h1 class="settitle" align="center"><small>GNU</small> libiberty</h1>
  46. <a name="SEC_Contents"></a>
  47. <h2 class="contents-heading">Table of Contents</h2>
  48. <div class="contents">
  49. <ul class="no-bullet">
  50. <li><a name="toc-Using-1" href="#Using">1 Using</a></li>
  51. <li><a name="toc-Overview-1" href="#Overview">2 Overview</a>
  52. <ul class="no-bullet">
  53. <li><a name="toc-Supplemental-Functions-1" href="#Supplemental-Functions">2.1 Supplemental Functions</a></li>
  54. <li><a name="toc-Replacement-Functions-1" href="#Replacement-Functions">2.2 Replacement Functions</a>
  55. <ul class="no-bullet">
  56. <li><a name="toc-Memory-Allocation-1" href="#Memory-Allocation">2.2.1 Memory Allocation</a></li>
  57. <li><a name="toc-Exit-Handlers-1" href="#Exit-Handlers">2.2.2 Exit Handlers</a></li>
  58. <li><a name="toc-Error-Reporting-1" href="#Error-Reporting">2.2.3 Error Reporting</a></li>
  59. </ul></li>
  60. <li><a name="toc-Extensions-1" href="#Extensions">2.3 Extensions</a>
  61. <ul class="no-bullet">
  62. <li><a name="toc-Obstacks-1" href="#Obstacks">2.3.1 Obstacks</a>
  63. <ul class="no-bullet">
  64. <li><a name="toc-Creating-Obstacks-1" href="#Creating-Obstacks">2.3.1.1 Creating Obstacks</a></li>
  65. <li><a name="toc-Preparing-for-Using-Obstacks" href="#Preparing-for-Obstacks">2.3.1.2 Preparing for Using Obstacks</a></li>
  66. <li><a name="toc-Allocation-in-an-Obstack-1" href="#Allocation-in-an-Obstack">2.3.1.3 Allocation in an Obstack</a></li>
  67. <li><a name="toc-Freeing-Objects-in-an-Obstack" href="#Freeing-Obstack-Objects">2.3.1.4 Freeing Objects in an Obstack</a></li>
  68. <li><a name="toc-Obstack-Functions-and-Macros" href="#Obstack-Functions">2.3.1.5 Obstack Functions and Macros</a></li>
  69. <li><a name="toc-Growing-Objects-1" href="#Growing-Objects">2.3.1.6 Growing Objects</a></li>
  70. <li><a name="toc-Extra-Fast-Growing-Objects" href="#Extra-Fast-Growing">2.3.1.7 Extra Fast Growing Objects</a></li>
  71. <li><a name="toc-Status-of-an-Obstack-1" href="#Status-of-an-Obstack">2.3.1.8 Status of an Obstack</a></li>
  72. <li><a name="toc-Alignment-of-Data-in-Obstacks" href="#Obstacks-Data-Alignment">2.3.1.9 Alignment of Data in Obstacks</a></li>
  73. <li><a name="toc-Obstack-Chunks-1" href="#Obstack-Chunks">2.3.1.10 Obstack Chunks</a></li>
  74. <li><a name="toc-Summary-of-Obstack-Macros" href="#Summary-of-Obstacks">2.3.1.11 Summary of Obstack Macros</a></li>
  75. </ul></li>
  76. </ul></li>
  77. </ul></li>
  78. <li><a name="toc-Function_002c-Variable_002c-and-Macro-Listing_002e" href="#Functions">3 Function, Variable, and Macro Listing.</a></li>
  79. <li><a name="toc-Licenses-1" href="#Licenses">Appendix A Licenses</a>
  80. <ul class="no-bullet">
  81. <li><a name="toc-GNU-LESSER-GENERAL-PUBLIC-LICENSE" href="#Library-Copying">A.1 GNU LESSER GENERAL PUBLIC LICENSE</a>
  82. <ul class="no-bullet">
  83. <li><a name="toc-Preamble" href="#Preamble">A.1.1 Preamble</a></li>
  84. <li><a name="toc-How-to-Apply-These-Terms-to-Your-New-Libraries" href="#How-to-Apply-These-Terms-to-Your-New-Libraries">A.1.2 How to Apply These Terms to Your New Libraries</a></li>
  85. </ul></li>
  86. <li><a name="toc-BSD-1" href="#BSD">A.2 BSD</a></li>
  87. </ul></li>
  88. <li><a name="toc-Index-1" href="#Index">Index</a></li>
  89. </ul>
  90. </div>
  91. <a name="Top"></a>
  92. <div class="header">
  93. <p>
  94. Next: <a href="#Using" accesskey="n" rel="next">Using</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  95. </div>
  96. <a name="Introduction"></a>
  97. <h1 class="top">Introduction</h1>
  98. <p>The <code>libiberty</code> library is a collection of subroutines used by various
  99. GNU programs. It is available under the Library General Public
  100. License; for more information, see <a href="#Library-Copying">Library Copying</a>.
  101. </p>
  102. <table class="menu" border="0" cellspacing="0">
  103. <tr><td align="left" valign="top">&bull; <a href="#Using" accesskey="1">Using</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to use libiberty in your code.
  104. </td></tr>
  105. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  106. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Overview" accesskey="2">Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Overview of available function groups.
  107. </td></tr>
  108. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  109. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Functions" accesskey="3">Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Available functions, macros, and global variables.
  110. </td></tr>
  111. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  112. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Licenses" accesskey="4">Licenses</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The various licenses under which libiberty sources are
  113. distributed.
  114. </td></tr>
  115. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  116. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Index" accesskey="5">Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Index of functions and categories.
  117. </td></tr>
  118. </table>
  119. <hr>
  120. <a name="Using"></a>
  121. <div class="header">
  122. <p>
  123. Next: <a href="#Overview" accesskey="n" rel="next">Overview</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  124. </div>
  125. <a name="Using-1"></a>
  126. <h2 class="chapter">1 Using</h2>
  127. <a name="index-using-libiberty"></a>
  128. <a name="index-libiberty-usage"></a>
  129. <a name="index-how-to-use"></a>
  130. <p>To date, <code>libiberty</code> is generally not installed on its own. It has evolved
  131. over years but does not have its own version number nor release schedule.
  132. </p>
  133. <p>Possibly the easiest way to use <code>libiberty</code> in your projects is to drop the
  134. <code>libiberty</code> code into your project&rsquo;s sources, and to build the library along
  135. with your own sources; the library would then be linked in at the end. This
  136. prevents any possible version mismatches with other copies of libiberty
  137. elsewhere on the system.
  138. </p>
  139. <p>Passing <samp>--enable-install-libiberty</samp> to the <code>configure</code>
  140. script when building <code>libiberty</code> causes the header files and archive library
  141. to be installed when <kbd>make install</kbd> is run. This option also takes
  142. an (optional) argument to specify the installation location, in the same
  143. manner as <samp>--prefix</samp>.
  144. </p>
  145. <p>For your own projects, an approach which offers stability and flexibility
  146. is to include <code>libiberty</code> with your code, but allow the end user to optionally
  147. choose to use a previously-installed version instead. In this way the
  148. user may choose (for example) to install <code>libiberty</code> as part of GCC, and use
  149. that version for all software built with that compiler. (This approach
  150. has proven useful with software using the GNU <code>readline</code> library.)
  151. </p>
  152. <p>Making use of <code>libiberty</code> code usually requires that you include one or more
  153. header files from the <code>libiberty</code> distribution. (They will be named as
  154. necessary in the function descriptions.) At link time, you will need to
  155. add <samp>-liberty</samp> to your link command invocation.
  156. </p>
  157. <hr>
  158. <a name="Overview"></a>
  159. <div class="header">
  160. <p>
  161. Next: <a href="#Functions" accesskey="n" rel="next">Functions</a>, Previous: <a href="#Using" accesskey="p" rel="prev">Using</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  162. </div>
  163. <a name="Overview-1"></a>
  164. <h2 class="chapter">2 Overview</h2>
  165. <p>Functions contained in <code>libiberty</code> can be divided into three general categories.
  166. </p>
  167. <table class="menu" border="0" cellspacing="0">
  168. <tr><td align="left" valign="top">&bull; <a href="#Supplemental-Functions" accesskey="1">Supplemental Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Providing functions which don&rsquo;t exist
  169. on older operating systems.
  170. </td></tr>
  171. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  172. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Replacement-Functions" accesskey="2">Replacement Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">These functions are sometimes buggy or
  173. unpredictable on some operating systems.
  174. </td></tr>
  175. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  176. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Extensions" accesskey="3">Extensions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Functions which provide useful extensions
  177. or safety wrappers around existing code.
  178. </td></tr>
  179. </table>
  180. <hr>
  181. <a name="Supplemental-Functions"></a>
  182. <div class="header">
  183. <p>
  184. Next: <a href="#Replacement-Functions" accesskey="n" rel="next">Replacement Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  185. </div>
  186. <a name="Supplemental-Functions-1"></a>
  187. <h3 class="section">2.1 Supplemental Functions</h3>
  188. <a name="index-supplemental-functions"></a>
  189. <a name="index-functions_002c-supplemental"></a>
  190. <a name="index-functions_002c-missing"></a>
  191. <p>Certain operating systems do not provide functions which have since
  192. become standardized, or at least common. For example, the Single
  193. Unix Specification Version 2 requires that the <code>basename</code>
  194. function be provided, but an OS which predates that specification
  195. might not have this function. This should not prevent well-written
  196. code from running on such a system.
  197. </p>
  198. <p>Similarly, some functions exist only among a particular &ldquo;flavor&rdquo;
  199. or &ldquo;family&rdquo; of operating systems. As an example, the <code>bzero</code>
  200. function is often not present on systems outside the BSD-derived
  201. family of systems.
  202. </p>
  203. <p>Many such functions are provided in <code>libiberty</code>. They are quickly
  204. listed here with little description, as systems which lack them
  205. become less and less common. Each function <var>foo</var> is implemented
  206. in <samp><var>foo</var>.c</samp> but not declared in any <code>libiberty</code> header file; more
  207. comments and caveats for each function&rsquo;s implementation are often
  208. available in the source file. Generally, the function can simply
  209. be declared as <code>extern</code>.
  210. </p>
  211. <hr>
  212. <a name="Replacement-Functions"></a>
  213. <div class="header">
  214. <p>
  215. Next: <a href="#Extensions" accesskey="n" rel="next">Extensions</a>, Previous: <a href="#Supplemental-Functions" accesskey="p" rel="prev">Supplemental Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  216. </div>
  217. <a name="Replacement-Functions-1"></a>
  218. <h3 class="section">2.2 Replacement Functions</h3>
  219. <a name="index-replacement-functions"></a>
  220. <a name="index-functions_002c-replacement"></a>
  221. <p>Some functions have extremely limited implementations on different
  222. platforms. Other functions are tedious to use correctly; for example,
  223. proper use of <code>malloc</code> calls for the return value to be checked and
  224. appropriate action taken if memory has been exhausted. A group of
  225. &ldquo;replacement functions&rdquo; is available in <code>libiberty</code> to address these issues
  226. for some of the most commonly used subroutines.
  227. </p>
  228. <p>All of these functions are declared in the <samp>libiberty.h</samp> header
  229. file. Many of the implementations will use preprocessor macros set by
  230. GNU Autoconf, if you decide to make use of that program. Some of these
  231. functions may call one another.
  232. </p>
  233. <table class="menu" border="0" cellspacing="0">
  234. <tr><td align="left" valign="top">&bull; <a href="#Memory-Allocation" accesskey="1">Memory Allocation</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Testing and handling failed memory
  235. requests automatically.
  236. </td></tr>
  237. <tr><td align="left" valign="top">&bull; <a href="#Exit-Handlers" accesskey="2">Exit Handlers</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Calling routines on program exit.
  238. </td></tr>
  239. <tr><td align="left" valign="top">&bull; <a href="#Error-Reporting" accesskey="3">Error Reporting</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Mapping errno and signal numbers to
  240. more useful string formats.
  241. </td></tr>
  242. </table>
  243. <hr>
  244. <a name="Memory-Allocation"></a>
  245. <div class="header">
  246. <p>
  247. Next: <a href="#Exit-Handlers" accesskey="n" rel="next">Exit Handlers</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  248. </div>
  249. <a name="Memory-Allocation-1"></a>
  250. <h4 class="subsection">2.2.1 Memory Allocation</h4>
  251. <a name="index-memory-allocation"></a>
  252. <p>The functions beginning with the letter &lsquo;<samp>x</samp>&rsquo; are wrappers around
  253. standard functions; the functions provided by the system environment
  254. are called and their results checked before the results are passed back
  255. to client code. If the standard functions fail, these wrappers will
  256. terminate the program. Thus, these versions can be used with impunity.
  257. </p>
  258. <hr>
  259. <a name="Exit-Handlers"></a>
  260. <div class="header">
  261. <p>
  262. Next: <a href="#Error-Reporting" accesskey="n" rel="next">Error Reporting</a>, Previous: <a href="#Memory-Allocation" accesskey="p" rel="prev">Memory Allocation</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  263. </div>
  264. <a name="Exit-Handlers-1"></a>
  265. <h4 class="subsection">2.2.2 Exit Handlers</h4>
  266. <a name="index-exit-handlers"></a>
  267. <p>The existence and implementation of the <code>atexit</code> routine varies
  268. amongst the flavors of Unix. <code>libiberty</code> provides an unvarying dependable
  269. implementation via <code>xatexit</code> and <code>xexit</code>.
  270. </p>
  271. <hr>
  272. <a name="Error-Reporting"></a>
  273. <div class="header">
  274. <p>
  275. Previous: <a href="#Exit-Handlers" accesskey="p" rel="prev">Exit Handlers</a>, Up: <a href="#Replacement-Functions" accesskey="u" rel="up">Replacement Functions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  276. </div>
  277. <a name="Error-Reporting-1"></a>
  278. <h4 class="subsection">2.2.3 Error Reporting</h4>
  279. <a name="index-error-reporting"></a>
  280. <p>These are a set of routines to facilitate programming with the system
  281. <code>errno</code> interface. The <code>libiberty</code> source file <samp>strerror.c</samp>
  282. contains a good deal of documentation for these functions.
  283. </p>
  284. <hr>
  285. <a name="Extensions"></a>
  286. <div class="header">
  287. <p>
  288. Previous: <a href="#Replacement-Functions" accesskey="p" rel="prev">Replacement Functions</a>, Up: <a href="#Overview" accesskey="u" rel="up">Overview</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  289. </div>
  290. <a name="Extensions-1"></a>
  291. <h3 class="section">2.3 Extensions</h3>
  292. <a name="index-extensions"></a>
  293. <a name="index-functions_002c-extension"></a>
  294. <p><code>libiberty</code> includes additional functionality above and beyond standard
  295. functions, which has proven generically useful in GNU programs, such as
  296. obstacks and regex. These functions are often copied from other
  297. projects as they gain popularity, and are included here to provide a
  298. central location from which to use, maintain, and distribute them.
  299. </p>
  300. <table class="menu" border="0" cellspacing="0">
  301. <tr><td align="left" valign="top">&bull; <a href="#Obstacks" accesskey="1">Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Stacks of arbitrary objects.
  302. </td></tr>
  303. </table>
  304. <hr>
  305. <a name="Obstacks"></a>
  306. <div class="header">
  307. <p>
  308. Up: <a href="#Extensions" accesskey="u" rel="up">Extensions</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  309. </div>
  310. <a name="Obstacks-1"></a>
  311. <h4 class="subsection">2.3.1 Obstacks</h4>
  312. <a name="index-obstacks"></a>
  313. <p>An <em>obstack</em> is a pool of memory containing a stack of objects. You
  314. can create any number of separate obstacks, and then allocate objects in
  315. specified obstacks. Within each obstack, the last object allocated must
  316. always be the first one freed, but distinct obstacks are independent of
  317. each other.
  318. </p>
  319. <p>Aside from this one constraint of order of freeing, obstacks are totally
  320. general: an obstack can contain any number of objects of any size. They
  321. are implemented with macros, so allocation is usually very fast as long as
  322. the objects are usually small. And the only space overhead per object is
  323. the padding needed to start each object on a suitable boundary.
  324. </p>
  325. <table class="menu" border="0" cellspacing="0">
  326. <tr><td align="left" valign="top">&bull; <a href="#Creating-Obstacks" accesskey="1">Creating Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to declare an obstack in your program.
  327. </td></tr>
  328. <tr><td align="left" valign="top">&bull; <a href="#Preparing-for-Obstacks" accesskey="2">Preparing for Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Preparations needed before you can
  329. use obstacks.
  330. </td></tr>
  331. <tr><td align="left" valign="top">&bull; <a href="#Allocation-in-an-Obstack" accesskey="3">Allocation in an Obstack</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Allocating objects in an obstack.
  332. </td></tr>
  333. <tr><td align="left" valign="top">&bull; <a href="#Freeing-Obstack-Objects" accesskey="4">Freeing Obstack Objects</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Freeing objects in an obstack.
  334. </td></tr>
  335. <tr><td align="left" valign="top">&bull; <a href="#Obstack-Functions" accesskey="5">Obstack Functions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The obstack functions are really macros.
  336. </td></tr>
  337. <tr><td align="left" valign="top">&bull; <a href="#Growing-Objects" accesskey="6">Growing Objects</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Making an object bigger by stages.
  338. </td></tr>
  339. <tr><td align="left" valign="top">&bull; <a href="#Extra-Fast-Growing" accesskey="7">Extra Fast Growing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Extra-high-efficiency (though more
  340. complicated) growing objects.
  341. </td></tr>
  342. <tr><td align="left" valign="top">&bull; <a href="#Status-of-an-Obstack" accesskey="8">Status of an Obstack</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Inquiries about the status of an obstack.
  343. </td></tr>
  344. <tr><td align="left" valign="top">&bull; <a href="#Obstacks-Data-Alignment" accesskey="9">Obstacks Data Alignment</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Controlling alignment of objects in obstacks.
  345. </td></tr>
  346. <tr><td align="left" valign="top">&bull; <a href="#Obstack-Chunks">Obstack Chunks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How obstacks obtain and release chunks;
  347. efficiency considerations.
  348. </td></tr>
  349. <tr><td align="left" valign="top">&bull; <a href="#Summary-of-Obstacks">Summary of Obstacks</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  350. </td></tr>
  351. </table>
  352. <hr>
  353. <a name="Creating-Obstacks"></a>
  354. <div class="header">
  355. <p>
  356. Next: <a href="#Preparing-for-Obstacks" accesskey="n" rel="next">Preparing for Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  357. </div>
  358. <a name="Creating-Obstacks-1"></a>
  359. <h4 class="subsubsection">2.3.1.1 Creating Obstacks</h4>
  360. <p>The utilities for manipulating obstacks are declared in the header
  361. file <samp>obstack.h</samp>.
  362. <a name="index-obstack_002eh"></a>
  363. </p>
  364. <dl>
  365. <dt><a name="index-struct-obstack"></a>Data Type: <strong>struct obstack</strong></dt>
  366. <dd><p>An obstack is represented by a data structure of type <code>struct
  367. obstack</code>. This structure has a small fixed size; it records the status
  368. of the obstack and how to find the space in which objects are allocated.
  369. It does not contain any of the objects themselves. You should not try
  370. to access the contents of the structure directly; use only the macros
  371. described in this chapter.
  372. </p></dd></dl>
  373. <p>You can declare variables of type <code>struct obstack</code> and use them as
  374. obstacks, or you can allocate obstacks dynamically like any other kind
  375. of object. Dynamic allocation of obstacks allows your program to have a
  376. variable number of different stacks. (You can even allocate an
  377. obstack structure in another obstack, but this is rarely useful.)
  378. </p>
  379. <p>All the macros that work with obstacks require you to specify which
  380. obstack to use. You do this with a pointer of type <code>struct obstack
  381. *</code>. In the following, we often say &ldquo;an obstack&rdquo; when strictly
  382. speaking the object at hand is such a pointer.
  383. </p>
  384. <p>The objects in the obstack are packed into large blocks called
  385. <em>chunks</em>. The <code>struct obstack</code> structure points to a chain of
  386. the chunks currently in use.
  387. </p>
  388. <p>The obstack library obtains a new chunk whenever you allocate an object
  389. that won&rsquo;t fit in the previous chunk. Since the obstack library manages
  390. chunks automatically, you don&rsquo;t need to pay much attention to them, but
  391. you do need to supply a function which the obstack library should use to
  392. get a chunk. Usually you supply a function which uses <code>malloc</code>
  393. directly or indirectly. You must also supply a function to free a chunk.
  394. These matters are described in the following section.
  395. </p>
  396. <hr>
  397. <a name="Preparing-for-Obstacks"></a>
  398. <div class="header">
  399. <p>
  400. Next: <a href="#Allocation-in-an-Obstack" accesskey="n" rel="next">Allocation in an Obstack</a>, Previous: <a href="#Creating-Obstacks" accesskey="p" rel="prev">Creating Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  401. </div>
  402. <a name="Preparing-for-Using-Obstacks"></a>
  403. <h4 class="subsubsection">2.3.1.2 Preparing for Using Obstacks</h4>
  404. <p>Each source file in which you plan to use obstacks
  405. must include the header file <samp>obstack.h</samp>, like this:
  406. </p>
  407. <div class="smallexample">
  408. <pre class="smallexample">#include &lt;obstack.h&gt;
  409. </pre></div>
  410. <a name="index-obstack_005fchunk_005falloc"></a>
  411. <a name="index-obstack_005fchunk_005ffree"></a>
  412. <p>Also, if the source file uses the macro <code>obstack_init</code>, it must
  413. declare or define two macros that will be called by the
  414. obstack library. One, <code>obstack_chunk_alloc</code>, is used to allocate
  415. the chunks of memory into which objects are packed. The other,
  416. <code>obstack_chunk_free</code>, is used to return chunks when the objects in
  417. them are freed. These macros should appear before any use of obstacks
  418. in the source file.
  419. </p>
  420. <p>Usually these are defined to use <code>malloc</code> via the intermediary
  421. <code>xmalloc</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Unconstrained-Allocation">Unconstrained Allocation</a> in <cite>The GNU C Library Reference Manual</cite>). This is done with
  422. the following pair of macro definitions:
  423. </p>
  424. <div class="smallexample">
  425. <pre class="smallexample">#define obstack_chunk_alloc xmalloc
  426. #define obstack_chunk_free free
  427. </pre></div>
  428. <p>Though the memory you get using obstacks really comes from <code>malloc</code>,
  429. using obstacks is faster because <code>malloc</code> is called less often, for
  430. larger blocks of memory. See <a href="#Obstack-Chunks">Obstack Chunks</a>, for full details.
  431. </p>
  432. <p>At run time, before the program can use a <code>struct obstack</code> object
  433. as an obstack, it must initialize the obstack by calling
  434. <code>obstack_init</code> or one of its variants, <code>obstack_begin</code>,
  435. <code>obstack_specify_allocation</code>, or
  436. <code>obstack_specify_allocation_with_arg</code>.
  437. </p>
  438. <dl>
  439. <dt><a name="index-obstack_005finit"></a>Function: <em>int</em> <strong>obstack_init</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  440. <dd><p>Initialize obstack <var>obstack-ptr</var> for allocation of objects. This
  441. macro calls the obstack&rsquo;s <code>obstack_chunk_alloc</code> function. If
  442. allocation of memory fails, the function pointed to by
  443. <code>obstack_alloc_failed_handler</code> is called. The <code>obstack_init</code>
  444. macro always returns 1 (Compatibility notice: Former versions of
  445. obstack returned 0 if allocation failed).
  446. </p></dd></dl>
  447. <p>Here are two examples of how to allocate the space for an obstack and
  448. initialize it. First, an obstack that is a static variable:
  449. </p>
  450. <div class="smallexample">
  451. <pre class="smallexample">static struct obstack myobstack;
  452. &hellip;
  453. obstack_init (&amp;myobstack);
  454. </pre></div>
  455. <p>Second, an obstack that is itself dynamically allocated:
  456. </p>
  457. <div class="smallexample">
  458. <pre class="smallexample">struct obstack *myobstack_ptr
  459. = (struct obstack *) xmalloc (sizeof (struct obstack));
  460. obstack_init (myobstack_ptr);
  461. </pre></div>
  462. <dl>
  463. <dt><a name="index-obstack_005fbegin"></a>Function: <em>int</em> <strong>obstack_begin</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t chunk_size)</em></dt>
  464. <dd><p>Like <code>obstack_init</code>, but specify chunks to be at least
  465. <var>chunk_size</var> bytes in size.
  466. </p></dd></dl>
  467. <dl>
  468. <dt><a name="index-obstack_005fspecify_005fallocation"></a>Function: <em>int</em> <strong>obstack_specify_allocation</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t chunk_size, size_t alignment, void *(*chunkfun) (size_t), void (*freefun) (void *))</em></dt>
  469. <dd><p>Like <code>obstack_init</code>, specifying chunk size, chunk
  470. alignment, and memory allocation functions. A <var>chunk_size</var> or
  471. <var>alignment</var> of zero results in the default size or alignment
  472. respectively being used.
  473. </p></dd></dl>
  474. <dl>
  475. <dt><a name="index-obstack_005fspecify_005fallocation_005fwith_005farg"></a>Function: <em>int</em> <strong>obstack_specify_allocation_with_arg</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t chunk_size, size_t alignment, void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg)</em></dt>
  476. <dd><p>Like <code>obstack_specify_allocation</code>, but specifying memory
  477. allocation functions that take an extra first argument, <var>arg</var>.
  478. </p></dd></dl>
  479. <dl>
  480. <dt><a name="index-obstack_005falloc_005ffailed_005fhandler"></a>Variable: <strong>obstack_alloc_failed_handler</strong></dt>
  481. <dd><p>The value of this variable is a pointer to a function that
  482. <code>obstack</code> uses when <code>obstack_chunk_alloc</code> fails to allocate
  483. memory. The default action is to print a message and abort.
  484. You should supply a function that either calls <code>exit</code>
  485. (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Program-Termination">Program Termination</a> in <cite>The GNU C Library Reference Manual</cite>) or <code>longjmp</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Non_002dLocal-Exits">Non-Local
  486. Exits</a> in <cite>The GNU C Library Reference Manual</cite>) and doesn&rsquo;t return.
  487. </p>
  488. <div class="smallexample">
  489. <pre class="smallexample">void my_obstack_alloc_failed (void)
  490. &hellip;
  491. obstack_alloc_failed_handler = &amp;my_obstack_alloc_failed;
  492. </pre></div>
  493. </dd></dl>
  494. <hr>
  495. <a name="Allocation-in-an-Obstack"></a>
  496. <div class="header">
  497. <p>
  498. Next: <a href="#Freeing-Obstack-Objects" accesskey="n" rel="next">Freeing Obstack Objects</a>, Previous: <a href="#Preparing-for-Obstacks" accesskey="p" rel="prev">Preparing for Obstacks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  499. </div>
  500. <a name="Allocation-in-an-Obstack-1"></a>
  501. <h4 class="subsubsection">2.3.1.3 Allocation in an Obstack</h4>
  502. <a name="index-allocation-_0028obstacks_0029"></a>
  503. <p>The most direct way to allocate an object in an obstack is with
  504. <code>obstack_alloc</code>, which is invoked almost like <code>malloc</code>.
  505. </p>
  506. <dl>
  507. <dt><a name="index-obstack_005falloc"></a>Function: <em>void *</em> <strong>obstack_alloc</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</em></dt>
  508. <dd><p>This allocates an uninitialized block of <var>size</var> bytes in an obstack
  509. and returns its address. Here <var>obstack-ptr</var> specifies which obstack
  510. to allocate the block in; it is the address of the <code>struct obstack</code>
  511. object which represents the obstack. Each obstack macro
  512. requires you to specify an <var>obstack-ptr</var> as the first argument.
  513. </p>
  514. <p>This macro calls the obstack&rsquo;s <code>obstack_chunk_alloc</code> function if
  515. it needs to allocate a new chunk of memory; it calls
  516. <code>obstack_alloc_failed_handler</code> if allocation of memory by
  517. <code>obstack_chunk_alloc</code> failed.
  518. </p></dd></dl>
  519. <p>For example, here is a function that allocates a copy of a string <var>str</var>
  520. in a specific obstack, which is in the variable <code>string_obstack</code>:
  521. </p>
  522. <div class="smallexample">
  523. <pre class="smallexample">struct obstack string_obstack;
  524. char *
  525. copystring (char *string)
  526. {
  527. size_t len = strlen (string) + 1;
  528. char *s = (char *) obstack_alloc (&amp;string_obstack, len);
  529. memcpy (s, string, len);
  530. return s;
  531. }
  532. </pre></div>
  533. <p>To allocate a block with specified contents, use the macro <code>obstack_copy</code>.
  534. </p>
  535. <dl>
  536. <dt><a name="index-obstack_005fcopy"></a>Function: <em>void *</em> <strong>obstack_copy</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</em></dt>
  537. <dd><p>This allocates a block and initializes it by copying <var>size</var>
  538. bytes of data starting at <var>address</var>. It calls
  539. <code>obstack_alloc_failed_handler</code> if allocation of memory by
  540. <code>obstack_chunk_alloc</code> failed.
  541. </p></dd></dl>
  542. <dl>
  543. <dt><a name="index-obstack_005fcopy0"></a>Function: <em>void *</em> <strong>obstack_copy0</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</em></dt>
  544. <dd><p>Like <code>obstack_copy</code>, but appends an extra byte containing a null
  545. character. This extra byte is not counted in the argument <var>size</var>.
  546. </p></dd></dl>
  547. <p>The <code>obstack_copy0</code> macro is convenient for copying a sequence
  548. of characters into an obstack as a null-terminated string. Here is an
  549. example of its use:
  550. </p>
  551. <div class="smallexample">
  552. <pre class="smallexample">char *
  553. obstack_savestring (char *addr, size_t size)
  554. {
  555. return obstack_copy0 (&amp;myobstack, addr, size);
  556. }
  557. </pre></div>
  558. <p>Contrast this with the previous example of <code>savestring</code> using
  559. <code>malloc</code> (see <a href="http://www.gnu.org/software/libc/manual/html_mono/libc.html#Basic-Allocation">Basic Allocation</a> in <cite>The GNU C Library Reference Manual</cite>).
  560. </p>
  561. <hr>
  562. <a name="Freeing-Obstack-Objects"></a>
  563. <div class="header">
  564. <p>
  565. Next: <a href="#Obstack-Functions" accesskey="n" rel="next">Obstack Functions</a>, Previous: <a href="#Allocation-in-an-Obstack" accesskey="p" rel="prev">Allocation in an Obstack</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  566. </div>
  567. <a name="Freeing-Objects-in-an-Obstack"></a>
  568. <h4 class="subsubsection">2.3.1.4 Freeing Objects in an Obstack</h4>
  569. <a name="index-freeing-_0028obstacks_0029"></a>
  570. <p>To free an object allocated in an obstack, use the macro
  571. <code>obstack_free</code>. Since the obstack is a stack of objects, freeing
  572. one object automatically frees all other objects allocated more recently
  573. in the same obstack.
  574. </p>
  575. <dl>
  576. <dt><a name="index-obstack_005ffree"></a>Function: <em>void</em> <strong>obstack_free</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>object</var>)</em></dt>
  577. <dd><p>If <var>object</var> is a null pointer, everything allocated in the obstack
  578. is freed. Otherwise, <var>object</var> must be the address of an object
  579. allocated in the obstack. Then <var>object</var> is freed, along with
  580. everything allocated in <var>obstack</var> since <var>object</var>.
  581. </p></dd></dl>
  582. <p>Note that if <var>object</var> is a null pointer, the result is an
  583. uninitialized obstack. To free all memory in an obstack but leave it
  584. valid for further allocation, call <code>obstack_free</code> with the address
  585. of the first object allocated on the obstack:
  586. </p>
  587. <div class="smallexample">
  588. <pre class="smallexample">obstack_free (obstack_ptr, first_object_allocated_ptr);
  589. </pre></div>
  590. <p>Recall that the objects in an obstack are grouped into chunks. When all
  591. the objects in a chunk become free, the obstack library automatically
  592. frees the chunk (see <a href="#Preparing-for-Obstacks">Preparing for Obstacks</a>). Then other
  593. obstacks, or non-obstack allocation, can reuse the space of the chunk.
  594. </p>
  595. <hr>
  596. <a name="Obstack-Functions"></a>
  597. <div class="header">
  598. <p>
  599. Next: <a href="#Growing-Objects" accesskey="n" rel="next">Growing Objects</a>, Previous: <a href="#Freeing-Obstack-Objects" accesskey="p" rel="prev">Freeing Obstack Objects</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  600. </div>
  601. <a name="Obstack-Functions-and-Macros"></a>
  602. <h4 class="subsubsection">2.3.1.5 Obstack Functions and Macros</h4>
  603. <a name="index-macros"></a>
  604. <p>The interfaces for using obstacks are shown here as functions to
  605. specify the return type and argument types, but they are really
  606. defined as macros. This means that the arguments don&rsquo;t actually have
  607. types, but they generally behave as if they have the types shown.
  608. You can call these macros like functions, but you cannot use them in
  609. any other way (for example, you cannot take their address).
  610. </p>
  611. <p>Calling the macros requires a special precaution: namely, the first
  612. operand (the obstack pointer) may not contain any side effects, because
  613. it may be computed more than once. For example, if you write this:
  614. </p>
  615. <div class="smallexample">
  616. <pre class="smallexample">obstack_alloc (get_obstack (), 4);
  617. </pre></div>
  618. <p>you will find that <code>get_obstack</code> may be called several times.
  619. If you use <code>*obstack_list_ptr++</code> as the obstack pointer argument,
  620. you will get very strange results since the incrementation may occur
  621. several times.
  622. </p>
  623. <p>If you use the GNU C compiler, this precaution is not necessary, because
  624. various language extensions in GNU C permit defining the macros so as to
  625. compute each argument only once.
  626. </p>
  627. <p>Note that arguments other than the first will only be evaluated once,
  628. even when not using GNU C.
  629. </p>
  630. <p><code>obstack.h</code> does declare a number of functions,
  631. <code>_obstack_begin</code>, <code>_obstack_begin_1</code>,
  632. <code>_obstack_newchunk</code>, <code>_obstack_free</code>, and
  633. <code>_obstack_memory_used</code>. You should not call these directly.
  634. </p>
  635. <hr>
  636. <a name="Growing-Objects"></a>
  637. <div class="header">
  638. <p>
  639. Next: <a href="#Extra-Fast-Growing" accesskey="n" rel="next">Extra Fast Growing</a>, Previous: <a href="#Obstack-Functions" accesskey="p" rel="prev">Obstack Functions</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  640. </div>
  641. <a name="Growing-Objects-1"></a>
  642. <h4 class="subsubsection">2.3.1.6 Growing Objects</h4>
  643. <a name="index-growing-objects-_0028in-obstacks_0029"></a>
  644. <a name="index-changing-the-size-of-a-block-_0028obstacks_0029"></a>
  645. <p>Because memory in obstack chunks is used sequentially, it is possible to
  646. build up an object step by step, adding one or more bytes at a time to the
  647. end of the object. With this technique, you do not need to know how much
  648. data you will put in the object until you come to the end of it. We call
  649. this the technique of <em>growing objects</em>. The special macros
  650. for adding data to the growing object are described in this section.
  651. </p>
  652. <p>You don&rsquo;t need to do anything special when you start to grow an object.
  653. Using one of the macros to add data to the object automatically
  654. starts it. However, it is necessary to say explicitly when the object is
  655. finished. This is done with <code>obstack_finish</code>.
  656. </p>
  657. <p>The actual address of the object thus built up is not known until the
  658. object is finished. Until then, it always remains possible that you will
  659. add so much data that the object must be copied into a new chunk.
  660. </p>
  661. <p>While the obstack is in use for a growing object, you cannot use it for
  662. ordinary allocation of another object. If you try to do so, the space
  663. already added to the growing object will become part of the other object.
  664. </p>
  665. <dl>
  666. <dt><a name="index-obstack_005fblank"></a>Function: <em>void</em> <strong>obstack_blank</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</em></dt>
  667. <dd><p>The most basic macro for adding to a growing object is
  668. <code>obstack_blank</code>, which adds space without initializing it.
  669. </p></dd></dl>
  670. <dl>
  671. <dt><a name="index-obstack_005fgrow"></a>Function: <em>void</em> <strong>obstack_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>, size_t <var>size</var>)</em></dt>
  672. <dd><p>To add a block of initialized space, use <code>obstack_grow</code>, which is
  673. the growing-object analogue of <code>obstack_copy</code>. It adds <var>size</var>
  674. bytes of data to the growing object, copying the contents from
  675. <var>data</var>.
  676. </p></dd></dl>
  677. <dl>
  678. <dt><a name="index-obstack_005fgrow0"></a>Function: <em>void</em> <strong>obstack_grow0</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>, size_t <var>size</var>)</em></dt>
  679. <dd><p>This is the growing-object analogue of <code>obstack_copy0</code>. It adds
  680. <var>size</var> bytes copied from <var>data</var>, followed by an additional null
  681. character.
  682. </p></dd></dl>
  683. <dl>
  684. <dt><a name="index-obstack_005f1grow"></a>Function: <em>void</em> <strong>obstack_1grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, char <var>c</var>)</em></dt>
  685. <dd><p>To add one character at a time, use <code>obstack_1grow</code>.
  686. It adds a single byte containing <var>c</var> to the growing object.
  687. </p></dd></dl>
  688. <dl>
  689. <dt><a name="index-obstack_005fptr_005fgrow"></a>Function: <em>void</em> <strong>obstack_ptr_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>)</em></dt>
  690. <dd><p>Adding the value of a pointer one can use
  691. <code>obstack_ptr_grow</code>. It adds <code>sizeof (void *)</code> bytes
  692. containing the value of <var>data</var>.
  693. </p></dd></dl>
  694. <dl>
  695. <dt><a name="index-obstack_005fint_005fgrow"></a>Function: <em>void</em> <strong>obstack_int_grow</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>data</var>)</em></dt>
  696. <dd><p>A single value of type <code>int</code> can be added by using
  697. <code>obstack_int_grow</code>. It adds <code>sizeof (int)</code> bytes to
  698. the growing object and initializes them with the value of <var>data</var>.
  699. </p></dd></dl>
  700. <dl>
  701. <dt><a name="index-obstack_005ffinish"></a>Function: <em>void *</em> <strong>obstack_finish</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  702. <dd><p>When you are finished growing the object, use
  703. <code>obstack_finish</code> to close it off and return its final address.
  704. </p>
  705. <p>Once you have finished the object, the obstack is available for ordinary
  706. allocation or for growing another object.
  707. </p></dd></dl>
  708. <p>When you build an object by growing it, you will probably need to know
  709. afterward how long it became. You need not keep track of this as you grow
  710. the object, because you can find out the length from the obstack
  711. with <code>obstack_object_size</code>, before finishing the object.
  712. </p>
  713. <dl>
  714. <dt><a name="index-obstack_005fobject_005fsize"></a>Function: <em>size_t</em> <strong>obstack_object_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  715. <dd><p>This macro returns the current size of the growing object, in bytes.
  716. Remember to call <code>obstack_object_size</code> <em>before</em> finishing the object.
  717. After it is finished, <code>obstack_object_size</code> will return zero.
  718. </p></dd></dl>
  719. <p>If you have started growing an object and wish to cancel it, you should
  720. finish it and then free it, like this:
  721. </p>
  722. <div class="smallexample">
  723. <pre class="smallexample">obstack_free (obstack_ptr, obstack_finish (obstack_ptr));
  724. </pre></div>
  725. <p>This has no effect if no object was growing.
  726. </p>
  727. <hr>
  728. <a name="Extra-Fast-Growing"></a>
  729. <div class="header">
  730. <p>
  731. Next: <a href="#Status-of-an-Obstack" accesskey="n" rel="next">Status of an Obstack</a>, Previous: <a href="#Growing-Objects" accesskey="p" rel="prev">Growing Objects</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  732. </div>
  733. <a name="Extra-Fast-Growing-Objects"></a>
  734. <h4 class="subsubsection">2.3.1.7 Extra Fast Growing Objects</h4>
  735. <a name="index-efficiency-and-obstacks"></a>
  736. <p>The usual macros for growing objects incur overhead for checking
  737. whether there is room for the new growth in the current chunk. If you
  738. are frequently constructing objects in small steps of growth, this
  739. overhead can be significant.
  740. </p>
  741. <p>You can reduce the overhead by using special &ldquo;fast growth&rdquo;
  742. macros that grow the object without checking. In order to have a
  743. robust program, you must do the checking yourself. If you do this checking
  744. in the simplest way each time you are about to add data to the object, you
  745. have not saved anything, because that is what the ordinary growth
  746. macros do. But if you can arrange to check less often, or check
  747. more efficiently, then you make the program faster.
  748. </p>
  749. <p><code>obstack_room</code> returns the amount of room available
  750. in the current chunk.
  751. </p>
  752. <dl>
  753. <dt><a name="index-obstack_005froom"></a>Function: <em>size_t</em> <strong>obstack_room</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  754. <dd><p>This returns the number of bytes that can be added safely to the current
  755. growing object (or to an object about to be started) in obstack
  756. <var>obstack</var> using the fast growth macros.
  757. </p></dd></dl>
  758. <p>While you know there is room, you can use these fast growth macros
  759. for adding data to a growing object:
  760. </p>
  761. <dl>
  762. <dt><a name="index-obstack_005f1grow_005ffast"></a>Function: <em>void</em> <strong>obstack_1grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, char <var>c</var>)</em></dt>
  763. <dd><p><code>obstack_1grow_fast</code> adds one byte containing the
  764. character <var>c</var> to the growing object in obstack <var>obstack-ptr</var>.
  765. </p></dd></dl>
  766. <dl>
  767. <dt><a name="index-obstack_005fptr_005fgrow_005ffast"></a>Function: <em>void</em> <strong>obstack_ptr_grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, void *<var>data</var>)</em></dt>
  768. <dd><p><code>obstack_ptr_grow_fast</code> adds <code>sizeof (void *)</code>
  769. bytes containing the value of <var>data</var> to the growing object in
  770. obstack <var>obstack-ptr</var>.
  771. </p></dd></dl>
  772. <dl>
  773. <dt><a name="index-obstack_005fint_005fgrow_005ffast"></a>Function: <em>void</em> <strong>obstack_int_grow_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, int <var>data</var>)</em></dt>
  774. <dd><p><code>obstack_int_grow_fast</code> adds <code>sizeof (int)</code> bytes
  775. containing the value of <var>data</var> to the growing object in obstack
  776. <var>obstack-ptr</var>.
  777. </p></dd></dl>
  778. <dl>
  779. <dt><a name="index-obstack_005fblank_005ffast"></a>Function: <em>void</em> <strong>obstack_blank_fast</strong> <em>(struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</em></dt>
  780. <dd><p><code>obstack_blank_fast</code> adds <var>size</var> bytes to the
  781. growing object in obstack <var>obstack-ptr</var> without initializing them.
  782. </p></dd></dl>
  783. <p>When you check for space using <code>obstack_room</code> and there is not
  784. enough room for what you want to add, the fast growth macros
  785. are not safe. In this case, simply use the corresponding ordinary
  786. growth macro instead. Very soon this will copy the object to a
  787. new chunk; then there will be lots of room available again.
  788. </p>
  789. <p>So, each time you use an ordinary growth macro, check afterward for
  790. sufficient space using <code>obstack_room</code>. Once the object is copied
  791. to a new chunk, there will be plenty of space again, so the program will
  792. start using the fast growth macros again.
  793. </p>
  794. <p>Here is an example:
  795. </p>
  796. <div class="smallexample">
  797. <pre class="smallexample">void
  798. add_string (struct obstack *obstack, const char *ptr, size_t len)
  799. {
  800. while (len &gt; 0)
  801. {
  802. size_t room = obstack_room (obstack);
  803. if (room == 0)
  804. {
  805. /* <span class="roman">Not enough room. Add one character slowly,</span>
  806. <span class="roman">which may copy to a new chunk and make room.</span> */
  807. obstack_1grow (obstack, *ptr++);
  808. len--;
  809. }
  810. else
  811. {
  812. if (room &gt; len)
  813. room = len;
  814. /* <span class="roman">Add fast as much as we have room for.</span> */
  815. len -= room;
  816. while (room-- &gt; 0)
  817. obstack_1grow_fast (obstack, *ptr++);
  818. }
  819. }
  820. }
  821. </pre></div>
  822. <a name="index-shrinking-objects"></a>
  823. <p>You can use <code>obstack_blank_fast</code> with a &ldquo;negative&rdquo; size
  824. argument to make the current object smaller. Just don&rsquo;t try to shrink
  825. it beyond zero length&mdash;there&rsquo;s no telling what will happen if you do
  826. that. Earlier versions of obstacks allowed you to use
  827. <code>obstack_blank</code> to shrink objects. This will no longer work.
  828. </p>
  829. <hr>
  830. <a name="Status-of-an-Obstack"></a>
  831. <div class="header">
  832. <p>
  833. Next: <a href="#Obstacks-Data-Alignment" accesskey="n" rel="next">Obstacks Data Alignment</a>, Previous: <a href="#Extra-Fast-Growing" accesskey="p" rel="prev">Extra Fast Growing</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  834. </div>
  835. <a name="Status-of-an-Obstack-1"></a>
  836. <h4 class="subsubsection">2.3.1.8 Status of an Obstack</h4>
  837. <a name="index-obstack-status"></a>
  838. <a name="index-status-of-obstack"></a>
  839. <p>Here are macros that provide information on the current status of
  840. allocation in an obstack. You can use them to learn about an object while
  841. still growing it.
  842. </p>
  843. <dl>
  844. <dt><a name="index-obstack_005fbase"></a>Function: <em>void *</em> <strong>obstack_base</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  845. <dd><p>This macro returns the tentative address of the beginning of the
  846. currently growing object in <var>obstack-ptr</var>. If you finish the object
  847. immediately, it will have that address. If you make it larger first, it
  848. may outgrow the current chunk&mdash;then its address will change!
  849. </p>
  850. <p>If no object is growing, this value says where the next object you
  851. allocate will start (once again assuming it fits in the current
  852. chunk).
  853. </p></dd></dl>
  854. <dl>
  855. <dt><a name="index-obstack_005fnext_005ffree"></a>Function: <em>void *</em> <strong>obstack_next_free</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  856. <dd><p>This macro returns the address of the first free byte in the current
  857. chunk of obstack <var>obstack-ptr</var>. This is the end of the currently
  858. growing object. If no object is growing, <code>obstack_next_free</code>
  859. returns the same value as <code>obstack_base</code>.
  860. </p></dd></dl>
  861. <dl>
  862. <dt><a name="index-obstack_005fobject_005fsize-1"></a>Function: <em>size_t</em> <strong>obstack_object_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  863. <dd><p>This macro returns the size in bytes of the currently growing object.
  864. This is equivalent to
  865. </p>
  866. <div class="smallexample">
  867. <pre class="smallexample">((size_t) (obstack_next_free (<var>obstack-ptr</var>) - obstack_base (<var>obstack-ptr</var>)))
  868. </pre></div>
  869. </dd></dl>
  870. <hr>
  871. <a name="Obstacks-Data-Alignment"></a>
  872. <div class="header">
  873. <p>
  874. Next: <a href="#Obstack-Chunks" accesskey="n" rel="next">Obstack Chunks</a>, Previous: <a href="#Status-of-an-Obstack" accesskey="p" rel="prev">Status of an Obstack</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  875. </div>
  876. <a name="Alignment-of-Data-in-Obstacks"></a>
  877. <h4 class="subsubsection">2.3.1.9 Alignment of Data in Obstacks</h4>
  878. <a name="index-alignment-_0028in-obstacks_0029"></a>
  879. <p>Each obstack has an <em>alignment boundary</em>; each object allocated in
  880. the obstack automatically starts on an address that is a multiple of the
  881. specified boundary. By default, this boundary is aligned so that
  882. the object can hold any type of data.
  883. </p>
  884. <p>To access an obstack&rsquo;s alignment boundary, use the macro
  885. <code>obstack_alignment_mask</code>.
  886. </p>
  887. <dl>
  888. <dt><a name="index-obstack_005falignment_005fmask"></a>Macro: <em>size_t</em> <strong>obstack_alignment_mask</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  889. <dd><p>The value is a bit mask; a bit that is 1 indicates that the corresponding
  890. bit in the address of an object should be 0. The mask value should be one
  891. less than a power of 2; the effect is that all object addresses are
  892. multiples of that power of 2. The default value of the mask is a value
  893. that allows aligned objects to hold any type of data: for example, if
  894. its value is 3, any type of data can be stored at locations whose
  895. addresses are multiples of 4. A mask value of 0 means an object can start
  896. on any multiple of 1 (that is, no alignment is required).
  897. </p>
  898. <p>The expansion of the macro <code>obstack_alignment_mask</code> is an lvalue,
  899. so you can alter the mask by assignment. For example, this statement:
  900. </p>
  901. <div class="smallexample">
  902. <pre class="smallexample">obstack_alignment_mask (obstack_ptr) = 0;
  903. </pre></div>
  904. <p>has the effect of turning off alignment processing in the specified obstack.
  905. </p></dd></dl>
  906. <p>Note that a change in alignment mask does not take effect until
  907. <em>after</em> the next time an object is allocated or finished in the
  908. obstack. If you are not growing an object, you can make the new
  909. alignment mask take effect immediately by calling <code>obstack_finish</code>.
  910. This will finish a zero-length object and then do proper alignment for
  911. the next object.
  912. </p>
  913. <hr>
  914. <a name="Obstack-Chunks"></a>
  915. <div class="header">
  916. <p>
  917. Next: <a href="#Summary-of-Obstacks" accesskey="n" rel="next">Summary of Obstacks</a>, Previous: <a href="#Obstacks-Data-Alignment" accesskey="p" rel="prev">Obstacks Data Alignment</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  918. </div>
  919. <a name="Obstack-Chunks-1"></a>
  920. <h4 class="subsubsection">2.3.1.10 Obstack Chunks</h4>
  921. <a name="index-efficiency-of-chunks"></a>
  922. <a name="index-chunks"></a>
  923. <p>Obstacks work by allocating space for themselves in large chunks, and
  924. then parceling out space in the chunks to satisfy your requests. Chunks
  925. are normally 4096 bytes long unless you specify a different chunk size.
  926. The chunk size includes 8 bytes of overhead that are not actually used
  927. for storing objects. Regardless of the specified size, longer chunks
  928. will be allocated when necessary for long objects.
  929. </p>
  930. <p>The obstack library allocates chunks by calling the function
  931. <code>obstack_chunk_alloc</code>, which you must define. When a chunk is no
  932. longer needed because you have freed all the objects in it, the obstack
  933. library frees the chunk by calling <code>obstack_chunk_free</code>, which you
  934. must also define.
  935. </p>
  936. <p>These two must be defined (as macros) or declared (as functions) in each
  937. source file that uses <code>obstack_init</code> (see <a href="#Creating-Obstacks">Creating Obstacks</a>).
  938. Most often they are defined as macros like this:
  939. </p>
  940. <div class="smallexample">
  941. <pre class="smallexample">#define obstack_chunk_alloc malloc
  942. #define obstack_chunk_free free
  943. </pre></div>
  944. <p>Note that these are simple macros (no arguments). Macro definitions with
  945. arguments will not work! It is necessary that <code>obstack_chunk_alloc</code>
  946. or <code>obstack_chunk_free</code>, alone, expand into a function name if it is
  947. not itself a function name.
  948. </p>
  949. <p>If you allocate chunks with <code>malloc</code>, the chunk size should be a
  950. power of 2. The default chunk size, 4096, was chosen because it is long
  951. enough to satisfy many typical requests on the obstack yet short enough
  952. not to waste too much memory in the portion of the last chunk not yet used.
  953. </p>
  954. <dl>
  955. <dt><a name="index-obstack_005fchunk_005fsize"></a>Macro: <em>size_t</em> <strong>obstack_chunk_size</strong> <em>(struct obstack *<var>obstack-ptr</var>)</em></dt>
  956. <dd><p>This returns the chunk size of the given obstack.
  957. </p></dd></dl>
  958. <p>Since this macro expands to an lvalue, you can specify a new chunk size by
  959. assigning it a new value. Doing so does not affect the chunks already
  960. allocated, but will change the size of chunks allocated for that particular
  961. obstack in the future. It is unlikely to be useful to make the chunk size
  962. smaller, but making it larger might improve efficiency if you are
  963. allocating many objects whose size is comparable to the chunk size. Here
  964. is how to do so cleanly:
  965. </p>
  966. <div class="smallexample">
  967. <pre class="smallexample">if (obstack_chunk_size (obstack_ptr) &lt; <var>new-chunk-size</var>)
  968. obstack_chunk_size (obstack_ptr) = <var>new-chunk-size</var>;
  969. </pre></div>
  970. <hr>
  971. <a name="Summary-of-Obstacks"></a>
  972. <div class="header">
  973. <p>
  974. Previous: <a href="#Obstack-Chunks" accesskey="p" rel="prev">Obstack Chunks</a>, Up: <a href="#Obstacks" accesskey="u" rel="up">Obstacks</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  975. </div>
  976. <a name="Summary-of-Obstack-Macros"></a>
  977. <h4 class="subsubsection">2.3.1.11 Summary of Obstack Macros</h4>
  978. <p>Here is a summary of all the macros associated with obstacks. Each
  979. takes the address of an obstack (<code>struct obstack *</code>) as its first
  980. argument.
  981. </p>
  982. <dl compact="compact">
  983. <dt><code>int obstack_init (struct obstack *<var>obstack-ptr</var>)</code></dt>
  984. <dd><p>Initialize use of an obstack. See <a href="#Creating-Obstacks">Creating Obstacks</a>.
  985. </p>
  986. </dd>
  987. <dt><code>int obstack_begin (struct obstack *<var>obstack-ptr</var>, size_t chunk_size)</code></dt>
  988. <dd><p>Initialize use of an obstack, with an initial chunk of
  989. <var>chunk_size</var> bytes.
  990. </p>
  991. </dd>
  992. <dt><code>int obstack_specify_allocation (struct obstack *<var>obstack-ptr</var>, size_t chunk_size, size_t alignment, void *(*chunkfun) (size_t), void (*freefun) (void *))</code></dt>
  993. <dd><p>Initialize use of an obstack, specifying intial chunk size, chunk
  994. alignment, and memory allocation functions.
  995. </p>
  996. </dd>
  997. <dt><code>int obstack_specify_allocation_with_arg (struct obstack *<var>obstack-ptr</var>, size_t chunk_size, size_t alignment, void *(*chunkfun) (void *, size_t), void (*freefun) (void *, void *), void *arg)</code></dt>
  998. <dd><p>Like <code>obstack_specify_allocation</code>, but specifying memory
  999. allocation functions that take an extra first argument, <var>arg</var>.
  1000. </p>
  1001. </dd>
  1002. <dt><code>void *obstack_alloc (struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</code></dt>
  1003. <dd><p>Allocate an object of <var>size</var> uninitialized bytes.
  1004. See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
  1005. </p>
  1006. </dd>
  1007. <dt><code>void *obstack_copy (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</code></dt>
  1008. <dd><p>Allocate an object of <var>size</var> bytes, with contents copied from
  1009. <var>address</var>. See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
  1010. </p>
  1011. </dd>
  1012. <dt><code>void *obstack_copy0 (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</code></dt>
  1013. <dd><p>Allocate an object of <var>size</var>+1 bytes, with <var>size</var> of them copied
  1014. from <var>address</var>, followed by a null character at the end.
  1015. See <a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a>.
  1016. </p>
  1017. </dd>
  1018. <dt><code>void obstack_free (struct obstack *<var>obstack-ptr</var>, void *<var>object</var>)</code></dt>
  1019. <dd><p>Free <var>object</var> (and everything allocated in the specified obstack
  1020. more recently than <var>object</var>). See <a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a>.
  1021. </p>
  1022. </dd>
  1023. <dt><code>void obstack_blank (struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</code></dt>
  1024. <dd><p>Add <var>size</var> uninitialized bytes to a growing object.
  1025. See <a href="#Growing-Objects">Growing Objects</a>.
  1026. </p>
  1027. </dd>
  1028. <dt><code>void obstack_grow (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</code></dt>
  1029. <dd><p>Add <var>size</var> bytes, copied from <var>address</var>, to a growing object.
  1030. See <a href="#Growing-Objects">Growing Objects</a>.
  1031. </p>
  1032. </dd>
  1033. <dt><code>void obstack_grow0 (struct obstack *<var>obstack-ptr</var>, void *<var>address</var>, size_t <var>size</var>)</code></dt>
  1034. <dd><p>Add <var>size</var> bytes, copied from <var>address</var>, to a growing object,
  1035. and then add another byte containing a null character. See <a href="#Growing-Objects">Growing Objects</a>.
  1036. </p>
  1037. </dd>
  1038. <dt><code>void obstack_1grow (struct obstack *<var>obstack-ptr</var>, char <var>data-char</var>)</code></dt>
  1039. <dd><p>Add one byte containing <var>data-char</var> to a growing object.
  1040. See <a href="#Growing-Objects">Growing Objects</a>.
  1041. </p>
  1042. </dd>
  1043. <dt><code>void *obstack_finish (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1044. <dd><p>Finalize the object that is growing and return its permanent address.
  1045. See <a href="#Growing-Objects">Growing Objects</a>.
  1046. </p>
  1047. </dd>
  1048. <dt><code>size_t obstack_object_size (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1049. <dd><p>Get the current size of the currently growing object. See <a href="#Growing-Objects">Growing Objects</a>.
  1050. </p>
  1051. </dd>
  1052. <dt><code>void obstack_blank_fast (struct obstack *<var>obstack-ptr</var>, size_t <var>size</var>)</code></dt>
  1053. <dd><p>Add <var>size</var> uninitialized bytes to a growing object without checking
  1054. that there is enough room. See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
  1055. </p>
  1056. </dd>
  1057. <dt><code>void obstack_1grow_fast (struct obstack *<var>obstack-ptr</var>, char <var>data-char</var>)</code></dt>
  1058. <dd><p>Add one byte containing <var>data-char</var> to a growing object without
  1059. checking that there is enough room. See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
  1060. </p>
  1061. </dd>
  1062. <dt><code>size_t obstack_room (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1063. <dd><p>Get the amount of room now available for growing the current object.
  1064. See <a href="#Extra-Fast-Growing">Extra Fast Growing</a>.
  1065. </p>
  1066. </dd>
  1067. <dt><code>size_t obstack_alignment_mask (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1068. <dd><p>The mask used for aligning the beginning of an object. This is an
  1069. lvalue. See <a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a>.
  1070. </p>
  1071. </dd>
  1072. <dt><code>size_t obstack_chunk_size (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1073. <dd><p>The size for allocating chunks. This is an lvalue. See <a href="#Obstack-Chunks">Obstack Chunks</a>.
  1074. </p>
  1075. </dd>
  1076. <dt><code>void *obstack_base (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1077. <dd><p>Tentative starting address of the currently growing object.
  1078. See <a href="#Status-of-an-Obstack">Status of an Obstack</a>.
  1079. </p>
  1080. </dd>
  1081. <dt><code>void *obstack_next_free (struct obstack *<var>obstack-ptr</var>)</code></dt>
  1082. <dd><p>Address just after the end of the currently growing object.
  1083. See <a href="#Status-of-an-Obstack">Status of an Obstack</a>.
  1084. </p></dd>
  1085. </dl>
  1086. <hr>
  1087. <a name="Functions"></a>
  1088. <div class="header">
  1089. <p>
  1090. Next: <a href="#Licenses" accesskey="n" rel="next">Licenses</a>, Previous: <a href="#Overview" accesskey="p" rel="prev">Overview</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  1091. </div>
  1092. <a name="Function_002c-Variable_002c-and-Macro-Listing_002e"></a>
  1093. <h2 class="chapter">3 Function, Variable, and Macro Listing.</h2>
  1094. <dl>
  1095. <dt><a name="index-alloca"></a>Replacement: <em>void*</em> <strong>alloca</strong> <em>(size_t <var>size</var>)</em></dt>
  1096. <dd>
  1097. <p>This function allocates memory which will be automatically reclaimed
  1098. after the procedure exits. The <code>libiberty</code> implementation does not free
  1099. the memory immediately but will do so eventually during subsequent
  1100. calls to this function. Memory is allocated using <code>xmalloc</code> under
  1101. normal circumstances.
  1102. </p>
  1103. <p>The header file <samp>alloca-conf.h</samp> can be used in conjunction with the
  1104. GNU Autoconf test <code>AC_FUNC_ALLOCA</code> to test for and properly make
  1105. available this function. The <code>AC_FUNC_ALLOCA</code> test requires that
  1106. client code use a block of preprocessor code to be safe (see the Autoconf
  1107. manual for more); this header incorporates that logic and more, including
  1108. the possibility of a GCC built-in function.
  1109. </p>
  1110. </dd></dl>
  1111. <dl>
  1112. <dt><a name="index-asprintf"></a>Extension: <em>int</em> <strong>asprintf</strong> <em>(char **<var>resptr</var>, const char *<var>format</var>, ...)</em></dt>
  1113. <dd>
  1114. <p>Like <code>sprintf</code>, but instead of passing a pointer to a buffer, you
  1115. pass a pointer to a pointer. This function will compute the size of
  1116. the buffer needed, allocate memory with <code>malloc</code>, and store a
  1117. pointer to the allocated memory in <code>*<var>resptr</var></code>. The value
  1118. returned is the same as <code>sprintf</code> would return. If memory could
  1119. not be allocated, minus one is returned and <code>NULL</code> is stored in
  1120. <code>*<var>resptr</var></code>.
  1121. </p>
  1122. </dd></dl>
  1123. <dl>
  1124. <dt><a name="index-atexit"></a>Supplemental: <em>int</em> <strong>atexit</strong> <em>(void (*<var>f</var>)())</em></dt>
  1125. <dd>
  1126. <p>Causes function <var>f</var> to be called at exit. Returns 0.
  1127. </p>
  1128. </dd></dl>
  1129. <dl>
  1130. <dt><a name="index-basename"></a>Supplemental: <em>char*</em> <strong>basename</strong> <em>(const char *<var>name</var>)</em></dt>
  1131. <dd>
  1132. <p>Returns a pointer to the last component of pathname <var>name</var>.
  1133. Behavior is undefined if the pathname ends in a directory separator.
  1134. </p>
  1135. </dd></dl>
  1136. <dl>
  1137. <dt><a name="index-bcmp"></a>Supplemental: <em>int</em> <strong>bcmp</strong> <em>(char *<var>x</var>, char *<var>y</var>, int <var>count</var>)</em></dt>
  1138. <dd>
  1139. <p>Compares the first <var>count</var> bytes of two areas of memory. Returns
  1140. zero if they are the same, nonzero otherwise. Returns zero if
  1141. <var>count</var> is zero. A nonzero result only indicates a difference,
  1142. it does not indicate any sorting order (say, by having a positive
  1143. result mean <var>x</var> sorts before <var>y</var>).
  1144. </p>
  1145. </dd></dl>
  1146. <dl>
  1147. <dt><a name="index-bcopy"></a>Supplemental: <em>void</em> <strong>bcopy</strong> <em>(char *<var>in</var>, char *<var>out</var>, int <var>length</var>)</em></dt>
  1148. <dd>
  1149. <p>Copies <var>length</var> bytes from memory region <var>in</var> to region
  1150. <var>out</var>. The use of <code>bcopy</code> is deprecated in new programs.
  1151. </p>
  1152. </dd></dl>
  1153. <dl>
  1154. <dt><a name="index-bsearch"></a>Supplemental: <em>void*</em> <strong>bsearch</strong> <em>(const void *<var>key</var>, const void *<var>base</var>, size_t <var>nmemb</var>, size_t <var>size</var>, int (*<var>compar</var>)(const void *, const void *))</em></dt>
  1155. <dd>
  1156. <p>Performs a search over an array of <var>nmemb</var> elements pointed to by
  1157. <var>base</var> for a member that matches the object pointed to by <var>key</var>.
  1158. The size of each member is specified by <var>size</var>. The array contents
  1159. should be sorted in ascending order according to the <var>compar</var>
  1160. comparison function. This routine should take two arguments pointing to
  1161. the <var>key</var> and to an array member, in that order, and should return an
  1162. integer less than, equal to, or greater than zero if the <var>key</var> object
  1163. is respectively less than, matching, or greater than the array member.
  1164. </p>
  1165. </dd></dl>
  1166. <dl>
  1167. <dt><a name="index-buildargv"></a>Extension: <em>char**</em> <strong>buildargv</strong> <em>(char *<var>sp</var>)</em></dt>
  1168. <dd>
  1169. <p>Given a pointer to a string, parse the string extracting fields
  1170. separated by whitespace and optionally enclosed within either single
  1171. or double quotes (which are stripped off), and build a vector of
  1172. pointers to copies of the string for each field. The input string
  1173. remains unchanged. The last element of the vector is followed by a
  1174. <code>NULL</code> element.
  1175. </p>
  1176. <p>All of the memory for the pointer array and copies of the string
  1177. is obtained from <code>xmalloc</code>. All of the memory can be returned to the
  1178. system with the single function call <code>freeargv</code>, which takes the
  1179. returned result of <code>buildargv</code>, as it&rsquo;s argument.
  1180. </p>
  1181. <p>Returns a pointer to the argument vector if successful. Returns
  1182. <code>NULL</code> if <var>sp</var> is <code>NULL</code> or if there is insufficient
  1183. memory to complete building the argument vector.
  1184. </p>
  1185. <p>If the input is a null string (as opposed to a <code>NULL</code> pointer),
  1186. then buildarg returns an argument vector that has one arg, a null
  1187. string.
  1188. </p>
  1189. </dd></dl>
  1190. <dl>
  1191. <dt><a name="index-bzero"></a>Supplemental: <em>void</em> <strong>bzero</strong> <em>(char *<var>mem</var>, int <var>count</var>)</em></dt>
  1192. <dd>
  1193. <p>Zeros <var>count</var> bytes starting at <var>mem</var>. Use of this function
  1194. is deprecated in favor of <code>memset</code>.
  1195. </p>
  1196. </dd></dl>
  1197. <dl>
  1198. <dt><a name="index-calloc"></a>Supplemental: <em>void*</em> <strong>calloc</strong> <em>(size_t <var>nelem</var>, size_t <var>elsize</var>)</em></dt>
  1199. <dd>
  1200. <p>Uses <code>malloc</code> to allocate storage for <var>nelem</var> objects of
  1201. <var>elsize</var> bytes each, then zeros the memory.
  1202. </p>
  1203. </dd></dl>
  1204. <dl>
  1205. <dt><a name="index-canonical_005ffilename_005feq"></a>Extension: <em>int</em> <strong>canonical_filename_eq</strong> <em>(const char *<var>a</var>, const char *<var>b</var>)</em></dt>
  1206. <dd>
  1207. <p>Return non-zero if file names <var>a</var> and <var>b</var> are equivalent.
  1208. This function compares the canonical versions of the filenames as returned by
  1209. <code>lrealpath()</code>, so that so that different file names pointing to the same
  1210. underlying file are treated as being identical.
  1211. </p>
  1212. </dd></dl>
  1213. <dl>
  1214. <dt><a name="index-choose_005ftemp_005fbase"></a>Extension: <em>char*</em> <strong>choose_temp_base</strong> <em>(void)</em></dt>
  1215. <dd>
  1216. <p>Return a prefix for temporary file names or <code>NULL</code> if unable to
  1217. find one. The current directory is chosen if all else fails so the
  1218. program is exited if a temporary directory can&rsquo;t be found (<code>mktemp</code>
  1219. fails). The buffer for the result is obtained with <code>xmalloc</code>.
  1220. </p>
  1221. <p>This function is provided for backwards compatibility only. Its use is
  1222. not recommended.
  1223. </p>
  1224. </dd></dl>
  1225. <dl>
  1226. <dt><a name="index-char_002a"></a>Replacement: <em>const</em> <strong>char*</strong> <em>choose_tmpdir ()</em></dt>
  1227. <dd>
  1228. <p>Returns a pointer to a directory path suitable for creating temporary
  1229. files in.
  1230. </p>
  1231. </dd></dl>
  1232. <dl>
  1233. <dt><a name="index-clock"></a>Supplemental: <em>long</em> <strong>clock</strong> <em>(void)</em></dt>
  1234. <dd>
  1235. <p>Returns an approximation of the CPU time used by the process as a
  1236. <code>clock_t</code>; divide this number by &lsquo;<samp>CLOCKS_PER_SEC</samp>&rsquo; to get the
  1237. number of seconds used.
  1238. </p>
  1239. </dd></dl>
  1240. <dl>
  1241. <dt><a name="index-concat"></a>Extension: <em>char*</em> <strong>concat</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, &hellip;, <code>NULL</code>)</em></dt>
  1242. <dd>
  1243. <p>Concatenate zero or more of strings and return the result in freshly
  1244. <code>xmalloc</code>ed memory. The argument list is terminated by the first
  1245. <code>NULL</code> pointer encountered. Pointers to empty strings are ignored.
  1246. </p>
  1247. </dd></dl>
  1248. <dl>
  1249. <dt><a name="index-countargv"></a>Extension: <em>int</em> <strong>countargv</strong> <em>(char * const *<var>argv</var>)</em></dt>
  1250. <dd>
  1251. <p>Return the number of elements in <var>argv</var>.
  1252. Returns zero if <var>argv</var> is NULL.
  1253. </p>
  1254. </dd></dl>
  1255. <dl>
  1256. <dt><a name="index-crc32"></a>Extension: <em>unsigned int</em> <strong>crc32</strong> <em>(const unsigned char *<var>buf</var>, int <var>len</var>, unsigned int <var>init</var>)</em></dt>
  1257. <dd>
  1258. <p>Compute the 32-bit CRC of <var>buf</var> which has length <var>len</var>. The
  1259. starting value is <var>init</var>; this may be used to compute the CRC of
  1260. data split across multiple buffers by passing the return value of each
  1261. call as the <var>init</var> parameter of the next.
  1262. </p>
  1263. <p>This is intended to match the CRC used by the <code>gdb</code> remote
  1264. protocol for the &lsquo;<samp>qCRC</samp>&rsquo; command. In order to get the same
  1265. results as gdb for a block of data, you must pass the first CRC
  1266. parameter as <code>0xffffffff</code>.
  1267. </p>
  1268. <p>This CRC can be specified as:
  1269. </p>
  1270. <p>Width : 32
  1271. Poly : 0x04c11db7
  1272. Init : parameter, typically 0xffffffff
  1273. RefIn : false
  1274. RefOut : false
  1275. XorOut : 0
  1276. </p>
  1277. <p>This differs from the &quot;standard&quot; CRC-32 algorithm in that the values
  1278. are not reflected, and there is no final XOR value. These differences
  1279. make it easy to compose the values of multiple blocks.
  1280. </p>
  1281. </dd></dl>
  1282. <dl>
  1283. <dt><a name="index-dupargv"></a>Extension: <em>char**</em> <strong>dupargv</strong> <em>(char * const *<var>vector</var>)</em></dt>
  1284. <dd>
  1285. <p>Duplicate an argument vector. Simply scans through <var>vector</var>,
  1286. duplicating each argument until the terminating <code>NULL</code> is found.
  1287. Returns a pointer to the argument vector if successful. Returns
  1288. <code>NULL</code> if there is insufficient memory to complete building the
  1289. argument vector.
  1290. </p>
  1291. </dd></dl>
  1292. <dl>
  1293. <dt><a name="index-errno_005fmax"></a>Extension: <em>int</em> <strong>errno_max</strong> <em>(void)</em></dt>
  1294. <dd>
  1295. <p>Returns the maximum <code>errno</code> value for which a corresponding
  1296. symbolic name or message is available. Note that in the case where we
  1297. use the <code>sys_errlist</code> supplied by the system, it is possible for
  1298. there to be more symbolic names than messages, or vice versa. In
  1299. fact, the manual page for <code>perror(3C)</code> explicitly warns that one
  1300. should check the size of the table (<code>sys_nerr</code>) before indexing
  1301. it, since new error codes may be added to the system before they are
  1302. added to the table. Thus <code>sys_nerr</code> might be smaller than value
  1303. implied by the largest <code>errno</code> value defined in <code>&lt;errno.h&gt;</code>.
  1304. </p>
  1305. <p>We return the maximum value that can be used to obtain a meaningful
  1306. symbolic name or message.
  1307. </p>
  1308. </dd></dl>
  1309. <dl>
  1310. <dt><a name="index-expandargv"></a>Extension: <em>void</em> <strong>expandargv</strong> <em>(int *<var>argcp</var>, char ***<var>argvp</var>)</em></dt>
  1311. <dd>
  1312. <p>The <var>argcp</var> and <code>argvp</code> arguments are pointers to the usual
  1313. <code>argc</code> and <code>argv</code> arguments to <code>main</code>. This function
  1314. looks for arguments that begin with the character &lsquo;<samp>@</samp>&rsquo;. Any such
  1315. arguments are interpreted as &ldquo;response files&rdquo;. The contents of the
  1316. response file are interpreted as additional command line options. In
  1317. particular, the file is separated into whitespace-separated strings;
  1318. each such string is taken as a command-line option. The new options
  1319. are inserted in place of the option naming the response file, and
  1320. <code>*argcp</code> and <code>*argvp</code> will be updated. If the value of
  1321. <code>*argvp</code> is modified by this function, then the new value has
  1322. been dynamically allocated and can be deallocated by the caller with
  1323. <code>freeargv</code>. However, most callers will simply call
  1324. <code>expandargv</code> near the beginning of <code>main</code> and allow the
  1325. operating system to free the memory when the program exits.
  1326. </p>
  1327. </dd></dl>
  1328. <dl>
  1329. <dt><a name="index-fdmatch"></a>Extension: <em>int</em> <strong>fdmatch</strong> <em>(int <var>fd1</var>, int <var>fd2</var>)</em></dt>
  1330. <dd>
  1331. <p>Check to see if two open file descriptors refer to the same file.
  1332. This is useful, for example, when we have an open file descriptor for
  1333. an unnamed file, and the name of a file that we believe to correspond
  1334. to that fd. This can happen when we are exec&rsquo;d with an already open
  1335. file (<code>stdout</code> for example) or from the SVR4 <samp>/proc</samp> calls
  1336. that return open file descriptors for mapped address spaces. All we
  1337. have to do is open the file by name and check the two file descriptors
  1338. for a match, which is done by comparing major and minor device numbers
  1339. and inode numbers.
  1340. </p>
  1341. </dd></dl>
  1342. <dl>
  1343. <dt><a name="index-fdopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>fdopen_unlocked</strong> <em>(int <var>fildes</var>, const char * <var>mode</var>)</em></dt>
  1344. <dd>
  1345. <p>Opens and returns a <code>FILE</code> pointer via <code>fdopen</code>. If the
  1346. operating system supports it, ensure that the stream is setup to avoid
  1347. any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
  1348. unchanged.
  1349. </p>
  1350. </dd></dl>
  1351. <dl>
  1352. <dt><a name="index-ffs"></a>Supplemental: <em>int</em> <strong>ffs</strong> <em>(int <var>valu</var>)</em></dt>
  1353. <dd>
  1354. <p>Find the first (least significant) bit set in <var>valu</var>. Bits are
  1355. numbered from right to left, starting with bit 1 (corresponding to the
  1356. value 1). If <var>valu</var> is zero, zero is returned.
  1357. </p>
  1358. </dd></dl>
  1359. <dl>
  1360. <dt><a name="index-filename_005fcmp"></a>Extension: <em>int</em> <strong>filename_cmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
  1361. <dd>
  1362. <p>Return zero if the two file names <var>s1</var> and <var>s2</var> are equivalent.
  1363. If not equivalent, the returned value is similar to what <code>strcmp</code>
  1364. would return. In other words, it returns a negative value if <var>s1</var>
  1365. is less than <var>s2</var>, or a positive value if <var>s2</var> is greater than
  1366. <var>s2</var>.
  1367. </p>
  1368. <p>This function does not normalize file names. As a result, this function
  1369. will treat filenames that are spelled differently as different even in
  1370. the case when the two filenames point to the same underlying file.
  1371. However, it does handle the fact that on DOS-like file systems, forward
  1372. and backward slashes are equal.
  1373. </p>
  1374. </dd></dl>
  1375. <dl>
  1376. <dt><a name="index-filename_005feq"></a>Extension: <em>int</em> <strong>filename_eq</strong> <em>(const void *<var>s1</var>, const void *<var>s2</var>)</em></dt>
  1377. <dd>
  1378. <p>Return non-zero if file names <var>s1</var> and <var>s2</var> are equivalent.
  1379. This function is for use with hashtab.c hash tables.
  1380. </p>
  1381. </dd></dl>
  1382. <dl>
  1383. <dt><a name="index-filename_005fhash"></a>Extension: <em>hashval_t</em> <strong>filename_hash</strong> <em>(const void *<var>s</var>)</em></dt>
  1384. <dd>
  1385. <p>Return the hash value for file name <var>s</var> that will be compared
  1386. using filename_cmp.
  1387. This function is for use with hashtab.c hash tables.
  1388. </p>
  1389. </dd></dl>
  1390. <dl>
  1391. <dt><a name="index-filename_005fncmp"></a>Extension: <em>int</em> <strong>filename_ncmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, size_t <var>n</var>)</em></dt>
  1392. <dd>
  1393. <p>Return zero if the two file names <var>s1</var> and <var>s2</var> are equivalent
  1394. in range <var>n</var>.
  1395. If not equivalent, the returned value is similar to what <code>strncmp</code>
  1396. would return. In other words, it returns a negative value if <var>s1</var>
  1397. is less than <var>s2</var>, or a positive value if <var>s2</var> is greater than
  1398. <var>s2</var>.
  1399. </p>
  1400. <p>This function does not normalize file names. As a result, this function
  1401. will treat filenames that are spelled differently as different even in
  1402. the case when the two filenames point to the same underlying file.
  1403. However, it does handle the fact that on DOS-like file systems, forward
  1404. and backward slashes are equal.
  1405. </p>
  1406. </dd></dl>
  1407. <dl>
  1408. <dt><a name="index-fnmatch"></a>Replacement: <em>int</em> <strong>fnmatch</strong> <em>(const char *<var>pattern</var>, const char *<var>string</var>, int <var>flags</var>)</em></dt>
  1409. <dd>
  1410. <p>Matches <var>string</var> against <var>pattern</var>, returning zero if it
  1411. matches, <code>FNM_NOMATCH</code> if not. <var>pattern</var> may contain the
  1412. wildcards <code>?</code> to match any one character, <code>*</code> to match any
  1413. zero or more characters, or a set of alternate characters in square
  1414. brackets, like &lsquo;<samp>[a-gt8]</samp>&rsquo;, which match one character (<code>a</code>
  1415. through <code>g</code>, or <code>t</code>, or <code>8</code>, in this example) if that one
  1416. character is in the set. A set may be inverted (i.e., match anything
  1417. except what&rsquo;s in the set) by giving <code>^</code> or <code>!</code> as the first
  1418. character in the set. To include those characters in the set, list them
  1419. as anything other than the first character of the set. To include a
  1420. dash in the set, list it last in the set. A backslash character makes
  1421. the following character not special, so for example you could match
  1422. against a literal asterisk with &lsquo;<samp>\*</samp>&rsquo;. To match a literal
  1423. backslash, use &lsquo;<samp>\\</samp>&rsquo;.
  1424. </p>
  1425. <p><code>flags</code> controls various aspects of the matching process, and is a
  1426. boolean OR of zero or more of the following values (defined in
  1427. <code>&lt;fnmatch.h&gt;</code>):
  1428. </p>
  1429. <dl compact="compact">
  1430. <dt><code>FNM_PATHNAME</code></dt>
  1431. <dt><code>FNM_FILE_NAME</code></dt>
  1432. <dd><p><var>string</var> is assumed to be a path name. No wildcard will ever match
  1433. <code>/</code>.
  1434. </p>
  1435. </dd>
  1436. <dt><code>FNM_NOESCAPE</code></dt>
  1437. <dd><p>Do not interpret backslashes as quoting the following special character.
  1438. </p>
  1439. </dd>
  1440. <dt><code>FNM_PERIOD</code></dt>
  1441. <dd><p>A leading period (at the beginning of <var>string</var>, or if
  1442. <code>FNM_PATHNAME</code> after a slash) is not matched by <code>*</code> or
  1443. <code>?</code> but must be matched explicitly.
  1444. </p>
  1445. </dd>
  1446. <dt><code>FNM_LEADING_DIR</code></dt>
  1447. <dd><p>Means that <var>string</var> also matches <var>pattern</var> if some initial part
  1448. of <var>string</var> matches, and is followed by <code>/</code> and zero or more
  1449. characters. For example, &lsquo;<samp>foo*</samp>&rsquo; would match either &lsquo;<samp>foobar</samp>&rsquo;
  1450. or &lsquo;<samp>foobar/grill</samp>&rsquo;.
  1451. </p>
  1452. </dd>
  1453. <dt><code>FNM_CASEFOLD</code></dt>
  1454. <dd><p>Ignores case when performing the comparison.
  1455. </p>
  1456. </dd>
  1457. </dl>
  1458. </dd></dl>
  1459. <dl>
  1460. <dt><a name="index-fopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>fopen_unlocked</strong> <em>(const char *<var>path</var>, const char * <var>mode</var>)</em></dt>
  1461. <dd>
  1462. <p>Opens and returns a <code>FILE</code> pointer via <code>fopen</code>. If the
  1463. operating system supports it, ensure that the stream is setup to avoid
  1464. any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
  1465. unchanged.
  1466. </p>
  1467. </dd></dl>
  1468. <dl>
  1469. <dt><a name="index-freeargv"></a>Extension: <em>void</em> <strong>freeargv</strong> <em>(char **<var>vector</var>)</em></dt>
  1470. <dd>
  1471. <p>Free an argument vector that was built using <code>buildargv</code>. Simply
  1472. scans through <var>vector</var>, freeing the memory for each argument until
  1473. the terminating <code>NULL</code> is found, and then frees <var>vector</var>
  1474. itself.
  1475. </p>
  1476. </dd></dl>
  1477. <dl>
  1478. <dt><a name="index-freopen_005funlocked"></a>Extension: <em>FILE *</em> <strong>freopen_unlocked</strong> <em>(const char * <var>path</var>, const char * <var>mode</var>, FILE * <var>stream</var>)</em></dt>
  1479. <dd>
  1480. <p>Opens and returns a <code>FILE</code> pointer via <code>freopen</code>. If the
  1481. operating system supports it, ensure that the stream is setup to avoid
  1482. any multi-threaded locking. Otherwise return the <code>FILE</code> pointer
  1483. unchanged.
  1484. </p>
  1485. </dd></dl>
  1486. <dl>
  1487. <dt><a name="index-get_005frun_005ftime"></a>Replacement: <em>long</em> <strong>get_run_time</strong> <em>(void)</em></dt>
  1488. <dd>
  1489. <p>Returns the time used so far, in microseconds. If possible, this is
  1490. the time used by this process, else it is the elapsed time since the
  1491. process started.
  1492. </p>
  1493. </dd></dl>
  1494. <dl>
  1495. <dt><a name="index-getcwd"></a>Supplemental: <em>char*</em> <strong>getcwd</strong> <em>(char *<var>pathname</var>, int <var>len</var>)</em></dt>
  1496. <dd>
  1497. <p>Copy the absolute pathname for the current working directory into
  1498. <var>pathname</var>, which is assumed to point to a buffer of at least
  1499. <var>len</var> bytes, and return a pointer to the buffer. If the current
  1500. directory&rsquo;s path doesn&rsquo;t fit in <var>len</var> characters, the result is
  1501. <code>NULL</code> and <code>errno</code> is set. If <var>pathname</var> is a null pointer,
  1502. <code>getcwd</code> will obtain <var>len</var> bytes of space using
  1503. <code>malloc</code>.
  1504. </p>
  1505. </dd></dl>
  1506. <dl>
  1507. <dt><a name="index-getpagesize"></a>Supplemental: <em>int</em> <strong>getpagesize</strong> <em>(void)</em></dt>
  1508. <dd>
  1509. <p>Returns the number of bytes in a page of memory. This is the
  1510. granularity of many of the system memory management routines. No
  1511. guarantee is made as to whether or not it is the same as the basic
  1512. memory management hardware page size.
  1513. </p>
  1514. </dd></dl>
  1515. <dl>
  1516. <dt><a name="index-getpwd"></a>Supplemental: <em>char*</em> <strong>getpwd</strong> <em>(void)</em></dt>
  1517. <dd>
  1518. <p>Returns the current working directory. This implementation caches the
  1519. result on the assumption that the process will not call <code>chdir</code>
  1520. between calls to <code>getpwd</code>.
  1521. </p>
  1522. </dd></dl>
  1523. <dl>
  1524. <dt><a name="index-gettimeofday"></a>Supplemental: <em>int</em> <strong>gettimeofday</strong> <em>(struct timeval *<var>tp</var>, void *<var>tz</var>)</em></dt>
  1525. <dd>
  1526. <p>Writes the current time to <var>tp</var>. This implementation requires
  1527. that <var>tz</var> be NULL. Returns 0 on success, -1 on failure.
  1528. </p>
  1529. </dd></dl>
  1530. <dl>
  1531. <dt><a name="index-hex_005finit"></a>Extension: <em>void</em> <strong>hex_init</strong> <em>(void)</em></dt>
  1532. <dd>
  1533. <p>Initializes the array mapping the current character set to
  1534. corresponding hex values. This function must be called before any
  1535. call to <code>hex_p</code> or <code>hex_value</code>. If you fail to call it, a
  1536. default ASCII-based table will normally be used on ASCII systems.
  1537. </p>
  1538. </dd></dl>
  1539. <dl>
  1540. <dt><a name="index-hex_005fp"></a>Extension: <em>int</em> <strong>hex_p</strong> <em>(int <var>c</var>)</em></dt>
  1541. <dd>
  1542. <p>Evaluates to non-zero if the given character is a valid hex character,
  1543. or zero if it is not. Note that the value you pass will be cast to
  1544. <code>unsigned char</code> within the macro.
  1545. </p>
  1546. </dd></dl>
  1547. <dl>
  1548. <dt><a name="index-hex_005fvalue"></a>Extension: <em>unsigned int</em> <strong>hex_value</strong> <em>(int <var>c</var>)</em></dt>
  1549. <dd>
  1550. <p>Returns the numeric equivalent of the given character when interpreted
  1551. as a hexadecimal digit. The result is undefined if you pass an
  1552. invalid hex digit. Note that the value you pass will be cast to
  1553. <code>unsigned char</code> within the macro.
  1554. </p>
  1555. <p>The <code>hex_value</code> macro returns <code>unsigned int</code>, rather than
  1556. signed <code>int</code>, to make it easier to use in parsing addresses from
  1557. hex dump files: a signed <code>int</code> would be sign-extended when
  1558. converted to a wider unsigned type &mdash; like <code>bfd_vma</code>, on some
  1559. systems.
  1560. </p>
  1561. </dd></dl>
  1562. <dl>
  1563. <dt><a name="index-HOST_005fCHARSET"></a>Extension: <strong>HOST_CHARSET</strong></dt>
  1564. <dd><p>This macro indicates the basic character set and encoding used by the
  1565. host: more precisely, the encoding used for character constants in
  1566. preprocessor &lsquo;<samp>#if</samp>&rsquo; statements (the C &quot;execution character set&quot;).
  1567. It is defined by <samp>safe-ctype.h</samp>, and will be an integer constant
  1568. with one of the following values:
  1569. </p>
  1570. <dl compact="compact">
  1571. <dt><code>HOST_CHARSET_UNKNOWN</code>
  1572. <a name="index-HOST_005fCHARSET_005fUNKNOWN"></a>
  1573. </dt>
  1574. <dd><p>The host character set is unknown - that is, not one of the next two
  1575. possibilities.
  1576. </p>
  1577. </dd>
  1578. <dt><code>HOST_CHARSET_ASCII</code>
  1579. <a name="index-HOST_005fCHARSET_005fASCII"></a>
  1580. </dt>
  1581. <dd><p>The host character set is ASCII.
  1582. </p>
  1583. </dd>
  1584. <dt><code>HOST_CHARSET_EBCDIC</code>
  1585. <a name="index-HOST_005fCHARSET_005fEBCDIC"></a>
  1586. </dt>
  1587. <dd><p>The host character set is some variant of EBCDIC. (Only one of the
  1588. nineteen EBCDIC varying characters is tested; exercise caution.)
  1589. </p></dd>
  1590. </dl>
  1591. </dd></dl>
  1592. <dl>
  1593. <dt><a name="index-htab_005fcreate_005ftyped_005falloc"></a>Supplemental: <em>htab_t</em> <strong>htab_create_typed_alloc</strong> <em>(size_t <var>size</var>, htab_hash <var>hash_f</var>, htab_eq <var>eq_f</var>, htab_del <var>del_f</var>, htab_alloc <var>alloc_tab_f</var>, htab_alloc <var>alloc_f</var>, htab_free <var>free_f</var>)</em></dt>
  1594. <dd>
  1595. <p>This function creates a hash table that uses two different allocators
  1596. <var>alloc_tab_f</var> and <var>alloc_f</var> to use for allocating the table itself
  1597. and its entries respectively. This is useful when variables of different
  1598. types need to be allocated with different allocators.
  1599. </p>
  1600. <p>The created hash table is slightly larger than <var>size</var> and it is
  1601. initially empty (all the hash table entries are <code>HTAB_EMPTY_ENTRY</code>).
  1602. The function returns the created hash table, or <code>NULL</code> if memory
  1603. allocation fails.
  1604. </p>
  1605. </dd></dl>
  1606. <dl>
  1607. <dt><a name="index-index"></a>Supplemental: <em>char*</em> <strong>index</strong> <em>(char *<var>s</var>, int <var>c</var>)</em></dt>
  1608. <dd>
  1609. <p>Returns a pointer to the first occurrence of the character <var>c</var> in
  1610. the string <var>s</var>, or <code>NULL</code> if not found. The use of <code>index</code> is
  1611. deprecated in new programs in favor of <code>strchr</code>.
  1612. </p>
  1613. </dd></dl>
  1614. <dl>
  1615. <dt><a name="index-insque"></a>Supplemental: <em>void</em> <strong>insque</strong> <em>(struct qelem *<var>elem</var>, struct qelem *<var>pred</var>)</em></dt>
  1616. <dt><a name="index-remque"></a>Supplemental: <em>void</em> <strong>remque</strong> <em>(struct qelem *<var>elem</var>)</em></dt>
  1617. <dd>
  1618. <p>Routines to manipulate queues built from doubly linked lists. The
  1619. <code>insque</code> routine inserts <var>elem</var> in the queue immediately
  1620. after <var>pred</var>. The <code>remque</code> routine removes <var>elem</var> from
  1621. its containing queue. These routines expect to be passed pointers to
  1622. structures which have as their first members a forward pointer and a
  1623. back pointer, like this prototype (although no prototype is provided):
  1624. </p>
  1625. <div class="example">
  1626. <pre class="example">struct qelem {
  1627. struct qelem *q_forw;
  1628. struct qelem *q_back;
  1629. char q_data[];
  1630. };
  1631. </pre></div>
  1632. </dd></dl>
  1633. <dl>
  1634. <dt><a name="index-ISALPHA"></a>Extension: <strong>ISALPHA</strong> <em>(<var>c</var>)</em></dt>
  1635. <dt><a name="index-ISALNUM"></a>Extension: <strong>ISALNUM</strong> <em>(<var>c</var>)</em></dt>
  1636. <dt><a name="index-ISBLANK"></a>Extension: <strong>ISBLANK</strong> <em>(<var>c</var>)</em></dt>
  1637. <dt><a name="index-ISCNTRL"></a>Extension: <strong>ISCNTRL</strong> <em>(<var>c</var>)</em></dt>
  1638. <dt><a name="index-ISDIGIT"></a>Extension: <strong>ISDIGIT</strong> <em>(<var>c</var>)</em></dt>
  1639. <dt><a name="index-ISGRAPH"></a>Extension: <strong>ISGRAPH</strong> <em>(<var>c</var>)</em></dt>
  1640. <dt><a name="index-ISLOWER"></a>Extension: <strong>ISLOWER</strong> <em>(<var>c</var>)</em></dt>
  1641. <dt><a name="index-ISPRINT"></a>Extension: <strong>ISPRINT</strong> <em>(<var>c</var>)</em></dt>
  1642. <dt><a name="index-ISPUNCT"></a>Extension: <strong>ISPUNCT</strong> <em>(<var>c</var>)</em></dt>
  1643. <dt><a name="index-ISSPACE"></a>Extension: <strong>ISSPACE</strong> <em>(<var>c</var>)</em></dt>
  1644. <dt><a name="index-ISUPPER"></a>Extension: <strong>ISUPPER</strong> <em>(<var>c</var>)</em></dt>
  1645. <dt><a name="index-ISXDIGIT"></a>Extension: <strong>ISXDIGIT</strong> <em>(<var>c</var>)</em></dt>
  1646. <dd>
  1647. <p>These twelve macros are defined by <samp>safe-ctype.h</samp>. Each has the
  1648. same meaning as the corresponding macro (with name in lowercase)
  1649. defined by the standard header <samp>ctype.h</samp>. For example,
  1650. <code>ISALPHA</code> returns true for alphabetic characters and false for
  1651. others. However, there are two differences between these macros and
  1652. those provided by <samp>ctype.h</samp>:
  1653. </p>
  1654. <ul>
  1655. <li> These macros are guaranteed to have well-defined behavior for all
  1656. values representable by <code>signed char</code> and <code>unsigned char</code>, and
  1657. for <code>EOF</code>.
  1658. </li><li> These macros ignore the current locale; they are true for these
  1659. fixed sets of characters:
  1660. <table>
  1661. <tr><td><code>ALPHA</code></td><td><kbd>A-Za-z</kbd></td></tr>
  1662. <tr><td><code>ALNUM</code></td><td><kbd>A-Za-z0-9</kbd></td></tr>
  1663. <tr><td><code>BLANK</code></td><td><kbd>space tab</kbd></td></tr>
  1664. <tr><td><code>CNTRL</code></td><td><code>!PRINT</code></td></tr>
  1665. <tr><td><code>DIGIT</code></td><td><kbd>0-9</kbd></td></tr>
  1666. <tr><td><code>GRAPH</code></td><td><code>ALNUM || PUNCT</code></td></tr>
  1667. <tr><td><code>LOWER</code></td><td><kbd>a-z</kbd></td></tr>
  1668. <tr><td><code>PRINT</code></td><td><code>GRAPH ||</code> <kbd>space</kbd></td></tr>
  1669. <tr><td><code>PUNCT</code></td><td><kbd>`~!@#$%^&amp;*()_-=+[{]}\|;:'&quot;,&lt;.&gt;/?</kbd></td></tr>
  1670. <tr><td><code>SPACE</code></td><td><kbd>space tab \n \r \f \v</kbd></td></tr>
  1671. <tr><td><code>UPPER</code></td><td><kbd>A-Z</kbd></td></tr>
  1672. <tr><td><code>XDIGIT</code></td><td><kbd>0-9A-Fa-f</kbd></td></tr>
  1673. </table>
  1674. <p>Note that, if the host character set is ASCII or a superset thereof,
  1675. all these macros will return false for all values of <code>char</code> outside
  1676. the range of 7-bit ASCII. In particular, both ISPRINT and ISCNTRL return
  1677. false for characters with numeric values from 128 to 255.
  1678. </p></li></ul>
  1679. </dd></dl>
  1680. <dl>
  1681. <dt><a name="index-ISIDNUM"></a>Extension: <strong>ISIDNUM</strong> <em>(<var>c</var>)</em></dt>
  1682. <dt><a name="index-ISIDST"></a>Extension: <strong>ISIDST</strong> <em>(<var>c</var>)</em></dt>
  1683. <dt><a name="index-IS_005fVSPACE"></a>Extension: <strong>IS_VSPACE</strong> <em>(<var>c</var>)</em></dt>
  1684. <dt><a name="index-IS_005fNVSPACE"></a>Extension: <strong>IS_NVSPACE</strong> <em>(<var>c</var>)</em></dt>
  1685. <dt><a name="index-IS_005fSPACE_005fOR_005fNUL"></a>Extension: <strong>IS_SPACE_OR_NUL</strong> <em>(<var>c</var>)</em></dt>
  1686. <dt><a name="index-IS_005fISOBASIC"></a>Extension: <strong>IS_ISOBASIC</strong> <em>(<var>c</var>)</em></dt>
  1687. <dd><p>These six macros are defined by <samp>safe-ctype.h</samp> and provide
  1688. additional character classes which are useful when doing lexical
  1689. analysis of C or similar languages. They are true for the following
  1690. sets of characters:
  1691. </p>
  1692. <table>
  1693. <tr><td><code>IDNUM</code></td><td><kbd>A-Za-z0-9_</kbd></td></tr>
  1694. <tr><td><code>IDST</code></td><td><kbd>A-Za-z_</kbd></td></tr>
  1695. <tr><td><code>VSPACE</code></td><td><kbd>\r \n</kbd></td></tr>
  1696. <tr><td><code>NVSPACE</code></td><td><kbd>space tab \f \v \0</kbd></td></tr>
  1697. <tr><td><code>SPACE_OR_NUL</code></td><td><code>VSPACE || NVSPACE</code></td></tr>
  1698. <tr><td><code>ISOBASIC</code></td><td><code>VSPACE || NVSPACE || PRINT</code></td></tr>
  1699. </table>
  1700. </dd></dl>
  1701. <dl>
  1702. <dt><a name="index-lbasename"></a>Replacement: <em>const char*</em> <strong>lbasename</strong> <em>(const char *<var>name</var>)</em></dt>
  1703. <dd>
  1704. <p>Given a pointer to a string containing a typical pathname
  1705. (&lsquo;<samp>/usr/src/cmd/ls/ls.c</samp>&rsquo; for example), returns a pointer to the
  1706. last component of the pathname (&lsquo;<samp>ls.c</samp>&rsquo; in this case). The
  1707. returned pointer is guaranteed to lie within the original
  1708. string. This latter fact is not true of many vendor C
  1709. libraries, which return special strings or modify the passed
  1710. strings for particular input.
  1711. </p>
  1712. <p>In particular, the empty string returns the same empty string,
  1713. and a path ending in <code>/</code> returns the empty string after it.
  1714. </p>
  1715. </dd></dl>
  1716. <dl>
  1717. <dt><a name="index-lrealpath"></a>Replacement: <em>const char*</em> <strong>lrealpath</strong> <em>(const char *<var>name</var>)</em></dt>
  1718. <dd>
  1719. <p>Given a pointer to a string containing a pathname, returns a canonical
  1720. version of the filename. Symlinks will be resolved, and &ldquo;.&rdquo; and &ldquo;..&rdquo;
  1721. components will be simplified. The returned value will be allocated using
  1722. <code>malloc</code>, or <code>NULL</code> will be returned on a memory allocation error.
  1723. </p>
  1724. </dd></dl>
  1725. <dl>
  1726. <dt><a name="index-make_005frelative_005fprefix"></a>Extension: <em>const char*</em> <strong>make_relative_prefix</strong> <em>(const char *<var>progname</var>, const char *<var>bin_prefix</var>, const char *<var>prefix</var>)</em></dt>
  1727. <dd>
  1728. <p>Given three paths <var>progname</var>, <var>bin_prefix</var>, <var>prefix</var>,
  1729. return the path that is in the same position relative to
  1730. <var>progname</var>&rsquo;s directory as <var>prefix</var> is relative to
  1731. <var>bin_prefix</var>. That is, a string starting with the directory
  1732. portion of <var>progname</var>, followed by a relative pathname of the
  1733. difference between <var>bin_prefix</var> and <var>prefix</var>.
  1734. </p>
  1735. <p>If <var>progname</var> does not contain any directory separators,
  1736. <code>make_relative_prefix</code> will search <code>PATH</code> to find a program
  1737. named <var>progname</var>. Also, if <var>progname</var> is a symbolic link,
  1738. the symbolic link will be resolved.
  1739. </p>
  1740. <p>For example, if <var>bin_prefix</var> is <code>/alpha/beta/gamma/gcc/delta</code>,
  1741. <var>prefix</var> is <code>/alpha/beta/gamma/omega/</code>, and <var>progname</var> is
  1742. <code>/red/green/blue/gcc</code>, then this function will return
  1743. <code>/red/green/blue/../../omega/</code>.
  1744. </p>
  1745. <p>The return value is normally allocated via <code>malloc</code>. If no
  1746. relative prefix can be found, return <code>NULL</code>.
  1747. </p>
  1748. </dd></dl>
  1749. <dl>
  1750. <dt><a name="index-make_005ftemp_005ffile"></a>Replacement: <em>char*</em> <strong>make_temp_file</strong> <em>(const char *<var>suffix</var>)</em></dt>
  1751. <dd>
  1752. <p>Return a temporary file name (as a string) or <code>NULL</code> if unable to
  1753. create one. <var>suffix</var> is a suffix to append to the file name. The
  1754. string is <code>malloc</code>ed, and the temporary file has been created.
  1755. </p>
  1756. </dd></dl>
  1757. <dl>
  1758. <dt><a name="index-memchr"></a>Supplemental: <em>void*</em> <strong>memchr</strong> <em>(const void *<var>s</var>, int <var>c</var>, size_t <var>n</var>)</em></dt>
  1759. <dd>
  1760. <p>This function searches memory starting at <code>*<var>s</var></code> for the
  1761. character <var>c</var>. The search only ends with the first occurrence of
  1762. <var>c</var>, or after <var>length</var> characters; in particular, a null
  1763. character does not terminate the search. If the character <var>c</var> is
  1764. found within <var>length</var> characters of <code>*<var>s</var></code>, a pointer
  1765. to the character is returned. If <var>c</var> is not found, then <code>NULL</code> is
  1766. returned.
  1767. </p>
  1768. </dd></dl>
  1769. <dl>
  1770. <dt><a name="index-memcmp"></a>Supplemental: <em>int</em> <strong>memcmp</strong> <em>(const void *<var>x</var>, const void *<var>y</var>, size_t <var>count</var>)</em></dt>
  1771. <dd>
  1772. <p>Compares the first <var>count</var> bytes of two areas of memory. Returns
  1773. zero if they are the same, a value less than zero if <var>x</var> is
  1774. lexically less than <var>y</var>, or a value greater than zero if <var>x</var>
  1775. is lexically greater than <var>y</var>. Note that lexical order is determined
  1776. as if comparing unsigned char arrays.
  1777. </p>
  1778. </dd></dl>
  1779. <dl>
  1780. <dt><a name="index-memcpy"></a>Supplemental: <em>void*</em> <strong>memcpy</strong> <em>(void *<var>out</var>, const void *<var>in</var>, size_t <var>length</var>)</em></dt>
  1781. <dd>
  1782. <p>Copies <var>length</var> bytes from memory region <var>in</var> to region
  1783. <var>out</var>. Returns a pointer to <var>out</var>.
  1784. </p>
  1785. </dd></dl>
  1786. <dl>
  1787. <dt><a name="index-memmem"></a>Supplemental: <em>void*</em> <strong>memmem</strong> <em>(const void *<var>haystack</var>, size_t <var>haystack_len</var> const void *<var>needle</var>, size_t <var>needle_len</var>)</em></dt>
  1788. <dd>
  1789. <p>Returns a pointer to the first occurrence of <var>needle</var> (length
  1790. <var>needle_len</var>) in <var>haystack</var> (length <var>haystack_len</var>).
  1791. Returns <code>NULL</code> if not found.
  1792. </p>
  1793. </dd></dl>
  1794. <dl>
  1795. <dt><a name="index-memmove"></a>Supplemental: <em>void*</em> <strong>memmove</strong> <em>(void *<var>from</var>, const void *<var>to</var>, size_t <var>count</var>)</em></dt>
  1796. <dd>
  1797. <p>Copies <var>count</var> bytes from memory area <var>from</var> to memory area
  1798. <var>to</var>, returning a pointer to <var>to</var>.
  1799. </p>
  1800. </dd></dl>
  1801. <dl>
  1802. <dt><a name="index-mempcpy"></a>Supplemental: <em>void*</em> <strong>mempcpy</strong> <em>(void *<var>out</var>, const void *<var>in</var>, size_t <var>length</var>)</em></dt>
  1803. <dd>
  1804. <p>Copies <var>length</var> bytes from memory region <var>in</var> to region
  1805. <var>out</var>. Returns a pointer to <var>out</var> + <var>length</var>.
  1806. </p>
  1807. </dd></dl>
  1808. <dl>
  1809. <dt><a name="index-memset"></a>Supplemental: <em>void*</em> <strong>memset</strong> <em>(void *<var>s</var>, int <var>c</var>, size_t <var>count</var>)</em></dt>
  1810. <dd>
  1811. <p>Sets the first <var>count</var> bytes of <var>s</var> to the constant byte
  1812. <var>c</var>, returning a pointer to <var>s</var>.
  1813. </p>
  1814. </dd></dl>
  1815. <dl>
  1816. <dt><a name="index-mkstemps"></a>Replacement: <em>int</em> <strong>mkstemps</strong> <em>(char *<var>pattern</var>, int <var>suffix_len</var>)</em></dt>
  1817. <dd>
  1818. <p>Generate a unique temporary file name from <var>pattern</var>.
  1819. <var>pattern</var> has the form:
  1820. </p>
  1821. <div class="example">
  1822. <pre class="example"> <var>path</var>/ccXXXXXX<var>suffix</var>
  1823. </pre></div>
  1824. <p><var>suffix_len</var> tells us how long <var>suffix</var> is (it can be zero
  1825. length). The last six characters of <var>pattern</var> before <var>suffix</var>
  1826. must be &lsquo;<samp>XXXXXX</samp>&rsquo;; they are replaced with a string that makes the
  1827. filename unique. Returns a file descriptor open on the file for
  1828. reading and writing.
  1829. </p>
  1830. </dd></dl>
  1831. <dl>
  1832. <dt><a name="index-pex_005ffree"></a>Extension: <em>void</em> <strong>pex_free</strong> <em>(struct pex_obj <var>obj</var>)</em></dt>
  1833. <dd>
  1834. <p>Clean up and free all data associated with <var>obj</var>. If you have not
  1835. yet called <code>pex_get_times</code> or <code>pex_get_status</code>, this will
  1836. try to kill the subprocesses.
  1837. </p>
  1838. </dd></dl>
  1839. <dl>
  1840. <dt><a name="index-pex_005fget_005fstatus"></a>Extension: <em>int</em> <strong>pex_get_status</strong> <em>(struct pex_obj *<var>obj</var>, int <var>count</var>, int *<var>vector</var>)</em></dt>
  1841. <dd>
  1842. <p>Returns the exit status of all programs run using <var>obj</var>.
  1843. <var>count</var> is the number of results expected. The results will be
  1844. placed into <var>vector</var>. The results are in the order of the calls
  1845. to <code>pex_run</code>. Returns 0 on error, 1 on success.
  1846. </p>
  1847. </dd></dl>
  1848. <dl>
  1849. <dt><a name="index-pex_005fget_005ftimes"></a>Extension: <em>int</em> <strong>pex_get_times</strong> <em>(struct pex_obj *<var>obj</var>, int <var>count</var>, struct pex_time *<var>vector</var>)</em></dt>
  1850. <dd>
  1851. <p>Returns the process execution times of all programs run using
  1852. <var>obj</var>. <var>count</var> is the number of results expected. The
  1853. results will be placed into <var>vector</var>. The results are in the
  1854. order of the calls to <code>pex_run</code>. Returns 0 on error, 1 on
  1855. success.
  1856. </p>
  1857. <p><code>struct pex_time</code> has the following fields of the type
  1858. <code>unsigned long</code>: <code>user_seconds</code>,
  1859. <code>user_microseconds</code>, <code>system_seconds</code>,
  1860. <code>system_microseconds</code>. On systems which do not support reporting
  1861. process times, all the fields will be set to <code>0</code>.
  1862. </p>
  1863. </dd></dl>
  1864. <dl>
  1865. <dt><a name="index-pex_005finit"></a>Extension: <em>struct pex_obj *</em> <strong>pex_init</strong> <em>(int <var>flags</var>, const char *<var>pname</var>, const char *<var>tempbase</var>)</em></dt>
  1866. <dd>
  1867. <p>Prepare to execute one or more programs, with standard output of each
  1868. program fed to standard input of the next. This is a system
  1869. independent interface to execute a pipeline.
  1870. </p>
  1871. <p><var>flags</var> is a bitwise combination of the following:
  1872. </p>
  1873. <dl compact="compact">
  1874. <dd>
  1875. <a name="index-PEX_005fRECORD_005fTIMES"></a>
  1876. </dd>
  1877. <dt><code>PEX_RECORD_TIMES</code></dt>
  1878. <dd><p>Record subprocess times if possible.
  1879. </p>
  1880. <a name="index-PEX_005fUSE_005fPIPES"></a>
  1881. </dd>
  1882. <dt><code>PEX_USE_PIPES</code></dt>
  1883. <dd><p>Use pipes for communication between processes, if possible.
  1884. </p>
  1885. <a name="index-PEX_005fSAVE_005fTEMPS"></a>
  1886. </dd>
  1887. <dt><code>PEX_SAVE_TEMPS</code></dt>
  1888. <dd><p>Don&rsquo;t delete temporary files used for communication between
  1889. processes.
  1890. </p>
  1891. </dd>
  1892. </dl>
  1893. <p><var>pname</var> is the name of program to be executed, used in error
  1894. messages. <var>tempbase</var> is a base name to use for any required
  1895. temporary files; it may be <code>NULL</code> to use a randomly chosen name.
  1896. </p>
  1897. </dd></dl>
  1898. <dl>
  1899. <dt><a name="index-pex_005finput_005ffile"></a>Extension: <em>FILE *</em> <strong>pex_input_file</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>in_name</var>)</em></dt>
  1900. <dd>
  1901. <p>Return a stream for a temporary file to pass to the first program in
  1902. the pipeline as input.
  1903. </p>
  1904. <p>The name of the input file is chosen according to the same rules
  1905. <code>pex_run</code> uses to choose output file names, based on
  1906. <var>in_name</var>, <var>obj</var> and the <code>PEX_SUFFIX</code> bit in <var>flags</var>.
  1907. </p>
  1908. <p>Don&rsquo;t call <code>fclose</code> on the returned stream; the first call to
  1909. <code>pex_run</code> closes it automatically.
  1910. </p>
  1911. <p>If <var>flags</var> includes <code>PEX_BINARY_OUTPUT</code>, open the stream in
  1912. binary mode; otherwise, open it in the default mode. Including
  1913. <code>PEX_BINARY_OUTPUT</code> in <var>flags</var> has no effect on Unix.
  1914. </p></dd></dl>
  1915. <dl>
  1916. <dt><a name="index-pex_005finput_005fpipe"></a>Extension: <em>FILE *</em> <strong>pex_input_pipe</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
  1917. <dd>
  1918. <p>Return a stream <var>fp</var> for a pipe connected to the standard input of
  1919. the first program in the pipeline; <var>fp</var> is opened for writing.
  1920. You must have passed <code>PEX_USE_PIPES</code> to the <code>pex_init</code> call
  1921. that returned <var>obj</var>.
  1922. </p>
  1923. <p>You must close <var>fp</var> using <code>fclose</code> yourself when you have
  1924. finished writing data to the pipeline.
  1925. </p>
  1926. <p>The file descriptor underlying <var>fp</var> is marked not to be inherited
  1927. by child processes.
  1928. </p>
  1929. <p>On systems that do not support pipes, this function returns
  1930. <code>NULL</code>, and sets <code>errno</code> to <code>EINVAL</code>. If you would
  1931. like to write code that is portable to all systems the <code>pex</code>
  1932. functions support, consider using <code>pex_input_file</code> instead.
  1933. </p>
  1934. <p>There are two opportunities for deadlock using
  1935. <code>pex_input_pipe</code>:
  1936. </p>
  1937. <ul>
  1938. <li> Most systems&rsquo; pipes can buffer only a fixed amount of data; a process
  1939. that writes to a full pipe blocks. Thus, if you write to <samp>fp</samp>
  1940. before starting the first process, you run the risk of blocking when
  1941. there is no child process yet to read the data and allow you to
  1942. continue. <code>pex_input_pipe</code> makes no promises about the
  1943. size of the pipe&rsquo;s buffer, so if you need to write any data at all
  1944. before starting the first process in the pipeline, consider using
  1945. <code>pex_input_file</code> instead.
  1946. </li><li> Using <code>pex_input_pipe</code> and <code>pex_read_output</code> together
  1947. may also cause deadlock. If the output pipe fills up, so that each
  1948. program in the pipeline is waiting for the next to read more data, and
  1949. you fill the input pipe by writing more data to <var>fp</var>, then there
  1950. is no way to make progress: the only process that could read data from
  1951. the output pipe is you, but you are blocked on the input pipe.
  1952. </li></ul>
  1953. </dd></dl>
  1954. <dl>
  1955. <dt><a name="index-pex_005fone"></a>Extension: <em>const char *</em> <strong>pex_one</strong> <em>(int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, const char *<var>pname</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>status</var>, int *<var>err</var>)</em></dt>
  1956. <dd>
  1957. <p>An interface to permit the easy execution of a
  1958. single program. The return value and most of the parameters are as
  1959. for a call to <code>pex_run</code>. <var>flags</var> is restricted to a
  1960. combination of <code>PEX_SEARCH</code>, <code>PEX_STDERR_TO_STDOUT</code>, and
  1961. <code>PEX_BINARY_OUTPUT</code>. <var>outname</var> is interpreted as if
  1962. <code>PEX_LAST</code> were set. On a successful return, <code>*<var>status</var></code> will
  1963. be set to the exit status of the program.
  1964. </p>
  1965. </dd></dl>
  1966. <dl>
  1967. <dt><a name="index-pex_005fread_005ferr"></a>Extension: <em>FILE *</em> <strong>pex_read_err</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
  1968. <dd>
  1969. <p>Returns a <code>FILE</code> pointer which may be used to read the standard
  1970. error of the last program in the pipeline. When this is used,
  1971. <code>PEX_LAST</code> should not be used in a call to <code>pex_run</code>. After
  1972. this is called, <code>pex_run</code> may no longer be called with the same
  1973. <var>obj</var>. <var>binary</var> should be non-zero if the file should be
  1974. opened in binary mode. Don&rsquo;t call <code>fclose</code> on the returned file;
  1975. it will be closed by <code>pex_free</code>.
  1976. </p>
  1977. </dd></dl>
  1978. <dl>
  1979. <dt><a name="index-pex_005fread_005foutput"></a>Extension: <em>FILE *</em> <strong>pex_read_output</strong> <em>(struct pex_obj *<var>obj</var>, int <var>binary</var>)</em></dt>
  1980. <dd>
  1981. <p>Returns a <code>FILE</code> pointer which may be used to read the standard
  1982. output of the last program in the pipeline. When this is used,
  1983. <code>PEX_LAST</code> should not be used in a call to <code>pex_run</code>. After
  1984. this is called, <code>pex_run</code> may no longer be called with the same
  1985. <var>obj</var>. <var>binary</var> should be non-zero if the file should be
  1986. opened in binary mode. Don&rsquo;t call <code>fclose</code> on the returned file;
  1987. it will be closed by <code>pex_free</code>.
  1988. </p>
  1989. </dd></dl>
  1990. <dl>
  1991. <dt><a name="index-pex_005frun"></a>Extension: <em>const char *</em> <strong>pex_run</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>err</var>)</em></dt>
  1992. <dd>
  1993. <p>Execute one program in a pipeline. On success this returns
  1994. <code>NULL</code>. On failure it returns an error message, a statically
  1995. allocated string.
  1996. </p>
  1997. <p><var>obj</var> is returned by a previous call to <code>pex_init</code>.
  1998. </p>
  1999. <p><var>flags</var> is a bitwise combination of the following:
  2000. </p>
  2001. <dl compact="compact">
  2002. <dd>
  2003. <a name="index-PEX_005fLAST"></a>
  2004. </dd>
  2005. <dt><code>PEX_LAST</code></dt>
  2006. <dd><p>This must be set on the last program in the pipeline. In particular,
  2007. it should be set when executing a single program. The standard output
  2008. of the program will be sent to <var>outname</var>, or, if <var>outname</var> is
  2009. <code>NULL</code>, to the standard output of the calling program. Do <em>not</em>
  2010. set this bit if you want to call <code>pex_read_output</code>
  2011. (described below). After a call to <code>pex_run</code> with this bit set,
  2012. <var>pex_run</var> may no longer be called with the same <var>obj</var>.
  2013. </p>
  2014. <a name="index-PEX_005fSEARCH"></a>
  2015. </dd>
  2016. <dt><code>PEX_SEARCH</code></dt>
  2017. <dd><p>Search for the program using the user&rsquo;s executable search path.
  2018. </p>
  2019. <a name="index-PEX_005fSUFFIX"></a>
  2020. </dd>
  2021. <dt><code>PEX_SUFFIX</code></dt>
  2022. <dd><p><var>outname</var> is a suffix. See the description of <var>outname</var>,
  2023. below.
  2024. </p>
  2025. <a name="index-PEX_005fSTDERR_005fTO_005fSTDOUT"></a>
  2026. </dd>
  2027. <dt><code>PEX_STDERR_TO_STDOUT</code></dt>
  2028. <dd><p>Send the program&rsquo;s standard error to standard output, if possible.
  2029. </p>
  2030. <a name="index-PEX_005fBINARY_005fINPUT"></a>
  2031. <a name="index-PEX_005fBINARY_005fOUTPUT"></a>
  2032. <a name="index-PEX_005fBINARY_005fERROR"></a>
  2033. </dd>
  2034. <dt><code>PEX_BINARY_INPUT</code></dt>
  2035. <dt><code>PEX_BINARY_OUTPUT</code></dt>
  2036. <dt><code>PEX_BINARY_ERROR</code></dt>
  2037. <dd><p>The standard input (output or error) of the program should be read (written) in
  2038. binary mode rather than text mode. These flags are ignored on systems
  2039. which do not distinguish binary mode and text mode, such as Unix. For
  2040. proper behavior these flags should match appropriately&mdash;a call to
  2041. <code>pex_run</code> using <code>PEX_BINARY_OUTPUT</code> should be followed by a
  2042. call using <code>PEX_BINARY_INPUT</code>.
  2043. </p>
  2044. <a name="index-PEX_005fSTDERR_005fTO_005fPIPE"></a>
  2045. </dd>
  2046. <dt><code>PEX_STDERR_TO_PIPE</code></dt>
  2047. <dd><p>Send the program&rsquo;s standard error to a pipe, if possible. This flag
  2048. cannot be specified together with <code>PEX_STDERR_TO_STDOUT</code>. This
  2049. flag can be specified only on the last program in pipeline.
  2050. </p>
  2051. </dd>
  2052. </dl>
  2053. <p><var>executable</var> is the program to execute. <var>argv</var> is the set of
  2054. arguments to pass to the program; normally <code><var>argv</var>[0]</code> will
  2055. be a copy of <var>executable</var>.
  2056. </p>
  2057. <p><var>outname</var> is used to set the name of the file to use for standard
  2058. output. There are two cases in which no output file will be used:
  2059. </p>
  2060. <ol>
  2061. <li> if <code>PEX_LAST</code> is not set in <var>flags</var>, and <code>PEX_USE_PIPES</code>
  2062. was set in the call to <code>pex_init</code>, and the system supports pipes
  2063. </li><li> if <code>PEX_LAST</code> is set in <var>flags</var>, and <var>outname</var> is
  2064. <code>NULL</code>
  2065. </li></ol>
  2066. <p>Otherwise the code will use a file to hold standard
  2067. output. If <code>PEX_LAST</code> is not set, this file is considered to be
  2068. a temporary file, and it will be removed when no longer needed, unless
  2069. <code>PEX_SAVE_TEMPS</code> was set in the call to <code>pex_init</code>.
  2070. </p>
  2071. <p>There are two cases to consider when setting the name of the file to
  2072. hold standard output.
  2073. </p>
  2074. <ol>
  2075. <li> <code>PEX_SUFFIX</code> is set in <var>flags</var>. In this case
  2076. <var>outname</var> may not be <code>NULL</code>. If the <var>tempbase</var> parameter
  2077. to <code>pex_init</code> was not <code>NULL</code>, then the output file name is
  2078. the concatenation of <var>tempbase</var> and <var>outname</var>. If
  2079. <var>tempbase</var> was <code>NULL</code>, then the output file name is a random
  2080. file name ending in <var>outname</var>.
  2081. </li><li> <code>PEX_SUFFIX</code> was not set in <var>flags</var>. In this
  2082. case, if <var>outname</var> is not <code>NULL</code>, it is used as the output
  2083. file name. If <var>outname</var> is <code>NULL</code>, and <var>tempbase</var> was
  2084. not NULL, the output file name is randomly chosen using
  2085. <var>tempbase</var>. Otherwise the output file name is chosen completely
  2086. at random.
  2087. </li></ol>
  2088. <p><var>errname</var> is the file name to use for standard error output. If
  2089. it is <code>NULL</code>, standard error is the same as the caller&rsquo;s.
  2090. Otherwise, standard error is written to the named file.
  2091. </p>
  2092. <p>On an error return, the code sets <code>*<var>err</var></code> to an <code>errno</code>
  2093. value, or to 0 if there is no relevant <code>errno</code>.
  2094. </p>
  2095. </dd></dl>
  2096. <dl>
  2097. <dt><a name="index-pex_005frun_005fin_005fenvironment"></a>Extension: <em>const char *</em> <strong>pex_run_in_environment</strong> <em>(struct pex_obj *<var>obj</var>, int <var>flags</var>, const char *<var>executable</var>, char * const *<var>argv</var>, char * const *<var>env</var>, int <var>env_size</var>, const char *<var>outname</var>, const char *<var>errname</var>, int *<var>err</var>)</em></dt>
  2098. <dd>
  2099. <p>Execute one program in a pipeline, permitting the environment for the
  2100. program to be specified. Behaviour and parameters not listed below are
  2101. as for <code>pex_run</code>.
  2102. </p>
  2103. <p><var>env</var> is the environment for the child process, specified as an array of
  2104. character pointers. Each element of the array should point to a string of the
  2105. form <code>VAR=VALUE</code>, with the exception of the last element that must be
  2106. <code>NULL</code>.
  2107. </p>
  2108. </dd></dl>
  2109. <dl>
  2110. <dt><a name="index-pexecute"></a>Extension: <em>int</em> <strong>pexecute</strong> <em>(const char *<var>program</var>, char * const *<var>argv</var>, const char *<var>this_pname</var>, const char *<var>temp_base</var>, char **<var>errmsg_fmt</var>, char **<var>errmsg_arg</var>, int <var>flags</var>)</em></dt>
  2111. <dd>
  2112. <p>This is the old interface to execute one or more programs. It is
  2113. still supported for compatibility purposes, but is no longer
  2114. documented.
  2115. </p>
  2116. </dd></dl>
  2117. <dl>
  2118. <dt><a name="index-psignal"></a>Supplemental: <em>void</em> <strong>psignal</strong> <em>(int <var>signo</var>, char *<var>message</var>)</em></dt>
  2119. <dd>
  2120. <p>Print <var>message</var> to the standard error, followed by a colon,
  2121. followed by the description of the signal specified by <var>signo</var>,
  2122. followed by a newline.
  2123. </p>
  2124. </dd></dl>
  2125. <dl>
  2126. <dt><a name="index-putenv"></a>Supplemental: <em>int</em> <strong>putenv</strong> <em>(const char *<var>string</var>)</em></dt>
  2127. <dd>
  2128. <p>Uses <code>setenv</code> or <code>unsetenv</code> to put <var>string</var> into
  2129. the environment or remove it. If <var>string</var> is of the form
  2130. &lsquo;<samp>name=value</samp>&rsquo; the string is added; if no &lsquo;<samp>=</samp>&rsquo; is present the
  2131. name is unset/removed.
  2132. </p>
  2133. </dd></dl>
  2134. <dl>
  2135. <dt><a name="index-pwait"></a>Extension: <em>int</em> <strong>pwait</strong> <em>(int <var>pid</var>, int *<var>status</var>, int <var>flags</var>)</em></dt>
  2136. <dd>
  2137. <p>Another part of the old execution interface.
  2138. </p>
  2139. </dd></dl>
  2140. <dl>
  2141. <dt><a name="index-random"></a>Supplement: <em>long int</em> <strong>random</strong> <em>(void)</em></dt>
  2142. <dt><a name="index-srandom"></a>Supplement: <em>void</em> <strong>srandom</strong> <em>(unsigned int <var>seed</var>)</em></dt>
  2143. <dt><a name="index-initstate"></a>Supplement: <em>void*</em> <strong>initstate</strong> <em>(unsigned int <var>seed</var>, void *<var>arg_state</var>, unsigned long <var>n</var>)</em></dt>
  2144. <dt><a name="index-setstate"></a>Supplement: <em>void*</em> <strong>setstate</strong> <em>(void *<var>arg_state</var>)</em></dt>
  2145. <dd>
  2146. <p>Random number functions. <code>random</code> returns a random number in the
  2147. range 0 to <code>LONG_MAX</code>. <code>srandom</code> initializes the random
  2148. number generator to some starting point determined by <var>seed</var>
  2149. (else, the values returned by <code>random</code> are always the same for each
  2150. run of the program). <code>initstate</code> and <code>setstate</code> allow fine-grained
  2151. control over the state of the random number generator.
  2152. </p>
  2153. </dd></dl>
  2154. <dl>
  2155. <dt><a name="index-reconcat"></a>Extension: <em>char*</em> <strong>reconcat</strong> <em>(char *<var>optr</var>, const char *<var>s1</var>, &hellip;, <code>NULL</code>)</em></dt>
  2156. <dd>
  2157. <p>Same as <code>concat</code>, except that if <var>optr</var> is not <code>NULL</code> it
  2158. is freed after the string is created. This is intended to be useful
  2159. when you&rsquo;re extending an existing string or building up a string in a
  2160. loop:
  2161. </p>
  2162. <div class="example">
  2163. <pre class="example"> str = reconcat (str, &quot;pre-&quot;, str, NULL);
  2164. </pre></div>
  2165. </dd></dl>
  2166. <dl>
  2167. <dt><a name="index-rename"></a>Supplemental: <em>int</em> <strong>rename</strong> <em>(const char *<var>old</var>, const char *<var>new</var>)</em></dt>
  2168. <dd>
  2169. <p>Renames a file from <var>old</var> to <var>new</var>. If <var>new</var> already
  2170. exists, it is removed.
  2171. </p>
  2172. </dd></dl>
  2173. <dl>
  2174. <dt><a name="index-rindex"></a>Supplemental: <em>char*</em> <strong>rindex</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
  2175. <dd>
  2176. <p>Returns a pointer to the last occurrence of the character <var>c</var> in
  2177. the string <var>s</var>, or <code>NULL</code> if not found. The use of <code>rindex</code> is
  2178. deprecated in new programs in favor of <code>strrchr</code>.
  2179. </p>
  2180. </dd></dl>
  2181. <dl>
  2182. <dt><a name="index-setenv"></a>Supplemental: <em>int</em> <strong>setenv</strong> <em>(const char *<var>name</var>, const char *<var>value</var>, int <var>overwrite</var>)</em></dt>
  2183. <dt><a name="index-unsetenv"></a>Supplemental: <em>void</em> <strong>unsetenv</strong> <em>(const char *<var>name</var>)</em></dt>
  2184. <dd>
  2185. <p><code>setenv</code> adds <var>name</var> to the environment with value
  2186. <var>value</var>. If the name was already present in the environment,
  2187. the new value will be stored only if <var>overwrite</var> is nonzero.
  2188. The companion <code>unsetenv</code> function removes <var>name</var> from the
  2189. environment. This implementation is not safe for multithreaded code.
  2190. </p>
  2191. </dd></dl>
  2192. <dl>
  2193. <dt><a name="index-setproctitle"></a>Supplemental: <em>void</em> <strong>setproctitle</strong> <em>(const char *<var>fmt</var>, ...)</em></dt>
  2194. <dd>
  2195. <p>Set the title of a process to <var>fmt</var>. va args not supported for now,
  2196. but defined for compatibility with BSD.
  2197. </p>
  2198. </dd></dl>
  2199. <dl>
  2200. <dt><a name="index-signo_005fmax"></a>Extension: <em>int</em> <strong>signo_max</strong> <em>(void)</em></dt>
  2201. <dd>
  2202. <p>Returns the maximum signal value for which a corresponding symbolic
  2203. name or message is available. Note that in the case where we use the
  2204. <code>sys_siglist</code> supplied by the system, it is possible for there to
  2205. be more symbolic names than messages, or vice versa. In fact, the
  2206. manual page for <code>psignal(3b)</code> explicitly warns that one should
  2207. check the size of the table (<code>NSIG</code>) before indexing it, since
  2208. new signal codes may be added to the system before they are added to
  2209. the table. Thus <code>NSIG</code> might be smaller than value implied by
  2210. the largest signo value defined in <code>&lt;signal.h&gt;</code>.
  2211. </p>
  2212. <p>We return the maximum value that can be used to obtain a meaningful
  2213. symbolic name or message.
  2214. </p>
  2215. </dd></dl>
  2216. <dl>
  2217. <dt><a name="index-sigsetmask"></a>Supplemental: <em>int</em> <strong>sigsetmask</strong> <em>(int <var>set</var>)</em></dt>
  2218. <dd>
  2219. <p>Sets the signal mask to the one provided in <var>set</var> and returns
  2220. the old mask (which, for libiberty&rsquo;s implementation, will always
  2221. be the value <code>1</code>).
  2222. </p>
  2223. </dd></dl>
  2224. <dl>
  2225. <dt><a name="index-simple_005fobject_005fattributes_005fcompare"></a>Extension: <em>const char *</em> <strong>simple_object_attributes_compare</strong> <em>(simple_object_attributes *<var>attrs1</var>, simple_object_attributes *<var>attrs2</var>, int *<var>err</var>)</em></dt>
  2226. <dd>
  2227. <p>Compare <var>attrs1</var> and <var>attrs2</var>. If they could be linked
  2228. together without error, return <code>NULL</code>. Otherwise, return an
  2229. error message and set <code>*<var>err</var></code> to an errno value or <code>0</code>
  2230. if there is no relevant errno.
  2231. </p>
  2232. </dd></dl>
  2233. <dl>
  2234. <dt><a name="index-simple_005fobject_005ffetch_005fattributes"></a>Extension: <em>simple_object_attributes *</em> <strong>simple_object_fetch_attributes</strong> <em>(simple_object_read *<var>simple_object</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
  2235. <dd>
  2236. <p>Fetch the attributes of <var>simple_object</var>. The attributes are
  2237. internal information such as the format of the object file, or the
  2238. architecture it was compiled for. This information will persist until
  2239. <code>simple_object_attributes_release</code> is called, even if
  2240. <var>simple_object</var> itself is released.
  2241. </p>
  2242. <p>On error this returns <code>NULL</code>, sets <code>*<var>errmsg</var></code> to an
  2243. error message, and sets <code>*<var>err</var></code> to an errno value or
  2244. <code>0</code> if there is no relevant errno.
  2245. </p>
  2246. </dd></dl>
  2247. <dl>
  2248. <dt><a name="index-simple_005fobject_005ffind_005fsection"></a>Extension: <em>int</em> <strong>simple_object_find_section</strong> <em>(simple_object_read *<var>simple_object</var> off_t *<var>offset</var>, off_t *<var>length</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
  2249. <dd>
  2250. <p>Look for the section <var>name</var> in <var>simple_object</var>. This returns
  2251. information for the first section with that name.
  2252. </p>
  2253. <p>If found, return 1 and set <code>*<var>offset</var></code> to the offset in the
  2254. file of the section contents and set <code>*<var>length</var></code> to the
  2255. length of the section contents. The value in <code>*<var>offset</var></code>
  2256. will be relative to the offset passed to
  2257. <code>simple_object_open_read</code>.
  2258. </p>
  2259. <p>If the section is not found, and no error occurs,
  2260. <code>simple_object_find_section</code> returns <code>0</code> and set
  2261. <code>*<var>errmsg</var></code> to <code>NULL</code>.
  2262. </p>
  2263. <p>If an error occurs, <code>simple_object_find_section</code> returns
  2264. <code>0</code>, sets <code>*<var>errmsg</var></code> to an error message, and sets
  2265. <code>*<var>err</var></code> to an errno value or <code>0</code> if there is no
  2266. relevant errno.
  2267. </p>
  2268. </dd></dl>
  2269. <dl>
  2270. <dt><a name="index-simple_005fobject_005ffind_005fsections"></a>Extension: <em>const char *</em> <strong>simple_object_find_sections</strong> <em>(simple_object_read *<var>simple_object</var>, int (*<var>pfn</var>) (void *<var>data</var>, const char *<var>name</var>, off_t <var>offset</var>, off_t <var>length</var>), void *<var>data</var>, int *<var>err</var>)</em></dt>
  2271. <dd>
  2272. <p>This function calls <var>pfn</var> for each section in <var>simple_object</var>.
  2273. It calls <var>pfn</var> with the section name, the offset within the file
  2274. of the section contents, and the length of the section contents. The
  2275. offset within the file is relative to the offset passed to
  2276. <code>simple_object_open_read</code>. The <var>data</var> argument to this
  2277. function is passed along to <var>pfn</var>.
  2278. </p>
  2279. <p>If <var>pfn</var> returns <code>0</code>, the loop over the sections stops and
  2280. <code>simple_object_find_sections</code> returns. If <var>pfn</var> returns some
  2281. other value, the loop continues.
  2282. </p>
  2283. <p>On success <code>simple_object_find_sections</code> returns. On error it
  2284. returns an error string, and sets <code>*<var>err</var></code> to an errno value
  2285. or <code>0</code> if there is no relevant errno.
  2286. </p>
  2287. </dd></dl>
  2288. <dl>
  2289. <dt><a name="index-simple_005fobject_005fopen_005fread"></a>Extension: <em>simple_object_read *</em> <strong>simple_object_open_read</strong> <em>(int <var>descriptor</var>, off_t <var>offset</var>, const char *segment_name, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
  2290. <dd>
  2291. <p>Opens an object file for reading. Creates and returns an
  2292. <code>simple_object_read</code> pointer which may be passed to other
  2293. functions to extract data from the object file.
  2294. </p>
  2295. <p><var>descriptor</var> holds a file descriptor which permits reading.
  2296. </p>
  2297. <p><var>offset</var> is the offset into the file; this will be <code>0</code> in the
  2298. normal case, but may be a different value when reading an object file
  2299. in an archive file.
  2300. </p>
  2301. <p><var>segment_name</var> is only used with the Mach-O file format used on
  2302. Darwin aka Mac OS X. It is required on that platform, and means to
  2303. only look at sections within the segment with that name. The
  2304. parameter is ignored on other systems.
  2305. </p>
  2306. <p>If an error occurs, this functions returns <code>NULL</code> and sets
  2307. <code>*<var>errmsg</var></code> to an error string and sets <code>*<var>err</var></code> to
  2308. an errno value or <code>0</code> if there is no relevant errno.
  2309. </p>
  2310. </dd></dl>
  2311. <dl>
  2312. <dt><a name="index-simple_005fobject_005frelease_005fattributes"></a>Extension: <em>void</em> <strong>simple_object_release_attributes</strong> <em>(simple_object_attributes *<var>attrs</var>)</em></dt>
  2313. <dd>
  2314. <p>Release all resources associated with <var>attrs</var>.
  2315. </p>
  2316. </dd></dl>
  2317. <dl>
  2318. <dt><a name="index-simple_005fobject_005frelease_005fread"></a>Extension: <em>void</em> <strong>simple_object_release_read</strong> <em>(simple_object_read *<var>simple_object</var>)</em></dt>
  2319. <dd>
  2320. <p>Release all resources associated with <var>simple_object</var>. This does
  2321. not close the file descriptor.
  2322. </p>
  2323. </dd></dl>
  2324. <dl>
  2325. <dt><a name="index-simple_005fobject_005frelease_005fwrite"></a>Extension: <em>void</em> <strong>simple_object_release_write</strong> <em>(simple_object_write *<var>simple_object</var>)</em></dt>
  2326. <dd>
  2327. <p>Release all resources associated with <var>simple_object</var>.
  2328. </p>
  2329. </dd></dl>
  2330. <dl>
  2331. <dt><a name="index-simple_005fobject_005fstart_005fwrite"></a>Extension: <em>simple_object_write *</em> <strong>simple_object_start_write</strong> <em>(simple_object_attributes <var>attrs</var>, const char *<var>segment_name</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
  2332. <dd>
  2333. <p>Start creating a new object file using the object file format
  2334. described in <var>attrs</var>. You must fetch attribute information from
  2335. an existing object file before you can create a new one. There is
  2336. currently no support for creating an object file de novo.
  2337. </p>
  2338. <p><var>segment_name</var> is only used with Mach-O as found on Darwin aka Mac
  2339. OS X. The parameter is required on that target. It means that all
  2340. sections are created within the named segment. It is ignored for
  2341. other object file formats.
  2342. </p>
  2343. <p>On error <code>simple_object_start_write</code> returns <code>NULL</code>, sets
  2344. <code>*<var>ERRMSG</var></code> to an error message, and sets <code>*<var>err</var></code>
  2345. to an errno value or <code>0</code> if there is no relevant errno.
  2346. </p>
  2347. </dd></dl>
  2348. <dl>
  2349. <dt><a name="index-simple_005fobject_005fwrite_005fadd_005fdata"></a>Extension: <em>const char *</em> <strong>simple_object_write_add_data</strong> <em>(simple_object_write *<var>simple_object</var>, simple_object_write_section *<var>section</var>, const void *<var>buffer</var>, size_t <var>size</var>, int <var>copy</var>, int *<var>err</var>)</em></dt>
  2350. <dd>
  2351. <p>Add data <var>buffer</var>/<var>size</var> to <var>section</var> in
  2352. <var>simple_object</var>. If <var>copy</var> is non-zero, the data will be
  2353. copied into memory if necessary. If <var>copy</var> is zero, <var>buffer</var>
  2354. must persist until <code>simple_object_write_to_file</code> is called. is
  2355. released.
  2356. </p>
  2357. <p>On success this returns <code>NULL</code>. On error this returns an error
  2358. message, and sets <code>*<var>err</var></code> to an errno value or 0 if there is
  2359. no relevant erro.
  2360. </p>
  2361. </dd></dl>
  2362. <dl>
  2363. <dt><a name="index-simple_005fobject_005fwrite_005fcreate_005fsection"></a>Extension: <em>simple_object_write_section *</em> <strong>simple_object_write_create_section</strong> <em>(simple_object_write *<var>simple_object</var>, const char *<var>name</var>, unsigned int <var>align</var>, const char **<var>errmsg</var>, int *<var>err</var>)</em></dt>
  2364. <dd>
  2365. <p>Add a section to <var>simple_object</var>. <var>name</var> is the name of the
  2366. new section. <var>align</var> is the required alignment expressed as the
  2367. number of required low-order 0 bits (e.g., 2 for alignment to a 32-bit
  2368. boundary).
  2369. </p>
  2370. <p>The section is created as containing data, readable, not writable, not
  2371. executable, not loaded at runtime. The section is not written to the
  2372. file until <code>simple_object_write_to_file</code> is called.
  2373. </p>
  2374. <p>On error this returns <code>NULL</code>, sets <code>*<var>errmsg</var></code> to an
  2375. error message, and sets <code>*<var>err</var></code> to an errno value or
  2376. <code>0</code> if there is no relevant errno.
  2377. </p>
  2378. </dd></dl>
  2379. <dl>
  2380. <dt><a name="index-simple_005fobject_005fwrite_005fto_005ffile"></a>Extension: <em>const char *</em> <strong>simple_object_write_to_file</strong> <em>(simple_object_write *<var>simple_object</var>, int <var>descriptor</var>, int *<var>err</var>)</em></dt>
  2381. <dd>
  2382. <p>Write the complete object file to <var>descriptor</var>, an open file
  2383. descriptor. This writes out all the data accumulated by calls to
  2384. <code>simple_object_write_create_section</code> and
  2385. <var>simple_object_write_add_data</var>.
  2386. </p>
  2387. <p>This returns <code>NULL</code> on success. On error this returns an error
  2388. message and sets <code>*<var>err</var></code> to an errno value or <code>0</code> if
  2389. there is no relevant errno.
  2390. </p>
  2391. </dd></dl>
  2392. <dl>
  2393. <dt><a name="index-snprintf"></a>Supplemental: <em>int</em> <strong>snprintf</strong> <em>(char *<var>buf</var>, size_t <var>n</var>, const char *<var>format</var>, ...)</em></dt>
  2394. <dd>
  2395. <p>This function is similar to <code>sprintf</code>, but it will write to
  2396. <var>buf</var> at most <code><var>n</var>-1</code> bytes of text, followed by a
  2397. terminating null byte, for a total of <var>n</var> bytes.
  2398. On error the return value is -1, otherwise it returns the number of
  2399. bytes, not including the terminating null byte, that would have been
  2400. written had <var>n</var> been sufficiently large, regardless of the actual
  2401. value of <var>n</var>. Note some pre-C99 system libraries do not implement
  2402. this correctly so users cannot generally rely on the return value if
  2403. the system version of this function is used.
  2404. </p>
  2405. </dd></dl>
  2406. <dl>
  2407. <dt><a name="index-spaces"></a>Extension: <em>char*</em> <strong>spaces</strong> <em>(int <var>count</var>)</em></dt>
  2408. <dd>
  2409. <p>Returns a pointer to a memory region filled with the specified
  2410. number of spaces and null terminated. The returned pointer is
  2411. valid until at least the next call.
  2412. </p>
  2413. </dd></dl>
  2414. <dl>
  2415. <dt><a name="index-splay_005ftree_005fnew_005fwith_005ftyped_005falloc"></a>Supplemental: <em>splay_tree</em> <strong>splay_tree_new_with_typed_alloc</strong> <em>(splay_tree_compare_fn <var>compare_fn</var>, splay_tree_delete_key_fn <var>delete_key_fn</var>, splay_tree_delete_value_fn <var>delete_value_fn</var>, splay_tree_allocate_fn <var>tree_allocate_fn</var>, splay_tree_allocate_fn <var>node_allocate_fn</var>, splay_tree_deallocate_fn <var>deallocate_fn</var>, void * <var>allocate_data</var>)</em></dt>
  2416. <dd>
  2417. <p>This function creates a splay tree that uses two different allocators
  2418. <var>tree_allocate_fn</var> and <var>node_allocate_fn</var> to use for allocating the
  2419. tree itself and its nodes respectively. This is useful when variables of
  2420. different types need to be allocated with different allocators.
  2421. </p>
  2422. <p>The splay tree will use <var>compare_fn</var> to compare nodes,
  2423. <var>delete_key_fn</var> to deallocate keys, and <var>delete_value_fn</var> to
  2424. deallocate values.
  2425. </p>
  2426. </dd></dl>
  2427. <dl>
  2428. <dt><a name="index-stack_005flimit_005fincrease"></a>Extension: <em>void</em> <strong>stack_limit_increase</strong> <em>(unsigned long <var>pref</var>)</em></dt>
  2429. <dd>
  2430. <p>Attempt to increase stack size limit to <var>pref</var> bytes if possible.
  2431. </p>
  2432. </dd></dl>
  2433. <dl>
  2434. <dt><a name="index-stpcpy"></a>Supplemental: <em>char*</em> <strong>stpcpy</strong> <em>(char *<var>dst</var>, const char *<var>src</var>)</em></dt>
  2435. <dd>
  2436. <p>Copies the string <var>src</var> into <var>dst</var>. Returns a pointer to
  2437. <var>dst</var> + strlen(<var>src</var>).
  2438. </p>
  2439. </dd></dl>
  2440. <dl>
  2441. <dt><a name="index-stpncpy"></a>Supplemental: <em>char*</em> <strong>stpncpy</strong> <em>(char *<var>dst</var>, const char *<var>src</var>, size_t <var>len</var>)</em></dt>
  2442. <dd>
  2443. <p>Copies the string <var>src</var> into <var>dst</var>, copying exactly <var>len</var>
  2444. and padding with zeros if necessary. If <var>len</var> &lt; strlen(<var>src</var>)
  2445. then return <var>dst</var> + <var>len</var>, otherwise returns <var>dst</var> +
  2446. strlen(<var>src</var>).
  2447. </p>
  2448. </dd></dl>
  2449. <dl>
  2450. <dt><a name="index-strcasecmp"></a>Supplemental: <em>int</em> <strong>strcasecmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
  2451. <dd>
  2452. <p>A case-insensitive <code>strcmp</code>.
  2453. </p>
  2454. </dd></dl>
  2455. <dl>
  2456. <dt><a name="index-strchr"></a>Supplemental: <em>char*</em> <strong>strchr</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
  2457. <dd>
  2458. <p>Returns a pointer to the first occurrence of the character <var>c</var> in
  2459. the string <var>s</var>, or <code>NULL</code> if not found. If <var>c</var> is itself the
  2460. null character, the results are undefined.
  2461. </p>
  2462. </dd></dl>
  2463. <dl>
  2464. <dt><a name="index-strdup"></a>Supplemental: <em>char*</em> <strong>strdup</strong> <em>(const char *<var>s</var>)</em></dt>
  2465. <dd>
  2466. <p>Returns a pointer to a copy of <var>s</var> in memory obtained from
  2467. <code>malloc</code>, or <code>NULL</code> if insufficient memory was available.
  2468. </p>
  2469. </dd></dl>
  2470. <dl>
  2471. <dt><a name="index-strerrno"></a>Replacement: <em>const char*</em> <strong>strerrno</strong> <em>(int <var>errnum</var>)</em></dt>
  2472. <dd>
  2473. <p>Given an error number returned from a system call (typically returned
  2474. in <code>errno</code>), returns a pointer to a string containing the
  2475. symbolic name of that error number, as found in <code>&lt;errno.h&gt;</code>.
  2476. </p>
  2477. <p>If the supplied error number is within the valid range of indices for
  2478. symbolic names, but no name is available for the particular error
  2479. number, then returns the string &lsquo;<samp>Error <var>num</var></samp>&rsquo;, where <var>num</var>
  2480. is the error number.
  2481. </p>
  2482. <p>If the supplied error number is not within the range of valid
  2483. indices, then returns <code>NULL</code>.
  2484. </p>
  2485. <p>The contents of the location pointed to are only guaranteed to be
  2486. valid until the next call to <code>strerrno</code>.
  2487. </p>
  2488. </dd></dl>
  2489. <dl>
  2490. <dt><a name="index-strerror"></a>Supplemental: <em>char*</em> <strong>strerror</strong> <em>(int <var>errnoval</var>)</em></dt>
  2491. <dd>
  2492. <p>Maps an <code>errno</code> number to an error message string, the contents
  2493. of which are implementation defined. On systems which have the
  2494. external variables <code>sys_nerr</code> and <code>sys_errlist</code>, these
  2495. strings will be the same as the ones used by <code>perror</code>.
  2496. </p>
  2497. <p>If the supplied error number is within the valid range of indices for
  2498. the <code>sys_errlist</code>, but no message is available for the particular
  2499. error number, then returns the string &lsquo;<samp>Error <var>num</var></samp>&rsquo;, where
  2500. <var>num</var> is the error number.
  2501. </p>
  2502. <p>If the supplied error number is not a valid index into
  2503. <code>sys_errlist</code>, returns <code>NULL</code>.
  2504. </p>
  2505. <p>The returned string is only guaranteed to be valid only until the
  2506. next call to <code>strerror</code>.
  2507. </p>
  2508. </dd></dl>
  2509. <dl>
  2510. <dt><a name="index-strncasecmp"></a>Supplemental: <em>int</em> <strong>strncasecmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
  2511. <dd>
  2512. <p>A case-insensitive <code>strncmp</code>.
  2513. </p>
  2514. </dd></dl>
  2515. <dl>
  2516. <dt><a name="index-strncmp"></a>Supplemental: <em>int</em> <strong>strncmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>, size_t <var>n</var>)</em></dt>
  2517. <dd>
  2518. <p>Compares the first <var>n</var> bytes of two strings, returning a value as
  2519. <code>strcmp</code>.
  2520. </p>
  2521. </dd></dl>
  2522. <dl>
  2523. <dt><a name="index-strndup"></a>Extension: <em>char*</em> <strong>strndup</strong> <em>(const char *<var>s</var>, size_t <var>n</var>)</em></dt>
  2524. <dd>
  2525. <p>Returns a pointer to a copy of <var>s</var> with at most <var>n</var> characters
  2526. in memory obtained from <code>malloc</code>, or <code>NULL</code> if insufficient
  2527. memory was available. The result is always NUL terminated.
  2528. </p>
  2529. </dd></dl>
  2530. <dl>
  2531. <dt><a name="index-strnlen"></a>Supplemental: <em>size_t</em> <strong>strnlen</strong> <em>(const char *<var>s</var>, size_t <var>maxlen</var>)</em></dt>
  2532. <dd>
  2533. <p>Returns the length of <var>s</var>, as with <code>strlen</code>, but never looks
  2534. past the first <var>maxlen</var> characters in the string. If there is no
  2535. &rsquo;\0&rsquo; character in the first <var>maxlen</var> characters, returns
  2536. <var>maxlen</var>.
  2537. </p>
  2538. </dd></dl>
  2539. <dl>
  2540. <dt><a name="index-strrchr"></a>Supplemental: <em>char*</em> <strong>strrchr</strong> <em>(const char *<var>s</var>, int <var>c</var>)</em></dt>
  2541. <dd>
  2542. <p>Returns a pointer to the last occurrence of the character <var>c</var> in
  2543. the string <var>s</var>, or <code>NULL</code> if not found. If <var>c</var> is itself the
  2544. null character, the results are undefined.
  2545. </p>
  2546. </dd></dl>
  2547. <dl>
  2548. <dt><a name="index-strsignal"></a>Supplemental: <em>const char *</em> <strong>strsignal</strong> <em>(int <var>signo</var>)</em></dt>
  2549. <dd>
  2550. <p>Maps an signal number to an signal message string, the contents of
  2551. which are implementation defined. On systems which have the external
  2552. variable <code>sys_siglist</code>, these strings will be the same as the
  2553. ones used by <code>psignal()</code>.
  2554. </p>
  2555. <p>If the supplied signal number is within the valid range of indices for
  2556. the <code>sys_siglist</code>, but no message is available for the particular
  2557. signal number, then returns the string &lsquo;<samp>Signal <var>num</var></samp>&rsquo;, where
  2558. <var>num</var> is the signal number.
  2559. </p>
  2560. <p>If the supplied signal number is not a valid index into
  2561. <code>sys_siglist</code>, returns <code>NULL</code>.
  2562. </p>
  2563. <p>The returned string is only guaranteed to be valid only until the next
  2564. call to <code>strsignal</code>.
  2565. </p>
  2566. </dd></dl>
  2567. <dl>
  2568. <dt><a name="index-strsigno"></a>Extension: <em>const char*</em> <strong>strsigno</strong> <em>(int <var>signo</var>)</em></dt>
  2569. <dd>
  2570. <p>Given an signal number, returns a pointer to a string containing the
  2571. symbolic name of that signal number, as found in <code>&lt;signal.h&gt;</code>.
  2572. </p>
  2573. <p>If the supplied signal number is within the valid range of indices for
  2574. symbolic names, but no name is available for the particular signal
  2575. number, then returns the string &lsquo;<samp>Signal <var>num</var></samp>&rsquo;, where
  2576. <var>num</var> is the signal number.
  2577. </p>
  2578. <p>If the supplied signal number is not within the range of valid
  2579. indices, then returns <code>NULL</code>.
  2580. </p>
  2581. <p>The contents of the location pointed to are only guaranteed to be
  2582. valid until the next call to <code>strsigno</code>.
  2583. </p>
  2584. </dd></dl>
  2585. <dl>
  2586. <dt><a name="index-strstr"></a>Supplemental: <em>char*</em> <strong>strstr</strong> <em>(const char *<var>string</var>, const char *<var>sub</var>)</em></dt>
  2587. <dd>
  2588. <p>This function searches for the substring <var>sub</var> in the string
  2589. <var>string</var>, not including the terminating null characters. A pointer
  2590. to the first occurrence of <var>sub</var> is returned, or <code>NULL</code> if the
  2591. substring is absent. If <var>sub</var> points to a string with zero
  2592. length, the function returns <var>string</var>.
  2593. </p>
  2594. </dd></dl>
  2595. <dl>
  2596. <dt><a name="index-strtod"></a>Supplemental: <em>double</em> <strong>strtod</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>)</em></dt>
  2597. <dd>
  2598. <p>This ISO C function converts the initial portion of <var>string</var> to a
  2599. <code>double</code>. If <var>endptr</var> is not <code>NULL</code>, a pointer to the
  2600. character after the last character used in the conversion is stored in
  2601. the location referenced by <var>endptr</var>. If no conversion is
  2602. performed, zero is returned and the value of <var>string</var> is stored in
  2603. the location referenced by <var>endptr</var>.
  2604. </p>
  2605. </dd></dl>
  2606. <dl>
  2607. <dt><a name="index-strtoerrno"></a>Extension: <em>int</em> <strong>strtoerrno</strong> <em>(const char *<var>name</var>)</em></dt>
  2608. <dd>
  2609. <p>Given the symbolic name of a error number (e.g., <code>EACCES</code>), map it
  2610. to an errno value. If no translation is found, returns 0.
  2611. </p>
  2612. </dd></dl>
  2613. <dl>
  2614. <dt><a name="index-strtol"></a>Supplemental: <em>long int</em> <strong>strtol</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
  2615. <dt><a name="index-strtoul"></a>Supplemental: <em>unsigned long int</em> <strong>strtoul</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
  2616. <dd>
  2617. <p>The <code>strtol</code> function converts the string in <var>string</var> to a
  2618. long integer value according to the given <var>base</var>, which must be
  2619. between 2 and 36 inclusive, or be the special value 0. If <var>base</var>
  2620. is 0, <code>strtol</code> will look for the prefixes <code>0</code> and <code>0x</code>
  2621. to indicate bases 8 and 16, respectively, else default to base 10.
  2622. When the base is 16 (either explicitly or implicitly), a prefix of
  2623. <code>0x</code> is allowed. The handling of <var>endptr</var> is as that of
  2624. <code>strtod</code> above. The <code>strtoul</code> function is the same, except
  2625. that the converted value is unsigned.
  2626. </p>
  2627. </dd></dl>
  2628. <dl>
  2629. <dt><a name="index-strtoll"></a>Supplemental: <em>long long int</em> <strong>strtoll</strong> <em>(const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
  2630. <dt><a name="index-strtoul-1"></a>Supplemental: <em>unsigned long long int</em> <strong>strtoul</strong> <em>( const char *<var>string</var>, char **<var>endptr</var>, int <var>base</var>)</em></dt>
  2631. <dd>
  2632. <p>The <code>strtoll</code> function converts the string in <var>string</var> to a
  2633. long long integer value according to the given <var>base</var>, which must be
  2634. between 2 and 36 inclusive, or be the special value 0. If <var>base</var>
  2635. is 0, <code>strtoll</code> will look for the prefixes <code>0</code> and <code>0x</code>
  2636. to indicate bases 8 and 16, respectively, else default to base 10.
  2637. When the base is 16 (either explicitly or implicitly), a prefix of
  2638. <code>0x</code> is allowed. The handling of <var>endptr</var> is as that of
  2639. <code>strtod</code> above. The <code>strtoull</code> function is the same, except
  2640. that the converted value is unsigned.
  2641. </p>
  2642. </dd></dl>
  2643. <dl>
  2644. <dt><a name="index-strtosigno"></a>Extension: <em>int</em> <strong>strtosigno</strong> <em>(const char *<var>name</var>)</em></dt>
  2645. <dd>
  2646. <p>Given the symbolic name of a signal, map it to a signal number. If no
  2647. translation is found, returns 0.
  2648. </p>
  2649. </dd></dl>
  2650. <dl>
  2651. <dt><a name="index-strverscmp"></a>Function: <em>int</em> <strong>strverscmp</strong> <em>(const char *<var>s1</var>, const char *<var>s2</var>)</em></dt>
  2652. <dd><p>The <code>strverscmp</code> function compares the string <var>s1</var> against
  2653. <var>s2</var>, considering them as holding indices/version numbers. Return
  2654. value follows the same conventions as found in the <code>strverscmp</code>
  2655. function. In fact, if <var>s1</var> and <var>s2</var> contain no digits,
  2656. <code>strverscmp</code> behaves like <code>strcmp</code>.
  2657. </p>
  2658. <p>Basically, we compare strings normally (character by character), until
  2659. we find a digit in each string - then we enter a special comparison
  2660. mode, where each sequence of digits is taken as a whole. If we reach the
  2661. end of these two parts without noticing a difference, we return to the
  2662. standard comparison mode. There are two types of numeric parts:
  2663. &quot;integral&quot; and &quot;fractional&quot; (those begin with a &rsquo;0&rsquo;). The types
  2664. of the numeric parts affect the way we sort them:
  2665. </p>
  2666. <ul>
  2667. <li> integral/integral: we compare values as you would expect.
  2668. </li><li> fractional/integral: the fractional part is less than the integral one.
  2669. Again, no surprise.
  2670. </li><li> fractional/fractional: the things become a bit more complex.
  2671. If the common prefix contains only leading zeroes, the longest part is less
  2672. than the other one; else the comparison behaves normally.
  2673. </li></ul>
  2674. <div class="smallexample">
  2675. <pre class="smallexample">strverscmp (&quot;no digit&quot;, &quot;no digit&quot;)
  2676. &rArr; 0 // <span class="roman">same behavior as strcmp.</span>
  2677. strverscmp (&quot;item#99&quot;, &quot;item#100&quot;)
  2678. &rArr; &lt;0 // <span class="roman">same prefix, but 99 &lt; 100.</span>
  2679. strverscmp (&quot;alpha1&quot;, &quot;alpha001&quot;)
  2680. &rArr; &gt;0 // <span class="roman">fractional part inferior to integral one.</span>
  2681. strverscmp (&quot;part1_f012&quot;, &quot;part1_f01&quot;)
  2682. &rArr; &gt;0 // <span class="roman">two fractional parts.</span>
  2683. strverscmp (&quot;foo.009&quot;, &quot;foo.0&quot;)
  2684. &rArr; &lt;0 // <span class="roman">idem, but with leading zeroes only.</span>
  2685. </pre></div>
  2686. <p>This function is especially useful when dealing with filename sorting,
  2687. because filenames frequently hold indices/version numbers.
  2688. </p></dd></dl>
  2689. <dl>
  2690. <dt><a name="index-timeval_005fadd"></a>Extension: <em>void</em> <strong>timeval_add</strong> <em>(struct timeval *<var>a</var>, struct timeval *<var>b</var>, struct timeval *<var>result</var>)</em></dt>
  2691. <dd>
  2692. <p>Adds <var>a</var> to <var>b</var> and stores the result in <var>result</var>.
  2693. </p>
  2694. </dd></dl>
  2695. <dl>
  2696. <dt><a name="index-timeval_005fsub"></a>Extension: <em>void</em> <strong>timeval_sub</strong> <em>(struct timeval *<var>a</var>, struct timeval *<var>b</var>, struct timeval *<var>result</var>)</em></dt>
  2697. <dd>
  2698. <p>Subtracts <var>b</var> from <var>a</var> and stores the result in <var>result</var>.
  2699. </p>
  2700. </dd></dl>
  2701. <dl>
  2702. <dt><a name="index-tmpnam"></a>Supplemental: <em>char*</em> <strong>tmpnam</strong> <em>(char *<var>s</var>)</em></dt>
  2703. <dd>
  2704. <p>This function attempts to create a name for a temporary file, which
  2705. will be a valid file name yet not exist when <code>tmpnam</code> checks for
  2706. it. <var>s</var> must point to a buffer of at least <code>L_tmpnam</code> bytes,
  2707. or be <code>NULL</code>. Use of this function creates a security risk, and it must
  2708. not be used in new projects. Use <code>mkstemp</code> instead.
  2709. </p>
  2710. </dd></dl>
  2711. <dl>
  2712. <dt><a name="index-unlink_005fif_005fordinary"></a>Supplemental: <em>int</em> <strong>unlink_if_ordinary</strong> <em>(const char*)</em></dt>
  2713. <dd>
  2714. <p>Unlinks the named file, unless it is special (e.g. a device file).
  2715. Returns 0 when the file was unlinked, a negative value (and errno set) when
  2716. there was an error deleting the file, and a positive value if no attempt
  2717. was made to unlink the file because it is special.
  2718. </p>
  2719. </dd></dl>
  2720. <dl>
  2721. <dt><a name="index-unlock_005fstd_005fstreams"></a>Extension: <em>void</em> <strong>unlock_std_streams</strong> <em>(void)</em></dt>
  2722. <dd>
  2723. <p>If the OS supports it, ensure that the standard I/O streams,
  2724. <code>stdin</code>, <code>stdout</code> and <code>stderr</code> are setup to avoid any
  2725. multi-threaded locking. Otherwise do nothing.
  2726. </p>
  2727. </dd></dl>
  2728. <dl>
  2729. <dt><a name="index-unlock_005fstream"></a>Extension: <em>void</em> <strong>unlock_stream</strong> <em>(FILE * <var>stream</var>)</em></dt>
  2730. <dd>
  2731. <p>If the OS supports it, ensure that the supplied stream is setup to
  2732. avoid any multi-threaded locking. Otherwise leave the <code>FILE</code>
  2733. pointer unchanged. If the <var>stream</var> is <code>NULL</code> do nothing.
  2734. </p>
  2735. </dd></dl>
  2736. <dl>
  2737. <dt><a name="index-vasprintf"></a>Extension: <em>int</em> <strong>vasprintf</strong> <em>(char **<var>resptr</var>, const char *<var>format</var>, va_list <var>args</var>)</em></dt>
  2738. <dd>
  2739. <p>Like <code>vsprintf</code>, but instead of passing a pointer to a buffer,
  2740. you pass a pointer to a pointer. This function will compute the size
  2741. of the buffer needed, allocate memory with <code>malloc</code>, and store a
  2742. pointer to the allocated memory in <code>*<var>resptr</var></code>. The value
  2743. returned is the same as <code>vsprintf</code> would return. If memory could
  2744. not be allocated, minus one is returned and <code>NULL</code> is stored in
  2745. <code>*<var>resptr</var></code>.
  2746. </p>
  2747. </dd></dl>
  2748. <dl>
  2749. <dt><a name="index-vfork"></a>Supplemental: <em>int</em> <strong>vfork</strong> <em>(void)</em></dt>
  2750. <dd>
  2751. <p>Emulates <code>vfork</code> by calling <code>fork</code> and returning its value.
  2752. </p>
  2753. </dd></dl>
  2754. <dl>
  2755. <dt><a name="index-vprintf"></a>Supplemental: <em>int</em> <strong>vprintf</strong> <em>(const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
  2756. <dt><a name="index-vfprintf"></a>Supplemental: <em>int</em> <strong>vfprintf</strong> <em>(FILE *<var>stream</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
  2757. <dt><a name="index-vsprintf"></a>Supplemental: <em>int</em> <strong>vsprintf</strong> <em>(char *<var>str</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
  2758. <dd>
  2759. <p>These functions are the same as <code>printf</code>, <code>fprintf</code>, and
  2760. <code>sprintf</code>, respectively, except that they are called with a
  2761. <code>va_list</code> instead of a variable number of arguments. Note that
  2762. they do not call <code>va_end</code>; this is the application&rsquo;s
  2763. responsibility. In <code>libiberty</code> they are implemented in terms of the
  2764. nonstandard but common function <code>_doprnt</code>.
  2765. </p>
  2766. </dd></dl>
  2767. <dl>
  2768. <dt><a name="index-vsnprintf"></a>Supplemental: <em>int</em> <strong>vsnprintf</strong> <em>(char *<var>buf</var>, size_t <var>n</var>, const char *<var>format</var>, va_list <var>ap</var>)</em></dt>
  2769. <dd>
  2770. <p>This function is similar to <code>vsprintf</code>, but it will write to
  2771. <var>buf</var> at most <code><var>n</var>-1</code> bytes of text, followed by a
  2772. terminating null byte, for a total of <var>n</var> bytes. On error the
  2773. return value is -1, otherwise it returns the number of characters that
  2774. would have been printed had <var>n</var> been sufficiently large,
  2775. regardless of the actual value of <var>n</var>. Note some pre-C99 system
  2776. libraries do not implement this correctly so users cannot generally
  2777. rely on the return value if the system version of this function is
  2778. used.
  2779. </p>
  2780. </dd></dl>
  2781. <dl>
  2782. <dt><a name="index-waitpid"></a>Supplemental: <em>int</em> <strong>waitpid</strong> <em>(int <var>pid</var>, int *<var>status</var>, int)</em></dt>
  2783. <dd>
  2784. <p>This is a wrapper around the <code>wait</code> function. Any &ldquo;special&rdquo;
  2785. values of <var>pid</var> depend on your implementation of <code>wait</code>, as
  2786. does the return value. The third argument is unused in <code>libiberty</code>.
  2787. </p>
  2788. </dd></dl>
  2789. <dl>
  2790. <dt><a name="index-writeargv"></a>Extension: <em>int</em> <strong>writeargv</strong> <em>(char * const *<var>argv</var>, FILE *<var>file</var>)</em></dt>
  2791. <dd>
  2792. <p>Write each member of ARGV, handling all necessary quoting, to the file
  2793. named by FILE, separated by whitespace. Return 0 on success, non-zero
  2794. if an error occurred while writing to FILE.
  2795. </p>
  2796. </dd></dl>
  2797. <dl>
  2798. <dt><a name="index-xasprintf"></a>Replacement: <em>char*</em> <strong>xasprintf</strong> <em>(const char *<var>format</var>, ...)</em></dt>
  2799. <dd>
  2800. <p>Print to allocated string without fail. If <code>xasprintf</code> fails,
  2801. this will print a message to <code>stderr</code> (using the name set by
  2802. <code>xmalloc_set_program_name</code>, if any) and then call <code>xexit</code>.
  2803. </p>
  2804. </dd></dl>
  2805. <dl>
  2806. <dt><a name="index-xatexit"></a>Function: <em>int</em> <strong>xatexit</strong> <em>(void (*<var>fn</var>) (void))</em></dt>
  2807. <dd>
  2808. <p>Behaves as the standard <code>atexit</code> function, but with no limit on
  2809. the number of registered functions. Returns 0 on success, or -1 on
  2810. failure. If you use <code>xatexit</code> to register functions, you must use
  2811. <code>xexit</code> to terminate your program.
  2812. </p>
  2813. </dd></dl>
  2814. <dl>
  2815. <dt><a name="index-xcalloc"></a>Replacement: <em>void*</em> <strong>xcalloc</strong> <em>(size_t <var>nelem</var>, size_t <var>elsize</var>)</em></dt>
  2816. <dd>
  2817. <p>Allocate memory without fail, and set it to zero. This routine functions
  2818. like <code>calloc</code>, but will behave the same as <code>xmalloc</code> if memory
  2819. cannot be found.
  2820. </p>
  2821. </dd></dl>
  2822. <dl>
  2823. <dt><a name="index-xexit"></a>Replacement: <em>void</em> <strong>xexit</strong> <em>(int <var>code</var>)</em></dt>
  2824. <dd>
  2825. <p>Terminates the program. If any functions have been registered with
  2826. the <code>xatexit</code> replacement function, they will be called first.
  2827. Termination is handled via the system&rsquo;s normal <code>exit</code> call.
  2828. </p>
  2829. </dd></dl>
  2830. <dl>
  2831. <dt><a name="index-xmalloc"></a>Replacement: <em>void*</em> <strong>xmalloc</strong> <em>(size_t)</em></dt>
  2832. <dd>
  2833. <p>Allocate memory without fail. If <code>malloc</code> fails, this will print
  2834. a message to <code>stderr</code> (using the name set by
  2835. <code>xmalloc_set_program_name</code>,
  2836. if any) and then call <code>xexit</code>. Note that it is therefore safe for
  2837. a program to contain <code>#define malloc xmalloc</code> in its source.
  2838. </p>
  2839. </dd></dl>
  2840. <dl>
  2841. <dt><a name="index-xmalloc_005ffailed"></a>Replacement: <em>void</em> <strong>xmalloc_failed</strong> <em>(size_t)</em></dt>
  2842. <dd>
  2843. <p>This function is not meant to be called by client code, and is listed
  2844. here for completeness only. If any of the allocation routines fail, this
  2845. function will be called to print an error message and terminate execution.
  2846. </p>
  2847. </dd></dl>
  2848. <dl>
  2849. <dt><a name="index-xmalloc_005fset_005fprogram_005fname"></a>Replacement: <em>void</em> <strong>xmalloc_set_program_name</strong> <em>(const char *<var>name</var>)</em></dt>
  2850. <dd>
  2851. <p>You can use this to set the name of the program used by
  2852. <code>xmalloc_failed</code> when printing a failure message.
  2853. </p>
  2854. </dd></dl>
  2855. <dl>
  2856. <dt><a name="index-xmemdup"></a>Replacement: <em>void*</em> <strong>xmemdup</strong> <em>(void *<var>input</var>, size_t <var>copy_size</var>, size_t <var>alloc_size</var>)</em></dt>
  2857. <dd>
  2858. <p>Duplicates a region of memory without fail. First, <var>alloc_size</var> bytes
  2859. are allocated, then <var>copy_size</var> bytes from <var>input</var> are copied into
  2860. it, and the new memory is returned. If fewer bytes are copied than were
  2861. allocated, the remaining memory is zeroed.
  2862. </p>
  2863. </dd></dl>
  2864. <dl>
  2865. <dt><a name="index-xrealloc"></a>Replacement: <em>void*</em> <strong>xrealloc</strong> <em>(void *<var>ptr</var>, size_t <var>size</var>)</em></dt>
  2866. <dd><p>Reallocate memory without fail. This routine functions like <code>realloc</code>,
  2867. but will behave the same as <code>xmalloc</code> if memory cannot be found.
  2868. </p>
  2869. </dd></dl>
  2870. <dl>
  2871. <dt><a name="index-xstrdup"></a>Replacement: <em>char*</em> <strong>xstrdup</strong> <em>(const char *<var>s</var>)</em></dt>
  2872. <dd>
  2873. <p>Duplicates a character string without fail, using <code>xmalloc</code> to
  2874. obtain memory.
  2875. </p>
  2876. </dd></dl>
  2877. <dl>
  2878. <dt><a name="index-xstrerror"></a>Replacement: <em>char*</em> <strong>xstrerror</strong> <em>(int <var>errnum</var>)</em></dt>
  2879. <dd>
  2880. <p>Behaves exactly like the standard <code>strerror</code> function, but
  2881. will never return a <code>NULL</code> pointer.
  2882. </p>
  2883. </dd></dl>
  2884. <dl>
  2885. <dt><a name="index-xstrndup"></a>Replacement: <em>char*</em> <strong>xstrndup</strong> <em>(const char *<var>s</var>, size_t <var>n</var>)</em></dt>
  2886. <dd>
  2887. <p>Returns a pointer to a copy of <var>s</var> with at most <var>n</var> characters
  2888. without fail, using <code>xmalloc</code> to obtain memory. The result is
  2889. always NUL terminated.
  2890. </p>
  2891. </dd></dl>
  2892. <dl>
  2893. <dt><a name="index-xvasprintf"></a>Replacement: <em>char*</em> <strong>xvasprintf</strong> <em>(const char *<var>format</var>, va_list <var>args</var>)</em></dt>
  2894. <dd>
  2895. <p>Print to allocated string without fail. If <code>xvasprintf</code> fails,
  2896. this will print a message to <code>stderr</code> (using the name set by
  2897. <code>xmalloc_set_program_name</code>, if any) and then call <code>xexit</code>.
  2898. </p>
  2899. </dd></dl>
  2900. <hr>
  2901. <a name="Licenses"></a>
  2902. <div class="header">
  2903. <p>
  2904. Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Functions" accesskey="p" rel="prev">Functions</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  2905. </div>
  2906. <a name="Licenses-1"></a>
  2907. <h2 class="appendix">Appendix A Licenses</h2>
  2908. <table class="menu" border="0" cellspacing="0">
  2909. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  2910. </pre></th></tr><tr><td align="left" valign="top">&bull; <a href="#Library-Copying" accesskey="1">Library Copying</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The GNU Library General Public License
  2911. </td></tr>
  2912. <tr><td align="left" valign="top">&bull; <a href="#BSD" accesskey="2">BSD</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Regents of the University of California
  2913. </td></tr>
  2914. <tr><th colspan="3" align="left" valign="top"><pre class="menu-comment">
  2915. </pre></th></tr></table>
  2916. <hr>
  2917. <a name="Library-Copying"></a>
  2918. <div class="header">
  2919. <p>
  2920. Next: <a href="#BSD" accesskey="n" rel="next">BSD</a>, Up: <a href="#Licenses" accesskey="u" rel="up">Licenses</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  2921. </div>
  2922. <a name="GNU-LESSER-GENERAL-PUBLIC-LICENSE"></a>
  2923. <h3 class="appendixsec">A.1 GNU LESSER GENERAL PUBLIC LICENSE</h3>
  2924. <a name="index-LGPL_002c-Lesser-General-Public-License"></a>
  2925. <div align="center">Version 2.1, February 1999
  2926. </div>
  2927. <div class="display">
  2928. <pre class="display">Copyright &copy; 1991-2017 Free Software Foundation, Inc.
  2929. 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA
  2930. Everyone is permitted to copy and distribute verbatim copies
  2931. of this license document, but changing it is not allowed.
  2932. [This is the first released version of the Lesser GPL. It also counts
  2933. as the successor of the GNU Library Public License, version 2, hence the
  2934. version number 2.1.]
  2935. </pre></div>
  2936. <a name="Preamble"></a>
  2937. <h4 class="appendixsubsec">A.1.1 Preamble</h4>
  2938. <p>The licenses for most software are designed to take away your
  2939. freedom to share and change it. By contrast, the GNU General Public
  2940. Licenses are intended to guarantee your freedom to share and change
  2941. free software&mdash;to make sure the software is free for all its users.
  2942. </p>
  2943. <p>This license, the Lesser General Public License, applies to some
  2944. specially designated software&mdash;typically libraries&mdash;of the Free
  2945. Software Foundation and other authors who decide to use it. You can use
  2946. it too, but we suggest you first think carefully about whether this
  2947. license or the ordinary General Public License is the better strategy to
  2948. use in any particular case, based on the explanations below.
  2949. </p>
  2950. <p>When we speak of free software, we are referring to freedom of use,
  2951. not price. Our General Public Licenses are designed to make sure that
  2952. you have the freedom to distribute copies of free software (and charge
  2953. for this service if you wish); that you receive source code or can get
  2954. it if you want it; that you can change the software and use pieces of it
  2955. in new free programs; and that you are informed that you can do these
  2956. things.
  2957. </p>
  2958. <p>To protect your rights, we need to make restrictions that forbid
  2959. distributors to deny you these rights or to ask you to surrender these
  2960. rights. These restrictions translate to certain responsibilities for
  2961. you if you distribute copies of the library or if you modify it.
  2962. </p>
  2963. <p>For example, if you distribute copies of the library, whether gratis
  2964. or for a fee, you must give the recipients all the rights that we gave
  2965. you. You must make sure that they, too, receive or can get the source
  2966. code. If you link other code with the library, you must provide
  2967. complete object files to the recipients, so that they can relink them
  2968. with the library after making changes to the library and recompiling
  2969. it. And you must show them these terms so they know their rights.
  2970. </p>
  2971. <p>We protect your rights with a two-step method: (1) we copyright the
  2972. library, and (2) we offer you this license, which gives you legal
  2973. permission to copy, distribute and/or modify the library.
  2974. </p>
  2975. <p>To protect each distributor, we want to make it very clear that
  2976. there is no warranty for the free library. Also, if the library is
  2977. modified by someone else and passed on, the recipients should know
  2978. that what they have is not the original version, so that the original
  2979. author&rsquo;s reputation will not be affected by problems that might be
  2980. introduced by others.
  2981. </p>
  2982. <p>Finally, software patents pose a constant threat to the existence of
  2983. any free program. We wish to make sure that a company cannot
  2984. effectively restrict the users of a free program by obtaining a
  2985. restrictive license from a patent holder. Therefore, we insist that
  2986. any patent license obtained for a version of the library must be
  2987. consistent with the full freedom of use specified in this license.
  2988. </p>
  2989. <p>Most GNU software, including some libraries, is covered by the
  2990. ordinary GNU General Public License. This license, the GNU Lesser
  2991. General Public License, applies to certain designated libraries, and
  2992. is quite different from the ordinary General Public License. We use
  2993. this license for certain libraries in order to permit linking those
  2994. libraries into non-free programs.
  2995. </p>
  2996. <p>When a program is linked with a library, whether statically or using
  2997. a shared library, the combination of the two is legally speaking a
  2998. combined work, a derivative of the original library. The ordinary
  2999. General Public License therefore permits such linking only if the
  3000. entire combination fits its criteria of freedom. The Lesser General
  3001. Public License permits more lax criteria for linking other code with
  3002. the library.
  3003. </p>
  3004. <p>We call this license the <em>Lesser</em> General Public License because it
  3005. does <em>Less</em> to protect the user&rsquo;s freedom than the ordinary General
  3006. Public License. It also provides other free software developers Less
  3007. of an advantage over competing non-free programs. These disadvantages
  3008. are the reason we use the ordinary General Public License for many
  3009. libraries. However, the Lesser license provides advantages in certain
  3010. special circumstances.
  3011. </p>
  3012. <p>For example, on rare occasions, there may be a special need to
  3013. encourage the widest possible use of a certain library, so that it becomes
  3014. a de-facto standard. To achieve this, non-free programs must be
  3015. allowed to use the library. A more frequent case is that a free
  3016. library does the same job as widely used non-free libraries. In this
  3017. case, there is little to gain by limiting the free library to free
  3018. software only, so we use the Lesser General Public License.
  3019. </p>
  3020. <p>In other cases, permission to use a particular library in non-free
  3021. programs enables a greater number of people to use a large body of
  3022. free software. For example, permission to use the GNU C Library in
  3023. non-free programs enables many more people to use the whole GNU
  3024. operating system, as well as its variant, the GNU/Linux operating
  3025. system.
  3026. </p>
  3027. <p>Although the Lesser General Public License is Less protective of the
  3028. users&rsquo; freedom, it does ensure that the user of a program that is
  3029. linked with the Library has the freedom and the wherewithal to run
  3030. that program using a modified version of the Library.
  3031. </p>
  3032. <p>The precise terms and conditions for copying, distribution and
  3033. modification follow. Pay close attention to the difference between a
  3034. &ldquo;work based on the library&rdquo; and a &ldquo;work that uses the library&rdquo;. The
  3035. former contains code derived from the library, whereas the latter must
  3036. be combined with the library in order to run.
  3037. </p>
  3038. <ol>
  3039. <li> This License Agreement applies to any software library or other program
  3040. which contains a notice placed by the copyright holder or other
  3041. authorized party saying it may be distributed under the terms of this
  3042. Lesser General Public License (also called &ldquo;this License&rdquo;). Each
  3043. licensee is addressed as &ldquo;you&rdquo;.
  3044. <p>A &ldquo;library&rdquo; means a collection of software functions and/or data
  3045. prepared so as to be conveniently linked with application programs
  3046. (which use some of those functions and data) to form executables.
  3047. </p>
  3048. <p>The &ldquo;Library&rdquo;, below, refers to any such software library or work
  3049. which has been distributed under these terms. A &ldquo;work based on the
  3050. Library&rdquo; means either the Library or any derivative work under
  3051. copyright law: that is to say, a work containing the Library or a
  3052. portion of it, either verbatim or with modifications and/or translated
  3053. straightforwardly into another language. (Hereinafter, translation is
  3054. included without limitation in the term &ldquo;modification&rdquo;.)
  3055. </p>
  3056. <p>&ldquo;Source code&rdquo; for a work means the preferred form of the work for
  3057. making modifications to it. For a library, complete source code means
  3058. all the source code for all modules it contains, plus any associated
  3059. interface definition files, plus the scripts used to control compilation
  3060. and installation of the library.
  3061. </p>
  3062. <p>Activities other than copying, distribution and modification are not
  3063. covered by this License; they are outside its scope. The act of
  3064. running a program using the Library is not restricted, and output from
  3065. such a program is covered only if its contents constitute a work based
  3066. on the Library (independent of the use of the Library in a tool for
  3067. writing it). Whether that is true depends on what the Library does
  3068. and what the program that uses the Library does.
  3069. </p>
  3070. </li><li> You may copy and distribute verbatim copies of the Library&rsquo;s
  3071. complete source code as you receive it, in any medium, provided that
  3072. you conspicuously and appropriately publish on each copy an
  3073. appropriate copyright notice and disclaimer of warranty; keep intact
  3074. all the notices that refer to this License and to the absence of any
  3075. warranty; and distribute a copy of this License along with the
  3076. Library.
  3077. <p>You may charge a fee for the physical act of transferring a copy,
  3078. and you may at your option offer warranty protection in exchange for a
  3079. fee.
  3080. </p>
  3081. </li><li> You may modify your copy or copies of the Library or any portion
  3082. of it, thus forming a work based on the Library, and copy and
  3083. distribute such modifications or work under the terms of Section 1
  3084. above, provided that you also meet all of these conditions:
  3085. <ol>
  3086. <li> The modified work must itself be a software library.
  3087. </li><li> You must cause the files modified to carry prominent notices
  3088. stating that you changed the files and the date of any change.
  3089. </li><li> You must cause the whole of the work to be licensed at no
  3090. charge to all third parties under the terms of this License.
  3091. </li><li> If a facility in the modified Library refers to a function or a
  3092. table of data to be supplied by an application program that uses
  3093. the facility, other than as an argument passed when the facility
  3094. is invoked, then you must make a good faith effort to ensure that,
  3095. in the event an application does not supply such function or
  3096. table, the facility still operates, and performs whatever part of
  3097. its purpose remains meaningful.
  3098. <p>(For example, a function in a library to compute square roots has
  3099. a purpose that is entirely well-defined independent of the
  3100. application. Therefore, Subsection 2d requires that any
  3101. application-supplied function or table used by this function must
  3102. be optional: if the application does not supply it, the square
  3103. root function must still compute square roots.)
  3104. </p></li></ol>
  3105. <p>These requirements apply to the modified work as a whole. If
  3106. identifiable sections of that work are not derived from the Library,
  3107. and can be reasonably considered independent and separate works in
  3108. themselves, then this License, and its terms, do not apply to those
  3109. sections when you distribute them as separate works. But when you
  3110. distribute the same sections as part of a whole which is a work based
  3111. on the Library, the distribution of the whole must be on the terms of
  3112. this License, whose permissions for other licensees extend to the
  3113. entire whole, and thus to each and every part regardless of who wrote
  3114. it.
  3115. </p>
  3116. <p>Thus, it is not the intent of this section to claim rights or contest
  3117. your rights to work written entirely by you; rather, the intent is to
  3118. exercise the right to control the distribution of derivative or
  3119. collective works based on the Library.
  3120. </p>
  3121. <p>In addition, mere aggregation of another work not based on the Library
  3122. with the Library (or with a work based on the Library) on a volume of
  3123. a storage or distribution medium does not bring the other work under
  3124. the scope of this License.
  3125. </p>
  3126. </li><li> You may opt to apply the terms of the ordinary GNU General Public
  3127. License instead of this License to a given copy of the Library. To do
  3128. this, you must alter all the notices that refer to this License, so
  3129. that they refer to the ordinary GNU General Public License, version 2,
  3130. instead of to this License. (If a newer version than version 2 of the
  3131. ordinary GNU General Public License has appeared, then you can specify
  3132. that version instead if you wish.) Do not make any other change in
  3133. these notices.
  3134. <p>Once this change is made in a given copy, it is irreversible for
  3135. that copy, so the ordinary GNU General Public License applies to all
  3136. subsequent copies and derivative works made from that copy.
  3137. </p>
  3138. <p>This option is useful when you wish to copy part of the code of
  3139. the Library into a program that is not a library.
  3140. </p>
  3141. </li><li> You may copy and distribute the Library (or a portion or
  3142. derivative of it, under Section 2) in object code or executable form
  3143. under the terms of Sections 1 and 2 above provided that you accompany
  3144. it with the complete corresponding machine-readable source code, which
  3145. must be distributed under the terms of Sections 1 and 2 above on a
  3146. medium customarily used for software interchange.
  3147. <p>If distribution of object code is made by offering access to copy
  3148. from a designated place, then offering equivalent access to copy the
  3149. source code from the same place satisfies the requirement to
  3150. distribute the source code, even though third parties are not
  3151. compelled to copy the source along with the object code.
  3152. </p>
  3153. </li><li> A program that contains no derivative of any portion of the
  3154. Library, but is designed to work with the Library by being compiled or
  3155. linked with it, is called a &ldquo;work that uses the Library&rdquo;. Such a
  3156. work, in isolation, is not a derivative work of the Library, and
  3157. therefore falls outside the scope of this License.
  3158. <p>However, linking a &ldquo;work that uses the Library&rdquo; with the Library
  3159. creates an executable that is a derivative of the Library (because it
  3160. contains portions of the Library), rather than a &ldquo;work that uses the
  3161. library&rdquo;. The executable is therefore covered by this License.
  3162. Section 6 states terms for distribution of such executables.
  3163. </p>
  3164. <p>When a &ldquo;work that uses the Library&rdquo; uses material from a header file
  3165. that is part of the Library, the object code for the work may be a
  3166. derivative work of the Library even though the source code is not.
  3167. Whether this is true is especially significant if the work can be
  3168. linked without the Library, or if the work is itself a library. The
  3169. threshold for this to be true is not precisely defined by law.
  3170. </p>
  3171. <p>If such an object file uses only numerical parameters, data
  3172. structure layouts and accessors, and small macros and small inline
  3173. functions (ten lines or less in length), then the use of the object
  3174. file is unrestricted, regardless of whether it is legally a derivative
  3175. work. (Executables containing this object code plus portions of the
  3176. Library will still fall under Section 6.)
  3177. </p>
  3178. <p>Otherwise, if the work is a derivative of the Library, you may
  3179. distribute the object code for the work under the terms of Section 6.
  3180. Any executables containing that work also fall under Section 6,
  3181. whether or not they are linked directly with the Library itself.
  3182. </p>
  3183. </li><li> As an exception to the Sections above, you may also combine or
  3184. link a &ldquo;work that uses the Library&rdquo; with the Library to produce a
  3185. work containing portions of the Library, and distribute that work
  3186. under terms of your choice, provided that the terms permit
  3187. modification of the work for the customer&rsquo;s own use and reverse
  3188. engineering for debugging such modifications.
  3189. <p>You must give prominent notice with each copy of the work that the
  3190. Library is used in it and that the Library and its use are covered by
  3191. this License. You must supply a copy of this License. If the work
  3192. during execution displays copyright notices, you must include the
  3193. copyright notice for the Library among them, as well as a reference
  3194. directing the user to the copy of this License. Also, you must do one
  3195. of these things:
  3196. </p>
  3197. <ol>
  3198. <li> Accompany the work with the complete corresponding
  3199. machine-readable source code for the Library including whatever
  3200. changes were used in the work (which must be distributed under
  3201. Sections 1 and 2 above); and, if the work is an executable linked
  3202. with the Library, with the complete machine-readable &ldquo;work that
  3203. uses the Library&rdquo;, as object code and/or source code, so that the
  3204. user can modify the Library and then relink to produce a modified
  3205. executable containing the modified Library. (It is understood
  3206. that the user who changes the contents of definitions files in the
  3207. Library will not necessarily be able to recompile the application
  3208. to use the modified definitions.)
  3209. </li><li> Use a suitable shared library mechanism for linking with the Library. A
  3210. suitable mechanism is one that (1) uses at run time a copy of the
  3211. library already present on the user&rsquo;s computer system, rather than
  3212. copying library functions into the executable, and (2) will operate
  3213. properly with a modified version of the library, if the user installs
  3214. one, as long as the modified version is interface-compatible with the
  3215. version that the work was made with.
  3216. </li><li> Accompany the work with a written offer, valid for at
  3217. least three years, to give the same user the materials
  3218. specified in Subsection 6a, above, for a charge no more
  3219. than the cost of performing this distribution.
  3220. </li><li> If distribution of the work is made by offering access to copy
  3221. from a designated place, offer equivalent access to copy the above
  3222. specified materials from the same place.
  3223. </li><li> Verify that the user has already received a copy of these
  3224. materials or that you have already sent this user a copy.
  3225. </li></ol>
  3226. <p>For an executable, the required form of the &ldquo;work that uses the
  3227. Library&rdquo; must include any data and utility programs needed for
  3228. reproducing the executable from it. However, as a special exception,
  3229. the materials to be distributed need not include anything that is
  3230. normally distributed (in either source or binary form) with the major
  3231. components (compiler, kernel, and so on) of the operating system on
  3232. which the executable runs, unless that component itself accompanies the
  3233. executable.
  3234. </p>
  3235. <p>It may happen that this requirement contradicts the license
  3236. restrictions of other proprietary libraries that do not normally
  3237. accompany the operating system. Such a contradiction means you cannot
  3238. use both them and the Library together in an executable that you
  3239. distribute.
  3240. </p>
  3241. </li><li> You may place library facilities that are a work based on the
  3242. Library side-by-side in a single library together with other library
  3243. facilities not covered by this License, and distribute such a combined
  3244. library, provided that the separate distribution of the work based on
  3245. the Library and of the other library facilities is otherwise
  3246. permitted, and provided that you do these two things:
  3247. <ol>
  3248. <li> Accompany the combined library with a copy of the same work
  3249. based on the Library, uncombined with any other library
  3250. facilities. This must be distributed under the terms of the
  3251. Sections above.
  3252. </li><li> Give prominent notice with the combined library of the fact
  3253. that part of it is a work based on the Library, and explaining
  3254. where to find the accompanying uncombined form of the same work.
  3255. </li></ol>
  3256. </li><li> You may not copy, modify, sublicense, link with, or distribute
  3257. the Library except as expressly provided under this License. Any
  3258. attempt otherwise to copy, modify, sublicense, link with, or
  3259. distribute the Library is void, and will automatically terminate your
  3260. rights under this License. However, parties who have received copies,
  3261. or rights, from you under this License will not have their licenses
  3262. terminated so long as such parties remain in full compliance.
  3263. </li><li> You are not required to accept this License, since you have not
  3264. signed it. However, nothing else grants you permission to modify or
  3265. distribute the Library or its derivative works. These actions are
  3266. prohibited by law if you do not accept this License. Therefore, by
  3267. modifying or distributing the Library (or any work based on the
  3268. Library), you indicate your acceptance of this License to do so, and
  3269. all its terms and conditions for copying, distributing or modifying
  3270. the Library or works based on it.
  3271. </li><li> Each time you redistribute the Library (or any work based on the
  3272. Library), the recipient automatically receives a license from the
  3273. original licensor to copy, distribute, link with or modify the Library
  3274. subject to these terms and conditions. You may not impose any further
  3275. restrictions on the recipients&rsquo; exercise of the rights granted herein.
  3276. You are not responsible for enforcing compliance by third parties with
  3277. this License.
  3278. </li><li> If, as a consequence of a court judgment or allegation of patent
  3279. infringement or for any other reason (not limited to patent issues),
  3280. conditions are imposed on you (whether by court order, agreement or
  3281. otherwise) that contradict the conditions of this License, they do not
  3282. excuse you from the conditions of this License. If you cannot
  3283. distribute so as to satisfy simultaneously your obligations under this
  3284. License and any other pertinent obligations, then as a consequence you
  3285. may not distribute the Library at all. For example, if a patent
  3286. license would not permit royalty-free redistribution of the Library by
  3287. all those who receive copies directly or indirectly through you, then
  3288. the only way you could satisfy both it and this License would be to
  3289. refrain entirely from distribution of the Library.
  3290. <p>If any portion of this section is held invalid or unenforceable under any
  3291. particular circumstance, the balance of the section is intended to apply,
  3292. and the section as a whole is intended to apply in other circumstances.
  3293. </p>
  3294. <p>It is not the purpose of this section to induce you to infringe any
  3295. patents or other property right claims or to contest validity of any
  3296. such claims; this section has the sole purpose of protecting the
  3297. integrity of the free software distribution system which is
  3298. implemented by public license practices. Many people have made
  3299. generous contributions to the wide range of software distributed
  3300. through that system in reliance on consistent application of that
  3301. system; it is up to the author/donor to decide if he or she is willing
  3302. to distribute software through any other system and a licensee cannot
  3303. impose that choice.
  3304. </p>
  3305. <p>This section is intended to make thoroughly clear what is believed to
  3306. be a consequence of the rest of this License.
  3307. </p>
  3308. </li><li> If the distribution and/or use of the Library is restricted in
  3309. certain countries either by patents or by copyrighted interfaces, the
  3310. original copyright holder who places the Library under this License may add
  3311. an explicit geographical distribution limitation excluding those countries,
  3312. so that distribution is permitted only in or among countries not thus
  3313. excluded. In such case, this License incorporates the limitation as if
  3314. written in the body of this License.
  3315. </li><li> The Free Software Foundation may publish revised and/or new
  3316. versions of the Lesser General Public License from time to time.
  3317. Such new versions will be similar in spirit to the present version,
  3318. but may differ in detail to address new problems or concerns.
  3319. <p>Each version is given a distinguishing version number. If the Library
  3320. specifies a version number of this License which applies to it and
  3321. &ldquo;any later version&rdquo;, you have the option of following the terms and
  3322. conditions either of that version or of any later version published by
  3323. the Free Software Foundation. If the Library does not specify a
  3324. license version number, you may choose any version ever published by
  3325. the Free Software Foundation.
  3326. </p>
  3327. </li><li> If you wish to incorporate parts of the Library into other free
  3328. programs whose distribution conditions are incompatible with these,
  3329. write to the author to ask for permission. For software which is
  3330. copyrighted by the Free Software Foundation, write to the Free
  3331. Software Foundation; we sometimes make exceptions for this. Our
  3332. decision will be guided by the two goals of preserving the free status
  3333. of all derivatives of our free software and of promoting the sharing
  3334. and reuse of software generally.
  3335. <div align="center">NO WARRANTY
  3336. </div>
  3337. </li><li> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
  3338. WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
  3339. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
  3340. OTHER PARTIES PROVIDE THE LIBRARY &ldquo;AS IS&rdquo; WITHOUT WARRANTY OF ANY
  3341. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
  3342. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  3343. PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
  3344. LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
  3345. THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
  3346. </li><li> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  3347. WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
  3348. AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
  3349. FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
  3350. CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
  3351. LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
  3352. RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
  3353. FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
  3354. SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  3355. DAMAGES.
  3356. </li></ol>
  3357. <a name="How-to-Apply-These-Terms-to-Your-New-Libraries"></a>
  3358. <h4 class="appendixsubsec">A.1.2 How to Apply These Terms to Your New Libraries</h4>
  3359. <p>If you develop a new library, and you want it to be of the greatest
  3360. possible use to the public, we recommend making it free software that
  3361. everyone can redistribute and change. You can do so by permitting
  3362. redistribution under these terms (or, alternatively, under the terms of the
  3363. ordinary General Public License).
  3364. </p>
  3365. <p>To apply these terms, attach the following notices to the library. It is
  3366. safest to attach them to the start of each source file to most effectively
  3367. convey the exclusion of warranty; and each file should have at least the
  3368. &ldquo;copyright&rdquo; line and a pointer to where the full notice is found.
  3369. </p>
  3370. <div class="smallexample">
  3371. <pre class="smallexample"><var>one line to give the library's name and an idea of what it does.</var>
  3372. Copyright (C) <var>year</var> <var>name of author</var>
  3373. This library is free software; you can redistribute it and/or modify it
  3374. under the terms of the GNU Lesser General Public License as published by
  3375. the Free Software Foundation; either version 2.1 of the License, or (at
  3376. your option) any later version.
  3377. This library is distributed in the hope that it will be useful, but
  3378. WITHOUT ANY WARRANTY; without even the implied warranty of
  3379. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  3380. Lesser General Public License for more details.
  3381. You should have received a copy of the GNU Lesser General Public
  3382. License along with this library; if not, write to the Free Software
  3383. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  3384. USA.
  3385. </pre></div>
  3386. <p>Also add information on how to contact you by electronic and paper mail.
  3387. </p>
  3388. <p>You should also get your employer (if you work as a programmer) or your
  3389. school, if any, to sign a &ldquo;copyright disclaimer&rdquo; for the library, if
  3390. necessary. Here is a sample; alter the names:
  3391. </p>
  3392. <div class="smallexample">
  3393. <pre class="smallexample">Yoyodyne, Inc., hereby disclaims all copyright interest in the library
  3394. `Frob' (a library for tweaking knobs) written by James Random Hacker.
  3395. <var>signature of Ty Coon</var>, 1 April 1990
  3396. Ty Coon, President of Vice
  3397. </pre></div>
  3398. <p>That&rsquo;s all there is to it!
  3399. </p>
  3400. <hr>
  3401. <a name="BSD"></a>
  3402. <div class="header">
  3403. <p>
  3404. Previous: <a href="#Library-Copying" accesskey="p" rel="prev">Library Copying</a>, Up: <a href="#Licenses" accesskey="u" rel="up">Licenses</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  3405. </div>
  3406. <a name="BSD-1"></a>
  3407. <h3 class="appendixsec">A.2 BSD</h3>
  3408. <p>Copyright &copy; 1990 Regents of the University of California.
  3409. All rights reserved.
  3410. </p>
  3411. <p>Redistribution and use in source and binary forms, with or without
  3412. modification, are permitted provided that the following conditions
  3413. are met:
  3414. </p>
  3415. <ol>
  3416. <li> Redistributions of source code must retain the above copyright
  3417. notice, this list of conditions and the following disclaimer.
  3418. </li><li> Redistributions in binary form must reproduce the above copyright
  3419. notice, this list of conditions and the following disclaimer in the
  3420. documentation and/or other materials provided with the distribution.
  3421. </li><li> [rescinded 22 July 1999]
  3422. </li><li> Neither the name of the University nor the names of its contributors
  3423. may be used to endorse or promote products derived from this software
  3424. without specific prior written permission.
  3425. </li></ol>
  3426. <p>THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS &ldquo;AS IS&rdquo; AND
  3427. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  3428. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  3429. ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  3430. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  3431. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  3432. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  3433. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  3434. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  3435. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  3436. SUCH DAMAGE.
  3437. </p>
  3438. <hr>
  3439. <a name="Index"></a>
  3440. <div class="header">
  3441. <p>
  3442. Previous: <a href="#Licenses" accesskey="p" rel="prev">Licenses</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="#Index" title="Index" rel="index">Index</a>]</p>
  3443. </div>
  3444. <a name="Index-1"></a>
  3445. <h2 class="unnumbered">Index</h2>
  3446. <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-A"><b>A</b></a>
  3447. &nbsp;
  3448. <a class="summary-letter" href="#Index_cp_letter-B"><b>B</b></a>
  3449. &nbsp;
  3450. <a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
  3451. &nbsp;
  3452. <a class="summary-letter" href="#Index_cp_letter-D"><b>D</b></a>
  3453. &nbsp;
  3454. <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
  3455. &nbsp;
  3456. <a class="summary-letter" href="#Index_cp_letter-F"><b>F</b></a>
  3457. &nbsp;
  3458. <a class="summary-letter" href="#Index_cp_letter-G"><b>G</b></a>
  3459. &nbsp;
  3460. <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
  3461. &nbsp;
  3462. <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
  3463. &nbsp;
  3464. <a class="summary-letter" href="#Index_cp_letter-L"><b>L</b></a>
  3465. &nbsp;
  3466. <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
  3467. &nbsp;
  3468. <a class="summary-letter" href="#Index_cp_letter-O"><b>O</b></a>
  3469. &nbsp;
  3470. <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
  3471. &nbsp;
  3472. <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
  3473. &nbsp;
  3474. <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
  3475. &nbsp;
  3476. <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
  3477. &nbsp;
  3478. <a class="summary-letter" href="#Index_cp_letter-U"><b>U</b></a>
  3479. &nbsp;
  3480. <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
  3481. &nbsp;
  3482. <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
  3483. &nbsp;
  3484. <a class="summary-letter" href="#Index_cp_letter-X"><b>X</b></a>
  3485. &nbsp;
  3486. </td></tr></table>
  3487. <table class="index-cp" border="0">
  3488. <tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
  3489. <tr><td colspan="4"> <hr></td></tr>
  3490. <tr><th><a name="Index_cp_letter-A">A</a></th><td></td><td></td></tr>
  3491. <tr><td></td><td valign="top"><a href="#index-alignment-_0028in-obstacks_0029">alignment (in obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a></td></tr>
  3492. <tr><td></td><td valign="top"><a href="#index-alloca"><code>alloca</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3493. <tr><td></td><td valign="top"><a href="#index-allocation-_0028obstacks_0029">allocation (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
  3494. <tr><td></td><td valign="top"><a href="#index-asprintf"><code>asprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3495. <tr><td></td><td valign="top"><a href="#index-atexit"><code>atexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3496. <tr><td colspan="4"> <hr></td></tr>
  3497. <tr><th><a name="Index_cp_letter-B">B</a></th><td></td><td></td></tr>
  3498. <tr><td></td><td valign="top"><a href="#index-basename"><code>basename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3499. <tr><td></td><td valign="top"><a href="#index-bcmp"><code>bcmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3500. <tr><td></td><td valign="top"><a href="#index-bcopy"><code>bcopy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3501. <tr><td></td><td valign="top"><a href="#index-bsearch"><code>bsearch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3502. <tr><td></td><td valign="top"><a href="#index-buildargv"><code>buildargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3503. <tr><td></td><td valign="top"><a href="#index-bzero"><code>bzero</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3504. <tr><td colspan="4"> <hr></td></tr>
  3505. <tr><th><a name="Index_cp_letter-C">C</a></th><td></td><td></td></tr>
  3506. <tr><td></td><td valign="top"><a href="#index-calloc"><code>calloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3507. <tr><td></td><td valign="top"><a href="#index-canonical_005ffilename_005feq"><code>canonical_filename_eq</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3508. <tr><td></td><td valign="top"><a href="#index-changing-the-size-of-a-block-_0028obstacks_0029">changing the size of a block (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3509. <tr><td></td><td valign="top"><a href="#index-char_002a"><code>char*</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3510. <tr><td></td><td valign="top"><a href="#index-choose_005ftemp_005fbase"><code>choose_temp_base</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3511. <tr><td></td><td valign="top"><a href="#index-chunks">chunks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
  3512. <tr><td></td><td valign="top"><a href="#index-clock"><code>clock</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3513. <tr><td></td><td valign="top"><a href="#index-concat"><code>concat</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3514. <tr><td></td><td valign="top"><a href="#index-countargv"><code>countargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3515. <tr><td></td><td valign="top"><a href="#index-crc32"><code>crc32</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3516. <tr><td colspan="4"> <hr></td></tr>
  3517. <tr><th><a name="Index_cp_letter-D">D</a></th><td></td><td></td></tr>
  3518. <tr><td></td><td valign="top"><a href="#index-dupargv"><code>dupargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3519. <tr><td colspan="4"> <hr></td></tr>
  3520. <tr><th><a name="Index_cp_letter-E">E</a></th><td></td><td></td></tr>
  3521. <tr><td></td><td valign="top"><a href="#index-efficiency-and-obstacks">efficiency and obstacks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3522. <tr><td></td><td valign="top"><a href="#index-efficiency-of-chunks">efficiency of chunks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
  3523. <tr><td></td><td valign="top"><a href="#index-errno_005fmax"><code>errno_max</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3524. <tr><td></td><td valign="top"><a href="#index-error-reporting">error reporting</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Error-Reporting">Error Reporting</a></td></tr>
  3525. <tr><td></td><td valign="top"><a href="#index-exit-handlers">exit handlers</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Exit-Handlers">Exit Handlers</a></td></tr>
  3526. <tr><td></td><td valign="top"><a href="#index-expandargv"><code>expandargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3527. <tr><td></td><td valign="top"><a href="#index-extensions">extensions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensions">Extensions</a></td></tr>
  3528. <tr><td colspan="4"> <hr></td></tr>
  3529. <tr><th><a name="Index_cp_letter-F">F</a></th><td></td><td></td></tr>
  3530. <tr><td></td><td valign="top"><a href="#index-fdmatch"><code>fdmatch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3531. <tr><td></td><td valign="top"><a href="#index-fdopen_005funlocked"><code>fdopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3532. <tr><td></td><td valign="top"><a href="#index-ffs"><code>ffs</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3533. <tr><td></td><td valign="top"><a href="#index-filename_005fcmp"><code>filename_cmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3534. <tr><td></td><td valign="top"><a href="#index-filename_005feq"><code>filename_eq</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3535. <tr><td></td><td valign="top"><a href="#index-filename_005fhash"><code>filename_hash</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3536. <tr><td></td><td valign="top"><a href="#index-filename_005fncmp"><code>filename_ncmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3537. <tr><td></td><td valign="top"><a href="#index-fnmatch"><code>fnmatch</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3538. <tr><td></td><td valign="top"><a href="#index-fopen_005funlocked"><code>fopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3539. <tr><td></td><td valign="top"><a href="#index-freeargv"><code>freeargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3540. <tr><td></td><td valign="top"><a href="#index-freeing-_0028obstacks_0029">freeing (obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a></td></tr>
  3541. <tr><td></td><td valign="top"><a href="#index-freopen_005funlocked"><code>freopen_unlocked</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3542. <tr><td></td><td valign="top"><a href="#index-functions_002c-extension">functions, extension</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extensions">Extensions</a></td></tr>
  3543. <tr><td></td><td valign="top"><a href="#index-functions_002c-missing">functions, missing</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
  3544. <tr><td></td><td valign="top"><a href="#index-functions_002c-replacement">functions, replacement</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Replacement-Functions">Replacement Functions</a></td></tr>
  3545. <tr><td></td><td valign="top"><a href="#index-functions_002c-supplemental">functions, supplemental</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
  3546. <tr><td colspan="4"> <hr></td></tr>
  3547. <tr><th><a name="Index_cp_letter-G">G</a></th><td></td><td></td></tr>
  3548. <tr><td></td><td valign="top"><a href="#index-getcwd"><code>getcwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3549. <tr><td></td><td valign="top"><a href="#index-getpagesize"><code>getpagesize</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3550. <tr><td></td><td valign="top"><a href="#index-getpwd"><code>getpwd</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3551. <tr><td></td><td valign="top"><a href="#index-gettimeofday"><code>gettimeofday</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3552. <tr><td></td><td valign="top"><a href="#index-get_005frun_005ftime"><code>get_run_time</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3553. <tr><td></td><td valign="top"><a href="#index-growing-objects-_0028in-obstacks_0029">growing objects (in obstacks)</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3554. <tr><td colspan="4"> <hr></td></tr>
  3555. <tr><th><a name="Index_cp_letter-H">H</a></th><td></td><td></td></tr>
  3556. <tr><td></td><td valign="top"><a href="#index-hex_005finit"><code>hex_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3557. <tr><td></td><td valign="top"><a href="#index-hex_005fp"><code>hex_p</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3558. <tr><td></td><td valign="top"><a href="#index-hex_005fvalue"><code>hex_value</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3559. <tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET"><code>HOST_CHARSET</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3560. <tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fASCII"><code>HOST_CHARSET_ASCII</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3561. <tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fEBCDIC"><code>HOST_CHARSET_EBCDIC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3562. <tr><td></td><td valign="top"><a href="#index-HOST_005fCHARSET_005fUNKNOWN"><code>HOST_CHARSET_UNKNOWN</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3563. <tr><td></td><td valign="top"><a href="#index-how-to-use">how to use</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
  3564. <tr><td></td><td valign="top"><a href="#index-htab_005fcreate_005ftyped_005falloc"><code>htab_create_typed_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3565. <tr><td colspan="4"> <hr></td></tr>
  3566. <tr><th><a name="Index_cp_letter-I">I</a></th><td></td><td></td></tr>
  3567. <tr><td></td><td valign="top"><a href="#index-index"><code>index</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3568. <tr><td></td><td valign="top"><a href="#index-initstate"><code>initstate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3569. <tr><td></td><td valign="top"><a href="#index-insque"><code>insque</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3570. <tr><td></td><td valign="top"><a href="#index-ISALNUM"><code>ISALNUM</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3571. <tr><td></td><td valign="top"><a href="#index-ISALPHA"><code>ISALPHA</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3572. <tr><td></td><td valign="top"><a href="#index-ISBLANK"><code>ISBLANK</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3573. <tr><td></td><td valign="top"><a href="#index-ISCNTRL"><code>ISCNTRL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3574. <tr><td></td><td valign="top"><a href="#index-ISDIGIT"><code>ISDIGIT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3575. <tr><td></td><td valign="top"><a href="#index-ISGRAPH"><code>ISGRAPH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3576. <tr><td></td><td valign="top"><a href="#index-ISIDNUM"><code>ISIDNUM</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3577. <tr><td></td><td valign="top"><a href="#index-ISIDST"><code>ISIDST</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3578. <tr><td></td><td valign="top"><a href="#index-ISLOWER"><code>ISLOWER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3579. <tr><td></td><td valign="top"><a href="#index-ISPRINT"><code>ISPRINT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3580. <tr><td></td><td valign="top"><a href="#index-ISPUNCT"><code>ISPUNCT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3581. <tr><td></td><td valign="top"><a href="#index-ISSPACE"><code>ISSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3582. <tr><td></td><td valign="top"><a href="#index-ISUPPER"><code>ISUPPER</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3583. <tr><td></td><td valign="top"><a href="#index-ISXDIGIT"><code>ISXDIGIT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3584. <tr><td></td><td valign="top"><a href="#index-IS_005fISOBASIC"><code>IS_ISOBASIC</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3585. <tr><td></td><td valign="top"><a href="#index-IS_005fNVSPACE"><code>IS_NVSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3586. <tr><td></td><td valign="top"><a href="#index-IS_005fSPACE_005fOR_005fNUL"><code>IS_SPACE_OR_NUL</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3587. <tr><td></td><td valign="top"><a href="#index-IS_005fVSPACE"><code>IS_VSPACE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3588. <tr><td colspan="4"> <hr></td></tr>
  3589. <tr><th><a name="Index_cp_letter-L">L</a></th><td></td><td></td></tr>
  3590. <tr><td></td><td valign="top"><a href="#index-lbasename"><code>lbasename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3591. <tr><td></td><td valign="top"><a href="#index-LGPL_002c-Lesser-General-Public-License">LGPL, Lesser General Public License</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Library-Copying">Library Copying</a></td></tr>
  3592. <tr><td></td><td valign="top"><a href="#index-libiberty-usage">libiberty usage</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
  3593. <tr><td></td><td valign="top"><a href="#index-lrealpath"><code>lrealpath</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3594. <tr><td colspan="4"> <hr></td></tr>
  3595. <tr><th><a name="Index_cp_letter-M">M</a></th><td></td><td></td></tr>
  3596. <tr><td></td><td valign="top"><a href="#index-macros">macros</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Functions">Obstack Functions</a></td></tr>
  3597. <tr><td></td><td valign="top"><a href="#index-make_005frelative_005fprefix"><code>make_relative_prefix</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3598. <tr><td></td><td valign="top"><a href="#index-make_005ftemp_005ffile"><code>make_temp_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3599. <tr><td></td><td valign="top"><a href="#index-memchr"><code>memchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3600. <tr><td></td><td valign="top"><a href="#index-memcmp"><code>memcmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3601. <tr><td></td><td valign="top"><a href="#index-memcpy"><code>memcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3602. <tr><td></td><td valign="top"><a href="#index-memmem"><code>memmem</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3603. <tr><td></td><td valign="top"><a href="#index-memmove"><code>memmove</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3604. <tr><td></td><td valign="top"><a href="#index-memory-allocation">memory allocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Memory-Allocation">Memory Allocation</a></td></tr>
  3605. <tr><td></td><td valign="top"><a href="#index-mempcpy"><code>mempcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3606. <tr><td></td><td valign="top"><a href="#index-memset"><code>memset</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3607. <tr><td></td><td valign="top"><a href="#index-mkstemps"><code>mkstemps</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3608. <tr><td colspan="4"> <hr></td></tr>
  3609. <tr><th><a name="Index_cp_letter-O">O</a></th><td></td><td></td></tr>
  3610. <tr><td></td><td valign="top"><a href="#index-obstack-status">obstack status</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
  3611. <tr><td></td><td valign="top"><a href="#index-obstack_002eh"><code>obstack.h</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Creating-Obstacks">Creating Obstacks</a></td></tr>
  3612. <tr><td></td><td valign="top"><a href="#index-obstacks">obstacks</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks">Obstacks</a></td></tr>
  3613. <tr><td></td><td valign="top"><a href="#index-obstack_005f1grow"><code>obstack_1grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3614. <tr><td></td><td valign="top"><a href="#index-obstack_005f1grow_005ffast"><code>obstack_1grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3615. <tr><td></td><td valign="top"><a href="#index-obstack_005falignment_005fmask"><code>obstack_alignment_mask</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstacks-Data-Alignment">Obstacks Data Alignment</a></td></tr>
  3616. <tr><td></td><td valign="top"><a href="#index-obstack_005falloc"><code>obstack_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
  3617. <tr><td></td><td valign="top"><a href="#index-obstack_005falloc_005ffailed_005fhandler"><code>obstack_alloc_failed_handler</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3618. <tr><td></td><td valign="top"><a href="#index-obstack_005fbase"><code>obstack_base</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
  3619. <tr><td></td><td valign="top"><a href="#index-obstack_005fbegin"><code>obstack_begin</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3620. <tr><td></td><td valign="top"><a href="#index-obstack_005fblank"><code>obstack_blank</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3621. <tr><td></td><td valign="top"><a href="#index-obstack_005fblank_005ffast"><code>obstack_blank_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3622. <tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005falloc"><code>obstack_chunk_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3623. <tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005ffree"><code>obstack_chunk_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3624. <tr><td></td><td valign="top"><a href="#index-obstack_005fchunk_005fsize"><code>obstack_chunk_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Obstack-Chunks">Obstack Chunks</a></td></tr>
  3625. <tr><td></td><td valign="top"><a href="#index-obstack_005fcopy"><code>obstack_copy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
  3626. <tr><td></td><td valign="top"><a href="#index-obstack_005fcopy0"><code>obstack_copy0</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Allocation-in-an-Obstack">Allocation in an Obstack</a></td></tr>
  3627. <tr><td></td><td valign="top"><a href="#index-obstack_005ffinish"><code>obstack_finish</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3628. <tr><td></td><td valign="top"><a href="#index-obstack_005ffree"><code>obstack_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Freeing-Obstack-Objects">Freeing Obstack Objects</a></td></tr>
  3629. <tr><td></td><td valign="top"><a href="#index-obstack_005fgrow"><code>obstack_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3630. <tr><td></td><td valign="top"><a href="#index-obstack_005fgrow0"><code>obstack_grow0</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3631. <tr><td></td><td valign="top"><a href="#index-obstack_005finit"><code>obstack_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3632. <tr><td></td><td valign="top"><a href="#index-obstack_005fint_005fgrow"><code>obstack_int_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3633. <tr><td></td><td valign="top"><a href="#index-obstack_005fint_005fgrow_005ffast"><code>obstack_int_grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3634. <tr><td></td><td valign="top"><a href="#index-obstack_005fnext_005ffree"><code>obstack_next_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
  3635. <tr><td></td><td valign="top"><a href="#index-obstack_005fobject_005fsize"><code>obstack_object_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3636. <tr><td></td><td valign="top"><a href="#index-obstack_005fobject_005fsize-1"><code>obstack_object_size</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
  3637. <tr><td></td><td valign="top"><a href="#index-obstack_005fptr_005fgrow"><code>obstack_ptr_grow</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Growing-Objects">Growing Objects</a></td></tr>
  3638. <tr><td></td><td valign="top"><a href="#index-obstack_005fptr_005fgrow_005ffast"><code>obstack_ptr_grow_fast</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3639. <tr><td></td><td valign="top"><a href="#index-obstack_005froom"><code>obstack_room</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3640. <tr><td></td><td valign="top"><a href="#index-obstack_005fspecify_005fallocation"><code>obstack_specify_allocation</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3641. <tr><td></td><td valign="top"><a href="#index-obstack_005fspecify_005fallocation_005fwith_005farg"><code>obstack_specify_allocation_with_arg</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Preparing-for-Obstacks">Preparing for Obstacks</a></td></tr>
  3642. <tr><td colspan="4"> <hr></td></tr>
  3643. <tr><th><a name="Index_cp_letter-P">P</a></th><td></td><td></td></tr>
  3644. <tr><td></td><td valign="top"><a href="#index-pexecute"><code>pexecute</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3645. <tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fERROR"><code>PEX_BINARY_ERROR</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3646. <tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fINPUT"><code>PEX_BINARY_INPUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3647. <tr><td></td><td valign="top"><a href="#index-PEX_005fBINARY_005fOUTPUT"><code>PEX_BINARY_OUTPUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3648. <tr><td></td><td valign="top"><a href="#index-pex_005ffree"><code>pex_free</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3649. <tr><td></td><td valign="top"><a href="#index-pex_005fget_005fstatus"><code>pex_get_status</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3650. <tr><td></td><td valign="top"><a href="#index-pex_005fget_005ftimes"><code>pex_get_times</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3651. <tr><td></td><td valign="top"><a href="#index-pex_005finit"><code>pex_init</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3652. <tr><td></td><td valign="top"><a href="#index-pex_005finput_005ffile"><code>pex_input_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3653. <tr><td></td><td valign="top"><a href="#index-pex_005finput_005fpipe"><code>pex_input_pipe</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3654. <tr><td></td><td valign="top"><a href="#index-PEX_005fLAST"><code>PEX_LAST</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3655. <tr><td></td><td valign="top"><a href="#index-pex_005fone"><code>pex_one</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3656. <tr><td></td><td valign="top"><a href="#index-pex_005fread_005ferr"><code>pex_read_err</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3657. <tr><td></td><td valign="top"><a href="#index-pex_005fread_005foutput"><code>pex_read_output</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3658. <tr><td></td><td valign="top"><a href="#index-PEX_005fRECORD_005fTIMES"><code>PEX_RECORD_TIMES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3659. <tr><td></td><td valign="top"><a href="#index-pex_005frun"><code>pex_run</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3660. <tr><td></td><td valign="top"><a href="#index-pex_005frun_005fin_005fenvironment"><code>pex_run_in_environment</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3661. <tr><td></td><td valign="top"><a href="#index-PEX_005fSAVE_005fTEMPS"><code>PEX_SAVE_TEMPS</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3662. <tr><td></td><td valign="top"><a href="#index-PEX_005fSEARCH"><code>PEX_SEARCH</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3663. <tr><td></td><td valign="top"><a href="#index-PEX_005fSTDERR_005fTO_005fPIPE"><code>PEX_STDERR_TO_PIPE</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3664. <tr><td></td><td valign="top"><a href="#index-PEX_005fSTDERR_005fTO_005fSTDOUT"><code>PEX_STDERR_TO_STDOUT</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3665. <tr><td></td><td valign="top"><a href="#index-PEX_005fSUFFIX"><code>PEX_SUFFIX</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3666. <tr><td></td><td valign="top"><a href="#index-PEX_005fUSE_005fPIPES"><code>PEX_USE_PIPES</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3667. <tr><td></td><td valign="top"><a href="#index-psignal"><code>psignal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3668. <tr><td></td><td valign="top"><a href="#index-putenv"><code>putenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3669. <tr><td></td><td valign="top"><a href="#index-pwait"><code>pwait</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3670. <tr><td colspan="4"> <hr></td></tr>
  3671. <tr><th><a name="Index_cp_letter-R">R</a></th><td></td><td></td></tr>
  3672. <tr><td></td><td valign="top"><a href="#index-random"><code>random</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3673. <tr><td></td><td valign="top"><a href="#index-reconcat"><code>reconcat</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3674. <tr><td></td><td valign="top"><a href="#index-remque"><code>remque</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3675. <tr><td></td><td valign="top"><a href="#index-rename"><code>rename</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3676. <tr><td></td><td valign="top"><a href="#index-replacement-functions">replacement functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Replacement-Functions">Replacement Functions</a></td></tr>
  3677. <tr><td></td><td valign="top"><a href="#index-rindex"><code>rindex</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3678. <tr><td colspan="4"> <hr></td></tr>
  3679. <tr><th><a name="Index_cp_letter-S">S</a></th><td></td><td></td></tr>
  3680. <tr><td></td><td valign="top"><a href="#index-setenv"><code>setenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3681. <tr><td></td><td valign="top"><a href="#index-setproctitle"><code>setproctitle</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3682. <tr><td></td><td valign="top"><a href="#index-setstate"><code>setstate</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3683. <tr><td></td><td valign="top"><a href="#index-shrinking-objects">shrinking objects</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Extra-Fast-Growing">Extra Fast Growing</a></td></tr>
  3684. <tr><td></td><td valign="top"><a href="#index-signo_005fmax"><code>signo_max</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3685. <tr><td></td><td valign="top"><a href="#index-sigsetmask"><code>sigsetmask</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3686. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fattributes_005fcompare"><code>simple_object_attributes_compare</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3687. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffetch_005fattributes"><code>simple_object_fetch_attributes</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3688. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffind_005fsection"><code>simple_object_find_section</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3689. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005ffind_005fsections"><code>simple_object_find_sections</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3690. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fopen_005fread"><code>simple_object_open_read</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3691. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fattributes"><code>simple_object_release_attributes</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3692. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fread"><code>simple_object_release_read</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3693. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005frelease_005fwrite"><code>simple_object_release_write</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3694. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fstart_005fwrite"><code>simple_object_start_write</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3695. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fadd_005fdata"><code>simple_object_write_add_data</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3696. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fcreate_005fsection"><code>simple_object_write_create_section</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3697. <tr><td></td><td valign="top"><a href="#index-simple_005fobject_005fwrite_005fto_005ffile"><code>simple_object_write_to_file</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3698. <tr><td></td><td valign="top"><a href="#index-snprintf"><code>snprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3699. <tr><td></td><td valign="top"><a href="#index-spaces"><code>spaces</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3700. <tr><td></td><td valign="top"><a href="#index-splay_005ftree_005fnew_005fwith_005ftyped_005falloc"><code>splay_tree_new_with_typed_alloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3701. <tr><td></td><td valign="top"><a href="#index-srandom"><code>srandom</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3702. <tr><td></td><td valign="top"><a href="#index-stack_005flimit_005fincrease"><code>stack_limit_increase</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3703. <tr><td></td><td valign="top"><a href="#index-status-of-obstack">status of obstack</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Status-of-an-Obstack">Status of an Obstack</a></td></tr>
  3704. <tr><td></td><td valign="top"><a href="#index-stpcpy"><code>stpcpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3705. <tr><td></td><td valign="top"><a href="#index-stpncpy"><code>stpncpy</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3706. <tr><td></td><td valign="top"><a href="#index-strcasecmp"><code>strcasecmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3707. <tr><td></td><td valign="top"><a href="#index-strchr"><code>strchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3708. <tr><td></td><td valign="top"><a href="#index-strdup"><code>strdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3709. <tr><td></td><td valign="top"><a href="#index-strerrno"><code>strerrno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3710. <tr><td></td><td valign="top"><a href="#index-strerror"><code>strerror</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3711. <tr><td></td><td valign="top"><a href="#index-strncasecmp"><code>strncasecmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3712. <tr><td></td><td valign="top"><a href="#index-strncmp"><code>strncmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3713. <tr><td></td><td valign="top"><a href="#index-strndup"><code>strndup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3714. <tr><td></td><td valign="top"><a href="#index-strnlen"><code>strnlen</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3715. <tr><td></td><td valign="top"><a href="#index-strrchr"><code>strrchr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3716. <tr><td></td><td valign="top"><a href="#index-strsignal"><code>strsignal</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3717. <tr><td></td><td valign="top"><a href="#index-strsigno"><code>strsigno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3718. <tr><td></td><td valign="top"><a href="#index-strstr"><code>strstr</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3719. <tr><td></td><td valign="top"><a href="#index-strtod"><code>strtod</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3720. <tr><td></td><td valign="top"><a href="#index-strtoerrno"><code>strtoerrno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3721. <tr><td></td><td valign="top"><a href="#index-strtol"><code>strtol</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3722. <tr><td></td><td valign="top"><a href="#index-strtoll"><code>strtoll</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3723. <tr><td></td><td valign="top"><a href="#index-strtosigno"><code>strtosigno</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3724. <tr><td></td><td valign="top"><a href="#index-strtoul"><code>strtoul</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3725. <tr><td></td><td valign="top"><a href="#index-strtoul-1"><code>strtoul</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3726. <tr><td></td><td valign="top"><a href="#index-strverscmp"><code>strverscmp</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3727. <tr><td></td><td valign="top"><a href="#index-supplemental-functions">supplemental functions</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Supplemental-Functions">Supplemental Functions</a></td></tr>
  3728. <tr><td colspan="4"> <hr></td></tr>
  3729. <tr><th><a name="Index_cp_letter-T">T</a></th><td></td><td></td></tr>
  3730. <tr><td></td><td valign="top"><a href="#index-timeval_005fadd"><code>timeval_add</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3731. <tr><td></td><td valign="top"><a href="#index-timeval_005fsub"><code>timeval_sub</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3732. <tr><td></td><td valign="top"><a href="#index-tmpnam"><code>tmpnam</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3733. <tr><td colspan="4"> <hr></td></tr>
  3734. <tr><th><a name="Index_cp_letter-U">U</a></th><td></td><td></td></tr>
  3735. <tr><td></td><td valign="top"><a href="#index-unlink_005fif_005fordinary"><code>unlink_if_ordinary</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3736. <tr><td></td><td valign="top"><a href="#index-unlock_005fstd_005fstreams"><code>unlock_std_streams</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3737. <tr><td></td><td valign="top"><a href="#index-unlock_005fstream"><code>unlock_stream</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3738. <tr><td></td><td valign="top"><a href="#index-unsetenv"><code>unsetenv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3739. <tr><td></td><td valign="top"><a href="#index-using-libiberty">using libiberty</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Using">Using</a></td></tr>
  3740. <tr><td colspan="4"> <hr></td></tr>
  3741. <tr><th><a name="Index_cp_letter-V">V</a></th><td></td><td></td></tr>
  3742. <tr><td></td><td valign="top"><a href="#index-vasprintf"><code>vasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3743. <tr><td></td><td valign="top"><a href="#index-vfork"><code>vfork</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3744. <tr><td></td><td valign="top"><a href="#index-vfprintf"><code>vfprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3745. <tr><td></td><td valign="top"><a href="#index-vprintf"><code>vprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3746. <tr><td></td><td valign="top"><a href="#index-vsnprintf"><code>vsnprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3747. <tr><td></td><td valign="top"><a href="#index-vsprintf"><code>vsprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3748. <tr><td colspan="4"> <hr></td></tr>
  3749. <tr><th><a name="Index_cp_letter-W">W</a></th><td></td><td></td></tr>
  3750. <tr><td></td><td valign="top"><a href="#index-waitpid"><code>waitpid</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3751. <tr><td></td><td valign="top"><a href="#index-writeargv"><code>writeargv</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3752. <tr><td colspan="4"> <hr></td></tr>
  3753. <tr><th><a name="Index_cp_letter-X">X</a></th><td></td><td></td></tr>
  3754. <tr><td></td><td valign="top"><a href="#index-xasprintf"><code>xasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3755. <tr><td></td><td valign="top"><a href="#index-xatexit"><code>xatexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3756. <tr><td></td><td valign="top"><a href="#index-xcalloc"><code>xcalloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3757. <tr><td></td><td valign="top"><a href="#index-xexit"><code>xexit</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3758. <tr><td></td><td valign="top"><a href="#index-xmalloc"><code>xmalloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3759. <tr><td></td><td valign="top"><a href="#index-xmalloc_005ffailed"><code>xmalloc_failed</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3760. <tr><td></td><td valign="top"><a href="#index-xmalloc_005fset_005fprogram_005fname"><code>xmalloc_set_program_name</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3761. <tr><td></td><td valign="top"><a href="#index-xmemdup"><code>xmemdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3762. <tr><td></td><td valign="top"><a href="#index-xrealloc"><code>xrealloc</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3763. <tr><td></td><td valign="top"><a href="#index-xstrdup"><code>xstrdup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3764. <tr><td></td><td valign="top"><a href="#index-xstrerror"><code>xstrerror</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3765. <tr><td></td><td valign="top"><a href="#index-xstrndup"><code>xstrndup</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3766. <tr><td></td><td valign="top"><a href="#index-xvasprintf"><code>xvasprintf</code></a>:</td><td>&nbsp;</td><td valign="top"><a href="#Functions">Functions</a></td></tr>
  3767. <tr><td colspan="4"> <hr></td></tr>
  3768. </table>
  3769. <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-A"><b>A</b></a>
  3770. &nbsp;
  3771. <a class="summary-letter" href="#Index_cp_letter-B"><b>B</b></a>
  3772. &nbsp;
  3773. <a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
  3774. &nbsp;
  3775. <a class="summary-letter" href="#Index_cp_letter-D"><b>D</b></a>
  3776. &nbsp;
  3777. <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
  3778. &nbsp;
  3779. <a class="summary-letter" href="#Index_cp_letter-F"><b>F</b></a>
  3780. &nbsp;
  3781. <a class="summary-letter" href="#Index_cp_letter-G"><b>G</b></a>
  3782. &nbsp;
  3783. <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
  3784. &nbsp;
  3785. <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
  3786. &nbsp;
  3787. <a class="summary-letter" href="#Index_cp_letter-L"><b>L</b></a>
  3788. &nbsp;
  3789. <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
  3790. &nbsp;
  3791. <a class="summary-letter" href="#Index_cp_letter-O"><b>O</b></a>
  3792. &nbsp;
  3793. <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
  3794. &nbsp;
  3795. <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
  3796. &nbsp;
  3797. <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
  3798. &nbsp;
  3799. <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
  3800. &nbsp;
  3801. <a class="summary-letter" href="#Index_cp_letter-U"><b>U</b></a>
  3802. &nbsp;
  3803. <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
  3804. &nbsp;
  3805. <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
  3806. &nbsp;
  3807. <a class="summary-letter" href="#Index_cp_letter-X"><b>X</b></a>
  3808. &nbsp;
  3809. </td></tr></table>
  3810. <hr>
  3811. </body>
  3812. </html>