libc.info-5 296 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295
  1. This is libc.info, produced by makeinfo version 7.3 from libc.texinfo.
  2. This is ‘The GNU C Library Reference Manual’, for version 2.43.
  3. Copyright © 1993-2026 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Free Software Needs Free Documentation" and
  8. "GNU Lesser General Public License", the Front-Cover texts being "A GNU
  9. Manual", and with the Back-Cover Texts as in (a) below. A copy of the
  10. license is included in the section entitled "GNU Free Documentation
  11. License".
  12. (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
  13. modify this GNU manual. Buying copies from the FSF supports it in
  14. developing GNU and promoting software freedom."
  15. INFO-DIR-SECTION Software libraries
  16. START-INFO-DIR-ENTRY
  17. * Libc: (libc). C library.
  18. END-INFO-DIR-ENTRY
  19. INFO-DIR-SECTION GNU C library functions and macros
  20. START-INFO-DIR-ENTRY
  21. * ALTWERASE: (libc)Local Modes.
  22. * ARGP_ERR_UNKNOWN: (libc)Argp Parser Functions.
  23. * ARG_MAX: (libc)General Limits.
  24. * BAUD_MAX: (libc)Line Speed.
  25. * BC_BASE_MAX: (libc)Utility Limits.
  26. * BC_DIM_MAX: (libc)Utility Limits.
  27. * BC_SCALE_MAX: (libc)Utility Limits.
  28. * BC_STRING_MAX: (libc)Utility Limits.
  29. * BRKINT: (libc)Input Modes.
  30. * BUFSIZ: (libc)Controlling Buffering.
  31. * CCTS_OFLOW: (libc)Control Modes.
  32. * CHAR_BIT: (libc)Width of Type.
  33. * CHILD_MAX: (libc)General Limits.
  34. * CIGNORE: (libc)Control Modes.
  35. * CLK_TCK: (libc)Processor Time.
  36. * CLOCAL: (libc)Control Modes.
  37. * CLOCKS_PER_SEC: (libc)CPU Time.
  38. * CLOCK_BOOTTIME: (libc)Getting the Time.
  39. * CLOCK_BOOTTIME_ALARM: (libc)Getting the Time.
  40. * CLOCK_MONOTONIC: (libc)Getting the Time.
  41. * CLOCK_MONOTONIC_COARSE: (libc)Getting the Time.
  42. * CLOCK_MONOTONIC_RAW: (libc)Getting the Time.
  43. * CLOCK_PROCESS_CPUTIME_ID: (libc)Getting the Time.
  44. * CLOCK_REALTIME: (libc)Getting the Time.
  45. * CLOCK_REALTIME_ALARM: (libc)Getting the Time.
  46. * CLOCK_REALTIME_COARSE: (libc)Getting the Time.
  47. * CLOCK_TAI: (libc)Getting the Time.
  48. * CLOCK_THREAD_CPUTIME_ID: (libc)Getting the Time.
  49. * COLL_WEIGHTS_MAX: (libc)Utility Limits.
  50. * CPU_ALLOC: (libc)CPU Affinity.
  51. * CPU_ALLOC_SIZE: (libc)CPU Affinity.
  52. * CPU_AND: (libc)CPU Affinity.
  53. * CPU_AND_S: (libc)CPU Affinity.
  54. * CPU_CLR: (libc)CPU Affinity.
  55. * CPU_CLR_S: (libc)CPU Affinity.
  56. * CPU_COUNT: (libc)CPU Affinity.
  57. * CPU_COUNT_S: (libc)CPU Affinity.
  58. * CPU_EQUAL: (libc)CPU Affinity.
  59. * CPU_EQUAL_S: (libc)CPU Affinity.
  60. * CPU_FEATURE_ACTIVE: (libc)X86.
  61. * CPU_FEATURE_PRESENT: (libc)X86.
  62. * CPU_FREE: (libc)CPU Affinity.
  63. * CPU_ISSET: (libc)CPU Affinity.
  64. * CPU_ISSET_S: (libc)CPU Affinity.
  65. * CPU_OR: (libc)CPU Affinity.
  66. * CPU_OR_S: (libc)CPU Affinity.
  67. * CPU_SET: (libc)CPU Affinity.
  68. * CPU_SETSIZE: (libc)CPU Affinity.
  69. * CPU_SET_S: (libc)CPU Affinity.
  70. * CPU_XOR: (libc)CPU Affinity.
  71. * CPU_XOR_S: (libc)CPU Affinity.
  72. * CPU_ZERO: (libc)CPU Affinity.
  73. * CPU_ZERO_S: (libc)CPU Affinity.
  74. * CREAD: (libc)Control Modes.
  75. * CRTS_IFLOW: (libc)Control Modes.
  76. * CS5: (libc)Control Modes.
  77. * CS6: (libc)Control Modes.
  78. * CS7: (libc)Control Modes.
  79. * CS8: (libc)Control Modes.
  80. * CSIZE: (libc)Control Modes.
  81. * CSTOPB: (libc)Control Modes.
  82. * DLFO_EH_SEGMENT_TYPE: (libc)Dynamic Linker Introspection.
  83. * DLFO_STRUCT_HAS_EH_COUNT: (libc)Dynamic Linker Introspection.
  84. * DLFO_STRUCT_HAS_EH_DBASE: (libc)Dynamic Linker Introspection.
  85. * DTTOIF: (libc)Directory Entries.
  86. * E2BIG: (libc)Error Codes.
  87. * EACCES: (libc)Error Codes.
  88. * EADDRINUSE: (libc)Error Codes.
  89. * EADDRNOTAVAIL: (libc)Error Codes.
  90. * EADV: (libc)Error Codes.
  91. * EAFNOSUPPORT: (libc)Error Codes.
  92. * EAGAIN: (libc)Error Codes.
  93. * EALREADY: (libc)Error Codes.
  94. * EAUTH: (libc)Error Codes.
  95. * EBACKGROUND: (libc)Error Codes.
  96. * EBADE: (libc)Error Codes.
  97. * EBADF: (libc)Error Codes.
  98. * EBADFD: (libc)Error Codes.
  99. * EBADMSG: (libc)Error Codes.
  100. * EBADR: (libc)Error Codes.
  101. * EBADRPC: (libc)Error Codes.
  102. * EBADRQC: (libc)Error Codes.
  103. * EBADSLT: (libc)Error Codes.
  104. * EBFONT: (libc)Error Codes.
  105. * EBUSY: (libc)Error Codes.
  106. * ECANCELED: (libc)Error Codes.
  107. * ECHILD: (libc)Error Codes.
  108. * ECHO: (libc)Local Modes.
  109. * ECHOCTL: (libc)Local Modes.
  110. * ECHOE: (libc)Local Modes.
  111. * ECHOK: (libc)Local Modes.
  112. * ECHOKE: (libc)Local Modes.
  113. * ECHONL: (libc)Local Modes.
  114. * ECHOPRT: (libc)Local Modes.
  115. * ECHRNG: (libc)Error Codes.
  116. * ECOMM: (libc)Error Codes.
  117. * ECONNABORTED: (libc)Error Codes.
  118. * ECONNREFUSED: (libc)Error Codes.
  119. * ECONNRESET: (libc)Error Codes.
  120. * ED: (libc)Error Codes.
  121. * EDEADLK: (libc)Error Codes.
  122. * EDEADLOCK: (libc)Error Codes.
  123. * EDESTADDRREQ: (libc)Error Codes.
  124. * EDIED: (libc)Error Codes.
  125. * EDOM: (libc)Error Codes.
  126. * EDOTDOT: (libc)Error Codes.
  127. * EDQUOT: (libc)Error Codes.
  128. * EEXIST: (libc)Error Codes.
  129. * EFAULT: (libc)Error Codes.
  130. * EFBIG: (libc)Error Codes.
  131. * EFTYPE: (libc)Error Codes.
  132. * EGRATUITOUS: (libc)Error Codes.
  133. * EGREGIOUS: (libc)Error Codes.
  134. * EHOSTDOWN: (libc)Error Codes.
  135. * EHOSTUNREACH: (libc)Error Codes.
  136. * EHWPOISON: (libc)Error Codes.
  137. * EIDRM: (libc)Error Codes.
  138. * EIEIO: (libc)Error Codes.
  139. * EILSEQ: (libc)Error Codes.
  140. * EINPROGRESS: (libc)Error Codes.
  141. * EINTR: (libc)Error Codes.
  142. * EINVAL: (libc)Error Codes.
  143. * EIO: (libc)Error Codes.
  144. * EISCONN: (libc)Error Codes.
  145. * EISDIR: (libc)Error Codes.
  146. * EISNAM: (libc)Error Codes.
  147. * EKEYEXPIRED: (libc)Error Codes.
  148. * EKEYREJECTED: (libc)Error Codes.
  149. * EKEYREVOKED: (libc)Error Codes.
  150. * EL2HLT: (libc)Error Codes.
  151. * EL2NSYNC: (libc)Error Codes.
  152. * EL3HLT: (libc)Error Codes.
  153. * EL3RST: (libc)Error Codes.
  154. * ELIBACC: (libc)Error Codes.
  155. * ELIBBAD: (libc)Error Codes.
  156. * ELIBEXEC: (libc)Error Codes.
  157. * ELIBMAX: (libc)Error Codes.
  158. * ELIBSCN: (libc)Error Codes.
  159. * ELNRNG: (libc)Error Codes.
  160. * ELOOP: (libc)Error Codes.
  161. * EMEDIUMTYPE: (libc)Error Codes.
  162. * EMFILE: (libc)Error Codes.
  163. * EMLINK: (libc)Error Codes.
  164. * EMSGSIZE: (libc)Error Codes.
  165. * EMULTIHOP: (libc)Error Codes.
  166. * ENAMETOOLONG: (libc)Error Codes.
  167. * ENAVAIL: (libc)Error Codes.
  168. * ENEEDAUTH: (libc)Error Codes.
  169. * ENETDOWN: (libc)Error Codes.
  170. * ENETRESET: (libc)Error Codes.
  171. * ENETUNREACH: (libc)Error Codes.
  172. * ENFILE: (libc)Error Codes.
  173. * ENOANO: (libc)Error Codes.
  174. * ENOBUFS: (libc)Error Codes.
  175. * ENOCSI: (libc)Error Codes.
  176. * ENODATA: (libc)Error Codes.
  177. * ENODEV: (libc)Error Codes.
  178. * ENOENT: (libc)Error Codes.
  179. * ENOEXEC: (libc)Error Codes.
  180. * ENOKEY: (libc)Error Codes.
  181. * ENOLCK: (libc)Error Codes.
  182. * ENOLINK: (libc)Error Codes.
  183. * ENOMEDIUM: (libc)Error Codes.
  184. * ENOMEM: (libc)Error Codes.
  185. * ENOMSG: (libc)Error Codes.
  186. * ENONET: (libc)Error Codes.
  187. * ENOPKG: (libc)Error Codes.
  188. * ENOPROTOOPT: (libc)Error Codes.
  189. * ENOSPC: (libc)Error Codes.
  190. * ENOSR: (libc)Error Codes.
  191. * ENOSTR: (libc)Error Codes.
  192. * ENOSYS: (libc)Error Codes.
  193. * ENOTBLK: (libc)Error Codes.
  194. * ENOTCONN: (libc)Error Codes.
  195. * ENOTDIR: (libc)Error Codes.
  196. * ENOTEMPTY: (libc)Error Codes.
  197. * ENOTNAM: (libc)Error Codes.
  198. * ENOTRECOVERABLE: (libc)Error Codes.
  199. * ENOTSOCK: (libc)Error Codes.
  200. * ENOTSUP: (libc)Error Codes.
  201. * ENOTTY: (libc)Error Codes.
  202. * ENOTUNIQ: (libc)Error Codes.
  203. * ENXIO: (libc)Error Codes.
  204. * EOF: (libc)EOF and Errors.
  205. * EOPNOTSUPP: (libc)Error Codes.
  206. * EOVERFLOW: (libc)Error Codes.
  207. * EOWNERDEAD: (libc)Error Codes.
  208. * EPERM: (libc)Error Codes.
  209. * EPFNOSUPPORT: (libc)Error Codes.
  210. * EPIPE: (libc)Error Codes.
  211. * EPROCLIM: (libc)Error Codes.
  212. * EPROCUNAVAIL: (libc)Error Codes.
  213. * EPROGMISMATCH: (libc)Error Codes.
  214. * EPROGUNAVAIL: (libc)Error Codes.
  215. * EPROTO: (libc)Error Codes.
  216. * EPROTONOSUPPORT: (libc)Error Codes.
  217. * EPROTOTYPE: (libc)Error Codes.
  218. * EQUIV_CLASS_MAX: (libc)Utility Limits.
  219. * ERANGE: (libc)Error Codes.
  220. * EREMCHG: (libc)Error Codes.
  221. * EREMOTE: (libc)Error Codes.
  222. * EREMOTEIO: (libc)Error Codes.
  223. * ERESTART: (libc)Error Codes.
  224. * ERFKILL: (libc)Error Codes.
  225. * EROFS: (libc)Error Codes.
  226. * ERPCMISMATCH: (libc)Error Codes.
  227. * ESHUTDOWN: (libc)Error Codes.
  228. * ESOCKTNOSUPPORT: (libc)Error Codes.
  229. * ESPIPE: (libc)Error Codes.
  230. * ESRCH: (libc)Error Codes.
  231. * ESRMNT: (libc)Error Codes.
  232. * ESTALE: (libc)Error Codes.
  233. * ESTRPIPE: (libc)Error Codes.
  234. * ETIME: (libc)Error Codes.
  235. * ETIMEDOUT: (libc)Error Codes.
  236. * ETOOMANYREFS: (libc)Error Codes.
  237. * ETXTBSY: (libc)Error Codes.
  238. * EUCLEAN: (libc)Error Codes.
  239. * EUNATCH: (libc)Error Codes.
  240. * EUSERS: (libc)Error Codes.
  241. * EWOULDBLOCK: (libc)Error Codes.
  242. * EXDEV: (libc)Error Codes.
  243. * EXFULL: (libc)Error Codes.
  244. * EXIT_FAILURE: (libc)Exit Status.
  245. * EXIT_SUCCESS: (libc)Exit Status.
  246. * EXPR_NEST_MAX: (libc)Utility Limits.
  247. * FD_CLOEXEC: (libc)Descriptor Flags.
  248. * FD_CLR: (libc)Waiting for I/O.
  249. * FD_ISSET: (libc)Waiting for I/O.
  250. * FD_SET: (libc)Waiting for I/O.
  251. * FD_SETSIZE: (libc)Waiting for I/O.
  252. * FD_ZERO: (libc)Waiting for I/O.
  253. * FE_SNANS_ALWAYS_SIGNAL: (libc)Infinity and NaN.
  254. * FILENAME_MAX: (libc)Limits for Files.
  255. * FLUSHO: (libc)Local Modes.
  256. * FOPEN_MAX: (libc)Opening Streams.
  257. * FP_ILOGB0: (libc)Exponents and Logarithms.
  258. * FP_ILOGBNAN: (libc)Exponents and Logarithms.
  259. * FP_LLOGB0: (libc)Exponents and Logarithms.
  260. * FP_LLOGBNAN: (libc)Exponents and Logarithms.
  261. * F_DUPFD: (libc)Duplicating Descriptors.
  262. * F_GETFD: (libc)Descriptor Flags.
  263. * F_GETFL: (libc)Getting File Status Flags.
  264. * F_GETLK: (libc)File Locks.
  265. * F_GETOWN: (libc)Interrupt Input.
  266. * F_OFD_GETLK: (libc)Open File Description Locks.
  267. * F_OFD_SETLK: (libc)Open File Description Locks.
  268. * F_OFD_SETLKW: (libc)Open File Description Locks.
  269. * F_OK: (libc)Testing File Access.
  270. * F_SETFD: (libc)Descriptor Flags.
  271. * F_SETFL: (libc)Getting File Status Flags.
  272. * F_SETLK: (libc)File Locks.
  273. * F_SETLKW: (libc)File Locks.
  274. * F_SETOWN: (libc)Interrupt Input.
  275. * HUGE_VAL: (libc)Math Error Reporting.
  276. * HUGE_VALF: (libc)Math Error Reporting.
  277. * HUGE_VALL: (libc)Math Error Reporting.
  278. * HUGE_VAL_FN: (libc)Math Error Reporting.
  279. * HUGE_VAL_FNx: (libc)Math Error Reporting.
  280. * HUPCL: (libc)Control Modes.
  281. * I: (libc)Complex Numbers.
  282. * ICANON: (libc)Local Modes.
  283. * ICRNL: (libc)Input Modes.
  284. * IEXTEN: (libc)Local Modes.
  285. * IFNAMSIZ: (libc)Interface Naming.
  286. * IFTODT: (libc)Directory Entries.
  287. * IGNBRK: (libc)Input Modes.
  288. * IGNCR: (libc)Input Modes.
  289. * IGNPAR: (libc)Input Modes.
  290. * IMAXBEL: (libc)Input Modes.
  291. * INADDR_ANY: (libc)Host Address Data Type.
  292. * INADDR_BROADCAST: (libc)Host Address Data Type.
  293. * INADDR_LOOPBACK: (libc)Host Address Data Type.
  294. * INADDR_NONE: (libc)Host Address Data Type.
  295. * INFINITY: (libc)Infinity and NaN.
  296. * INLCR: (libc)Input Modes.
  297. * INPCK: (libc)Input Modes.
  298. * IPPORT_RESERVED: (libc)Ports.
  299. * IPPORT_USERRESERVED: (libc)Ports.
  300. * ISIG: (libc)Local Modes.
  301. * ISTRIP: (libc)Input Modes.
  302. * IXANY: (libc)Input Modes.
  303. * IXOFF: (libc)Input Modes.
  304. * IXON: (libc)Input Modes.
  305. * LINE_MAX: (libc)Utility Limits.
  306. * LINK_MAX: (libc)Limits for Files.
  307. * L_ctermid: (libc)Identifying the Terminal.
  308. * L_cuserid: (libc)Who Logged In.
  309. * L_tmpnam: (libc)Temporary Files.
  310. * MAXNAMLEN: (libc)Limits for Files.
  311. * MAXSYMLINKS: (libc)Symbolic Links.
  312. * MAX_CANON: (libc)Limits for Files.
  313. * MAX_INPUT: (libc)Limits for Files.
  314. * MB_CUR_MAX: (libc)Selecting the Conversion.
  315. * MB_LEN_MAX: (libc)Selecting the Conversion.
  316. * MDMBUF: (libc)Control Modes.
  317. * MSG_DONTROUTE: (libc)Socket Data Options.
  318. * MSG_OOB: (libc)Socket Data Options.
  319. * MSG_PEEK: (libc)Socket Data Options.
  320. * NAME_MAX: (libc)Limits for Files.
  321. * NAN: (libc)Infinity and NaN.
  322. * NCCS: (libc)Mode Data Types.
  323. * NGROUPS_MAX: (libc)General Limits.
  324. * NOFLSH: (libc)Local Modes.
  325. * NOKERNINFO: (libc)Local Modes.
  326. * NSIG: (libc)Standard Signals.
  327. * NULL: (libc)Null Pointer Constant.
  328. * ONLCR: (libc)Output Modes.
  329. * ONOEOT: (libc)Output Modes.
  330. * OPEN_MAX: (libc)General Limits.
  331. * OPOST: (libc)Output Modes.
  332. * OXTABS: (libc)Output Modes.
  333. * O_ACCMODE: (libc)Access Modes.
  334. * O_APPEND: (libc)Operating Modes.
  335. * O_ASYNC: (libc)Operating Modes.
  336. * O_CREAT: (libc)Open-time Flags.
  337. * O_DIRECTORY: (libc)Open-time Flags.
  338. * O_EXCL: (libc)Open-time Flags.
  339. * O_EXEC: (libc)Access Modes.
  340. * O_EXLOCK: (libc)Open-time Flags.
  341. * O_FSYNC: (libc)Operating Modes.
  342. * O_IGNORE_CTTY: (libc)Open-time Flags.
  343. * O_NDELAY: (libc)Operating Modes.
  344. * O_NOATIME: (libc)Operating Modes.
  345. * O_NOCTTY: (libc)Open-time Flags.
  346. * O_NOFOLLOW: (libc)Open-time Flags.
  347. * O_NOLINK: (libc)Open-time Flags.
  348. * O_NONBLOCK: (libc)Open-time Flags.
  349. * O_NONBLOCK: (libc)Operating Modes.
  350. * O_NOTRANS: (libc)Open-time Flags.
  351. * O_PATH: (libc)Access Modes.
  352. * O_RDONLY: (libc)Access Modes.
  353. * O_RDWR: (libc)Access Modes.
  354. * O_READ: (libc)Access Modes.
  355. * O_SHLOCK: (libc)Open-time Flags.
  356. * O_SYNC: (libc)Operating Modes.
  357. * O_TMPFILE: (libc)Open-time Flags.
  358. * O_TRUNC: (libc)Open-time Flags.
  359. * O_WRITE: (libc)Access Modes.
  360. * O_WRONLY: (libc)Access Modes.
  361. * PARENB: (libc)Control Modes.
  362. * PARMRK: (libc)Input Modes.
  363. * PARODD: (libc)Control Modes.
  364. * PATH_MAX: (libc)Limits for Files.
  365. * PA_FLAG_MASK: (libc)Parsing a Template String.
  366. * PENDIN: (libc)Local Modes.
  367. * PF_FILE: (libc)Local Namespace Details.
  368. * PF_INET6: (libc)Internet Namespace.
  369. * PF_INET: (libc)Internet Namespace.
  370. * PF_LOCAL: (libc)Local Namespace Details.
  371. * PF_UNIX: (libc)Local Namespace Details.
  372. * PIPE_BUF: (libc)Limits for Files.
  373. * PTHREAD_ATTR_NO_SIGMASK_NP: (libc)Initial Thread Signal Mask.
  374. * P_tmpdir: (libc)Temporary Files.
  375. * RAND_MAX: (libc)ISO Random.
  376. * RE_DUP_MAX: (libc)General Limits.
  377. * RLIM_INFINITY: (libc)Limits on Resources.
  378. * RSEQ_SIG: (libc)Restartable Sequences.
  379. * R_OK: (libc)Testing File Access.
  380. * SA_NOCLDSTOP: (libc)Flags for Sigaction.
  381. * SA_NOCLDWAIT: (libc)Flags for Sigaction.
  382. * SA_NODEFER: (libc)Flags for Sigaction.
  383. * SA_ONSTACK: (libc)Flags for Sigaction.
  384. * SA_RESETHAND: (libc)Flags for Sigaction.
  385. * SA_RESTART: (libc)Flags for Sigaction.
  386. * SA_SIGINFO: (libc)Flags for Sigaction.
  387. * SEEK_CUR: (libc)File Positioning.
  388. * SEEK_END: (libc)File Positioning.
  389. * SEEK_SET: (libc)File Positioning.
  390. * SIGABRT: (libc)Program Error Signals.
  391. * SIGALRM: (libc)Alarm Signals.
  392. * SIGBUS: (libc)Program Error Signals.
  393. * SIGCHLD: (libc)Job Control Signals.
  394. * SIGCLD: (libc)Job Control Signals.
  395. * SIGCONT: (libc)Job Control Signals.
  396. * SIGEMT: (libc)Program Error Signals.
  397. * SIGFPE: (libc)Program Error Signals.
  398. * SIGHUP: (libc)Termination Signals.
  399. * SIGILL: (libc)Program Error Signals.
  400. * SIGINFO: (libc)Miscellaneous Signals.
  401. * SIGINT: (libc)Termination Signals.
  402. * SIGIO: (libc)Asynchronous I/O Signals.
  403. * SIGIOT: (libc)Program Error Signals.
  404. * SIGKILL: (libc)Termination Signals.
  405. * SIGLOST: (libc)Operation Error Signals.
  406. * SIGPIPE: (libc)Operation Error Signals.
  407. * SIGPOLL: (libc)Asynchronous I/O Signals.
  408. * SIGPROF: (libc)Alarm Signals.
  409. * SIGPWR: (libc)Miscellaneous Signals.
  410. * SIGQUIT: (libc)Termination Signals.
  411. * SIGSEGV: (libc)Program Error Signals.
  412. * SIGSTKFLT: (libc)Program Error Signals.
  413. * SIGSTOP: (libc)Job Control Signals.
  414. * SIGSYS: (libc)Program Error Signals.
  415. * SIGTERM: (libc)Termination Signals.
  416. * SIGTRAP: (libc)Program Error Signals.
  417. * SIGTSTP: (libc)Job Control Signals.
  418. * SIGTTIN: (libc)Job Control Signals.
  419. * SIGTTOU: (libc)Job Control Signals.
  420. * SIGURG: (libc)Asynchronous I/O Signals.
  421. * SIGUSR1: (libc)Miscellaneous Signals.
  422. * SIGUSR2: (libc)Miscellaneous Signals.
  423. * SIGVTALRM: (libc)Alarm Signals.
  424. * SIGWINCH: (libc)Miscellaneous Signals.
  425. * SIGXCPU: (libc)Operation Error Signals.
  426. * SIGXFSZ: (libc)Operation Error Signals.
  427. * SIG_ERR: (libc)Basic Signal Handling.
  428. * SNAN: (libc)Infinity and NaN.
  429. * SNANF: (libc)Infinity and NaN.
  430. * SNANFN: (libc)Infinity and NaN.
  431. * SNANFNx: (libc)Infinity and NaN.
  432. * SNANL: (libc)Infinity and NaN.
  433. * SOCK_DGRAM: (libc)Communication Styles.
  434. * SOCK_RAW: (libc)Communication Styles.
  435. * SOCK_RDM: (libc)Communication Styles.
  436. * SOCK_SEQPACKET: (libc)Communication Styles.
  437. * SOCK_STREAM: (libc)Communication Styles.
  438. * SOL_SOCKET: (libc)Socket-Level Options.
  439. * SPEED_MAX: (libc)Line Speed.
  440. * SSIZE_MAX: (libc)General Limits.
  441. * STREAM_MAX: (libc)General Limits.
  442. * SUN_LEN: (libc)Local Namespace Details.
  443. * S_IFMT: (libc)Testing File Type.
  444. * S_ISBLK: (libc)Testing File Type.
  445. * S_ISCHR: (libc)Testing File Type.
  446. * S_ISDIR: (libc)Testing File Type.
  447. * S_ISFIFO: (libc)Testing File Type.
  448. * S_ISLNK: (libc)Testing File Type.
  449. * S_ISREG: (libc)Testing File Type.
  450. * S_ISSOCK: (libc)Testing File Type.
  451. * S_TYPEISMQ: (libc)Testing File Type.
  452. * S_TYPEISSEM: (libc)Testing File Type.
  453. * S_TYPEISSHM: (libc)Testing File Type.
  454. * TIME_UTC: (libc)Getting the Time.
  455. * TMP_MAX: (libc)Temporary Files.
  456. * TOSTOP: (libc)Local Modes.
  457. * TZNAME_MAX: (libc)General Limits.
  458. * VDISCARD: (libc)Other Special.
  459. * VDSUSP: (libc)Signal Characters.
  460. * VEOF: (libc)Editing Characters.
  461. * VEOL2: (libc)Editing Characters.
  462. * VEOL: (libc)Editing Characters.
  463. * VERASE: (libc)Editing Characters.
  464. * VINTR: (libc)Signal Characters.
  465. * VKILL: (libc)Editing Characters.
  466. * VLNEXT: (libc)Other Special.
  467. * VMIN: (libc)Noncanonical Input.
  468. * VQUIT: (libc)Signal Characters.
  469. * VREPRINT: (libc)Editing Characters.
  470. * VSTART: (libc)Start/Stop Characters.
  471. * VSTATUS: (libc)Other Special.
  472. * VSTOP: (libc)Start/Stop Characters.
  473. * VSUSP: (libc)Signal Characters.
  474. * VTIME: (libc)Noncanonical Input.
  475. * VWERASE: (libc)Editing Characters.
  476. * WCHAR_MAX: (libc)Extended Char Intro.
  477. * WCHAR_MIN: (libc)Extended Char Intro.
  478. * WCOREDUMP: (libc)Process Completion Status.
  479. * WEOF: (libc)EOF and Errors.
  480. * WEOF: (libc)Extended Char Intro.
  481. * WEXITSTATUS: (libc)Process Completion Status.
  482. * WIFEXITED: (libc)Process Completion Status.
  483. * WIFSIGNALED: (libc)Process Completion Status.
  484. * WIFSTOPPED: (libc)Process Completion Status.
  485. * WSTOPSIG: (libc)Process Completion Status.
  486. * WTERMSIG: (libc)Process Completion Status.
  487. * W_OK: (libc)Testing File Access.
  488. * X_OK: (libc)Testing File Access.
  489. * _Complex_I: (libc)Complex Numbers.
  490. * _Exit: (libc)Termination Internals.
  491. * _Fork: (libc)Creating a Process.
  492. * _IOFBF: (libc)Controlling Buffering.
  493. * _IOLBF: (libc)Controlling Buffering.
  494. * _IONBF: (libc)Controlling Buffering.
  495. * _Imaginary_I: (libc)Complex Numbers.
  496. * _PATH_UTMP: (libc)Manipulating the Database.
  497. * _PATH_WTMP: (libc)Manipulating the Database.
  498. * _POSIX2_C_DEV: (libc)System Options.
  499. * _POSIX2_C_VERSION: (libc)Version Supported.
  500. * _POSIX2_FORT_DEV: (libc)System Options.
  501. * _POSIX2_FORT_RUN: (libc)System Options.
  502. * _POSIX2_LOCALEDEF: (libc)System Options.
  503. * _POSIX2_SW_DEV: (libc)System Options.
  504. * _POSIX_CHOWN_RESTRICTED: (libc)Options for Files.
  505. * _POSIX_JOB_CONTROL: (libc)System Options.
  506. * _POSIX_NO_TRUNC: (libc)Options for Files.
  507. * _POSIX_SAVED_IDS: (libc)System Options.
  508. * _POSIX_VDISABLE: (libc)Options for Files.
  509. * _POSIX_VERSION: (libc)Version Supported.
  510. * __fbufsize: (libc)Controlling Buffering.
  511. * __flbf: (libc)Controlling Buffering.
  512. * __fpending: (libc)Controlling Buffering.
  513. * __fpurge: (libc)Flushing Buffers.
  514. * __freadable: (libc)Opening Streams.
  515. * __freading: (libc)Opening Streams.
  516. * __fsetlocking: (libc)Streams and Threads.
  517. * __fwritable: (libc)Opening Streams.
  518. * __fwriting: (libc)Opening Streams.
  519. * __gconv_end_fct: (libc)glibc iconv Implementation.
  520. * __gconv_fct: (libc)glibc iconv Implementation.
  521. * __gconv_init_fct: (libc)glibc iconv Implementation.
  522. * __ppc_get_timebase: (libc)PowerPC.
  523. * __ppc_get_timebase_freq: (libc)PowerPC.
  524. * __ppc_mdoio: (libc)PowerPC.
  525. * __ppc_mdoom: (libc)PowerPC.
  526. * __ppc_set_ppr_low: (libc)PowerPC.
  527. * __ppc_set_ppr_med: (libc)PowerPC.
  528. * __ppc_set_ppr_med_high: (libc)PowerPC.
  529. * __ppc_set_ppr_med_low: (libc)PowerPC.
  530. * __ppc_set_ppr_very_low: (libc)PowerPC.
  531. * __ppc_yield: (libc)PowerPC.
  532. * __riscv_flush_icache: (libc)RISC-V.
  533. * __va_copy: (libc)Argument Macros.
  534. * __x86_get_cpuid_feature_leaf: (libc)X86.
  535. * _dl_find_object: (libc)Dynamic Linker Introspection.
  536. * _exit: (libc)Termination Internals.
  537. * _flushlbf: (libc)Flushing Buffers.
  538. * _tolower: (libc)Case Conversion.
  539. * _toupper: (libc)Case Conversion.
  540. * a64l: (libc)Encode Binary Data.
  541. * abort: (libc)Aborting a Program.
  542. * abs: (libc)Absolute Value.
  543. * accept: (libc)Accepting Connections.
  544. * access: (libc)Testing File Access.
  545. * acos: (libc)Inverse Trig Functions.
  546. * acosf: (libc)Inverse Trig Functions.
  547. * acosfN: (libc)Inverse Trig Functions.
  548. * acosfNx: (libc)Inverse Trig Functions.
  549. * acosh: (libc)Hyperbolic Functions.
  550. * acoshf: (libc)Hyperbolic Functions.
  551. * acoshfN: (libc)Hyperbolic Functions.
  552. * acoshfNx: (libc)Hyperbolic Functions.
  553. * acoshl: (libc)Hyperbolic Functions.
  554. * acosl: (libc)Inverse Trig Functions.
  555. * acospi: (libc)Inverse Trig Functions.
  556. * acospif: (libc)Inverse Trig Functions.
  557. * acospifN: (libc)Inverse Trig Functions.
  558. * acospifNx: (libc)Inverse Trig Functions.
  559. * acospil: (libc)Inverse Trig Functions.
  560. * addmntent: (libc)mtab.
  561. * addseverity: (libc)Adding Severity Classes.
  562. * adjtime: (libc)Setting and Adjusting the Time.
  563. * adjtimex: (libc)Setting and Adjusting the Time.
  564. * aio_cancel64: (libc)Cancel AIO Operations.
  565. * aio_cancel: (libc)Cancel AIO Operations.
  566. * aio_error64: (libc)Status of AIO Operations.
  567. * aio_error: (libc)Status of AIO Operations.
  568. * aio_fsync64: (libc)Synchronizing AIO Operations.
  569. * aio_fsync: (libc)Synchronizing AIO Operations.
  570. * aio_init: (libc)Configuration of AIO.
  571. * aio_read64: (libc)Asynchronous Reads/Writes.
  572. * aio_read: (libc)Asynchronous Reads/Writes.
  573. * aio_return64: (libc)Status of AIO Operations.
  574. * aio_return: (libc)Status of AIO Operations.
  575. * aio_suspend64: (libc)Synchronizing AIO Operations.
  576. * aio_suspend: (libc)Synchronizing AIO Operations.
  577. * aio_write64: (libc)Asynchronous Reads/Writes.
  578. * aio_write: (libc)Asynchronous Reads/Writes.
  579. * alarm: (libc)Setting an Alarm.
  580. * aligned_alloc: (libc)Aligned Memory Blocks.
  581. * alloca: (libc)Variable Size Automatic.
  582. * alphasort64: (libc)Scanning Directory Content.
  583. * alphasort: (libc)Scanning Directory Content.
  584. * arc4random: (libc)High Quality Random.
  585. * arc4random_buf: (libc)High Quality Random.
  586. * arc4random_uniform: (libc)High Quality Random.
  587. * argp_error: (libc)Argp Helper Functions.
  588. * argp_failure: (libc)Argp Helper Functions.
  589. * argp_help: (libc)Argp Help.
  590. * argp_parse: (libc)Argp.
  591. * argp_state_help: (libc)Argp Helper Functions.
  592. * argp_usage: (libc)Argp Helper Functions.
  593. * argz_add: (libc)Argz Functions.
  594. * argz_add_sep: (libc)Argz Functions.
  595. * argz_append: (libc)Argz Functions.
  596. * argz_count: (libc)Argz Functions.
  597. * argz_create: (libc)Argz Functions.
  598. * argz_create_sep: (libc)Argz Functions.
  599. * argz_delete: (libc)Argz Functions.
  600. * argz_extract: (libc)Argz Functions.
  601. * argz_insert: (libc)Argz Functions.
  602. * argz_next: (libc)Argz Functions.
  603. * argz_replace: (libc)Argz Functions.
  604. * argz_stringify: (libc)Argz Functions.
  605. * asctime: (libc)Formatting Calendar Time.
  606. * asctime_r: (libc)Formatting Calendar Time.
  607. * asin: (libc)Inverse Trig Functions.
  608. * asinf: (libc)Inverse Trig Functions.
  609. * asinfN: (libc)Inverse Trig Functions.
  610. * asinfNx: (libc)Inverse Trig Functions.
  611. * asinh: (libc)Hyperbolic Functions.
  612. * asinhf: (libc)Hyperbolic Functions.
  613. * asinhfN: (libc)Hyperbolic Functions.
  614. * asinhfNx: (libc)Hyperbolic Functions.
  615. * asinhl: (libc)Hyperbolic Functions.
  616. * asinl: (libc)Inverse Trig Functions.
  617. * asinpi: (libc)Inverse Trig Functions.
  618. * asinpif: (libc)Inverse Trig Functions.
  619. * asinpifN: (libc)Inverse Trig Functions.
  620. * asinpifNx: (libc)Inverse Trig Functions.
  621. * asinpil: (libc)Inverse Trig Functions.
  622. * asprintf: (libc)Dynamic Output.
  623. * assert: (libc)Consistency Checking.
  624. * assert_perror: (libc)Consistency Checking.
  625. * atan2: (libc)Inverse Trig Functions.
  626. * atan2f: (libc)Inverse Trig Functions.
  627. * atan2fN: (libc)Inverse Trig Functions.
  628. * atan2fNx: (libc)Inverse Trig Functions.
  629. * atan2l: (libc)Inverse Trig Functions.
  630. * atan2pi: (libc)Inverse Trig Functions.
  631. * atan2pif: (libc)Inverse Trig Functions.
  632. * atan2pifN: (libc)Inverse Trig Functions.
  633. * atan2pifNx: (libc)Inverse Trig Functions.
  634. * atan2pil: (libc)Inverse Trig Functions.
  635. * atan: (libc)Inverse Trig Functions.
  636. * atanf: (libc)Inverse Trig Functions.
  637. * atanfN: (libc)Inverse Trig Functions.
  638. * atanfNx: (libc)Inverse Trig Functions.
  639. * atanh: (libc)Hyperbolic Functions.
  640. * atanhf: (libc)Hyperbolic Functions.
  641. * atanhfN: (libc)Hyperbolic Functions.
  642. * atanhfNx: (libc)Hyperbolic Functions.
  643. * atanhl: (libc)Hyperbolic Functions.
  644. * atanl: (libc)Inverse Trig Functions.
  645. * atanpi: (libc)Inverse Trig Functions.
  646. * atanpif: (libc)Inverse Trig Functions.
  647. * atanpifN: (libc)Inverse Trig Functions.
  648. * atanpifNx: (libc)Inverse Trig Functions.
  649. * atanpil: (libc)Inverse Trig Functions.
  650. * atexit: (libc)Cleanups on Exit.
  651. * atof: (libc)Parsing of Floats.
  652. * atoi: (libc)Parsing of Integers.
  653. * atol: (libc)Parsing of Integers.
  654. * atoll: (libc)Parsing of Integers.
  655. * backtrace: (libc)Backtraces.
  656. * backtrace_symbols: (libc)Backtraces.
  657. * backtrace_symbols_fd: (libc)Backtraces.
  658. * basename: (libc)Finding Tokens in a String.
  659. * basename: (libc)Finding Tokens in a String.
  660. * bcmp: (libc)String/Array Comparison.
  661. * bcopy: (libc)Copying Strings and Arrays.
  662. * bind: (libc)Setting Address.
  663. * bind_textdomain_codeset: (libc)Charset conversion in gettext.
  664. * bindtextdomain: (libc)Locating gettext catalog.
  665. * brk: (libc)Resizing the Data Segment.
  666. * bsearch: (libc)Array Search Function.
  667. * btowc: (libc)Converting a Character.
  668. * bzero: (libc)Copying Strings and Arrays.
  669. * cabs: (libc)Absolute Value.
  670. * cabsf: (libc)Absolute Value.
  671. * cabsfN: (libc)Absolute Value.
  672. * cabsfNx: (libc)Absolute Value.
  673. * cabsl: (libc)Absolute Value.
  674. * cacos: (libc)Inverse Trig Functions.
  675. * cacosf: (libc)Inverse Trig Functions.
  676. * cacosfN: (libc)Inverse Trig Functions.
  677. * cacosfNx: (libc)Inverse Trig Functions.
  678. * cacosh: (libc)Hyperbolic Functions.
  679. * cacoshf: (libc)Hyperbolic Functions.
  680. * cacoshfN: (libc)Hyperbolic Functions.
  681. * cacoshfNx: (libc)Hyperbolic Functions.
  682. * cacoshl: (libc)Hyperbolic Functions.
  683. * cacosl: (libc)Inverse Trig Functions.
  684. * call_once: (libc)Call Once.
  685. * calloc: (libc)Allocating Cleared Space.
  686. * canonicalize: (libc)FP Bit Twiddling.
  687. * canonicalize_file_name: (libc)Symbolic Links.
  688. * canonicalizef: (libc)FP Bit Twiddling.
  689. * canonicalizefN: (libc)FP Bit Twiddling.
  690. * canonicalizefNx: (libc)FP Bit Twiddling.
  691. * canonicalizel: (libc)FP Bit Twiddling.
  692. * carg: (libc)Operations on Complex.
  693. * cargf: (libc)Operations on Complex.
  694. * cargfN: (libc)Operations on Complex.
  695. * cargfNx: (libc)Operations on Complex.
  696. * cargl: (libc)Operations on Complex.
  697. * casin: (libc)Inverse Trig Functions.
  698. * casinf: (libc)Inverse Trig Functions.
  699. * casinfN: (libc)Inverse Trig Functions.
  700. * casinfNx: (libc)Inverse Trig Functions.
  701. * casinh: (libc)Hyperbolic Functions.
  702. * casinhf: (libc)Hyperbolic Functions.
  703. * casinhfN: (libc)Hyperbolic Functions.
  704. * casinhfNx: (libc)Hyperbolic Functions.
  705. * casinhl: (libc)Hyperbolic Functions.
  706. * casinl: (libc)Inverse Trig Functions.
  707. * catan: (libc)Inverse Trig Functions.
  708. * catanf: (libc)Inverse Trig Functions.
  709. * catanfN: (libc)Inverse Trig Functions.
  710. * catanfNx: (libc)Inverse Trig Functions.
  711. * catanh: (libc)Hyperbolic Functions.
  712. * catanhf: (libc)Hyperbolic Functions.
  713. * catanhfN: (libc)Hyperbolic Functions.
  714. * catanhfNx: (libc)Hyperbolic Functions.
  715. * catanhl: (libc)Hyperbolic Functions.
  716. * catanl: (libc)Inverse Trig Functions.
  717. * catclose: (libc)The catgets Functions.
  718. * catgets: (libc)The catgets Functions.
  719. * catopen: (libc)The catgets Functions.
  720. * cbrt: (libc)Exponents and Logarithms.
  721. * cbrtf: (libc)Exponents and Logarithms.
  722. * cbrtfN: (libc)Exponents and Logarithms.
  723. * cbrtfNx: (libc)Exponents and Logarithms.
  724. * cbrtl: (libc)Exponents and Logarithms.
  725. * ccos: (libc)Trig Functions.
  726. * ccosf: (libc)Trig Functions.
  727. * ccosfN: (libc)Trig Functions.
  728. * ccosfNx: (libc)Trig Functions.
  729. * ccosh: (libc)Hyperbolic Functions.
  730. * ccoshf: (libc)Hyperbolic Functions.
  731. * ccoshfN: (libc)Hyperbolic Functions.
  732. * ccoshfNx: (libc)Hyperbolic Functions.
  733. * ccoshl: (libc)Hyperbolic Functions.
  734. * ccosl: (libc)Trig Functions.
  735. * ceil: (libc)Rounding Functions.
  736. * ceilf: (libc)Rounding Functions.
  737. * ceilfN: (libc)Rounding Functions.
  738. * ceilfNx: (libc)Rounding Functions.
  739. * ceill: (libc)Rounding Functions.
  740. * cexp: (libc)Exponents and Logarithms.
  741. * cexpf: (libc)Exponents and Logarithms.
  742. * cexpfN: (libc)Exponents and Logarithms.
  743. * cexpfNx: (libc)Exponents and Logarithms.
  744. * cexpl: (libc)Exponents and Logarithms.
  745. * cfgetibaud: (libc)Line Speed.
  746. * cfgetispeed: (libc)Line Speed.
  747. * cfgetobaud: (libc)Line Speed.
  748. * cfgetospeed: (libc)Line Speed.
  749. * cfmakeraw: (libc)Noncanonical Input.
  750. * cfsetbaud: (libc)Line Speed.
  751. * cfsetibaud: (libc)Line Speed.
  752. * cfsetispeed: (libc)Line Speed.
  753. * cfsetobaud: (libc)Line Speed.
  754. * cfsetospeed: (libc)Line Speed.
  755. * cfsetspeed: (libc)Line Speed.
  756. * chdir: (libc)Working Directory.
  757. * chmod: (libc)Setting Permissions.
  758. * chown: (libc)File Owner.
  759. * cimag: (libc)Operations on Complex.
  760. * cimagf: (libc)Operations on Complex.
  761. * cimagfN: (libc)Operations on Complex.
  762. * cimagfNx: (libc)Operations on Complex.
  763. * cimagl: (libc)Operations on Complex.
  764. * clearenv: (libc)Environment Access.
  765. * clearerr: (libc)Error Recovery.
  766. * clearerr_unlocked: (libc)Error Recovery.
  767. * clock: (libc)CPU Time.
  768. * clock_getres: (libc)Getting the Time.
  769. * clock_gettime: (libc)Getting the Time.
  770. * clock_nanosleep: (libc)Sleeping.
  771. * clock_settime: (libc)Setting and Adjusting the Time.
  772. * clog10: (libc)Exponents and Logarithms.
  773. * clog10f: (libc)Exponents and Logarithms.
  774. * clog10fN: (libc)Exponents and Logarithms.
  775. * clog10fNx: (libc)Exponents and Logarithms.
  776. * clog10l: (libc)Exponents and Logarithms.
  777. * clog: (libc)Exponents and Logarithms.
  778. * clogf: (libc)Exponents and Logarithms.
  779. * clogfN: (libc)Exponents and Logarithms.
  780. * clogfNx: (libc)Exponents and Logarithms.
  781. * clogl: (libc)Exponents and Logarithms.
  782. * close: (libc)Opening and Closing Files.
  783. * close_range: (libc)Opening and Closing Files.
  784. * closedir: (libc)Reading/Closing Directory.
  785. * closefrom: (libc)Opening and Closing Files.
  786. * closelog: (libc)closelog.
  787. * cnd_broadcast: (libc)ISO C Condition Variables.
  788. * cnd_destroy: (libc)ISO C Condition Variables.
  789. * cnd_init: (libc)ISO C Condition Variables.
  790. * cnd_signal: (libc)ISO C Condition Variables.
  791. * cnd_timedwait: (libc)ISO C Condition Variables.
  792. * cnd_wait: (libc)ISO C Condition Variables.
  793. * compoundn: (libc)Exponents and Logarithms.
  794. * compoundnf: (libc)Exponents and Logarithms.
  795. * compoundnfN: (libc)Exponents and Logarithms.
  796. * compoundnfNx: (libc)Exponents and Logarithms.
  797. * compoundnl: (libc)Exponents and Logarithms.
  798. * confstr: (libc)String Parameters.
  799. * conj: (libc)Operations on Complex.
  800. * conjf: (libc)Operations on Complex.
  801. * conjfN: (libc)Operations on Complex.
  802. * conjfNx: (libc)Operations on Complex.
  803. * conjl: (libc)Operations on Complex.
  804. * connect: (libc)Connecting.
  805. * copy_file_range: (libc)Copying File Data.
  806. * copysign: (libc)FP Bit Twiddling.
  807. * copysignf: (libc)FP Bit Twiddling.
  808. * copysignfN: (libc)FP Bit Twiddling.
  809. * copysignfNx: (libc)FP Bit Twiddling.
  810. * copysignl: (libc)FP Bit Twiddling.
  811. * cos: (libc)Trig Functions.
  812. * cosf: (libc)Trig Functions.
  813. * cosfN: (libc)Trig Functions.
  814. * cosfNx: (libc)Trig Functions.
  815. * cosh: (libc)Hyperbolic Functions.
  816. * coshf: (libc)Hyperbolic Functions.
  817. * coshfN: (libc)Hyperbolic Functions.
  818. * coshfNx: (libc)Hyperbolic Functions.
  819. * coshl: (libc)Hyperbolic Functions.
  820. * cosl: (libc)Trig Functions.
  821. * cospi: (libc)Trig Functions.
  822. * cospif: (libc)Trig Functions.
  823. * cospifN: (libc)Trig Functions.
  824. * cospifNx: (libc)Trig Functions.
  825. * cospil: (libc)Trig Functions.
  826. * cpow: (libc)Exponents and Logarithms.
  827. * cpowf: (libc)Exponents and Logarithms.
  828. * cpowfN: (libc)Exponents and Logarithms.
  829. * cpowfNx: (libc)Exponents and Logarithms.
  830. * cpowl: (libc)Exponents and Logarithms.
  831. * cproj: (libc)Operations on Complex.
  832. * cprojf: (libc)Operations on Complex.
  833. * cprojfN: (libc)Operations on Complex.
  834. * cprojfNx: (libc)Operations on Complex.
  835. * cprojl: (libc)Operations on Complex.
  836. * creal: (libc)Operations on Complex.
  837. * crealf: (libc)Operations on Complex.
  838. * crealfN: (libc)Operations on Complex.
  839. * crealfNx: (libc)Operations on Complex.
  840. * creall: (libc)Operations on Complex.
  841. * creat64: (libc)Opening and Closing Files.
  842. * creat: (libc)Opening and Closing Files.
  843. * csin: (libc)Trig Functions.
  844. * csinf: (libc)Trig Functions.
  845. * csinfN: (libc)Trig Functions.
  846. * csinfNx: (libc)Trig Functions.
  847. * csinh: (libc)Hyperbolic Functions.
  848. * csinhf: (libc)Hyperbolic Functions.
  849. * csinhfN: (libc)Hyperbolic Functions.
  850. * csinhfNx: (libc)Hyperbolic Functions.
  851. * csinhl: (libc)Hyperbolic Functions.
  852. * csinl: (libc)Trig Functions.
  853. * csqrt: (libc)Exponents and Logarithms.
  854. * csqrtf: (libc)Exponents and Logarithms.
  855. * csqrtfN: (libc)Exponents and Logarithms.
  856. * csqrtfNx: (libc)Exponents and Logarithms.
  857. * csqrtl: (libc)Exponents and Logarithms.
  858. * ctan: (libc)Trig Functions.
  859. * ctanf: (libc)Trig Functions.
  860. * ctanfN: (libc)Trig Functions.
  861. * ctanfNx: (libc)Trig Functions.
  862. * ctanh: (libc)Hyperbolic Functions.
  863. * ctanhf: (libc)Hyperbolic Functions.
  864. * ctanhfN: (libc)Hyperbolic Functions.
  865. * ctanhfNx: (libc)Hyperbolic Functions.
  866. * ctanhl: (libc)Hyperbolic Functions.
  867. * ctanl: (libc)Trig Functions.
  868. * ctermid: (libc)Identifying the Terminal.
  869. * ctime: (libc)Formatting Calendar Time.
  870. * ctime_r: (libc)Formatting Calendar Time.
  871. * cuserid: (libc)Who Logged In.
  872. * daddl: (libc)Misc FP Arithmetic.
  873. * dcgettext: (libc)Translation with gettext.
  874. * dcngettext: (libc)Advanced gettext functions.
  875. * ddivl: (libc)Misc FP Arithmetic.
  876. * dfmal: (libc)Misc FP Arithmetic.
  877. * dgettext: (libc)Translation with gettext.
  878. * difftime: (libc)Calculating Elapsed Time.
  879. * dirfd: (libc)Opening a Directory.
  880. * dirname: (libc)Finding Tokens in a String.
  881. * div: (libc)Integer Division.
  882. * dlinfo: (libc)Dynamic Linker Introspection.
  883. * dmull: (libc)Misc FP Arithmetic.
  884. * dngettext: (libc)Advanced gettext functions.
  885. * dprintf: (libc)Formatted Output Functions.
  886. * drand48: (libc)SVID Random.
  887. * drand48_r: (libc)SVID Random.
  888. * drem: (libc)Remainder Functions.
  889. * dremf: (libc)Remainder Functions.
  890. * dreml: (libc)Remainder Functions.
  891. * dsqrtl: (libc)Misc FP Arithmetic.
  892. * dsubl: (libc)Misc FP Arithmetic.
  893. * dup2: (libc)Duplicating Descriptors.
  894. * dup3: (libc)Duplicating Descriptors.
  895. * dup: (libc)Duplicating Descriptors.
  896. * ecvt: (libc)System V Number Conversion.
  897. * ecvt_r: (libc)System V Number Conversion.
  898. * endfsent: (libc)fstab.
  899. * endgrent: (libc)Scanning All Groups.
  900. * endhostent: (libc)Host Names.
  901. * endmntent: (libc)mtab.
  902. * endnetent: (libc)Networks Database.
  903. * endnetgrent: (libc)Lookup Netgroup.
  904. * endprotoent: (libc)Protocols Database.
  905. * endpwent: (libc)Scanning All Users.
  906. * endservent: (libc)Services Database.
  907. * endutent: (libc)Manipulating the Database.
  908. * endutxent: (libc)XPG Functions.
  909. * envz_add: (libc)Envz Functions.
  910. * envz_entry: (libc)Envz Functions.
  911. * envz_get: (libc)Envz Functions.
  912. * envz_merge: (libc)Envz Functions.
  913. * envz_remove: (libc)Envz Functions.
  914. * envz_strip: (libc)Envz Functions.
  915. * epoll_create: (libc)Other Low-Level I/O APIs.
  916. * epoll_wait: (libc)Other Low-Level I/O APIs.
  917. * erand48: (libc)SVID Random.
  918. * erand48_r: (libc)SVID Random.
  919. * erf: (libc)Special Functions.
  920. * erfc: (libc)Special Functions.
  921. * erfcf: (libc)Special Functions.
  922. * erfcfN: (libc)Special Functions.
  923. * erfcfNx: (libc)Special Functions.
  924. * erfcl: (libc)Special Functions.
  925. * erff: (libc)Special Functions.
  926. * erffN: (libc)Special Functions.
  927. * erffNx: (libc)Special Functions.
  928. * erfl: (libc)Special Functions.
  929. * err: (libc)Error Messages.
  930. * errno: (libc)Checking for Errors.
  931. * error: (libc)Error Messages.
  932. * error_at_line: (libc)Error Messages.
  933. * errx: (libc)Error Messages.
  934. * execl: (libc)Executing a File.
  935. * execle: (libc)Executing a File.
  936. * execlp: (libc)Executing a File.
  937. * execv: (libc)Executing a File.
  938. * execve: (libc)Executing a File.
  939. * execvp: (libc)Executing a File.
  940. * exit: (libc)Normal Termination.
  941. * exp10: (libc)Exponents and Logarithms.
  942. * exp10f: (libc)Exponents and Logarithms.
  943. * exp10fN: (libc)Exponents and Logarithms.
  944. * exp10fNx: (libc)Exponents and Logarithms.
  945. * exp10l: (libc)Exponents and Logarithms.
  946. * exp10m1: (libc)Exponents and Logarithms.
  947. * exp10m1f: (libc)Exponents and Logarithms.
  948. * exp10m1fN: (libc)Exponents and Logarithms.
  949. * exp10m1fNx: (libc)Exponents and Logarithms.
  950. * exp10m1l: (libc)Exponents and Logarithms.
  951. * exp2: (libc)Exponents and Logarithms.
  952. * exp2f: (libc)Exponents and Logarithms.
  953. * exp2fN: (libc)Exponents and Logarithms.
  954. * exp2fNx: (libc)Exponents and Logarithms.
  955. * exp2l: (libc)Exponents and Logarithms.
  956. * exp2m1: (libc)Exponents and Logarithms.
  957. * exp2m1f: (libc)Exponents and Logarithms.
  958. * exp2m1fN: (libc)Exponents and Logarithms.
  959. * exp2m1fNx: (libc)Exponents and Logarithms.
  960. * exp2m1l: (libc)Exponents and Logarithms.
  961. * exp: (libc)Exponents and Logarithms.
  962. * expf: (libc)Exponents and Logarithms.
  963. * expfN: (libc)Exponents and Logarithms.
  964. * expfNx: (libc)Exponents and Logarithms.
  965. * expl: (libc)Exponents and Logarithms.
  966. * explicit_bzero: (libc)Erasing Sensitive Data.
  967. * expm1: (libc)Exponents and Logarithms.
  968. * expm1f: (libc)Exponents and Logarithms.
  969. * expm1fN: (libc)Exponents and Logarithms.
  970. * expm1fNx: (libc)Exponents and Logarithms.
  971. * expm1l: (libc)Exponents and Logarithms.
  972. * fMaddfN: (libc)Misc FP Arithmetic.
  973. * fMaddfNx: (libc)Misc FP Arithmetic.
  974. * fMdivfN: (libc)Misc FP Arithmetic.
  975. * fMdivfNx: (libc)Misc FP Arithmetic.
  976. * fMfmafN: (libc)Misc FP Arithmetic.
  977. * fMfmafNx: (libc)Misc FP Arithmetic.
  978. * fMmulfN: (libc)Misc FP Arithmetic.
  979. * fMmulfNx: (libc)Misc FP Arithmetic.
  980. * fMsqrtfN: (libc)Misc FP Arithmetic.
  981. * fMsqrtfNx: (libc)Misc FP Arithmetic.
  982. * fMsubfN: (libc)Misc FP Arithmetic.
  983. * fMsubfNx: (libc)Misc FP Arithmetic.
  984. * fMxaddfN: (libc)Misc FP Arithmetic.
  985. * fMxaddfNx: (libc)Misc FP Arithmetic.
  986. * fMxdivfN: (libc)Misc FP Arithmetic.
  987. * fMxdivfNx: (libc)Misc FP Arithmetic.
  988. * fMxfmafN: (libc)Misc FP Arithmetic.
  989. * fMxfmafNx: (libc)Misc FP Arithmetic.
  990. * fMxmulfN: (libc)Misc FP Arithmetic.
  991. * fMxmulfNx: (libc)Misc FP Arithmetic.
  992. * fMxsqrtfN: (libc)Misc FP Arithmetic.
  993. * fMxsqrtfNx: (libc)Misc FP Arithmetic.
  994. * fMxsubfN: (libc)Misc FP Arithmetic.
  995. * fMxsubfNx: (libc)Misc FP Arithmetic.
  996. * fabs: (libc)Absolute Value.
  997. * fabsf: (libc)Absolute Value.
  998. * fabsfN: (libc)Absolute Value.
  999. * fabsfNx: (libc)Absolute Value.
  1000. * fabsl: (libc)Absolute Value.
  1001. * faccessat: (libc)Testing File Access.
  1002. * fadd: (libc)Misc FP Arithmetic.
  1003. * faddl: (libc)Misc FP Arithmetic.
  1004. * fchdir: (libc)Working Directory.
  1005. * fchmod: (libc)Setting Permissions.
  1006. * fchown: (libc)File Owner.
  1007. * fclose: (libc)Closing Streams.
  1008. * fcloseall: (libc)Closing Streams.
  1009. * fcntl: (libc)Control Operations.
  1010. * fcvt: (libc)System V Number Conversion.
  1011. * fcvt_r: (libc)System V Number Conversion.
  1012. * fdatasync: (libc)Synchronizing I/O.
  1013. * fdim: (libc)Misc FP Arithmetic.
  1014. * fdimf: (libc)Misc FP Arithmetic.
  1015. * fdimfN: (libc)Misc FP Arithmetic.
  1016. * fdimfNx: (libc)Misc FP Arithmetic.
  1017. * fdiml: (libc)Misc FP Arithmetic.
  1018. * fdiv: (libc)Misc FP Arithmetic.
  1019. * fdivl: (libc)Misc FP Arithmetic.
  1020. * fdopen: (libc)Descriptors and Streams.
  1021. * fdopendir: (libc)Opening a Directory.
  1022. * feclearexcept: (libc)Status bit operations.
  1023. * fedisableexcept: (libc)Control Functions.
  1024. * feenableexcept: (libc)Control Functions.
  1025. * fegetenv: (libc)Control Functions.
  1026. * fegetexcept: (libc)Control Functions.
  1027. * fegetexceptflag: (libc)Status bit operations.
  1028. * fegetmode: (libc)Control Functions.
  1029. * fegetround: (libc)Rounding.
  1030. * feholdexcept: (libc)Control Functions.
  1031. * feof: (libc)EOF and Errors.
  1032. * feof_unlocked: (libc)EOF and Errors.
  1033. * feraiseexcept: (libc)Status bit operations.
  1034. * ferror: (libc)EOF and Errors.
  1035. * ferror_unlocked: (libc)EOF and Errors.
  1036. * fesetenv: (libc)Control Functions.
  1037. * fesetexcept: (libc)Status bit operations.
  1038. * fesetexceptflag: (libc)Status bit operations.
  1039. * fesetmode: (libc)Control Functions.
  1040. * fesetround: (libc)Rounding.
  1041. * fetestexcept: (libc)Status bit operations.
  1042. * fetestexceptflag: (libc)Status bit operations.
  1043. * feupdateenv: (libc)Control Functions.
  1044. * fexecve: (libc)Executing a File.
  1045. * fflush: (libc)Flushing Buffers.
  1046. * fflush_unlocked: (libc)Flushing Buffers.
  1047. * ffma: (libc)Misc FP Arithmetic.
  1048. * ffmal: (libc)Misc FP Arithmetic.
  1049. * fgetc: (libc)Character Input.
  1050. * fgetc_unlocked: (libc)Character Input.
  1051. * fgetgrent: (libc)Scanning All Groups.
  1052. * fgetgrent_r: (libc)Scanning All Groups.
  1053. * fgetpos64: (libc)Portable Positioning.
  1054. * fgetpos: (libc)Portable Positioning.
  1055. * fgetpwent: (libc)Scanning All Users.
  1056. * fgetpwent_r: (libc)Scanning All Users.
  1057. * fgets: (libc)Line Input.
  1058. * fgets_unlocked: (libc)Line Input.
  1059. * fgetwc: (libc)Character Input.
  1060. * fgetwc_unlocked: (libc)Character Input.
  1061. * fgetws: (libc)Line Input.
  1062. * fgetws_unlocked: (libc)Line Input.
  1063. * fileno: (libc)Descriptors and Streams.
  1064. * fileno_unlocked: (libc)Descriptors and Streams.
  1065. * finite: (libc)Floating Point Classes.
  1066. * finitef: (libc)Floating Point Classes.
  1067. * finitel: (libc)Floating Point Classes.
  1068. * flockfile: (libc)Streams and Threads.
  1069. * floor: (libc)Rounding Functions.
  1070. * floorf: (libc)Rounding Functions.
  1071. * floorfN: (libc)Rounding Functions.
  1072. * floorfNx: (libc)Rounding Functions.
  1073. * floorl: (libc)Rounding Functions.
  1074. * fma: (libc)Misc FP Arithmetic.
  1075. * fmaf: (libc)Misc FP Arithmetic.
  1076. * fmafN: (libc)Misc FP Arithmetic.
  1077. * fmafNx: (libc)Misc FP Arithmetic.
  1078. * fmal: (libc)Misc FP Arithmetic.
  1079. * fmax: (libc)Misc FP Arithmetic.
  1080. * fmaxf: (libc)Misc FP Arithmetic.
  1081. * fmaxfN: (libc)Misc FP Arithmetic.
  1082. * fmaxfNx: (libc)Misc FP Arithmetic.
  1083. * fmaximum: (libc)Misc FP Arithmetic.
  1084. * fmaximum_mag: (libc)Misc FP Arithmetic.
  1085. * fmaximum_mag_num: (libc)Misc FP Arithmetic.
  1086. * fmaximum_mag_numf: (libc)Misc FP Arithmetic.
  1087. * fmaximum_mag_numfN: (libc)Misc FP Arithmetic.
  1088. * fmaximum_mag_numfNx: (libc)Misc FP Arithmetic.
  1089. * fmaximum_mag_numl: (libc)Misc FP Arithmetic.
  1090. * fmaximum_magf: (libc)Misc FP Arithmetic.
  1091. * fmaximum_magfN: (libc)Misc FP Arithmetic.
  1092. * fmaximum_magfNx: (libc)Misc FP Arithmetic.
  1093. * fmaximum_magl: (libc)Misc FP Arithmetic.
  1094. * fmaximum_num: (libc)Misc FP Arithmetic.
  1095. * fmaximum_numf: (libc)Misc FP Arithmetic.
  1096. * fmaximum_numfN: (libc)Misc FP Arithmetic.
  1097. * fmaximum_numfNx: (libc)Misc FP Arithmetic.
  1098. * fmaximum_numl: (libc)Misc FP Arithmetic.
  1099. * fmaximumf: (libc)Misc FP Arithmetic.
  1100. * fmaximumfN: (libc)Misc FP Arithmetic.
  1101. * fmaximumfNx: (libc)Misc FP Arithmetic.
  1102. * fmaximuml: (libc)Misc FP Arithmetic.
  1103. * fmaxl: (libc)Misc FP Arithmetic.
  1104. * fmaxmag: (libc)Misc FP Arithmetic.
  1105. * fmaxmagf: (libc)Misc FP Arithmetic.
  1106. * fmaxmagfN: (libc)Misc FP Arithmetic.
  1107. * fmaxmagfNx: (libc)Misc FP Arithmetic.
  1108. * fmaxmagl: (libc)Misc FP Arithmetic.
  1109. * fmemopen: (libc)String Streams.
  1110. * fmin: (libc)Misc FP Arithmetic.
  1111. * fminf: (libc)Misc FP Arithmetic.
  1112. * fminfN: (libc)Misc FP Arithmetic.
  1113. * fminfNx: (libc)Misc FP Arithmetic.
  1114. * fminimum: (libc)Misc FP Arithmetic.
  1115. * fminimum_mag: (libc)Misc FP Arithmetic.
  1116. * fminimum_mag_num: (libc)Misc FP Arithmetic.
  1117. * fminimum_mag_numf: (libc)Misc FP Arithmetic.
  1118. * fminimum_mag_numfN: (libc)Misc FP Arithmetic.
  1119. * fminimum_mag_numfNx: (libc)Misc FP Arithmetic.
  1120. * fminimum_mag_numl: (libc)Misc FP Arithmetic.
  1121. * fminimum_magf: (libc)Misc FP Arithmetic.
  1122. * fminimum_magfN: (libc)Misc FP Arithmetic.
  1123. * fminimum_magfNx: (libc)Misc FP Arithmetic.
  1124. * fminimum_magl: (libc)Misc FP Arithmetic.
  1125. * fminimum_num: (libc)Misc FP Arithmetic.
  1126. * fminimum_numf: (libc)Misc FP Arithmetic.
  1127. * fminimum_numfN: (libc)Misc FP Arithmetic.
  1128. * fminimum_numfNx: (libc)Misc FP Arithmetic.
  1129. * fminimum_numl: (libc)Misc FP Arithmetic.
  1130. * fminimumf: (libc)Misc FP Arithmetic.
  1131. * fminimumfN: (libc)Misc FP Arithmetic.
  1132. * fminimumfNx: (libc)Misc FP Arithmetic.
  1133. * fminimuml: (libc)Misc FP Arithmetic.
  1134. * fminl: (libc)Misc FP Arithmetic.
  1135. * fminmag: (libc)Misc FP Arithmetic.
  1136. * fminmagf: (libc)Misc FP Arithmetic.
  1137. * fminmagfN: (libc)Misc FP Arithmetic.
  1138. * fminmagfNx: (libc)Misc FP Arithmetic.
  1139. * fminmagl: (libc)Misc FP Arithmetic.
  1140. * fmod: (libc)Remainder Functions.
  1141. * fmodf: (libc)Remainder Functions.
  1142. * fmodfN: (libc)Remainder Functions.
  1143. * fmodfNx: (libc)Remainder Functions.
  1144. * fmodl: (libc)Remainder Functions.
  1145. * fmtmsg: (libc)Printing Formatted Messages.
  1146. * fmul: (libc)Misc FP Arithmetic.
  1147. * fmull: (libc)Misc FP Arithmetic.
  1148. * fnmatch: (libc)Wildcard Matching.
  1149. * fopen64: (libc)Opening Streams.
  1150. * fopen: (libc)Opening Streams.
  1151. * fopencookie: (libc)Streams and Cookies.
  1152. * fork: (libc)Creating a Process.
  1153. * forkpty: (libc)Pseudo-Terminal Pairs.
  1154. * fpathconf: (libc)Pathconf.
  1155. * fpclassify: (libc)Floating Point Classes.
  1156. * fprintf: (libc)Formatted Output Functions.
  1157. * fputc: (libc)Simple Output.
  1158. * fputc_unlocked: (libc)Simple Output.
  1159. * fputs: (libc)Simple Output.
  1160. * fputs_unlocked: (libc)Simple Output.
  1161. * fputwc: (libc)Simple Output.
  1162. * fputwc_unlocked: (libc)Simple Output.
  1163. * fputws: (libc)Simple Output.
  1164. * fputws_unlocked: (libc)Simple Output.
  1165. * fread: (libc)Block Input/Output.
  1166. * fread_unlocked: (libc)Block Input/Output.
  1167. * free: (libc)Freeing after Malloc.
  1168. * free_aligned_sized: (libc)Freeing after Malloc.
  1169. * free_sized: (libc)Freeing after Malloc.
  1170. * freopen64: (libc)Opening Streams.
  1171. * freopen: (libc)Opening Streams.
  1172. * frexp: (libc)Normalization Functions.
  1173. * frexpf: (libc)Normalization Functions.
  1174. * frexpfN: (libc)Normalization Functions.
  1175. * frexpfNx: (libc)Normalization Functions.
  1176. * frexpl: (libc)Normalization Functions.
  1177. * fromfp: (libc)Rounding Functions.
  1178. * fromfpf: (libc)Rounding Functions.
  1179. * fromfpfN: (libc)Rounding Functions.
  1180. * fromfpfNx: (libc)Rounding Functions.
  1181. * fromfpl: (libc)Rounding Functions.
  1182. * fromfpx: (libc)Rounding Functions.
  1183. * fromfpxf: (libc)Rounding Functions.
  1184. * fromfpxfN: (libc)Rounding Functions.
  1185. * fromfpxfNx: (libc)Rounding Functions.
  1186. * fromfpxl: (libc)Rounding Functions.
  1187. * fscanf: (libc)Formatted Input Functions.
  1188. * fseek: (libc)File Positioning.
  1189. * fseeko64: (libc)File Positioning.
  1190. * fseeko: (libc)File Positioning.
  1191. * fsetpos64: (libc)Portable Positioning.
  1192. * fsetpos: (libc)Portable Positioning.
  1193. * fsqrt: (libc)Misc FP Arithmetic.
  1194. * fsqrtl: (libc)Misc FP Arithmetic.
  1195. * fstat64: (libc)Reading Attributes.
  1196. * fstat: (libc)Reading Attributes.
  1197. * fstatat64: (libc)Reading Attributes.
  1198. * fstatat: (libc)Reading Attributes.
  1199. * fsub: (libc)Misc FP Arithmetic.
  1200. * fsubl: (libc)Misc FP Arithmetic.
  1201. * fsync: (libc)Synchronizing I/O.
  1202. * ftell: (libc)File Positioning.
  1203. * ftello64: (libc)File Positioning.
  1204. * ftello: (libc)File Positioning.
  1205. * ftruncate64: (libc)File Size.
  1206. * ftruncate: (libc)File Size.
  1207. * ftrylockfile: (libc)Streams and Threads.
  1208. * ftw64: (libc)Working with Directory Trees.
  1209. * ftw: (libc)Working with Directory Trees.
  1210. * funlockfile: (libc)Streams and Threads.
  1211. * futimens: (libc)File Times.
  1212. * futimes: (libc)File Times.
  1213. * fwide: (libc)Streams and I18N.
  1214. * fwprintf: (libc)Formatted Output Functions.
  1215. * fwrite: (libc)Block Input/Output.
  1216. * fwrite_unlocked: (libc)Block Input/Output.
  1217. * fwscanf: (libc)Formatted Input Functions.
  1218. * gamma: (libc)Special Functions.
  1219. * gammaf: (libc)Special Functions.
  1220. * gammal: (libc)Special Functions.
  1221. * gcvt: (libc)System V Number Conversion.
  1222. * get_avphys_pages: (libc)Query Memory Parameters.
  1223. * get_current_dir_name: (libc)Working Directory.
  1224. * get_nprocs: (libc)Processor Resources.
  1225. * get_nprocs_conf: (libc)Processor Resources.
  1226. * get_phys_pages: (libc)Query Memory Parameters.
  1227. * getauxval: (libc)Auxiliary Vector.
  1228. * getc: (libc)Character Input.
  1229. * getc_unlocked: (libc)Character Input.
  1230. * getchar: (libc)Character Input.
  1231. * getchar_unlocked: (libc)Character Input.
  1232. * getcontext: (libc)System V contexts.
  1233. * getcpu: (libc)CPU Affinity.
  1234. * getcwd: (libc)Working Directory.
  1235. * getdate: (libc)General Time String Parsing.
  1236. * getdate_r: (libc)General Time String Parsing.
  1237. * getdelim: (libc)Line Input.
  1238. * getdents64: (libc)Low-level Directory Access.
  1239. * getdomainname: (libc)Host Identification.
  1240. * getegid: (libc)Reading Persona.
  1241. * getentropy: (libc)Unpredictable Bytes.
  1242. * getenv: (libc)Environment Access.
  1243. * geteuid: (libc)Reading Persona.
  1244. * getfsent: (libc)fstab.
  1245. * getfsfile: (libc)fstab.
  1246. * getfsspec: (libc)fstab.
  1247. * getgid: (libc)Reading Persona.
  1248. * getgrent: (libc)Scanning All Groups.
  1249. * getgrent_r: (libc)Scanning All Groups.
  1250. * getgrgid: (libc)Lookup Group.
  1251. * getgrgid_r: (libc)Lookup Group.
  1252. * getgrnam: (libc)Lookup Group.
  1253. * getgrnam_r: (libc)Lookup Group.
  1254. * getgrouplist: (libc)Setting Groups.
  1255. * getgroups: (libc)Reading Persona.
  1256. * gethostbyaddr: (libc)Host Names.
  1257. * gethostbyaddr_r: (libc)Host Names.
  1258. * gethostbyname2: (libc)Host Names.
  1259. * gethostbyname2_r: (libc)Host Names.
  1260. * gethostbyname: (libc)Host Names.
  1261. * gethostbyname_r: (libc)Host Names.
  1262. * gethostent: (libc)Host Names.
  1263. * gethostid: (libc)Host Identification.
  1264. * gethostname: (libc)Host Identification.
  1265. * getitimer: (libc)Setting an Alarm.
  1266. * getline: (libc)Line Input.
  1267. * getloadavg: (libc)Processor Resources.
  1268. * getlogin: (libc)Who Logged In.
  1269. * getmntent: (libc)mtab.
  1270. * getmntent_r: (libc)mtab.
  1271. * getnetbyaddr: (libc)Networks Database.
  1272. * getnetbyname: (libc)Networks Database.
  1273. * getnetent: (libc)Networks Database.
  1274. * getnetgrent: (libc)Lookup Netgroup.
  1275. * getnetgrent_r: (libc)Lookup Netgroup.
  1276. * getopt: (libc)Using Getopt.
  1277. * getopt_long: (libc)Getopt Long Options.
  1278. * getopt_long_only: (libc)Getopt Long Options.
  1279. * getpagesize: (libc)Query Memory Parameters.
  1280. * getpass: (libc)getpass.
  1281. * getpayload: (libc)FP Bit Twiddling.
  1282. * getpayloadf: (libc)FP Bit Twiddling.
  1283. * getpayloadfN: (libc)FP Bit Twiddling.
  1284. * getpayloadfNx: (libc)FP Bit Twiddling.
  1285. * getpayloadl: (libc)FP Bit Twiddling.
  1286. * getpeername: (libc)Who is Connected.
  1287. * getpgid: (libc)Process Group Functions.
  1288. * getpgrp: (libc)Process Group Functions.
  1289. * getpid: (libc)Process Identification.
  1290. * getppid: (libc)Process Identification.
  1291. * getpriority: (libc)Traditional Scheduling Functions.
  1292. * getprotobyname: (libc)Protocols Database.
  1293. * getprotobynumber: (libc)Protocols Database.
  1294. * getprotoent: (libc)Protocols Database.
  1295. * getpt: (libc)Allocation.
  1296. * getpwent: (libc)Scanning All Users.
  1297. * getpwent_r: (libc)Scanning All Users.
  1298. * getpwnam: (libc)Lookup User.
  1299. * getpwnam_r: (libc)Lookup User.
  1300. * getpwuid: (libc)Lookup User.
  1301. * getpwuid_r: (libc)Lookup User.
  1302. * getrandom: (libc)Unpredictable Bytes.
  1303. * getrlimit64: (libc)Limits on Resources.
  1304. * getrlimit: (libc)Limits on Resources.
  1305. * getrusage: (libc)Resource Usage.
  1306. * gets: (libc)Line Input.
  1307. * getservbyname: (libc)Services Database.
  1308. * getservbyport: (libc)Services Database.
  1309. * getservent: (libc)Services Database.
  1310. * getsid: (libc)Process Group Functions.
  1311. * getsockname: (libc)Reading Address.
  1312. * getsockopt: (libc)Socket Option Functions.
  1313. * getsubopt: (libc)Suboptions.
  1314. * gettext: (libc)Translation with gettext.
  1315. * gettid: (libc)Process Identification.
  1316. * gettimeofday: (libc)Getting the Time.
  1317. * getuid: (libc)Reading Persona.
  1318. * getumask: (libc)Setting Permissions.
  1319. * getutent: (libc)Manipulating the Database.
  1320. * getutent_r: (libc)Manipulating the Database.
  1321. * getutid: (libc)Manipulating the Database.
  1322. * getutid_r: (libc)Manipulating the Database.
  1323. * getutline: (libc)Manipulating the Database.
  1324. * getutline_r: (libc)Manipulating the Database.
  1325. * getutmp: (libc)XPG Functions.
  1326. * getutmpx: (libc)XPG Functions.
  1327. * getutxent: (libc)XPG Functions.
  1328. * getutxid: (libc)XPG Functions.
  1329. * getutxline: (libc)XPG Functions.
  1330. * getw: (libc)Character Input.
  1331. * getwc: (libc)Character Input.
  1332. * getwc_unlocked: (libc)Character Input.
  1333. * getwchar: (libc)Character Input.
  1334. * getwchar_unlocked: (libc)Character Input.
  1335. * getwd: (libc)Working Directory.
  1336. * glob64: (libc)Calling Glob.
  1337. * glob: (libc)Calling Glob.
  1338. * globfree64: (libc)More Flags for Globbing.
  1339. * globfree: (libc)More Flags for Globbing.
  1340. * gmtime: (libc)Broken-down Time.
  1341. * gmtime_r: (libc)Broken-down Time.
  1342. * grantpt: (libc)Allocation.
  1343. * gsignal: (libc)Signaling Yourself.
  1344. * gtty: (libc)BSD Terminal Modes.
  1345. * hasmntopt: (libc)mtab.
  1346. * hcreate: (libc)Hash Search Function.
  1347. * hcreate_r: (libc)Hash Search Function.
  1348. * hdestroy: (libc)Hash Search Function.
  1349. * hdestroy_r: (libc)Hash Search Function.
  1350. * hsearch: (libc)Hash Search Function.
  1351. * hsearch_r: (libc)Hash Search Function.
  1352. * htonl: (libc)Byte Order.
  1353. * htons: (libc)Byte Order.
  1354. * hypot: (libc)Exponents and Logarithms.
  1355. * hypotf: (libc)Exponents and Logarithms.
  1356. * hypotfN: (libc)Exponents and Logarithms.
  1357. * hypotfNx: (libc)Exponents and Logarithms.
  1358. * hypotl: (libc)Exponents and Logarithms.
  1359. * iconv: (libc)Generic Conversion Interface.
  1360. * iconv_close: (libc)Generic Conversion Interface.
  1361. * iconv_open: (libc)Generic Conversion Interface.
  1362. * if_freenameindex: (libc)Interface Naming.
  1363. * if_indextoname: (libc)Interface Naming.
  1364. * if_nameindex: (libc)Interface Naming.
  1365. * if_nametoindex: (libc)Interface Naming.
  1366. * ilogb: (libc)Exponents and Logarithms.
  1367. * ilogbf: (libc)Exponents and Logarithms.
  1368. * ilogbfN: (libc)Exponents and Logarithms.
  1369. * ilogbfNx: (libc)Exponents and Logarithms.
  1370. * ilogbl: (libc)Exponents and Logarithms.
  1371. * imaxabs: (libc)Absolute Value.
  1372. * imaxdiv: (libc)Integer Division.
  1373. * in6addr_any: (libc)Host Address Data Type.
  1374. * in6addr_loopback: (libc)Host Address Data Type.
  1375. * index: (libc)Search Functions.
  1376. * inet_addr: (libc)Host Address Functions.
  1377. * inet_aton: (libc)Host Address Functions.
  1378. * inet_lnaof: (libc)Host Address Functions.
  1379. * inet_makeaddr: (libc)Host Address Functions.
  1380. * inet_netof: (libc)Host Address Functions.
  1381. * inet_network: (libc)Host Address Functions.
  1382. * inet_ntoa: (libc)Host Address Functions.
  1383. * inet_ntop: (libc)Host Address Functions.
  1384. * inet_pton: (libc)Host Address Functions.
  1385. * initgroups: (libc)Setting Groups.
  1386. * initstate: (libc)BSD Random.
  1387. * initstate_r: (libc)BSD Random.
  1388. * innetgr: (libc)Netgroup Membership.
  1389. * ioctl: (libc)IOCTLs.
  1390. * isalnum: (libc)Classification of Characters.
  1391. * isalpha: (libc)Classification of Characters.
  1392. * isascii: (libc)Classification of Characters.
  1393. * isatty: (libc)Is It a Terminal.
  1394. * isblank: (libc)Classification of Characters.
  1395. * iscanonical: (libc)Floating Point Classes.
  1396. * iscntrl: (libc)Classification of Characters.
  1397. * isdigit: (libc)Classification of Characters.
  1398. * iseqsig: (libc)FP Comparison Functions.
  1399. * isfinite: (libc)Floating Point Classes.
  1400. * isgraph: (libc)Classification of Characters.
  1401. * isgreater: (libc)FP Comparison Functions.
  1402. * isgreaterequal: (libc)FP Comparison Functions.
  1403. * isinf: (libc)Floating Point Classes.
  1404. * isinff: (libc)Floating Point Classes.
  1405. * isinfl: (libc)Floating Point Classes.
  1406. * isless: (libc)FP Comparison Functions.
  1407. * islessequal: (libc)FP Comparison Functions.
  1408. * islessgreater: (libc)FP Comparison Functions.
  1409. * islower: (libc)Classification of Characters.
  1410. * isnan: (libc)Floating Point Classes.
  1411. * isnan: (libc)Floating Point Classes.
  1412. * isnanf: (libc)Floating Point Classes.
  1413. * isnanl: (libc)Floating Point Classes.
  1414. * isnormal: (libc)Floating Point Classes.
  1415. * isprint: (libc)Classification of Characters.
  1416. * ispunct: (libc)Classification of Characters.
  1417. * issignaling: (libc)Floating Point Classes.
  1418. * isspace: (libc)Classification of Characters.
  1419. * issubnormal: (libc)Floating Point Classes.
  1420. * isunordered: (libc)FP Comparison Functions.
  1421. * isupper: (libc)Classification of Characters.
  1422. * iswalnum: (libc)Classification of Wide Characters.
  1423. * iswalpha: (libc)Classification of Wide Characters.
  1424. * iswblank: (libc)Classification of Wide Characters.
  1425. * iswcntrl: (libc)Classification of Wide Characters.
  1426. * iswctype: (libc)Classification of Wide Characters.
  1427. * iswdigit: (libc)Classification of Wide Characters.
  1428. * iswgraph: (libc)Classification of Wide Characters.
  1429. * iswlower: (libc)Classification of Wide Characters.
  1430. * iswprint: (libc)Classification of Wide Characters.
  1431. * iswpunct: (libc)Classification of Wide Characters.
  1432. * iswspace: (libc)Classification of Wide Characters.
  1433. * iswupper: (libc)Classification of Wide Characters.
  1434. * iswxdigit: (libc)Classification of Wide Characters.
  1435. * isxdigit: (libc)Classification of Characters.
  1436. * iszero: (libc)Floating Point Classes.
  1437. * j0: (libc)Special Functions.
  1438. * j0f: (libc)Special Functions.
  1439. * j0fN: (libc)Special Functions.
  1440. * j0fNx: (libc)Special Functions.
  1441. * j0l: (libc)Special Functions.
  1442. * j1: (libc)Special Functions.
  1443. * j1f: (libc)Special Functions.
  1444. * j1fN: (libc)Special Functions.
  1445. * j1fNx: (libc)Special Functions.
  1446. * j1l: (libc)Special Functions.
  1447. * jn: (libc)Special Functions.
  1448. * jnf: (libc)Special Functions.
  1449. * jnfN: (libc)Special Functions.
  1450. * jnfNx: (libc)Special Functions.
  1451. * jnl: (libc)Special Functions.
  1452. * jrand48: (libc)SVID Random.
  1453. * jrand48_r: (libc)SVID Random.
  1454. * kill: (libc)Signaling Another Process.
  1455. * killpg: (libc)Signaling Another Process.
  1456. * l64a: (libc)Encode Binary Data.
  1457. * labs: (libc)Absolute Value.
  1458. * lcong48: (libc)SVID Random.
  1459. * lcong48_r: (libc)SVID Random.
  1460. * ldexp: (libc)Normalization Functions.
  1461. * ldexpf: (libc)Normalization Functions.
  1462. * ldexpfN: (libc)Normalization Functions.
  1463. * ldexpfNx: (libc)Normalization Functions.
  1464. * ldexpl: (libc)Normalization Functions.
  1465. * ldiv: (libc)Integer Division.
  1466. * lfind: (libc)Array Search Function.
  1467. * lgamma: (libc)Special Functions.
  1468. * lgamma_r: (libc)Special Functions.
  1469. * lgammaf: (libc)Special Functions.
  1470. * lgammafN: (libc)Special Functions.
  1471. * lgammafN_r: (libc)Special Functions.
  1472. * lgammafNx: (libc)Special Functions.
  1473. * lgammafNx_r: (libc)Special Functions.
  1474. * lgammaf_r: (libc)Special Functions.
  1475. * lgammal: (libc)Special Functions.
  1476. * lgammal_r: (libc)Special Functions.
  1477. * link: (libc)Hard Links.
  1478. * linkat: (libc)Hard Links.
  1479. * lio_listio64: (libc)Asynchronous Reads/Writes.
  1480. * lio_listio: (libc)Asynchronous Reads/Writes.
  1481. * listen: (libc)Listening.
  1482. * llabs: (libc)Absolute Value.
  1483. * lldiv: (libc)Integer Division.
  1484. * llogb: (libc)Exponents and Logarithms.
  1485. * llogbf: (libc)Exponents and Logarithms.
  1486. * llogbfN: (libc)Exponents and Logarithms.
  1487. * llogbfNx: (libc)Exponents and Logarithms.
  1488. * llogbl: (libc)Exponents and Logarithms.
  1489. * llrint: (libc)Rounding Functions.
  1490. * llrintf: (libc)Rounding Functions.
  1491. * llrintfN: (libc)Rounding Functions.
  1492. * llrintfNx: (libc)Rounding Functions.
  1493. * llrintl: (libc)Rounding Functions.
  1494. * llround: (libc)Rounding Functions.
  1495. * llroundf: (libc)Rounding Functions.
  1496. * llroundfN: (libc)Rounding Functions.
  1497. * llroundfNx: (libc)Rounding Functions.
  1498. * llroundl: (libc)Rounding Functions.
  1499. * localeconv: (libc)The Lame Way to Locale Data.
  1500. * localtime: (libc)Broken-down Time.
  1501. * localtime_r: (libc)Broken-down Time.
  1502. * log10: (libc)Exponents and Logarithms.
  1503. * log10f: (libc)Exponents and Logarithms.
  1504. * log10fN: (libc)Exponents and Logarithms.
  1505. * log10fNx: (libc)Exponents and Logarithms.
  1506. * log10l: (libc)Exponents and Logarithms.
  1507. * log10p1: (libc)Exponents and Logarithms.
  1508. * log10p1f: (libc)Exponents and Logarithms.
  1509. * log10p1fN: (libc)Exponents and Logarithms.
  1510. * log10p1fNx: (libc)Exponents and Logarithms.
  1511. * log10p1l: (libc)Exponents and Logarithms.
  1512. * log1p: (libc)Exponents and Logarithms.
  1513. * log1pf: (libc)Exponents and Logarithms.
  1514. * log1pfN: (libc)Exponents and Logarithms.
  1515. * log1pfNx: (libc)Exponents and Logarithms.
  1516. * log1pl: (libc)Exponents and Logarithms.
  1517. * log2: (libc)Exponents and Logarithms.
  1518. * log2f: (libc)Exponents and Logarithms.
  1519. * log2fN: (libc)Exponents and Logarithms.
  1520. * log2fNx: (libc)Exponents and Logarithms.
  1521. * log2l: (libc)Exponents and Logarithms.
  1522. * log2p1: (libc)Exponents and Logarithms.
  1523. * log2p1f: (libc)Exponents and Logarithms.
  1524. * log2p1fN: (libc)Exponents and Logarithms.
  1525. * log2p1fNx: (libc)Exponents and Logarithms.
  1526. * log2p1l: (libc)Exponents and Logarithms.
  1527. * log: (libc)Exponents and Logarithms.
  1528. * logb: (libc)Exponents and Logarithms.
  1529. * logbf: (libc)Exponents and Logarithms.
  1530. * logbfN: (libc)Exponents and Logarithms.
  1531. * logbfNx: (libc)Exponents and Logarithms.
  1532. * logbl: (libc)Exponents and Logarithms.
  1533. * logf: (libc)Exponents and Logarithms.
  1534. * logfN: (libc)Exponents and Logarithms.
  1535. * logfNx: (libc)Exponents and Logarithms.
  1536. * login: (libc)Logging In and Out.
  1537. * login_tty: (libc)Logging In and Out.
  1538. * logl: (libc)Exponents and Logarithms.
  1539. * logout: (libc)Logging In and Out.
  1540. * logp1: (libc)Exponents and Logarithms.
  1541. * logp1f: (libc)Exponents and Logarithms.
  1542. * logp1fN: (libc)Exponents and Logarithms.
  1543. * logp1fNx: (libc)Exponents and Logarithms.
  1544. * logp1l: (libc)Exponents and Logarithms.
  1545. * logwtmp: (libc)Logging In and Out.
  1546. * longjmp: (libc)Non-Local Details.
  1547. * lrand48: (libc)SVID Random.
  1548. * lrand48_r: (libc)SVID Random.
  1549. * lrint: (libc)Rounding Functions.
  1550. * lrintf: (libc)Rounding Functions.
  1551. * lrintfN: (libc)Rounding Functions.
  1552. * lrintfNx: (libc)Rounding Functions.
  1553. * lrintl: (libc)Rounding Functions.
  1554. * lround: (libc)Rounding Functions.
  1555. * lroundf: (libc)Rounding Functions.
  1556. * lroundfN: (libc)Rounding Functions.
  1557. * lroundfNx: (libc)Rounding Functions.
  1558. * lroundl: (libc)Rounding Functions.
  1559. * lsearch: (libc)Array Search Function.
  1560. * lseek64: (libc)File Position Primitive.
  1561. * lseek: (libc)File Position Primitive.
  1562. * lstat64: (libc)Reading Attributes.
  1563. * lstat: (libc)Reading Attributes.
  1564. * lutimes: (libc)File Times.
  1565. * madvise: (libc)Memory-mapped I/O.
  1566. * makecontext: (libc)System V contexts.
  1567. * mallinfo2: (libc)Statistics of Malloc.
  1568. * malloc: (libc)Basic Allocation.
  1569. * mallopt: (libc)Malloc Tunable Parameters.
  1570. * mblen: (libc)Non-reentrant Character Conversion.
  1571. * mbrlen: (libc)Converting a Character.
  1572. * mbrtowc: (libc)Converting a Character.
  1573. * mbsinit: (libc)Keeping the state.
  1574. * mbsnrtowcs: (libc)Converting Strings.
  1575. * mbsrtowcs: (libc)Converting Strings.
  1576. * mbstowcs: (libc)Non-reentrant String Conversion.
  1577. * mbtowc: (libc)Non-reentrant Character Conversion.
  1578. * mcheck: (libc)Heap Consistency Checking.
  1579. * memalign: (libc)Aligned Memory Blocks.
  1580. * memalignment: (libc)Aligned Memory Blocks.
  1581. * memccpy: (libc)Copying Strings and Arrays.
  1582. * memchr: (libc)Search Functions.
  1583. * memcmp: (libc)String/Array Comparison.
  1584. * memcpy: (libc)Copying Strings and Arrays.
  1585. * memfd_create: (libc)Memory-mapped I/O.
  1586. * memfrob: (libc)Obfuscating Data.
  1587. * memmem: (libc)Search Functions.
  1588. * memmove: (libc)Copying Strings and Arrays.
  1589. * mempcpy: (libc)Copying Strings and Arrays.
  1590. * memrchr: (libc)Search Functions.
  1591. * memset: (libc)Copying Strings and Arrays.
  1592. * memset_explicit: (libc)Erasing Sensitive Data.
  1593. * mkdir: (libc)Creating Directories.
  1594. * mkdirat: (libc)Creating Directories.
  1595. * mkdtemp: (libc)Temporary Files.
  1596. * mkfifo: (libc)FIFO Special Files.
  1597. * mknod: (libc)Making Special Files.
  1598. * mkstemp: (libc)Temporary Files.
  1599. * mktemp: (libc)Temporary Files.
  1600. * mktime: (libc)Broken-down Time.
  1601. * mlock2: (libc)Page Lock Functions.
  1602. * mlock: (libc)Page Lock Functions.
  1603. * mlockall: (libc)Page Lock Functions.
  1604. * mmap64: (libc)Memory-mapped I/O.
  1605. * mmap: (libc)Memory-mapped I/O.
  1606. * modf: (libc)Rounding Functions.
  1607. * modff: (libc)Rounding Functions.
  1608. * modffN: (libc)Rounding Functions.
  1609. * modffNx: (libc)Rounding Functions.
  1610. * modfl: (libc)Rounding Functions.
  1611. * mount: (libc)Mount-Unmount-Remount.
  1612. * mprobe: (libc)Heap Consistency Checking.
  1613. * mprotect: (libc)Memory Protection.
  1614. * mrand48: (libc)SVID Random.
  1615. * mrand48_r: (libc)SVID Random.
  1616. * mremap: (libc)Memory-mapped I/O.
  1617. * mseal: (libc)Memory Protection.
  1618. * msync: (libc)Memory-mapped I/O.
  1619. * mtrace: (libc)Tracing malloc.
  1620. * mtx_destroy: (libc)ISO C Mutexes.
  1621. * mtx_init: (libc)ISO C Mutexes.
  1622. * mtx_lock: (libc)ISO C Mutexes.
  1623. * mtx_timedlock: (libc)ISO C Mutexes.
  1624. * mtx_trylock: (libc)ISO C Mutexes.
  1625. * mtx_unlock: (libc)ISO C Mutexes.
  1626. * munlock: (libc)Page Lock Functions.
  1627. * munlockall: (libc)Page Lock Functions.
  1628. * munmap: (libc)Memory-mapped I/O.
  1629. * muntrace: (libc)Tracing malloc.
  1630. * nan: (libc)FP Bit Twiddling.
  1631. * nanf: (libc)FP Bit Twiddling.
  1632. * nanfN: (libc)FP Bit Twiddling.
  1633. * nanfNx: (libc)FP Bit Twiddling.
  1634. * nanl: (libc)FP Bit Twiddling.
  1635. * nanosleep: (libc)Sleeping.
  1636. * nearbyint: (libc)Rounding Functions.
  1637. * nearbyintf: (libc)Rounding Functions.
  1638. * nearbyintfN: (libc)Rounding Functions.
  1639. * nearbyintfNx: (libc)Rounding Functions.
  1640. * nearbyintl: (libc)Rounding Functions.
  1641. * nextafter: (libc)FP Bit Twiddling.
  1642. * nextafterf: (libc)FP Bit Twiddling.
  1643. * nextafterfN: (libc)FP Bit Twiddling.
  1644. * nextafterfNx: (libc)FP Bit Twiddling.
  1645. * nextafterl: (libc)FP Bit Twiddling.
  1646. * nextdown: (libc)FP Bit Twiddling.
  1647. * nextdownf: (libc)FP Bit Twiddling.
  1648. * nextdownfN: (libc)FP Bit Twiddling.
  1649. * nextdownfNx: (libc)FP Bit Twiddling.
  1650. * nextdownl: (libc)FP Bit Twiddling.
  1651. * nexttoward: (libc)FP Bit Twiddling.
  1652. * nexttowardf: (libc)FP Bit Twiddling.
  1653. * nexttowardl: (libc)FP Bit Twiddling.
  1654. * nextup: (libc)FP Bit Twiddling.
  1655. * nextupf: (libc)FP Bit Twiddling.
  1656. * nextupfN: (libc)FP Bit Twiddling.
  1657. * nextupfNx: (libc)FP Bit Twiddling.
  1658. * nextupl: (libc)FP Bit Twiddling.
  1659. * nftw64: (libc)Working with Directory Trees.
  1660. * nftw: (libc)Working with Directory Trees.
  1661. * ngettext: (libc)Advanced gettext functions.
  1662. * nice: (libc)Traditional Scheduling Functions.
  1663. * nl_langinfo: (libc)The Elegant and Fast Way.
  1664. * nrand48: (libc)SVID Random.
  1665. * nrand48_r: (libc)SVID Random.
  1666. * ntohl: (libc)Byte Order.
  1667. * ntohs: (libc)Byte Order.
  1668. * ntp_adjtime: (libc)Setting and Adjusting the Time.
  1669. * ntp_gettime: (libc)Setting and Adjusting the Time.
  1670. * obstack_1grow: (libc)Growing Objects.
  1671. * obstack_1grow_fast: (libc)Extra Fast Growing.
  1672. * obstack_alignment_mask: (libc)Obstacks Data Alignment.
  1673. * obstack_alloc: (libc)Allocation in an Obstack.
  1674. * obstack_base: (libc)Status of an Obstack.
  1675. * obstack_blank: (libc)Growing Objects.
  1676. * obstack_blank_fast: (libc)Extra Fast Growing.
  1677. * obstack_chunk_size: (libc)Obstack Chunks.
  1678. * obstack_copy0: (libc)Allocation in an Obstack.
  1679. * obstack_copy: (libc)Allocation in an Obstack.
  1680. * obstack_finish: (libc)Growing Objects.
  1681. * obstack_free: (libc)Freeing Obstack Objects.
  1682. * obstack_grow0: (libc)Growing Objects.
  1683. * obstack_grow: (libc)Growing Objects.
  1684. * obstack_init: (libc)Preparing for Obstacks.
  1685. * obstack_int_grow: (libc)Growing Objects.
  1686. * obstack_int_grow_fast: (libc)Extra Fast Growing.
  1687. * obstack_next_free: (libc)Status of an Obstack.
  1688. * obstack_object_size: (libc)Growing Objects.
  1689. * obstack_object_size: (libc)Status of an Obstack.
  1690. * obstack_printf: (libc)Dynamic Output.
  1691. * obstack_ptr_grow: (libc)Growing Objects.
  1692. * obstack_ptr_grow_fast: (libc)Extra Fast Growing.
  1693. * obstack_room: (libc)Extra Fast Growing.
  1694. * obstack_vprintf: (libc)Variable Arguments Output.
  1695. * offsetof: (libc)Structure Measurement.
  1696. * on_exit: (libc)Cleanups on Exit.
  1697. * open64: (libc)Opening and Closing Files.
  1698. * open: (libc)Opening and Closing Files.
  1699. * open_memstream: (libc)String Streams.
  1700. * openat2: (libc)Opening and Closing Files.
  1701. * openat64: (libc)Opening and Closing Files.
  1702. * openat: (libc)Opening and Closing Files.
  1703. * opendir: (libc)Opening a Directory.
  1704. * openlog: (libc)openlog.
  1705. * openpty: (libc)Pseudo-Terminal Pairs.
  1706. * parse_printf_format: (libc)Parsing a Template String.
  1707. * pathconf: (libc)Pathconf.
  1708. * pause: (libc)Using Pause.
  1709. * pclose: (libc)Pipe to a Subprocess.
  1710. * perror: (libc)Error Messages.
  1711. * pidfd_getpid: (libc)Querying a Process.
  1712. * pipe: (libc)Creating a Pipe.
  1713. * pkey_alloc: (libc)Memory Protection.
  1714. * pkey_free: (libc)Memory Protection.
  1715. * pkey_get: (libc)Memory Protection.
  1716. * pkey_mprotect: (libc)Memory Protection.
  1717. * pkey_set: (libc)Memory Protection.
  1718. * poll: (libc)Other Low-Level I/O APIs.
  1719. * popen: (libc)Pipe to a Subprocess.
  1720. * posix_fallocate64: (libc)Storage Allocation.
  1721. * posix_fallocate: (libc)Storage Allocation.
  1722. * posix_memalign: (libc)Aligned Memory Blocks.
  1723. * posix_openpt: (libc)Allocation.
  1724. * pow: (libc)Exponents and Logarithms.
  1725. * powf: (libc)Exponents and Logarithms.
  1726. * powfN: (libc)Exponents and Logarithms.
  1727. * powfNx: (libc)Exponents and Logarithms.
  1728. * powl: (libc)Exponents and Logarithms.
  1729. * pown: (libc)Exponents and Logarithms.
  1730. * pownf: (libc)Exponents and Logarithms.
  1731. * pownfN: (libc)Exponents and Logarithms.
  1732. * pownfNx: (libc)Exponents and Logarithms.
  1733. * pownl: (libc)Exponents and Logarithms.
  1734. * powr: (libc)Exponents and Logarithms.
  1735. * powrf: (libc)Exponents and Logarithms.
  1736. * powrfN: (libc)Exponents and Logarithms.
  1737. * powrfNx: (libc)Exponents and Logarithms.
  1738. * powrl: (libc)Exponents and Logarithms.
  1739. * pread64: (libc)I/O Primitives.
  1740. * pread: (libc)I/O Primitives.
  1741. * preadv2: (libc)Scatter-Gather.
  1742. * preadv64: (libc)Scatter-Gather.
  1743. * preadv64v2: (libc)Scatter-Gather.
  1744. * preadv: (libc)Scatter-Gather.
  1745. * printf: (libc)Formatted Output Functions.
  1746. * printf_size: (libc)Predefined Printf Handlers.
  1747. * printf_size_info: (libc)Predefined Printf Handlers.
  1748. * psignal: (libc)Signal Messages.
  1749. * pthread_attr_destroy: (libc)Creating and Destroying Threads.
  1750. * pthread_attr_getaffinity_np: (libc)Thread CPU Affinity.
  1751. * pthread_attr_getdetachstate: (libc)Creating and Destroying Threads.
  1752. * pthread_attr_getsigmask_np: (libc)Initial Thread Signal Mask.
  1753. * pthread_attr_init: (libc)Creating and Destroying Threads.
  1754. * pthread_attr_setaffinity_np: (libc)Thread CPU Affinity.
  1755. * pthread_attr_setdetachstate: (libc)Creating and Destroying Threads.
  1756. * pthread_attr_setsigmask_np: (libc)Initial Thread Signal Mask.
  1757. * pthread_barrier_destroy: (libc)POSIX Barriers.
  1758. * pthread_barrier_init: (libc)POSIX Barriers.
  1759. * pthread_barrier_wait: (libc)POSIX Barriers.
  1760. * pthread_clockjoin_np: (libc)Joining Threads.
  1761. * pthread_cond_clockwait: (libc)Waiting with Explicit Clocks.
  1762. * pthread_create: (libc)Creating and Destroying Threads.
  1763. * pthread_detach: (libc)Creating and Destroying Threads.
  1764. * pthread_equal: (libc)POSIX Threads Other APIs.
  1765. * pthread_getaffinity_np: (libc)Thread CPU Affinity.
  1766. * pthread_getattr_default_np: (libc)Default Thread Attributes.
  1767. * pthread_getcpuclockid: (libc)POSIX Threads Other APIs.
  1768. * pthread_getname_np: (libc)Thread Names.
  1769. * pthread_getspecific: (libc)Thread-specific Data.
  1770. * pthread_gettid_np: (libc)Process Identification.
  1771. * pthread_join: (libc)Creating and Destroying Threads.
  1772. * pthread_key_create: (libc)Thread-specific Data.
  1773. * pthread_key_delete: (libc)Thread-specific Data.
  1774. * pthread_kill: (libc)Creating and Destroying Threads.
  1775. * pthread_mutex_clocklock: (libc)POSIX Mutexes.
  1776. * pthread_mutex_destroy: (libc)POSIX Mutexes.
  1777. * pthread_mutex_init: (libc)POSIX Mutexes.
  1778. * pthread_mutex_lock: (libc)POSIX Mutexes.
  1779. * pthread_mutex_timedlock: (libc)POSIX Mutexes.
  1780. * pthread_mutex_trylock: (libc)POSIX Mutexes.
  1781. * pthread_mutex_unlock: (libc)POSIX Mutexes.
  1782. * pthread_mutexattr_destroy: (libc)POSIX Mutexes.
  1783. * pthread_mutexattr_gettype: (libc)POSIX Mutexes.
  1784. * pthread_mutexattr_init: (libc)POSIX Mutexes.
  1785. * pthread_mutexattr_settype: (libc)POSIX Mutexes.
  1786. * pthread_once: (libc)POSIX Threads Other APIs.
  1787. * pthread_rwlock_clockrdlock: (libc)Waiting with Explicit Clocks.
  1788. * pthread_rwlock_clockwrlock: (libc)Waiting with Explicit Clocks.
  1789. * pthread_self: (libc)Creating and Destroying Threads.
  1790. * pthread_setaffinity_np: (libc)Thread CPU Affinity.
  1791. * pthread_setattr_default_np: (libc)Default Thread Attributes.
  1792. * pthread_setname_np: (libc)Thread Names.
  1793. * pthread_setspecific: (libc)Thread-specific Data.
  1794. * pthread_sigmask: (libc)POSIX Threads Other APIs.
  1795. * pthread_spin_destroy: (libc)POSIX Spin Locks.
  1796. * pthread_spin_init: (libc)POSIX Spin Locks.
  1797. * pthread_spin_lock: (libc)POSIX Spin Locks.
  1798. * pthread_spin_trylock: (libc)POSIX Spin Locks.
  1799. * pthread_spin_unlock: (libc)POSIX Spin Locks.
  1800. * pthread_timedjoin_np: (libc)Joining Threads.
  1801. * pthread_tryjoin_np: (libc)Joining Threads.
  1802. * ptsname: (libc)Allocation.
  1803. * ptsname_r: (libc)Allocation.
  1804. * putc: (libc)Simple Output.
  1805. * putc_unlocked: (libc)Simple Output.
  1806. * putchar: (libc)Simple Output.
  1807. * putchar_unlocked: (libc)Simple Output.
  1808. * putenv: (libc)Environment Access.
  1809. * putpwent: (libc)Writing a User Entry.
  1810. * puts: (libc)Simple Output.
  1811. * pututline: (libc)Manipulating the Database.
  1812. * pututxline: (libc)XPG Functions.
  1813. * putw: (libc)Simple Output.
  1814. * putwc: (libc)Simple Output.
  1815. * putwc_unlocked: (libc)Simple Output.
  1816. * putwchar: (libc)Simple Output.
  1817. * putwchar_unlocked: (libc)Simple Output.
  1818. * pwrite64: (libc)I/O Primitives.
  1819. * pwrite: (libc)I/O Primitives.
  1820. * pwritev2: (libc)Scatter-Gather.
  1821. * pwritev64: (libc)Scatter-Gather.
  1822. * pwritev64v2: (libc)Scatter-Gather.
  1823. * pwritev: (libc)Scatter-Gather.
  1824. * qecvt: (libc)System V Number Conversion.
  1825. * qecvt_r: (libc)System V Number Conversion.
  1826. * qfcvt: (libc)System V Number Conversion.
  1827. * qfcvt_r: (libc)System V Number Conversion.
  1828. * qgcvt: (libc)System V Number Conversion.
  1829. * qsort: (libc)Array Sort Function.
  1830. * raise: (libc)Signaling Yourself.
  1831. * rand: (libc)ISO Random.
  1832. * rand_r: (libc)ISO Random.
  1833. * random: (libc)BSD Random.
  1834. * random_r: (libc)BSD Random.
  1835. * rawmemchr: (libc)Search Functions.
  1836. * read: (libc)I/O Primitives.
  1837. * readdir64: (libc)Reading/Closing Directory.
  1838. * readdir64_r: (libc)Reading/Closing Directory.
  1839. * readdir: (libc)Reading/Closing Directory.
  1840. * readdir_r: (libc)Reading/Closing Directory.
  1841. * readlink: (libc)Symbolic Links.
  1842. * readv: (libc)Scatter-Gather.
  1843. * realloc: (libc)Changing Block Size.
  1844. * reallocarray: (libc)Changing Block Size.
  1845. * realpath: (libc)Symbolic Links.
  1846. * recv: (libc)Receiving Data.
  1847. * recvfrom: (libc)Receiving Datagrams.
  1848. * recvmsg: (libc)Other Socket APIs.
  1849. * regcomp: (libc)POSIX Regexp Compilation.
  1850. * regerror: (libc)Regexp Cleanup.
  1851. * regexec: (libc)Matching POSIX Regexps.
  1852. * regfree: (libc)Regexp Cleanup.
  1853. * register_printf_function: (libc)Registering New Conversions.
  1854. * remainder: (libc)Remainder Functions.
  1855. * remainderf: (libc)Remainder Functions.
  1856. * remainderfN: (libc)Remainder Functions.
  1857. * remainderfNx: (libc)Remainder Functions.
  1858. * remainderl: (libc)Remainder Functions.
  1859. * remove: (libc)Deleting Files.
  1860. * rename: (libc)Renaming Files.
  1861. * renameat: (libc)Renaming Files.
  1862. * rewind: (libc)File Positioning.
  1863. * rewinddir: (libc)Random Access Directory.
  1864. * rindex: (libc)Search Functions.
  1865. * rint: (libc)Rounding Functions.
  1866. * rintf: (libc)Rounding Functions.
  1867. * rintfN: (libc)Rounding Functions.
  1868. * rintfNx: (libc)Rounding Functions.
  1869. * rintl: (libc)Rounding Functions.
  1870. * rmdir: (libc)Deleting Files.
  1871. * rootn: (libc)Exponents and Logarithms.
  1872. * rootnf: (libc)Exponents and Logarithms.
  1873. * rootnfN: (libc)Exponents and Logarithms.
  1874. * rootnfNx: (libc)Exponents and Logarithms.
  1875. * rootnl: (libc)Exponents and Logarithms.
  1876. * round: (libc)Rounding Functions.
  1877. * roundeven: (libc)Rounding Functions.
  1878. * roundevenf: (libc)Rounding Functions.
  1879. * roundevenfN: (libc)Rounding Functions.
  1880. * roundevenfNx: (libc)Rounding Functions.
  1881. * roundevenl: (libc)Rounding Functions.
  1882. * roundf: (libc)Rounding Functions.
  1883. * roundfN: (libc)Rounding Functions.
  1884. * roundfNx: (libc)Rounding Functions.
  1885. * roundl: (libc)Rounding Functions.
  1886. * rpmatch: (libc)Yes-or-No Questions.
  1887. * rsqrt: (libc)Exponents and Logarithms.
  1888. * rsqrtf: (libc)Exponents and Logarithms.
  1889. * rsqrtfN: (libc)Exponents and Logarithms.
  1890. * rsqrtfNx: (libc)Exponents and Logarithms.
  1891. * rsqrtl: (libc)Exponents and Logarithms.
  1892. * sbrk: (libc)Resizing the Data Segment.
  1893. * scalb: (libc)Normalization Functions.
  1894. * scalbf: (libc)Normalization Functions.
  1895. * scalbl: (libc)Normalization Functions.
  1896. * scalbln: (libc)Normalization Functions.
  1897. * scalblnf: (libc)Normalization Functions.
  1898. * scalblnfN: (libc)Normalization Functions.
  1899. * scalblnfNx: (libc)Normalization Functions.
  1900. * scalblnl: (libc)Normalization Functions.
  1901. * scalbn: (libc)Normalization Functions.
  1902. * scalbnf: (libc)Normalization Functions.
  1903. * scalbnfN: (libc)Normalization Functions.
  1904. * scalbnfNx: (libc)Normalization Functions.
  1905. * scalbnl: (libc)Normalization Functions.
  1906. * scandir64: (libc)Scanning Directory Content.
  1907. * scandir: (libc)Scanning Directory Content.
  1908. * scanf: (libc)Formatted Input Functions.
  1909. * sched_get_priority_max: (libc)Basic Scheduling Functions.
  1910. * sched_get_priority_min: (libc)Basic Scheduling Functions.
  1911. * sched_getaffinity: (libc)CPU Affinity.
  1912. * sched_getattr: (libc)Extensible Scheduling.
  1913. * sched_getcpu: (libc)CPU Affinity.
  1914. * sched_getparam: (libc)Basic Scheduling Functions.
  1915. * sched_getscheduler: (libc)Basic Scheduling Functions.
  1916. * sched_rr_get_interval: (libc)Basic Scheduling Functions.
  1917. * sched_setaffinity: (libc)CPU Affinity.
  1918. * sched_setattr: (libc)Extensible Scheduling.
  1919. * sched_setparam: (libc)Basic Scheduling Functions.
  1920. * sched_setscheduler: (libc)Basic Scheduling Functions.
  1921. * sched_yield: (libc)Basic Scheduling Functions.
  1922. * secure_getenv: (libc)Environment Access.
  1923. * seed48: (libc)SVID Random.
  1924. * seed48_r: (libc)SVID Random.
  1925. * seekdir: (libc)Random Access Directory.
  1926. * select: (libc)Waiting for I/O.
  1927. * sem_clockwait: (libc)POSIX Semaphores.
  1928. * sem_close: (libc)POSIX Semaphores.
  1929. * sem_destroy: (libc)POSIX Semaphores.
  1930. * sem_getvalue: (libc)POSIX Semaphores.
  1931. * sem_init: (libc)POSIX Semaphores.
  1932. * sem_open: (libc)POSIX Semaphores.
  1933. * sem_post: (libc)POSIX Semaphores.
  1934. * sem_timedwait: (libc)POSIX Semaphores.
  1935. * sem_trywait: (libc)POSIX Semaphores.
  1936. * sem_unlink: (libc)POSIX Semaphores.
  1937. * sem_wait: (libc)POSIX Semaphores.
  1938. * semctl: (libc)Semaphores.
  1939. * semget: (libc)Semaphores.
  1940. * semop: (libc)Semaphores.
  1941. * semtimedop: (libc)Semaphores.
  1942. * send: (libc)Sending Data.
  1943. * sendmsg: (libc)Other Socket APIs.
  1944. * sendto: (libc)Sending Datagrams.
  1945. * setbuf: (libc)Controlling Buffering.
  1946. * setbuffer: (libc)Controlling Buffering.
  1947. * setcontext: (libc)System V contexts.
  1948. * setdomainname: (libc)Host Identification.
  1949. * setegid: (libc)Setting Groups.
  1950. * setenv: (libc)Environment Access.
  1951. * seteuid: (libc)Setting User ID.
  1952. * setfsent: (libc)fstab.
  1953. * setgid: (libc)Setting Groups.
  1954. * setgrent: (libc)Scanning All Groups.
  1955. * setgroups: (libc)Setting Groups.
  1956. * sethostent: (libc)Host Names.
  1957. * sethostid: (libc)Host Identification.
  1958. * sethostname: (libc)Host Identification.
  1959. * setitimer: (libc)Setting an Alarm.
  1960. * setjmp: (libc)Non-Local Details.
  1961. * setlinebuf: (libc)Controlling Buffering.
  1962. * setlocale: (libc)Setting the Locale.
  1963. * setlogmask: (libc)setlogmask.
  1964. * setmntent: (libc)mtab.
  1965. * setnetent: (libc)Networks Database.
  1966. * setnetgrent: (libc)Lookup Netgroup.
  1967. * setpayload: (libc)FP Bit Twiddling.
  1968. * setpayloadf: (libc)FP Bit Twiddling.
  1969. * setpayloadfN: (libc)FP Bit Twiddling.
  1970. * setpayloadfNx: (libc)FP Bit Twiddling.
  1971. * setpayloadl: (libc)FP Bit Twiddling.
  1972. * setpayloadsig: (libc)FP Bit Twiddling.
  1973. * setpayloadsigf: (libc)FP Bit Twiddling.
  1974. * setpayloadsigfN: (libc)FP Bit Twiddling.
  1975. * setpayloadsigfNx: (libc)FP Bit Twiddling.
  1976. * setpayloadsigl: (libc)FP Bit Twiddling.
  1977. * setpgid: (libc)Process Group Functions.
  1978. * setpgrp: (libc)Process Group Functions.
  1979. * setpriority: (libc)Traditional Scheduling Functions.
  1980. * setprotoent: (libc)Protocols Database.
  1981. * setpwent: (libc)Scanning All Users.
  1982. * setregid: (libc)Setting Groups.
  1983. * setreuid: (libc)Setting User ID.
  1984. * setrlimit64: (libc)Limits on Resources.
  1985. * setrlimit: (libc)Limits on Resources.
  1986. * setservent: (libc)Services Database.
  1987. * setsid: (libc)Process Group Functions.
  1988. * setsockopt: (libc)Socket Option Functions.
  1989. * setstate: (libc)BSD Random.
  1990. * setstate_r: (libc)BSD Random.
  1991. * settimeofday: (libc)Setting and Adjusting the Time.
  1992. * setuid: (libc)Setting User ID.
  1993. * setutent: (libc)Manipulating the Database.
  1994. * setutxent: (libc)XPG Functions.
  1995. * setvbuf: (libc)Controlling Buffering.
  1996. * shm_open: (libc)Memory-mapped I/O.
  1997. * shm_unlink: (libc)Memory-mapped I/O.
  1998. * shutdown: (libc)Closing a Socket.
  1999. * sigabbrev_np: (libc)Signal Messages.
  2000. * sigaction: (libc)Advanced Signal Handling.
  2001. * sigaddset: (libc)Signal Sets.
  2002. * sigaltstack: (libc)Signal Stack.
  2003. * sigblock: (libc)BSD Signal Handling.
  2004. * sigdelset: (libc)Signal Sets.
  2005. * sigdescr_np: (libc)Signal Messages.
  2006. * sigemptyset: (libc)Signal Sets.
  2007. * sigfillset: (libc)Signal Sets.
  2008. * siginterrupt: (libc)BSD Signal Handling.
  2009. * sigismember: (libc)Signal Sets.
  2010. * siglongjmp: (libc)Non-Local Exits and Signals.
  2011. * sigmask: (libc)BSD Signal Handling.
  2012. * signal: (libc)Basic Signal Handling.
  2013. * signbit: (libc)FP Bit Twiddling.
  2014. * significand: (libc)Normalization Functions.
  2015. * significandf: (libc)Normalization Functions.
  2016. * significandl: (libc)Normalization Functions.
  2017. * sigpause: (libc)BSD Signal Handling.
  2018. * sigpending: (libc)Checking for Pending Signals.
  2019. * sigprocmask: (libc)Process Signal Mask.
  2020. * sigsetjmp: (libc)Non-Local Exits and Signals.
  2021. * sigsetmask: (libc)BSD Signal Handling.
  2022. * sigstack: (libc)Signal Stack.
  2023. * sigsuspend: (libc)Sigsuspend.
  2024. * sin: (libc)Trig Functions.
  2025. * sincos: (libc)Trig Functions.
  2026. * sincosf: (libc)Trig Functions.
  2027. * sincosfN: (libc)Trig Functions.
  2028. * sincosfNx: (libc)Trig Functions.
  2029. * sincosl: (libc)Trig Functions.
  2030. * sinf: (libc)Trig Functions.
  2031. * sinfN: (libc)Trig Functions.
  2032. * sinfNx: (libc)Trig Functions.
  2033. * sinh: (libc)Hyperbolic Functions.
  2034. * sinhf: (libc)Hyperbolic Functions.
  2035. * sinhfN: (libc)Hyperbolic Functions.
  2036. * sinhfNx: (libc)Hyperbolic Functions.
  2037. * sinhl: (libc)Hyperbolic Functions.
  2038. * sinl: (libc)Trig Functions.
  2039. * sinpi: (libc)Trig Functions.
  2040. * sinpif: (libc)Trig Functions.
  2041. * sinpifN: (libc)Trig Functions.
  2042. * sinpifNx: (libc)Trig Functions.
  2043. * sinpil: (libc)Trig Functions.
  2044. * sleep: (libc)Sleeping.
  2045. * snprintf: (libc)Formatted Output Functions.
  2046. * socket: (libc)Creating a Socket.
  2047. * socketpair: (libc)Socket Pairs.
  2048. * sprintf: (libc)Formatted Output Functions.
  2049. * sqrt: (libc)Exponents and Logarithms.
  2050. * sqrtf: (libc)Exponents and Logarithms.
  2051. * sqrtfN: (libc)Exponents and Logarithms.
  2052. * sqrtfNx: (libc)Exponents and Logarithms.
  2053. * sqrtl: (libc)Exponents and Logarithms.
  2054. * srand48: (libc)SVID Random.
  2055. * srand48_r: (libc)SVID Random.
  2056. * srand: (libc)ISO Random.
  2057. * srandom: (libc)BSD Random.
  2058. * srandom_r: (libc)BSD Random.
  2059. * sscanf: (libc)Formatted Input Functions.
  2060. * ssignal: (libc)Basic Signal Handling.
  2061. * stat64: (libc)Reading Attributes.
  2062. * stat: (libc)Reading Attributes.
  2063. * stdc_bit_ceil_uc: (libc)Bit Manipulation.
  2064. * stdc_bit_ceil_ui: (libc)Bit Manipulation.
  2065. * stdc_bit_ceil_ul: (libc)Bit Manipulation.
  2066. * stdc_bit_ceil_ull: (libc)Bit Manipulation.
  2067. * stdc_bit_ceil_us: (libc)Bit Manipulation.
  2068. * stdc_bit_floor_uc: (libc)Bit Manipulation.
  2069. * stdc_bit_floor_ui: (libc)Bit Manipulation.
  2070. * stdc_bit_floor_ul: (libc)Bit Manipulation.
  2071. * stdc_bit_floor_ull: (libc)Bit Manipulation.
  2072. * stdc_bit_floor_us: (libc)Bit Manipulation.
  2073. * stdc_bit_width_uc: (libc)Bit Manipulation.
  2074. * stdc_bit_width_ui: (libc)Bit Manipulation.
  2075. * stdc_bit_width_ul: (libc)Bit Manipulation.
  2076. * stdc_bit_width_ull: (libc)Bit Manipulation.
  2077. * stdc_bit_width_us: (libc)Bit Manipulation.
  2078. * stdc_count_ones_uc: (libc)Bit Manipulation.
  2079. * stdc_count_ones_ui: (libc)Bit Manipulation.
  2080. * stdc_count_ones_ul: (libc)Bit Manipulation.
  2081. * stdc_count_ones_ull: (libc)Bit Manipulation.
  2082. * stdc_count_ones_us: (libc)Bit Manipulation.
  2083. * stdc_count_zeros_uc: (libc)Bit Manipulation.
  2084. * stdc_count_zeros_ui: (libc)Bit Manipulation.
  2085. * stdc_count_zeros_ul: (libc)Bit Manipulation.
  2086. * stdc_count_zeros_ull: (libc)Bit Manipulation.
  2087. * stdc_count_zeros_us: (libc)Bit Manipulation.
  2088. * stdc_first_leading_one_uc: (libc)Bit Manipulation.
  2089. * stdc_first_leading_one_ui: (libc)Bit Manipulation.
  2090. * stdc_first_leading_one_ul: (libc)Bit Manipulation.
  2091. * stdc_first_leading_one_ull: (libc)Bit Manipulation.
  2092. * stdc_first_leading_one_us: (libc)Bit Manipulation.
  2093. * stdc_first_leading_zero_uc: (libc)Bit Manipulation.
  2094. * stdc_first_leading_zero_ui: (libc)Bit Manipulation.
  2095. * stdc_first_leading_zero_ul: (libc)Bit Manipulation.
  2096. * stdc_first_leading_zero_ull: (libc)Bit Manipulation.
  2097. * stdc_first_leading_zero_us: (libc)Bit Manipulation.
  2098. * stdc_first_trailing_one_uc: (libc)Bit Manipulation.
  2099. * stdc_first_trailing_one_ui: (libc)Bit Manipulation.
  2100. * stdc_first_trailing_one_ul: (libc)Bit Manipulation.
  2101. * stdc_first_trailing_one_ull: (libc)Bit Manipulation.
  2102. * stdc_first_trailing_one_us: (libc)Bit Manipulation.
  2103. * stdc_first_trailing_zero_uc: (libc)Bit Manipulation.
  2104. * stdc_first_trailing_zero_ui: (libc)Bit Manipulation.
  2105. * stdc_first_trailing_zero_ul: (libc)Bit Manipulation.
  2106. * stdc_first_trailing_zero_ull: (libc)Bit Manipulation.
  2107. * stdc_first_trailing_zero_us: (libc)Bit Manipulation.
  2108. * stdc_has_single_bit_uc: (libc)Bit Manipulation.
  2109. * stdc_has_single_bit_ui: (libc)Bit Manipulation.
  2110. * stdc_has_single_bit_ul: (libc)Bit Manipulation.
  2111. * stdc_has_single_bit_ull: (libc)Bit Manipulation.
  2112. * stdc_has_single_bit_us: (libc)Bit Manipulation.
  2113. * stdc_leading_ones_uc: (libc)Bit Manipulation.
  2114. * stdc_leading_ones_ui: (libc)Bit Manipulation.
  2115. * stdc_leading_ones_ul: (libc)Bit Manipulation.
  2116. * stdc_leading_ones_ull: (libc)Bit Manipulation.
  2117. * stdc_leading_ones_us: (libc)Bit Manipulation.
  2118. * stdc_leading_zeros_uc: (libc)Bit Manipulation.
  2119. * stdc_leading_zeros_ui: (libc)Bit Manipulation.
  2120. * stdc_leading_zeros_ul: (libc)Bit Manipulation.
  2121. * stdc_leading_zeros_ull: (libc)Bit Manipulation.
  2122. * stdc_leading_zeros_us: (libc)Bit Manipulation.
  2123. * stdc_trailing_ones_uc: (libc)Bit Manipulation.
  2124. * stdc_trailing_ones_ui: (libc)Bit Manipulation.
  2125. * stdc_trailing_ones_ul: (libc)Bit Manipulation.
  2126. * stdc_trailing_ones_ull: (libc)Bit Manipulation.
  2127. * stdc_trailing_ones_us: (libc)Bit Manipulation.
  2128. * stdc_trailing_zeros_uc: (libc)Bit Manipulation.
  2129. * stdc_trailing_zeros_ui: (libc)Bit Manipulation.
  2130. * stdc_trailing_zeros_ul: (libc)Bit Manipulation.
  2131. * stdc_trailing_zeros_ull: (libc)Bit Manipulation.
  2132. * stdc_trailing_zeros_us: (libc)Bit Manipulation.
  2133. * stime: (libc)Setting and Adjusting the Time.
  2134. * stpcpy: (libc)Copying Strings and Arrays.
  2135. * stpncpy: (libc)Truncating Strings.
  2136. * strcasecmp: (libc)String/Array Comparison.
  2137. * strcasestr: (libc)Search Functions.
  2138. * strcat: (libc)Concatenating Strings.
  2139. * strchr: (libc)Search Functions.
  2140. * strchrnul: (libc)Search Functions.
  2141. * strcmp: (libc)String/Array Comparison.
  2142. * strcoll: (libc)Collation Functions.
  2143. * strcpy: (libc)Copying Strings and Arrays.
  2144. * strcspn: (libc)Search Functions.
  2145. * strdup: (libc)Copying Strings and Arrays.
  2146. * strdupa: (libc)Copying Strings and Arrays.
  2147. * strerror: (libc)Error Messages.
  2148. * strerror_l: (libc)Error Messages.
  2149. * strerror_r: (libc)Error Messages.
  2150. * strerror_r: (libc)Error Messages.
  2151. * strerrordesc_np: (libc)Error Messages.
  2152. * strerrorname_np: (libc)Error Messages.
  2153. * strfmon: (libc)Formatting Numbers.
  2154. * strfromd: (libc)Printing of Floats.
  2155. * strfromf: (libc)Printing of Floats.
  2156. * strfromfN: (libc)Printing of Floats.
  2157. * strfromfNx: (libc)Printing of Floats.
  2158. * strfroml: (libc)Printing of Floats.
  2159. * strfry: (libc)Shuffling Bytes.
  2160. * strftime: (libc)Formatting Calendar Time.
  2161. * strftime_l: (libc)Formatting Calendar Time.
  2162. * strlcat: (libc)Truncating Strings.
  2163. * strlcpy: (libc)Truncating Strings.
  2164. * strlen: (libc)String Length.
  2165. * strncasecmp: (libc)String/Array Comparison.
  2166. * strncat: (libc)Truncating Strings.
  2167. * strncmp: (libc)String/Array Comparison.
  2168. * strncpy: (libc)Truncating Strings.
  2169. * strndup: (libc)Truncating Strings.
  2170. * strndupa: (libc)Truncating Strings.
  2171. * strnlen: (libc)String Length.
  2172. * strpbrk: (libc)Search Functions.
  2173. * strptime: (libc)Low-Level Time String Parsing.
  2174. * strrchr: (libc)Search Functions.
  2175. * strsep: (libc)Finding Tokens in a String.
  2176. * strsignal: (libc)Signal Messages.
  2177. * strspn: (libc)Search Functions.
  2178. * strstr: (libc)Search Functions.
  2179. * strtod: (libc)Parsing of Floats.
  2180. * strtof: (libc)Parsing of Floats.
  2181. * strtofN: (libc)Parsing of Floats.
  2182. * strtofNx: (libc)Parsing of Floats.
  2183. * strtoimax: (libc)Parsing of Integers.
  2184. * strtok: (libc)Finding Tokens in a String.
  2185. * strtok_r: (libc)Finding Tokens in a String.
  2186. * strtol: (libc)Parsing of Integers.
  2187. * strtold: (libc)Parsing of Floats.
  2188. * strtoll: (libc)Parsing of Integers.
  2189. * strtoq: (libc)Parsing of Integers.
  2190. * strtoul: (libc)Parsing of Integers.
  2191. * strtoull: (libc)Parsing of Integers.
  2192. * strtoumax: (libc)Parsing of Integers.
  2193. * strtouq: (libc)Parsing of Integers.
  2194. * strverscmp: (libc)String/Array Comparison.
  2195. * strxfrm: (libc)Collation Functions.
  2196. * stty: (libc)BSD Terminal Modes.
  2197. * swapcontext: (libc)System V contexts.
  2198. * swprintf: (libc)Formatted Output Functions.
  2199. * swscanf: (libc)Formatted Input Functions.
  2200. * symlink: (libc)Symbolic Links.
  2201. * sync: (libc)Synchronizing I/O.
  2202. * syscall: (libc)System Calls.
  2203. * sysconf: (libc)Sysconf Definition.
  2204. * syslog: (libc)syslog; vsyslog.
  2205. * system: (libc)Running a Command.
  2206. * sysv_signal: (libc)Basic Signal Handling.
  2207. * tan: (libc)Trig Functions.
  2208. * tanf: (libc)Trig Functions.
  2209. * tanfN: (libc)Trig Functions.
  2210. * tanfNx: (libc)Trig Functions.
  2211. * tanh: (libc)Hyperbolic Functions.
  2212. * tanhf: (libc)Hyperbolic Functions.
  2213. * tanhfN: (libc)Hyperbolic Functions.
  2214. * tanhfNx: (libc)Hyperbolic Functions.
  2215. * tanhl: (libc)Hyperbolic Functions.
  2216. * tanl: (libc)Trig Functions.
  2217. * tanpi: (libc)Trig Functions.
  2218. * tanpif: (libc)Trig Functions.
  2219. * tanpifN: (libc)Trig Functions.
  2220. * tanpifNx: (libc)Trig Functions.
  2221. * tanpil: (libc)Trig Functions.
  2222. * tcdrain: (libc)Line Control.
  2223. * tcflow: (libc)Line Control.
  2224. * tcflush: (libc)Line Control.
  2225. * tcgetattr: (libc)Mode Functions.
  2226. * tcgetpgrp: (libc)Terminal Access Functions.
  2227. * tcgetsid: (libc)Terminal Access Functions.
  2228. * tcsendbreak: (libc)Line Control.
  2229. * tcsetattr: (libc)Mode Functions.
  2230. * tcsetpgrp: (libc)Terminal Access Functions.
  2231. * tdelete: (libc)Tree Search Function.
  2232. * tdestroy: (libc)Tree Search Function.
  2233. * telldir: (libc)Random Access Directory.
  2234. * tempnam: (libc)Temporary Files.
  2235. * textdomain: (libc)Locating gettext catalog.
  2236. * tfind: (libc)Tree Search Function.
  2237. * tgamma: (libc)Special Functions.
  2238. * tgammaf: (libc)Special Functions.
  2239. * tgammafN: (libc)Special Functions.
  2240. * tgammafNx: (libc)Special Functions.
  2241. * tgammal: (libc)Special Functions.
  2242. * tgkill: (libc)Signaling Another Process.
  2243. * thrd_create: (libc)ISO C Thread Management.
  2244. * thrd_current: (libc)ISO C Thread Management.
  2245. * thrd_detach: (libc)ISO C Thread Management.
  2246. * thrd_equal: (libc)ISO C Thread Management.
  2247. * thrd_exit: (libc)ISO C Thread Management.
  2248. * thrd_join: (libc)ISO C Thread Management.
  2249. * thrd_sleep: (libc)ISO C Thread Management.
  2250. * thrd_yield: (libc)ISO C Thread Management.
  2251. * time: (libc)Getting the Time.
  2252. * timegm: (libc)Broken-down Time.
  2253. * timelocal: (libc)Broken-down Time.
  2254. * times: (libc)Processor Time.
  2255. * timespec_get: (libc)Getting the Time.
  2256. * timespec_getres: (libc)Getting the Time.
  2257. * tmpfile64: (libc)Temporary Files.
  2258. * tmpfile: (libc)Temporary Files.
  2259. * tmpnam: (libc)Temporary Files.
  2260. * tmpnam_r: (libc)Temporary Files.
  2261. * toascii: (libc)Case Conversion.
  2262. * tolower: (libc)Case Conversion.
  2263. * totalorder: (libc)FP Comparison Functions.
  2264. * totalorderf: (libc)FP Comparison Functions.
  2265. * totalorderfN: (libc)FP Comparison Functions.
  2266. * totalorderfNx: (libc)FP Comparison Functions.
  2267. * totalorderl: (libc)FP Comparison Functions.
  2268. * totalordermag: (libc)FP Comparison Functions.
  2269. * totalordermagf: (libc)FP Comparison Functions.
  2270. * totalordermagfN: (libc)FP Comparison Functions.
  2271. * totalordermagfNx: (libc)FP Comparison Functions.
  2272. * totalordermagl: (libc)FP Comparison Functions.
  2273. * toupper: (libc)Case Conversion.
  2274. * towctrans: (libc)Wide Character Case Conversion.
  2275. * towlower: (libc)Wide Character Case Conversion.
  2276. * towupper: (libc)Wide Character Case Conversion.
  2277. * trunc: (libc)Rounding Functions.
  2278. * truncate64: (libc)File Size.
  2279. * truncate: (libc)File Size.
  2280. * truncf: (libc)Rounding Functions.
  2281. * truncfN: (libc)Rounding Functions.
  2282. * truncfNx: (libc)Rounding Functions.
  2283. * truncl: (libc)Rounding Functions.
  2284. * tsearch: (libc)Tree Search Function.
  2285. * tss_create: (libc)ISO C Thread-local Storage.
  2286. * tss_delete: (libc)ISO C Thread-local Storage.
  2287. * tss_get: (libc)ISO C Thread-local Storage.
  2288. * tss_set: (libc)ISO C Thread-local Storage.
  2289. * ttyname: (libc)Is It a Terminal.
  2290. * ttyname_r: (libc)Is It a Terminal.
  2291. * twalk: (libc)Tree Search Function.
  2292. * twalk_r: (libc)Tree Search Function.
  2293. * tzset: (libc)Time Zone State.
  2294. * uabs: (libc)Absolute Value.
  2295. * ufromfp: (libc)Rounding Functions.
  2296. * ufromfpf: (libc)Rounding Functions.
  2297. * ufromfpfN: (libc)Rounding Functions.
  2298. * ufromfpfNx: (libc)Rounding Functions.
  2299. * ufromfpl: (libc)Rounding Functions.
  2300. * ufromfpx: (libc)Rounding Functions.
  2301. * ufromfpxf: (libc)Rounding Functions.
  2302. * ufromfpxfN: (libc)Rounding Functions.
  2303. * ufromfpxfNx: (libc)Rounding Functions.
  2304. * ufromfpxl: (libc)Rounding Functions.
  2305. * ulabs: (libc)Absolute Value.
  2306. * ulimit: (libc)Limits on Resources.
  2307. * ullabs: (libc)Absolute Value.
  2308. * umask: (libc)Setting Permissions.
  2309. * umaxabs: (libc)Absolute Value.
  2310. * umount2: (libc)Mount-Unmount-Remount.
  2311. * umount: (libc)Mount-Unmount-Remount.
  2312. * uname: (libc)Platform Type.
  2313. * ungetc: (libc)How Unread.
  2314. * ungetwc: (libc)How Unread.
  2315. * unlink: (libc)Deleting Files.
  2316. * unlinkat: (libc)Deleting Files.
  2317. * unlockpt: (libc)Allocation.
  2318. * unsetenv: (libc)Environment Access.
  2319. * updwtmp: (libc)Manipulating the Database.
  2320. * utime: (libc)File Times.
  2321. * utimensat: (libc)File Times.
  2322. * utimes: (libc)File Times.
  2323. * utmpname: (libc)Manipulating the Database.
  2324. * utmpxname: (libc)XPG Functions.
  2325. * va_arg: (libc)Argument Macros.
  2326. * va_copy: (libc)Argument Macros.
  2327. * va_end: (libc)Argument Macros.
  2328. * va_start: (libc)Argument Macros.
  2329. * valloc: (libc)Aligned Memory Blocks.
  2330. * vasprintf: (libc)Variable Arguments Output.
  2331. * vdprintf: (libc)Variable Arguments Output.
  2332. * verr: (libc)Error Messages.
  2333. * verrx: (libc)Error Messages.
  2334. * versionsort64: (libc)Scanning Directory Content.
  2335. * versionsort: (libc)Scanning Directory Content.
  2336. * vfork: (libc)Creating a Process.
  2337. * vfprintf: (libc)Variable Arguments Output.
  2338. * vfscanf: (libc)Variable Arguments Input.
  2339. * vfwprintf: (libc)Variable Arguments Output.
  2340. * vfwscanf: (libc)Variable Arguments Input.
  2341. * vlimit: (libc)Limits on Resources.
  2342. * vprintf: (libc)Variable Arguments Output.
  2343. * vscanf: (libc)Variable Arguments Input.
  2344. * vsnprintf: (libc)Variable Arguments Output.
  2345. * vsprintf: (libc)Variable Arguments Output.
  2346. * vsscanf: (libc)Variable Arguments Input.
  2347. * vswprintf: (libc)Variable Arguments Output.
  2348. * vswscanf: (libc)Variable Arguments Input.
  2349. * vsyslog: (libc)syslog; vsyslog.
  2350. * vwarn: (libc)Error Messages.
  2351. * vwarnx: (libc)Error Messages.
  2352. * vwprintf: (libc)Variable Arguments Output.
  2353. * vwscanf: (libc)Variable Arguments Input.
  2354. * wait3: (libc)BSD Wait Functions.
  2355. * wait4: (libc)Process Completion.
  2356. * wait: (libc)Process Completion.
  2357. * waitpid: (libc)Process Completion.
  2358. * warn: (libc)Error Messages.
  2359. * warnx: (libc)Error Messages.
  2360. * wcpcpy: (libc)Copying Strings and Arrays.
  2361. * wcpncpy: (libc)Truncating Strings.
  2362. * wcrtomb: (libc)Converting a Character.
  2363. * wcscasecmp: (libc)String/Array Comparison.
  2364. * wcscat: (libc)Concatenating Strings.
  2365. * wcschr: (libc)Search Functions.
  2366. * wcschrnul: (libc)Search Functions.
  2367. * wcscmp: (libc)String/Array Comparison.
  2368. * wcscoll: (libc)Collation Functions.
  2369. * wcscpy: (libc)Copying Strings and Arrays.
  2370. * wcscspn: (libc)Search Functions.
  2371. * wcsdup: (libc)Copying Strings and Arrays.
  2372. * wcsftime: (libc)Formatting Calendar Time.
  2373. * wcslcat: (libc)Truncating Strings.
  2374. * wcslcpy: (libc)Truncating Strings.
  2375. * wcslen: (libc)String Length.
  2376. * wcsncasecmp: (libc)String/Array Comparison.
  2377. * wcsncat: (libc)Truncating Strings.
  2378. * wcsncmp: (libc)String/Array Comparison.
  2379. * wcsncpy: (libc)Truncating Strings.
  2380. * wcsnlen: (libc)String Length.
  2381. * wcsnrtombs: (libc)Converting Strings.
  2382. * wcspbrk: (libc)Search Functions.
  2383. * wcsrchr: (libc)Search Functions.
  2384. * wcsrtombs: (libc)Converting Strings.
  2385. * wcsspn: (libc)Search Functions.
  2386. * wcsstr: (libc)Search Functions.
  2387. * wcstod: (libc)Parsing of Floats.
  2388. * wcstof: (libc)Parsing of Floats.
  2389. * wcstofN: (libc)Parsing of Floats.
  2390. * wcstofNx: (libc)Parsing of Floats.
  2391. * wcstoimax: (libc)Parsing of Integers.
  2392. * wcstok: (libc)Finding Tokens in a String.
  2393. * wcstol: (libc)Parsing of Integers.
  2394. * wcstold: (libc)Parsing of Floats.
  2395. * wcstoll: (libc)Parsing of Integers.
  2396. * wcstombs: (libc)Non-reentrant String Conversion.
  2397. * wcstoq: (libc)Parsing of Integers.
  2398. * wcstoul: (libc)Parsing of Integers.
  2399. * wcstoull: (libc)Parsing of Integers.
  2400. * wcstoumax: (libc)Parsing of Integers.
  2401. * wcstouq: (libc)Parsing of Integers.
  2402. * wcswcs: (libc)Search Functions.
  2403. * wcsxfrm: (libc)Collation Functions.
  2404. * wctob: (libc)Converting a Character.
  2405. * wctomb: (libc)Non-reentrant Character Conversion.
  2406. * wctrans: (libc)Wide Character Case Conversion.
  2407. * wctype: (libc)Classification of Wide Characters.
  2408. * wmemchr: (libc)Search Functions.
  2409. * wmemcmp: (libc)String/Array Comparison.
  2410. * wmemcpy: (libc)Copying Strings and Arrays.
  2411. * wmemmove: (libc)Copying Strings and Arrays.
  2412. * wmempcpy: (libc)Copying Strings and Arrays.
  2413. * wmemset: (libc)Copying Strings and Arrays.
  2414. * wordexp: (libc)Calling Wordexp.
  2415. * wordfree: (libc)Calling Wordexp.
  2416. * wprintf: (libc)Formatted Output Functions.
  2417. * write: (libc)I/O Primitives.
  2418. * writev: (libc)Scatter-Gather.
  2419. * wscanf: (libc)Formatted Input Functions.
  2420. * y0: (libc)Special Functions.
  2421. * y0f: (libc)Special Functions.
  2422. * y0fN: (libc)Special Functions.
  2423. * y0fNx: (libc)Special Functions.
  2424. * y0l: (libc)Special Functions.
  2425. * y1: (libc)Special Functions.
  2426. * y1f: (libc)Special Functions.
  2427. * y1fN: (libc)Special Functions.
  2428. * y1fNx: (libc)Special Functions.
  2429. * y1l: (libc)Special Functions.
  2430. * yn: (libc)Special Functions.
  2431. * ynf: (libc)Special Functions.
  2432. * ynfN: (libc)Special Functions.
  2433. * ynfNx: (libc)Special Functions.
  2434. * ynl: (libc)Special Functions.
  2435. END-INFO-DIR-ENTRY
  2436. 
  2437. File: libc.info, Node: Flags for POSIX Regexps, Next: Matching POSIX Regexps, Prev: POSIX Regexp Compilation, Up: Regular Expressions
  2438. 10.3.2 Flags for POSIX Regular Expressions
  2439. ------------------------------------------
  2440. These are the bit flags that you can use in the CFLAGS operand when
  2441. compiling a regular expression with ‘regcomp’.
  2442. ‘REG_EXTENDED’
  2443. Treat the pattern as an extended regular expression, rather than as
  2444. a basic regular expression.
  2445. ‘REG_ICASE’
  2446. Ignore case when matching letters.
  2447. ‘REG_NOSUB’
  2448. Don't bother storing the contents of the MATCHPTR array.
  2449. ‘REG_NEWLINE’
  2450. Treat a newline in STRING as dividing STRING into multiple lines,
  2451. so that ‘$’ can match before the newline and ‘^’ can match after.
  2452. Also, don't permit ‘.’ to match a newline, and don't permit
  2453. ‘[^...]’ to match a newline.
  2454. Otherwise, newline acts like any other ordinary character.
  2455. 
  2456. File: libc.info, Node: Matching POSIX Regexps, Next: Regexp Subexpressions, Prev: Flags for POSIX Regexps, Up: Regular Expressions
  2457. 10.3.3 Matching a Compiled POSIX Regular Expression
  2458. ---------------------------------------------------
  2459. Once you have compiled a regular expression, as described in *note POSIX
  2460. Regexp Compilation::, you can match it against strings using ‘regexec’.
  2461. A match anywhere inside the string counts as success, unless the regular
  2462. expression contains anchor characters (‘^’ or ‘$’).
  2463. -- Function: int regexec (const regex_t *restrict COMPILED, const char
  2464. *restrict STRING, size_t NMATCH, regmatch_t
  2465. MATCHPTR[restrict], int EFLAGS)
  2466. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap lock dlopen
  2467. | AC-Unsafe corrupt lock mem fd | *Note POSIX Safety Concepts::.
  2468. This function tries to match the compiled regular expression
  2469. ‘*COMPILED’ against STRING.
  2470. ‘regexec’ returns ‘0’ if the regular expression matches; otherwise,
  2471. it returns a nonzero value. See the table below for what nonzero
  2472. values mean. You can use ‘regerror’ to produce an error message
  2473. string describing the reason for a nonzero value; see *note Regexp
  2474. Cleanup::.
  2475. The argument EFLAGS is a word of bit flags that enable various
  2476. options.
  2477. If you want to get information about what part of STRING actually
  2478. matched the regular expression or its subexpressions, use the
  2479. arguments MATCHPTR and NMATCH. Otherwise, pass ‘0’ for NMATCH, and
  2480. ‘NULL’ for MATCHPTR. *Note Regexp Subexpressions::.
  2481. You must match the regular expression with the same set of current
  2482. locales that were in effect when you compiled the regular expression.
  2483. The function ‘regexec’ accepts the following flags in the EFLAGS
  2484. argument:
  2485. ‘REG_NOTBOL’
  2486. Do not regard the beginning of the specified string as the
  2487. beginning of a line; more generally, don't make any assumptions
  2488. about what text might precede it.
  2489. ‘REG_NOTEOL’
  2490. Do not regard the end of the specified string as the end of a line;
  2491. more generally, don't make any assumptions about what text might
  2492. follow it.
  2493. Here are the possible nonzero values that ‘regexec’ can return:
  2494. ‘REG_NOMATCH’
  2495. The pattern didn't match the string. This isn't really an error.
  2496. ‘REG_ESPACE’
  2497. ‘regexec’ ran out of memory.
  2498. 
  2499. File: libc.info, Node: Regexp Subexpressions, Next: Subexpression Complications, Prev: Matching POSIX Regexps, Up: Regular Expressions
  2500. 10.3.4 Match Results with Subexpressions
  2501. ----------------------------------------
  2502. When ‘regexec’ matches parenthetical subexpressions of PATTERN, it
  2503. records which parts of STRING they match. It returns that information
  2504. by storing the offsets into an array whose elements are structures of
  2505. type ‘regmatch_t’. The first element of the array (index ‘0’) records
  2506. the part of the string that matched the entire regular expression. Each
  2507. other element of the array records the beginning and end of the part
  2508. that matched a single parenthetical subexpression.
  2509. -- Data Type: regmatch_t
  2510. This is the data type of the MATCHPTR array that you pass to
  2511. ‘regexec’. It contains two structure fields, as follows:
  2512. ‘rm_so’
  2513. The offset in STRING of the beginning of a substring. Add
  2514. this value to STRING to get the address of that part.
  2515. ‘rm_eo’
  2516. The offset in STRING of the end of the substring.
  2517. -- Data Type: regoff_t
  2518. ‘regoff_t’ is an alias for another signed integer type. The fields
  2519. of ‘regmatch_t’ have type ‘regoff_t’.
  2520. The ‘regmatch_t’ elements correspond to subexpressions positionally;
  2521. the first element (index ‘1’) records where the first subexpression
  2522. matched, the second element records the second subexpression, and so on.
  2523. The order of the subexpressions is the order in which they begin.
  2524. When you call ‘regexec’, you specify how long the MATCHPTR array is,
  2525. with the NMATCH argument. This tells ‘regexec’ how many elements to
  2526. store. If the actual regular expression has more than NMATCH
  2527. subexpressions, then you won't get offset information about the rest of
  2528. them. But this doesn't alter whether the pattern matches a particular
  2529. string or not.
  2530. If you don't want ‘regexec’ to return any information about where the
  2531. subexpressions matched, you can either supply ‘0’ for NMATCH, or use the
  2532. flag ‘REG_NOSUB’ when you compile the pattern with ‘regcomp’.
  2533. 
  2534. File: libc.info, Node: Subexpression Complications, Next: Regexp Cleanup, Prev: Regexp Subexpressions, Up: Regular Expressions
  2535. 10.3.5 Complications in Subexpression Matching
  2536. ----------------------------------------------
  2537. Sometimes a subexpression matches a substring of no characters. This
  2538. happens when ‘f\(o*\)’ matches the string ‘fum’. (It really matches
  2539. just the ‘f’.) In this case, both of the offsets identify the point in
  2540. the string where the null substring was found. In this example, the
  2541. offsets are both ‘1’.
  2542. Sometimes the entire regular expression can match without using some
  2543. of its subexpressions at all--for example, when ‘ba\(na\)*’ matches the
  2544. string ‘ba’, the parenthetical subexpression is not used. When this
  2545. happens, ‘regexec’ stores ‘-1’ in both fields of the element for that
  2546. subexpression.
  2547. Sometimes matching the entire regular expression can match a
  2548. particular subexpression more than once--for example, when ‘ba\(na\)*’
  2549. matches the string ‘bananana’, the parenthetical subexpression matches
  2550. three times. When this happens, ‘regexec’ usually stores the offsets of
  2551. the last part of the string that matched the subexpression. In the case
  2552. of ‘bananana’, these offsets are ‘6’ and ‘8’.
  2553. But the last match is not always the one that is chosen. It's more
  2554. accurate to say that the last _opportunity_ to match is the one that
  2555. takes precedence. What this means is that when one subexpression
  2556. appears within another, then the results reported for the inner
  2557. subexpression reflect whatever happened on the last match of the outer
  2558. subexpression. For an example, consider ‘\(ba\(na\)*s \)*’ matching the
  2559. string ‘bananas bas ’. The last time the inner expression actually
  2560. matches is near the end of the first word. But it is _considered_ again
  2561. in the second word, and fails to match there. ‘regexec’ reports nonuse
  2562. of the "na" subexpression.
  2563. Another place where this rule applies is when the regular expression
  2564. \(ba\(na\)*s \|nefer\(ti\)* \)*
  2565. matches ‘bananas nefertiti’. The "na" subexpression does match in the
  2566. first word, but it doesn't match in the second word because the other
  2567. alternative is used there. Once again, the second repetition of the
  2568. outer subexpression overrides the first, and within that second
  2569. repetition, the "na" subexpression is not used. So ‘regexec’ reports
  2570. nonuse of the "na" subexpression.
  2571. 
  2572. File: libc.info, Node: Regexp Cleanup, Prev: Subexpression Complications, Up: Regular Expressions
  2573. 10.3.6 POSIX Regexp Matching Cleanup
  2574. ------------------------------------
  2575. When you are finished using a compiled regular expression, you can free
  2576. the storage it uses by calling ‘regfree’.
  2577. -- Function: void regfree (regex_t *COMPILED)
  2578. Preliminary: | MT-Safe | AS-Unsafe heap | AC-Unsafe mem | *Note
  2579. POSIX Safety Concepts::.
  2580. Calling ‘regfree’ frees all the storage that ‘*COMPILED’ points to.
  2581. This includes various internal fields of the ‘regex_t’ structure
  2582. that aren't documented in this manual.
  2583. ‘regfree’ does not free the object ‘*COMPILED’ itself.
  2584. You should always free the space in a ‘regex_t’ structure with
  2585. ‘regfree’ before using the structure to compile another regular
  2586. expression.
  2587. When ‘regcomp’ or ‘regexec’ reports an error, you can use the
  2588. function ‘regerror’ to turn it into an error message string.
  2589. -- Function: size_t regerror (int ERRCODE, const regex_t *restrict
  2590. COMPILED, char *restrict BUFFER, size_t LENGTH)
  2591. Preliminary: | MT-Safe env | AS-Unsafe corrupt heap lock dlopen |
  2592. AC-Unsafe corrupt lock fd mem | *Note POSIX Safety Concepts::.
  2593. This function produces an error message string for the error code
  2594. ERRCODE, and stores the string in LENGTH bytes of memory starting
  2595. at BUFFER. For the COMPILED argument, supply the same compiled
  2596. regular expression structure that ‘regcomp’ or ‘regexec’ was
  2597. working with when it got the error. Alternatively, you can supply
  2598. ‘NULL’ for COMPILED; you will still get a meaningful error message,
  2599. but it might not be as detailed.
  2600. If the error message can't fit in LENGTH bytes (including a
  2601. terminating null character), then ‘regerror’ truncates it. The
  2602. string that ‘regerror’ stores is always null-terminated even if it
  2603. has been truncated.
  2604. The return value of ‘regerror’ is the minimum length needed to
  2605. store the entire error message. If this is less than LENGTH, then
  2606. the error message was not truncated, and you can use it.
  2607. Otherwise, you should call ‘regerror’ again with a larger buffer.
  2608. Here is a function which uses ‘regerror’, but always dynamically
  2609. allocates a buffer for the error message:
  2610. char *get_regerror (int errcode, regex_t *compiled)
  2611. {
  2612. size_t length = regerror (errcode, compiled, NULL, 0);
  2613. char *buffer = xmalloc (length);
  2614. (void) regerror (errcode, compiled, buffer, length);
  2615. return buffer;
  2616. }
  2617. 
  2618. File: libc.info, Node: Word Expansion, Prev: Regular Expressions, Up: Pattern Matching
  2619. 10.4 Shell-Style Word Expansion
  2620. ===============================
  2621. “Word expansion” means the process of splitting a string into “words”
  2622. and substituting for variables, commands, and wildcards just as the
  2623. shell does.
  2624. For example, when you write ‘ls -l foo.c’, this string is split into
  2625. three separate words--‘ls’, ‘-l’ and ‘foo.c’. This is the most basic
  2626. function of word expansion.
  2627. When you write ‘ls *.c’, this can become many words, because the word
  2628. ‘*.c’ can be replaced with any number of file names. This is called
  2629. “wildcard expansion”, and it is also a part of word expansion.
  2630. When you use ‘echo $PATH’ to print your path, you are taking
  2631. advantage of “variable substitution”, which is also part of word
  2632. expansion.
  2633. Ordinary programs can perform word expansion just like the shell by
  2634. calling the library function ‘wordexp’.
  2635. * Menu:
  2636. * Expansion Stages:: What word expansion does to a string.
  2637. * Calling Wordexp:: How to call ‘wordexp’.
  2638. * Flags for Wordexp:: Options you can enable in ‘wordexp’.
  2639. * Wordexp Example:: A sample program that does word expansion.
  2640. * Tilde Expansion:: Details of how tilde expansion works.
  2641. * Variable Substitution:: Different types of variable substitution.
  2642. 
  2643. File: libc.info, Node: Expansion Stages, Next: Calling Wordexp, Up: Word Expansion
  2644. 10.4.1 The Stages of Word Expansion
  2645. -----------------------------------
  2646. When word expansion is applied to a sequence of words, it performs the
  2647. following transformations in the order shown here:
  2648. 1. “Tilde expansion”: Replacement of ‘~foo’ with the name of the home
  2649. directory of ‘foo’.
  2650. 2. Next, three different transformations are applied in the same step,
  2651. from left to right:
  2652. • “Variable substitution”: Environment variables are substituted
  2653. for references such as ‘$foo’.
  2654. • “Command substitution”: Constructs such as ‘`cat foo`’ and the
  2655. equivalent ‘$(cat foo)’ are replaced with the output from the
  2656. inner command.
  2657. • “Arithmetic expansion”: Constructs such as ‘$(($x-1))’ are
  2658. replaced with the result of the arithmetic computation.
  2659. 3. “Field splitting”: subdivision of the text into “words”.
  2660. 4. “Wildcard expansion”: The replacement of a construct such as ‘*.c’
  2661. with a list of ‘.c’ file names. Wildcard expansion applies to an
  2662. entire word at a time, and replaces that word with 0 or more file
  2663. names that are themselves words.
  2664. 5. “Quote removal”: The deletion of string-quotes, now that they have
  2665. done their job by inhibiting the above transformations when
  2666. appropriate.
  2667. For the details of these transformations, and how to write the
  2668. constructs that use them, see ‘The BASH Manual’ (to appear).
  2669. 
  2670. File: libc.info, Node: Calling Wordexp, Next: Flags for Wordexp, Prev: Expansion Stages, Up: Word Expansion
  2671. 10.4.2 Calling ‘wordexp’
  2672. ------------------------
  2673. All the functions, constants and data types for word expansion are
  2674. declared in the header file ‘wordexp.h’.
  2675. Word expansion produces a vector of words (strings). To return this
  2676. vector, ‘wordexp’ uses a special data type, ‘wordexp_t’, which is a
  2677. structure. You pass ‘wordexp’ the address of the structure, and it
  2678. fills in the structure's fields to tell you about the results.
  2679. -- Data Type: wordexp_t
  2680. This data type holds a pointer to a word vector. More precisely,
  2681. it records both the address of the word vector and its size.
  2682. ‘we_wordc’
  2683. The number of elements in the vector.
  2684. ‘we_wordv’
  2685. The address of the vector. This field has type ‘char **’.
  2686. ‘we_offs’
  2687. The offset of the first real element of the vector, from its
  2688. nominal address in the ‘we_wordv’ field. Unlike the other
  2689. fields, this is always an input to ‘wordexp’, rather than an
  2690. output from it.
  2691. If you use a nonzero offset, then that many elements at the
  2692. beginning of the vector are left empty. (The ‘wordexp’
  2693. function fills them with null pointers.)
  2694. The ‘we_offs’ field is meaningful only if you use the
  2695. ‘WRDE_DOOFFS’ flag. Otherwise, the offset is always zero
  2696. regardless of what is in this field, and the first real
  2697. element comes at the beginning of the vector.
  2698. -- Function: int wordexp (const char *WORDS, wordexp_t
  2699. *WORD-VECTOR-PTR, int FLAGS)
  2700. Preliminary: | MT-Unsafe race:utent const:env env sig:ALRM timer
  2701. locale | AS-Unsafe dlopen plugin i18n heap corrupt lock | AC-Unsafe
  2702. corrupt lock fd mem | *Note POSIX Safety Concepts::.
  2703. Perform word expansion on the string WORDS, putting the result in a
  2704. newly allocated vector, and store the size and address of this
  2705. vector into ‘*WORD-VECTOR-PTR’. The argument FLAGS is a
  2706. combination of bit flags; see *note Flags for Wordexp::, for
  2707. details of the flags.
  2708. You shouldn't use any of the characters ‘|&;<>’ in the string WORDS
  2709. unless they are quoted; likewise for newline. If you use these
  2710. characters unquoted, you will get the ‘WRDE_BADCHAR’ error code.
  2711. Don't use parentheses or braces unless they are quoted or part of a
  2712. word expansion construct. If you use quotation characters ‘'"`’,
  2713. they should come in pairs that balance.
  2714. The results of word expansion are a sequence of words. The
  2715. function ‘wordexp’ allocates a string for each resulting word, then
  2716. allocates a vector of type ‘char **’ to store the addresses of
  2717. these strings. The last element of the vector is a null pointer.
  2718. This vector is called the “word vector”.
  2719. To return this vector, ‘wordexp’ stores both its address and its
  2720. length (number of elements, not counting the terminating null
  2721. pointer) into ‘*WORD-VECTOR-PTR’.
  2722. If ‘wordexp’ succeeds, it returns 0. Otherwise, it returns one of
  2723. these error codes:
  2724. ‘WRDE_BADCHAR’
  2725. The input string WORDS contains an unquoted invalid character
  2726. such as ‘|’.
  2727. ‘WRDE_BADVAL’
  2728. The input string refers to an undefined shell variable, and
  2729. you used the flag ‘WRDE_UNDEF’ to forbid such references.
  2730. ‘WRDE_CMDSUB’
  2731. The input string uses command substitution, and you used the
  2732. flag ‘WRDE_NOCMD’ to forbid command substitution.
  2733. ‘WRDE_NOSPACE’
  2734. It was impossible to allocate memory to hold the result. In
  2735. this case, ‘wordexp’ can store part of the results--as much as
  2736. it could allocate room for.
  2737. ‘WRDE_SYNTAX’
  2738. There was a syntax error in the input string. For example, an
  2739. unmatched quoting character is a syntax error. This error
  2740. code is also used to signal division by zero and overflow in
  2741. arithmetic expansion.
  2742. -- Function: void wordfree (wordexp_t *WORD-VECTOR-PTR)
  2743. Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe corrupt
  2744. mem | *Note POSIX Safety Concepts::.
  2745. Free the storage used for the word-strings and vector that
  2746. ‘*WORD-VECTOR-PTR’ points to. This does not free the structure
  2747. ‘*WORD-VECTOR-PTR’ itself--only the other data it points to.
  2748. 
  2749. File: libc.info, Node: Flags for Wordexp, Next: Wordexp Example, Prev: Calling Wordexp, Up: Word Expansion
  2750. 10.4.3 Flags for Word Expansion
  2751. -------------------------------
  2752. This section describes the flags that you can specify in the FLAGS
  2753. argument to ‘wordexp’. Choose the flags you want, and combine them with
  2754. the C operator ‘|’.
  2755. ‘WRDE_APPEND’
  2756. Append the words from this expansion to the vector of words
  2757. produced by previous calls to ‘wordexp’. This way you can
  2758. effectively expand several words as if they were concatenated with
  2759. spaces between them.
  2760. In order for appending to work, you must not modify the contents of
  2761. the word vector structure between calls to ‘wordexp’. And, if you
  2762. set ‘WRDE_DOOFFS’ in the first call to ‘wordexp’, you must also set
  2763. it when you append to the results.
  2764. ‘WRDE_DOOFFS’
  2765. Leave blank slots at the beginning of the vector of words. The
  2766. ‘we_offs’ field says how many slots to leave. The blank slots
  2767. contain null pointers.
  2768. ‘WRDE_NOCMD’
  2769. Don't do command substitution; if the input requests command
  2770. substitution, report an error.
  2771. ‘WRDE_REUSE’
  2772. Reuse a word vector made by a previous call to ‘wordexp’. Instead
  2773. of allocating a new vector of words, this call to ‘wordexp’ will
  2774. use the vector that already exists (making it larger if necessary).
  2775. Note that the vector may move, so it is not safe to save an old
  2776. pointer and use it again after calling ‘wordexp’. You must fetch
  2777. ‘we_pathv’ anew after each call.
  2778. ‘WRDE_SHOWERR’
  2779. Do show any error messages printed by commands run by command
  2780. substitution. More precisely, allow these commands to inherit the
  2781. standard error output stream of the current process. By default,
  2782. ‘wordexp’ gives these commands a standard error stream that
  2783. discards all output.
  2784. ‘WRDE_UNDEF’
  2785. If the input refers to a shell variable that is not defined, report
  2786. an error.
  2787. 
  2788. File: libc.info, Node: Wordexp Example, Next: Tilde Expansion, Prev: Flags for Wordexp, Up: Word Expansion
  2789. 10.4.4 ‘wordexp’ Example
  2790. ------------------------
  2791. Here is an example of using ‘wordexp’ to expand several strings and use
  2792. the results to run a shell command. It also shows the use of
  2793. ‘WRDE_APPEND’ to concatenate the expansions and of ‘wordfree’ to free
  2794. the space allocated by ‘wordexp’.
  2795. int
  2796. expand_and_execute (const char *program, const char **options)
  2797. {
  2798. wordexp_t result;
  2799. pid_t pid
  2800. int status, i;
  2801. /* Expand the string for the program to run. */
  2802. switch (wordexp (program, &result, 0))
  2803. {
  2804. case 0: /* Successful. */
  2805. break;
  2806. case WRDE_NOSPACE:
  2807. /* If the error was ‘WRDE_NOSPACE’,
  2808. then perhaps part of the result was allocated. */
  2809. wordfree (&result);
  2810. default: /* Some other error. */
  2811. return -1;
  2812. }
  2813. /* Expand the strings specified for the arguments. */
  2814. for (i = 0; options[i] != NULL; i++)
  2815. {
  2816. if (wordexp (options[i], &result, WRDE_APPEND))
  2817. {
  2818. wordfree (&result);
  2819. return -1;
  2820. }
  2821. }
  2822. pid = fork ();
  2823. if (pid == 0)
  2824. {
  2825. /* This is the child process. Execute the command. */
  2826. execv (result.we_wordv[0], result.we_wordv);
  2827. exit (EXIT_FAILURE);
  2828. }
  2829. else if (pid < 0)
  2830. /* The fork failed. Report failure. */
  2831. status = -1;
  2832. else
  2833. /* This is the parent process. Wait for the child to complete. */
  2834. if (waitpid (pid, &status, 0) != pid)
  2835. status = -1;
  2836. wordfree (&result);
  2837. return status;
  2838. }
  2839. 
  2840. File: libc.info, Node: Tilde Expansion, Next: Variable Substitution, Prev: Wordexp Example, Up: Word Expansion
  2841. 10.4.5 Details of Tilde Expansion
  2842. ---------------------------------
  2843. It's a standard part of shell syntax that you can use ‘~’ at the
  2844. beginning of a file name to stand for your own home directory. You can
  2845. use ‘~USER’ to stand for USER's home directory.
  2846. “Tilde expansion” is the process of converting these abbreviations to
  2847. the directory names that they stand for.
  2848. Tilde expansion applies to the ‘~’ plus all following characters up
  2849. to whitespace or a slash. It takes place only at the beginning of a
  2850. word, and only if none of the characters to be transformed is quoted in
  2851. any way.
  2852. Plain ‘~’ uses the value of the environment variable ‘HOME’ as the
  2853. proper home directory name. ‘~’ followed by a user name uses
  2854. ‘getpwname’ to look up that user in the user database, and uses whatever
  2855. directory is recorded there. Thus, ‘~’ followed by your own name can
  2856. give different results from plain ‘~’, if the value of ‘HOME’ is not
  2857. really your home directory.
  2858. 
  2859. File: libc.info, Node: Variable Substitution, Prev: Tilde Expansion, Up: Word Expansion
  2860. 10.4.6 Details of Variable Substitution
  2861. ---------------------------------------
  2862. Part of ordinary shell syntax is the use of ‘$VARIABLE’ to substitute
  2863. the value of a shell variable into a command. This is called “variable
  2864. substitution”, and it is one part of doing word expansion.
  2865. There are two basic ways you can write a variable reference for
  2866. substitution:
  2867. ‘${VARIABLE}’
  2868. If you write braces around the variable name, then it is completely
  2869. unambiguous where the variable name ends. You can concatenate
  2870. additional letters onto the end of the variable value by writing
  2871. them immediately after the close brace. For example, ‘${foo}s’
  2872. expands into ‘tractors’.
  2873. ‘$VARIABLE’
  2874. If you do not put braces around the variable name, then the
  2875. variable name consists of all the alphanumeric characters and
  2876. underscores that follow the ‘$’. The next punctuation character
  2877. ends the variable name. Thus, ‘$foo-bar’ refers to the variable
  2878. ‘foo’ and expands into ‘tractor-bar’.
  2879. When you use braces, you can also use various constructs to modify
  2880. the value that is substituted, or test it in various ways.
  2881. ‘${VARIABLE:-DEFAULT}’
  2882. Substitute the value of VARIABLE, but if that is empty or
  2883. undefined, use DEFAULT instead.
  2884. ‘${VARIABLE:=DEFAULT}’
  2885. Substitute the value of VARIABLE, but if that is empty or
  2886. undefined, use DEFAULT instead and set the variable to DEFAULT.
  2887. ‘${VARIABLE:?MESSAGE}’
  2888. If VARIABLE is defined and not empty, substitute its value.
  2889. Otherwise, print MESSAGE as an error message on the standard error
  2890. stream, and consider word expansion a failure.
  2891. ‘${VARIABLE:+REPLACEMENT}’
  2892. Substitute REPLACEMENT, but only if VARIABLE is defined and
  2893. nonempty. Otherwise, substitute nothing for this construct.
  2894. ‘${#VARIABLE}’
  2895. Substitute a numeral which expresses in base ten the number of
  2896. characters in the value of VARIABLE. ‘${#foo}’ stands for ‘7’,
  2897. because ‘tractor’ is seven characters.
  2898. These variants of variable substitution let you remove part of the
  2899. variable's value before substituting it. The PREFIX and SUFFIX are not
  2900. mere strings; they are wildcard patterns, just like the patterns that
  2901. you use to match multiple file names. But in this context, they match
  2902. against parts of the variable value rather than against file names.
  2903. ‘${VARIABLE%%SUFFIX}’
  2904. Substitute the value of VARIABLE, but first discard from that
  2905. variable any portion at the end that matches the pattern SUFFIX.
  2906. If there is more than one alternative for how to match against
  2907. SUFFIX, this construct uses the longest possible match.
  2908. Thus, ‘${foo%%r*}’ substitutes ‘t’, because the largest match for
  2909. ‘r*’ at the end of ‘tractor’ is ‘ractor’.
  2910. ‘${VARIABLE%SUFFIX}’
  2911. Substitute the value of VARIABLE, but first discard from that
  2912. variable any portion at the end that matches the pattern SUFFIX.
  2913. If there is more than one alternative for how to match against
  2914. SUFFIX, this construct uses the shortest possible alternative.
  2915. Thus, ‘${foo%r*}’ substitutes ‘tracto’, because the shortest match
  2916. for ‘r*’ at the end of ‘tractor’ is just ‘r’.
  2917. ‘${VARIABLE##PREFIX}’
  2918. Substitute the value of VARIABLE, but first discard from that
  2919. variable any portion at the beginning that matches the pattern
  2920. PREFIX.
  2921. If there is more than one alternative for how to match against
  2922. PREFIX, this construct uses the longest possible match.
  2923. Thus, ‘${foo##*t}’ substitutes ‘or’, because the largest match for
  2924. ‘*t’ at the beginning of ‘tractor’ is ‘tract’.
  2925. ‘${VARIABLE#PREFIX}’
  2926. Substitute the value of VARIABLE, but first discard from that
  2927. variable any portion at the beginning that matches the pattern
  2928. PREFIX.
  2929. If there is more than one alternative for how to match against
  2930. PREFIX, this construct uses the shortest possible alternative.
  2931. Thus, ‘${foo#*t}’ substitutes ‘ractor’, because the shortest match
  2932. for ‘*t’ at the beginning of ‘tractor’ is just ‘t’.
  2933. 
  2934. File: libc.info, Node: I/O Overview, Next: I/O on Streams, Prev: Pattern Matching, Up: Top
  2935. 11 Input/Output Overview
  2936. ************************
  2937. Most programs need to do either input (reading data) or output (writing
  2938. data), or most frequently both, in order to do anything useful. The GNU
  2939. C Library provides such a large selection of input and output functions
  2940. that the hardest part is often deciding which function is most
  2941. appropriate!
  2942. This chapter introduces concepts and terminology relating to input
  2943. and output. Other chapters relating to the GNU I/O facilities are:
  2944. • *note I/O on Streams::, which covers the high-level functions that
  2945. operate on streams, including formatted input and output.
  2946. • *note Low-Level I/O::, which covers the basic I/O and control
  2947. functions on file descriptors.
  2948. • *note File System Interface::, which covers functions for operating
  2949. on directories and for manipulating file attributes such as access
  2950. modes and ownership.
  2951. • *note Pipes and FIFOs::, which includes information on the basic
  2952. interprocess communication facilities.
  2953. • *note Sockets::, which covers a more complicated interprocess
  2954. communication facility with support for networking.
  2955. • *note Low-Level Terminal Interface::, which covers functions for
  2956. changing how input and output to terminals or other serial devices
  2957. are processed.
  2958. * Menu:
  2959. * I/O Concepts:: Some basic information and terminology.
  2960. * File Names:: How to refer to a file.
  2961. 
  2962. File: libc.info, Node: I/O Concepts, Next: File Names, Up: I/O Overview
  2963. 11.1 Input/Output Concepts
  2964. ==========================
  2965. Before you can read or write the contents of a file, you must establish
  2966. a connection or communications channel to the file. This process is
  2967. called “opening” the file. You can open a file for reading, writing, or
  2968. both.
  2969. The connection to an open file is represented either as a stream or
  2970. as a file descriptor. You pass this as an argument to the functions
  2971. that do the actual read or write operations, to tell them which file to
  2972. operate on. Certain functions expect streams, and others are designed
  2973. to operate on file descriptors.
  2974. When you have finished reading from or writing to the file, you can
  2975. terminate the connection by “closing” the file. Once you have closed a
  2976. stream or file descriptor, you cannot do any more input or output
  2977. operations on it.
  2978. * Menu:
  2979. * Streams and File Descriptors:: The GNU C Library provides two ways
  2980. to access the contents of files.
  2981. * File Position:: The number of bytes from the
  2982. beginning of the file.
  2983. 
  2984. File: libc.info, Node: Streams and File Descriptors, Next: File Position, Up: I/O Concepts
  2985. 11.1.1 Streams and File Descriptors
  2986. -----------------------------------
  2987. When you want to do input or output to a file, you have a choice of two
  2988. basic mechanisms for representing the connection between your program
  2989. and the file: file descriptors and streams. File descriptors are
  2990. represented as objects of type ‘int’, while streams are represented as
  2991. ‘FILE *’ objects.
  2992. File descriptors provide a primitive, low-level interface to input
  2993. and output operations. Both file descriptors and streams can represent
  2994. a connection to a device (such as a terminal), or a pipe or socket for
  2995. communicating with another process, as well as a normal file. But, if
  2996. you want to do control operations that are specific to a particular kind
  2997. of device, you must use a file descriptor; there are no facilities to
  2998. use streams in this way. You must also use file descriptors if your
  2999. program needs to do input or output in special modes, such as
  3000. nonblocking (or polled) input (*note File Status Flags::).
  3001. Streams provide a higher-level interface, layered on top of the
  3002. primitive file descriptor facilities. The stream interface treats all
  3003. kinds of files pretty much alike--the sole exception being the three
  3004. styles of buffering that you can choose (*note Stream Buffering::).
  3005. The main advantage of using the stream interface is that the set of
  3006. functions for performing actual input and output operations (as opposed
  3007. to control operations) on streams is much richer and more powerful than
  3008. the corresponding facilities for file descriptors. The file descriptor
  3009. interface provides only simple functions for transferring blocks of
  3010. characters, but the stream interface also provides powerful formatted
  3011. input and output functions (‘printf’ and ‘scanf’) as well as functions
  3012. for character- and line-oriented input and output.
  3013. Since streams are implemented in terms of file descriptors, you can
  3014. extract the file descriptor from a stream and perform low-level
  3015. operations directly on the file descriptor. You can also initially open
  3016. a connection as a file descriptor and then make a stream associated with
  3017. that file descriptor.
  3018. In general, you should stick with using streams rather than file
  3019. descriptors, unless there is some specific operation you want to do that
  3020. can only be done on a file descriptor. If you are a beginning
  3021. programmer and aren't sure what functions to use, we suggest that you
  3022. concentrate on the formatted input functions (*note Formatted Input::)
  3023. and formatted output functions (*note Formatted Output::).
  3024. If you are concerned about portability of your programs to systems
  3025. other than GNU, you should also be aware that file descriptors are not
  3026. as portable as streams. You can expect any system running ISO C to
  3027. support streams, but non-GNU systems may not support file descriptors at
  3028. all, or may only implement a subset of the GNU functions that operate on
  3029. file descriptors. Most of the file descriptor functions in the GNU C
  3030. Library are included in the POSIX.1 standard, however.
  3031. 
  3032. File: libc.info, Node: File Position, Prev: Streams and File Descriptors, Up: I/O Concepts
  3033. 11.1.2 File Position
  3034. --------------------
  3035. One of the attributes of an open file is its “file position” that keeps
  3036. track of where in the file the next character is to be read or written.
  3037. On GNU systems, and all POSIX.1 systems, the file position is simply an
  3038. integer representing the number of bytes from the beginning of the file.
  3039. The file position is normally set to the beginning of the file when
  3040. it is opened, and each time a character is read or written, the file
  3041. position is incremented. In other words, access to the file is normally
  3042. “sequential”.
  3043. Ordinary files permit read or write operations at any position within
  3044. the file. Some other kinds of files may also permit this. Files which
  3045. do permit this are sometimes referred to as “random-access” files. You
  3046. can change the file position using the ‘fseek’ function on a stream
  3047. (*note File Positioning::) or the ‘lseek’ function on a file descriptor
  3048. (*note I/O Primitives::). If you try to change the file position on a
  3049. file that doesn't support random access, you get the ‘ESPIPE’ error.
  3050. Streams and descriptors that are opened for “append access” are
  3051. treated specially for output: output to such files is _always_ appended
  3052. sequentially to the _end_ of the file, regardless of the file position.
  3053. However, the file position is still used to control where in the file
  3054. reading is done.
  3055. If you think about it, you'll realize that several programs can read
  3056. a given file at the same time. In order for each program to be able to
  3057. read the file at its own pace, each program must have its own file
  3058. pointer, which is not affected by anything the other programs do.
  3059. In fact, each opening of a file creates a separate file position.
  3060. Thus, if you open a file twice even in the same program, you get two
  3061. streams or descriptors with independent file positions.
  3062. By contrast, if you open a descriptor and then duplicate it to get
  3063. another descriptor, these two descriptors share the same file position:
  3064. changing the file position of one descriptor will affect the other.
  3065. 
  3066. File: libc.info, Node: File Names, Prev: I/O Concepts, Up: I/O Overview
  3067. 11.2 File Names
  3068. ===============
  3069. In order to open a connection to a file, or to perform other operations
  3070. such as deleting a file, you need some way to refer to the file. Nearly
  3071. all files have names that are strings--even files which are actually
  3072. devices such as tape drives or terminals. These strings are called
  3073. “file names”. You specify the file name to say which file you want to
  3074. open or operate on.
  3075. This section describes the conventions for file names and how the
  3076. operating system works with them.
  3077. * Menu:
  3078. * Directories:: Directories contain entries for files.
  3079. * File Name Resolution:: A file name specifies how to look up a file.
  3080. * File Name Errors:: Error conditions relating to file names.
  3081. * File Name Portability:: File name portability and syntax issues.
  3082. 
  3083. File: libc.info, Node: Directories, Next: File Name Resolution, Up: File Names
  3084. 11.2.1 Directories
  3085. ------------------
  3086. In order to understand the syntax of file names, you need to understand
  3087. how the file system is organized into a hierarchy of directories.
  3088. A “directory” is a file that contains information to associate other
  3089. files with names; these associations are called “links” or “directory
  3090. entries”. Sometimes, people speak of "files in a directory", but in
  3091. reality, a directory only contains pointers to files, not the files
  3092. themselves.
  3093. The name of a file contained in a directory entry is called a “file
  3094. name component”. In general, a file name consists of a sequence of one
  3095. or more such components, separated by the slash character (‘/’). A file
  3096. name which is just one component names a file with respect to its
  3097. directory. A file name with multiple components names a directory, and
  3098. then a file in that directory, and so on.
  3099. Some other documents, such as the POSIX standard, use the term
  3100. “pathname” for what we call a file name, and either “filename” or
  3101. “pathname component” for what this manual calls a file name component.
  3102. We don't use this terminology because a "path" is something completely
  3103. different (a list of directories to search), and we think that
  3104. "pathname" used for something else will confuse users. We always use
  3105. "file name" and "file name component" (or sometimes just "component",
  3106. where the context is obvious) in GNU documentation. Some macros use the
  3107. POSIX terminology in their names, such as ‘PATH_MAX’. These macros are
  3108. defined by the POSIX standard, so we cannot change their names.
  3109. You can find more detailed information about operations on
  3110. directories in *note File System Interface::.
  3111. 
  3112. File: libc.info, Node: File Name Resolution, Next: File Name Errors, Prev: Directories, Up: File Names
  3113. 11.2.2 File Name Resolution
  3114. ---------------------------
  3115. A file name consists of file name components separated by slash (‘/’)
  3116. characters. On the systems that the GNU C Library supports, multiple
  3117. successive ‘/’ characters are equivalent to a single ‘/’ character.
  3118. The process of determining what file a file name refers to is called
  3119. “file name resolution”. This is performed by examining the components
  3120. that make up a file name in left-to-right order, and locating each
  3121. successive component in the directory named by the previous component.
  3122. Of course, each of the files that are referenced as directories must
  3123. actually exist, be directories instead of regular files, and have the
  3124. appropriate permissions to be accessible by the process; otherwise the
  3125. file name resolution fails.
  3126. If a file name begins with a ‘/’, the first component in the file
  3127. name is located in the “root directory” of the process (usually all
  3128. processes on the system have the same root directory). Such a file name
  3129. is called an “absolute file name”.
  3130. Otherwise, the first component in the file name is located in the
  3131. current working directory (*note Working Directory::). This kind of
  3132. file name is called a “relative file name”.
  3133. The file name components ‘.’ ("dot") and ‘..’ ("dot-dot") have
  3134. special meanings. Every directory has entries for these file name
  3135. components. The file name component ‘.’ refers to the directory itself,
  3136. while the file name component ‘..’ refers to its “parent directory” (the
  3137. directory that contains the link for the directory in question). As a
  3138. special case, ‘..’ in the root directory refers to the root directory
  3139. itself, since it has no parent; thus ‘/..’ is the same as ‘/’.
  3140. Here are some examples of file names:
  3141. ‘/a’
  3142. The file named ‘a’, in the root directory.
  3143. ‘/a/b’
  3144. The file named ‘b’, in the directory named ‘a’ in the root
  3145. directory.
  3146. ‘a’
  3147. The file named ‘a’, in the current working directory.
  3148. ‘/a/./b’
  3149. This is the same as ‘/a/b’.
  3150. ‘./a’
  3151. The file named ‘a’, in the current working directory.
  3152. ‘../a’
  3153. The file named ‘a’, in the parent directory of the current working
  3154. directory.
  3155. A file name that names a directory may optionally end in a ‘/’. You
  3156. can specify a file name of ‘/’ to refer to the root directory, but the
  3157. empty string is not a meaningful file name. If you want to refer to the
  3158. current working directory, use a file name of ‘.’ or ‘./’.
  3159. Unlike some other operating systems, GNU systems don't have any
  3160. built-in support for file types (or extensions) or file versions as part
  3161. of its file name syntax. Many programs and utilities use conventions
  3162. for file names--for example, files containing C source code usually have
  3163. names suffixed with ‘.c’--but there is nothing in the file system itself
  3164. that enforces this kind of convention.
  3165. 
  3166. File: libc.info, Node: File Name Errors, Next: File Name Portability, Prev: File Name Resolution, Up: File Names
  3167. 11.2.3 File Name Errors
  3168. -----------------------
  3169. Functions that accept file name arguments usually detect these ‘errno’
  3170. error conditions relating to the file name syntax or trouble finding the
  3171. named file. These errors are referred to throughout this manual as the
  3172. “usual file name errors”.
  3173. ‘EACCES’
  3174. The process does not have search permission for a directory
  3175. component of the file name.
  3176. ‘ENAMETOOLONG’
  3177. This error is used when either the total length of a file name is
  3178. greater than ‘PATH_MAX’, or when an individual file name component
  3179. has a length greater than ‘NAME_MAX’. *Note Limits for Files::.
  3180. On GNU/Hurd systems, there is no imposed limit on overall file name
  3181. length, but some file systems may place limits on the length of a
  3182. component.
  3183. ‘ENOENT’
  3184. This error is reported when a file referenced as a directory
  3185. component in the file name doesn't exist, or when a component is a
  3186. symbolic link whose target file does not exist. *Note Symbolic
  3187. Links::.
  3188. ‘ENOTDIR’
  3189. A file that is referenced as a directory component in the file name
  3190. exists, but it isn't a directory.
  3191. ‘ELOOP’
  3192. Too many symbolic links were resolved while trying to look up the
  3193. file name. The system has an arbitrary limit on the number of
  3194. symbolic links that may be resolved in looking up a single file
  3195. name, as a primitive way to detect loops. *Note Symbolic Links::.
  3196. 
  3197. File: libc.info, Node: File Name Portability, Prev: File Name Errors, Up: File Names
  3198. 11.2.4 Portability of File Names
  3199. --------------------------------
  3200. The rules for the syntax of file names discussed in *note File Names::,
  3201. are the rules normally used by GNU systems and by other POSIX systems.
  3202. However, other operating systems may use other conventions.
  3203. There are two reasons why it can be important for you to be aware of
  3204. file name portability issues:
  3205. • If your program makes assumptions about file name syntax, or
  3206. contains embedded literal file name strings, it is more difficult
  3207. to get it to run under other operating systems that use different
  3208. syntax conventions.
  3209. • Even if you are not concerned about running your program on
  3210. machines that run other operating systems, it may still be possible
  3211. to access files that use different naming conventions. For
  3212. example, you may be able to access file systems on another computer
  3213. running a different operating system over a network, or read and
  3214. write disks in formats used by other operating systems.
  3215. The ISO C standard says very little about file name syntax, only that
  3216. file names are strings. In addition to varying restrictions on the
  3217. length of file names and what characters can validly appear in a file
  3218. name, different operating systems use different conventions and syntax
  3219. for concepts such as structured directories and file types or
  3220. extensions. Some concepts such as file versions might be supported in
  3221. some operating systems and not by others.
  3222. The POSIX.1 standard allows implementations to put additional
  3223. restrictions on file name syntax, concerning what characters are
  3224. permitted in file names and on the length of file name and file name
  3225. component strings. However, on GNU systems, any character except the
  3226. null character is permitted in a file name string, and on GNU/Hurd
  3227. systems there are no limits on the length of file name strings.
  3228. 
  3229. File: libc.info, Node: I/O on Streams, Next: Low-Level I/O, Prev: I/O Overview, Up: Top
  3230. 12 Input/Output on Streams
  3231. **************************
  3232. This chapter describes the functions for creating streams and performing
  3233. input and output operations on them. As discussed in *note I/O
  3234. Overview::, a stream is a fairly abstract, high-level concept
  3235. representing a communications channel to a file, device, or process.
  3236. * Menu:
  3237. * Streams:: About the data type representing a stream.
  3238. * Standard Streams:: Streams to the standard input and output
  3239. devices are created for you.
  3240. * Opening Streams:: How to create a stream to talk to a file.
  3241. * Closing Streams:: Close a stream when you are finished with it.
  3242. * Streams and Threads:: Issues with streams in threaded programs.
  3243. * Streams and I18N:: Streams in internationalized applications.
  3244. * Simple Output:: Unformatted output by characters and lines.
  3245. * Character Input:: Unformatted input by characters and words.
  3246. * Line Input:: Reading a line or a record from a stream.
  3247. * Unreading:: Peeking ahead/pushing back input just read.
  3248. * Block Input/Output:: Input and output operations on blocks of data.
  3249. * Formatted Output:: ‘printf’ and related functions.
  3250. * Customizing Printf:: You can define new conversion specifiers for
  3251. ‘printf’ and friends.
  3252. * Formatted Input:: ‘scanf’ and related functions.
  3253. * EOF and Errors:: How you can tell if an I/O error happens.
  3254. * Error Recovery:: What you can do about errors.
  3255. * Binary Streams:: Some systems distinguish between text files
  3256. and binary files.
  3257. * File Positioning:: About random-access streams.
  3258. * Portable Positioning:: Random access on peculiar ISO C systems.
  3259. * Stream Buffering:: How to control buffering of streams.
  3260. * Other Kinds of Streams:: Streams that do not necessarily correspond
  3261. to an open file.
  3262. * Formatted Messages:: Print strictly formatted messages.
  3263. 
  3264. File: libc.info, Node: Streams, Next: Standard Streams, Up: I/O on Streams
  3265. 12.1 Streams
  3266. ============
  3267. For historical reasons, the type of the C data structure that represents
  3268. a stream is called ‘FILE’ rather than "stream". Since most of the
  3269. library functions deal with objects of type ‘FILE *’, sometimes the term
  3270. “file pointer” is also used to mean "stream". This leads to unfortunate
  3271. confusion over terminology in many books on C. This manual, however, is
  3272. careful to use the terms "file" and "stream" only in the technical
  3273. sense.
  3274. The ‘FILE’ type is declared in the header file ‘stdio.h’.
  3275. -- Data Type: FILE
  3276. This is the data type used to represent stream objects. A ‘FILE’
  3277. object holds all of the internal state information about the
  3278. connection to the associated file, including such things as the
  3279. file position indicator and buffering information. Each stream
  3280. also has error and end-of-file status indicators that can be tested
  3281. with the ‘ferror’ and ‘feof’ functions; see *note EOF and Errors::.
  3282. ‘FILE’ objects are allocated and managed internally by the
  3283. input/output library functions. Don't try to create your own objects of
  3284. type ‘FILE’; let the library do it. Your programs should deal only with
  3285. pointers to these objects (that is, ‘FILE *’ values) rather than the
  3286. objects themselves.
  3287. 
  3288. File: libc.info, Node: Standard Streams, Next: Opening Streams, Prev: Streams, Up: I/O on Streams
  3289. 12.2 Standard Streams
  3290. =====================
  3291. When the ‘main’ function of your program is invoked, it already has
  3292. three predefined streams open and available for use. These represent
  3293. the "standard" input and output channels that have been established for
  3294. the process.
  3295. These streams are declared in the header file ‘stdio.h’.
  3296. -- Variable: FILE * stdin
  3297. The “standard input” stream, which is the normal source of input
  3298. for the program.
  3299. -- Variable: FILE * stdout
  3300. The “standard output” stream, which is used for normal output from
  3301. the program.
  3302. -- Variable: FILE * stderr
  3303. The “standard error” stream, which is used for error messages and
  3304. diagnostics issued by the program.
  3305. On GNU systems, you can specify what files or processes correspond to
  3306. these streams using the pipe and redirection facilities provided by the
  3307. shell. (The primitives shells use to implement these facilities are
  3308. described in *note File System Interface::.) Most other operating
  3309. systems provide similar mechanisms, but the details of how to use them
  3310. can vary.
  3311. In the GNU C Library, ‘stdin’, ‘stdout’, and ‘stderr’ are normal
  3312. variables which you can set just like any others. For example, to
  3313. redirect the standard output to a file, you could do:
  3314. fclose (stdout);
  3315. stdout = fopen ("standard-output-file", "w");
  3316. Note however, that in other systems ‘stdin’, ‘stdout’, and ‘stderr’
  3317. are macros that you cannot assign to in the normal way. But you can use
  3318. ‘freopen’ to get the effect of closing one and reopening it. *Note
  3319. Opening Streams::.
  3320. The three streams ‘stdin’, ‘stdout’, and ‘stderr’ are not unoriented
  3321. at program start (*note Streams and I18N::).
  3322. 
  3323. File: libc.info, Node: Opening Streams, Next: Closing Streams, Prev: Standard Streams, Up: I/O on Streams
  3324. 12.3 Opening Streams
  3325. ====================
  3326. Opening a file with the ‘fopen’ function creates a new stream and
  3327. establishes a connection between the stream and a file. This may
  3328. involve creating a new file.
  3329. Everything described in this section is declared in the header file
  3330. ‘stdio.h’.
  3331. -- Function: FILE * fopen (const char *FILENAME, const char *OPENTYPE)
  3332. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem fd
  3333. lock | *Note POSIX Safety Concepts::.
  3334. The ‘fopen’ function opens a stream for I/O to the file FILENAME,
  3335. and returns a pointer to the stream.
  3336. The OPENTYPE argument is a string that controls how the file is
  3337. opened and specifies attributes of the resulting stream. It must
  3338. begin with one of the following sequences of characters:
  3339. ‘r’
  3340. Open an existing file for reading only.
  3341. ‘w’
  3342. Open the file for writing only. If the file already exists,
  3343. it is truncated to zero length. Otherwise a new file is
  3344. created.
  3345. ‘a’
  3346. Open a file for append access; that is, writing at the end of
  3347. file only. If the file already exists, its initial contents
  3348. are unchanged and output to the stream is appended to the end
  3349. of the file. Otherwise, a new, empty file is created.
  3350. ‘r+’
  3351. Open an existing file for both reading and writing. The
  3352. initial contents of the file are unchanged and the initial
  3353. file position is at the beginning of the file.
  3354. ‘w+’
  3355. Open a file for both reading and writing. If the file already
  3356. exists, it is truncated to zero length. Otherwise, a new file
  3357. is created.
  3358. ‘a+’
  3359. Open or create file for both reading and appending. If the
  3360. file exists, its initial contents are unchanged. Otherwise, a
  3361. new file is created. The initial file position for reading is
  3362. at the beginning of the file, but output is always appended to
  3363. the end of the file.
  3364. As you can see, ‘+’ requests a stream that can do both input and
  3365. output. When using such a stream, you must call ‘fflush’ (*note
  3366. Stream Buffering::) or a file positioning function such as ‘fseek’
  3367. (*note File Positioning::) when switching from reading to writing
  3368. or vice versa. Otherwise, internal buffers might not be emptied
  3369. properly.
  3370. Additional characters may appear after these to specify flags for
  3371. the call. Always put the mode (‘r’, ‘w+’, etc.) first; that is
  3372. the only part you are guaranteed will be understood by all systems.
  3373. The GNU C Library defines additional characters for use in
  3374. OPENTYPE:
  3375. ‘c’
  3376. The file is opened with cancellation in the I/O functions
  3377. disabled.
  3378. ‘e’
  3379. The underlying file descriptor will be closed if you use any
  3380. of the ‘exec...’ functions (*note Executing a File::). (This
  3381. is equivalent to having set ‘FD_CLOEXEC’ on that descriptor.
  3382. *Note Descriptor Flags::.)
  3383. ‘m’
  3384. The file is opened and accessed using ‘mmap’. This is only
  3385. supported with files opened for reading.
  3386. ‘x’
  3387. Insist on creating a new file--if a file FILENAME already
  3388. exists, ‘fopen’ fails rather than opening it. If you use ‘x’
  3389. you are guaranteed that you will not clobber an existing file.
  3390. This is equivalent to the ‘O_EXCL’ option to the ‘open’
  3391. function (*note Opening and Closing Files::).
  3392. The ‘x’ modifier is part of ISO C11, which says the file is
  3393. created with exclusive access; in the GNU C Library this means
  3394. the equivalent of ‘O_EXCL’.
  3395. The character ‘b’ in OPENTYPE has a standard meaning; it requests a
  3396. binary stream rather than a text stream. But this makes no
  3397. difference in POSIX systems (including GNU systems). If both ‘+’
  3398. and ‘b’ are specified, they can appear in either order. *Note
  3399. Binary Streams::.
  3400. If the OPENTYPE string contains the sequence ‘,ccs=STRING’ then
  3401. STRING is taken as the name of a coded character set and ‘fopen’
  3402. will mark the stream as wide-oriented with appropriate conversion
  3403. functions in place to convert from and to the character set STRING.
  3404. Any other stream is opened initially unoriented and the orientation
  3405. is decided with the first file operation. If the first operation
  3406. is a wide character operation, the stream is not only marked as
  3407. wide-oriented, also the conversion functions to convert to the
  3408. coded character set used for the current locale are loaded. This
  3409. will not change anymore from this point on even if the locale
  3410. selected for the ‘LC_CTYPE’ category is changed.
  3411. Any other characters in OPENTYPE are simply ignored. They may be
  3412. meaningful in other systems.
  3413. If the open fails, ‘fopen’ returns a null pointer.
  3414. When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  3415. 32 bit machine this function is in fact ‘fopen64’ since the LFS
  3416. interface replaces transparently the old interface.
  3417. You can have multiple streams (or file descriptors) pointing to the
  3418. same file open at the same time. If you do only input, this works
  3419. straightforwardly, but you must be careful if any output streams are
  3420. included. *Note Stream/Descriptor Precautions::. This is equally true
  3421. whether the streams are in one program (not usual) or in several
  3422. programs (which can easily happen). It may be advantageous to use the
  3423. file locking facilities to avoid simultaneous access. *Note File
  3424. Locks::.
  3425. -- Function: FILE * fopen64 (const char *FILENAME, const char
  3426. *OPENTYPE)
  3427. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe mem fd
  3428. lock | *Note POSIX Safety Concepts::.
  3429. This function is similar to ‘fopen’ but the stream it returns a
  3430. pointer for is opened using ‘open64’. Therefore this stream can be
  3431. used even on files larger than 2^31 bytes on 32 bit machines.
  3432. Please note that the return type is still ‘FILE *’. There is no
  3433. special ‘FILE’ type for the LFS interface.
  3434. If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
  3435. bits machine this function is available under the name ‘fopen’ and
  3436. so transparently replaces the old interface.
  3437. -- Macro: int FOPEN_MAX
  3438. The value of this macro is an integer constant expression that
  3439. represents the minimum number of streams that the implementation
  3440. guarantees can be open simultaneously. You might be able to open
  3441. more than this many streams, but that is not guaranteed. The value
  3442. of this constant is at least eight, which includes the three
  3443. standard streams ‘stdin’, ‘stdout’, and ‘stderr’. In POSIX.1
  3444. systems this value is determined by the ‘OPEN_MAX’ parameter; *note
  3445. General Limits::. In BSD and GNU, it is controlled by the
  3446. ‘RLIMIT_NOFILE’ resource limit; *note Limits on Resources::.
  3447. -- Function: FILE * freopen (const char *FILENAME, const char
  3448. *OPENTYPE, FILE *STREAM)
  3449. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt fd |
  3450. *Note POSIX Safety Concepts::.
  3451. This function is like a combination of ‘fclose’ and ‘fopen’. It
  3452. first closes the stream referred to by STREAM, ignoring any errors
  3453. that are detected in the process. (Because errors are ignored, you
  3454. should not use ‘freopen’ on an output stream if you have actually
  3455. done any output using the stream.) Then the file named by FILENAME
  3456. is opened with mode OPENTYPE as for ‘fopen’, and associated with
  3457. the same stream object STREAM.
  3458. If the operation fails, a null pointer is returned; otherwise,
  3459. ‘freopen’ returns STREAM. On Linux, ‘freopen’ may also fail and
  3460. set ‘errno’ to ‘EBUSY’ when the kernel structure for the old file
  3461. descriptor was not initialized completely before ‘freopen’ was
  3462. called. This can only happen in multi-threaded programs, when two
  3463. threads race to allocate the same file descriptor number. To avoid
  3464. the possibility of this race, do not use ‘close’ to close the
  3465. underlying file descriptor for a ‘FILE’; either use ‘freopen’ while
  3466. the file is still open, or use ‘open’ and then ‘dup2’ to install
  3467. the new file descriptor.
  3468. ‘freopen’ has traditionally been used to connect a standard stream
  3469. such as ‘stdin’ with a file of your own choice. This is useful in
  3470. programs in which use of a standard stream for certain purposes is
  3471. hard-coded. In the GNU C Library, you can simply close the
  3472. standard streams and open new ones with ‘fopen’. But other systems
  3473. lack this ability, so using ‘freopen’ is more portable.
  3474. When the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a
  3475. 32 bit machine this function is in fact ‘freopen64’ since the LFS
  3476. interface replaces transparently the old interface.
  3477. The GNU C Library only supports use of ‘freopen’ on streams opened
  3478. with ‘fopen’ or ‘fopen64’ and on the original values of the
  3479. standard streams ‘stdin’, ‘stdout’, and ‘stderr’; such a stream may
  3480. be reopened multiple times with ‘freopen’. If it is called on
  3481. another kind of stream (opened with functions such as ‘popen’,
  3482. ‘fmemopen’, ‘open_memstream’, and ‘fopencookie’), ‘freopen’ fails
  3483. and returns a null pointer.
  3484. -- Function: FILE * freopen64 (const char *FILENAME, const char
  3485. *OPENTYPE, FILE *STREAM)
  3486. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt fd |
  3487. *Note POSIX Safety Concepts::.
  3488. This function is similar to ‘freopen’. The only difference is that
  3489. on 32 bit machine the stream returned is able to read beyond the
  3490. 2^31 bytes limits imposed by the normal interface. It should be
  3491. noted that the stream pointed to by STREAM need not be opened using
  3492. ‘fopen64’ or ‘freopen64’ since its mode is not important for this
  3493. function.
  3494. If the sources are compiled with ‘_FILE_OFFSET_BITS == 64’ on a 32
  3495. bits machine this function is available under the name ‘freopen’
  3496. and so transparently replaces the old interface.
  3497. In some situations it is useful to know whether a given stream is
  3498. available for reading or writing. This information is normally not
  3499. available and would have to be remembered separately. Solaris
  3500. introduced a few functions to get this information from the stream
  3501. descriptor and these functions are also available in the GNU C Library.
  3502. -- Function: int __freadable (FILE *STREAM)
  3503. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3504. Concepts::.
  3505. The ‘__freadable’ function determines whether the stream STREAM was
  3506. opened to allow reading. In this case the return value is nonzero.
  3507. For write-only streams the function returns zero.
  3508. This function is declared in ‘stdio_ext.h’.
  3509. -- Function: int __fwritable (FILE *STREAM)
  3510. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3511. Concepts::.
  3512. The ‘__fwritable’ function determines whether the stream STREAM was
  3513. opened to allow writing. In this case the return value is nonzero.
  3514. For read-only streams the function returns zero.
  3515. This function is declared in ‘stdio_ext.h’.
  3516. For slightly different kinds of problems there are two more
  3517. functions. They provide even finer-grained information.
  3518. -- Function: int __freading (FILE *STREAM)
  3519. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3520. Concepts::.
  3521. The ‘__freading’ function determines whether the stream STREAM was
  3522. last read from or whether it is opened read-only. In this case the
  3523. return value is nonzero, otherwise it is zero. Determining whether
  3524. a stream opened for reading and writing was last used for writing
  3525. allows to draw conclusions about the content about the buffer,
  3526. among other things.
  3527. This function is declared in ‘stdio_ext.h’.
  3528. -- Function: int __fwriting (FILE *STREAM)
  3529. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  3530. Concepts::.
  3531. The ‘__fwriting’ function determines whether the stream STREAM was
  3532. last written to or whether it is opened write-only. In this case
  3533. the return value is nonzero, otherwise it is zero.
  3534. This function is declared in ‘stdio_ext.h’.
  3535. 
  3536. File: libc.info, Node: Closing Streams, Next: Streams and Threads, Prev: Opening Streams, Up: I/O on Streams
  3537. 12.4 Closing Streams
  3538. ====================
  3539. When a stream is closed with ‘fclose’, the connection between the stream
  3540. and the file is canceled. After you have closed a stream, you cannot
  3541. perform any additional operations on it.
  3542. -- Function: int fclose (FILE *STREAM)
  3543. Preliminary: | MT-Safe | AS-Unsafe heap lock | AC-Unsafe lock mem
  3544. fd | *Note POSIX Safety Concepts::.
  3545. This function causes STREAM to be closed and the connection to the
  3546. corresponding file to be broken. Any buffered output is written
  3547. and any buffered input is discarded. The ‘fclose’ function returns
  3548. a value of ‘0’ if the file was closed successfully, and ‘EOF’ if an
  3549. error was detected.
  3550. It is important to check for errors when you call ‘fclose’ to close
  3551. an output stream, because real, everyday errors can be detected at
  3552. this time. For example, when ‘fclose’ writes the remaining
  3553. buffered output, it might get an error because the disk is full.
  3554. Even if you know the buffer is empty, errors can still occur when
  3555. closing a file if you are using NFS.
  3556. The function ‘fclose’ is declared in ‘stdio.h’.
  3557. To close all streams currently available the GNU C Library provides
  3558. another function.
  3559. -- Function: int fcloseall (void)
  3560. Preliminary: | MT-Unsafe race:streams | AS-Unsafe | AC-Safe | *Note
  3561. POSIX Safety Concepts::.
  3562. This function causes all open streams of the process to be closed
  3563. and the connections to corresponding files to be broken. All
  3564. buffered data is written and any buffered input is discarded. The
  3565. ‘fcloseall’ function returns a value of ‘0’ if all the files were
  3566. closed successfully, and ‘EOF’ if an error was detected.
  3567. This function should be used only in special situations, e.g., when
  3568. an error occurred and the program must be aborted. Normally each
  3569. single stream should be closed separately so that problems with
  3570. individual streams can be identified. It is also problematic since
  3571. the standard streams (*note Standard Streams::) will also be
  3572. closed.
  3573. The function ‘fcloseall’ is declared in ‘stdio.h’.
  3574. If the ‘main’ function to your program returns, or if you call the
  3575. ‘exit’ function (*note Normal Termination::), all open streams are
  3576. automatically closed properly. If your program terminates in any other
  3577. manner, such as by calling the ‘abort’ function (*note Aborting a
  3578. Program::) or from a fatal signal (*note Signal Handling::), open
  3579. streams might not be closed properly. Buffered output might not be
  3580. flushed and files may be incomplete. For more information on buffering
  3581. of streams, see *note Stream Buffering::.
  3582. 
  3583. File: libc.info, Node: Streams and Threads, Next: Streams and I18N, Prev: Closing Streams, Up: I/O on Streams
  3584. 12.5 Streams and Threads
  3585. ========================
  3586. Streams can be used in multi-threaded applications in the same way they
  3587. are used in single-threaded applications. But the programmer must be
  3588. aware of the possible complications. It is important to know about
  3589. these also if the program one writes never use threads since the design
  3590. and implementation of many stream functions are heavily influenced by
  3591. the requirements added by multi-threaded programming.
  3592. The POSIX standard requires that by default the stream operations are
  3593. atomic. I.e., issuing two stream operations for the same stream in two
  3594. threads at the same time will cause the operations to be executed as if
  3595. they were issued sequentially. The buffer operations performed while
  3596. reading or writing are protected from other uses of the same stream. To
  3597. do this each stream has an internal lock object which has to be
  3598. (implicitly) acquired before any work can be done.
  3599. But there are situations where this is not enough and there are also
  3600. situations where this is not wanted. The implicit locking is not enough
  3601. if the program requires more than one stream function call to happen
  3602. atomically. One example would be if an output line a program wants to
  3603. generate is created by several function calls. The functions by
  3604. themselves would ensure only atomicity of their own operation, but not
  3605. atomicity over all the function calls. For this it is necessary to
  3606. perform the stream locking in the application code.
  3607. -- Function: void flockfile (FILE *STREAM)
  3608. Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
  3609. Safety Concepts::.
  3610. The ‘flockfile’ function acquires the internal locking object
  3611. associated with the stream STREAM. This ensures that no other
  3612. thread can explicitly through ‘flockfile’/‘ftrylockfile’ or
  3613. implicitly through the call of a stream function lock the stream.
  3614. The thread will block until the lock is acquired. An explicit call
  3615. to ‘funlockfile’ has to be used to release the lock.
  3616. -- Function: int ftrylockfile (FILE *STREAM)
  3617. Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
  3618. Safety Concepts::.
  3619. The ‘ftrylockfile’ function tries to acquire the internal locking
  3620. object associated with the stream STREAM just like ‘flockfile’.
  3621. But unlike ‘flockfile’ this function does not block if the lock is
  3622. not available. ‘ftrylockfile’ returns zero if the lock was
  3623. successfully acquired. Otherwise the stream is locked by another
  3624. thread.
  3625. -- Function: void funlockfile (FILE *STREAM)
  3626. Preliminary: | MT-Safe | AS-Safe | AC-Unsafe lock | *Note POSIX
  3627. Safety Concepts::.
  3628. The ‘funlockfile’ function releases the internal locking object of
  3629. the stream STREAM. The stream must have been locked before by a
  3630. call to ‘flockfile’ or a successful call of ‘ftrylockfile’. The
  3631. implicit locking performed by the stream operations do not count.
  3632. The ‘funlockfile’ function does not return an error status and the
  3633. behavior of a call for a stream which is not locked by the current
  3634. thread is undefined.
  3635. The following example shows how the functions above can be used to
  3636. generate an output line atomically even in multi-threaded applications
  3637. (yes, the same job could be done with one ‘fprintf’ call but it is
  3638. sometimes not possible):
  3639. FILE *fp;
  3640. {
  3641. ...
  3642. flockfile (fp);
  3643. fputs ("This is test number ", fp);
  3644. fprintf (fp, "%d\n", test);
  3645. funlockfile (fp)
  3646. }
  3647. Without the explicit locking it would be possible for another thread
  3648. to use the stream FP after the ‘fputs’ call returns and before ‘fprintf’
  3649. was called with the result that the number does not follow the word
  3650. ‘number’.
  3651. From this description it might already be clear that the locking
  3652. objects in streams are no simple mutexes. Since locking the same stream
  3653. twice in the same thread is allowed the locking objects must be
  3654. equivalent to recursive mutexes. These mutexes keep track of the owner
  3655. and the number of times the lock is acquired. The same number of
  3656. ‘funlockfile’ calls by the same threads is necessary to unlock the
  3657. stream completely. For instance:
  3658. void
  3659. foo (FILE *fp)
  3660. {
  3661. ftrylockfile (fp);
  3662. fputs ("in foo\n", fp);
  3663. /* This is very wrong!!! */
  3664. funlockfile (fp);
  3665. }
  3666. It is important here that the ‘funlockfile’ function is only called
  3667. if the ‘ftrylockfile’ function succeeded in locking the stream. It is
  3668. therefore always wrong to ignore the result of ‘ftrylockfile’. And it
  3669. makes no sense since otherwise one would use ‘flockfile’. The result of
  3670. code like that above is that either ‘funlockfile’ tries to free a stream
  3671. that hasn't been locked by the current thread or it frees the stream
  3672. prematurely. The code should look like this:
  3673. void
  3674. foo (FILE *fp)
  3675. {
  3676. if (ftrylockfile (fp) == 0)
  3677. {
  3678. fputs ("in foo\n", fp);
  3679. funlockfile (fp);
  3680. }
  3681. }
  3682. Now that we covered why it is necessary to have locking it is
  3683. necessary to talk about situations when locking is unwanted and what can
  3684. be done. The locking operations (explicit or implicit) don't come for
  3685. free. Even if a lock is not taken the cost is not zero. The operations
  3686. which have to be performed require memory operations that are safe in
  3687. multi-processor environments. With the many local caches involved in
  3688. such systems this is quite costly. So it is best to avoid the locking
  3689. completely if it is not needed - because the code in question is never
  3690. used in a context where two or more threads may use a stream at a time.
  3691. This can be determined most of the time for application code; for
  3692. library code which can be used in many contexts one should default to be
  3693. conservative and use locking.
  3694. There are two basic mechanisms to avoid locking. The first is to use
  3695. the ‘_unlocked’ variants of the stream operations. The POSIX standard
  3696. defines quite a few of those and the GNU C Library adds a few more.
  3697. These variants of the functions behave just like the functions with the
  3698. name without the suffix except that they do not lock the stream. Using
  3699. these functions is very desirable since they are potentially much
  3700. faster. This is not only because the locking operation itself is
  3701. avoided. More importantly, functions like ‘putc’ and ‘getc’ are very
  3702. simple and traditionally (before the introduction of threads) were
  3703. implemented as macros which are very fast if the buffer is not empty.
  3704. With the addition of locking requirements these functions are no longer
  3705. implemented as macros since they would expand to too much code. But
  3706. these macros are still available with the same functionality under the
  3707. new names ‘putc_unlocked’ and ‘getc_unlocked’. This possibly huge
  3708. difference of speed also suggests the use of the ‘_unlocked’ functions
  3709. even if locking is required. The difference is that the locking then
  3710. has to be performed in the program:
  3711. void
  3712. foo (FILE *fp, char *buf)
  3713. {
  3714. flockfile (fp);
  3715. while (*buf != '/')
  3716. putc_unlocked (*buf++, fp);
  3717. funlockfile (fp);
  3718. }
  3719. If in this example the ‘putc’ function would be used and the explicit
  3720. locking would be missing the ‘putc’ function would have to acquire the
  3721. lock in every call, potentially many times depending on when the loop
  3722. terminates. Writing it the way illustrated above allows the
  3723. ‘putc_unlocked’ macro to be used which means no locking and direct
  3724. manipulation of the buffer of the stream.
  3725. A second way to avoid locking is by using a non-standard function
  3726. which was introduced in Solaris and is available in the GNU C Library as
  3727. well.
  3728. -- Function: int __fsetlocking (FILE *STREAM, int TYPE)
  3729. Preliminary: | MT-Safe race:stream | AS-Unsafe lock | AC-Safe |
  3730. *Note POSIX Safety Concepts::.
  3731. The ‘__fsetlocking’ function can be used to select whether the
  3732. stream operations will implicitly acquire the locking object of the
  3733. stream STREAM. By default this is done but it can be disabled and
  3734. reinstated using this function. There are three values defined for
  3735. the TYPE parameter.
  3736. ‘FSETLOCKING_INTERNAL’
  3737. The stream ‘stream’ will from now on use the default internal
  3738. locking. Every stream operation with exception of the
  3739. ‘_unlocked’ variants will implicitly lock the stream.
  3740. ‘FSETLOCKING_BYCALLER’
  3741. After the ‘__fsetlocking’ function returns, the user is
  3742. responsible for locking the stream. None of the stream
  3743. operations will implicitly do this anymore until the state is
  3744. set back to ‘FSETLOCKING_INTERNAL’.
  3745. ‘FSETLOCKING_QUERY’
  3746. ‘__fsetlocking’ only queries the current locking state of the
  3747. stream. The return value will be ‘FSETLOCKING_INTERNAL’ or
  3748. ‘FSETLOCKING_BYCALLER’ depending on the state.
  3749. The return value of ‘__fsetlocking’ is either
  3750. ‘FSETLOCKING_INTERNAL’ or ‘FSETLOCKING_BYCALLER’ depending on the
  3751. state of the stream before the call.
  3752. This function and the values for the TYPE parameter are declared in
  3753. ‘stdio_ext.h’.
  3754. This function is especially useful when program code has to be used
  3755. which is written without knowledge about the ‘_unlocked’ functions (or
  3756. if the programmer was too lazy to use them).
  3757. 
  3758. File: libc.info, Node: Streams and I18N, Next: Simple Output, Prev: Streams and Threads, Up: I/O on Streams
  3759. 12.6 Streams in Internationalized Applications
  3760. ==============================================
  3761. ISO C90 introduced the new type ‘wchar_t’ to allow handling larger
  3762. character sets. What was missing was a possibility to output strings of
  3763. ‘wchar_t’ directly. One had to convert them into multibyte strings
  3764. using ‘mbstowcs’ (there was no ‘mbsrtowcs’ yet) and then use the normal
  3765. stream functions. While this is doable it is very cumbersome since
  3766. performing the conversions is not trivial and greatly increases program
  3767. complexity and size.
  3768. The Unix standard early on (I think in XPG4.2) introduced two
  3769. additional format specifiers for the ‘printf’ and ‘scanf’ families of
  3770. functions. Printing and reading of single wide characters was made
  3771. possible using the ‘%C’ specifier and wide character strings can be
  3772. handled with ‘%S’. These modifiers behave just like ‘%c’ and ‘%s’ only
  3773. that they expect the corresponding argument to have the wide character
  3774. type and that the wide character and string are transformed into/from
  3775. multibyte strings before being used.
  3776. This was a beginning but it is still not good enough. Not always is
  3777. it desirable to use ‘printf’ and ‘scanf’. The other, smaller and faster
  3778. functions cannot handle wide characters. Second, it is not possible to
  3779. have a format string for ‘printf’ and ‘scanf’ consisting of wide
  3780. characters. The result is that format strings would have to be
  3781. generated if they have to contain non-basic characters.
  3782. In the Amendment 1 to ISO C90 a whole new set of functions was added
  3783. to solve the problem. Most of the stream functions got a counterpart
  3784. which take a wide character or wide character string instead of a
  3785. character or string respectively. The new functions operate on the same
  3786. streams (like ‘stdout’). This is different from the model of the C++
  3787. runtime library where separate streams for wide and normal I/O are used.
  3788. Being able to use the same stream for wide and normal operations
  3789. comes with a restriction: a stream can be used either for wide
  3790. operations or for normal operations. Once it is decided there is no way
  3791. back. Only a call to ‘freopen’ or ‘freopen64’ can reset the
  3792. “orientation”. The orientation can be decided in three ways:
  3793. • If any of the normal character functions are used (this includes
  3794. the ‘fread’ and ‘fwrite’ functions) the stream is marked as not
  3795. wide oriented.
  3796. • If any of the wide character functions are used the stream is
  3797. marked as wide oriented.
  3798. • The ‘fwide’ function can be used to set the orientation either way.
  3799. It is important to never mix the use of wide and not wide operations
  3800. on a stream. There are no diagnostics issued. The application behavior
  3801. will simply be strange or the application will simply crash. The
  3802. ‘fwide’ function can help avoid this.
  3803. -- Function: int fwide (FILE *STREAM, int MODE)
  3804. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock | *Note
  3805. POSIX Safety Concepts::.
  3806. The ‘fwide’ function can be used to set and query the state of the
  3807. orientation of the stream STREAM. If the MODE parameter has a
  3808. positive value the streams get wide oriented, for negative values
  3809. narrow oriented. It is not possible to overwrite previous
  3810. orientations with ‘fwide’. I.e., if the stream STREAM was already
  3811. oriented before the call nothing is done.
  3812. If MODE is zero the current orientation state is queried and
  3813. nothing is changed.
  3814. The ‘fwide’ function returns a negative value, zero, or a positive
  3815. value if the stream is narrow, not at all, or wide oriented
  3816. respectively.
  3817. This function was introduced in Amendment 1 to ISO C90 and is
  3818. declared in ‘wchar.h’.
  3819. It is generally a good idea to orient a stream as early as possible.
  3820. This can prevent surprise especially for the standard streams ‘stdin’,
  3821. ‘stdout’, and ‘stderr’. If some library function in some situations
  3822. uses one of these streams and this use orients the stream in a different
  3823. way the rest of the application expects it one might end up with hard to
  3824. reproduce errors. Remember that no errors are signal if the streams are
  3825. used incorrectly. Leaving a stream unoriented after creation is
  3826. normally only necessary for library functions which create streams which
  3827. can be used in different contexts.
  3828. When writing code which uses streams and which can be used in
  3829. different contexts it is important to query the orientation of the
  3830. stream before using it (unless the rules of the library interface demand
  3831. a specific orientation). The following little, silly function
  3832. illustrates this.
  3833. void
  3834. print_f (FILE *fp)
  3835. {
  3836. if (fwide (fp, 0) > 0)
  3837. /* Positive return value means wide orientation. */
  3838. fputwc (L'f', fp);
  3839. else
  3840. fputc ('f', fp);
  3841. }
  3842. Note that in this case the function ‘print_f’ decides about the
  3843. orientation of the stream if it was unoriented before (will not happen
  3844. if the advice above is followed).
  3845. The encoding used for the ‘wchar_t’ values is unspecified and the
  3846. user must not make any assumptions about it. For I/O of ‘wchar_t’
  3847. values this means that it is impossible to write these values directly
  3848. to the stream. This is not what follows from the ISO C locale model
  3849. either. What happens instead is that the bytes read from or written to
  3850. the underlying media are first converted into the internal encoding
  3851. chosen by the implementation for ‘wchar_t’. The external encoding is
  3852. determined by the ‘LC_CTYPE’ category of the current locale or by the
  3853. ‘ccs’ part of the mode specification given to ‘fopen’, ‘fopen64’,
  3854. ‘freopen’, or ‘freopen64’. How and when the conversion happens is
  3855. unspecified and it happens invisibly to the user.
  3856. Since a stream is created in the unoriented state it has at that
  3857. point no conversion associated with it. The conversion which will be
  3858. used is determined by the ‘LC_CTYPE’ category selected at the time the
  3859. stream is oriented. If the locales are changed at the runtime this
  3860. might produce surprising results unless one pays attention. This is
  3861. just another good reason to orient the stream explicitly as soon as
  3862. possible, perhaps with a call to ‘fwide’.
  3863. 
  3864. File: libc.info, Node: Simple Output, Next: Character Input, Prev: Streams and I18N, Up: I/O on Streams
  3865. 12.7 Simple Output by Characters or Lines
  3866. =========================================
  3867. This section describes functions for performing character- and
  3868. line-oriented output.
  3869. These narrow stream functions are declared in the header file
  3870. ‘stdio.h’ and the wide stream functions in ‘wchar.h’.
  3871. -- Function: int fputc (int C, FILE *STREAM)
  3872. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3873. | *Note POSIX Safety Concepts::.
  3874. The ‘fputc’ function converts the character C to type ‘unsigned
  3875. char’, and writes it to the stream STREAM. ‘EOF’ is returned if a
  3876. write error occurs; otherwise the character C is returned.
  3877. -- Function: wint_t fputwc (wchar_t WC, FILE *STREAM)
  3878. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3879. | *Note POSIX Safety Concepts::.
  3880. The ‘fputwc’ function writes the wide character WC to the stream
  3881. STREAM. ‘WEOF’ is returned if a write error occurs; otherwise the
  3882. character WC is returned.
  3883. -- Function: int fputc_unlocked (int C, FILE *STREAM)
  3884. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3885. corrupt | *Note POSIX Safety Concepts::.
  3886. The ‘fputc_unlocked’ function is equivalent to the ‘fputc’ function
  3887. except that it does not implicitly lock the stream.
  3888. -- Function: wint_t fputwc_unlocked (wchar_t WC, FILE *STREAM)
  3889. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3890. corrupt | *Note POSIX Safety Concepts::.
  3891. The ‘fputwc_unlocked’ function is equivalent to the ‘fputwc’
  3892. function except that it does not implicitly lock the stream.
  3893. This function is a GNU extension.
  3894. -- Function: int putc (int C, FILE *STREAM)
  3895. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3896. | *Note POSIX Safety Concepts::.
  3897. This is just like ‘fputc’, except that it may be implemented as a
  3898. macro and may evaluate the STREAM argument more than once.
  3899. Therefore, STREAM should never be an expression with side-effects.
  3900. -- Function: wint_t putwc (wchar_t WC, FILE *STREAM)
  3901. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3902. | *Note POSIX Safety Concepts::.
  3903. This is just like ‘fputwc’, except that it may be implemented as a
  3904. macro and may evaluate the STREAM argument more than once.
  3905. Therefore, STREAM should never be an expression with side-effects.
  3906. -- Function: int putc_unlocked (int C, FILE *STREAM)
  3907. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3908. corrupt | *Note POSIX Safety Concepts::.
  3909. The ‘putc_unlocked’ function is equivalent to the ‘putc’ function
  3910. except that it does not implicitly lock the stream. Like ‘putc’,
  3911. it may be implemented as a macro and may evaluate the STREAM
  3912. argument more than once. Therefore, STREAM should not be an
  3913. expression with side-effects.
  3914. -- Function: wint_t putwc_unlocked (wchar_t WC, FILE *STREAM)
  3915. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3916. corrupt | *Note POSIX Safety Concepts::.
  3917. The ‘putwc_unlocked’ function is equivalent to the ‘putwc’ function
  3918. except that it does not implicitly lock the stream.
  3919. This function is a GNU extension.
  3920. -- Function: int putchar (int C)
  3921. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3922. | *Note POSIX Safety Concepts::.
  3923. The ‘putchar’ function is equivalent to ‘putc’ with ‘stdout’ as the
  3924. value of the STREAM argument.
  3925. -- Function: wint_t putwchar (wchar_t WC)
  3926. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3927. | *Note POSIX Safety Concepts::.
  3928. The ‘putwchar’ function is equivalent to ‘putwc’ with ‘stdout’ as
  3929. the value of the STREAM argument.
  3930. -- Function: int putchar_unlocked (int C)
  3931. Preliminary: | MT-Unsafe race:stdout | AS-Unsafe corrupt |
  3932. AC-Unsafe corrupt | *Note POSIX Safety Concepts::.
  3933. The ‘putchar_unlocked’ function is equivalent to the ‘putchar’
  3934. function except that it does not implicitly lock the stream.
  3935. -- Function: wint_t putwchar_unlocked (wchar_t WC)
  3936. Preliminary: | MT-Unsafe race:stdout | AS-Unsafe corrupt |
  3937. AC-Unsafe corrupt | *Note POSIX Safety Concepts::.
  3938. The ‘putwchar_unlocked’ function is equivalent to the ‘putwchar’
  3939. function except that it does not implicitly lock the stream.
  3940. This function is a GNU extension.
  3941. -- Function: int fputs (const char *S, FILE *STREAM)
  3942. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3943. | *Note POSIX Safety Concepts::.
  3944. The function ‘fputs’ writes the string S to the stream STREAM. The
  3945. terminating null character is not written. This function does
  3946. _not_ add a newline character, either. It outputs only the
  3947. characters in the string.
  3948. This function returns ‘EOF’ if a write error occurs, and otherwise
  3949. a non-negative value.
  3950. For example:
  3951. fputs ("Are ", stdout);
  3952. fputs ("you ", stdout);
  3953. fputs ("hungry?\n", stdout);
  3954. outputs the text ‘Are you hungry?’ followed by a newline.
  3955. -- Function: int fputws (const wchar_t *WS, FILE *STREAM)
  3956. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe corrupt lock
  3957. | *Note POSIX Safety Concepts::.
  3958. The function ‘fputws’ writes the wide character string WS to the
  3959. stream STREAM. The terminating null character is not written.
  3960. This function does _not_ add a newline character, either. It
  3961. outputs only the characters in the string.
  3962. This function returns ‘WEOF’ if a write error occurs, and otherwise
  3963. a non-negative value.
  3964. -- Function: int fputs_unlocked (const char *S, FILE *STREAM)
  3965. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3966. corrupt | *Note POSIX Safety Concepts::.
  3967. The ‘fputs_unlocked’ function is equivalent to the ‘fputs’ function
  3968. except that it does not implicitly lock the stream.
  3969. This function is a GNU extension.
  3970. -- Function: int fputws_unlocked (const wchar_t *WS, FILE *STREAM)
  3971. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  3972. corrupt | *Note POSIX Safety Concepts::.
  3973. The ‘fputws_unlocked’ function is equivalent to the ‘fputws’
  3974. function except that it does not implicitly lock the stream.
  3975. This function is a GNU extension.
  3976. -- Function: int puts (const char *S)
  3977. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  3978. | *Note POSIX Safety Concepts::.
  3979. The ‘puts’ function writes the string S to the stream ‘stdout’
  3980. followed by a newline. The terminating null character of the
  3981. string is not written. (Note that ‘fputs’ does _not_ write a
  3982. newline as this function does.)
  3983. ‘puts’ is the most convenient function for printing simple
  3984. messages. For example:
  3985. puts ("This is a message.");
  3986. outputs the text ‘This is a message.’ followed by a newline.
  3987. -- Function: int putw (int W, FILE *STREAM)
  3988. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  3989. | *Note POSIX Safety Concepts::.
  3990. This function writes the word W (that is, an ‘int’) to STREAM. It
  3991. is provided for compatibility with SVID, but we recommend you use
  3992. ‘fwrite’ instead (*note Block Input/Output::).
  3993. 
  3994. File: libc.info, Node: Character Input, Next: Line Input, Prev: Simple Output, Up: I/O on Streams
  3995. 12.8 Character Input
  3996. ====================
  3997. This section describes functions for performing character-oriented
  3998. input. These narrow stream functions are declared in the header file
  3999. ‘stdio.h’ and the wide character functions are declared in ‘wchar.h’.
  4000. These functions return an ‘int’ or ‘wint_t’ value (for narrow and
  4001. wide stream functions respectively) that is either a character of input,
  4002. or the special value ‘EOF’/‘WEOF’ (usually -1). For the narrow stream
  4003. functions it is important to store the result of these functions in a
  4004. variable of type ‘int’ instead of ‘char’, even when you plan to use it
  4005. only as a character. Storing ‘EOF’ in a ‘char’ variable truncates its
  4006. value to the size of a character, so that it is no longer
  4007. distinguishable from the valid character ‘(char) -1’. So always use an
  4008. ‘int’ for the result of ‘getc’ and friends, and check for ‘EOF’ after
  4009. the call; once you've verified that the result is not ‘EOF’, you can be
  4010. sure that it will fit in a ‘char’ variable without loss of information.
  4011. -- Function: int fgetc (FILE *STREAM)
  4012. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4013. | *Note POSIX Safety Concepts::.
  4014. This function reads the next character as an ‘unsigned char’ from
  4015. the stream STREAM and returns its value, converted to an ‘int’. If
  4016. an end-of-file condition or read error occurs, ‘EOF’ is returned
  4017. instead.
  4018. -- Function: wint_t fgetwc (FILE *STREAM)
  4019. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4020. | *Note POSIX Safety Concepts::.
  4021. This function reads the next wide character from the stream STREAM
  4022. and returns its value. If an end-of-file condition or read error
  4023. occurs, ‘WEOF’ is returned instead.
  4024. -- Function: int fgetc_unlocked (FILE *STREAM)
  4025. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4026. corrupt | *Note POSIX Safety Concepts::.
  4027. The ‘fgetc_unlocked’ function is equivalent to the ‘fgetc’ function
  4028. except that it does not implicitly lock the stream.
  4029. -- Function: wint_t fgetwc_unlocked (FILE *STREAM)
  4030. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4031. corrupt | *Note POSIX Safety Concepts::.
  4032. The ‘fgetwc_unlocked’ function is equivalent to the ‘fgetwc’
  4033. function except that it does not implicitly lock the stream.
  4034. This function is a GNU extension.
  4035. -- Function: int getc (FILE *STREAM)
  4036. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4037. | *Note POSIX Safety Concepts::.
  4038. This is just like ‘fgetc’, except that it may be implemented as a
  4039. macro and may evaluate the STREAM argument more than once.
  4040. Therefore, STREAM should never be an expression with side-effects.
  4041. -- Function: wint_t getwc (FILE *STREAM)
  4042. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4043. | *Note POSIX Safety Concepts::.
  4044. This is just like ‘fgetwc’, except that it may be implemented as a
  4045. macro and may evaluate the STREAM argument more than once.
  4046. Therefore, STREAM should never be an expression with side-effects.
  4047. -- Function: int getc_unlocked (FILE *STREAM)
  4048. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4049. corrupt | *Note POSIX Safety Concepts::.
  4050. The ‘getc_unlocked’ function is equivalent to the ‘getc’ function
  4051. except that it does not implicitly lock the stream. Like ‘getc’,
  4052. it may be implemented as a macro and may evaluate the STREAM
  4053. argument more than once. Therefore, STREAM should not be an
  4054. expression with side-effects.
  4055. -- Function: wint_t getwc_unlocked (FILE *STREAM)
  4056. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4057. corrupt | *Note POSIX Safety Concepts::.
  4058. The ‘getwc_unlocked’ function is equivalent to the ‘getwc’ function
  4059. except that it does not implicitly lock the stream.
  4060. This function is a GNU extension.
  4061. -- Function: int getchar (void)
  4062. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4063. | *Note POSIX Safety Concepts::.
  4064. The ‘getchar’ function is equivalent to ‘getc’ with ‘stdin’ as the
  4065. value of the STREAM argument.
  4066. -- Function: wint_t getwchar (void)
  4067. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4068. | *Note POSIX Safety Concepts::.
  4069. The ‘getwchar’ function is equivalent to ‘getwc’ with ‘stdin’ as
  4070. the value of the STREAM argument.
  4071. -- Function: int getchar_unlocked (void)
  4072. Preliminary: | MT-Unsafe race:stdin | AS-Unsafe corrupt | AC-Unsafe
  4073. corrupt | *Note POSIX Safety Concepts::.
  4074. The ‘getchar_unlocked’ function is equivalent to the ‘getchar’
  4075. function except that it does not implicitly lock the stream.
  4076. -- Function: wint_t getwchar_unlocked (void)
  4077. Preliminary: | MT-Unsafe race:stdin | AS-Unsafe corrupt | AC-Unsafe
  4078. corrupt | *Note POSIX Safety Concepts::.
  4079. The ‘getwchar_unlocked’ function is equivalent to the ‘getwchar’
  4080. function except that it does not implicitly lock the stream.
  4081. This function is a GNU extension.
  4082. Here is an example of a function that does input using ‘fgetc’. It
  4083. would work just as well using ‘getc’ instead, or using ‘getchar ()’
  4084. instead of ‘fgetc (stdin)’. The code would also work the same for the
  4085. wide character stream functions.
  4086. int
  4087. y_or_n_p (const char *question)
  4088. {
  4089. fputs (question, stdout);
  4090. while (1)
  4091. {
  4092. int c, answer;
  4093. /* Write a space to separate answer from question. */
  4094. fputc (' ', stdout);
  4095. /* Read the first character of the line.
  4096. This should be the answer character, but might not be. */
  4097. c = tolower (fgetc (stdin));
  4098. answer = c;
  4099. /* Discard rest of input line. */
  4100. while (c != '\n' && c != EOF)
  4101. c = fgetc (stdin);
  4102. /* Obey the answer if it was valid. */
  4103. if (answer == 'y')
  4104. return 1;
  4105. if (answer == 'n')
  4106. return 0;
  4107. /* Answer was invalid: ask for valid answer. */
  4108. fputs ("Please answer y or n:", stdout);
  4109. }
  4110. }
  4111. -- Function: int getw (FILE *STREAM)
  4112. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4113. | *Note POSIX Safety Concepts::.
  4114. This function reads a word (that is, an ‘int’) from STREAM. It's
  4115. provided for compatibility with SVID. We recommend you use ‘fread’
  4116. instead (*note Block Input/Output::). Unlike ‘getc’, any ‘int’
  4117. value could be a valid result. ‘getw’ returns ‘EOF’ when it
  4118. encounters end-of-file or an error, but there is no way to
  4119. distinguish this from an input word with value -1.
  4120. 
  4121. File: libc.info, Node: Line Input, Next: Unreading, Prev: Character Input, Up: I/O on Streams
  4122. 12.9 Line-Oriented Input
  4123. ========================
  4124. Since many programs interpret input on the basis of lines, it is
  4125. convenient to have functions to read a line of text from a stream.
  4126. Standard C has functions to do this, but they aren't very safe: null
  4127. characters and even (for ‘gets’) long lines can confuse them. So the
  4128. GNU C Library provides the ‘getline’ function that makes it easy to read
  4129. lines reliably.
  4130. The ‘getdelim’ function is a generalized version of ‘getline’. It
  4131. reads a delimited record, defined as everything through the next
  4132. occurrence of a specified delimiter character. These functions were
  4133. both GNU extensions until standardized by POSIX.1-2008.
  4134. All these functions are declared in ‘stdio.h’.
  4135. -- Function: ssize_t getline (char **restrict LINEPTR, size_t *restrict
  4136. N, FILE *restrict STREAM)
  4137. Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe lock
  4138. corrupt mem | *Note POSIX Safety Concepts::.
  4139. This function reads an entire line from STREAM, storing the text
  4140. (including the newline and a terminating null character) in a
  4141. buffer and storing the buffer address in ‘*LINEPTR’.
  4142. Before calling ‘getline’, you should place in ‘*LINEPTR’ the
  4143. address of a buffer ‘*N’ bytes long, allocated with ‘malloc’. If
  4144. this buffer is long enough to hold the line, ‘getline’ stores the
  4145. line in this buffer. Otherwise, ‘getline’ makes the buffer bigger
  4146. using ‘realloc’, storing the new buffer address back in ‘*LINEPTR’
  4147. and the increased size back in ‘*N’. *Note Unconstrained
  4148. Allocation::.
  4149. If you set ‘*LINEPTR’ to a null pointer, and ‘*N’ to zero, before
  4150. the call, then ‘getline’ allocates the initial buffer for you by
  4151. calling ‘malloc’. This buffer remains allocated even if ‘getline’
  4152. encounters errors and is unable to read any bytes.
  4153. In either case, when ‘getline’ returns, ‘*LINEPTR’ is a ‘char *’
  4154. which points to the text of the line.
  4155. When ‘getline’ is successful, it returns the number of characters
  4156. read (including the newline, but not including the terminating
  4157. null). This value enables you to distinguish null characters that
  4158. are part of the line from the null character inserted as a
  4159. terminator.
  4160. This function was originally a GNU extension, but was added in
  4161. POSIX.1-2008.
  4162. If an error occurs or end of file is reached without any bytes
  4163. read, ‘getline’ returns ‘-1’. POSIX leaves the contents of
  4164. ‘*LINEPTR’ undefined when ‘getline’ returns ‘-1’. If the GNU C
  4165. Library implementation of ‘getline’ allocates the initial buffer it
  4166. will null terminate it to prevent the caller from reading
  4167. uninitialized memory if no characters can be read from ‘stream’.
  4168. -- Function: ssize_t getdelim (char **restrict LINEPTR, size_t
  4169. *restrict N, int DELIMITER, FILE *restrict STREAM)
  4170. Preliminary: | MT-Safe | AS-Unsafe corrupt heap | AC-Unsafe lock
  4171. corrupt mem | *Note POSIX Safety Concepts::.
  4172. This function is like ‘getline’ except that the character which
  4173. tells it to stop reading is not necessarily newline. The argument
  4174. DELIMITER specifies the delimiter character; ‘getdelim’ keeps
  4175. reading until it sees that character (or end of file).
  4176. The text is stored in LINEPTR, including the delimiter character
  4177. and a terminating null. Like ‘getline’, ‘getdelim’ makes LINEPTR
  4178. bigger if it isn't big enough.
  4179. This function was originally a GNU extension, but was added in
  4180. POSIX.1-2008.
  4181. ‘getline’ is in fact implemented in terms of ‘getdelim’, just like
  4182. this:
  4183. ssize_t
  4184. getline (char **lineptr, size_t *n, FILE *stream)
  4185. {
  4186. return getdelim (lineptr, n, '\n', stream);
  4187. }
  4188. -- Function: char * fgets (char *S, int COUNT, FILE *STREAM)
  4189. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4190. | *Note POSIX Safety Concepts::.
  4191. The ‘fgets’ function reads characters from the stream STREAM up to
  4192. and including a newline character and stores them in the string S,
  4193. adding a null character to mark the end of the string. You must
  4194. supply COUNT characters worth of space in S, but the number of
  4195. characters read is at most COUNT − 1. The extra character space is
  4196. used to hold the null character at the end of the string.
  4197. If the system is already at end of file when you call ‘fgets’, then
  4198. the contents of the array S are unchanged and a null pointer is
  4199. returned. A null pointer is also returned if a read error occurs.
  4200. Otherwise, the return value is the pointer S.
  4201. *Warning:* If the input data has a null character, you can't tell.
  4202. So don't use ‘fgets’ unless you know the data cannot contain a
  4203. null. Don't use it to read files edited by the user because, if
  4204. the user inserts a null character, you should either handle it
  4205. properly or print a clear error message. We recommend using
  4206. ‘getline’ instead of ‘fgets’.
  4207. -- Function: wchar_t * fgetws (wchar_t *WS, int COUNT, FILE *STREAM)
  4208. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4209. | *Note POSIX Safety Concepts::.
  4210. The ‘fgetws’ function reads wide characters from the stream STREAM
  4211. up to and including a newline character and stores them in the
  4212. string WS, adding a null wide character to mark the end of the
  4213. string. You must supply COUNT wide characters worth of space in
  4214. WS, but the number of characters read is at most COUNT − 1. The
  4215. extra character space is used to hold the null wide character at
  4216. the end of the string.
  4217. If the system is already at end of file when you call ‘fgetws’,
  4218. then the contents of the array WS are unchanged and a null pointer
  4219. is returned. A null pointer is also returned if a read error
  4220. occurs. Otherwise, the return value is the pointer WS.
  4221. *Warning:* If the input data has a null wide character (which are
  4222. null bytes in the input stream), you can't tell. So don't use
  4223. ‘fgetws’ unless you know the data cannot contain a null. Don't use
  4224. it to read files edited by the user because, if the user inserts a
  4225. null character, you should either handle it properly or print a
  4226. clear error message.
  4227. -- Function: char * fgets_unlocked (char *S, int COUNT, FILE *STREAM)
  4228. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4229. corrupt | *Note POSIX Safety Concepts::.
  4230. The ‘fgets_unlocked’ function is equivalent to the ‘fgets’ function
  4231. except that it does not implicitly lock the stream.
  4232. This function is a GNU extension.
  4233. -- Function: wchar_t * fgetws_unlocked (wchar_t *WS, int COUNT, FILE
  4234. *STREAM)
  4235. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4236. corrupt | *Note POSIX Safety Concepts::.
  4237. The ‘fgetws_unlocked’ function is equivalent to the ‘fgetws’
  4238. function except that it does not implicitly lock the stream.
  4239. This function is a GNU extension.
  4240. -- Deprecated function: char * gets (char *S)
  4241. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4242. | *Note POSIX Safety Concepts::.
  4243. The function ‘gets’ reads characters from the stream ‘stdin’ up to
  4244. the next newline character, and stores them in the string S. The
  4245. newline character is discarded (note that this differs from the
  4246. behavior of ‘fgets’, which copies the newline character into the
  4247. string). If ‘gets’ encounters a read error or end-of-file, it
  4248. returns a null pointer; otherwise it returns S.
  4249. *Warning:* The ‘gets’ function is *very dangerous* because it
  4250. provides no protection against overflowing the string S. The GNU C
  4251. Library includes it for compatibility only. You should *always*
  4252. use ‘fgets’ or ‘getline’ instead. To remind you of this, the
  4253. linker (if using GNU ‘ld’) will issue a warning whenever you use
  4254. ‘gets’.
  4255. 
  4256. File: libc.info, Node: Unreading, Next: Block Input/Output, Prev: Line Input, Up: I/O on Streams
  4257. 12.10 Unreading
  4258. ===============
  4259. In parser programs it is often useful to examine the next character in
  4260. the input stream without removing it from the stream. This is called
  4261. "peeking ahead" at the input because your program gets a glimpse of the
  4262. input it will read next.
  4263. Using stream I/O, you can peek ahead at input by first reading it and
  4264. then “unreading” it (also called “pushing it back” on the stream).
  4265. Unreading a character makes it available to be input again from the
  4266. stream, by the next call to ‘fgetc’ or other input function on that
  4267. stream.
  4268. * Menu:
  4269. * Unreading Idea:: An explanation of unreading with pictures.
  4270. * How Unread:: How to call ‘ungetc’ to do unreading.
  4271. 
  4272. File: libc.info, Node: Unreading Idea, Next: How Unread, Up: Unreading
  4273. 12.10.1 What Unreading Means
  4274. ----------------------------
  4275. Here is a pictorial explanation of unreading. Suppose you have a stream
  4276. reading a file that contains just six characters, the letters ‘foobar’.
  4277. Suppose you have read three characters so far. The situation looks like
  4278. this:
  4279. f o o b a r
  4280. ^
  4281. so the next input character will be ‘b’.
  4282. If instead of reading ‘b’ you unread the letter ‘o’, you get a
  4283. situation like this:
  4284. f o o b a r
  4285. |
  4286. o--
  4287. ^
  4288. so that the next input characters will be ‘o’ and ‘b’.
  4289. If you unread ‘9’ instead of ‘o’, you get this situation:
  4290. f o o b a r
  4291. |
  4292. 9--
  4293. ^
  4294. so that the next input characters will be ‘9’ and ‘b’.
  4295. 
  4296. File: libc.info, Node: How Unread, Prev: Unreading Idea, Up: Unreading
  4297. 12.10.2 Using ‘ungetc’ To Do Unreading
  4298. --------------------------------------
  4299. The function to unread a character is called ‘ungetc’, because it
  4300. reverses the action of ‘getc’.
  4301. -- Function: int ungetc (int C, FILE *STREAM)
  4302. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4303. | *Note POSIX Safety Concepts::.
  4304. The ‘ungetc’ function pushes back the character C onto the input
  4305. stream STREAM. So the next input from STREAM will read C before
  4306. anything else.
  4307. If C is ‘EOF’, ‘ungetc’ does nothing and just returns ‘EOF’. This
  4308. lets you call ‘ungetc’ with the return value of ‘getc’ without
  4309. needing to check for an error from ‘getc’.
  4310. The character that you push back doesn't have to be the same as the
  4311. last character that was actually read from the stream. In fact, it
  4312. isn't necessary to actually read any characters from the stream
  4313. before unreading them with ‘ungetc’! But that is a strange way to
  4314. write a program; usually ‘ungetc’ is used only to unread a
  4315. character that was just read from the same stream. The GNU C
  4316. Library supports this even on files opened in binary mode, but
  4317. other systems might not.
  4318. The GNU C Library supports pushing back multiple characters;
  4319. subsequently reading from the stream retrieves the characters in
  4320. the reverse order that they were pushed.
  4321. Pushing back characters doesn't alter the file; only the internal
  4322. buffering for the stream is affected. If a file positioning
  4323. function (such as ‘fseek’, ‘fseeko’ or ‘rewind’; *note File
  4324. Positioning::) is called, any pending pushed-back characters are
  4325. discarded.
  4326. Unreading a character on a stream that is at end of file clears the
  4327. end-of-file indicator for the stream, because it makes the
  4328. character of input available. After you read that character,
  4329. trying to read again will encounter end of file.
  4330. -- Function: wint_t ungetwc (wint_t WC, FILE *STREAM)
  4331. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4332. | *Note POSIX Safety Concepts::.
  4333. The ‘ungetwc’ function behaves just like ‘ungetc’ just that it
  4334. pushes back a wide character.
  4335. Here is an example showing the use of ‘getc’ and ‘ungetc’ to skip
  4336. over whitespace characters. When this function reaches a non-whitespace
  4337. character, it unreads that character to be seen again on the next read
  4338. operation on the stream.
  4339. #include <stdio.h>
  4340. #include <ctype.h>
  4341. void
  4342. skip_whitespace (FILE *stream)
  4343. {
  4344. int c;
  4345. do
  4346. /* No need to check for ‘EOF’ because it is not
  4347. ‘isspace’, and ‘ungetc’ ignores ‘EOF’. */
  4348. c = getc (stream);
  4349. while (isspace (c));
  4350. ungetc (c, stream);
  4351. }
  4352. 
  4353. File: libc.info, Node: Block Input/Output, Next: Formatted Output, Prev: Unreading, Up: I/O on Streams
  4354. 12.11 Block Input/Output
  4355. ========================
  4356. This section describes how to do input and output operations on blocks
  4357. of data. You can use these functions to read and write binary data, as
  4358. well as to read and write text in fixed-size blocks instead of by
  4359. characters or lines.
  4360. Binary files are typically used to read and write blocks of data in
  4361. the same format as is used to represent the data in a running program.
  4362. In other words, arbitrary blocks of memory--not just character or string
  4363. objects--can be written to a binary file, and meaningfully read in again
  4364. by the same program.
  4365. Storing data in binary form is often considerably more efficient than
  4366. using the formatted I/O functions. Also, for floating-point numbers,
  4367. the binary form avoids possible loss of precision in the conversion
  4368. process. On the other hand, binary files can't be examined or modified
  4369. easily using many standard file utilities (such as text editors), and
  4370. are not portable between different implementations of the language, or
  4371. different kinds of computers.
  4372. These functions are declared in ‘stdio.h’.
  4373. -- Function: size_t fread (void *DATA, size_t SIZE, size_t COUNT, FILE
  4374. *STREAM)
  4375. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4376. | *Note POSIX Safety Concepts::.
  4377. This function reads up to COUNT objects of size SIZE into the array
  4378. DATA, from the stream STREAM. It returns the number of objects
  4379. actually read, which might be less than COUNT if a read error
  4380. occurs or the end of the file is reached. This function returns a
  4381. value of zero (and doesn't read anything) if either SIZE or COUNT
  4382. is zero.
  4383. If ‘fread’ encounters end of file in the middle of an object, it
  4384. returns the number of complete objects read, and discards the
  4385. partial object. Therefore, the stream remains at the actual end of
  4386. the file.
  4387. -- Function: size_t fread_unlocked (void *DATA, size_t SIZE, size_t
  4388. COUNT, FILE *STREAM)
  4389. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4390. corrupt | *Note POSIX Safety Concepts::.
  4391. The ‘fread_unlocked’ function is equivalent to the ‘fread’ function
  4392. except that it does not implicitly lock the stream.
  4393. This function is a GNU extension. This function may be implemented
  4394. as a macro and may evaluate STREAM more than once. Therefore,
  4395. STREAM should not be an expression with side-effects.
  4396. -- Function: size_t fwrite (const void *DATA, size_t SIZE, size_t
  4397. COUNT, FILE *STREAM)
  4398. Preliminary: | MT-Safe | AS-Unsafe corrupt | AC-Unsafe lock corrupt
  4399. | *Note POSIX Safety Concepts::.
  4400. This function writes up to COUNT objects of size SIZE from the
  4401. array DATA, to the stream STREAM. The return value is normally
  4402. COUNT, if the call succeeds. Any other value indicates some sort
  4403. of error, such as running out of space.
  4404. -- Function: size_t fwrite_unlocked (const void *DATA, size_t SIZE,
  4405. size_t COUNT, FILE *STREAM)
  4406. Preliminary: | MT-Safe race:stream | AS-Unsafe corrupt | AC-Unsafe
  4407. corrupt | *Note POSIX Safety Concepts::.
  4408. The ‘fwrite_unlocked’ function is equivalent to the ‘fwrite’
  4409. function except that it does not implicitly lock the stream.
  4410. This function is a GNU extension. This function may be implemented
  4411. as a macro and may evaluate STREAM more than once. Therefore,
  4412. STREAM should not be an expression with side-effects.
  4413. 
  4414. File: libc.info, Node: Formatted Output, Next: Customizing Printf, Prev: Block Input/Output, Up: I/O on Streams
  4415. 12.12 Formatted Output
  4416. ======================
  4417. The functions described in this section (‘printf’ and related functions)
  4418. provide a convenient way to perform formatted output. You call ‘printf’
  4419. with a “format string” or “template string” that specifies how to format
  4420. the values of the remaining arguments.
  4421. Unless your program is a filter that specifically performs line- or
  4422. character-oriented processing, using ‘printf’ or one of the other
  4423. related functions described in this section is usually the easiest and
  4424. most concise way to perform output. These functions are especially
  4425. useful for printing error messages, tables of data, and the like.
  4426. * Menu:
  4427. * Formatted Output Basics:: Some examples to get you started.
  4428. * Output Conversion Syntax:: General syntax of conversion
  4429. specifications.
  4430. * Table of Output Conversions:: Summary of output conversions and
  4431. what they do.
  4432. * Integer Conversions:: Details about formatting of integers.
  4433. * Floating-Point Conversions:: Details about formatting of
  4434. floating-point numbers.
  4435. * Other Output Conversions:: Details about formatting of strings,
  4436. characters, pointers, and the like.
  4437. * Formatted Output Functions:: Descriptions of the actual functions.
  4438. * Dynamic Output:: Functions that allocate memory for the output.
  4439. * Variable Arguments Output:: ‘vprintf’ and friends.
  4440. * Parsing a Template String:: What kinds of args does a given template
  4441. call for?
  4442. * Example of Parsing:: Sample program using ‘parse_printf_format’.
  4443. 
  4444. File: libc.info, Node: Formatted Output Basics, Next: Output Conversion Syntax, Up: Formatted Output
  4445. 12.12.1 Formatted Output Basics
  4446. -------------------------------
  4447. The ‘printf’ function can be used to print any number of arguments. The
  4448. template string argument you supply in a call provides information not
  4449. only about the number of additional arguments, but also about their
  4450. types and what style should be used for printing them.
  4451. Ordinary characters in the template string are simply written to the
  4452. output stream as-is, while “conversion specifications” introduced by a
  4453. ‘%’ character in the template cause subsequent arguments to be formatted
  4454. and written to the output stream. For example,
  4455. int pct = 37;
  4456. char filename[] = "foo.txt";
  4457. printf ("Processing of `%s' is %d%% finished.\nPlease be patient.\n",
  4458. filename, pct);
  4459. produces output like
  4460. Processing of `foo.txt' is 37% finished.
  4461. Please be patient.
  4462. This example shows the use of the ‘%d’ conversion to specify that an
  4463. ‘int’ argument should be printed in decimal notation, the ‘%s’
  4464. conversion to specify printing of a string argument, and the ‘%%’
  4465. conversion to print a literal ‘%’ character.
  4466. There are also conversions for printing an integer argument as an
  4467. unsigned value in binary, octal, decimal, or hexadecimal radix (‘%b’,
  4468. ‘%o’, ‘%u’, or ‘%x’, respectively); or as a character value (‘%c’).
  4469. Floating-point numbers can be printed in normal, fixed-point notation
  4470. using the ‘%f’ conversion or in exponential notation using the ‘%e’
  4471. conversion. The ‘%g’ conversion uses either ‘%e’ or ‘%f’ format,
  4472. depending on what is more appropriate for the magnitude of the
  4473. particular number.
  4474. You can control formatting more precisely by writing “modifiers”
  4475. between the ‘%’ and the character that indicates which conversion to
  4476. apply. These slightly alter the ordinary behavior of the conversion.
  4477. For example, most conversion specifications permit you to specify a
  4478. minimum field width and a flag indicating whether you want the result
  4479. left- or right-justified within the field.
  4480. The specific flags and modifiers that are permitted and their
  4481. interpretation vary depending on the particular conversion. They're all
  4482. described in more detail in the following sections. Don't worry if this
  4483. all seems excessively complicated at first; you can almost always get
  4484. reasonable free-format output without using any of the modifiers at all.
  4485. The modifiers are mostly used to make the output look "prettier" in
  4486. tables.
  4487. 
  4488. File: libc.info, Node: Output Conversion Syntax, Next: Table of Output Conversions, Prev: Formatted Output Basics, Up: Formatted Output
  4489. 12.12.2 Output Conversion Syntax
  4490. --------------------------------
  4491. This section provides details about the precise syntax of conversion
  4492. specifications that can appear in a ‘printf’ template string.
  4493. Characters in the template string that are not part of a conversion
  4494. specification are printed as-is to the output stream. Multibyte
  4495. character sequences (*note Character Set Handling::) are permitted in a
  4496. template string.
  4497. The conversion specifications in a ‘printf’ template string have the
  4498. general form:
  4499. % [ PARAM-NO $] FLAGS WIDTH [ . PRECISION ] TYPE CONVERSION
  4500. or
  4501. % [ PARAM-NO $] FLAGS WIDTH . * [ PARAM-NO $] TYPE CONVERSION
  4502. For example, in the conversion specifier ‘%-10.8ld’, the ‘-’ is a
  4503. flag, ‘10’ specifies the field width, the precision is ‘8’, the letter
  4504. ‘l’ is a type modifier, and ‘d’ specifies the conversion style. (This
  4505. particular type specifier says to print a ‘long int’ argument in decimal
  4506. notation, with a minimum of 8 digits left-justified in a field at least
  4507. 10 characters wide.)
  4508. In more detail, output conversion specifications consist of an
  4509. initial ‘%’ character followed in sequence by:
  4510. • An optional specification of the parameter used for this format.
  4511. Normally the parameters to the ‘printf’ function are assigned to
  4512. the formats in the order of appearance in the format string. But
  4513. in some situations (such as message translation) this is not
  4514. desirable and this extension allows an explicit parameter to be
  4515. specified.
  4516. The PARAM-NO parts of the format must be integers in the range of 1
  4517. to the maximum number of arguments present to the function call.
  4518. Some implementations limit this number to a certain upper bound.
  4519. The exact limit can be retrieved by the following constant.
  4520. -- Macro: NL_ARGMAX
  4521. The value of ‘NL_ARGMAX’ is the maximum value allowed for the
  4522. specification of a positional parameter in a ‘printf’ call.
  4523. The actual value in effect at runtime can be retrieved by
  4524. using ‘sysconf’ using the ‘_SC_NL_ARGMAX’ parameter *note
  4525. Sysconf Definition::.
  4526. Some systems have a quite low limit such as 9 for System V
  4527. systems. The GNU C Library has no real limit.
  4528. If any of the formats has a specification for the parameter
  4529. position all of them in the format string shall have one.
  4530. Otherwise the behavior is undefined.
  4531. • Zero or more “flag characters” that modify the normal behavior of
  4532. the conversion specification.
  4533. • An optional decimal integer specifying the “minimum field width”.
  4534. If the normal conversion produces fewer characters than this, the
  4535. field is padded with spaces to the specified width. This is a
  4536. _minimum_ value; if the normal conversion produces more characters
  4537. than this, the field is _not_ truncated. Normally, the output is
  4538. right-justified within the field.
  4539. You can also specify a field width of ‘*’. This means that the
  4540. next argument in the argument list (before the actual value to be
  4541. printed) is used as the field width. The value must be an ‘int’.
  4542. If the value is negative, this means to set the ‘-’ flag (see
  4543. below) and to use the absolute value as the field width.
  4544. • An optional “precision” to specify the number of digits to be
  4545. written for the numeric conversions. If the precision is
  4546. specified, it consists of a period (‘.’) followed optionally by a
  4547. decimal integer (which defaults to zero if omitted).
  4548. You can also specify a precision of ‘*’. This means that the next
  4549. argument in the argument list (before the actual value to be
  4550. printed) is used as the precision. The value must be an ‘int’, and
  4551. is ignored if it is negative. If you specify ‘*’ for both the
  4552. field width and precision, the field width argument precedes the
  4553. precision argument. Other C library versions may not recognize
  4554. this syntax.
  4555. • An optional “type modifier character”, which is used to specify the
  4556. data type of the corresponding argument if it differs from the
  4557. default type. (For example, the integer conversions assume a type
  4558. of ‘int’, but you can specify ‘h’, ‘l’, or ‘L’ for other integer
  4559. types.)
  4560. • A character that specifies the conversion to be applied.
  4561. The exact options that are permitted and how they are interpreted
  4562. vary between the different conversion specifiers. See the descriptions
  4563. of the individual conversions for information about the particular
  4564. options that they use.
  4565. With the ‘-Wformat’ option, the GNU C compiler checks calls to
  4566. ‘printf’ and related functions. It examines the format string and
  4567. verifies that the correct number and types of arguments are supplied.
  4568. There is also a GNU C syntax to tell the compiler that a function you
  4569. write uses a ‘printf’-style format string. *Note Declaring Attributes
  4570. of Functions: (gcc)Function Attributes, for more information.
  4571. 
  4572. File: libc.info, Node: Table of Output Conversions, Next: Integer Conversions, Prev: Output Conversion Syntax, Up: Formatted Output
  4573. 12.12.3 Table of Output Conversions
  4574. -----------------------------------
  4575. Here is a table summarizing what all the different conversions do:
  4576. ‘%d’, ‘%i’
  4577. Print an integer as a signed decimal number. *Note Integer
  4578. Conversions::, for details. ‘%d’ and ‘%i’ are synonymous for
  4579. output, but are different when used with ‘scanf’ for input (*note
  4580. Table of Input Conversions::).
  4581. ‘%b’, ‘%B’
  4582. Print an integer as an unsigned binary number. ‘%b’ uses
  4583. lower-case ‘b’ with the ‘#’ flag and ‘%B’ uses upper-case. ‘%b’ is
  4584. an ISO C23 feature; ‘%B’ is an optional ISO C23 feature. *Note
  4585. Integer Conversions::, for details.
  4586. ‘%o’
  4587. Print an integer as an unsigned octal number. *Note Integer
  4588. Conversions::, for details.
  4589. ‘%u’
  4590. Print an integer as an unsigned decimal number. *Note Integer
  4591. Conversions::, for details.
  4592. ‘%x’, ‘%X’
  4593. Print an integer as an unsigned hexadecimal number. ‘%x’ uses
  4594. lower-case letters and ‘%X’ uses upper-case. *Note Integer
  4595. Conversions::, for details.
  4596. ‘%f’, ‘%F’
  4597. Print a floating-point number in normal (fixed-point) notation.
  4598. ‘%f’ uses lower-case letters and ‘%F’ uses upper-case. *Note
  4599. Floating-Point Conversions::, for details.
  4600. ‘%e’, ‘%E’
  4601. Print a floating-point number in exponential notation. ‘%e’ uses
  4602. lower-case letters and ‘%E’ uses upper-case. *Note Floating-Point
  4603. Conversions::, for details.
  4604. ‘%g’, ‘%G’
  4605. Print a floating-point number in either normal or exponential
  4606. notation, whichever is more appropriate for its magnitude. ‘%g’
  4607. uses lower-case letters and ‘%G’ uses upper-case. *Note
  4608. Floating-Point Conversions::, for details.
  4609. ‘%a’, ‘%A’
  4610. Print a floating-point number in a hexadecimal fractional notation
  4611. with the exponent to base 2 represented in decimal digits. ‘%a’
  4612. uses lower-case letters and ‘%A’ uses upper-case. *Note
  4613. Floating-Point Conversions::, for details.
  4614. ‘%c’
  4615. Print a single character. *Note Other Output Conversions::.
  4616. ‘%C’
  4617. This is an alias for ‘%lc’ which is supported for compatibility
  4618. with the Unix standard.
  4619. ‘%s’
  4620. Print a string. *Note Other Output Conversions::.
  4621. ‘%S’
  4622. This is an alias for ‘%ls’ which is supported for compatibility
  4623. with the Unix standard.
  4624. ‘%p’
  4625. Print the value of a pointer. *Note Other Output Conversions::.
  4626. ‘%n’
  4627. Get the number of characters printed so far. *Note Other Output
  4628. Conversions::. Note that this conversion specification never
  4629. produces any output.
  4630. ‘%m’
  4631. Print the string corresponding to the value of ‘errno’. (This is a
  4632. GNU extension.) *Note Other Output Conversions::.
  4633. ‘%%’
  4634. Print a literal ‘%’ character. *Note Other Output Conversions::.
  4635. If the syntax of a conversion specification is invalid, unpredictable
  4636. things will happen, so don't do this. If there aren't enough function
  4637. arguments provided to supply values for all the conversion
  4638. specifications in the template string, or if the arguments are not of
  4639. the correct types, the results are unpredictable. If you supply more
  4640. arguments than conversion specifications, the extra argument values are
  4641. simply ignored; this is sometimes useful.
  4642. 
  4643. File: libc.info, Node: Integer Conversions, Next: Floating-Point Conversions, Prev: Table of Output Conversions, Up: Formatted Output
  4644. 12.12.4 Integer Conversions
  4645. ---------------------------
  4646. This section describes the options for the ‘%d’, ‘%i’, ‘%b’, ‘%B’, ‘%o’,
  4647. ‘%u’, ‘%x’, and ‘%X’ conversion specifications. These conversions print
  4648. integers in various formats.
  4649. The ‘%d’ and ‘%i’ conversion specifications both print an ‘int’
  4650. argument as a signed decimal number; while ‘%b’, ‘%o’, ‘%u’, and ‘%x’
  4651. print the argument as an unsigned binary, octal, decimal, or hexadecimal
  4652. number (respectively). The ‘%X’ conversion specification is just like
  4653. ‘%x’ except that it uses the characters ‘ABCDEF’ as digits instead of
  4654. ‘abcdef’. The ‘%B’ conversion specification is just like ‘%b’ except
  4655. that, with the ‘#’ flag, the output starts with ‘0B’ instead of ‘0b’.
  4656. The following flags are meaningful:
  4657. ‘-’
  4658. Left-justify the result in the field (instead of the normal
  4659. right-justification).
  4660. ‘+’
  4661. For the signed ‘%d’ and ‘%i’ conversions, print a plus sign if the
  4662. value is positive.
  4663. ‘ ’
  4664. For the signed ‘%d’ and ‘%i’ conversions, if the result doesn't
  4665. start with a plus or minus sign, prefix it with a space character
  4666. instead. Since the ‘+’ flag ensures that the result includes a
  4667. sign, this flag is ignored if you supply both of them.
  4668. ‘#’
  4669. For the ‘%o’ conversion, this forces the leading digit to be ‘0’,
  4670. as if by increasing the precision. For ‘%x’ or ‘%X’, this prefixes
  4671. a leading ‘0x’ or ‘0X’ (respectively) to the result. For ‘%b’ or
  4672. ‘%B’, this prefixes a leading ‘0b’ or ‘0B’ (respectively) to the
  4673. result. This doesn't do anything useful for the ‘%d’, ‘%i’, or
  4674. ‘%u’ conversions. Using this flag produces output which can be
  4675. parsed by the ‘strtoul’ function (*note Parsing of Integers::) and
  4676. ‘scanf’ with the ‘%i’ conversion (*note Numeric Input
  4677. Conversions::).
  4678. For the ‘%m’ conversion, print an error constant or decimal error
  4679. number, instead of a (possibly translated) error message.
  4680. ‘'’
  4681. Separate the digits into groups as specified by the locale
  4682. specified for the ‘LC_NUMERIC’ category; *note General Numeric::.
  4683. This flag is a GNU extension.
  4684. ‘0’
  4685. Pad the field with zeros instead of spaces. The zeros are placed
  4686. after any indication of sign or base. This flag is ignored if the
  4687. ‘-’ flag is also specified, or if a precision is specified.
  4688. If a precision is supplied, it specifies the minimum number of digits
  4689. to appear; leading zeros are produced if necessary. If you don't
  4690. specify a precision, the number is printed with as many digits as it
  4691. needs. If you convert a value of zero with an explicit precision of
  4692. zero, then no characters at all are produced.
  4693. Without a type modifier, the corresponding argument is treated as an
  4694. ‘int’ (for the signed conversions ‘%i’ and ‘%d’) or ‘unsigned int’ (for
  4695. the unsigned conversions ‘%b’, ‘%B’, ‘%o’, ‘%u’, ‘%x’, and ‘%X’).
  4696. Recall that since ‘printf’ and friends are variadic, any ‘char’ and
  4697. ‘short’ arguments are automatically converted to ‘int’ by the default
  4698. argument promotions. For arguments of other integer types, you can use
  4699. these modifiers:
  4700. ‘hh’
  4701. Specifies that the argument is a ‘signed char’ or ‘unsigned char’,
  4702. as appropriate. A ‘char’ argument is converted to an ‘int’ or
  4703. ‘unsigned int’ by the default argument promotions anyway, but the
  4704. ‘hh’ modifier says to convert it back to a ‘char’ again.
  4705. This modifier was introduced in ISO C99.
  4706. ‘h’
  4707. Specifies that the argument is a ‘short int’ or ‘unsigned short
  4708. int’, as appropriate. A ‘short’ argument is converted to an ‘int’
  4709. or ‘unsigned int’ by the default argument promotions anyway, but
  4710. the ‘h’ modifier says to convert it back to a ‘short’ again.
  4711. ‘j’
  4712. Specifies that the argument is a ‘intmax_t’ or ‘uintmax_t’, as
  4713. appropriate.
  4714. This modifier was introduced in ISO C99.
  4715. ‘l’
  4716. Specifies that the argument is a ‘long int’ or ‘unsigned long int’,
  4717. as appropriate. Two ‘l’ characters are like the ‘L’ modifier,
  4718. below.
  4719. If used with ‘%c’ or ‘%s’ the corresponding parameter is considered
  4720. as a wide character or wide character string respectively. This
  4721. use of ‘l’ was introduced in Amendment 1 to ISO C90.
  4722. ‘L’
  4723. ‘ll’
  4724. ‘q’
  4725. Specifies that the argument is a ‘long long int’. (This type is an
  4726. extension supported by the GNU C compiler. On systems that don't
  4727. support extra-long integers, this is the same as ‘long int’.)
  4728. The ‘q’ modifier is another name for the same thing, which comes
  4729. from 4.4 BSD; a ‘long long int’ is sometimes called a "quad" ‘int’.
  4730. ‘t’
  4731. Specifies that the argument is a ‘ptrdiff_t’.
  4732. This modifier was introduced in ISO C99.
  4733. ‘wN’
  4734. Specifies that the argument is a ‘intN_t’ or ‘int_leastN_t’ (which
  4735. are the same type), for conversions taking signed integers, or
  4736. ‘uintN_t’ or ‘uint_leastN_t’ (which are the same type), for
  4737. conversions taking unsigned integers. If the type is narrower than
  4738. ‘int’, the promoted argument is converted back to the specified
  4739. type.
  4740. This modifier was introduced in ISO C23.
  4741. ‘wfN’
  4742. Specifies that the argument is a ‘int_fastN_t’ or ‘uint_fastN_t’,
  4743. as appropriate. If the type is narrower than ‘int’, the promoted
  4744. argument is converted back to the specified type.
  4745. This modifier was introduced in ISO C23.
  4746. ‘z’
  4747. ‘Z’
  4748. Specifies that the argument is a ‘size_t’.
  4749. ‘z’ was introduced in ISO C99. ‘Z’ is a GNU extension predating
  4750. this addition and should not be used in new code.
  4751. Here is an example. Using the template string:
  4752. "|%5d|%-5d|%+5d|%+-5d|% 5d|%05d|%5.0d|%5.2d|%d|\n"
  4753. to print numbers using the different options for the ‘%d’ conversion
  4754. gives results like:
  4755. | 0|0 | +0|+0 | 0|00000| | 00|0|
  4756. | 1|1 | +1|+1 | 1|00001| 1| 01|1|
  4757. | -1|-1 | -1|-1 | -1|-0001| -1| -01|-1|
  4758. |100000|100000|+100000|+100000| 100000|100000|100000|100000|100000|
  4759. In particular, notice what happens in the last case where the number
  4760. is too large to fit in the minimum field width specified.
  4761. Here are some more examples showing how unsigned integers print under
  4762. various format options, using the template string:
  4763. "|%5u|%5o|%5x|%5X|%#5o|%#5x|%#5X|%#10.8x|\n"
  4764. | 0| 0| 0| 0| 0| 0| 0| 00000000|
  4765. | 1| 1| 1| 1| 01| 0x1| 0X1|0x00000001|
  4766. |100000|303240|186a0|186A0|0303240|0x186a0|0X186A0|0x000186a0|
  4767. 
  4768. File: libc.info, Node: Floating-Point Conversions, Next: Other Output Conversions, Prev: Integer Conversions, Up: Formatted Output
  4769. 12.12.5 Floating-Point Conversions
  4770. ----------------------------------
  4771. This section discusses the conversion specifications for floating-point
  4772. numbers: the ‘%f’, ‘%F’, ‘%e’, ‘%E’, ‘%g’, and ‘%G’ conversions.
  4773. The ‘%f’ and ‘%F’ conversions print their argument in fixed-point
  4774. notation, producing output of the form [‘-’]DDD‘.’DDD, where the number
  4775. of digits following the decimal point is controlled by the precision you
  4776. specify.
  4777. The ‘%e’ conversion prints its argument in exponential notation,
  4778. producing output of the form [‘-’]D‘.’DDD‘e’[‘+’|‘-’]DD. Again, the
  4779. number of digits following the decimal point is controlled by the
  4780. precision. The exponent always contains at least two digits. The ‘%E’
  4781. conversion is similar but the exponent is marked with the letter ‘E’
  4782. instead of ‘e’.
  4783. The ‘%g’ and ‘%G’ conversions print the argument in the style of ‘%e’
  4784. or ‘%E’ (respectively) if the exponent would be less than -4 or greater
  4785. than or equal to the precision; otherwise they use the ‘%f’ or ‘%F’
  4786. style. A precision of ‘0’, is taken as 1. Trailing zeros are removed
  4787. from the fractional portion of the result and a decimal-point character
  4788. appears only if it is followed by a digit.
  4789. The ‘%a’ and ‘%A’ conversions are meant for representing
  4790. floating-point numbers exactly in textual form so that they can be
  4791. exchanged as texts between different programs and/or machines. The
  4792. numbers are represented in the form [‘-’]‘0x’H‘.’HHH‘p’[‘+’|‘-’]DD. At
  4793. the left of the decimal-point character exactly one digit is print.
  4794. This character is only ‘0’ if the number is denormalized. Otherwise the
  4795. value is unspecified; it is implementation dependent how many bits are
  4796. used. The number of hexadecimal digits on the right side of the
  4797. decimal-point character is equal to the precision. If the precision is
  4798. zero it is determined to be large enough to provide an exact
  4799. representation of the number (or it is large enough to distinguish two
  4800. adjacent values if the ‘FLT_RADIX’ is not a power of 2, *note Floating
  4801. Point Parameters::). For the ‘%a’ conversion lower-case characters are
  4802. used to represent the hexadecimal number and the prefix and exponent
  4803. sign are printed as ‘0x’ and ‘p’ respectively. Otherwise upper-case
  4804. characters are used and ‘0X’ and ‘P’ are used for the representation of
  4805. prefix and exponent string. The exponent to the base of two is printed
  4806. as a decimal number using at least one digit but at most as many digits
  4807. as necessary to represent the value exactly.
  4808. If the value to be printed represents infinity or a NaN, the output
  4809. is [‘-’]‘inf’ or ‘nan’ respectively if the conversion specifier is ‘%a’,
  4810. ‘%e’, ‘%f’, or ‘%g’ and it is [‘-’]‘INF’ or ‘NAN’ respectively if the
  4811. conversion is ‘%A’, ‘%E’, ‘%F’ or ‘%G’. On some implementations, a NaN
  4812. may result in longer output with information about the payload of the
  4813. NaN; ISO C23 defines a macro ‘_PRINTF_NAN_LEN_MAX’ giving the maximum
  4814. length of such output.
  4815. The following flags can be used to modify the behavior:
  4816. ‘-’
  4817. Left-justify the result in the field. Normally the result is
  4818. right-justified.
  4819. ‘+’
  4820. Always include a plus or minus sign in the result.
  4821. ‘ ’
  4822. If the result doesn't start with a plus or minus sign, prefix it
  4823. with a space instead. Since the ‘+’ flag ensures that the result
  4824. includes a sign, this flag is ignored if you supply both of them.
  4825. ‘#’
  4826. Specifies that the result should always include a decimal point,
  4827. even if no digits follow it. For the ‘%g’ and ‘%G’ conversions,
  4828. this also forces trailing zeros after the decimal point to be left
  4829. in place where they would otherwise be removed.
  4830. ‘'’
  4831. Separate the digits of the integer part of the result into groups
  4832. as specified by the locale specified for the ‘LC_NUMERIC’ category;
  4833. *note General Numeric::. This flag is a GNU extension.
  4834. ‘0’
  4835. Pad the field with zeros instead of spaces; the zeros are placed
  4836. after any sign. This flag is ignored if the ‘-’ flag is also
  4837. specified.
  4838. The precision specifies how many digits follow the decimal-point
  4839. character for the ‘%f’, ‘%F’, ‘%e’, and ‘%E’ conversions. For these
  4840. conversions, the default precision is ‘6’. If the precision is
  4841. explicitly ‘0’, this suppresses the decimal point character entirely.
  4842. For the ‘%g’ and ‘%G’ conversions, the precision specifies how many
  4843. significant digits to print. Significant digits are the first digit
  4844. before the decimal point, and all the digits after it. If the precision
  4845. is ‘0’ or not specified for ‘%g’ or ‘%G’, it is treated like a value of
  4846. ‘1’. If the value being printed cannot be expressed accurately in the
  4847. specified number of digits, the value is rounded to the nearest number
  4848. that fits.
  4849. Without a type modifier, the floating-point conversions use an
  4850. argument of type ‘double’. (By the default argument promotions, any
  4851. ‘float’ arguments are automatically converted to ‘double’.) The
  4852. following type modifier is supported:
  4853. ‘L’
  4854. An uppercase ‘L’ specifies that the argument is a ‘long double’.
  4855. Here are some examples showing how numbers print using the various
  4856. floating-point conversions. All of the numbers were printed using this
  4857. template string:
  4858. "|%13.4a|%13.4f|%13.4e|%13.4g|\n"
  4859. Here is the output:
  4860. | 0x0.0000p+0| 0.0000| 0.0000e+00| 0|
  4861. | 0x1.0000p-1| 0.5000| 5.0000e-01| 0.5|
  4862. | 0x1.0000p+0| 1.0000| 1.0000e+00| 1|
  4863. | -0x1.0000p+0| -1.0000| -1.0000e+00| -1|
  4864. | 0x1.9000p+6| 100.0000| 1.0000e+02| 100|
  4865. | 0x1.f400p+9| 1000.0000| 1.0000e+03| 1000|
  4866. | 0x1.3880p+13| 10000.0000| 1.0000e+04| 1e+04|
  4867. | 0x1.81c8p+13| 12345.0000| 1.2345e+04| 1.234e+04|
  4868. | 0x1.86a0p+16| 100000.0000| 1.0000e+05| 1e+05|
  4869. | 0x1.e240p+16| 123456.0000| 1.2346e+05| 1.235e+05|
  4870. Notice how the ‘%g’ conversion drops trailing zeros.
  4871. 
  4872. File: libc.info, Node: Other Output Conversions, Next: Formatted Output Functions, Prev: Floating-Point Conversions, Up: Formatted Output
  4873. 12.12.6 Other Output Conversions
  4874. --------------------------------
  4875. This section describes miscellaneous conversions for ‘printf’.
  4876. The ‘%c’ conversion prints a single character. In case there is no
  4877. ‘l’ modifier the ‘int’ argument is first converted to an ‘unsigned
  4878. char’. Then, if used in a wide stream function, the character is
  4879. converted into the corresponding wide character. The ‘-’ flag can be
  4880. used to specify left-justification in the field, but no other flags are
  4881. defined, and no precision or type modifier can be given. For example:
  4882. printf ("%c%c%c%c%c", 'h', 'e', 'l', 'l', 'o');
  4883. prints ‘hello’.
  4884. If there is an ‘l’ modifier present the argument is expected to be of
  4885. type ‘wint_t’. If used in a multibyte function the wide character is
  4886. converted into a multibyte character before being added to the output.
  4887. In this case more than one output byte can be produced.
  4888. The ‘%s’ conversion prints a string. If no ‘l’ modifier is present
  4889. the corresponding argument must be of type ‘char *’ (or ‘const char *’).
  4890. If used in a wide stream function the string is first converted to a
  4891. wide character string. A precision can be specified to indicate the
  4892. maximum number of characters to write; otherwise characters in the
  4893. string up to but not including the terminating null character are
  4894. written to the output stream. The ‘-’ flag can be used to specify
  4895. left-justification in the field, but no other flags or type modifiers
  4896. are defined for this conversion. For example:
  4897. printf ("%3s%-6s", "no", "where");
  4898. prints ‘ nowhere ’.
  4899. If there is an ‘l’ modifier present, the argument is expected to be
  4900. of type ‘wchar_t’ (or ‘const wchar_t *’).
  4901. If you accidentally pass a null pointer as the argument for a ‘%s’
  4902. conversion, the GNU C Library prints it as ‘(null)’. We think this is
  4903. more useful than crashing. But it's not good practice to pass a null
  4904. argument intentionally.
  4905. The ‘%m’ conversion prints the string corresponding to the error code
  4906. in ‘errno’. *Note Error Messages::. Thus:
  4907. fprintf (stderr, "can't open `%s': %m\n", filename);
  4908. is equivalent to:
  4909. fprintf (stderr, "can't open `%s': %s\n", filename, strerror (errno));
  4910. The ‘%m’ conversion can be used with the ‘#’ flag to print an error
  4911. constant, as provided by ‘strerrorname_np’. Both ‘%m’ and ‘%#m’ are GNU
  4912. C Library extensions.
  4913. The ‘%p’ conversion prints a pointer value. The corresponding
  4914. argument must be of type ‘void *’. In practice, you can use any type of
  4915. pointer.
  4916. In the GNU C Library, non-null pointers are printed as unsigned
  4917. integers, as if a ‘%#x’ conversion were used. Null pointers print as
  4918. ‘(nil)’. (Pointers might print differently in other systems.)
  4919. For example:
  4920. printf ("%p", "testing");
  4921. prints ‘0x’ followed by a hexadecimal number--the address of the string
  4922. constant ‘"testing"’. It does not print the word ‘testing’.
  4923. You can supply the ‘-’ flag with the ‘%p’ conversion to specify
  4924. left-justification, but no other flags, precision, or type modifiers are
  4925. defined.
  4926. The ‘%n’ conversion is unlike any of the other output conversions.
  4927. It uses an argument which must be a pointer to an ‘int’, but instead of
  4928. printing anything it stores the number of characters printed so far by
  4929. this call at that location. The ‘h’ and ‘l’ type modifiers are
  4930. permitted to specify that the argument is of type ‘short int *’ or ‘long
  4931. int *’ instead of ‘int *’, but no flags, field width, or precision are
  4932. permitted.
  4933. For example,
  4934. int nchar;
  4935. printf ("%d %s%n\n", 3, "bears", &nchar);
  4936. prints:
  4937. 3 bears
  4938. and sets ‘nchar’ to ‘7’, because ‘3 bears’ is seven characters.
  4939. The ‘%%’ conversion prints a literal ‘%’ character. This conversion
  4940. doesn't use an argument, and no flags, field width, precision, or type
  4941. modifiers are permitted.
  4942. 
  4943. File: libc.info, Node: Formatted Output Functions, Next: Dynamic Output, Prev: Other Output Conversions, Up: Formatted Output
  4944. 12.12.7 Formatted Output Functions
  4945. ----------------------------------
  4946. This section describes how to call ‘printf’ and related functions.
  4947. Prototypes for these functions are in the header file ‘stdio.h’.
  4948. Because these functions take a variable number of arguments, you _must_
  4949. declare prototypes for them before using them. Of course, the easiest
  4950. way to make sure you have all the right prototypes is to just include
  4951. ‘stdio.h’.
  4952. The ‘printf’ family shares the error codes listed below. Individual
  4953. functions may report additional ‘errno’ values if they fail.
  4954. ‘EOVERFLOW’
  4955. The number of written bytes would have exceeded ‘INT_MAX’, and thus
  4956. could not be represented in the return type ‘int’.
  4957. ‘ENOMEM’
  4958. The function could not allocate memory during processing. Long
  4959. argument lists and certain floating point conversions may require
  4960. memory allocation, as does initialization of an output stream upon
  4961. first use.
  4962. ‘EILSEQ’
  4963. POSIX specifies this error code should be used if a wide character
  4964. is encountered that does not have a matching valid character. The
  4965. GNU C Library always performs transliteration, using a replacement
  4966. character if necessary, so this error condition cannot occur on
  4967. output. However, the GNU C Library uses ‘EILSEQ’ to indicate that
  4968. an input character sequence (wide or multi-byte) could not be
  4969. converted successfully.
  4970. -- Function: int printf (const char *TEMPLATE, ...)
  4971. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  4972. mem lock corrupt | *Note POSIX Safety Concepts::.
  4973. The ‘printf’ function prints the optional arguments under the
  4974. control of the template string TEMPLATE to the stream ‘stdout’. It
  4975. returns the number of characters printed, or a negative value if
  4976. there was an output error.
  4977. -- Function: int wprintf (const wchar_t *TEMPLATE, ...)
  4978. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  4979. mem lock corrupt | *Note POSIX Safety Concepts::.
  4980. The ‘wprintf’ function prints the optional arguments under the
  4981. control of the wide template string TEMPLATE to the stream
  4982. ‘stdout’. It returns the number of wide characters printed, or a
  4983. negative value if there was an output error.
  4984. -- Function: int fprintf (FILE *STREAM, const char *TEMPLATE, ...)
  4985. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  4986. mem lock corrupt | *Note POSIX Safety Concepts::.
  4987. This function is just like ‘printf’, except that the output is
  4988. written to the stream STREAM instead of ‘stdout’.
  4989. -- Function: int fwprintf (FILE *STREAM, const wchar_t *TEMPLATE, ...)
  4990. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  4991. mem lock corrupt | *Note POSIX Safety Concepts::.
  4992. This function is just like ‘wprintf’, except that the output is
  4993. written to the stream STREAM instead of ‘stdout’.
  4994. -- Function: int sprintf (char *S, const char *TEMPLATE, ...)
  4995. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  4996. *Note POSIX Safety Concepts::.
  4997. This is like ‘printf’, except that the output is stored in the
  4998. character array S instead of written to a stream. A null character
  4999. is written to mark the end of the string.
  5000. The ‘sprintf’ function returns the number of characters stored in
  5001. the array S, not including the terminating null character.
  5002. The behavior of this function is undefined if copying takes place
  5003. between objects that overlap--for example, if S is also given as an
  5004. argument to be printed under control of the ‘%s’ conversion. *Note
  5005. Copying Strings and Arrays::.
  5006. *Warning:* The ‘sprintf’ function can be *dangerous* because it can
  5007. potentially output more characters than can fit in the allocation
  5008. size of the string S. Remember that the field width given in a
  5009. conversion specification is only a _minimum_ value.
  5010. To avoid this problem, you can use ‘snprintf’ or ‘asprintf’,
  5011. described below.
  5012. -- Function: int swprintf (wchar_t *WS, size_t SIZE, const wchar_t
  5013. *TEMPLATE, ...)
  5014. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5015. *Note POSIX Safety Concepts::.
  5016. This is like ‘wprintf’, except that the output is stored in the
  5017. wide character array WS instead of written to a stream. A null
  5018. wide character is written to mark the end of the string. The SIZE
  5019. argument specifies the maximum number of characters to produce.
  5020. The trailing null character is counted towards this limit, so you
  5021. should allocate at least SIZE wide characters for the string WS.
  5022. The return value is the number of characters generated for the
  5023. given input, excluding the trailing null. If not all output fits
  5024. into the provided buffer a negative value is returned, and ‘errno’
  5025. is set to ‘E2BIG’. (The setting of ‘errno’ is a GNU extension.)
  5026. You should try again with a bigger output string. _Note:_ this is
  5027. different from how ‘snprintf’ handles this situation.
  5028. Note that the corresponding narrow stream function takes fewer
  5029. parameters. ‘swprintf’ in fact corresponds to the ‘snprintf’
  5030. function. Since the ‘sprintf’ function can be dangerous and should
  5031. be avoided the ISO C committee refused to make the same mistake
  5032. again and decided to not define a function exactly corresponding to
  5033. ‘sprintf’.
  5034. -- Function: int snprintf (char *S, size_t SIZE, const char *TEMPLATE,
  5035. ...)
  5036. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5037. *Note POSIX Safety Concepts::.
  5038. The ‘snprintf’ function is similar to ‘sprintf’, except that the
  5039. SIZE argument specifies the maximum number of characters to
  5040. produce. The trailing null character is counted towards this
  5041. limit, so you should allocate at least SIZE characters for the
  5042. string S. If SIZE is zero, nothing, not even the null byte, shall
  5043. be written and S may be a null pointer.
  5044. The return value is the number of characters which would be
  5045. generated for the given input, excluding the trailing null. If
  5046. this value is greater than or equal to SIZE, not all characters
  5047. from the result have been stored in S. If this happens, you should
  5048. be wary of using the truncated result as that could lead to
  5049. security, encoding, or other bugs in your program (*note Truncating
  5050. Strings::). Instead, you should try again with a bigger output
  5051. string. Here is an example of doing this:
  5052. /* Construct a message describing the value of a variable
  5053. whose name is NAME and whose value is VALUE. */
  5054. char *
  5055. make_message (char *name, char *value)
  5056. {
  5057. /* Guess we need no more than 100 bytes of space. */
  5058. size_t size = 100;
  5059. char *buffer = xmalloc (size);
  5060. /* Try to print in the allocated space. */
  5061. int buflen = snprintf (buffer, size, "value of %s is %s",
  5062. name, value);
  5063. if (! (0 <= buflen && buflen < SIZE_MAX))
  5064. fatal ("integer overflow");
  5065. if (buflen >= size)
  5066. {
  5067. /* Reallocate buffer now that we know
  5068. how much space is needed. */
  5069. size = buflen;
  5070. size++;
  5071. buffer = xrealloc (buffer, size);
  5072. /* Try again. */
  5073. snprintf (buffer, size, "value of %s is %s",
  5074. name, value);
  5075. }
  5076. /* The last call worked, return the string. */
  5077. return buffer;
  5078. }
  5079. In practice, it is often easier just to use ‘asprintf’, below.
  5080. *Attention:* In versions of the GNU C Library prior to 2.1 the
  5081. return value is the number of characters stored, not including the
  5082. terminating null; unless there was not enough space in S to store
  5083. the result in which case ‘-1’ is returned. This was changed in
  5084. order to comply with the ISO C99 standard.
  5085. -- Function: int dprintf (int FD, TEMPLATE, ...)
  5086. | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem | *Note POSIX
  5087. Safety Concepts::.
  5088. This function formats its arguments according to TEMPLATE and
  5089. writes the result to the file descriptor FD, using the ‘write’
  5090. function. It returns the number of bytes written, or a negative
  5091. value if there was an error. In the error case, ‘errno’ is set
  5092. appropriately. The possible ‘errno’ values depend on the type of
  5093. the file descriptor FD, in addition to the general ‘printf’ error
  5094. codes.
  5095. The number of calls to ‘write’ is unspecified, and some ‘write’
  5096. calls may have happened even if ‘dprintf’ returns with an error.
  5097. *Portability Note:* POSIX does not require that this function is
  5098. async-signal-safe, and the GNU C Library implementation is not.
  5099. However, some other systems offer this function as an
  5100. async-signal-safe alternative to ‘fprintf’. *Note POSIX Safety
  5101. Concepts::.
  5102. 
  5103. File: libc.info, Node: Dynamic Output, Next: Variable Arguments Output, Prev: Formatted Output Functions, Up: Formatted Output
  5104. 12.12.8 Dynamically Allocating Formatted Output
  5105. -----------------------------------------------
  5106. The functions in this section do formatted output and place the results
  5107. in dynamically allocated memory.
  5108. -- Function: int asprintf (char **PTR, const char *TEMPLATE, ...)
  5109. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5110. *Note POSIX Safety Concepts::.
  5111. This function is similar to ‘sprintf’, except that it dynamically
  5112. allocates a string (as with ‘malloc’; *note Unconstrained
  5113. Allocation::) to hold the output, instead of putting the output in
  5114. a buffer you allocate in advance. The PTR argument should be the
  5115. address of a ‘char *’ object, and a successful call to ‘asprintf’
  5116. stores a pointer to the newly allocated string at that location.
  5117. Current and future versions of the GNU C Library write a null
  5118. pointer to ‘*PTR’ upon failure. To achieve similar behavior with
  5119. previous versions, initialize ‘*PTR’ to a null pointer before
  5120. calling ‘asprintf’. (Specifications for ‘asprintf’ only require a
  5121. valid pointer value in ‘*PTR’ if ‘asprintf’ succeeds, but no
  5122. implementations are known which overwrite a null pointer with a
  5123. pointer that cannot be freed on failure.)
  5124. The return value is the number of characters allocated for the
  5125. buffer, or less than zero if an error occurred. Usually this means
  5126. that the buffer could not be allocated.
  5127. Here is how to use ‘asprintf’ to get the same result as the
  5128. ‘snprintf’ example, but more easily:
  5129. /* Construct a message describing the value of a variable
  5130. whose name is NAME and whose value is VALUE. */
  5131. char *
  5132. make_message (char *name, char *value)
  5133. {
  5134. char *result;
  5135. if (asprintf (&result, "value of %s is %s", name, value) < 0)
  5136. return NULL;
  5137. return result;
  5138. }
  5139. -- Function: int obstack_printf (struct obstack *OBSTACK, const char
  5140. *TEMPLATE, ...)
  5141. Preliminary: | MT-Safe race:obstack locale | AS-Unsafe corrupt heap
  5142. | AC-Unsafe corrupt mem | *Note POSIX Safety Concepts::.
  5143. This function is similar to ‘asprintf’, except that it uses the
  5144. obstack OBSTACK to allocate the space. *Note Obstacks::.
  5145. The characters are written onto the end of the current object. To
  5146. get at them, you must finish the object with ‘obstack_finish’
  5147. (*note Growing Objects::).
  5148. 
  5149. File: libc.info, Node: Variable Arguments Output, Next: Parsing a Template String, Prev: Dynamic Output, Up: Formatted Output
  5150. 12.12.9 Variable Arguments Output Functions
  5151. -------------------------------------------
  5152. The functions ‘vprintf’ and friends are provided so that you can define
  5153. your own variadic ‘printf’-like functions that make use of the same
  5154. internals as the built-in formatted output functions.
  5155. The most natural way to define such functions would be to use a
  5156. language construct to say, "Call ‘printf’ and pass this template plus
  5157. all of my arguments after the first five." But there is no way to do
  5158. this in C, and it would be hard to provide a way, since at the C
  5159. language level there is no way to tell how many arguments your function
  5160. received.
  5161. Since that method is impossible, we provide alternative functions,
  5162. the ‘vprintf’ series, which lets you pass a ‘va_list’ to describe "all
  5163. of my arguments after the first five."
  5164. When it is sufficient to define a macro rather than a real function,
  5165. the GNU C compiler provides a way to do this much more easily with
  5166. macros. For example:
  5167. #define myprintf(a, b, c, d, e, rest...) \
  5168. printf (mytemplate , ## rest)
  5169. *Note (cpp)Variadic Macros::, for details. But this is limited to
  5170. macros, and does not apply to real functions at all.
  5171. Before calling ‘vprintf’ or the other functions listed in this
  5172. section, you _must_ call ‘va_start’ (*note Variadic Functions::) to
  5173. initialize a pointer to the variable arguments. Then you can call
  5174. ‘va_arg’ to fetch the arguments that you want to handle yourself. This
  5175. advances the pointer past those arguments.
  5176. Once your ‘va_list’ pointer is pointing at the argument of your
  5177. choice, you are ready to call ‘vprintf’. That argument and all
  5178. subsequent arguments that were passed to your function are used by
  5179. ‘vprintf’ along with the template that you specified separately.
  5180. *Portability Note:* The value of the ‘va_list’ pointer is
  5181. undetermined after the call to ‘vprintf’, so you must not use ‘va_arg’
  5182. after you call ‘vprintf’. Instead, you should call ‘va_end’ to retire
  5183. the pointer from service. You can call ‘va_start’ again and begin
  5184. fetching the arguments from the start of the variable argument list.
  5185. (Alternatively, you can use ‘va_copy’ to make a copy of the ‘va_list’
  5186. pointer before calling ‘vfprintf’.) Calling ‘vprintf’ does not destroy
  5187. the argument list of your function, merely the particular pointer that
  5188. you passed to it.
  5189. Prototypes for these functions are declared in ‘stdio.h’.
  5190. -- Function: int vprintf (const char *TEMPLATE, va_list AP)
  5191. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  5192. mem lock corrupt | *Note POSIX Safety Concepts::.
  5193. This function is similar to ‘printf’ except that, instead of taking
  5194. a variable number of arguments directly, it takes an argument list
  5195. pointer AP.
  5196. -- Function: int vwprintf (const wchar_t *TEMPLATE, va_list AP)
  5197. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  5198. mem lock corrupt | *Note POSIX Safety Concepts::.
  5199. This function is similar to ‘wprintf’ except that, instead of
  5200. taking a variable number of arguments directly, it takes an
  5201. argument list pointer AP.
  5202. -- Function: int vfprintf (FILE *STREAM, const char *TEMPLATE, va_list
  5203. AP)
  5204. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  5205. mem lock corrupt | *Note POSIX Safety Concepts::.
  5206. This is the equivalent of ‘fprintf’ with the variable argument list
  5207. specified directly as for ‘vprintf’.
  5208. -- Function: int vfwprintf (FILE *STREAM, const wchar_t *TEMPLATE,
  5209. va_list AP)
  5210. Preliminary: | MT-Safe locale | AS-Unsafe corrupt heap | AC-Unsafe
  5211. mem lock corrupt | *Note POSIX Safety Concepts::.
  5212. This is the equivalent of ‘fwprintf’ with the variable argument
  5213. list specified directly as for ‘vwprintf’.
  5214. -- Function: int vsprintf (char *S, const char *TEMPLATE, va_list AP)
  5215. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5216. *Note POSIX Safety Concepts::.
  5217. This is the equivalent of ‘sprintf’ with the variable argument list
  5218. specified directly as for ‘vprintf’.
  5219. -- Function: int vswprintf (wchar_t *WS, size_t SIZE, const wchar_t
  5220. *TEMPLATE, va_list AP)
  5221. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5222. *Note POSIX Safety Concepts::.
  5223. This is the equivalent of ‘swprintf’ with the variable argument
  5224. list specified directly as for ‘vwprintf’.
  5225. -- Function: int vsnprintf (char *S, size_t SIZE, const char *TEMPLATE,
  5226. va_list AP)
  5227. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5228. *Note POSIX Safety Concepts::.
  5229. This is the equivalent of ‘snprintf’ with the variable argument
  5230. list specified directly as for ‘vprintf’.
  5231. -- Function: int vasprintf (char **PTR, const char *TEMPLATE, va_list
  5232. AP)
  5233. Preliminary: | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem |
  5234. *Note POSIX Safety Concepts::.
  5235. The ‘vasprintf’ function is the equivalent of ‘asprintf’ with the
  5236. variable argument list specified directly as for ‘vprintf’.
  5237. -- Function: int obstack_vprintf (struct obstack *OBSTACK, const char
  5238. *TEMPLATE, va_list AP)
  5239. Preliminary: | MT-Safe race:obstack locale | AS-Unsafe corrupt heap
  5240. | AC-Unsafe corrupt mem | *Note POSIX Safety Concepts::.
  5241. The ‘obstack_vprintf’ function is the equivalent of
  5242. ‘obstack_printf’ with the variable argument list specified directly
  5243. as for ‘vprintf’.
  5244. -- Function: int vdprintf (int FD, const char *TEMPLATE, va_list AP)
  5245. | MT-Safe locale | AS-Unsafe heap | AC-Unsafe mem | *Note POSIX
  5246. Safety Concepts::.
  5247. The ‘vdprintf’ is the equivalent of ‘dprintf’, but processes an
  5248. argument list.
  5249. Here's an example showing how you might use ‘vfprintf’. This is a
  5250. function that prints error messages to the stream ‘stderr’, along with a
  5251. prefix indicating the name of the program (*note Error Messages::, for a
  5252. description of ‘program_invocation_short_name’).
  5253. #include <stdio.h>
  5254. #include <stdarg.h>
  5255. void
  5256. eprintf (const char *template, ...)
  5257. {
  5258. va_list ap;
  5259. extern char *program_invocation_short_name;
  5260. fprintf (stderr, "%s: ", program_invocation_short_name);
  5261. va_start (ap, template);
  5262. vfprintf (stderr, template, ap);
  5263. va_end (ap);
  5264. }
  5265. You could call ‘eprintf’ like this:
  5266. eprintf ("file `%s' does not exist\n", filename);
  5267. In GNU C, there is a special construct you can use to let the
  5268. compiler know that a function uses a ‘printf’-style format string. Then
  5269. it can check the number and types of arguments in each call to the
  5270. function, and warn you when they do not match the format string. For
  5271. example, take this declaration of ‘eprintf’:
  5272. void eprintf (const char *template, ...)
  5273. __attribute__ ((format (printf, 1, 2)));
  5274. This tells the compiler that ‘eprintf’ uses a format string like
  5275. ‘printf’ (as opposed to ‘scanf’; *note Formatted Input::); the format
  5276. string appears as the first argument; and the arguments to satisfy the
  5277. format begin with the second. *Note Declaring Attributes of Functions:
  5278. (gcc)Function Attributes, for more information.
  5279. 
  5280. File: libc.info, Node: Parsing a Template String, Next: Example of Parsing, Prev: Variable Arguments Output, Up: Formatted Output
  5281. 12.12.10 Parsing a Template String
  5282. ----------------------------------
  5283. You can use the function ‘parse_printf_format’ to obtain information
  5284. about the number and types of arguments that are expected by a given
  5285. template string. This function permits interpreters that provide
  5286. interfaces to ‘printf’ to avoid passing along invalid arguments from the
  5287. user's program, which could cause a crash.
  5288. All the symbols described in this section are declared in the header
  5289. file ‘printf.h’.
  5290. -- Function: size_t parse_printf_format (const char *TEMPLATE, size_t
  5291. N, int *ARGTYPES)
  5292. Preliminary: | MT-Safe locale | AS-Safe | AC-Safe | *Note POSIX
  5293. Safety Concepts::.
  5294. This function returns information about the number and types of
  5295. arguments expected by the ‘printf’ template string TEMPLATE. The
  5296. information is stored in the array ARGTYPES; each element of this
  5297. array describes one argument. This information is encoded using
  5298. the various ‘PA_’ macros, listed below.
  5299. The argument N specifies the number of elements in the array
  5300. ARGTYPES. This is the maximum number of elements that
  5301. ‘parse_printf_format’ will try to write.
  5302. ‘parse_printf_format’ returns the total number of arguments
  5303. required by TEMPLATE. If this number is greater than N, then the
  5304. information returned describes only the first N arguments. If you
  5305. want information about additional arguments, allocate a bigger
  5306. array and call ‘parse_printf_format’ again.
  5307. The argument types are encoded as a combination of a basic type and
  5308. modifier flag bits.
  5309. -- Macro: int PA_FLAG_MASK
  5310. This macro is a bitmask for the type modifier flag bits. You can
  5311. write the expression ‘(argtypes[i] & PA_FLAG_MASK)’ to extract just
  5312. the flag bits for an argument, or ‘(argtypes[i] & ~PA_FLAG_MASK)’
  5313. to extract just the basic type code.
  5314. Here are symbolic constants that represent the basic types; they
  5315. stand for integer values.
  5316. ‘PA_INT’
  5317. This specifies that the base type is ‘int’.
  5318. ‘PA_CHAR’
  5319. This specifies that the base type is ‘int’, cast to ‘char’.
  5320. ‘PA_STRING’
  5321. This specifies that the base type is ‘char *’, a null-terminated
  5322. string.
  5323. ‘PA_POINTER’
  5324. This specifies that the base type is ‘void *’, an arbitrary
  5325. pointer.
  5326. ‘PA_FLOAT’
  5327. This specifies that the base type is ‘float’.
  5328. ‘PA_DOUBLE’
  5329. This specifies that the base type is ‘double’.
  5330. ‘PA_LAST’
  5331. You can define additional base types for your own programs as
  5332. offsets from ‘PA_LAST’. For example, if you have data types ‘foo’
  5333. and ‘bar’ with their own specialized ‘printf’ conversions, you
  5334. could define encodings for these types as:
  5335. #define PA_FOO PA_LAST
  5336. #define PA_BAR (PA_LAST + 1)
  5337. Here are the flag bits that modify a basic type. They are combined
  5338. with the code for the basic type using inclusive-or.
  5339. ‘PA_FLAG_PTR’
  5340. If this bit is set, it indicates that the encoded type is a pointer
  5341. to the base type, rather than an immediate value. For example,
  5342. ‘PA_INT|PA_FLAG_PTR’ represents the type ‘int *’.
  5343. ‘PA_FLAG_SHORT’
  5344. If this bit is set, it indicates that the base type is modified
  5345. with ‘short’. (This corresponds to the ‘h’ type modifier.)
  5346. ‘PA_FLAG_LONG’
  5347. If this bit is set, it indicates that the base type is modified
  5348. with ‘long’. (This corresponds to the ‘l’ type modifier.)
  5349. ‘PA_FLAG_LONG_LONG’
  5350. If this bit is set, it indicates that the base type is modified
  5351. with ‘long long’. (This corresponds to the ‘L’ type modifier.)
  5352. ‘PA_FLAG_LONG_DOUBLE’
  5353. This is a synonym for ‘PA_FLAG_LONG_LONG’, used by convention with
  5354. a base type of ‘PA_DOUBLE’ to indicate a type of ‘long double’.
  5355. For an example of using these facilities, see *note Example of
  5356. Parsing::.
  5357. 
  5358. File: libc.info, Node: Example of Parsing, Prev: Parsing a Template String, Up: Formatted Output
  5359. 12.12.11 Example of Parsing a Template String
  5360. ---------------------------------------------
  5361. Here is an example of decoding argument types for a format string. We
  5362. assume this is part of an interpreter which contains arguments of type
  5363. ‘NUMBER’, ‘CHAR’, ‘STRING’ and ‘STRUCTURE’ (and perhaps others which are
  5364. not valid here).
  5365. /* Test whether the NARGS specified objects
  5366. in the vector ARGS are valid
  5367. for the format string FORMAT:
  5368. if so, return 1.
  5369. If not, return 0 after printing an error message. */
  5370. int
  5371. validate_args (char *format, int nargs, OBJECT *args)
  5372. {
  5373. int *argtypes;
  5374. int nwanted;
  5375. /* Get the information about the arguments.
  5376. Each conversion specification must be at least two characters
  5377. long, so there cannot be more specifications than half the
  5378. length of the string. */
  5379. argtypes = (int *) alloca (strlen (format) / 2 * sizeof (int));
  5380. nwanted = parse_printf_format (format, nargs, argtypes);
  5381. /* Check the number of arguments. */
  5382. if (nwanted > nargs)
  5383. {
  5384. error ("too few arguments (at least %d required)", nwanted);
  5385. return 0;
  5386. }
  5387. /* Check the C type wanted for each argument
  5388. and see if the object given is suitable. */
  5389. for (i = 0; i < nwanted; i++)
  5390. {
  5391. int wanted;
  5392. if (argtypes[i] & PA_FLAG_PTR)
  5393. wanted = STRUCTURE;
  5394. else
  5395. switch (argtypes[i] & ~PA_FLAG_MASK)
  5396. {
  5397. case PA_INT:
  5398. case PA_FLOAT:
  5399. case PA_DOUBLE:
  5400. wanted = NUMBER;
  5401. break;
  5402. case PA_CHAR:
  5403. wanted = CHAR;
  5404. break;
  5405. case PA_STRING:
  5406. wanted = STRING;
  5407. break;
  5408. case PA_POINTER:
  5409. wanted = STRUCTURE;
  5410. break;
  5411. }
  5412. if (TYPE (args[i]) != wanted)
  5413. {
  5414. error ("type mismatch for arg number %d", i);
  5415. return 0;
  5416. }
  5417. }
  5418. return 1;
  5419. }
  5420. 
  5421. File: libc.info, Node: Customizing Printf, Next: Formatted Input, Prev: Formatted Output, Up: I/O on Streams
  5422. 12.13 Customizing ‘printf’
  5423. ==========================
  5424. The GNU C Library lets you define your own custom conversion specifiers
  5425. for ‘printf’ template strings, to teach ‘printf’ clever ways to print
  5426. the important data structures of your program.
  5427. The way you do this is by registering the conversion with the
  5428. function ‘register_printf_function’; see *note Registering New
  5429. Conversions::. One of the arguments you pass to this function is a
  5430. pointer to a handler function that produces the actual output; see *note
  5431. Defining the Output Handler::, for information on how to write this
  5432. function.
  5433. You can also install a function that just returns information about
  5434. the number and type of arguments expected by the conversion specifier.
  5435. *Note Parsing a Template String::, for information about this.
  5436. The facilities of this section are declared in the header file
  5437. ‘printf.h’.
  5438. * Menu:
  5439. * Registering New Conversions:: Using ‘register_printf_function’
  5440. to register a new output conversion.
  5441. * Conversion Specifier Options:: The handler must be able to get
  5442. the options specified in the
  5443. template when it is called.
  5444. * Defining the Output Handler:: Defining the handler and arginfo
  5445. functions that are passed as arguments
  5446. to ‘register_printf_function’.
  5447. * Printf Extension Example:: How to define a ‘printf’
  5448. handler function.
  5449. * Predefined Printf Handlers:: Predefined ‘printf’ handlers.
  5450. *Portability Note:* The ability to extend the syntax of ‘printf’
  5451. template strings is a GNU extension. ISO standard C has nothing
  5452. similar. When using the GNU C compiler or any other compiler that
  5453. interprets calls to standard I/O functions according to the rules of the
  5454. language standard it is necessary to disable such handling by the
  5455. appropriate compiler option. Otherwise the behavior of a program that
  5456. relies on the extension is undefined.
  5457. 
  5458. File: libc.info, Node: Registering New Conversions, Next: Conversion Specifier Options, Up: Customizing Printf
  5459. 12.13.1 Registering New Conversions
  5460. -----------------------------------
  5461. The function to register a new output conversion is
  5462. ‘register_printf_function’, declared in ‘printf.h’.
  5463. -- Function: int register_printf_function (int SPEC, printf_function
  5464. HANDLER-FUNCTION, printf_arginfo_function ARGINFO-FUNCTION)
  5465. Preliminary: | MT-Unsafe const:printfext | AS-Unsafe heap lock |
  5466. AC-Unsafe mem lock | *Note POSIX Safety Concepts::.
  5467. This function defines the conversion specifier character SPEC.
  5468. Thus, if SPEC is ‘'Y'’, it defines the conversion ‘%Y’. You can
  5469. redefine the built-in conversions like ‘%s’, but flag characters
  5470. like ‘#’ and type modifiers like ‘l’ can never be used as
  5471. conversions; calling ‘register_printf_function’ for those
  5472. characters has no effect. It is advisable not to use lowercase
  5473. letters, since the ISO C standard warns that additional lowercase
  5474. letters may be standardized in future editions of the standard.
  5475. The HANDLER-FUNCTION is the function called by ‘printf’ and friends
  5476. when this conversion appears in a template string. *Note Defining
  5477. the Output Handler::, for information about how to define a
  5478. function to pass as this argument. If you specify a null pointer,
  5479. any existing handler function for SPEC is removed.
  5480. The ARGINFO-FUNCTION is the function called by
  5481. ‘parse_printf_format’ when this conversion appears in a template
  5482. string. *Note Parsing a Template String::, for information about
  5483. this.
  5484. *Attention:* In the GNU C Library versions before 2.0 the
  5485. ARGINFO-FUNCTION function did not need to be installed unless the
  5486. user used the ‘parse_printf_format’ function. This has changed.
  5487. Now a call to any of the ‘printf’ functions will call this function
  5488. when this format specifier appears in the format string.
  5489. The return value is ‘0’ on success, and ‘-1’ on failure (which
  5490. occurs if SPEC is out of range).
  5491. *Portability Note:* It is possible to redefine the standard output
  5492. conversions but doing so is strongly discouraged because it may
  5493. interfere with the behavior of programs and compiler
  5494. implementations that assume the effects of the conversions conform
  5495. to the relevant language standards. In addition, conforming
  5496. compilers need not guarantee that the function registered for a
  5497. standard conversion will be called for each such conversion in
  5498. every format string in a program.
  5499. 
  5500. File: libc.info, Node: Conversion Specifier Options, Next: Defining the Output Handler, Prev: Registering New Conversions, Up: Customizing Printf
  5501. 12.13.2 Conversion Specifier Options
  5502. ------------------------------------
  5503. If you define a meaning for ‘%A’, what if the template contains ‘%+23A’
  5504. or ‘%-#A’? To implement a sensible meaning for these, the handler when
  5505. called needs to be able to get the options specified in the template.
  5506. Both the HANDLER-FUNCTION and ARGINFO-FUNCTION accept an argument
  5507. that points to a ‘struct printf_info’, which contains information about
  5508. the options appearing in an instance of the conversion specifier. This
  5509. data type is declared in the header file ‘printf.h’.
  5510. -- Type: struct printf_info
  5511. This structure is used to pass information about the options
  5512. appearing in an instance of a conversion specifier in a ‘printf’
  5513. template string to the handler and arginfo functions for that
  5514. specifier. It contains the following members:
  5515. ‘int prec’
  5516. This is the precision specified. The value is ‘-1’ if no
  5517. precision was specified. If the precision was given as ‘*’,
  5518. the ‘printf_info’ structure passed to the handler function
  5519. contains the actual value retrieved from the argument list.
  5520. But the structure passed to the arginfo function contains a
  5521. value of ‘INT_MIN’, since the actual value is not known.
  5522. ‘int width’
  5523. This is the minimum field width specified. The value is ‘0’
  5524. if no width was specified. If the field width was given as
  5525. ‘*’, the ‘printf_info’ structure passed to the handler
  5526. function contains the actual value retrieved from the argument
  5527. list. But the structure passed to the arginfo function
  5528. contains a value of ‘INT_MIN’, since the actual value is not
  5529. known.
  5530. ‘wchar_t spec’
  5531. This is the conversion specifier character specified. It's
  5532. stored in the structure so that you can register the same
  5533. handler function for multiple characters, but still have a way
  5534. to tell them apart when the handler function is called.
  5535. ‘unsigned int is_long_double’
  5536. This is a boolean that is true if the ‘L’, ‘ll’, or ‘q’ type
  5537. modifier was specified. For integer conversions, this
  5538. indicates ‘long long int’, as opposed to ‘long double’ for
  5539. floating point conversions.
  5540. ‘unsigned int is_char’
  5541. This is a boolean that is true if the ‘hh’ type modifier was
  5542. specified.
  5543. ‘unsigned int is_short’
  5544. This is a boolean that is true if the ‘h’ type modifier was
  5545. specified.
  5546. ‘unsigned int is_long’
  5547. This is a boolean that is true if the ‘l’ type modifier was
  5548. specified.
  5549. ‘unsigned int alt’
  5550. This is a boolean that is true if the ‘#’ flag was specified.
  5551. ‘unsigned int space’
  5552. This is a boolean that is true if the ‘ ’ flag was specified.
  5553. ‘unsigned int left’
  5554. This is a boolean that is true if the ‘-’ flag was specified.
  5555. ‘unsigned int showsign’
  5556. This is a boolean that is true if the ‘+’ flag was specified.
  5557. ‘unsigned int group’
  5558. This is a boolean that is true if the ‘'’ flag was specified.
  5559. ‘unsigned int extra’
  5560. This flag has a special meaning depending on the context. It
  5561. could be used freely by the user-defined handlers but when
  5562. called from the ‘printf’ function this variable always
  5563. contains the value ‘0’.
  5564. ‘unsigned int wide’
  5565. This flag is set if the stream is wide oriented.
  5566. ‘wchar_t pad’
  5567. This is the character to use for padding the output to the
  5568. minimum field width. The value is ‘'0'’ if the ‘0’ flag was
  5569. specified, and ‘' '’ otherwise.
  5570. 
  5571. File: libc.info, Node: Defining the Output Handler, Next: Printf Extension Example, Prev: Conversion Specifier Options, Up: Customizing Printf
  5572. 12.13.3 Defining the Output Handler
  5573. -----------------------------------
  5574. Now let's look at how to define the handler and arginfo functions which
  5575. are passed as arguments to ‘register_printf_function’.
  5576. *Compatibility Note:* The interface changed in the GNU C Library
  5577. version 2.0. Previously the third argument was of type ‘va_list *’.
  5578. You should define your handler functions with a prototype like:
  5579. int FUNCTION (FILE *stream, const struct printf_info *info,
  5580. const void *const *args)
  5581. The STREAM argument passed to the handler function is the stream to
  5582. which it should write output.
  5583. The INFO argument is a pointer to a structure that contains
  5584. information about the various options that were included with the
  5585. conversion in the template string. You should not modify this structure
  5586. inside your handler function. *Note Conversion Specifier Options::, for
  5587. a description of this data structure.
  5588. The ARGS is a vector of pointers to the arguments data. The number
  5589. of arguments was determined by calling the argument information function
  5590. provided by the user.
  5591. Your handler function should return a value just like ‘printf’ does:
  5592. it should return the number of characters it has written, or a negative
  5593. value to indicate an error.
  5594. -- Data Type: printf_function
  5595. This is the data type that a handler function should have.
  5596. If you are going to use ‘parse_printf_format’ in your application,
  5597. you must also define a function to pass as the ARGINFO-FUNCTION argument
  5598. for each new conversion you install with ‘register_printf_function’.
  5599. You have to define these functions with a prototype like:
  5600. int FUNCTION (const struct printf_info *info,
  5601. size_t n, int *argtypes)
  5602. The return value from the function should be the number of arguments
  5603. the conversion expects. The function should also fill in no more than N
  5604. elements of the ARGTYPES array with information about the types of each
  5605. of these arguments. This information is encoded using the various ‘PA_’
  5606. macros. (You will notice that this is the same calling convention
  5607. ‘parse_printf_format’ itself uses.)
  5608. -- Data Type: printf_arginfo_function
  5609. This type is used to describe functions that return information
  5610. about the number and type of arguments used by a conversion
  5611. specifier.
  5612. 
  5613. File: libc.info, Node: Printf Extension Example, Next: Predefined Printf Handlers, Prev: Defining the Output Handler, Up: Customizing Printf
  5614. 12.13.4 ‘printf’ Extension Example
  5615. ----------------------------------
  5616. Here is an example showing how to define a ‘printf’ handler function.
  5617. This program defines a data structure called a ‘Widget’ and defines the
  5618. ‘%W’ conversion to print information about ‘Widget *’ arguments,
  5619. including the pointer value and the name stored in the data structure.
  5620. The ‘%W’ conversion supports the minimum field width and
  5621. left-justification options, but ignores everything else.
  5622. #include <stdio.h>
  5623. #include <stdlib.h>
  5624. #include <printf.h>
  5625. typedef struct
  5626. {
  5627. char *name;
  5628. }
  5629. Widget;
  5630. int
  5631. print_widget (FILE *stream,
  5632. const struct printf_info *info,
  5633. const void *const *args)
  5634. {
  5635. const Widget *w;
  5636. char *buffer;
  5637. int len;
  5638. /* Format the output into a string. */
  5639. w = *((const Widget **) (args[0]));
  5640. len = asprintf (&buffer, "<Widget %p: %s>", w, w->name);
  5641. if (len == -1)
  5642. return -1;
  5643. /* Pad to the minimum field width and print to the stream. */
  5644. len = fprintf (stream, "%*s",
  5645. (info->left ? -info->width : info->width),
  5646. buffer);
  5647. /* Clean up and return. */
  5648. free (buffer);
  5649. return len;
  5650. }
  5651. int
  5652. print_widget_arginfo (const struct printf_info *info, size_t n,
  5653. int *argtypes)
  5654. {
  5655. /* We always take exactly one argument and this is a pointer to the
  5656. structure.. */
  5657. if (n > 0)
  5658. argtypes[0] = PA_POINTER;
  5659. return 1;
  5660. }
  5661. int
  5662. main (void)
  5663. {
  5664. /* Make a widget to print. */
  5665. Widget mywidget;
  5666. mywidget.name = "mywidget";
  5667. /* Register the print function for widgets. */
  5668. register_printf_function ('W', print_widget, print_widget_arginfo);
  5669. /* Now print the widget. */
  5670. printf ("|%W|\n", &mywidget);
  5671. printf ("|%35W|\n", &mywidget);
  5672. printf ("|%-35W|\n", &mywidget);
  5673. return 0;
  5674. }
  5675. The output produced by this program looks like:
  5676. |<Widget 0xffeffb7c: mywidget>|
  5677. | <Widget 0xffeffb7c: mywidget>|
  5678. |<Widget 0xffeffb7c: mywidget> |
  5679. 
  5680. File: libc.info, Node: Predefined Printf Handlers, Prev: Printf Extension Example, Up: Customizing Printf
  5681. 12.13.5 Predefined ‘printf’ Handlers
  5682. ------------------------------------
  5683. The GNU C Library also contains a concrete and useful application of the
  5684. ‘printf’ handler extension. There are two functions available which
  5685. implement a special way to print floating-point numbers.
  5686. -- Function: int printf_size (FILE *FP, const struct printf_info *INFO,
  5687. const void *const *ARGS)
  5688. Preliminary: | MT-Safe race:fp locale | AS-Unsafe corrupt heap |
  5689. AC-Unsafe mem corrupt | *Note POSIX Safety Concepts::.
  5690. Print a given floating point number as for the format ‘%f’ except
  5691. that there is a postfix character indicating the divisor for the
  5692. number to make this less than 1000. There are two possible
  5693. divisors: powers of 1024 or powers of 1000. Which one is used
  5694. depends on the format character specified while registered this
  5695. handler. If the character is of lower case, 1024 is used. For
  5696. upper case characters, 1000 is used.
  5697. The postfix tag corresponds to bytes, kilobytes, megabytes,
  5698. gigabytes, etc. The full table is:
  5699. low Multiplier From Upper Multiplier
  5700. ' ' 1 ' ' 1
  5701. k 2^10 (1024) kilo K 10^3 (1000)
  5702. m 2^20 mega M 10^6
  5703. g 2^30 giga G 10^9
  5704. t 2^40 tera T 10^12
  5705. p 2^50 peta P 10^15
  5706. e 2^60 exa E 10^18
  5707. z 2^70 zetta Z 10^21
  5708. y 2^80 yotta Y 10^24
  5709. The default precision is 3, i.e., 1024 is printed with a lower-case
  5710. format character as if it were ‘%.3fk’ and will yield ‘1.000k’.
  5711. Due to the requirements of ‘register_printf_function’ we must also
  5712. provide the function which returns information about the arguments.
  5713. -- Function: int printf_size_info (const struct printf_info *INFO,
  5714. size_t N, int *ARGTYPES)
  5715. Preliminary: | MT-Safe | AS-Safe | AC-Safe | *Note POSIX Safety
  5716. Concepts::.
  5717. This function will return in ARGTYPES the information about the
  5718. used parameters in the way the ‘vfprintf’ implementation expects
  5719. it. The format always takes one argument.
  5720. To use these functions both functions must be registered with a call
  5721. like
  5722. register_printf_function ('B', printf_size, printf_size_info);
  5723. Here we register the functions to print numbers as powers of 1000
  5724. since the format character ‘'B'’ is an upper-case character. If we
  5725. would additionally use ‘'b'’ in a line like
  5726. register_printf_function ('b', printf_size, printf_size_info);
  5727. we could also print using a power of 1024. Please note that all that is
  5728. different in these two lines is the format specifier. The ‘printf_size’
  5729. function knows about the difference between lower and upper case format
  5730. specifiers.
  5731. The use of ‘'B'’ and ‘'b'’ is no coincidence. Rather it is the
  5732. preferred way to use this functionality since it is available on some
  5733. other systems which also use format specifiers.
  5734. 
  5735. File: libc.info, Node: Formatted Input, Next: EOF and Errors, Prev: Customizing Printf, Up: I/O on Streams
  5736. 12.14 Formatted Input
  5737. =====================
  5738. The functions described in this section (‘scanf’ and related functions)
  5739. provide facilities for formatted input analogous to the formatted output
  5740. facilities. These functions provide a mechanism for reading arbitrary
  5741. values under the control of a “format string” or “template string”.
  5742. * Menu:
  5743. * Formatted Input Basics:: Some basics to get you started.
  5744. * Input Conversion Syntax:: Syntax of conversion specifications.
  5745. * Table of Input Conversions:: Summary of input conversions and what they do.
  5746. * Numeric Input Conversions:: Details of conversions for reading numbers.
  5747. * String Input Conversions:: Details of conversions for reading strings.
  5748. * Dynamic String Input:: String conversions that ‘malloc’ the buffer.
  5749. * Other Input Conversions:: Details of miscellaneous other conversions.
  5750. * Formatted Input Functions:: Descriptions of the actual functions.
  5751. * Variable Arguments Input:: ‘vscanf’ and friends.
  5752. 
  5753. File: libc.info, Node: Formatted Input Basics, Next: Input Conversion Syntax, Up: Formatted Input
  5754. 12.14.1 Formatted Input Basics
  5755. ------------------------------
  5756. Calls to ‘scanf’ are superficially similar to calls to ‘printf’ in that
  5757. arbitrary arguments are read under the control of a template string.
  5758. While the syntax of the conversion specifications in the template is
  5759. very similar to that for ‘printf’, the interpretation of the template is
  5760. oriented more towards free-format input and simple pattern matching,
  5761. rather than fixed-field formatting. For example, most ‘scanf’
  5762. conversions skip over any amount of "white space" (including spaces,
  5763. tabs, and newlines) in the input file, and there is no concept of
  5764. precision for the numeric input conversions as there is for the
  5765. corresponding output conversions. Ordinarily, non-whitespace characters
  5766. in the template are expected to match characters in the input stream
  5767. exactly, but a matching failure is distinct from an input error on the
  5768. stream.
  5769. Another area of difference between ‘scanf’ and ‘printf’ is that you
  5770. must remember to supply pointers rather than immediate values as the
  5771. optional arguments to ‘scanf’; the values that are read are stored in
  5772. the objects that the pointers point to. Even experienced programmers
  5773. tend to forget this occasionally, so if your program is getting strange
  5774. errors that seem to be related to ‘scanf’, you might want to
  5775. double-check this.
  5776. When a “matching failure” occurs, ‘scanf’ returns immediately,
  5777. leaving the first non-matching character as the next character to be
  5778. read from the stream. The normal return value from ‘scanf’ is the
  5779. number of values that were assigned, so you can use this to determine if
  5780. a matching error happened before all the expected values were read.
  5781. The ‘scanf’ function is typically used for things like reading in the
  5782. contents of tables. For example, here is a function that uses ‘scanf’
  5783. to initialize an array of ‘double’:
  5784. void
  5785. readarray (double *array, int n)
  5786. {
  5787. int i;
  5788. for (i=0; i<n; i++)
  5789. if (scanf (" %lf", &(array[i])) != 1)
  5790. invalid_input_error ();
  5791. }
  5792. The formatted input functions are not used as frequently as the
  5793. formatted output functions. Partly, this is because it takes some care
  5794. to use them properly. Another reason is that it is difficult to recover
  5795. from a matching error.
  5796. If you are trying to read input that doesn't match a single, fixed
  5797. pattern, you may be better off using a tool such as Flex to generate a
  5798. lexical scanner, or Bison to generate a parser, rather than using
  5799. ‘scanf’. For more information about these tools, see *note (flex)Top::,
  5800. and *note (bison)Top::.
  5801. 
  5802. File: libc.info, Node: Input Conversion Syntax, Next: Table of Input Conversions, Prev: Formatted Input Basics, Up: Formatted Input
  5803. 12.14.2 Input Conversion Syntax
  5804. -------------------------------
  5805. A ‘scanf’ template string is a string that contains ordinary multibyte
  5806. characters interspersed with conversion specifications that start with
  5807. ‘%’.
  5808. Any whitespace character (as defined by the ‘isspace’ function; *note
  5809. Classification of Characters::) in the template causes any number of
  5810. whitespace characters in the input stream to be read and discarded. The
  5811. whitespace characters that are matched need not be exactly the same
  5812. whitespace characters that appear in the template string. For example,
  5813. write ‘ , ’ in the template to recognize a comma with optional
  5814. whitespace before and after.
  5815. Other characters in the template string that are not part of
  5816. conversion specifications must match characters in the input stream
  5817. exactly; if this is not the case, a matching failure occurs.
  5818. The conversion specifications in a ‘scanf’ template string have the
  5819. general form:
  5820. % FLAGS WIDTH TYPE CONVERSION
  5821. In more detail, an input conversion specification consists of an
  5822. initial ‘%’ character followed in sequence by:
  5823. • An optional “flag character” ‘*’, which says to ignore the text
  5824. read for this specification. When ‘scanf’ finds a conversion
  5825. specification that uses this flag, it reads input as directed by
  5826. the rest of the conversion specification, but it discards this
  5827. input, does not use a pointer argument, and does not increment the
  5828. count of successful assignments.
  5829. • An optional flag character ‘a’ (valid with string conversions only)
  5830. which requests allocation of a buffer long enough to store the
  5831. string in. (This is a GNU extension.) *Note Dynamic String
  5832. Input::.
  5833. • An optional decimal integer that specifies the “maximum field
  5834. width”. Reading of characters from the input stream stops either
  5835. when this maximum is reached or when a non-matching character is
  5836. found, whichever happens first. Most conversions discard initial
  5837. whitespace characters (those that don't are explicitly documented),
  5838. and these discarded characters don't count towards the maximum
  5839. field width. String input conversions store a null character to
  5840. mark the end of the input; the maximum field width does not include
  5841. this terminator.
  5842. • An optional “type modifier character”. For example, you can
  5843. specify a type modifier of ‘l’ with integer conversions such as
  5844. ‘%d’ to specify that the argument is a pointer to a ‘long int’
  5845. rather than a pointer to an ‘int’.
  5846. • A character that specifies the conversion to be applied.
  5847. The exact options that are permitted and how they are interpreted
  5848. vary between the different conversion specifiers. See the descriptions
  5849. of the individual conversions for information about the particular
  5850. options that they allow.
  5851. With the ‘-Wformat’ option, the GNU C compiler checks calls to
  5852. ‘scanf’ and related functions. It examines the format string and
  5853. verifies that the correct number and types of arguments are supplied.
  5854. There is also a GNU C syntax to tell the compiler that a function you
  5855. write uses a ‘scanf’-style format string. *Note Declaring Attributes of
  5856. Functions: (gcc)Function Attributes, for more information.
  5857. 
  5858. File: libc.info, Node: Table of Input Conversions, Next: Numeric Input Conversions, Prev: Input Conversion Syntax, Up: Formatted Input
  5859. 12.14.3 Table of Input Conversions
  5860. ----------------------------------
  5861. Here is a table that summarizes the various conversion specifications:
  5862. ‘%d’
  5863. Matches an optionally signed integer written in decimal. *Note
  5864. Numeric Input Conversions::.
  5865. ‘%i’
  5866. Matches an optionally signed integer in any of the formats that the
  5867. C language defines for specifying an integer constant. *Note
  5868. Numeric Input Conversions::.
  5869. ‘%b’
  5870. Matches an unsigned integer written in binary radix. This is an
  5871. ISO C23 feature. *Note Numeric Input Conversions::.
  5872. ‘%o’
  5873. Matches an unsigned integer written in octal radix. *Note Numeric
  5874. Input Conversions::.
  5875. ‘%u’
  5876. Matches an unsigned integer written in decimal radix. *Note
  5877. Numeric Input Conversions::.
  5878. ‘%x’, ‘%X’
  5879. Matches an unsigned integer written in hexadecimal radix. *Note
  5880. Numeric Input Conversions::.
  5881. ‘%e’, ‘%f’, ‘%g’, ‘%E’, ‘%F’, ‘%G’
  5882. Matches an optionally signed floating-point number. *Note Numeric
  5883. Input Conversions::.
  5884. ‘%s’
  5885. Matches a string containing only non-whitespace characters. *Note
  5886. String Input Conversions::. The presence of the ‘l’ modifier
  5887. determines whether the output is stored as a wide character string
  5888. or a multibyte string. If ‘%s’ is used in a wide character
  5889. function the string is converted as with multiple calls to
  5890. ‘wcrtomb’ into a multibyte string. This means that the buffer must
  5891. provide room for ‘MB_CUR_MAX’ bytes for each wide character read.
  5892. In case ‘%ls’ is used in a multibyte function the result is
  5893. converted into wide characters as with multiple calls of ‘mbrtowc’
  5894. before being stored in the user provided buffer.
  5895. ‘%S’
  5896. This is an alias for ‘%ls’ which is supported for compatibility
  5897. with the Unix standard.
  5898. ‘%[’
  5899. Matches a string of characters that belong to a specified set.
  5900. *Note String Input Conversions::. The presence of the ‘l’ modifier
  5901. determines whether the output is stored as a wide character string
  5902. or a multibyte string. If ‘%[’ is used in a wide character
  5903. function the string is converted as with multiple calls to
  5904. ‘wcrtomb’ into a multibyte string. This means that the buffer must
  5905. provide room for ‘MB_CUR_MAX’ bytes for each wide character read.
  5906. In case ‘%l[’ is used in a multibyte function the result is
  5907. converted into wide characters as with multiple calls of ‘mbrtowc’
  5908. before being stored in the user provided buffer.
  5909. ‘%c’
  5910. Matches a string of one or more characters; the number of
  5911. characters read is controlled by the maximum field width given for
  5912. the conversion. *Note String Input Conversions::.
  5913. If ‘%c’ is used in a wide stream function the read value is
  5914. converted from a wide character to the corresponding multibyte
  5915. character before storing it. Note that this conversion can produce
  5916. more than one byte of output and therefore the provided buffer must
  5917. be large enough for up to ‘MB_CUR_MAX’ bytes for each character.
  5918. If ‘%lc’ is used in a multibyte function the input is treated as a
  5919. multibyte sequence (and not bytes) and the result is converted as
  5920. with calls to ‘mbrtowc’.
  5921. ‘%C’
  5922. This is an alias for ‘%lc’ which is supported for compatibility
  5923. with the Unix standard.
  5924. ‘%p’
  5925. Matches a pointer value in the same implementation-defined format
  5926. used by the ‘%p’ output conversion for ‘printf’. *Note Other Input
  5927. Conversions::.
  5928. ‘%n’
  5929. This conversion doesn't read any characters; it records the number
  5930. of characters read so far by this call. *Note Other Input
  5931. Conversions::.
  5932. ‘%%’
  5933. This matches a literal ‘%’ character in the input stream. No
  5934. corresponding argument is used. *Note Other Input Conversions::.
  5935. If the syntax of a conversion specification is invalid, the behavior
  5936. is undefined. If there aren't enough function arguments provided to
  5937. supply addresses for all the conversion specifications in the template
  5938. strings that perform assignments, or if the arguments are not of the
  5939. correct types, the behavior is also undefined. On the other hand, extra
  5940. arguments are simply ignored.
  5941. 
  5942. File: libc.info, Node: Numeric Input Conversions, Next: String Input Conversions, Prev: Table of Input Conversions, Up: Formatted Input
  5943. 12.14.4 Numeric Input Conversions
  5944. ---------------------------------
  5945. This section describes the ‘scanf’ conversions for reading numeric
  5946. values.
  5947. The ‘%d’ conversion matches an optionally signed integer in decimal
  5948. radix. The syntax that is recognized is the same as that for the
  5949. ‘strtol’ function (*note Parsing of Integers::) with the value ‘10’ for
  5950. the BASE argument.
  5951. The ‘%i’ conversion matches an optionally signed integer in any of
  5952. the formats that the C language defines for specifying an integer
  5953. constant. The syntax that is recognized is the same as that for the
  5954. ‘strtol’ function (*note Parsing of Integers::) with the value ‘0’ for
  5955. the BASE argument. (You can print integers in this syntax with ‘printf’
  5956. by using the ‘#’ flag character with the ‘%x’, ‘%o’, ‘%b’, or ‘%d’
  5957. conversion. *Note Integer Conversions::.)
  5958. For example, any of the strings ‘10’, ‘0xa’, or ‘012’ could be read
  5959. in as integers under the ‘%i’ conversion. Each of these specifies a
  5960. number with decimal value ‘10’.
  5961. The ‘%b’, ‘%o’, ‘%u’, and ‘%x’ conversions match unsigned integers in
  5962. binary, octal, decimal, and hexadecimal radices, respectively. The
  5963. syntax that is recognized is the same as that for the ‘strtoul’ function
  5964. (*note Parsing of Integers::) with the appropriate value (‘2’, ‘8’,
  5965. ‘10’, or ‘16’) for the BASE argument. The ‘%b’ conversion accepts an
  5966. optional leading ‘0b’ or ‘0B’ in all standards modes.
  5967. The ‘%X’ conversion is identical to the ‘%x’ conversion. They both
  5968. permit either uppercase or lowercase letters to be used as digits.
  5969. The default type of the corresponding argument for the ‘%d’, ‘%i’,
  5970. and ‘%n’ conversions is ‘int *’, and ‘unsigned int *’ for the other
  5971. integer conversions. You can use the following type modifiers to
  5972. specify other sizes of integer:
  5973. ‘hh’
  5974. Specifies that the argument is a ‘signed char *’ or ‘unsigned char
  5975. *’.
  5976. This modifier was introduced in ISO C99.
  5977. ‘h’
  5978. Specifies that the argument is a ‘short int *’ or ‘unsigned short
  5979. int *’.
  5980. ‘j’
  5981. Specifies that the argument is a ‘intmax_t *’ or ‘uintmax_t *’.
  5982. This modifier was introduced in ISO C99.
  5983. ‘l’
  5984. Specifies that the argument is a ‘long int *’ or ‘unsigned long int
  5985. *’. Two ‘l’ characters is like the ‘L’ modifier, below.
  5986. If used with ‘%c’ or ‘%s’ the corresponding parameter is considered
  5987. as a pointer to a wide character or wide character string
  5988. respectively. This use of ‘l’ was introduced in Amendment 1 to
  5989. ISO C90.
  5990. ‘ll’
  5991. ‘L’
  5992. ‘q’
  5993. Specifies that the argument is a ‘long long int *’ or ‘unsigned
  5994. long long int *’. (The ‘long long’ type is an extension supported
  5995. by the GNU C compiler. For systems that don't provide extra-long
  5996. integers, this is the same as ‘long int’.)
  5997. The ‘q’ modifier is another name for the same thing, which comes
  5998. from 4.4 BSD; a ‘long long int’ is sometimes called a "quad" ‘int’.
  5999. ‘t’
  6000. Specifies that the argument is a ‘ptrdiff_t *’.
  6001. This modifier was introduced in ISO C99.
  6002. ‘wN’
  6003. Specifies that the argument is an ‘intN_t *’ or ‘int_leastN_t *’
  6004. (which are the same type), or ‘uintN_t *’ or ‘uint_leastN_t *’
  6005. (which are the same type).
  6006. This modifier was introduced in ISO C23.
  6007. ‘wfN’
  6008. Specifies that the argument is an ‘int_fastN_t *’ or ‘uint_fastN_t
  6009. *’.
  6010. This modifier was introduced in ISO C23.
  6011. ‘z’
  6012. Specifies that the argument is a ‘size_t *’.
  6013. This modifier was introduced in ISO C99.
  6014. All of the ‘%e’, ‘%f’, ‘%g’, ‘%E’, ‘%F’ and ‘%G’ input conversions
  6015. are interchangeable. They all match an optionally signed floating point
  6016. number, in the same syntax as for the ‘strtod’ function (*note Parsing
  6017. of Floats::).
  6018. For the floating-point input conversions, the default argument type
  6019. is ‘float *’. (This is different from the corresponding output
  6020. conversions, where the default type is ‘double’; remember that ‘float’
  6021. arguments to ‘printf’ are converted to ‘double’ by the default argument
  6022. promotions, but ‘float *’ arguments are not promoted to ‘double *’.)
  6023. You can specify other sizes of float using these type modifiers:
  6024. ‘l’
  6025. Specifies that the argument is of type ‘double *’.
  6026. ‘L’
  6027. Specifies that the argument is of type ‘long double *’.
  6028. For all the above number parsing formats there is an additional
  6029. optional flag ‘'’. When this flag is given the ‘scanf’ function expects
  6030. the number represented in the input string to be formatted according to
  6031. the grouping rules of the currently selected locale (*note General
  6032. Numeric::).
  6033. If the ‘"C"’ or ‘"POSIX"’ locale is selected there is no difference.
  6034. But for a locale which specifies values for the appropriate fields in
  6035. the locale the input must have the correct form in the input. Otherwise
  6036. the longest prefix with a correct form is processed.
  6037. 
  6038. File: libc.info, Node: String Input Conversions, Next: Dynamic String Input, Prev: Numeric Input Conversions, Up: Formatted Input
  6039. 12.14.5 String Input Conversions
  6040. --------------------------------
  6041. This section describes the ‘scanf’ input conversions for reading string
  6042. and character values: ‘%s’, ‘%S’, ‘%[’, ‘%c’, and ‘%C’.
  6043. You have two options for how to receive the input from these
  6044. conversions:
  6045. • Provide a buffer to store it in. This is the default. You should
  6046. provide an argument of type ‘char *’ or ‘wchar_t *’ (the latter if
  6047. the ‘l’ modifier is present).
  6048. *Warning:* To make a robust program, you must make sure that the
  6049. input (plus its terminating null) cannot possibly exceed the size
  6050. of the buffer you provide. In general, the only way to do this is
  6051. to specify a maximum field width one less than the buffer size.
  6052. *If you provide the buffer, always specify a maximum field width to
  6053. prevent overflow.*
  6054. • Ask ‘scanf’ to allocate a big enough buffer, by specifying the ‘a’
  6055. flag character. This is a GNU extension. You should provide an
  6056. argument of type ‘char **’ for the buffer address to be stored in.
  6057. *Note Dynamic String Input::.
  6058. The ‘%c’ conversion is the simplest: it matches a fixed number of
  6059. characters, always. The maximum field width says how many characters to
  6060. read; if you don't specify the maximum, the default is 1. This
  6061. conversion doesn't append a null character to the end of the text it
  6062. reads. It also does not skip over initial whitespace characters. It
  6063. reads precisely the next N characters, and fails if it cannot get that
  6064. many. Since there is always a maximum field width with ‘%c’ (whether
  6065. specified, or 1 by default), you can always prevent overflow by making
  6066. the buffer long enough.
  6067. If the format is ‘%lc’ or ‘%C’ the function stores wide characters
  6068. which are converted using the conversion determined at the time the
  6069. stream was opened from the external byte stream. The number of bytes
  6070. read from the medium is limited by ‘MB_CUR_LEN * N’ but at most N wide
  6071. characters get stored in the output string.
  6072. The ‘%s’ conversion matches a string of non-whitespace characters.
  6073. It skips and discards initial whitespace, but stops when it encounters
  6074. more whitespace after having read something. It stores a null character
  6075. at the end of the text that it reads.
  6076. For example, reading the input:
  6077. hello, world
  6078. with the conversion ‘%10c’ produces ‘" hello, wo"’, but reading the same
  6079. input with the conversion ‘%10s’ produces ‘"hello,"’.
  6080. *Warning:* If you do not specify a field width for ‘%s’, then the
  6081. number of characters read is limited only by where the next whitespace
  6082. character appears. This almost certainly means that invalid input can
  6083. make your program crash--which is a bug.
  6084. The ‘%ls’ and ‘%S’ format are handled just like ‘%s’ except that the
  6085. external byte sequence is converted using the conversion associated with
  6086. the stream to wide characters with their own encoding. A width or
  6087. precision specified with the format do not directly determine how many
  6088. bytes are read from the stream since they measure wide characters. But
  6089. an upper limit can be computed by multiplying the value of the width or
  6090. precision by ‘MB_CUR_MAX’.
  6091. To read in characters that belong to an arbitrary set of your choice,
  6092. use the ‘%[’ conversion. You specify the set between the ‘[’ character
  6093. and a following ‘]’ character, using the same syntax used in regular
  6094. expressions for explicit sets of characters. As special cases:
  6095. • A literal ‘]’ character can be specified as the first character of
  6096. the set.
  6097. • An embedded ‘-’ character (that is, one that is not the first or
  6098. last character of the set) is used to specify a range of
  6099. characters.
  6100. • If a caret character ‘^’ immediately follows the initial ‘[’, then
  6101. the set of allowed input characters is everything _except_ the
  6102. characters listed.
  6103. The ‘%[’ conversion does not skip over initial whitespace characters.
  6104. Note that the “character class” syntax available in character sets
  6105. that appear inside regular expressions (such as ‘[:alpha:]’) is _not_
  6106. available in the ‘%[’ conversion.
  6107. Here are some examples of ‘%[’ conversions and what they mean:
  6108. ‘%25[1234567890]’
  6109. Matches a string of up to 25 digits.
  6110. ‘%25[][]’
  6111. Matches a string of up to 25 square brackets.
  6112. ‘%25[^ \f\n\r\t\v]’
  6113. Matches a string up to 25 characters long that doesn't contain any
  6114. of the standard whitespace characters. This is slightly different
  6115. from ‘%s’, because if the input begins with a whitespace character,
  6116. ‘%[’ reports a matching failure while ‘%s’ simply discards the
  6117. initial whitespace.
  6118. ‘%25[a-z]’
  6119. Matches up to 25 lowercase characters.
  6120. As for ‘%c’ and ‘%s’ the ‘%[’ format is also modified to produce wide
  6121. characters if the ‘l’ modifier is present. All what is said about ‘%ls’
  6122. above is true for ‘%l[’.
  6123. One more reminder: the ‘%s’ and ‘%[’ conversions are *dangerous* if
  6124. you don't specify a maximum width or use the ‘a’ flag, because input too
  6125. long would overflow whatever buffer you have provided for it. No matter
  6126. how long your buffer is, a user could supply input that is longer. A
  6127. well-written program reports invalid input with a comprehensible error
  6128. message, not with a crash.