File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / readline / doc / readline.dvi
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Wed Mar 17 01:01:01 2021 UTC (3 years, 2 months ago) by misho
Branches: readline, MAIN
CVS tags: v8_2p0, v8_1p0, HEAD
readline 8.1

; TeX output 2020.10.30:100733GKNjcmbx12KGNUqReadlineLibraryG0π6K`y
3
cmr10Editionf8.1,for7<x
3
cmtt10ReadlineLibraryVeersion8.1.
qiOctobMerf2020z]Nffcmbx12]ChetffRameyf,CaseWesternReserveUniversityBrianffFfox,FreeSoftwareffFoundation̉*33fhGThiscman!ualbdescribMestheGNUYReadlineLibrary(v!ersion8.1,29OctobMer2020),alibrary
33Gwhic!haidsintheconsistencyofuserinterfaceacrossdiscreteprogramswhichprovideaGcommandflinein!terface.33GCop!yrightcf?!",
3
cmsy10
@1988{2020fFereeSoft!warefFoundation,Inc..P!ermissiont#ist"grantedtot"copye,ddistributeand/ort#moMdifythisdoMcumen!tunderthe
33.terms
~oftheGNU
WFereeDoMcumen!tationLicense,)Version1.3oran!ylaterversion.published^b!ytheFereeSoftwareFeoundation;;<withnoInvdDariantSections,no.Feron!t-CoverxfTexts,andxenoBac!k-CoverTeexts.ΈAxZcopyxfofthelicenseisincluded.infthesectionen!titled\GNUFereeDoMcumentationLicense".ݍTi33͍GTNGcmbx12TTaGablezofConutents*33G]132CommandffLineEditingh32egffcmmi12e:Q32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:	]1!G1.1
5In!troMductionftoLineEditing>b>
3
cmmi10:ۍ:::::::::::::::::::::::::::::::::::71
33!G1.2
5ReadlinefIn!teractionRd:ۍ:::::::::::::::::::::::::::::::::::::::::::ԫ10G1.2.1
5ReadlinefBareEssen!tials.:ۍ::::::::::::::::::::::::::::::::::10G1.2.2
5ReadlinefMo!vementCommandsB":ۍ:::::::::::::::::::::::::::i20G1.2.3
5ReadlinefKillingCommands1:ۍ:::::::::::::::::::::::::::::::20G1.2.4
5ReadlinefArgumen!ts:ۍ::::::::::::::::::::::::::::::::::::::5c30G1.2.5
5Searc!hingfforCommandsintheHistoryi:ۍ:::::::::::::::::::K3!G1.3
5ReadlinefInitFile:ۍ::::::::::::::::::::::::::::::::::::::::::::::)a40G1.3.1
5ReadlinefInitFileSyn!tax :ۍ:::::::::::::::::::::::::::::::::]40G1.3.2
5ConditionalfInitConstructs:ۍ::::::::::::::::::::::::::::::~X120G1.3.3
5SamplefInitFile΍:ۍ:::::::::::::::::::::::::::::::::::::::::A13!G1.4
5BindablefReadlineCommands:ۍ::::::::::::::::::::::::::::::::2	160G1.4.1
5CommandsfFeorMo!ving>H:ۍ::::::::::::::::::::::::::::::::::160G1.4.2
5CommandsfFeorManipulatingTheHistoryi:ۍ:::::::::::::::9170G1.4.3
5CommandsfFeorChangingText{:ۍ:::::::::::::::::::::::::::180G1.4.4
5KillingfAndYeankingǍ:ۍ:::::::::::::::::::::::::::::::::::::200G1.4.5
5SpMecifyingfNumericArgumen!ts^V:ۍ::::::::::::::::::::::::::210G1.4.6
5LettingfReadlineT!ypMeFeorYouҍ:ۍ::::::::::::::::::::::::::=210G1.4.7
5KeybMoardfMacrosdI:ۍ::::::::::::::::::::::::::::::::::::::::220G1.4.8
5SomefMiscellaneousCommands&:ۍ::::::::::::::::::::::::::zn22!G1.5
5ReadlinefviMoMdeE:ۍ:::::::::::::::::::::::::::::::::::::::::::::
2433G]232ProgrammingffwithGNUReadline׍32e:Q32:32:32:32:32:32:32:32:32:32:
O]25!G2.1
5BasicfBeha!vior䍑:ۍ:::::::::::::::::::::::::::::::::::::::::::::::U,25!G2.2
5CustomfFeunctionsF:ۍ::::::::::::::::::::::::::::::::::::::::::::260G2.2.1
5ReadlinefT!ypMedefsF:ۍ:::::::::::::::::::::::::::::::::::::::270G2.2.2
5WeritingfaNewFunction̍:ۍ:::::::::::::::::::::::::::::::::d27!G2.3
5ReadlinefVeariablesa:ۍ::::::::::::::::::::::::::::::::::::::::::::J28!G2.4
5ReadlinefCon!venienceFeunctions:ۍ::::::::::::::::::::::::::::::2330G2.4.1
5NamingfaFeunctionڍ:ۍ::::::::::::::::::::::::::::::::::::::"330G2.4.2
5SelectingfaKeymap%:ۍ::::::::::::::::::::::::::::::::::::::C340G2.4.3
5BindingfKeysn:ۍ::::::::::::::::::::::::::::::::::::::::::::O350G2.4.4
5AssoMciatingfFeunctionNamesandBindings'Í:ۍ:::::::::::::::
360G2.4.5
5Allo!wingfUndoingG:ۍ:::::::::::::::::::::::::::::::::::::::W370G2.4.6
5Redispla!y1:ۍ::::::::::::::::::::::::::::::::::::::::::::::::380G2.4.7
5MoMdifyingfTeext謍:ۍ::::::::::::::::::::::::::::::::::::::::::j400G2.4.8
5CharacterfInput:ۍ:::::::::::::::::::::::::::::::::::::::::%400G2.4.9
5TeerminalfManagemen!t:ۍ:::::::::::::::::::::::::::::::::::410G2.4.10
5Utilit!yfFeunctions:ۍ:::::::::::::::::::::::::::::::::::::::`7410G2.4.11
5MiscellaneousfFeunctionsR:ۍ::::::::::::::::::::::::::::::::P430G2.4.12
5AlternatefIn!terfaceT:ۍ:::::::::::::::::::::::::::::::::::::440G2.4.13
5AfReadlineExamples׍:ۍ::::::::::::::::::::::::::::::::::::45Ǎii33͍0G2.4.14
5AlternatefIn!terfaceExampleB#:ۍ::::::::::::::::::::::::::::j46
33!G2.5
5ReadlinefSignalHandling/O:ۍ:::::::::::::::::::::::::::::::::::::48!G2.6
5CustomfCompleters?:ۍ::::::::::::::::::::::::::::::::::::::::::'510G2.6.1
5Ho!wfCompletingWeorksh&:ۍ::::::::::::::::::::::::::::::::::n510G2.6.2
5CompletionfFeunctionsR:ۍ:::::::::::::::::::::::::::::::::::520G2.6.3
5CompletionfVeariables*ԍ:ۍ::::::::::::::::::::::::::::::::::::530G2.6.4
5AfShortCompletionExample::ۍ::::::::::::::::::::::::::::S5833G]Apps3endixffAwLGNUFfreeDos3cumentationLicenseȓ32e:Q32:	@]67!GConceptffIndex#C32e:Q32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:]75GFfunctionffandVariableIndex;32e:Q32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:	1]76>6e133͍GT1	QCommandzLineEditingnGThisfc!hapterdescribMesthebasicfeaturesofthe<-
3
cmcsc10gnucommandlineeditinginterface.䍍G]1.1Intros3ductionf@toLineEditing33GTheffollo!wingparagraphsdescribMethenotationusedtorepresentkeystrokes.!GTheYtextY=<x
3
cmsltt10C-kisreadas`Con!trol-K'YanddescribMesthec!haracterproMducedwhenthek
33Gk!eyfispressedwhiletheControlkeyisdepressed.!GTheztext{M-kisreadas`Meta-K'oanddescribMesthec!haracterproMducedwhentheMetaGk!ey(ifyouhaveone)isdepressed,
Bandthekk!eyispressed.ԺTheMetak!eyislabMeledALTGon~man!y}keybMoards.OnkeybMoards}withtwo}keyslabMeledALT}(usuallytoeithersideoftheGspacebar),OtheALTontheleftsideisgenerallysettow!orkasaMetak!eye.٩TheALTk!eyonGtheCrigh!tmayalsobMeconguredtoworkasaMetakeyormaybMeconguredassomeotherGmoMdier,fsuc!hasaComposek!eyfortypingaccentedcharacters.!GIf"y!oudonothaveaMetaorALTkeye,oranotherkeyworkingasaMetakeye,theidenticalGk!eystrokejcanjbMegeneratedb!ytypingjESC9':
3
cmti10rst,vandthent!ypingk.EitherproMcessiskno!wnGasf:p0J
3
cmsl10metafying~thekk!eye.!GThetextM-C-kisreadas`Meta-Con!trol-k'anddescribMesthec!haracterproMducedb!yGmetafying~C-k.!GInTaddition,sev!eralTkeyshavetheirownnames.SpMecicallye,DEL,ESC,LFD,SPC,RET,Gand$CTABallstand$Dforthemselv!eswhenseeninthistext,Corinaninitle(seeSection1.3G[ReadlineInitFile],vpage4).cIfy!ourkeybMoardlacksaLFDkeye,vtypingC-jwillproMducetheGdesiredfc!haracter.TheRETkeymaybMelabeledReturnorEnteronsomek!eyboards.䍍G]1.2Readlinef@Interaction33GOften3duringanin!teractive3session2youtypMeinalonglineoftext,onlytonoticethattheGrstw!ordonthelineismisspMelled."TheReadlinelibrarygiv!esyouasetofcommandsforGmanipulatingthetextasy!outypMeitin,ballo!wingyoutojustxy!ourtypMo,bandnotforcingGy!ou`toretypMethe`majorityoftheline.ƹUsing`theseeditingcommands,nyoumovethecursorGtotheplacethatneedscorrection,;Zanddeleteorinsertthetextofthecorrections.CZThen,Gwheny!ouaresatisedwiththeline,cyousimplypressRET.YeoudonothavetobMeattheendGofthelinetopressRET;,theen!tirelineisacceptedregardlessoftheloMcationofthecursorGwithinftheline.卍GgN
#cmbx12g1.2.1d(ReadlineMBareEssentials3GInordertoen!tercharactersintotheline,zsimplytypMethem.~Thet!ypedcharacterappearsGwhereNthecursorOw!as,Handthenthecursormo!vesNonespacetotherigh!t.IfyouNmistypMeaGc!haracter,fyoucanuseyourerasecharactertobackupanddeletethemistypMedcharacter.!GSometimesly!oummaymistypMemacharacter,andnotmnoticetheerrorun!tilyoumhavetypMedGsev!eralwothercharacters.cInthatcase,ByoucantypMeC-btomovethecursorwtotheleft,AandGthenfcorrecty!ourmistake.Afterwards,youcanmovethecursortotherightwithC-f.!GWhen"y!ou!addtextinthemiddleofaline,y!ouwillnoticethatc!haracterstotherigh!tGofqthecursorare`pushedqo!ver'qtomak!eroMomforthetextthatyouqhaveinserted.BLikewise,Gwheny!oudeletetextbMehindthecursor,c!haracterstotherigh!tofthecursorare`pulledJ卟GChapterf1:CommandLineEditingMH233͍Gbac!k'tollintheblankspacecreatedbytheremovdDalofthetext.Alistofthebareessentials
33Gforfeditingthetextofaninputlinefollo!ws.GC-b(Mo!vefbackonecharacter.kʍGC-f(Mo!vefforwardonecharacter.GDELforBackspaceK:Deletefthec!haractertotheleftofthecursor.kˍGC-d(Deletefthec!haracterunderneaththecursor.GPrin!tingfcharactersK:Insertfthec!haracterintothelineatthecursor.GC-_forC-xC-uK:Undojthelasteditingcommand.Yeoucaniundoallthew!ayjbacktoanemptyK:line.G(DepMendingrony!ourconguration,thesBackspacekeybMesettodeletesthecharactertotheGleftZofthecursorandtheZDELk!eysettodeletethecharacterunderneaththecursor,likeGC-d,fratherthanthec!haractertotheleftofthecursor.)8Gg1.2.2d(ReadlineMMovementCommands3GTheSabMo!veStabledescribMesthemostbasick!eystrokesSthatyouneedSinordertodoeditingofGtheinputline.Feory!ourconvenience,	manyothercommandshavebMeenaddedinadditionGto2XC-b,UUC-f,C-d,UTand2YDEL.Herearesomecommandsformo!vingmorerapidlyabMouttheGline.GC-a(Mo!veftothestartoftheline.kˍGC-e(Mo!veftotheendoftheline.kʍGM-f(Mo!vefforwardaword,whereawordiscompMosedoflettersanddigits.GM-b(Mo!vefbackwardaword.GC-l(Clearfthescreen,reprin!tingthecurrentlineatthetop.!GNoticeKho!wLC-fmovesforwardaLcharacter,whileM-fmovesLforwardaword.ItisLaloMoseGcon!ventionthatcon!trolkeystrokesopMerateoncharacterswhilemetakeystrokesopMerateonGw!ords.8Gg1.2.3d(ReadlineMKillingCommands3GKilling text0means0todeletethetextfromtheline,HNbuttosa!ve0ita!way0forlateruse,HNusuallyGb!y<yanking,(re-inserting)itback<intotheline.e(`Cut'and`paste'<aremorerecent<jargonforG`kill'fand`y!ank'.)kˍ!GIfthedescriptionforacommandsa!ysthatit`kills'text,theny!oucanbMesurethaty!ouGcanfgetthetextbac!kinadierent(orthesame)placelater.kʍ!GWhenʛy!ouʜuseakillcommand,thetextissa!vedinʛakill-ring.An!ynumbMerʜofconsecutiveGkills$sa!ve#allofthekilledtexttogether,sothatwheny!ouyankitback,you#getitall.TheGkillringisnotlinespMecic;(thetextthaty!oukilledonapreviouslyt!ypMedlineisa!vdDailableGtofbMey!ankedfbacklater,whenyouaretypinganotherline.\"GChapterf1:CommandLineEditingMH333͍!GHerefisthelistofcommandsforkillingtext.GC-k(Killfthetextfromthecurren!tcursorpMositiontotheendoftheline.GM-d(Kill)fromthe)cursortotheendofthecurren!tword,Bor,BifbMetweenwords,Btothe
33K:endfofthenextw!ord.WeordbMoundariesarethesameasthoseusedbyM-f.GM-DELKillofromthencursorthestartofthecurren!tword,or,ifobMetweennwords,tootheK:startofthepreviousw!ord.WeordbMoundariesarethesameasthoseusedb!yK:M-b.GC-w(Kill4Ufrom4Vthecursortothepreviouswhitespace.Thisisdieren!tthanM-DELK:bMecausefthew!ordboundariesdier.!GHereisho!wtoyankthetextbackintotheline.NYeankingmeanstocopythemost-Grecen!tly-killedftextfromthekillbuer.GC-y(Yeankfthemostrecen!tlykilledtextbackintothebueratthecursor.GM-y(Rotate'!thekill-ring,GPandy!ankthenewtop.`Yeoucan'"onlydothisifthepriorK:commandfisC-yorM-y.}Gg1.2.4d(ReadlineMArguments3GYeoucanpassn!umericargumentstoReadlinecommands.ESometimestheargumen!tactsGasѤarepMeatѣcoun!t,sothertimesitisthesignoftheargumen!tthatissignicant._IfyouGpassanegativ!eargumenttoacommandwhichnormallyactsinaforwarddirection,thatGcommand=willactina=bac!kward=direction.?Feorexample,ctokilltextbac!ktothestartofGthefline,y!oumighttypMe`M--C-k'.!GThebOgeneralbPw!aytobPpassnumericbPargumentstobPacommandistot!ypMemetadigitsbMeforeGthecommand.RIftherst`digit't!ypMedisaminussign(`-'),thenthesignoftheargumentGwillbMenegativ!e.HOnceyouhavetypMedonemetadigittogettheargumen!tstarted,ҒyouGcanvt!ypMevtheremainderofthedigits,pandthenthecommand.Feorexample,ptogiv!etheC-dGcommand~Gan~Hargumen!tof10,@youcould~HtypMe`M-1f0C-d',?which~Hwill~GdeletethenexttenGc!haractersfontheinputline.Gg1.2.5d(SearchingMforCommandsintheHistory3GReadlinepro!videscommandsforsearc!hingthroughthecommandhistoryforlinescon!tainingGafspMeciedstring.Therearet!wofsearchmoMdes:incrementalandnon-incremental.!GIncremen!talsearchesbMeginbeforetheuserhasnishedt!ypingthesearc!hstring.Aseac!hGc!haracter@|ofthesearchstringistypMed,gReadlinedisplaysthenextentryfromthehistoryGmatc!hing+thestringtypMed*sofar.tAnincrementalsearchrequiresonly*asmanycharactersasGneededttotndthedesiredhistoryen!trye.bTosearc!htbackwardintthehistoryforaparticularGstring,0t!ypMecC-r.1TypingC-ssearchesbforwardthroughthebhistorye.2Thec!haracterspresentGin^thevdDalue_oftheisearch-terminatorsvariableareused_toterminateanincremen!talGsearc!h.tIfsthatvdDariablehasnotbMeenassignedavalue,$theESCandC-Jc!haracterswillGterminateCanincremen!talsearch.	3uC-gwillabMortanincrementalDsearchandrestoretheGoriginalxline.άWhenthesearc!histerminated,thehistoryentrycontainingthesearchstringGbMecomesfthecurren!tline.!GTeondothermatc!hingentriesinthehistorylist,typMeC-rorC-sasappropriate.ThisGwill#searc!h#backwardorforward#inthehistoryforthenexten!trymatchingthe#searchstringhGChapterf1:CommandLineEditingMH433͍Gt!ypMed5so4far.IAnyother5keysequence5bMoundtoaReadlinecommandwillterminatethe
33Gsearc!handexecutethatcommand.DFeorinstance,,aRETwillterminatethesearchandacceptGtheline,6thereb!yexecutingthecommandfromthehistorylist.Amo!vementcommandwillGterminatefthesearc!h,makethelastlinefoundthecurrentline,andbMeginediting.^!GReadline.remem!bMersthe.lastincrementalsearchstring.vhIftwoC-rs.aretypMedwithoutGan!yainterveningcharactersadeninganewsearchastring,anyremembMeredasearchstringisGused.]!GNon-incremen!talsearchesreadtheentiresearchstringbMeforestartingtosearchforGmatc!hinghistorylines.	FThesearchstringmaybMetypMedbytheuserorbMepartoftheGcon!tentsfofthecurren!tline.G]1.3Readlinef@InitFile33GAlthoughAtheReadlinelibraryAcomeswithasetofEmacs-lik!ekeybindingsAinstalledb!yGdefault,itKispMossibletouseadieren!tJsetofkeybindings.AnyusercancustomizeprogramsGthatTuseReadlineb!yputtingcommandsinaninputrcle,;conventionallyinhishomeGdirectorye.(TheEnameofthisleistak!enfromthevdDalueoftheenvironmentvdDariableINPUTRC.GIfthatvdDariableisunset,:thedefaultis~/.inputrc.JIfthatledoMesnotexistorcannotbeGread,ftheultimatedefaultis/etc/inputrc.!GWhen\a[programwhic!husestheReadlinelibrarystartsup,*theinitleisread,*andtheGk!eyfbindingsareset.^!GIn8addition,Nthe8C-xfC-rcommandre-readsthisinitle,Nth!usincorpMoratingan!ychangesGthatfy!oumighthavemadetoit.+Gg1.3.1d(ReadlineMInitFileSyntax3GThereoareonlynafewbasicconstructsallo!wedointheReadlineinitle.BlanklinesareGignored.zLinesbMeginningwitha`#'arecommen!ts.yLinesbeginningwitha`$'indicateGconditional0constructs(seeSection1.3.2[Conditional1InitConstructs],Mpage12).;OtherGlinesfdenotevdDariablesettingsandk!eybindings.GVeariablefSettingsK:YeouڽcanmoMdifytherun-timebeha!viorofڼReadlinebyalteringthevdDaluesofK:vdDariablesdineReadlineusingthesetcommandwithintheinitle.Thesyn!taxK:isfsimple:ɍhʏsetvariablevalueȍK:Here,XforE}example,isho!wE|tochangeE|fromthedefaultEmacs-lik!ekeyE}bindingtoK:usefvilineeditingcommands:hʏsetediting-modeviK:Veariable4Ynames4XandvdDalues,Wwhereappropriate,are4YrecognizedwithoutregardK:tofcase.UnrecognizedvdDariablenamesareignored.ɍK:BoMoleanvdDariables(thosethatcanbMesettoonoro)aresettoonifthevdDalueisK:n!ullJorIemptye,on(case-insensitive),or1.AnyothervdDalueIresultsinthevdDariableK:bMeingfsettoo.K:Afgreatdealofrun-timebMeha!viorischangeablewiththefollowingvdDariables.y	GChapterf1:CommandLineEditingMH533͍K:bell-style
33-Con!trolsFwhatFhappMenswhenReadlinew!antstoFringthetermi--nalxzbMell.TIfsetxyto`none',Readlinenev!erringsthebMell.TIfsetto-`visible',
dReadlineeusesdavisiblebMellifoneisa!vdDailable.Ifsetto-`audible'(thedefault),5Readlineattemptstoringtheterminal's-bMell.K:bind-tty-special-chars-If5>set5?to`on'(thedefault),XReadlineattemptstobindthecon!trol-c!haracters{wtreated{vspMeciallybythe{vkernel'sterminaldriver{vtotheir-ReadlinefequivdDalen!ts.K:blink-matching-paren-IfYsetYto`on',Readlineattemptstobrie
ymo!vetheYcursortoan-opMeningparen!thesiswhenaclosingparenthesisisinserted.The-defaultfis`off'.K:colored-completion-prefix-Ifsetto`on',Wwhenlistingcompletions,Readlinedispla!ysthecom--monprexofthesetofpMossiblecompletionsusingadieren!tcolor.-Thecolordenitionsaretak!enfromthevdDalueoftheLS_COLORS-en!vironmentfvdDariable.Thedefaultis`off'.K:colored-stats-If0*set0+to`on',GReadlinedispla!yspMossiblecompletionsusingdieren!t-colorstoindicatetheirlet!ypMe.iThecolordenitionsaretak!en-from;the<vdDalueoftheLS_COLORSen!vironment;vdDariable.Thedefault-isf`off'.K:comment-begin-The}3string}4toinsertatthebMeginningofthelinewhenthe-insert-commentfcommandisexecuted.ThedefaultvdDalueis"#".K:completion-display-width-Then!umbMerofscreencolumnsusedtodispla!ypMossiblematches-when{pMerforming{completion.ϤThevdDalueisignoredifitislessthan-0%8orgreaterthan%9theterminalscreenwidth.A%vdDalueof0willcause-matc!hesftobMedisplayedonepMerline.ThedefaultvdDalueis-1.K:completion-ignore-case-IfIsetIto`on',\WReadlinepMerformslenamematc!hingandcompletion-infacase-insensitiv!efashion.ThedefaultvdDalueis`off'.K:completion-map-case-Ifsetto`on',vandcompletion-ignore-caseGisenabled,Readlinetreats-h!yphense(`-')andunderscores(`_')asequivdDalentwhenpMerforming-case-insensitiv!eZlenameZmatchingandZcompletion.	Thedefault-vdDaluefis`off'.K:completion-prefix-display-length-TheŒlength‹inc!haractersofthecommonprexofalistofpMossible-completionsSthatRisdispla!yedSwithoutmoMdication.ցWhensettoa	GChapterf1:CommandLineEditingMH633͍-vdDaluegreaterthanzero,0hcommonprexeslongerthanthisvdDalueare
33-replacedfwithanellipsiswhendispla!yingpMossiblecompletions.oK:completion-query-items-The%n!umbMer%ofpossiblecompletions%thatdetermineswhentheuser-is
ask!edwhetherthelistofpMossibilitiesshouldbedispla!yed.	AIf-the|1n!umbMer|2ofpossiblecompletionsis|2greaterthanorequaltothis-vdDalue,^<ReadlineFwillEaskwhetherornottheuserwishestoview-them;otherwise,\theyaresimplylisted.\ThisvdDariablem!ustbMeset-toYanZin!tegervdDaluegreaterthanorequalto0.Anegativ!evdDalue-meansfReadlineshouldnev!erask.Thedefaultlimitis100.nK:convert-meta-Ifsetto`on',Readlinewillcon!vertcharacterswiththeeighthbitset-toanasci>Kik!eysequencebystrippingtheeighthbitandprexing-anESCc!haracter,convertingthemtoameta-prexedk!eysequence.-TheNdefaultNvdDalueis`on',`FbutwillbMesetto`off'iftheloMcaleisone-thatfcon!tainseight-bitcharacters.K:disable-completion-Ifgsettog`On',?Readlinewillginhibitw!ordcompletion.Completion-c!haracters!willbMe!insertedintothelineasif!theyhadbMeenmapped-tofself-insert.Thedefaultis`off'.K:echo-control-characters-Whensetto`on',onopMeratingsystemsthatindicatetheysuppMort-it,readlineec!hoMesacharactercorrespMondingtoasignalgenerated-fromfthek!eybMoard.Thedefaultis`on'.K:editing-mode-Therediting-modevdDariablecon!trolswhichrdefaultsetofkeybind--ings?is>used.&Bydefault,#ReadlinestartsupinEmacseditingmoMde,-where~the~k!eystrokesare~mostsimilartoEmacs.ПThisvdDariablecan-bMefsettoeither`emacs'or`vi'.nK:emacs-mode-string-Ifthesho!w-moMde-in-promptIvdDariableisenabled,&Kthisstringisdis--pla!yedRimmediatelyQbMeforethelastlineoftheprimarypromptwhen-emacsTeditingUmoMdeisactiv!e.,ThevdDalueisexpandedlik!eak!eybind--ing,,sothestandardsetofmeta-andcon!trolprexesandbac!kslash-escapMe?sequencesisa!vdDailable.&Usethe`\1'and@`\2'escapestobegin-andendsequencesofnon-prin!tingcharacters,whichcanbMeused-tozem!bMedzaterminalcon!trolsequenceintozthemoMdestring.[)The-defaultfis`@'.K:enable-bracketed-paste-Whensetto`On',{Readlinewillconguretheterminalinaw!aythat-willg"enableittoinserteac!hpasteg#intotheeditingbuerasasingle-stringofc!haracters,>insteadoftreatingeachcharacterasifithad-bMeenreadfromthek!eyboard.Thiscanprev!entpastedcharacters-fromfbMeingin!terpretedaseditingcommands.Thedefaultis`On'.GChapterf1:CommandLineEditingMH733͍K:enable-keypad
33-Whensetto`on',mReadlinewilltrytoenabletheapplicationk!eypad-when1it1iscalled.Somesystemsneedthistoenablethearro!wkeys.-Thefdefaultis`off'.oK:enable-meta-key-WhenJsetIto`on',Readlinewilltrytoenablean!ymetamoMdier-k!eytheterminalclaimstosuppMortwhenitiscalled.Onman!y-terminals,^=the9ymetak!eyisusedtosendeight-bitcharacters.The-defaultfis`on'.nK:expand-tilde-IfPsettoP`on',a[tildeexpansionispMerformedwhenReadlineattempts-w!ordfcompletion.Thedefaultis`off'.K:history-preserve-point-Ifsetto`on',ZthehistorycoMdeattemptstoplacethepMoin!t(the-curren!t;kcursor;jpMosition)atthesameloMcationoneac!hhistoryline-retriev!ed^withprevious-historyor^next-history.Thedefault-isf`off'.K:history-size-Setthemaxim!umnumbMerofhistoryen!triessavedinthehistory-list.Ifmsettozero,(oan!yexistinghistoryentriesarendeletedandno-newqen!triesarepsaved.XIfsetqtoavdDalueplessthanzero,ٳthenumbMer-ofhistoryen!triesisnotlimited.Bydefault,then!umbMerofhistory-en!triesbisnotalimited.Ifanattemptismadetosethistory-sizeito-anon-n!umericvdDalue,VthemaximumnumbMerofhistoryentrieswill-bMefsetto500.K:horizontal-scroll-mode-ThisNvdDariableNcanbMesettoeither`on'or`off'.
Settingitto`on'-means$jthatthetextofthe$ilinesbMeingeditedwillscrollhorizon!tally-onasinglescreenlinewhentheyarelongerthanthewidthofthe-screen,VinsteadBofwrappingon!toBanewscreenline.ThisvdDariableis-automaticallysetto`on'forterminalsofheigh!t1.Bydefault,this-vdDariablefissetto`off'.nK:input-meta-Ifsetto`on',Readlinewillenableeigh!t-bitinput(itwillnotclear-the"eigh!thbitin!thecharactersitreads),
Pregardlessofwhatthe-terminalC-claimsitcansuppMort.	3ThedefaultvdDalueis`off',^but-Readlineۂwillsetitto`on'ہiftheloMcalecon!tainseight-bitcharacters.-Thefnamemeta-flagisasynon!ymforthisvdDariable.K:isearch-terminators-The5string5ofc!haractersthatshouldterminateanincremen!tal-searc!h|withoutsubsequentlyexecutingthecharacterasacommand-(seeZSection1.2.5[Searc!hing],page3).	IfthisvdDariablehasnot-bMeenBggiv!enavdDalue,igthecharactersBfESCandC-Jwillterminatean-incremen!talfsearch.GChapterf1:CommandLineEditingMH833͍K:keymapRSetsTReadline'sideaoftheUcurren!tkeymapforkeybinding
33-commands.Built-inTkeymapUnamesareemacs,+emacs-standard,-emacs-meta,0emacs-ctlx,vi,0vi-move,vi-command,and-vi-insert.
2viaisequivdDalen!ttovi-command(vi-moveaisalsoa-synon!ym);aemacsis
equivdDalentto
emacs-standard.Applications-ma!yaddadditionalnames.ThedefaultvdDalueisemacs.ThevdDalue-offtheediting-modevdDariablealsoaectsthedefaultk!eymap.oK:keyseq-timeout-SpMeciesthedurationReadlinewillw!aitforacharacterwhenread--inganam!biguouskeysequence(onethatcanformacompletek!ey-sequence-using.theinputreadsofar,orcantak!eadditionalinput-toKcompletealongerk!eysequence).ČIfnoinputisreceivedwithin-the*timeout,Readline*willusetheshorterbutcompletek!eyse--quence.ReadlineusesthisvdDaluetodeterminewhetherornotinput-isa!vdDailableonthecurren!tinputsource(rl_instreamb!ydefault).-The	vdDalueisspMeciedinmilliseconds,(soavalueof1000meansthat-Readlinewillw!aitonesecondforadditionalinput.RIfthisvdDariableis-setYtoYavdDaluelessthanorequaltozero,i.ortoanon-n!umericvdDalue,-Readlinewillw!aituntilanotherkeyispressedtodecidewhic!hkey-sequenceftocomplete.ThedefaultvdDalueis500.nK:mark-directories-Ifsetto`on',completeddirectorynamesha!veaslashappMended.-Thefdefaultis`on'.K:mark-modified-lines-ThisNvdDariable,xwhensetto`on',xcausesReadlinetodispla!yanas--terisk(`*')atthestartofhistorylineswhic!hhavebMeenmodied.-ThisfvdDariableis`off'b!ydefault.K:mark-symlinked-directories-If$set$to`on',mcompletednameswhic!haresym!bMoliclinksto-directories\ha!veaslashappMended\(subjecttothevdDalueof-mark-directories).Thefdefaultis`off'.K:match-hidden-files-ThissvdDariable,ݣwhensetto`on',causesReadlinetormatc!hleswhose-namesMbMeginwitha`.'(hiddenles)whenperforminglename-completion.Ifsetto`off',Jtheleading`.'m!ustbMesuppliedby-theLuserMinthelenametobMecompleted.9ThisvdDariableis`on'b!y-default.nK:menu-complete-display-prefix-Ifsetto`on',men!ucompletiondisplaysthecommonprexofthe-listXofYpMossiblecompletions(whic!hmayYbMeempty)YbMeforecycling-throughfthelist.Thedefaultis`off'.K:output-meta-IfAsetto`on',gReadlinewilldispla!ycharacterswiththeeighthbit-set`!directlyratherthanasa`"meta-prexedescapMesequence.The	0GChapterf1:CommandLineEditingMH933͍-defaultkis`off',0butReadlinewillsetittoj`on'iftheloMcalecon!tains
33-eigh!t-bitfcharacters.-K:page-completions-Ifsetto`on',,Readlineusesanin!ternalmore-likepagertodisplay-ascreenfulofpMossiblecompletionsatatime.ThisvdDariableis`on'-b!yfdefault.K:print-completions-horizontally-Ifsetto`on',Readlinewilldispla!ycompletionswithmatc!hessorted-horizon!tally8inalphabMeticalorder,oratherthandownthescreen.-Thefdefaultis`off'.K:revert-all-at-newline-Ifsetto`on',Readlinewillundoallc!hangestohistorylinesbMefore-returningqXwhenqYaccept-lineisexecuted.-Bydefault,{historylines-ma!ybMemodiedandretainindividualundolistsacrosscallsto-readline.Thefdefaultis`off'.,K:show-all-if-ambiguous-This]altersthedefaultbMeha!viorofthe\completionfunctions.مIfset-toL`on',^.w!ordswhichL havemorethanL onepMossiblecompletioncause-thematc!hestobMelistedimmediatelyinsteadofringingthebell.-ThefdefaultvdDalueis`off'.K:show-all-if-unmodified-ThisaltersthedefaultbMeha!viorofthecompletionfunctionsina-fashionsimilartosho!w-all-if-ambiguous.Ifsetto`on',-w!ordswhich-ha!vemorethanonepMossiblecompletionwithoutan!ypossiblepar--tialcompletion(thepMossiblecompletionsdon'tshareacommon-prex)causethematc!hestobMelistedimmediatelyinsteadofring--ingfthebMell.ThedefaultvdDalueis`off'.K:show-mode-in-prompt-Ifsetto`on',addastringtothebMeginningofthepromptindicating-theeditingmoMde:emacs,`vicommand,orviinsertion.ޛThemoMde-stringsrareruser-settable(e.g.,emacs-moMde-string).
BYThedefault-vdDaluefis`off'.K:skip-completed-text-Ifjsetto`on',+thisialtersthedefaultcompletionbMeha!viorwhenin--serting}=a}<singlematc!hintothe}<line.%It'sonlyactive}<whenpMerform--ing'completion'inthemiddleofaw!ord.bdIfenabled,HHreadlinedoMes-not.insert-c!haractersfromthecompletionthatmatc!hcharacters-afterlpMoin!tinthelwordbMeingcompleted,*solportionsofthew!ord-follo!wingthecursorarenotduplicated.TFeorinstance,ifthisisen--abled,*0attemptingܢcompletionwhenthecursorisafterthe`e'in-`Makefile'willresultin`Makefile'ratherthan`Makefilefile',-assuming<thereisasinglepMossible<completion.ThedefaultvdDalue-isf`off'.
fGChapterf1:CommandLineEditingӮ1033͍K:vi-cmd-mode-string
33-Ifthesho!w-moMde-in-promptIvdDariableisenabled,&Kthisstringisdis--pla!yedRimmediatelyQbMeforethelastlineoftheprimarypromptwhen-vi:editingmoMdeisactiv!eandincommandmode.YThevdDalueisex--panded:mlik!ea:lkeybinding,Psothestandardsetof:lmeta-andcontrol-prexes3and3bac!kslashescapMesequencesisa!vdDailable.HUsethe`\1'-and`\2'escapMestobeginandendsequencesofnon-prin!tingcharac--ters,whic!hcanbMeusedtoembMedaterminalcontrolsequenceinto-thefmoMdestring.Thedefaultis`(cmd)'.΍K:vi-ins-mode-string-Ifthesho!w-moMde-in-promptIvdDariableisenabled,&Kthisstringisdis--pla!yedRimmediatelyQbMeforethelastlineoftheprimarypromptwhen-vi5editing5moMdeisactiv!eandininsertionmoMde.QThevdDalueisex--panded:mlik!ea:lkeybinding,Psothestandardsetof:lmeta-andcontrol-prexes3and3bac!kslashescapMesequencesisa!vdDailable.HUsethe`\1'-and`\2'escapMestobeginandendsequencesofnon-prin!tingcharac--ters,whic!hcanbMeusedtoembMedaterminalcontrolsequenceinto-thefmoMdestring.Thedefaultis`(ins)'.K:visible-stats-Ifvsetto`on',ac!haracterdenotingwale'stypMeisappendedtothe-lenamefwhenlistingpMossiblecompletions.Thedefaultis`off'.GKeyfBindingsK:Thesyn!taxforcontrolling keybindingsintheinitleissimple.		FirstyouK:needQtondQthenameofthecommandthaty!ouwanttoQchange.ThefollowingK:sectionsOcon!tainOtablesofthecommandname,yLthedefaultk!eybinding,yMifanye,K:andfashortdescriptionofwhatthecommanddoMes.K:OncePy!ouPknowthenamePofthecommand,{simplyplaceonalineintheinitK:lethenameofthek!eyyouwishtobindthecommandto,$'acolon,andthenK:thenameofthecommand.TherecanbMenospacebMet!weenthekeynameandK:thecolon{thatwillbMein!terpretedaspartofthekeyname.ThenameofK:the$k!eycanbMe$expressedindierentways,DxdepMendingon$whatyoundmostK:comfortable.K:InSadditionStocommandnames,<readlineallo!wskeystoSbMeboundtoSastringK:thatfisinsertedwhenthek!eyispressed(amacro).K:k!eyname:function-nameCmorfmacro-k!eynamejistcthenametdofakeyspMelledoutinEnglish.2Feorexample:Control-u:universal-argumentMeta-Rubout:backward-kill-wordControl-o:">output"-In\the\exampleabMo!ve,
JSC-u\isboundto\thefunction-universal-argument,|M-DEL
&is
%bMoundtothefunction-backward-kill-word,	andiLC-oiKisbMoundtorunthemacro-expressed~Jonthe~Irigh!thandside(thatis,Btoinsertthetext`>-output'fin!totheline).ύGChapterf1:CommandLineEditingӮ1133͍-Anbn!umbMero[ofsym!bolicc!haracternamesarerecognizedwhile
33-proMcessing3thisk!eybindingsyntax:%wDEL,&ESC,ESCAPE,LFD,-NEWLINE,fRET,RETURN,R!UBOUT,SPeACE,SPC,andTeAB.#׍K:"k!eyseq@":function-nameCmorfmacro-k!eyseqdiersfromkeynameVabMoveinthatstringsdenotinganen--tirehk!eysequencecanbMegspecied,%bygplacinghthekeysequencein-doublequotes.bSomegnuEmacsst!ylekeyescapMescanbeused,as-inthefollo!wingexample,(butthespMecialc!haracternamesarenot-recognized.+"\C-u":universal-argument"\C-x\C-r":re-read-init-file"\e[11~":"FunctionKey1"-IntheabMo!veexample,C-uisagainboundtothefunction-universal-argument?(justasitw!asintherst?example),=`C-x-C-r'isbMoundtothefunctionre-read-init-file,&and`ESCf[11-~'fisbMoundtoinsertthetext`FunctionKey1'.#؍K:Thefollo!winggnuEmacsstyleescapMesequencesareavdDailablewhenspMecifyingK:k!eyfsequences:#׍K:\C-(con!trolfprexK:\M-(metafprexK:\e.QanfescapMec!haracterK:\\.Qbac!kslashK:\".Q",fadoublequotationmarkK:\'.Q',fasinglequoteorapMostropheK:InQadditiontoQthegnuEmacsst!yleescapMesequences,b)asecondsetofbac!kslash
33K:escapMesfisa!vdDailable:K:\a.Qalertf(bMell)K:\b.Qbac!kspaceK:\d.QdeleteK:\f.QformffeedK:\n.QnewlineK:\r.QcarriagefreturnK:\t.Qhorizon!talftabK:\v.Qv!erticalftabK:\nnn"Kthe$eigh!t-bitcharacter$whosevdDalueistheoMctalvalue$nnn(oneto
33-threefdigits)K:\xHH"Ktheeigh!t-bitcharacterwhosevdDalueisthehexadecimalvdDalueHH-(onefort!wofhexdigits)ԋGChapterf1:CommandLineEditingӮ1233͍K:When}en!teringthetextofamacro,singleordoublequotesmustbMeusedto
33K:indicateamacrodenition.?UnquotedtextisassumedtobMeafunctionname.?InK:themacrobModye,~thebac!kslashescapesdescribedabo!veareexpanded.BackslashK:willquotean!yothercharacterinthemacrotext,including`"'and`''.RFeorK:example,4 thefollo!wingbindingwillmake`C-xf\'insertasingle`\'in!totheline:L͍hʏ"\C-x\\":"\\"34Gg1.3.2d(ConditionalMInitConstructs3GReadlineiimplemen!tsafacilitysimilarinispirittotheconditionalcompilationfeaturesofGtheJCHpreproMcessorKwhic!hallowsKkeybindingsandKvdDariablesettingstobMeperformedKastheGresultfoftests.Therearefourparserdirectiv!esused.G$if(TheN$ifconstructallo!wsbindingstobMeOmadebasedontheeditingmode,ʈtheK:terminal[bMeing[used,JortheapplicationusingReadline.hThetextofthetest,K:after\an!y[comparisonopMerator,extendstotheendoftheline;_unlessotherwiseK:noted,fnoc!haractersarerequiredtoisolateit.fgK:mode"KThemode=formofthe$ifdirectiv!eisusedtotestwhetherRead--line3isin3emacsorvimoMde.	Thisma!ybe3usedinconjunction-with the`setfkeymap'command,for!instance,to setbindingsin-theemacs-standardandemacs-ctlxk!eymapsonlyifReadlineis-startingfoutinemacsmoMde.K:term"KThe<term=form<ma!ybMeusedtoincludeterminal-spMecick!eybind--ings,pMerhapsVtobindVthek!eysequencesoutputb!ytheterminal's-functionހk!eys.;Thewordontherightsideofthe`='istestedagainst-bMothPthefullnameoftheOterminalandtheportionoftheterminal-namebMeforetherst`-'./Thisallo!wssuntomatc!hbMothsunand-sun-cmd,fforinstance.fhK:versionMThe^@version^Atestma!ybMeusedtopMerformcomparisonsagainst-spMecic6Readlinev!ersions.MTheversionexpandstothecurrent-Readlinev!ersion.TThesetofcomparisonopMeratorsincludes`='(and-`=='),`!=',`<=',`>=',`<',andִ`>'.nThev!ersionnumbMersuppliedon-therigh!tsideoftheopMeratorconsistsofamajorv!ersionnumbMer,-anuoptionaludecimalpMoin!t,andanoptionalminorv!ersion(e.g.,-`7.1').IfRutheRtminorv!ersionisomitted,c?itisassumedtobMe`0'.The-opMeratorma!ybeseparatedfromthestringversionandfromthe-v!ersionnumbMerargumentbywhitespace.Thefollowingexample-setsfavdDariableiftheReadlinev!ersionbMeingusedis7.0ornewer:L͍$ifversion>=7.0setshow-mode-in-prompton$endifK:application-Theapplicationconstructisusedtoincludeapplication-spMecicset--tings.mEac!hprogramusingtheReadlinelibrarysetstheapplication-name,wand<y!oucan;testforaparticularvdDalue.$ThiscouldbMeusedto-bindDk!eysequencestofunctionsusefulforCaspMecicprogram.wFeor
ݕGChapterf1:CommandLineEditingӮ1333͍-instance,thefollo!wingcommandaddsakeysequencethatquotes
33-thefcurren!torpreviouswordinBash:33$ifBash#Quotethecurrentorpreviousword"\C-xq":"\eb\"\ef\""$endif33K:variableӣTheVvdDariable]constructpro!videssimpleUequalitytestsforReadline-vdDariablesgandhvalues.UThepMermittedhcomparisonoperatorshare`=',-`==',ۢandj`!='.
*oThejvdDariablenamem!ustbMeseparatedfromthe-comparison&opMeratorb!y'whitespace;4theoperator'ma!ybeseparated-fromptheqvdDalueontherigh!thandsidebyqwhitespace.!Bothstring-andfbMooleanvdDariablesma!ybetested.nBooleanvdDariablesm!ustbe-testedjEagainstthevdDaluesonando.
)zThefollo!wingexampleis-equivdDalen!tftothemode=emacstestdescribMedabo!ve:$ifediting-mode==emacssetshow-mode-in-prompton$endif33G$endifRThiscommand,(asseeninthepreviousexample,)terminatesan$ifcommand.G$elseCommandsfinthisbranc!hofthe$ifdirectiveareexecutedifthetestfails.G$includeӣThis:directiv!e:takesasinglelename:asanargumentand:readscommands
33K:andbindingsfromthatle.Feorexample,#thefollo!wingdirectivereadsfromK:/etc/inputrc:hʏ$include/etc/inputrcGg1.3.3d(SampleMInitFile3GHere,is,anexampleofaninputrcle.[Thisillustratesk!eybinding,E-vdDariableassignment,E-andGconditionalfsyn!tax.:GChapterf1:CommandLineEditingӮ1433.#Thisfilecontrolsthebehaviouroflineinputeditingfor
33.#programsthatusetheGNUReadlinelibrary.TExisting.#programsincludeFTP,Bash,andGDB..#.#Youcanre-readtheinputrcfilewithC-xC-r..#Linesbeginningwith'#'arecomments..#.#First,includeanysystem-widebindingsandvariable.#assignmentsfrom/etc/Inputrc.$include/etc/Inputrcff.#.#Setvariousbindingsforemacsmode..setediting-modeemacs.$ifmode=emacs.Meta-Control-h:Tbackward-kill-wordTextafterthefunctionnameisignoredn	 .#.#Arrowkeysinkeypadmode.#.#"\M-OD":-Pbackward-char.#"\M-OC":-Pforward-char.#"\M-OA":-Pprevious-history.#"\M-OB":-Pnext-history.#.#ArrowkeysinANSImode.#."\M-[D":-Pbackward-char."\M-[C":-Pforward-char."\M-[A":-Pprevious-history."\M-[B":-Pnext-history.#.#Arrowkeysin8bitkeypadmode.#.#"\M-\C-OD":(=backward-char.#"\M-\C-OC":(=forward-char.#"\M-\C-OA":(=previous-history.#"\M-\C-OB":(=next-history.#.#Arrowkeysin8bitANSImode.#.#"\M-\C-[D":(=backward-char.#"\M-\C-[C":(=forward-char󤍟GChapterf1:CommandLineEditingӮ1533͍.#"\M-\C-[A":(=previous-history
33.#"\M-\C-[B":(=next-historyff.C-q:quoted-insert.$endif.#Anold-stylebinding.TThishappenstobethedefault..TAB:complete.#Macrosthatareconvenientforshellinteraction.$ifBash.#editthepath."\C-xp":"PATH=${PATH}\e\C-e\C-a\ef\C-f".#preparetotypeaquotedword--.#insertopenandclosedoublequotes.#andmovetojustaftertheopenquote."\C-x\"":"\"\"\C-b".#insertabackslash(testingbackslashescapes.#insequencesandmacros)."\C-x\\":"\\".#Quotethecurrentorpreviousword."\C-xq":"\eb\"\ef\"".#Addabindingtorefreshtheline,whichisunbound."\C-xr":redraw-current-line.#Editvariableoncurrentline.."\M-\C-v":"\C-a\C-k$\C-y\M-\C-e\C-a\C-y=".$endif.#useavisiblebellifoneisavailable.setbell-stylevisible.#don'tstripcharactersto7bitswhenreading.setinput-metaon.#allowiso-latin1characterstobeinsertedrather.#thanconvertedtoprefix-metasequences.setconvert-metaoff.#displaycharacterswiththeeighthbitsetdirectly.#ratherthanasmeta-prefixedcharacters.setoutput-metaon.#ifthereare150ormorepossiblecompletionsforaword,.#askwhetherornottheuserwantstoseeallofthem.setcompletion-query-items150jGChapterf1:CommandLineEditingӮ1633͍.#ForFTP
33.$ifFtp."\C-xg":"get\M-?"."\C-xt":"put\M-?"."\M-.":yank-last-arg.$endif)G]1.4Bindablef@ReadlineCommands33GThis\section[describMesReadlinecommandsthatma!ybMebound\tok!eysequences.CommandGnamesfwithoutanaccompan!yingkeysequenceareunbMoundbydefault.N!GIn%Xthe%Wfollo!wingdescriptions,?'pMointbXrefers%Wtothecurren!tcursorpMosition,?'andmark\refersGtoAacursorBpMositionsa!vedAbytheset-markBcommand.nThetextbMetweenBthepMointandGmarkfisreferredtoastheregion.Gg1.4.1d(CommandsMFģorMovingGbeginning-of-linef(C-a)K:Mo!veftothestartofthecurren!tline.NGend-of-linef(C-e)K:Mo!veftotheendoftheline.NGforward-charf(C-f)K:Mo!vefforwardacharacter.Gbackward-charf(C-b)K:Mo!vefbackacharacter.NGforward-wordf(M-f)K:Mo!vekforwardtojtheendofthenextword.܉WeordsarecompMosedjoflettersandK:digits.Gbackward-wordf(M-b)K:Mo!vebacktothestartofthecurrentorpreviousword.|WeordsarecompMosedK:offlettersanddigits.Gprevious-screen-linef()K:A!ttempt@tomovepMointtothesame?physicalscreencolumnonthepreviousK:ph!ysicalscreenline.Thiswillnotha!vethedesiredeectifthecurren!tReadlineK:lineGdoMesnotGtak!eupmorethanonephysicalGlineorifpMointisGnotgreaterthanK:theflengthofthepromptplusthescreenwidth.NGnext-screen-linef()K:A!ttemptitohmovepMointhtothesameph!ysicalscreencolumnonthenextph!ysicalK:screenBline.|ThiswillAnotha!veBthedesiredeectifthecurren!tReadlinelinedoMesK:notEtak!eupmorethanonephysicallineEorifthelengthofthecurrentReadlineK:linefisnotgreaterthanthelengthofthepromptplusthescreenwidth.Gclear-displayf(M-C-l)K:Clearthescreenand,LifpMossible,Ktheterminal'sscrollbac!kbuer,Lthenredra!wK:thefcurren!tline,leavingthecurrentlineatthetopofthescreen.GChapterf1:CommandLineEditingӮ1733͍Gclear-screenf(C-l)
33K:Clear"the"screen,Athenredra!wthecurren!tline,Aleavingthe"currentline"attheK:topfofthescreen.kGredraw-current-linef()K:Refreshfthecurren!tline.Bydefault,thisisunbMound.8Gg1.4.2d(CommandsMFģorManipulatingTheHistoryύGaccept-linef(NewlineorReturn)K:Accept:thelineregardlessof:wherethecursoris.Ifthislineisnon-empt!ye,^itK:ma!y0bMe1addedtothehistorylistforfuturerecallwithadd_history().g=IfthisK:linefisamoMdiedhistoryline,thehistorylineisrestoredtoitsoriginalstate.Gprevious-historyf(C-p)K:Mo!vef`back'throughthehistorylist,fetchingthepreviouscommand.Gnext-historyf(C-n)K:Mo!vef`forward'throughthehistorylist,fetchingthenextcommand.Gbeginning-of-historyf(M-<)K:Mo!veftotherstlineinthehistorye.jGend-of-historyf(M->)K:Mo!veftotheendoftheinputhistorye,i.e.,thelinecurren!tlybMeingentered.Greverse-search-historyf(C-r)K:Searc!h:backwardstarting;atthecurrentlineandmoving;`up'throughthehis-K:tory$as$necessarye.Thisisanincremen!talsearch.This$commandsetstheregionK:tofthematc!hedtextandactivdDatesthemark.Gforward-search-historyf(C-s)K:Searc!h>Dforwardstartingatthecurrent>Clineandmoving`down'throughtheK:historyasnecessarye.Thisisanincremen!talsearch.ThiscommandsetstheK:regionftothematc!hedtextandactivdDatesthemark.Gnon-incremental-reverse-search-historyf(M-p)K:Searc!h:backwardstarting;atthecurrentlineandmoving;`up'throughthehis-K:toryRyasnecessaryusingRxanon-incremen!talsearchforastringRxsuppliedbytheK:user.Thefsearc!hstringmaymatchanywhereinahistoryline.Gnon-incremental-forward-search-historyf(M-n)K:Searc!h>Dforwardstartingatthecurrent>Clineandmoving`down'throughtheK:history3as3necessaryusinganon-incremen!talsearchfor3astringsuppliedb!ytheK:user.Thefsearc!hstringmaymatchanywhereinahistoryline.Ghistory-search-forwardf()K:Searc!hOforwardthroughPthehistoryforthestringofc!haractersbMetweentheK:startQofQthecurren!tlineandthepMoin!t.
ThesearchQstringmustmatchQattheK:bMeginning"ofahistoryline.Thisisanon-incremen!talsearch.Bydefault,thisK:commandfisun!bMound.Ghistory-search-backwardf()K:Searc!h-backward-throughthehistoryforthestringofc!haractersbMetween-theK:startQofQthecurren!tlineandthepMoin!t.
ThesearchQstringmustmatchQatthe
GChapterf1:CommandLineEditingӮ1833͍K:bMeginning"ofahistoryline.Thisisanon-incremen!talsearch.Bydefault,this
33K:commandfisun!bMound.Ghistory-substring-search-forwardf()K:Searc!hOforwardthroughPthehistoryforthestringofc!haractersbMetweentheK:startuofuthecurren!tlineandthepMoin!t.ͳThesearchstringmayumatchanywhereK:in"ahistoryline.Thisisanon-incremen!talsearch.Bydefault,thiscommandK:isfun!bMound.Ghistory-substring-search-backwardf()K:Searc!h-backward-throughthehistoryforthestringofc!haractersbMetween-theK:startuofuthecurren!tlineandthepMoin!t.ͳThesearchstringmayumatchanywhereK:in"ahistoryline.Thisisanon-incremen!talsearch.Bydefault,thiscommandK:isfun!bMound.‘Gyank-nth-argf(M-C-y)K:Insertsthesrstargumen!ttothepreviouscommand(usuallythesecondw!ordK:on|the}previousline)atpMoin!t.h!Withanargumen!tn,insertthenthw!ordfromK:the0previouscommand(thew!ordsin0thepreviouscommandbMeginwithwordK:0).-dAnegativ!eargumentinsertsthenthw!ordfromtheendofthepreviousK:command.OnceGtheargumen!tFniscomputed,
>theargumentisextractedFasifK:thef`!n'historyexpansionhadbMeenspecied.Gyank-last-argf(M-.orM-_)K:Insert5Elast5Fargumen!ttothepreviouscommand(thelastw!ordofthepreviousK:history"en!try).Witha#numericargument, bMehaveexactly#likeyank-nth-arg.K:Successiv!e%calls&toyank-last-argmove&backthrough&thehistorylist,insertingK:thelastw!ord(orthewordspMeciedbytheargumenttotherstcall)ofeac!hlineK:in`turn.An!ynumeric`argumentsuppliedto`thesesuccessive`callsdeterminesK:the-Idirection-Jtomo!vethrough-Ithehistorye.rA-'negative-Iargumentswitches-ItheK:directionthroughthehistory(bac!korforw!ard).ThehistoryexpansionfacilitiesK:areMusedtoMextractthelastargumen!t,_asifthe`!$'historyexpansionhadbMeenK:spMecied.Goperate-and-get-nextf(C-o)K:Accept~tthecurren!tlineforreturntothe~ucallingapplicationasifanewlinehadK:bMeenen!tered,andfetchthenextȿlinerelativetothecurrentlineȿfromthehistoryK:forediting.~An!umericargument,ifsupplied,spMeciesthehistoryen!trytouseK:insteadfofthecurren!tline.]Gg1.4.3d(CommandsMFģorChangingTextz⍑Gend-of-filef(usuallyC-d)K:The%c!haracter%indicatingend-of-leasset,?bforexample,b!y%stty.Ifthisc!harac-K:terisreadwhentherearenoc!haractersontheline,andpMointisatthebMeginningK:offtheline,Readlinein!terpretsitastheendofinputandreturnseof.Gdelete-charf(C-d)K:Deletethec!haracteratpMoint.IfthisfunctionisbMoundtothesamecharacterK:asfthett!yeofcharacter,asC-dcommonlyis,seeabMovefortheeects.GChapterf1:CommandLineEditingӮ1933͍Gbackward-delete-charf(Rubout)
33K:Deletethec!haracterbMehindthecursor.۝AnumericargumentmeanstokilltheK:c!haractersfinsteadofdeletingthem.:Gforward-backward-delete-charf()K:Deletethec!haracterunderthecursor,unlessthecursorisattheendoftheK:line,~inͭwhic!hͬcasethecharacterͬbMehindthecursorisdeleted.SBydefault,~thisK:isfnotbMoundtoak!eye.Gquoted-insertf(C-qorC-v)K:Addthenextc!haractertypMedtothelineverbatim.CThisishowtoinsertkeyK:sequencesflik!eC-q,forexample.:Gtab-insertf(M-TAB)K:Insertfatabc!haracter.Gself-insertf(a,b,A,1,!,...e)K:Insertfy!ourself.Gbracketed-paste-beginf()K:This6function7isin!tendedtobMeboundto7the"brac!ketedpaste"escapMe6sequenceK:sen!tbysometerminals,andsuchabindingisassignedb!ydefault.mItallowsK:Readlinetoinsertthepastedtextasasingleunitwithouttreatingeac!hchar-K:acterasifithadbMeenreadfromthek!eybMoard._ThecharactersareinsertedK:asLPifLOeac!honew!asbMoundtoself-insertinsteadofexecutingan!yeditingK:commands.܍K:Brac!ketedU`pasteU_setstheregion(thec!haractersbMetweenU_pointU`andU_themark)K:totheinsertedtext.Itusestheconceptofanactive̚mark-:|whenthemarkK:is5activ!e,XReadlineredisplayusesthe5terminal'sstandoutmoMdetodenotetheK:region.Gtranspose-charsf(C-t)K:Dragthec!haracterbMeforethecursorforwardoverthecharacteratthecursor,K:mo!vingC"thecursorC!forwardaswell.IftheinsertionC!pMointisattheC!endoftheK:line,thenthistranspMosesthelastt!wocharactersoftheline.Negativ!eargumentsK:ha!vefnoeect.Gtranspose-wordsf(M-t)K:Dragthew!ordbMeforepoin!tpastthewordafterpMoint,movingpointpastthatK:w!ordgaswell.IftheinsertionpMointisattheendofthegline,tAthistranspMosestheK:lastft!wowordsontheline.:Gupcase-wordf(M-u)K:UppMercasethecurren!t(orfollowing)word.o#Withanegativeargument,uppMer-K:casefthepreviousw!ord,butdonotmovethecursor.Gdowncase-wordf(M-l)K:Lo!wercasethecurrent(orfollowing)word.Withanegativeargument,˖lowercaseK:thefpreviousw!ord,butdonotmovethecursor.Gcapitalize-wordf(M-c)K:Capitalize6the5curren!t(orfollo!wing)word.#With5anegativeargument,rcapitalizeK:thefpreviousw!ord,butdonotmovethecursor.$lGChapterf1:CommandLineEditingӮ2033͍Goverwrite-modef()
33K:Teoggleo!verwritemoMde.	Withanexplicitpositiv!e numericargument,

switchesK:too!verwritemoMde.fWithanexplicitnon-pMositiv!enumericargument,ϮswitchestoK:insertmoMde.=ThiscommandaectsonlyemacsmoMde;vimodedoeso!verwriteK:dieren!tlye.Eachfcalltoreadline()startsininsertmoMde.$K:InIo!verwritemoMde,charactersbMoundtoself-insertIreplacethetextatK:pMoin!tratherthanpushingthetexttotheright.CharactersbMoundtoK:backward-delete-charfreplacethec!haracterbMeforepoin!twithaspace.#K:Byfdefault,thiscommandisun!bMound.9⍍Gg1.4.4d(KillingMAndYģankingP$Gkill-linef(C-k)K:KillthetextfrompMoin!ttotheendoftheline.3NWithanegativ!enumericargu-K:men!t,fkillbackwardfromthecursortothebMeginningofthecurrentline.mGbackward-kill-linef(C-xRubout)K:Killbac!kwardfromthecursortothebMeginningofthecurrentline.Q(WithaK:negativ!emnumericargument,rkillforwardfromthecursortotheendoftheK:curren!tfline.mGunix-line-discardf(C-u)K:Killfbac!kwardfromthecursortothebMeginningofthecurrentline.Gkill-whole-linef()K:Killcjallc!haracterscionthecurrentline,nomatterwherepMointis.Bydefault,K:thisfisun!bMound.mGkill-wordf(M-d)K:KillfrompMoin!ttotheendofthecurren!tword,PorifbMetweenwords,QtotheendK:offthenextw!ord.WeordbMoundariesarethesameasforward-word.Gbackward-kill-wordf(M-DEL)K:Killwtheww!ordbMehindpoin!t.XWeordwboundariesarewthesameasbackward-word.mGshell-transpose-wordsf(M-C-t)K:Dragthew!ordbMeforepoin!tpastthewordafterpMoint,movingpointpastthatK:w!ordgaswell.IftheinsertionpMointisattheendofthegline,tAthistranspMosestheK:lastt!wowordsontheline.WeordbMoundariesarethesameasshell-forward-K:wordfandshell-backward-word.Gunix-word-ruboutf(C-w)K:KillLthew!ordbMehindpoin!t,usingwhitespaceasawordbMoundarye.RThekilledK:textfissa!vedfonthekill-ring.mGunix-filename-ruboutf()K:Kill]thew!ordbMehindpoin!t,usingwhitespaceandtheslashcharacterastheK:w!ordfbMoundaries.Thekilledtextissavedonthekill-ring.Gdelete-horizontal-spacef()K:DeletefallspacesandtabsaroundpMoin!t.Bydefault,thisisunbMound.0ԍGChapterf1:CommandLineEditingӮ2133͍Gkill-regionf()
33K:Killfthetextinthecurren!tregion.Bydefault,thiscommandisunbMound.TGcopy-region-as-killf()K:Cop!ythetextintheregiontothekillbuer,0EsoitcanbMey!ankedrightawaye.K:Byfdefault,thiscommandisun!bMound.UGcopy-backward-wordf()K:Cop!ythewordbMeforepoin!ttothekillbuer.ThewordbMoundariesaretheK:samefasbackward-word.Bydefault,thiscommandisun!bMound.Gcopy-forward-wordf()K:Cop!y8thewordfollowing9pMointtothekillbuer.SThe9wordbMoundariesaretheK:samefasforward-word.Bydefault,thiscommandisun!bMound.Gyankf(C-y)K:Yeankfthetopofthekillringin!tothebueratpMoint.Gyank-popf(M-y)K:Rotate'!thekill-ring,GPandy!ankthenewtop.`Yeoucan'"onlydothisifthepriorK:commandfisyankoryank-pop.O"Gg1.4.5d(SpiecifyingMNumericArgumentsÍGdigit-argumentf(M-0,M-1,...M--)K:Add:Lthis:Kdigittotheargumen!talreadyaccumulating,Oorstarta:Knewargument.K:M--fstartsanegativ!eargument.UGuniversal-argumentf()K:Thiskisanotherw!ayjtokspMecifyanargumen!t.Ifthiscommandisfollo!wedkbyoneK:ormoredigits,optionallywithaleadingmin!ussign,thosedigitsdenethear-K:gumen!t.If[the\commandisfollowedbydigits,*executinguniversal-argumentK:againѫendsѪthen!umericargument,{butisotherwiseѪignored._AsaspMecialcase,K:ifthiscommandisimmediatelyfollo!wedbyacharacterthatisneitheradigitK:normin!ussign,H{theargumentcountforthenextcommandismultipliedbyK:four.The6argumen!t6countisinitially6one,ZsoexecutingthisfunctiontherstK:timeomak!esotheargumentocountfour,z&aosecondtimemak!estheargumen!tcountK:sixteen,fandsoon.Bydefault,thisisnotbMoundtoak!eye.O!Gg1.4.6d(LettingMReadlineTypieFģorYouGcompletef(TAB)K:A!ttempttopMerformcompletiononthetextbMeforepoin!t.	TheactualcompletionK:pMerformedfisapplication-specic.Thedefaultislenamecompletion.UGpossible-completionsf(M-?)K:List)the)pMossiblecompletionsofthetextbMeforepoin!t.gWhendisplaying)com-K:pletions,fReadlinesetsthen!umbMerofcolumnsusedfordispla!ytothevdDalueofK:completion-display-width,UtheavdDalueoftheen!vironmentavariableCOLUMNS,K:orfthescreenwidth,inthatorder.TGinsert-completionsf(M-*)K:InsertallcompletionsofthetextbMeforepoin!tthatwouldhavebMeengeneratedK:b!yfpossible-completions.<⍟GChapterf1:CommandLineEditingӮ2233͍Gmenu-completef()
33K:SimilarVtocomplete,butreplacesthew!ordtoWbMecompletedwithasinglematchK:fromthelistofpMossiblecompletions.^Repeatedexecutionofmenu-completeK:stepsկthroughհthelistofpMossiblecompletions,!insertingeac!hmatchհinturn.K:A!tjtheendofjthelistofcompletions,thebMellisrung(subjecttothesettingK:ofThbell-style)andtheTioriginaltextisrestored.Anargumen!tofnmo!vesThnK:pMositions,Rforw!ard,Qinthelistofmatc!hes;oGanegative,QargumentmaybMe,QusedtoK:mo!vebackwardthroughthelist.VThiscommandisintendedtobMeboundtoK:TAB,fbutisun!bMoundbydefault.Gmenu-complete-backwardf()K:Iden!tical5atomenu-complete,Ybut5`movesbackwardthroughthe5`listofpMossibleK:completions,fasifmenu-completehadbMeengiv!enanegativeargument.Gdelete-char-or-listf()K:Deletesthec!haracterunderthecursorifnotatthebMeginningorendoftheK:line(lik!edelete-char).4Ifattheendoftheline,bMeha!vesidenticallytoK:possible-completions.Thisfcommandisun!bMoundbydefault.TGg1.4.7d(KeybioardMMacrost^Gstart-kbd-macrof(C-x()K:Beginfsa!vingthecharacterstypMedintothecurrentkeybMoardmacro.Gend-kbd-macrof(C-x))K:StopG!sa!vingthecharactersG"typMedintothecurrentkeybMoardmacroG"andsavetheK:denition.Gcall-last-kbd-macrof(C-xe)K:Re-execute9Bthelast9Ck!eybMoardmacrodened,]bymakingthe9CcharactersintheK:macrofappMearasift!ypedatthek!eyboard.Gprint-last-kbd-macrof()K:Prin!tfthelastkebMoardmacrodenedinaformatsuitablefortheinputrcPjle.TGg1.4.8d(SomeMMiscellaneousCommandst^Gre-read-init-filef(C-xC-r)K:Readkinthejcon!tentskoftheinputrcJole,andincorpMoratean!ybindingsorvdDariableK:assignmen!tsffoundthere.Gabortf(C-g)K:AbMort/the/curren!teditingcommandandringtheterminal'sbMell(subjecttotheK:settingfofbell-style).Gdo-lowercase-versionf(M-A,M-B,M-x,...e)K:If4themetaed4c!haracterxisuppMercase,X:runthecommandthatisbMoundtoK:theUcorrespMondingTmetaedlo!wercaseUcharacter.ͩThebMehaviorUisundenedifK:xgisfalreadylo!werfcase.Gprefix-metaf(ESC)K:Metafy2the1nextc!haractertypMed.q@This2isfork!eybMoardswithoutametak!eye.K:T!ypingf`ESCf'isequivdDalenttotypingM-f.IGChapterf1:CommandLineEditingӮ2333͍Gundof(C-_orC-xC-u)
33K:Incremen!talfundo,separatelyremembMeredforeachline.Grevert-linef(M-r)K:Undoallc!hangesmadetothisline.ThisislikeexecutingtheundocommandK:enoughftimestogetbac!ktothebMeginning.Gtilde-expandf(M-~)K:P!erformftildeexpansiononthecurrentword.Gset-markf(C-@)K:SetthemarktothepMoin!t.Ifanumericargumentissupplied,ythemarkissetK:tofthatpMosition.Gexchange-point-and-markf(C-xC-x)K:Sw!apthepMointwiththemark.'"ThecurrentcursorpMositionissettothesavedK:pMosition,fandtheoldcursorpositionissa!vedfasthemark.Gcharacter-searchf(C-])K:A&c!haracterQisRreadandpMointRismovedtoRthenextoMccurrenceofthatc!haracter.K:Afnegativ!ecountsearchesforpreviousoMccurrences.Gcharacter-search-backwardf(M-C-])K:Ac"c!haracterciscreadandpMoin!tismovedctothepreviousoMccurrenceofthatK:c!haracter.AfnegativecountsearchesforsubsequentoMccurrences.Gskip-csi-sequencef()K:ReadGenoughc!haractersGtoconsumeamulti-keysequencesuchGasthosedenedK:forzk!eyslikezHomeandEnd.[SuchsequencesbMeginwithzaControlSequenceK:IndicatorfM(CSI),usuallyfLESC-[.IfthisfMsequenceisbMoundfLto"\e[",Fk!eyspro-K:ducing։suc!hsequenceswillֈhavenoeectunlessexplicitlybMoundֈtoareadlineK:command,insteadXofinsertingstra!ycharactersintotheeditingWbuer.gThisisK:un!bMoundfbydefault,butusuallybMoundtoESC-[.Ginsert-commentf(M-#)K:WithoutGaGn!umericargument,p*thevdDalueGofthecomment-beginvdDariableisin-K:sertedatthebMeginningofthecurren!tline.QdIfanumericargumentissupplied,K:thisccommandactsasatoggle:Yifcthec!haractersatthebMeginningofthelineK:donotmatc!hthevdDalueofcomment-begin,Ythevalueisinserted,YotherwisetheK:c!haracters6incomment-beginare5deletedfromthebMeginningoftheline.dMInK:eitherfcase,thelineisacceptedasifanewlinehadbMeent!yped.Gdump-functionsf()K:Prin!t,Qall,Pofthefunctionsandtheirk!eybindingstotheReadlineoutputstream.K:Ifan!umericargumentissupplied,theoutputisformattedinsuc!hawaythatK:itfcanbMemadepartofaninputrcPjle.Thiscommandisun!boundb!ydefault.Gdump-variablesf()K:Prin!tallofthesettablevdDariablesandtheirvaluestotheReadlineoutputstream.K:Ifan!umericargumentissupplied,theoutputisformattedinsuc!hawaythatK:itfcanbMemadepartofaninputrcPjle.Thiscommandisun!boundb!ydefault.UGChapterf1:CommandLineEditingӮ2433͍Gdump-macrosf()
33K:Prin!t
allofthe
ReadlinekeysequencesbMoundtomacros
andthestringstheyK:output.rIf-Jan!umericargumentis-Ksupplied,Otheoutputisformattedinsuc!haK:w!aythatitcanbMemadepartofaninputrcDle.Thiscommandisun!bMoundbyK:default.33Gemacs-editing-modef(C-e)K:WhenfinvicommandmoMde,thiscausesaswitc!htoemacseditingmode.Gvi-editing-modef(M-C-j)K:WhenfinemacseditingmoMde,thiscausesaswitc!htovieditingmode.G]1.5Readlinef@viMos3deGWhile`theReadline_librarydoMesnotha!ve`afullsetofvieditingfunctions,itdoMescon!tainGenoughtoallo!wsimpleeditingoftheline..TheReadlinevimoMdebeha!vesasspMeciedinGthefposixstandard.33!GIn|Uorder|Vtoswitc!hinteractively|UbMetweenemacs|UandvieditingmoMdes,usethecommandGM-C-ji(bMoundjtoemacs-editing-modewheninjvimodeandtojvi-editing-modeinemacsGmoMde).ThefReadlinedefaultisemacsmode.!GWheny!ouenteralineinvimoMde,youarealreadyplacedin`insertion'moMde,asifyouGhadt!ypMedan`i'.PressingESCswitchesyouinto`command'moMde,(whereyoucanedittheGtextofthelinewiththestandardvimo!vementkeys,);movetoprevioushistorylineswithG`k'fandsubsequen!tlineswith`j',andsoforth.b\2533͍GT2	QProgrammingzwithGNUReadline]GThis c!hapterdescribMestheinterfacebMetweenthegnuReadlineLibraryandotherprograms.
33GIf}y!ouareaprogrammer,andyouwishtoincludethefeaturesfoundingnuReadlinesuchGascompletion,llineediting,andin!teractivehistorymanipulationiny!ourownprograms,lthisGsectionfisfory!ou.󍍑G]2.1Basicf@Behavior33GMan!yprogramsprovideacommandlineinterface,suchasmail,ftp,andsh.FeorsuchGprograms,xthemFdefaultbMeha!viourofReadlineissucient.ThissectiondescribMeshowtouseGReadline!tinthe!usimplestw!ay!tpMossible,@8perhapstoreplace!ucallsiny!ourcode!utogets()orGfgets().!GThefunctionreadline()prin!tsapromptprompt%andthenreadsandreturnsasingleGlineoftextfromtheuser.Ifprompt*isNULLortheempt!ystring,xnopromptisdisplayed.GTheu}lineu|readlinereturnsisalloMcatedwithmalloc();thecallershouldfree()thelineGwhenfithasnishedwithit.ThedeclarationforreadlineinANSICis.char*readline(constchar*prompt);GSo,fonemigh!tsay.char*line=readline("Enteraline:");Ginordertoreadalineoftextfromtheuser.Thelinereturnedhasthenalnewlineremo!ved,
33Gsofonlythetextremains.!GIfreadlineencoun!tersanEOFwhilereadingtheline,*^andthelineisemptyatthatGpMoin!t,^then(charf*)NULLisreturned.oOtherwise,thelineisendedjustasifanewlinehadGbMeenft!yped.!GReadlineZpMerformssomeexpansiononthepromptZbeforeitisdispla!yedZonthescreen.SeeGthe@descriptionofrl_expand_prompt(seeSection2.4.6@[Redispla!y],Upage38)foradditionalGdetails,
espMeciallyPifpromptPwillcon!taincharactersOthatdonotconsumephysicalscreenGspacefwhendispla!yed.!GIf=Ay!ouwant=BtheusertobMeabletogetatthelinelater,RI(withC-pforexample),y!oumustGcallfadd_history()tosa!vefthelinea!wayfinahistory~listofsuc!hlines..add_history(line);GFeorffulldetailsontheGNUHistoryLibrary,seetheassoMciatedman!ual.!GItÍispreferabletoa!voidÌsavingÍemptylinesonthehistorylist,sinceusersrarelyhavea
33Gburning4needto5reuseablankline.Hereisafunctionwhic!husefullyreplacesthestandardGgets()flibraryfunction,andhastheadvdDan!tageofnostaticbuertoover
ow:./*Astaticvariableforholdingtheline.*/.staticchar*line_read=(char*)NULL;ff./*Readastring,andreturnapointertoit.@8ReturnsNULLonEOF.*/.char*.rl_gets().{iIGChapterf2:ProgrammingwithGNUReadlineʗ2633͍:x/*Ifthebufferhasalreadybeenallocated,
33Kreturnthememorytothefreepool.*/:xif(line_read)ED{Qwfree(line_read);Qwline_read=(char*)NULL;ED}ff:x/*Getalinefromtheuser.*/:xline_read=readline("");:x/*Ifthelinehasanytextinit,Ksaveitonthehistory.*/:xif(line_read&&*line_read)EDadd_history(line_read);:xreturn(line_read);.}֍!GThis`functiongiv!estheuserthedefaultbMehaviourofTABcompletion:completiononleGnames.Ify!oudonotwantReadlinetocompleteonlenames,youcanchangethebindingGofftheTABk!eywithrl_bind_key().Ս.intrl_bind_key(intkey,rl_command_func_t*function);!Grl_bind_key()tak!estwoarguments:?keyisthecharacterthatyouwanttobind,andGfunctionistheaddressofthefunctiontocallwhenk!eyispressed.XBindingTABtorl_Ginsert()wmak!esxTABinsertitself.rl_bind_key()returnsnon-zeroifk!eyisnotavdDalidGASCIMIfc!haractercode(bet!weenf0and255).Ս!GTh!us,ftodisablethedefaultTABbMehavior,thefollowingsuces:.rl_bind_key('\t',rl_insert);!GThis+coMdeshould+beexecutedonceat+thestartofy!ourprogram;T,youmight+writeafunc-
33Gtioncalledinitialize_readline()whic!hpMerformsthisandotherdesiredinitializations,Gsuc!hfasinstallingcustomcompleters(seeSection2.6[CustomCompleters],page51).􍍑G]2.2Customf@Ffunctions33GReadlineEpro!videsmanyfunctionsforEmanipulatingthetextoftheline,Y3butitisn'tpMossibleGtodcan!ticipatethedbneedsofallprograms.ThissectiondescribMesthevdDariousfunctionsandGvdDariables"denedwithinthe"Readlinelibrarywhic!hallowauser"programtoaddcustomizedGfunctionalit!yftoReadline.Ս!GBeforeadeclaringaan!yfunctionsthatcustomizeReadline'sbMeha!vior,orusingan!yfunc-Gtionalit!yxQReadlinexRprovidesinxRothercoMde,anapplicationwritershouldincludetheleG<readline/readline.h>inan!ylethatusesReadline'sfeatures.?Sincesomeofthede-Gnitionsinreadline.husethestdiolibrarye,ċthele<stdio.h>shouldbMeincludedbMeforeGreadline.h.!Greadline.h2denes3aC1preproMcessorvdDariablethatshouldbMetreatedasanin!teger,RL_GREADLINE_VERSION,whic!h(maybMeusedtoconditionallycompileapplicationcodedependinguߍGChapterf2:ProgrammingwithGNUReadlineʗ2733͍Gon4theinstalled4Readlinev!ersion.ThevdDalueisahexadecimalencoMdingofthemajorand
33GminorPv!ersionnumbMersOofthelibrarye,8oftheform0xMMmm.<MMJisthet!wo-digitPmajorGv!ersionz.numbMer;mmz-isthetwo-digitz-minorversionnumbMer.FeorReadline4.2,forexample,GthefvdDalueofRL_READLINE_VERSIONw!ouldbMe0x0402.34Gg2.2.1d(ReadlineMTypiedefs3GFeorfreadabilit!y,w!edeclareanumbMerofnewobjecttypMes,allpoin!terstofunctions.fg!GTheIreasonIfordeclaringthesenewt!ypMesistomak!eiteasiertowritecoMdedescribingGpMoin!tersftoCfunctionswithappropriatelyprototypMedargumentsandreturnvdDalues.ff!GFeorminstance,sa!ymwewantmtodeclareavdDariablefuncasapMoin!tertoafunctionwhic!hGtak!estwointargumentsandreturnsanint(thisisthet!ypMeofalloftheReadlinebindableGfunctions).InsteadfoftheclassicCdeclaration!Gintf(*func)();GorftheANSI-Cst!yledeclaration!Gintf(*func)(int,int);ffGw!efmaywrite!Grl_command_func_tf*func;!GTheffulllistoffunctionpMoin!tertypMesavdDailableisGtypedeffintrl_command_func_t(int,int);Gtypedeffchar*rl_compentry_func_t(constchar*,int);Gtypedeffchar**rl_completion_func_t(constchar*,int,int);Gtypedeffchar*rl_quote_func_t(char*,int,char*);Gtypedeffchar*rl_dequote_func_t(char*,int);Gtypedeffintrl_compignore_func_t(char**);Gtypedeffvoidrl_compdisp_func_t(char**,int,int);Gtypedeffintrl_hook_func_t(void);Gtypedeffintrl_getc_func_t(FILE*);Gtypedeffintrl_linebuf_func_t(char*,int);Gtypedeffintrl_intfunc_t(int);G#definefrl_ivoidfunc_trl_hook_func_tGtypedeffintrl_icpfunc_t(char*);Gtypedeffintrl_icppfunc_t(char**);Gtypedeffvoidrl_voidfunc_t(void);Gtypedeffvoidrl_vintfunc_t(int);Gtypedeffvoidrl_vcpfunc_t(char*);Gtypedeffvoidrl_vcppfunc_t(char**);Gg2.2.2d(WģritingMaNewFunction3GInordertowritenewfunctionsforReadline,3y!ouneedtokno!wthecallingcon!ventionsforGk!eybMoard-invokedfunctions,\andthenamesofthevdDariablesthatdescribMethecurren!tstateGoffthelinereadsofar.!GThefcallingsequenceforacommandfooloMokslik!e.intfoo(intcount,intkey)GChapterf2:ProgrammingwithGNUReadlineʗ2833͍GwherePgcoun!tfisthePfnumericargumentPf(or1ifdefaulted)andk!ey@~isthek!eythatin!voked
33Gthisffunction.,!GItiscompletelyuptothefunctionastowhatshouldbMedonewiththen!umericargument.GSome;functionsuseitasarepMeatcoun!t,psome:asa
ag,andotherstoc!hoMosealternateGbMeha!vior4(refreshing4thecurrent4lineasoppMosedtorefreshingthescreen,forexample).GSomec!hoMosetoignoreit.Ingeneral,ifafunctionusesthen!umericargumentasarepMeatGcoun!t,ititZ7shouldbMeZ8abletodosomethingusefulwithbMothnegativ!eandpMositiv!earguments.GA!tftheveryleast,itshouldbMeawarethatitcanbMepassedanegativeargument.!GAcommandfunctionshouldreturn0ifitsactioncompletessuccessfullye,gandavdDalueGgreaterthanzeroifsomeerroroMccurs.ȿThisisthecon!ventionobMeyedbyallofthebuiltinGReadlinefbindablecommandfunctions.v(G]2.3Readlinef@Vfariables33GThesefvdDariablesarea!vailabletofunctionwriters.&3[Veariable]G@<x
cmtt10@charL*rl_line_buffer.Thisisthelinegatheredsofar.$Yeouarew!elcometomoMdifythecon!tentsoftheline,.butDqseeDrSection2.4.5[Allo!wingUndoing],kpage37.Thefunctionrl_extend_line_.bufferfisa!vdDailabletoincreasethememoryalloMcatedtorl_line_buffer.3[Veariable]G@intLrl_point.Thefosetofthecurren!tcursorpMositioninrl_line_buffer(theppoint	).3[Veariable]G@intLrl_end.TheY6n!umbMerofY5characterspresentinrl_line_buffer."Whenrl_pointisY5attheend.offtheline,rl_pointandrl_endareequal.&3[Veariable]G@intLrl_mark.Thenmark(sa!vedpMosition)inthencurrentline.6Ifset,themarkandpMointndenea.rpegion.3[Veariable]G@intLrl_done.Settingthistoanon-zerovdDaluecausesReadlinetoreturnthecurren!tlineimmediatelye.3[Veariable]G@intLrl_num_chars_to_read.SettingthistoapMositiv!evdDaluebMeforecallingreadline()causesReadlinetoreturn.afterHacceptingthatman!yHcharacters,q}ratherHthanreadinguptoac!haracterbMound.tofaccept-line.3[Veariable]G@intLrl_pending_input.SettingthistoavdDaluemak!esitthenextkeystrokeread.Thisisawaytostuasingle.c!haracterfintotheinputstream.3[Veariable]G@intLrl_dispatching.SetWtoVanon-zerovdDalueifafunctionisbMeingcalledfromak!eybinding;'zerootherwise..ApplicationJOfunctionscantestthistodisco!verJOwhethertheyw!erecalleddirectlyor.b!yfReadline'sdispatchingmechanism.⍟GChapterf2:ProgrammingwithGNUReadlineʗ2933͍3[Veariable]G@intLrl_erase_empty_line
33.Settingthistoanon-zerovdDaluecausesReadlinetocompletelyerasethecurren!t.line,L[includingan!yprompt,an!ytimeanewlineistypMedastheonlycharacteron.an\
otherwise-empt!yline.Thecursorismovedtothe\bMeginningofthenewly-blank.line.3[Veariable]G@charL*rl_prompt.The#=promptReadlineuses.%Thisis#>setfromtheargumen!ttoreadline(),=yandshould.not:^bMeassignedto:]directlye.Therl_set_prompt()function(seeSection2.4.6[Redis-.pla!y],fpage38)maybMeusedtomodifythepromptstringaftercallingreadline().3[Veariable]G@charL*rl_display_prompt.Thestringdispla!yedastheprompt.Z=Thisisusuallyiden!ticaltorl>xHtprompt,9butma!y.bMe[c!hangedtemporarilyb!yfunctionsthatusethepromptstringasamessagearea,.suc!hfasincrementalsearch.3[Veariable]G@intLrl_already_prompted.If\Xanapplicationwishes\Wtodispla!ythepromptitself,ratherthanha!ve\XReadlinedo.it9thersttimereadline()iscalled,mitshouldsetthisvdDariabletoanon-zerovalue.afterdispla!yingtheprompt.ThepromptmustalsobMepassedastheargumen!tto.readline()	sotheredispla!yfunctionscanupMdatethedisplaypropMerlye.Thecalling.applicationfisrespMonsibleformanagingthevdDalue;Readlinenev!ersetsit.3[Veariable]G@constLchar*rl_library_version.Thefv!ersionnumbMerofthisrevisionofthelibrarye.3[Veariable]G@intLrl_readline_version.Anin!tegerencoMdingthecurren!tversionofthelibrarye.4bTheencoMdingisoftheform.0xMMmm,wherebMMvisbthet!wo-digitbmajorv!ersionnumbMer,andmmbisthetwo-.digit{minor{v!ersionnumbMer.]Feorexample,
for{Readline-4.2,rl_readline_version.w!ouldfhavethevdDalue0x0402.3[Veariable]G@intLrl_gnu_readline_p.Alw!aysfsetto1,denotingthatthisisgnureadlineratherthansomeem!ulation.3[Veariable]G@constLchar*rl_terminal_name.The_terminal_t!ypMe,mKusedforinitialization.Ifnotsetb!ytheapplication,mJReadlinesets.thisftothevdDalueoftheTERMen!vironmentfvariablethersttimeitiscalled.3[Veariable]G@constLchar*rl_readline_name.ThisvdDariableissettoauniquenameb!yeachapplicationusingReadline.)4ThevdDalue.allo!ws]wconditionalparsing]voftheinputrcle(seeSection1.3.2[ConditionalInitCon-.structs],fpage12).3[Veariable]G@FILEL*rl_instream.Thestdiostreamfromwhic!hReadlinereadsinput.*IfNULL,?FReadlinedefaultsto.stdin.3[Veariable]G@FILEL*rl_outstream.The#Rstdio#Qstreamtowhic!hReadlinepMerformsoutput.TIfNULL,BReadlinedefaultsto.stdout.荟GChapterf2:ProgrammingwithGNUReadlineʗ3033͍3[Veariable]G@intLrl_prefer_env_winsize
33.Ifh non-zero,tReadlinegiv!esvdDaluesfoundinthehLINESandCOLUMNSenvironmentvdDari-.ablesgreaterprecedencethanvdDaluesfetc!hedfromthekernelwhencomputingthe.screenfdimensions.fg3[Veariable]G@rl_command_func_tL*rl_last_func.The-)addressofthelastcommandfunctionReadline-*executed.r&Ma!ybMeusedtotest.whetherfornotafunctionisbMeingexecutedt!wiceinsuccession,forexample.fh3[Veariable]G@rl_hook_func_tL*rl_startup_hook.Ifnon-zero,>thisistheaddressofafunctiontocalljustbMeforereadlineprin!tsthe.rstfprompt.3[Veariable]G@rl_hook_func_tL*rl_pre_input_hook.IfCnon-zero,k9thisCistheaddressofafunctiontocallaftertherstprompthasbMeen.prin!tedfandjustbMeforereadlinestartsreadinginputcharacters.3[Veariable]G@rl_hook_func_tL*rl_event_hook.Ifnon-zero,0thisistheaddressofafunctiontocallpMeriodicallywhenReadlineis.w!aiting*forterminal)input.Bydefault,this*willbMecalledatmosttentimesasecond.iffthereisnok!eybMoardinput.3[Veariable]G@rl_getc_func_tL*rl_getc_function.IfWnon-zero,ReadlinewillcallindirectlythroughthispMoin!tertogetacharacterfrom.theinputstream.EBydefault,itissettorl_getc,thedefaultReadlinec!haracterinput.function(seeSection2.4.8[CharacterInput],page40).Ingeneral,anapplicationthat.setsfrl>xHtgetc>xHfunctionshouldconsidersettingrl>xHinput>xHa!vdDailable>xHhoMokPjasw!ell.fh3[Veariable]G@rl_hook_func_tL*rl_signal_event_hook.If>non-zero,Sthisis>theaddressofafunctiontocallifareadsystemcallisin!terrupted.whenfReadlineisreadingterminalinput.3[Veariable]G@rl_hook_func_tL*rl_input_available_hook.Ifznon-zero,Readlinezwillusethisfunction'sreturnvdDaluewhenitneedstodetermine.whetherornotthereisa!vdDailableinputonthecurrentinputsource.	8LThedefault.hoMok
#c!hecks
$rl_instream;@:ifanapplicationisusingadieren!tinputsource,+itshould.setthehoMokappropriatelye.vReadlinequeriesfora!vdDailableinputwhenimplemen!ting.in!tra-key-sequencecStimeoutsduringinputandincremen!talsearches.ǂThismayusean.application-spMecictimeoutbeforereturningavdDalue;ReadlineusesthevdDaluepassedto.rl_set_keyboard_input_timeout()9or:thevdDalueoftheuser-settablek!eyseq-timeout.vdDariable.Thisuistdesignedforuseb!yapplicationsusingReadline'scallbac!kinterface.(seeRSectionS2.4.12[AlternateIn!terface],page44),whic!hRmaynotRusethetraditional.read(2)Kandledescriptorin!terface,,Corotherapplicationsusingadierentinput.mec!hanism.LIfqanapplicationusesaninputmechanismorhoMokthatcanpoten!tially.exceeddthevdDalueofdk!eyseq-timeout,itshouldincreasethetimeoutorsetthishoMok.appropriatelyev!enwhennotusingthecallbac!kinterface.wIngeneral,anapplication.thatfsetsrl>xHtgetc>xHfunctionfshouldconsidersettingrl>xHtinput>xHa!vdDailable>xHhoMokPjasfwell.GChapterf2:ProgrammingwithGNUReadlineʗ3133͍3[Veariable]G@rl_voidfunc_tL*rl_redisplay_function
33.IfSnon-zero,~ReadlinewillcallindirectlythroughthisSpMoin!tertoupdatethedispla!y.with=thecurren!t=contents=oftheeditingbuer.Bydefault,Ritissettorl_redisplay,.thefdefaultReadlineredispla!yfunction(seeSection2.4.6[Redisplay],page38).`3[Veariable]G@rl_vintfunc_tL*rl_prep_term_function.Ifnon-zero,	ReadlinewillcallindirectlythroughthispMoin!tertoinitializetheterminal..Theufunctiontak!esausingleargument,Ganint
agthatsayswhetheruornottouse.eigh!t-bitcharacters.5Bydefault,5athisissettorl_prep_terminal(seeSection2.4.9.[TeerminalfManagemen!t],page41)._3[Veariable]G@rl_voidfunc_tL*rl_deprep_term_function.Ifeynon-zero,>ReadlineezwillcallindirectlythroughthispMoin!tertoresettheterminal..This4functionshouldundo4theeectsofrl_prep_term_function.YBydefault,Xthis.isfsettorl_deprep_terminal(seeSection2.4.9[TeerminalManagemen!t],page41).3[Veariable]G@KeymapLrl_executing_keymap.ThisROvdDariableRNissettothek!eymap(seeSection2.4.2[Keymaps],}Hpage34)inwhic!h.thefcurren!tlyexecutingreadlinefunctionwasfound.3[Veariable]G@KeymapLrl_binding_keymap.ThisROvdDariableRNissettothek!eymap(seeSection2.4.2[Keymaps],}Hpage34)inwhic!h.theflastk!eybindingoMccurred.3[Veariable]G@charL*rl_executing_macro.ThisfvdDariableissettothetextofan!ycurrently-executingmacro._3[Veariable]G@intLrl_executing_key.Thefk!eythatcausedthedispatchtothecurrently-executingReadlinefunction.3[Veariable]G@charL*rl_executing_keyseq.TheCfullk!eyCsequencethatcausedthedispatchtoCthecurrently-executingReadline.function.3[Veariable]G@intLrl_key_sequence_length.Thefn!umbMerofcharactersinrl>xHtexecuting>xHk!eyseq.3[Veariable]G@intLrl_readline_state.A#vdDariable#with#bitvalues#thatencapsulatethecurren!tReadlinestate.VA#bitisset.withtheRL_SETSTATEmacro,ǓandunsetwiththeRL_UNSETSTATEmacro.Usethe.RL_ISSTATEzmacrotoztestwhetheraparticularstatebitisset.XCurren!tstatebits.include:.RL_STATE_NONEhʏReadlinefhasnoty!etbMeencalled,norhasitbeguntoinitialize.ʍ.RL_STATE_INITIALIZINGhʏReadlinefisinitializingitsin!ternaldatastructures.ɍ.RL_STATE_INITIALIZEDhʏReadlinefhascompleteditsinitialization. IGChapterf2:ProgrammingwithGNUReadlineʗ3233͍.RL_STATE_TERMPREPPED
33hʏReadliner[hasmoMdiedtheterminalmodestodoitso!wninputandredis-hʏpla!ye.ij.RL_STATE_READCMDhʏReadlinefisreadingacommandfromthek!eybMoard.ii.RL_STATE_METANEXThʏReadlinefisreadingmoreinputafterreadingthemeta-prexc!haracter..RL_STATE_DISPATCHINGhʏReadlinefisdispatc!hingtoacommand..RL_STATE_MOREINPUThʏReadlinefisreadingmoreinputwhileexecutinganeditingcommand.ii.RL_STATE_ISEARCHhʏReadlinefispMerforminganincremen!talhistorysearch..RL_STATE_NSEARCHhʏReadlinefispMerforminganon-incremen!talhistorysearch..RL_STATE_SEARCHhʏReadlinepispsearc!hingbackwardorpforwardthroughpthehistoryforastring.ii.RL_STATE_NUMERICARGhʏReadlinefisreadingan!umericargument..RL_STATE_MACROINPUThʏReadlineiscurren!tlygettingitsinputfromapreviously-denedk!eybMoardhʏmacro.ii.RL_STATE_MACRODEFhʏReadlinefiscurren!tlyreadingcharactersdeningakeybMoardmacro..RL_STATE_OVERWRITEhʏReadlinefisino!verwritefmoMde..RL_STATE_COMPLETINGhʏReadlinefispMerformingw!ordcompletion.ii.RL_STATE_SIGHANDLERhʏReadlinefiscurren!tlyexecutingthereadlinesignalhandler..RL_STATE_UNDOINGhʏReadlinefispMerforminganundo..RL_STATE_INPUTPENDINGhʏReadlinefhasinputpMendingduetoacalltorl_execute_next().ii.RL_STATE_TTYCSAVEDhʏReadlinefhassa!vedfthevdDaluesoftheterminal'sspMecialc!haracters..RL_STATE_CALLBACKhʏReadline+is+curren!tlyusingthealternate(callbac!k)interface+(seeSec-hʏtionf2.4.12[AlternateIn!terface],page44).!ÈGChapterf2:ProgrammingwithGNUReadlineʗ3333͍.RL_STATE_VIMOTION
33hʏReadlinefisreadingtheargumen!ttoavi-moMde"motion"command.c.RL_STATE_MULTIKEYhʏReadlinefisreadingam!ultiple-keystrokefcommand.d.RL_STATE_VICMDONCEhʏReadlinehasen!teredvicommand(mo!vement)moMdeatleastonetimehʏduringfthecurren!tcalltoreadline()..RL_STATE_DONEhʏReadlineThasreadak!eysequenceTbMoundtoaccept-lineandisabouttohʏreturnfthelinetothecaller.M3[Veariable]G@intLrl_explicit_arg.Set]toanon-zero\vdDalueifanexplicitn!umericargumentwas\spMeciedbytheuser..OnlyfvdDalidinabindablecommandfunction.3[Veariable]G@intLrl_numeric_arg.Setr,tothevdDalueofan!ynumericr-argumentexplicitlyspMeciedbytheuserbMefore.executingthecurren!tReadlinefunction.MOnlyvdDalidinabindablecommandfunction.3[Veariable]G@intLrl_editing_mode.SetptooavdDaluedenotingReadline'scurren!teditingmoMde.AFvdDalueof1meansReadline.isfcurren!tlyinemacsmoMde;0meansthatvimodeisactiv!e. ɍG]2.4Readlinef@ConvenienceFfunctionsGg2.4.1d(NamingMaFģunction3GTheusercandynamicallyc!hangethebindingsofkeyswhileusingReadline.]ThisisdonebyGrepresen!ting"the#functionwithadescriptiv!ename.Theuserisabletot!ypMethedescriptiv!eGnamefwhenreferringtothefunction.Th!us,inaninitle,onemightndd.Meta-Rubout:Tbackward-kill-wordc!GThis
Mtbindsthek!eystroke
MtMeta-Rubout
MutothefunctiondescriptivelyEunamedGbackward-kill-word.4Yeou,
asYtheprogrammer,
shouldbindthefunctionsZy!ouwritetoGdescriptiv!efnamesaswell.Readlineprovidesafunctionfordoingthat:z[Feunction]G@intLrl_add_defuny;m#R
3
cmss10(Ap0J
cmsl10Aconstochar*name,rlFGcommandFfuncFto*function,DGintkey).Add<nametothe<listofnamedfunctions.Mak!efunctionbMethefunctionthatgets.called.Iffk!ey~isnot-1,thenbindittofunctionusingrl_bind_key().!GUsingthisfunctionaloneissucien!tformostapplications.Itistherecommendedw!ayGto<add<afewfunctionstothedefaultfunctionsthatReadlinehasbuiltin.Ify!ouneedtodoGsomething{otherthanaddingzafunctiontoReadline,$y!oumayneedztousetheunderlyingGfunctionsfdescribMedbelo!w."˄GChapterf2:ProgrammingwithGNUReadlineʗ3433͍Gg2.4.2d(SelectingMaKeymap3GKeyabindingstak!eplace`onakeymap.Thekeymapisthe`assoMciationbet!weenathek!eys
33Gthatk8theuserk9t!ypMesandthefunctionsthatgetrun.#Yeoucanmak!eyourk9ownkeymaps,wcopyGexistingfk!eymaps,andtellReadlinewhichkeymaptouse.z[Feunction]G@KeymapLrl_make_bare_keymapy(Avoid).ReturnsEaDnew,empt!ykeymap.TheDspaceforthek!eymapisalloMcatedwithmalloc();.thefcallershouldfreeitb!ycallingrl_free_keymap()whendone.z[Feunction]G@KeymapLrl_copy_keymapy(AKeymapmap).Returnfanewk!eymapwhichisacopyofmap.z[Feunction]G@KeymapLrl_make_keymapy(Avoid).ReturnŬaūnewk!eymapwiththeprin!tingcharactersūbMoundtorl>xHtinsert,|thelowercase.Metac!haractersbMoundtoruntheirequivdDalents,andtheMetadigitsbMoundtoproduce.n!umericfarguments.z[Feunction]G@voidLrl_discard_keymapy(AKeymapkeymap).FereethestorageassoMciatedwiththedataink!eymap.Thecallershouldfreek!eymap.z[Feunction]G@voidLrl_free_keymapy(AKeymapkeymap).FereeallstorageassoMciatedwithk!eymap.Thiscallsrl_discard_keymaptofreesub-.ordindatefk!eymapsandmacros.z[Feunction]G@intLrl_empty_keymapy(AKeymapkeymap).Returnnon-zeroiftherearenok!eysbMoundtofunctionsinkeymapU;zzeroifthereare.an!yfkeysbMound.!GReadlineqhassev!eralqinternalqkeymaps.
>ThesefunctionsallowyouqtochangewhichGk!eymapfisactive.z[Feunction]G@KeymapLrl_get_keymapy(Avoid).Returnsfthecurren!tlyactivekeymap.z[Feunction]G@voidLrl_set_keymapy(AKeymapkeymap).Mak!esfkeymapgthecurrentlyactivekeymap.z[Feunction]G@KeymapLrl_get_keymap_by_namey(Aconstchar*name).Return>thek!eymap=matching>name.dnameEisonewhic!hwould>bMesuppliedinaset.keymapfinputrcline(seeSection1.3[ReadlineInitFile],page4).z[Feunction]G@charL*rl_get_keymap_namey(AKeymapkeymap).Return>thename=matc!hingkeymap.dnameEisonewhich=wouldbMesuppliedin=aset.keymapfinputrcline(seeSection1.3[ReadlineInitFile],page4).z[Feunction]G@intLrl_set_keymap_namey(Aconstchar*name,Keymapkeymap).Setthename
ofk!eymap.ThisnamewillthenbMe"registered"anda!vdDailableforuse.in0asetfkeymap0inputrcdirectiv!eseeSection1.3[ReadlineInitFile],S page4).|hThe.nameGzma!yrnotsbMeoneofReadline'sbuiltink!eymapnames;nyoumayrnotaddadieren!t.nameS'foroneofReadline'sbuiltink!eymaps.!YeoumayreplacethenameassoMciated#FGChapterf2:ProgrammingwithGNUReadlineʗ3533͍.withxaygiv!enkeymapbyycallingthisfunctionmorethanoncewiththesamek!eymap
33.argumen!t.Yeou$mayassoMciate%aregisteredname+withanewk!eymapby%callingthis.functionmorethanoncewiththesamenameiargumen!t.NThereisnow!aytoremove.a:named:k!eymaponcethenamehasbMeenregistered.Readlinewillmak!eacop!yof.name.ThereturnvdDalueisgreaterthanzerounlessnameFisoneofReadline'sbuiltin.k!eymapfnamesorkeymapgisoneofReadline'sbuiltinkeymaps.@Gg2.4.3d(BindingMKeys3GKeysequencesareassoMciatewithfunctionsthroughthek!eymap.2;Readlinehassev!eralin-Gternalk!eymaps:emacs_standard_keymap,<emacs_meta_keymap,emacs_ctlx_keymap,vi_Gmovement_keymap,qxandvi_insertion_keymap.	+emacs_standard_keymapisthedefault,Gandftheexamplesinthisman!ualassumethat.s!GSinceQreadline()installsQasetofdefaultk!eybindingsthersttimeitiscalled,b"thereisGalw!aysthedangerthatacustombindinginstalledbMeforetherstcalltoreadline()willGbMeo!verridden.Analternatemechanismistoinstallcustomk!eybindingsinaninitializationGfunctionuassignedtotherl_startup_hookvdDariable(seeSection2.3[ReadlineVeariables],Gpagef28).s!GTheseffunctionsmanagek!eybindings.z[Feunction]G@intLrl_bind_keyy(Aintkey,rlFGcommandFfuncFt*function).Bindsk!eytofunctioninthecurrentlyactivekeymap.Returnsnon-zerointhecase.offanin!vdDalidkey.z[Feunction]G@intLrl_bind_key_in_mapy(Aintkey,rlFGcommandFfuncFt*function,DGKeymapmap).Bindfk!ey~tofunctioninmap.Returnsnon-zerointhecaseofaninvdDalidkey.z[Feunction]G@intLrl_bind_key_if_unboundy(Aintkey,rlFGcommandFfuncFtDG*function).BindsIk!ey9-tofunctionifIitisnotalreadybMoundinthecurren!tlyactiveIkeymap..Returnsfnon-zerointhecaseofanin!vdDalidkey~orifkey~isalreadybMound.z[Feunction]G@intLrl_bind_key_if_unbound_in_mapy(Aintkey,rlFGcommandFfuncFtDG*function,Keymapmap).BindsGk!ey7tofunctionifitisnotalreadybMoundinmap.WReturnsnon-zerointhecase.offanin!vdDalidkey~orifkey~isalreadybMound.z[Feunction]G@intLrl_unbind_keyy(Aintkey).Bind[rk!eyKtothe[snullfunction[sinthecurren!tlyactive[skeymap.Returnsnon-zero[rin.casefoferror.z[Feunction]G@intLrl_unbind_key_in_mapy(Aintkey,Keymapmap).Bindfk!ey~tothenullfunctioninmap.Returnsnon-zeroincaseoferror.z[Feunction]G@intLrl_unbind_function_in_mapy(ArlFGcommandFfuncFt*function,DGKeymapmap).Un!bindfallkeysthatexecutefunctioninmap.$ҍGChapterf2:ProgrammingwithGNUReadlineʗ3633͍z[Feunction]G@intLrl_unbind_command_in_mapy(Aconstchar*command,Keymap
33DGmap).Un!bindfallkeysthatarebMoundtocommandinmap.͍z[Feunction]G@intLrl_bind_keyseqy(Aconstchar*keyseq,rlFGcommandFfuncFtDG*function).Bind,thek!eysequence,representedbythestringkeyseqmtto,thefunctionfunction,.bMeginningcincthecurren!tkeymap.ǠThismakescnewk!eymapsasnecessarye.ǟThereturn.vdDaluefisnon-zeroifk!eyseqLisinvdDalid.΍z[Feunction]G@intLrl_bind_keyseq_in_mapy(Aconstchar*keyseq,DGrlFGcommandFfuncFt*function,Keymapmap).Bindthek!eysequencerepresentedbythestringkeyseqBtothefunctionfunction.This.mak!es&newkeymapsasnecessarye.Initial%bindingsarepMerformedinmap.Thereturn.vdDaluefisnon-zeroifk!eyseqLisinvdDalid.z[Feunction]G@intLrl_set_keyy(Aconstchar*keyseq,rlFGcommandFfuncFt*function,DGKeymapmap).EquivdDalen!tftorl_bind_keyseq_in_map.΍z[Feunction]G@intLrl_bind_keyseq_if_unboundy(Aconstchar*keyseq,DGrlFGcommandFfuncFt*function).BindsCk!eyseqtofunctionifCitisnotalreadybMoundinthecurren!tlyactiveCkeymap..Returnsfnon-zerointhecaseofanin!vdDalidkeyseqLorifkeyseqLisalreadybMound.z[Feunction]G@intLrl_bind_keyseq_if_unbound_in_mapy(Aconstchar*keyseq,DGrlFGcommandFfuncFt*function,Keymapmap).Bindsk!eyseqtofunctionifitisnotalreadybMoundinmap.oReturnsnon-zerointhe.casefofanin!vdDalidkeyseqLorifkeyseqLisalreadybMound.΍z[Feunction]G@intLrl_generic_bindy(AinttypUVe,constchar*keyseq,char*data,DGKeymapmap).Bind>the>k!eysequencerepresen!tedby>thestringk!eyseqtothearbitrarypMoin!terdata..t!ypMesaysjwhatjkindofdataispoin!tedjtobydata;~thiscanbMeajfunction(ISFUNC),va.macro(ISMACR),(orak!eymap(ISKMAP).ԙThismak!esnewkeymapsasnecessarye.ԙThe.initialfk!eymapinwhichtodobindingsismap.z[Feunction]G@intLrl_parse_and_bindy(Achar*line).P!arseyline$asxifithadbMeenreadfromtheinputrcleandpMerforman!ykeybindings.andfvdDariableassignmen!tsfound(seeSection1.3[ReadlineInitFile],page4).΍z[Feunction]G@intLrl_read_init_filey(Aconstchar*lename).Read8k!eybindingsand9vdDariableassignmentsfromlenamee?(see9Section1.3[Readline.InitfFile],page4).L͍Gg2.4.4d(AssoiciatingMFģunctionNamesandBindings3GThesefunctionsallo!wyoutondoutwhatk!eysinvokenamedfunctionsandthefunctionsGin!vokedMLbyMMaparticularkeysequence.*YeouMMmayalsoassoMciateMManewfunctionnamewithanGarbitraryffunction.%{GChapterf2:ProgrammingwithGNUReadlineʗ3733͍z[Feunction]G@rl_command_func_tL*rl_named_functiony(Aconstchar*name)
33.Returnfthefunctionwithnamename.gz[Feunction]G@rl_command_func_tL*rl_function_of_keyseqy(AconstcharDG*keyseq,Keymapmap,int*typUVe).Returnthefunctionin!vokedbykeyseq)inkeymapmap.Ifmap=isNULL,Ethecurren!t.k!eymapqisqused.?IftypMeisnotqNULL,sthetypMeqoftheobjectqisreturnedintheint.vdDariableLitpMoin!tsto(oneofISFUNC,ISKMAP,orISMACR).*Ittakesa"translated"key.sequencefandshouldnotbMeusedifthek!eysequencecanincludeNUL.z[Feunction]G@rl_command_func_tL*rl_function_of_keyseq_leny(AconstcharDG*keyseq,sizeFGtlen,Keymapmap,int*typUVe).Returnthefunctionin!vokedbykeyseqnjoflengthleninkeymapmap.}EquivdDalenttorl_.function_of_keyseqJwithJtheadditionofthelenparameter.bIttak!esa"translated".k!eyfsequenceandshouldbMeusedifthekeysequencecanincludeNUL.z[Feunction]G@charL**rl_invoking_keyseqsy(ArlFGcommandFfuncFt*function).Returnanarra!yofstringsrepresen!tingthek!eysequencesusedtoin!vokefunctionin.thefcurren!tkeymap.z[Feunction]G@charL**rl_invoking_keyseqs_in_mapy(ArlFGcommandFfuncFtDG*function,Keymapmap).Returnanarra!yofstringsrepresen!tingthek!eysequencesusedtoin!vokefunctionin.thefk!eymapmap.z[Feunction]G@voidLrl_function_dumpery(Aintreadable).Prin!tthereadlinefunctionnamesandthekeysequencescurrentlybMoundtothemto.rl_outstream.IfLLreadableTisLMnon-zero,^Rthelistisformattedinsuc!hawaythatLLitcan.bMefmadepartofaninputrcleandre-read.z[Feunction]G@voidLrl_list_funmap_namesy(Avoid).Prin!tfthenamesofallbindableReadlinefunctionstorl_outstream.z[Feunction]G@constLchar**rl_funmap_namesy(Avoid).ReturnSaRNULL1terminatedarra!yofkno!wnfunctionnames.Thearra!yissorted.The.arra!y\hitself\iisalloMcated,k5butnotthestringsinside.3Yeoushouldfreethearra!ye,k5butnot.thefpMoin!ters,usingfreeorrl_freewhenyouaredone.z[Feunction]G@intLrl_add_funmap_entryy(Aconstchar*name,rlFGcommandFfuncFtDG*function).AddnametothelistofbindableReadlinecommandnames,Gandmak!efunctionthe.functionftobMecalledwhennameCmisin!voked.ٚGg2.4.5d(AllowingMUndoing3GSuppMortingLtheLundocommandisapainlessthing,vGandmak!esyourLfunctionsmuchLmoreGuseful.Itfiscertainlyeasytotrysomethingify!ouknowyoucanundoit.͍!GIf*y!our+functionsimplyinsertstextonce,8ordeletestextonce,8andusesrl_insert_Gtext()Y)orrl_delete_text()Y*todoit,hthenundoingisalreadydonefory!ouautomaticallye.&RGChapterf2:ProgrammingwithGNUReadlineʗ3833͍!GIfuy!oudomultipleinsertionsormultipledeletions,oranycombinationoftheseopMerations,
33Gy!oushouldgroupthemtogetherin!tooneopMeration.\Thisisdonewithrl_begin_undo_Ggroup()fandrl_end_undo_group().9!GTheft!ypMesofeventsthatcanbMeundoneare:
.ߤN		cmtt9enumundo_code{UNDO_DELETE,UNDO_INSERT,UNDO_BEGIN,UNDO_END};:!GNoticethatUNDO_DELETEmeanstoinsertsometext,:andUNDO_INSERTmeanstodeleteGsomeOtext.Thatis,a
theundocoMdetellswhatOtoundo,notho!wtoundoit.UNDO_BEGINandGUNDO_ENDfaretagsaddedb!yrl_begin_undo_group()andrl_end_undo_group().Ez[Feunction]G@intLrl_begin_undo_groupy(Avoid).Beginssa!vingundoinformationinagroupconstruct.ATheundoinformationusually.comesIfromHcallstorl_insert_text()andrl_delete_text(),TAbutcouldbMethe.resultfofcallstorl_add_undo().Fz[Feunction]G@intLrl_end_undo_groupy(Avoid).Closes{the{curren!tundogroupstartedwithrl_begin_undo_groupf().mThereshould.bMefonecalltorl_end_undo_group()foreac!hcalltorl_begin_undo_group().z[Feunction]G@voidLrl_add_undoy(AenumundoFGcoUVdewhat,intstart,intend,charDG*text).Remem!bMerhowtoundoanevent(accordingtowhat=)./rTheaectedtextrunsfrom.startftofend,andencompassestext.z[Feunction]G@voidLrl_free_undo_listy(Avoid).Fereeftheexistingundolist.Ez[Feunction]G@intLrl_do_undoy(Avoid).Undotherstthingontheundolist.Returns0iftherew!asnothingtoundo,non-zero.iffsomethingw!asundone.!GFinallye,#ify!ouneitherinsertnordeletetext,#butdirectlymoMdifytheexistingtext(e.g.,Gc!hangeitscase),Kcallrl_modifying()once,LjustbMeforeyoumoMdifythetext.YeoumustGsupplyftheindicesofthetextrangethaty!ouaregoingtomoMdifye.z[Feunction]G@intLrl_modifyingy(Aintstart,intend).Teell-Readlineto.sa!ve-thetextbMet!weenstart-and-endBasasingleundounit.g3Itis.assumedfthaty!ouwillsubsequentlymoMdifythattext.Gg2.4.6d(Redisplay@z[Feunction]G@voidLrl_redisplayy(Avoid).Changewhat'sdispla!yedonthescreentore
ectthecurren!tcontentsofrl_line_.buffer.Ez[Feunction]G@intLrl_forced_update_displayy(Avoid).FeorcethelinetobMeupdatedandredispla!yed,whetherornotReadlinethinksthe.screenfdispla!yiscorrect.z[Feunction]G@intLrl_on_new_liney(Avoid).TeelltheupMdatefunctionsthatw!ehavemovedontoanew(empty)line,!usuallyafter.outputtingfanewline.'#GChapterf2:ProgrammingwithGNUReadlineʗ3933͍z[Feunction]G@intLrl_on_new_line_with_prompty(Avoid)
33.Teell_the`upMdatefunctionsthatw!ehavemoved`ontoanew`line,
`withrl>xHtprompt _already.displa!yed.ˮThisocouldbMeousedb!yapplicationsthatw!antotooutputthepromptstring.themselv!es,\butJ_stillneedReadlinetoknowthepromptstringlengthforredisplaye.0It.shouldfbMeusedaftersettingrl>xHtalready>xHprompted.z[Feunction]G@intLrl_clear_visible_liney(Avoid).ClearfthescreenlinescorrespMondingtothecurren!tline'scontents.z[Feunction]G@intLrl_reset_line_statey(Avoid).Reset*the*displa!ystatetoacleanstateandredispla!ythecurren!tlinestartingona.newfline.z[Feunction]G@intLrl_crlfy(Avoid).Mo!vefthecursortothestartofthenextscreenline.z[Feunction]G@intLrl_show_chary(Aintc).Displa!ycharacterconrl_outstream.IfReadlinehasnotbMeensettodispla!ymeta.c!haractersdirectlye,9(thiswillconvertmetacharacterstoameta-prexedk!eysequence..Thisfisin!tendedforusebyapplicationswhichwishtodotheirownredisplaye.z[Feunction]G@intLrl_messagey(Aconstchar*,/...).Theyargumen!tsareyaformatstringaswouldybMesuppliedtoprintf,possiblycon!taining.con!versionNspMecicationsNsuchas`%d',andanyadditionalargumentsNnecessaryto.satisfythecon!versionspMecications.iTheresultingstringisdispla!yedintheec!ho.area.qTheLec!hoareaisalsousedtodisplaynumericargumentsandsearchstrings..Yeoushouldcallrl_save_prompttosa!vethepromptinformationbMeforecallingthis.function.z[Feunction]G@intLrl_clear_messagey(Avoid).Clearzthemessagezintheec!hoarea.Ifthepromptw!assavedwithazcalltorl_save_.promptobMeforetheplastcalltorl_message,callrl_restore_promptbMeforecalling.thisffunction.z[Feunction]G@voidLrl_save_prompty(Avoid).Sa!ve,the, loMcalReadlinepromptdispla!ystateinpreparationfordispla!yinganew.messagefinthemessageareawithrl_message().z[Feunction]G@voidLrl_restore_prompty(Avoid).Restore!PtheloMcal!OReadlinepromptdispla!ystatesa!ved!Pbythemost!Orecentcallto.rl_save_prompt.ifmrl_save_promptnw!ascalledtosaventhepromptbMeforeacall.tok7rl_message,kthisk6functionshouldbMecalledbeforethek6correspondingcalltorl_.clear_message.z[Feunction]G@intLrl_expand_prompty(Achar*prompt).Expand#&an!y#%spMecialcharacter#%sequencesinprompt`&andsetuptheloMcalReadline.promptM%redispla!yM$vdDariables.Thisfunctioniscalledb!yreadline().ItmayM%alsobMe.calledvtouexpandtheprimarypromptiftherl_on_new_line_with_prompt()function.or
rl_already_promptedvdDariableisused.
Itreturnsthen!umbMer
ofvisiblec!haracters.on/thelastlineofthe(pMossiblym!ulti-line).prompt.8Applicationsmayindicatethat(GChapterf2:ProgrammingwithGNUReadlineʗ4033͍.theXFpromptcon!tainscharactersXGthattakeupnophysicalscreenXGspacewhendisplayed
33.b!yxbracketingwasequenceofsuc!hcharactersxwiththespMecialmark!ersRL_PROMPT_.START_IGNOREandRL_PROMPT_END_IGNORE(declaredinreadline.h).ZThisma!ybMe.usedftoem!bMedterminal-specicescapesequencesinprompts.z[Feunction]G@intLrl_set_prompty(Aconstchar*prompt).Mak!e;Readlineusepromptxforsubsequentredisplaye.LThiscallsrl_expand_prompt().tofexpandthepromptandsetsrl_prompttotheresult.Gg2.4.7d(MoidifyingMTģextnz[Feunction]G@intLrl_insert_texty(Aconstchar*text).Inserttextin!tothelineatthecurren!tcursorpMosition.MReturnsthen!umbMerofchar-.actersfinserted.z[Feunction]G@intLrl_delete_texty(Aintstart,intend).DeletethetextbMet!weenstartŁandendinthecurren!tline..Returnsthen!umbMerof.c!haractersfdeleted.z[Feunction]G@charL*rl_copy_texty(Aintstart,intend).Returnfacop!yofthetextbMetweenstartfandendinthecurrentline.z[Feunction]G@intLrl_kill_texty(Aintstart,intend).Cop!ythetextbMetweenstartWandendinthecurrentlinetothekillring,7appMending.orprepMendingtothelastkillifthelastcommandw!asakillcommand.)Thetextis.deleted.If_startE_islessthan^end, thetext_isappMended, otherwiseprepended.Ifthe.lastfcommandw!asnotakill,anewkillringslotisused.z[Feunction]G@intLrl_push_macro_inputy(Achar*macro).CausedmacrobtobMeinsertedin!totheline,qasifithadbeenin!vokeddbyakeybMoundto.afmacro.NotespMeciallyuseful;userl_insert_text()instead.Gg2.4.8d(CharacterMInputnz[Feunction]G@intLrl_read_keyy(Avoid).Return7the8nextc!haracteravdDailable7fromReadline'scurren!tinputstream.yThishan-.dles.Sinputinsertedin!totheinputstream.Tviarl>xHtpMending>xHinputkS(see.SSection2.3[Read-.lineVeariables],:page28)andrl_stuff_char(),9macros,andc!haractersreadfrom.thek!eybMoard.2.Whilewaitingforinput,43thisfunctionwillcallan!yfunctionassigned.toftherl_event_hookvdDariable.z[Feunction]G@intLrl_getcy(AFILE*stream).Returnthenextc!haracteravdDailablefromstream,whichisassumedtobMethekeybMoard.z[Feunction]G@intLrl_stuff_chary(Aintc).Insertcin!totheReadlineinputstream.ItwillbMe"read"beforeReadlineattempts.to6read6c!haractersfromtheterminalwithrl_read_key().Upto512c!haractersmay.bMe+pushedbac!k.,rl_stuff_charreturns1ifthecharacterwassuccessfullyinserted;.0fotherwise.)-GChapterf2:ProgrammingwithGNUReadlineʗ4133͍z[Feunction]G@intLrl_execute_nexty(Aintc)
33.Mak!eHcbMetheHnextcommandtobMeexecutedwhenrl_read_key()iscalled.This.setsfrl>xHtpMending>xHinput.xz[Feunction]G@intLrl_clear_pending_inputy(Avoid).Unset|rl>xHtpMending>xHinput,\eectiv!elynegatingtheeect{ofanypreviouscalltorl_.execute_next().zYThis:w!orksonlyifthepMendinginputhasnotalreadybeenread.withfrl_read_key().xz[Feunction]G@intLrl_set_keyboard_input_timeouty(Aintu).Whileюw!aitingforэkeybMoardinputinrl_read_key(),WReadlinewillwaitэforumi-.crosecondsforinputbMeforecallingan!yfunctionassignedtorl_event_hook.um!ust.bMeӐgreaterthanorequaltozero(azero-lengthtimeoutisequivdDalen!ttoapoll).e[The.defaultfw!aitingpMeriodfisone-tenthofasecond.ReturnstheoldtimeoutvdDalue.-荍Gg2.4.9d(TģerminalMManagementz[Feunction]G@voidLrl_prep_terminaly(AintmetaFG
ag).MoMdifytheterminalsettingsforReadline'suse,wsoreadline()canreadasingle.c!haracter,at-atimefromthek!eybMoard.
0Themeta>xHt
agDargument,shouldbMenon-zero.iffReadlineshouldreadeigh!t-bitinput.z[Feunction]G@voidLrl_deprep_terminaly(Avoid).Undo˭theˬeectsofrl_prep_terminal(),lea!vingtheterminalinthestateinwhic!h.itfw!asbMeforethemostrecentcalltorl_prep_terminal().xz[Feunction]G@voidLrl_tty_set_default_bindingsy(AKeymapkmap).ReadotheoopMeratingsystem'sterminaleditingc!haracters(aswouldbMeodisplayedby.stty)ftotheirReadlineequivdDalen!ts.ThebindingsarepMerformedinkmap.z[Feunction]G@voidLrl_tty_unset_default_bindingsy(AKeymapkmap).Reset;thebindingsmanipulatedb!y:rl_tty_set_default_bindingssothattheter-.minal¯editing°c!haractersarebMoundtorl_insert.2ThebindingsarepMerformedin.kmap.z[Feunction]G@intLrl_tty_set_echoingy(AintvUUalue).SetReadline'sideaofwhetherornotitisec!hoingoutputtoitsoutputstream.(rl>xHtoutstream).IfvdDalueis0,TReadlinedoMesnotdispla!youtputtorl>xHtoutstream;,an!y.other'vdDalue'enablesoutput.	_TheinitialvdDalueissetwhenReadlineinitializesthe.terminalfsettings.ThisfunctionreturnsthepreviousvdDalue.xz[Feunction]G@intLrl_reset_terminaly(Aconstchar*terminalFGname).ReinitializeReadline'sideaoftheterminalsettingsusingterminal>xHtnamexasthetermi-.nalѢt!ypMeѡ(e.g.,qvt100)._Ifterminal>xHtnamenisNULL,theѡvdDalueoftheTERMen!vironment.vdDariablefisused.-荍Gg2.4.10d(UtilityMFģunctionsz[Feunction]G@intLrl_save_statey(AstructreadlineFGstate*sp).Sa!vekaksnapshotofReadline'sin!ternalstatetosp.Thecon!tentskofthereadline>xHtstate.structurearedoMcumen!tedinreadline.h.ѶThecallerisresponsibleforallocatingthe.structure.*;GChapterf2:ProgrammingwithGNUReadlineʗ4233͍z[Feunction]G@intLrl_restore_statey(AstructreadlineFGstate*sp)
33.Restore Readline'sin!ternalstatetothatstoredinsp,whic!hmusthavebMeensavedbya.call|torl_save_state.The|con!tents|ofthereadline>xHtstatestructurearedoMcumen!ted.infreadline.h.ThecallerisrespMonsibleforfreeingthestructure.z[Feunction]G@voidLrl_freey(Avoid*mem).DealloMcatethememorypoin!tedtobymem.memmusthavebMeenallocatedb!ymalloc.z[Feunction]G@voidLrl_replace_liney(Aconstchar*text,intclearFGundo).ReplaceJtheKcon!tentsofrl_line_bufferKwithtext.ThepMoin!tandmarkarepre-.serv!ed,.eifepMossible.Ifclear>xHtundo5isdnon-zero,.ftheundolistassoMciatedwiththecurren!t.linefiscleared.z[Feunction]G@voidLrl_extend_line_buffery(Aintlen).Ensure4thatrl_line_bufferhas5enoughspacetoholdlenc!haracters,pMossiblyreal-.loMcatingfitifnecessarye.z[Feunction]G@intLrl_initializey(Avoid).Initializen8orn7re-initializeReadline'sin!ternalstate.5RIt'snotstrictlynecessarytocall.this;freadline()callsitbMeforereadingan!yinput.z[Feunction]G@intLrl_dingy(Avoid).RingftheterminalbMell,obeyingthesettingofbell-style.z[Feunction]G@intLrl_alphabeticy(Aintc).Returnf1ifcPjisanalphabMeticc!haracter.z[Feunction]G@voidLrl_display_match_listy(Achar**matches,intlen,intmax).A#;con!venience#[functionfordispla!yingalistofstringsincolumnarformatonRead-.line'swoutputxstream.matchesisthelistofstrings,inargvformat,suc!hasalistof.completion9matc!hes.lenisthenumbMerofstringsinmatches,andmaxisthelengthof.the$longest$stringinmatches.Thisfunctionusesthesettingofprint-completions-.horizontallyYtoYselectho!wthematchesYaredisplayed(seeSectionY1.3.1[Readline.InitFileSyn!tax],page4).ۢWhendisplayingcompletions,thisfunctionsetsthenum-.bMerTofScolumnsusedfordispla!ytothevdDalueofcompletion-display-width,WthevdDalue.offtheen!vironmentfvdDariableCOLUMNS,orthescreenwidth,inthatorder.!GThefollo!wingareimplementedasmacros,<denedinchardefs.h.{ApplicationsshouldGrefrainffromusingthem.z[Feunction]G@intL_rl_uppercase_py(Aintc).Returnf1ifcPjisanuppMercasealphabeticc!haracter.z[Feunction]G@intL_rl_lowercase_py(Aintc).Returnf1ifcPjisalo!wercasefalphabMeticc!haracter.z[Feunction]G@intL_rl_digit_py(Aintc).Returnf1ifcPjisan!umericcharacter.z[Feunction]G@intL_rl_to_uppery(Aintc).Ifyc}isxalo!wercaseyalphabMeticc!haracter,ureturnthecorrespMondinguppercasec!haracter.+KGChapterf2:ProgrammingwithGNUReadlineʗ4333͍z[Feunction]G@intL_rl_to_lowery(Aintc)
33.Ifxc"isanxuppMercasealphabeticxc!haracter,returnthexcorrespondinglo!wercasexcharac-.ter.z[Feunction]G@intL_rl_digit_valuey(Aintc).IffcPjisan!umbMer,freturnthevdDalueitrepresen!ts.Gg2.4.11d(MiscellaneousMFģunctionsb"z[Feunction]G@intLrl_macro_bindy(Aconstchar*keyseq,constchar*macro,DGKeymapmap).Bindthek!eysequencek!eyseq
toinvokethemacromacro.UThebindingispMerformedin.map.WhenNrk!eyseqXisinvoked,`	themacroBwillbMeinsertedintotheline.Thisfunction.isfdeprecated;userl_generic_bind()instead.z[Feunction]G@voidLrl_macro_dumpery(Aintreadable).Prin!tBdtheBckeysequencesbMoundBctomacrosandtheirvdDalues,Vdusingthecurren!tkeymap,.torl_outstream.*TIfreadable\isnon-zero,Bthelistisformattedinsuc!hawaythatit.canfbMemadepartofaninputrcleandre-read.z[Feunction]G@intLrl_variable_bindy(Aconstchar*vUUariable,constchar*vUUalue).Mak!e{the{ReadlinevdDariablevariable#ha!ve{vdDalue.pThisbMeha!ves{asifthereadlinecom-.mand0`setfvariablevalue'hadbMeenexecutedinaninputrcle(seeSection1.3.1.[ReadlinefInitFileSyn!tax],page4).z[Feunction]G@charL*rl_variable_valuey(Aconstchar*vUUariable).Returnastringrepresen!tingthevdDalueoftheReadlinevdDariablevariable.SFeorbMoolean.vdDariables,fthisstringiseither`on'or`off'.z[Feunction]G@voidLrl_variable_dumpery(Aintreadable).Prin!tpthepreadlinevdDariablenamesandtheircurren!tvdDaluestorl_outstream.Ifread-.ableAis9non-zero,3othelist:isformattedin9suc!haway9thatitcanbMemadepartofan.inputrcfleandre-read.z[Feunction]G@intLrl_set_paren_blink_timeouty(Aintu).Setthetimein!tervdDal(inmicroseconds)thatReadlinewaitswhenshowingabalancing.c!haracterfwhenblink-matching-parenhasbMeenenabled.z[Feunction]G@charL*rl_get_termcapy(Aconstchar*cap).Retriev!e=thestringvdDalueofthetermcapcapabilitycap.Readlinefetchesthetermcap.en!try2for1thecurrent1terminalnameandusesthosecapabilitiestomo!vearound2the.screenlineandpMerformotherterminal-specicoperations,>lik!eerasingaline.}Readline.doMes4Anotuse4@allofaterminal'scapabilities,WandthisfunctionwillreturnvdDaluesfor.onlyfthosecapabilitiesReadlineuses.z[Feunction]G@voidLrl_clear_historyy(Avoid).ClearC%thehistoryC$listb!ydeletingalloftheen!tries,VinthesamemannerastheHistory.library's%>clear_history()%=function.	ZeThisdiersfromclear_historybMecauseit.freesfprivdDatedataReadlinesa!vesfinthehistorylist.,YGChapterf2:ProgrammingwithGNUReadlineʗ4433͍z[Feunction]G@voidLrl_activate_marky(Avoid)
33.EnableanactiveeRmark.LWhenthisisenabled,thetextbMet!weenpMointandmark(the.region)isdispla!yedintheterminal'sstandoutmoMde(aface).RThisiscalledb!yvdDarious.readlinefunctionsthatsetthemarkandinserttext,andisa!vdDailableforapplications.tofcall.z[Feunction]G@voidLrl_deactivate_marky(Avoid).Teurnfotheactiv!emark.z[Feunction]G@voidLrl_keep_mark_activey(Avoid).IndicateJthatJthemarkshouldremainactiv!ewhenthecurren!treadlinefunctioncom-.pletesJandJafterredispla!yoMccurs.ZInmostcases,]*themarkremainsactiv!eforonlythe.durationfofasinglebindablereadlinefunction.z[Feunction]G@intLrl_mark_active_py(Avoid).Returnfanon-zerovdDalueifthemarkiscurren!tlyactive;zerootherwise.卍Gg2.4.12d(AlternateMInterface3GAnalternatein!terfaceisavdDailabletoplainreadline().RSomeapplicationsneedtoin!terleaveGk!eybMoardF'I/OEwithF(le,ndevice,orwindo!wF'systemI/O,typicallyF(byusingamainF(loMoptoGselect()VonVvdDariousledescriptors.	TeoaccommoMdatethisneed,readlinecanalsobMeGin!voked=asa>`callbac!k'functionfromanevent>loMop.%bTherearefunctionsa!vdDailabletomakeGthisfeasye.z[Feunction]G@voidLrl_callback_handler_instally(Aconstchar*prompt,DGrlFGvcpfuncFt*lhandler).SetuptheterminalforreadlineI/Oanddispla!ytheinitialexpandedvdDalueofprompt..Sa!ve<the;vdDalueoflhandleretouseasahandlerfunctiontocallwhenacompleteline.ofIinputIhasbMeenen!tered.Thehandlerfunctionreceiv!esthetextofthelineasan.argumen!t.@Ashwithhreadline(),tthehandlerfunctionshouldfreethelinewhenitit.nishedfwithit.z[Feunction]G@voidLrl_callback_read_chary(Avoid).Whenev!eranapplicationdeterminesthatkeybMoardinputisavdDailable,%<itshouldcall.rl_callback_read_char(),whic!h[will\readthenextc!haracterfromthecurren!tinput.source.0IfY_thatc!haracterY^completestheline,hrl_callback_read_charwillin!vokeY_the.lhandlerfunctionuinstalledb!yvrl_callback_handler_installtoproMcesstheline..Before1calling1thelhandlerfunction,mtheterminalsettingsareresettothevdDalues.they7GhadbMeforecallingrl_callback_handler_install.	Ifthelhandlerpfunction.returns,jand[the[linehandlerremainsinstalled,jtheterminalsettingsaremoMdiedfor.Readline'sfuseagain.EOFisindicatedb!ycallinglhandlerowithaNULLline.z[Feunction]G@voidLrl_callback_sigcleanupy(Avoid).Cleanupan!yinternalstatethecallbackinterfaceusestomaintainstatebMetweencalls.to9rl>xHtcallbac!k>xHread>xHchar9(e.g.,5thestateof8anyactiveincrementalsearches).6UThisis.in!tendedtobMeusedb!yapplicationsthatwishtopMerformtheiro!wnsignalhandling;.Readline'sfin!ternalsignalhandlercallsthiswhenappropriate.-gɍGChapterf2:ProgrammingwithGNUReadlineʗ4533͍z[Feunction]G@voidLrl_callback_handler_removey(Avoid)
33.RestoreL)theL(terminaltoitsinitialstateandremo!vetheL)linehandler.%YeoumayL)call.thisfunctionfromwithinacallbac!kasw!ellasindepMenden!tlye.NIfthelhandlerinstalled.b!y1rl_callback_handler_install0doMesnotexittheprogram,*;eitherthisfunctionor.theMfunctionLreferredtob!ythevdDalueofrl_deprep_term_functionshouldbMecalled.bMeforeftheprogramexitstoresettheterminalsettings.эGg2.4.13d(AMReadlineExample3GHere.is/afunctionwhic!hchanges/lowercasecharacterstotheir/uppMercaseequivdDalents,+andGuppMercase>c!haracterstolowercase.XIfthisfunctionwasbMoundto`M-c',dthentyping`M-c'Gw!ouldɳchangeɴthecaseofthec!haracterunderpMoin!t.GTypingɴ`M-1f0M-c'w!ouldɴchangetheGcasefofthefollo!wing10characters,leavingthecursoronthelastcharacterchanged.@./*InvertthecaseoftheCOUNTfollowingcharacters.*/.int.invert_case_line(count,key)Kintcount,key;.{:xregisterintstart,end,i;ff:xstart=rl_point;:xif(rl_point>=rl_end)
33EDreturn(0);:xif(count<0)ED{Qwdirection=-1;Qwcount=-count;ED}:xelseEDdirection=1;:x/*Findtheendoftherangetomodify.*/:xend=start+(count*direction);:x/*Forceittobewithinrange.*/:xif(end>rl_end)EDend=rl_end;:xelseif(end<0)EDend=0;:xif(start==end)EDreturn(0);:xif(start>end)ED{.wGChapterf2:ProgrammingwithGNUReadlineʗ4633͍Qwinttemp=start;
33Qwstart=end;Qwend=temp;ED}ff:x/*Tellreadlinethatwearemodifyingtheline,Ksoitwillsavetheundoinformation.*/:xrl_modifying(start,end);:xfor(i=start;i!=end;i++)ED{Qwif(_rl_uppercase_p(rl_line_buffer[i]))\rl_line_buffer[i]=_rl_to_lower(rl_line_buffer[i]);Qwelseif(_rl_lowercase_p(rl_line_buffer[i]))\rl_line_buffer[i]=_rl_to_upper(rl_line_buffer[i]);ED}:x/*Movepointtoontopofthelastcharacterchanged.*/:xrl_point=(direction==1)?end-1:start;:xreturn(0);.}эGg2.4.14d(AlternateMInterfaceExample3GHereisacompleteprogramthatillustratesReadline'salternatein!terface.	ItreadslinesGfrom0theterminalanddispla!ysthem,providingthestandardhistoryandTeAB+completionGfunctions.ItfunderstandstheEOFc!haracteror"exit"toexittheprogram.@./*Standardincludefiles.stdio.hisrequired.*/.#include<stdlib.h>.#include<string.h>.#include<unistd.h>.#include<locale.h>./*Usedforselect(2)*/.#include<sys/types.h>.#include<sys/select.h>.#include<signal.h>.#include<stdio.h>./*Standardreadlineincludefiles.*/.#include<readline/readline.h>.#include<readline/history.h>.staticvoidcb_linehandler(char*);.staticvoidsighandler(int);/~čGChapterf2:ProgrammingwithGNUReadlineʗ4733͍.intrunning;
33.intsigwinch_received;.constchar*prompt="rltest$";ff./*HandleSIGWINCHandwindowsizechangeswhenreadlineisnotactiveandn
	@8readingacharacter.*/.staticvoid.sighandler(intsig).{:xsigwinch_received=1;.}./*Callbackfunctioncalledforeachlinewhenaccept-lineexecuted,EOF@8seen,orEOFcharacterread.TThissetsaflagandreturns;itcould@8alsocallexit(3).*/.staticvoid.cb_linehandler(char*line).{:x/*Canuse^D(sttyeof)or`exit'toexit.*/:xif(line==NULL||strcmp(line,"exit")==0)ED{Qwif(line==0)\printf("\n");Qwprintf("exit\n");Qw/*Thisfunctionneedstobecalledtoresettheterminalsettings,n
	bandcallingitfromthelinehandlerkeepsoneextrapromptfromn	 bbeingdisplayed.*/Qwrl_callback_handler_remove();Qwrunning=0;ED}:xelseED{Qwif(*line)\add_history(line);Qwprintf("inputline:%s\n",line);Qwfree(line);ED}.}.int.main(intc,char**v).{:xfd_setfds;:xintr;:x/*Setthedefaultlocalevaluesaccordingtoenvironmentvariables.*/n
	0tGChapterf2:ProgrammingwithGNUReadlineʗ4833͍:xsetlocale(LC_ALL,"");ff:x/*Handlewindowsizechangeswhenreadlineisnotactiveandreading
33Kcharacters.*/:xsignal(SIGWINCH,sighandler);:x/*Installthelinehandler.*/:xrl_callback_handler_install(prompt,cb_linehandler);:x/*Enterasimpleeventloop.TThiswaitsuntilsomethingisavailableKtoreadonreadline'sinputstream(defaultstostandardinput)andKcallsthebuiltincharacterreadcallbacktoreadit.TItdoesnotKhavetomodifytheuser'sterminalsettings.*/:xrunning=1;:xwhile(running)ED{QwFD_ZERO(&fds);QwFD_SET(fileno(rl_instream),&fds);Qwr=select(FD_SETSIZE,&fds,NULL,NULL,NULL);Qwif(r<0&&errno!=EINTR)\{hv@perror("rltest:select");hv@rl_callback_handler_remove();hv@break;\}Qwif(sigwinch_received).{:xrl_resize_terminal();:xsigwinch_received=0;.}Qwif(r<0).continue;Qwif(FD_ISSET(fileno(rl_instream),&fds))\rl_callback_read_char();ED}:xprintf("rltest:Eventloophasexited\n");:xreturn0;.}!G]2.5Readlinef@SignalHandling33GSignalsareasync!hronouseventssenttoaproMcessbytheUnixkernel,sometimesonbMehalfGof*anotherproMcess.jTheyarein!tended*toindicateexceptionalevents,Klike*auserpressingGthe
'in!terruptkeyonhisterminal,#oranetworkconnectionbMeingbroken.	 Thereisaclass1dGChapterf2:ProgrammingwithGNUReadlineʗ4933͍GofusignalsuthatcanbMesen!ttotheproMcesscurren!tlyreadinginputfromthek!eybMoard.͐Since
33GReadlineWc!hangesWtheterminalattributeswhenitiscalled,itneedstopMerformspecialGproMcessingOBwhenOAsuc!hasignalisreceiv!edinordertorestoretheterminaltoasanestate,`orGpro!videfapplicationwriterswithfunctionstodosomanuallye.g!GReadlinecon!tainsaninternalsignalhandlerthatisinstalledforan!umbMerofsignalsG(SIGINT,	SIGQUIT,SIGTERM,
SIGHUP,SIGALRM,SIGTSTP,SIGTTIN,andvSIGTTOU).LWhenGone5Fofthesesignalsisreceiv!ed,Kthesignal5GhandlerwillresettheterminalattributestothoseGthat w!ereineectbMeforereadline()w!ascalled,resetthesignalhandlingtowhatitw!asGbMefore4readline()4w!ascalled,KUandresendthesignaltothecallingapplication.IfandwhenGthe"calling!application'ssignalhandlerreturns,0ReadlinewillreinitializetheterminalandGcon!tinuedLtoacceptdMinput.WhenaSIGINTisreceiv!ed,qtheReadlinesignalhandlerpMerformsGsomeadditionalw!ork,whichwillcausean!ypartially-enteredlinetobMeaborted(seetheGdescriptionfofrl_free_line_state()bMelo!w).h!GThereisanadditionalReadlinesignalhandler,forSIGWINCH,whic!hthekernelsendstoaGproMcessv`whenev!erv_theterminal'ssizec!hanges(forexample,ifauserresizesanxterm).TheGReadlineGtSIGWINCHhandlerGsupMdatesReadline'sin!ternalscreensizeinformation,oandthenGcallsan!ySIGWINCHsignalhandlerthecallingapplicationhasinstalled.ReadlinecallstheGapplication's;SIGWINCHsignal;
handlerwithoutresettingtheterminaltoitsoriginalstate.GIf֫theapplication'ssignalhandlerdoMesmorethan֬updateitsideaoftheterminalsizeandGreturn(forexample,alongjmpbac!ktoamainproMcessingloop),itmustcallrl_cleanup_Gafter_signal()f(describMedbelo!w),torestoretheterminalstate.!GWhenanapplicationisusingthecallbac!kinterface(seeSection2.4.12[AlternateIn-Gterface],page(44),Readlineinstalls(signalhandlersonlyforthedurationofthecalltoGrl_callback_read_char.Applicationsݣusingtheݢcallbac!kinterfaceshouldbMepreparedtoGclean3upReadline's3stateiftheywishtohandlethesignalbMeforethelinehandlercompletesGandfrestorestheterminalstate.!GIfKanapplicationusingKthecallbac!kinterfacewishestohaveKReadlineinstallitssignalGhandlersatthetimetheapplicationcallsrl_callback_handler_installandremo!vethemGonly\whenacomplete[lineofinputhasbMeenread,^itshouldsettherl_persistent_signal_GhandlersqvdDariabletopanon-zerovalue.6Thisallo!wsanpapplicationtodeferallofthehandlingGof!the!signalsReadlinecatc!hestoReadline.ApplicationsshouldusethisvdDariablewithcare;Git(canresult)inReadlinecatc!hingsignalsandnotactingonthem(orallo!wingtheapplicationGto<reactto<	them)un!tiltheapplicationcallsrl_callback_read_char.ThiscanresultinGanapplicationbMecominglessresponsiv!etokeybMoardsignalslikeSIGINT.IfanapplicationGdoMesnotw!antorneedtoperforman!ysignalhandling,ordoesnotneedtodoan!yprocessingGbMet!weenfcallstorl_callback_read_char,settingthisvdDariablema!ybedesirable.!GReadlineo#pro!videstwovdDariablesthatallowo"applicationwriterstocontrolwhetherornotGit.will/catc!hcertainsignalsandactonthemwhentheyarereceiv!ed.6ItisimpMortan!tthatGapplicationsfc!hangefthevdDaluesofthesevdDariablesonlywhencallingreadline(),notinaGsignalfhandler,soReadline'sin!ternalsignalstateisnotcorrupted.Y3[Veariable]G@intLrl_catch_signals.Ifw*thisw)vdDariableisnon-zero,ReadlinewillinstallsignalhandlersforSIGINT,SIGQUIT,.SIGTERM,fSIGHUP,SIGALRM,SIGTSTP,SIGTTIN,andSIGTTOU..ThefdefaultvdDalueofrl_catch_signalsis1.2PGChapterf2:ProgrammingwithGNUReadlineʗ5033͍3[Veariable]G@intLrl_catch_sigwinch
33.IfTthisvdDariableissettoanon-zerovalue,Readlinewillinstallasignalhandlerfor.SIGWINCH.ff.ThefdefaultvdDalueofrl_catch_sigwinchis1.΍3[Veariable]G@intLrl_persistent_signal_handlers.If!an applicationusingthecallbac!kinterface wishesReadline'ssignalhandlerstobMe.installedzandactiv!eduringthesetzofcallstorl_callback_read_charthatconstitutes.anfen!tiresingleline,itshouldsetthisvdDariabletoanon-zerovalue..ThefdefaultvdDalueofrl_persistent_signal_handlersis0.΍3[Veariable]G@intLrl_change_environment.If2this1vdDariableissettoanon-zerovdDalue,eandReadlineishandlingSIGWINCH,dRead-.linewillmoMdifytheLINES?IandCOLUMNS?Hen!vironmentvdDariablesupMonreceiptofa.SIGWINCH.ThefdefaultvdDalueofrl_change_environmentis1.΍!GIf0anapplication/doMesnotwishtoha!ve0Readlinecatc!hany/signals,orto0handlesignalsGotherthanthoseReadlinecatc!hes(SIGHUP,Zforexample),Readlinepro!videsconvenienceGfunctionsftodothenecessaryterminalandin!ternalstatecleanupupMonreceiptofasignal.͍z[Feunction]G@intLrl_pending_signaly(Avoid).ReturnItheIsignaln!umbMerofIthemostrecen!tsignalReadlinereceiv!edbuthasnoty!et.handled,for0ifthereisnopMendingsignal.z[Feunction]G@voidLrl_cleanup_after_signaly(Avoid).Thisfunctionwillresetthestateoftheterminaltowhatitw!asbMeforereadline().w!ascalled,~andremovetheReadlinesignalhandlersforallsignals,depMendingonthe.vdDaluesfofrl_catch_signalsandrl_catch_sigwinch.΍z[Feunction]G@voidLrl_free_line_statey(Avoid).Thiswillfree~an!ypartialstateassoMciatedwiththecurren!tinputline(undoinfor-.mation,z$an!ypartialhistoryentrye,z#anypartially-enteredkeybMoardmacro,z$andany.partially-en!terednumericargument).$*ThisshouldbMecalledbMeforerl_cleanup_.after_signal().	LThe Readlinesignalhandler forSIGINTcallsthistoabMortthe.curren!tfinputline.z[Feunction]G@voidLrl_reset_after_signaly(Avoid).Thiskwillreinitializetheterminalandreinstallkan!yReadlinesignalhandlers,wsdepMend-.ingfonthevdDaluesofrl_catch_signalsandrl_catch_sigwinch.΍!GIfanapplicationw!antstoforceReadlinetohandlean!ysignalsthatha!vearrivedwhileGitM9hasM:bMeenexecuting,vrl_check_signals()willcallReadline'sin!ternalsignalhandlerifGtherejarejan!ypMendingsignals.(Thisisprimarilyin!tendedforthoseapplicationsthatuseGacustomrl_getc_function(seeSection2.3[ReadlineVeariables],page28)andwishtoGhandlefsignalsreceiv!edwhilewaitingforinput.z[Feunction]G@voidLrl_check_signalsy(Avoid).If!there arean!ypMendingsignals,2NcallReadline'sin!ternalsignalhandlingfunctions.to"GproMcessthem.	Qrl_pending_signal()"Hcanbeusedindependen!tlytodetermine.whetherfornottherearean!ypMendingsignals.3GChapterf2:ProgrammingwithGNUReadlineʗ5133͍!GIfanapplicationdoMesnotwishReadlinetocatc!hSIGWINCH,	itmaycallrl_resize_
33Gterminal()Borrl_set_screen_size()toforceReadlinetoupMdateitsideaoftheterminalGsizefwhenitreceiv!esaSIGWINCH.Dz[Feunction]G@voidLrl_echo_signal_chary(Aintsig).If;anapplicationwishestoinstallits;o!wnsignalhandlers,butstillhavereadline.displa!ycharactersthatgeneratesignals,gcallingthisfunctionwithsigsettoSIGINT,.SIGQUIT,forSIGTSTPwilldispla!ythecharactergeneratingthatsignal.Dz[Feunction]G@voidLrl_resize_terminaly(Avoid).UpMdatefReadline'sin!ternalscreensizebyreadingvdDaluesfromthekernel.z[Feunction]G@voidLrl_set_screen_sizey(Aintrows,intcols).SetXReadline'sideaXoftheterminalsizetoro!wsGrowsXandcolscolumns.Ifeitherro!ws.or9columnsZislessthan9orequalto0,^Readline'sideaofthatterminaldimensionis.unc!hanged.JThisSisSintendedtoStellReadlinetheph!ysicaldimensionsoftheterminal,.andcGiscHusedin!ternallytocalculatethemaxim!umnumbMerofcHcharactersthatmay.appMearfonasinglelineandonthescreen.!GIfanapplicationdoMesnotw!anttoinstallaSIGWINCHhandler,butisstillin!terestedinGthefscreendimensions,itma!yqueryReadline'sideaofthescreensize.z[Feunction]G@voidLrl_get_screen_sizey(Aint*rows,int*cols).ReturnGReadline'sideaofHtheterminal'ssizeinthevdDariablespMoin!tedtob!ytheargu-.men!ts.Dz[Feunction]G@voidLrl_reset_screen_sizey(Avoid).CausefReadlinetoreobtainthescreensizeandrecalculateitsdimensions.!GTheffollo!wingfunctionsinstallandremoveReadline'ssignalhandlers.z[Feunction]G@intLrl_set_signalsy(Avoid).InstallReadline'ssignalhandlerforSIGINT,SIGQUIT,SIGTERM,SIGHUP,SIGALRM,.SIGTSTP,aSIGTTIN,aSIGTTOU,and<?SIGWINCH,depMendingon<@thevdDaluesofrl_catch_.signalsfandrl_catch_sigwinch.Dz[Feunction]G@intLrl_clear_signalsy(Avoid).Remo!vefalloftheReadlinesignalhandlersinstalledb!yrl_set_signals().
G]2.6Customf@Completers33GT!ypicallye,}BaprogramthatreadscommandsfromtheuserhasawayofdisambiguatingGcommandsB anddata.Ify!ourprogramisoneB!ofthese,ithenitcanpro!videcompletionforGcommands,data,or[bMoth.фTheZfollo!wingsectionsdescribeho!wyourZprogramandReadlineGcoMoperateftopro!videthisservice.Gg2.6.1d(HowMCompletingWģorks3GIn(order(tocompletesometext,AthefulllistofpMossiblecompletionsm!ustbMea!vdDailable.ThatGis,P
it:visnotpMossibleto:waccuratelyexpandapartialw!ordwithoutknowingall:wofthepMossibleGw!ordswhichmakesenseinthatcontext.TheReadlinelibraryprovidestheuserinterface4䍟GChapterf2:ProgrammingwithGNUReadlineʗ5233͍Gtogcompletion,t:andt!wogofgthemostcommoncompletionfunctions:lenameandusername.
33GFeorcompletingothert!ypMesoftext,̠youmustwriteyourowncompletionfunction.ThisGsectionfdescribMesexactlywhatsuc!hfunctionsmustdo,andprovidesanexample.8R!GTherefarethreemajorfunctionsusedtopMerformcompletion:8S-1.'The6@user-in!terfacefunctionrl_complete().	lThisfunctioniscalledwiththesame'argumen!tsHasotherbindableReadlinefunctions:!<countandinvoking>xHtkey.Itisolates'the,w!ordtobMecompletedandcalls+rl_completion_matches()togeneratealistof'pMossible?completions.iIt@theneitherliststhepMossiblecompletions,insertsthepMossible'completions,ormactuallym pMerformsthecompletion,depMendingmonwhic!hbeha!vioris'desired.-2.'Thein!ternalfunctionrl_completion_matches()usesanapplication-suppliedgener-'ator:yfunctionqQtoqPgeneratethelistofpMossiblematc!hes,
andthenreturnsthearra!yof'these>matc!hes.fThecallershouldplacetheaddressofits?generatorfunctioninrl_'completion_entry_function.-3.'ThegeneratorfunctioniscalledrepMeatedlyfromrl_completion_matches(),Lreturning'anstringeac!htime.Theargumentstoothegeneratorfunctionaretext+nandstate.text'isthepartialw!ordtobMecompleted.xRstateviszerothersttimethefunctioniscalled,'allo!wingG2thegeneratortoG3pMerformanynecessaryinitialization,eandapMositivenon-'zeroin!tegerforeachsubsequentcall.ћThegeneratorfunctionreturns(charf*)NULLto'informrl_completion_matches()thattherearenomorepMossibilitiesleft.Usually'the^generatorfunctioncomputesthelistof]pMossiblecompletionswhenstateDeiszero,'andjreturnskthemoneatatimeonsubsequen!tcalls.Eachstringjthegeneratorfunction'returnsԨasamatc!hmustbMeallocatedwithmalloc();Readlinefreesthestringswhen'ithasnishedwiththem.TSuc!hageneratorfunctionisreferredtoasanapplication-'spMecicfcompletionfunction.Bz[Feunction]G@intLrl_completey(Aintignore,intinvokingFGkey).Completetthesw!ordatorbMeforepoin!t.YeouhavesuppliedsthefunctionthatdoMesthe.initialsimplematc!hingselectionalgorithm(seerl_completion_matches()).wThe.defaultfistodolenamecompletion.3[Veariable]G@rl_compentry_func_tL*rl_completion_entry_function.ThisJisIapMoin!tertothegeneratorfunctionforrl_completion_matches().OIfthe.vdDalueofrl_completion_entry_functionisNULLthenthedefaultlenamegenerator.function,rl_filename_completion_function(),isgused.
!Anapplication-spMecic.completionfunctionisafunctionwhoseaddressisassignedtorl_completion_entry_.functionfandwhosereturnvdDaluesareusedtogeneratepMossiblecompletions.
>Gg2.6.2d(CompletionMFģunctions3GHerefisthecompletelistofcallablecompletionfunctionspresen!tinReadline.z[Feunction]G@intLrl_complete_internaly(AintwhatFGtoFdo).Completefthew!ordfatorbMeforepoin!t.what>xHtto>xHdosaysfwhatftodowiththecom-.pletion.(AcvdDaluejof`?'meanslistthepMossiblecompletions.(`TAB'meansdostandard.completion.&'`*'~meansinsertallofthepMossiblecompletions.&'`!'meanstodispla!yall.of!)thepMossiblecompletions,?ifthereis!*morethanone,?asw!ellaspMerformingpartial.completion.*`@'GMisGNsimilarto`!',ZRbutpMossiblecompletionsarenotlistedifthepMossible.completionsfshareacommonprex.5GChapterf2:ProgrammingwithGNUReadlineʗ5333͍z[Feunction]G@intLrl_completey(Aintignore,intinvokingFGkey)
33.Completethew!ordatorbMeforepoin!t.aYeouhavesuppliedthefunctionthatdoMes.theinitialsimplematc!hingselectionalgorithm(seerl_completion_matches()and.rl_completion_entry_function).XTheNdefaultNistodolenamecompletion.XThis.callsfrl_complete_internal()withanargumen!tdepMendingoninvoking>xHtkey.Q썍z[Feunction]G@intLrl_possible_completionsy(Aintcount,intinvokingFGkey).ListthepMossiblecompletions.Seedescriptionofrl_completef().Thiscallsrl_.complete_internal()fwithanargumen!tof`?'.Q퍍z[Feunction]G@intLrl_insert_completionsy(Aintcount,intinvokingFGkey).Insert	the	listofpMossiblecompletionsin!totheline,"deletingthepartially-completed.w!ord.WSeedescriptionofrl_complete().Thiscallsrl_complete_internal()with.anfargumen!tof`*'.z[Feunction]G@intLrl_completion_modey(ArlFGcommandFfuncFt*cfunc).ReturnstheappropriatevdDaluetopasstorl_complete_internal()depMendingon.whetherxcfunc{w!ascalledwtwiceinwsuccessionandthevdDaluesoftheshow-all-if-.ambiguousOandOshow-all-if-unmodifiedvdDariables.Application-spMeciccompletion.functionsfma!yusethisfunctiontopresentthesameinterfaceasrl_complete().z[Feunction]G@charL**rl_completion_matchesy(Aconstchar*text,DGrlFGcompUVentryFfuncFt*entryFfunc).Returns^an]arra!yofstringswhich]isalistofcompletionsfortext.Ifthereareno.completions,C;returns#NULL.VCThe#rsten!tryinthereturnedarra!yisthesubstitution.for)Gtext.(Theremainingen!triesarethepMossiblecompletions.Thearra!yisterminated.withfaNULLpMoin!ter.B.en!try>xHtfunchoislakfunctionoft!woargs,mandreturnsalcharf*.%Therstargumen!tis.text.Thedsecondisastateeargumen!t;#bitiszeroontherstcall,andnon-zeroon.subsequen!t~calls.#entry>xHtfuncreturnsa}NULLpMointer}tothecallerwhenthereareno.morefmatc!hes.z[Feunction]G@charL*rl_filename_completion_functiony(Aconstchar*text,intDGstate).Ageneratorfunctionforlenamecompletioninthegeneralcase.textPisapartialle-.name.UTheBashsourceisausefulreferenceforwritingapplication-spMeciccompletion.functionsf(theBashcompletionfunctionscallthisandotherReadlinefunctions).Q퍍z[Feunction]G@charL*rl_username_completion_functiony(Aconstchar*text,intDGstate).Al&completionl4generatorl5forusernames.xtext4con!tainsapartialusernameprecededb!y.arandomc!haracter(usually`~').Aswithallcompletiongenerators,stateHiszeroon.thefrstcallandnon-zeroforsubsequen!tcalls.\Gg2.6.3d(CompletionMVģariables3[Veariable]G@rl_compentry_func_tL*rl_completion_entry_function.A{pMoin!tertothegeneratorfunctionforrl_completion_matches().dNULLmeansto.usefrl_filename_completion_function(),thedefaultlenamecompleter.6ӈGChapterf2:ProgrammingwithGNUReadlineʗ5433͍3[Veariable]G@rl_completion_func_tL*rl_attempted_completion_function
33.A,pMoin!ter,to,analternative,functiontocreatematc!hes.pThefunctioniscalledwith.text,start,and end.qstart andend/rareindicesinrl_line_bufferdeningthebMound-.ariesoftext,9\whic!hisac!haracterstring.nIfthisfunctionexistsandreturnsNULL,9]orif.thisvdDariableissettoNULL,thenrl_complete()willcallthevdDalueofrl_completion_.entry_functionhtohgeneratematc!hes,u)otherwisethearra!yofstringsreturnedwillbMe.used.tIf,this+functionsetstherl_attempted_completion_overvdDariabletoanon-zero.vdDalue,-ReadlinewillnotpMerformitsdefaultcompletionev!enifthisfunctionreturns.nofmatc!hes.3[Veariable]G@rl_quote_func_tL*rl_filename_quoting_function.ApMoin!tertoafunctionthatwillquotealenameinanapplication-spMecicfashion..ThisKiscallediflenamecompletionisJbMeingattemptedandoneofthec!haracters.inrl_filename_quote_charactersappMearsinacompletedlename.`Thefunction.ismPcalledwithmQtext,
matc!h>xHttypMe,andmPquote>xHpoin!ter.2ThemPtextPisthemQlenametobMe.quoted.	(TThematc!h>xHttypMeiseitherSINGLE_MATCH,pifthereisonlyonecompletion.matc!h,̂orMULT_MATCH.9SSomefunctionsusethistodecidewhetherornottoinserta.closingquotec!haracter.{Thequote>xHtpMointerIisapMointertoanyopMeningquotecharacter.thefusert!ypMed.SomefunctionschoMosetoresetthischaracter.3[Veariable]G@rl_dequote_func_tL*rl_filename_dequoting_function.ApMoin!tertoafunctionthatwillremo!veapplication-spMecicquotingc!haractersfrom.alenamebMeforecompletionisattempted,sothosec!haractersdonotinterferewith.matc!hingthetextagainstnamesinthelesystem.NItiscalledwithtext,@thetext.ofxthew!ordtowbMedequoted,m|andquote>xHtchar,m|whichiswthequotingcharacterthat.delimits>thelename?(usually`''or`"').fIfquote>xHtc!hargiszero,thelenamew!asnot.infanem!bMeddedstring.3[Veariable]G@rl_linebuf_func_tL*rl_char_is_quoted_p.AkpMoin!terl2toafunctiontocallthatdetermineswhetherornotaspecicc!haracter.in#^theline#_buerisquoted,Baccordingtowhatev!erquotingmec!hanismtheprogram.callingReadlineuses.Thefunctioniscalledwitht!woarguments:text, thetextofthe.line,andindex,theindexofthec!haracterintheline.!Itisusedtodecidewhethera.c!haracterFfoundEinrl_completer_word_break_charactersshouldbMeusedtobreak.w!ordsfforthecompleter.3[Veariable]G@rl_compignore_func_tL*rl_ignore_some_completions_function.Thishfunction,hifdened,iiscalledb!ythecompleterwhenreallenamecompletion.isdone,1afterallthematc!hingnamesha!vebMeengenerated.+ItispassedaNULLter-.minatedZarra!yYofmatches.TherstelementY(matches[0])isthemaximalsubstring.commontEtotFallmatc!hes.(Thisfunctioncanre-arrangethelistofmatc!hesasrequired,.butfeac!helementdeletedfromthearraymustbMefreed.3[Veariable]G@rl_icppfunc_tL*rl_directory_completion_hook.ThisqAfunction,ifdened,isallo!wedq@toqAmoMdifythedirectorypMortionoflenames.Readline0completes.}
It0couldbMeusedtoexpandsym!bMoliclinksorshellvdDariablesin.pathnames.tItwisxcalledwiththeaddressofastring(thecurren!tdirectoryname).as6anargumen!t,andmaymoMdifythatstring.zMIfthestringisreplacedwithanew.string,UtheYoldvdDalueshouldbMefreed.ŶAn!yXmodieddirectorynameshouldha!veYa7[GChapterf2:ProgrammingwithGNUReadlineʗ5533͍.trailing2slash.ThemoMdiedvdDalue2willbeusedas2partofthecompletion,Ureplacing
33.the}directory~pMortionofthepathnametheusert!ypMed.S#Atthe}least,Devenif~noother.expansionEQispMerformed,mthisfunctionshouldremo!veEQanyERquotecharactersfromthe.directoryfname,bMecauseitsresultwillbepasseddirectlytoopendir().軍.ThedirectorycompletionhoMokreturnsanin!tegerthatshouldbMenon-zeroifthefunc-.tionmoMdiesitsdirectoryargumen!t.;ThefunctionshouldnotmoMdifythedirectory.argumen!tfifitreturns0.B3[Veariable]G@rl_icppfunc_tL*rl_directory_rewrite_hook;.Ifnon-zero,dthisistheaddressofafunctiontocallwhencompletingadirectoryname..This2}functiontak!esthe2~addressofthedirectorynametobMemodied2}asanargumen!t..Unlik!erl_directory_completion_hook,itonlymoMdiesthedirectorynameused.in>opendir,enotwhatisdispla!yed>when>thepMossiblecompletionsareprin!tedorin-.serted.NIt&is&calledbMeforerl>xHtdirectory>xHcompletion>xHhook.NA!t&the&least,@Bevenif&noother.expansionEQispMerformed,mthisfunctionshouldremo!veEQanyERquotecharactersfromthe.directoryfname,bMecauseitsresultwillbepasseddirectlytoopendir()..The*directory+rewritehoMokreturnsanin!tegerthatshouldbMenon-zeroifthefunc-.tionmoMdiesitsdirectoryargumen!t.;ThefunctionshouldnotmoMdifythedirectory.argumen!tfifitreturns0.B3[Veariable]G@rl_icppfunc_tL*rl_filename_stat_hook.If?non-zero,thisisthe>addressofafunctionforthecompletertocallbMeforedeciding.whic!hcharactertoappMendtoacompletedname.ThisfunctionmoMdiesitslename.nameFargumen!t,mandthemoMdiedvdDalueispassedtostat()todeterminethele's.t!ypMe:andcharacteristics.YThisfunction;doMesnotneedtoremovequotecharacters.fromfthelename..ThestathoMokreturnsanin!tegerthat
shouldbenon-zeroifthefunctionmodies.itsdirectoryargumen!t.)ThefunctionshouldnotmoMdifythedirectoryargumen!tifit.returnsf0.C3[Veariable]G@rl_dequote_func_tL*rl_filename_rewrite_hook.If non-zero,thisistheaddressofafunctioncalledwhenreadingdirectoryen!tries.fromthelesystemforcompletionandcomparingthemtothepartialw!ordtobMe.completed.zThe?>function?=shouldpMerforman!ynecessaryapplicationorsystem-spMecic.con!versiononthelename,9$suc!hascon!vertingbMetweencharactersetsorcon!verting.fromalesystemformattoac!haracterinputformat.8Thefunctiontak!estwoargu-.men!ts:Rfname,Cthe$!lename$ tobMecon!verted,Cand$!fnlen,itslength$ inb!ytes.WItmust.eitherȊreturnitsrstargumen!t(ifnoȋconversiontakesplace)ortheconvertedlename.indnewly-alloMcatedmemorye.Thedcon!verteddformisusedtocompareagainstthew!ord.toBbMeBcompleted,Vand,ifitBmatc!hes,isaddedBtothelistofmatc!hes.Readlinewillfree.thefalloMcatedstring.B3[Veariable]G@rl_compdisp_func_tL*rl_completion_display_matches_hook.Ifxnon-zero,Athenthisistheaddressofafunctiontocallwhencompletingaw!ordwould.normallydispla!ythelistofpMossiblematc!hes.MThisfunctioniscalledinlieuofReadline.displa!yings7thelist.DPIts8takesthreearguments:w(charf**matches,kintnum>xHtmatches,.int-max>xHtlength)-wherematc!hesisthearra!yofmatc!hingstrings,EUnum>xHtmatchesisthe8GChapterf2:ProgrammingwithGNUReadlineʗ5633͍.n!umbMeracofabstringsinthatarra!ye,!andmax>xHtlengthisthelengthofthelongeststring
33.inthatarra!ye.Readlineprovidesaconveniencefunction,rl_display_match_list,.that\tak!es[careofdoingthedispla!ytoReadline'soutputstream.pYeouma!ycallthat.functionffromthishoMok.3[Veariable]G@constLchar*rl_basic_word_break_characters.TheOobasiclistofc!haractersthatsignalOnabreakbMetweenwordsforthecompleter.routine.MThev[defaultvdDalueofthisv\variableisthec!haracterswhichbreakwordsfor.completionfinBash:"\t\n\"\\'`@$><=;|&{(".3[Veariable]G@constLchar*rl_basic_quote_characters.Aflistofquotec!haracterswhichcancauseawordbreak.3[Veariable]G@constLchar*rl_completer_word_break_characters.Thelistofc!haractersthatsignal~abreakbMetweenwordsforrl_complete_.internal().ThefdefaultlististhevdDalueofrl_basic_word_break_characters.3[Veariable]G@rl_cpvfunc_tL*rl_completion_word_break_hook.Ifnon-zero,ьthisistheaddressofafunctiontocallwhenReadlineisdecidingwhere.toseparatew!ordsforwordcompletion.FItshouldreturnacharacterstringlikerl_.completer_word_break_characterstobMeusedtoperformthecurren!tcompletion..TheMfunctionma!yLchoMoseMtosetrl_completer_word_break_charactersitself.Ifthe.functionfreturnsNULL,rl_completer_word_break_charactersisused.3[Veariable]G@constLchar*rl_completer_quote_characters.AClist^ofc!haracters]which^canbMeusedtoquoteasubstringoftheline.Completion.oMccurs&on&theen!tiresubstring,@8andwithinthesubstringrl_completer_word_break_.characters8\are8[treatedasan!yotherc!haracter,\unlesstheyalsoappMearwithinthis.list.3[Veariable]G@constLchar*rl_filename_quote_characters.A]listvofwc!haractersthatcausealenametobMequotedb!ythecompleterwhenthey.appMearfinacompletedlename.Thedefaultisthen!ullstring.3[Veariable]G@constLchar*rl_special_prefixes.TheSlistSofc!haractersthatarew!ordbreakcharacters,d8butSshouldbMeleftintextwhen.itispassedtothecompletionfunction.Programscanusethistohelpdeterminewhat.kindUofUcompletingtodo.
Feorinstance,fBashsetsthisvdDariableto"$@"sothatitcan.completefshellvdDariablesandhostnames.3[Veariable]G@intLrl_completion_query_items.UpYAtothisman!yitemswillbMedisplayedinrespMonsetoapossible-completionscall..AfterVthat,f&readlineasksVtheuserifsheissureshew!antsVtoseethemall.Thedefault.vdDaluefis100.Anegativ!evalueindicatesthatReadlineshouldnev!erasktheuser.3[Veariable]G@intLrl_completion_append_character.Whenasinglecompletionalternativ!ematchesattheendofthecommandline,this.c!haracter?isappMendedtotheinsertedcompletiontext.Thedefaultisaspacecharacter.(`f').Setting2this2tothen!ullcharacter(`\0')2preventsanythingbMeing2appended2auto-.maticallye.,ThisQcanbMec!hangedinapplication-specicRcompletionfunctionstopro!vide9䍟GChapterf2:ProgrammingwithGNUReadlineʗ5733͍.the\mostsensiblew!ordseparatorcharacter"accordingtoanapplication-spMeciccom-
33.mandVlinesyn!taxspMecication.-Itissettothedefaultbeforean!yapplication-specic.completionffunctioniscalled,andma!yonlybMechangedwithinsuchafunction.΍3[Veariable]G@intLrl_completion_suppress_append.Ifnon-zero,rl>xHtcompletion>xHappMend>xHc!haracterisnotappMendedtomatc!hesattheend.ofOthecommandOline,`asdescribMedabo!ve.ItOissetto0Obeforean!yapplication-specic.completionffunctioniscalled,andma!yonlybMechangedwithinsuchafunction.͍3[Veariable]G@intLrl_completion_quote_character.WhenX;ReadlineisX:completingquotedtext,asdelimitedb!yoneofthec!haractersin.rl>xHtcompleter>xHquote>xHc!haracters,CitsetsthisvdDariabletothequotingc!haracterfound..ThisfissetbMeforean!yapplication-speciccompletionfunctioniscalled.3[Veariable]G@intLrl_completion_suppress_quote.IfDnon-zero,ReadlineCdoMesnotappMendamatc!hingquotec!haracterwhenpMerforming.completionGonFaquotedstring.~Itissetto0bMeforean!yapplication-spMeciccompletion.functionfiscalled,andma!yonlybMechangedwithinsuchafunction.͍3[Veariable]G@intLrl_completion_found_quote.WhenReadlineiscompletingquotedtext,֟itsetsthisvdDariabletoanon-zerovdDalueif.thew!ordbMeingcompletedcontainsorisdelimitedbyanyquotingcharacters,including.bac!kslashes.ThisfissetbMeforeanyapplication-spMeciccompletionfunctioniscalled.3[Veariable]G@intLrl_completion_mark_symlink_dirs.Ifѧnon-zero,waslashwillbMeappendedtocompletedlenamesthataresym!boliclinks.tordirectorysnames,subjecttothevdDalueoftheuser-settablemark-directoriesYvdDariable..ThisImvdDariableexistssothatapplication-spMeciccompletionfunctionscano!verrideImthe.user'sglobalpreference(setviathemark-symlink!ed-directoriesReadlinevdDariable).ifappropriate.vThisvdDariableissettotheuser'spreferencebMeforean!yapplication-.spMeciccompletionfunctioniscalled,sounlessthatfunctionmoMdiesthevdDalue,the.user'sfpreferencesarehonored.3[Veariable]G@intLrl_ignore_completion_duplicates.Iffnon-zero,thenduplicatesinthematc!hesareremoved.Thedefaultis1.͍3[Veariable]G@intLrl_filename_completion_desired.Non-zeromeansthat	theresultsofthematc!hesaretobMetreatedaslenames.]This.is'always?zero(whencompletionisattempted,andcanonlybMec!hangedwithinan.application-spMeciccompletionfunction.!Ifitissettoanon-zerovdDalueb!ysucha.function,directory
namesha!ve	a
slashappMendedandReadlineattemptstoquotecom-.pleted6 lenamesifthey6!con!tainanycharactersinrl_filename_quote_characters.andfrl_filename_quoting_desiredissettoanon-zerovdDalue.3[Veariable]G@intLrl_filename_quoting_desired.Non-zero^nmeansthatthe^mresultsofthematc!hesaretobMequotedusingdoublequotes.(or8anapplication-spMecicquotingmec!hanism)7ifthecompletedlenamecontains.an!yQJcharactersQIinrl_filename_quote_chars.~Thisisalways7bnon-zerowhencomple-.tionQ	isQattempted,bandcanonlybMec!hangedwithinanapplication-spMeciccompletion.function.}ThequotingiseectedviaacalltothefunctionpMoin!tedtob!yrl_filename_.quoting_function.:BGChapterf2:ProgrammingwithGNUReadlineʗ5833͍3[Veariable]G@intLrl_attempted_completion_over
33.IfOanapplication-spMeciccompletionOfunctionassignedtorl_attempted_.completion_functionbsetsbthisvdDariabletoanon-zerovdDalue,Readlinewillnot.pMerformitsdefaultlenamecompletionev!eniftheapplication'scompletionfunction.returnsfnomatc!hes.ItshouldbMesetonlybyanapplication'scompletionfunction.333[Veariable]G@intLrl_sort_completion_matches.IfanapplicationsetsthisvdDariableto0,WReadlinewillnotsortthelistofcompletions.(whic!himpliesthatitcannotremoveanyduplicatecompletions).ThedefaultvdDalueis.1,whic!hmeansthatReadlinewillsortthecompletionsand,depMendingonthevdDalue.offrl_ignore_completion_duplicates,willattempttoremo!vefduplicatematc!hes.3[Veariable]G@intLrl_completion_type.Set61to62ac!haracterdescribingthet!ypMeofcompletionReadlineiscurren!tlyattempt-.ing;.qseethedescriptionofrl_complete_internal()(seeSection2.6.2[Completion.Feunctions],%pageg52)forthelistofc!haracters."ThisissettotheappropriatevdDalue.bMefore͡an!y͠application-speciccompletionfunctionis͠called,pallo!wingsuch͡functions.tofpresen!tthesameinterfaceasrl_complete().3[Veariable]G@intLrl_completion_invoking_key.SetRtoQthenalc!haracterinthek!eysequencethatin!vokedoneRofthecompletion.functionsthatcallrl_complete_internal().o(ThisissettotheappropriatevdDalue.bMeforefan!yapplication-speciccompletionfunctioniscalled.3[Veariable]G@intLrl_inhibit_completion.Ifd`thisdavdDariableisnon-zero,qcompletionisinhibited.Thecompletionc!haracterwillbMe.insertedfasan!yotherbMoundtoself-insert.Gg2.6.4d(AMShortCompletionExample3GHere}aisa}`smallapplicationdemonstratingtheuseoftheGNU}VReadlinelibrarye.0ItiscalledGfileman,0andthesourcecoMderesidesinexamples/fileman.c.6)ThissampleapplicationGpro!vides#completionof#commandnames,>lineeditingfeatures,andaccessto#thehistorylist.;'6GChapterf2:ProgrammingwithGNUReadlineʗ5933͍./*fileman.c--Atinyapplicationwhichdemonstrateshowtousethe
=&^GNUReadlinelibrary.	s,Thisapplicationinteractivelyallowsusers=&^tomanipulatefilesandtheirmodes.*/.#ifdefHAVE_CONFIG_H.#	s,include<config.h>.#endif.#include<sys/types.h>.#ifdefHAVE_SYS_FILE_H.#	s,include<sys/file.h>.#endif.#include<sys/stat.h>.#ifdefHAVE_UNISTD_H.#	s,include<unistd.h>.#endif.#include<fcntl.h>.#include<stdio.h>.#include<errno.h>.#ifdefined(HAVE_STRING_H).#	s,include<string.h>.#else/*!HAVE_STRING_H*/.#	s,include<strings.h>.#endif/*!HAVE_STRING_H*/.#ifdefHAVE_STDLIB_H.#	s,include<stdlib.h>.#endif.#include<time.h>.#include<readline/readline.h>.#include<readline/history.h>.externchar*xmallocPARAMS((size_t));./*Thenamesoffunctionsthatactuallydothemanipulation.*/.intcom_listPARAMS((char*));.intcom_viewPARAMS((char*));.intcom_renamePARAMS((char*));.intcom_statPARAMS((char*));.intcom_pwdPARAMS((char*));.intcom_deletePARAMS((char*));.intcom_helpPARAMS((char*));.intcom_cdPARAMS((char*));.intcom_quitPARAMS((char*));./*Astructurewhichcontainsinformationonthecommandsthisprogram=&^canunderstand.*/.typedefstruct{8lchar*name;/*Userprintablenameofthefunction.*/8lrl_icpfunc_t*func;/*Functiontocalltodothejob.*/8lchar*doc;/*Documentationforthisfunction.	s,*/.}COMMAND;<1xGChapterf2:ProgrammingwithGNUReadlineʗ6033L͍.COMMANDcommands[]={
8l{"cd",com_cd,"ChangetodirectoryDIR"},8l{"delete",com_delete,"DeleteFILE"},8l{"help",com_help,"Displaythistext"},8l{"?",com_help,"Synonymfor`help'"},8l{"list",com_list,"ListfilesinDIR"},8l{"ls",com_list,"Synonymfor`list'"},8l{"pwd",com_pwd,"Printthecurrentworkingdirectory"},8l{"quit",com_quit,"QuitusingFileman"},8l{"rename",com_rename,"RenameFILEtoNEWNAME"},8l{"stat",com_stat,"PrintoutstatisticsonFILE"},8l{"view",com_view,"ViewthecontentsofFILE"},8l{(char*)NULL,(rl_icpfunc_t*)NULL,(char*)NULL}.};./*Forwarddeclarations.*/.char*stripwhite();.COMMAND*find_command();./*Thenameofthisprogram,astakenfromargv[0].*/.char*progname;./*Whennon-zero,thisglobalmeanstheuserisdoneusingthisprogram.*/.intdone;.char*.dupstr(s)Fchar*s;.{8lchar*r;8lr=xmalloc(strlen(s)+1);8lstrcpy(r,s);8lreturn(r);.}.main(argc,argv)Fintargc;Fchar**argv;.{8lchar*line,*s;8lprogname=argv[0];8linitialize_readline();/*Bindourcompleter.*/8l/*Loopreadingandexecutinglinesuntiltheuserquits.*/8lfor(;done==0;)A{KS line=readline("FileMan:");KS if(!line)TLbreak;KS /*Removeleadingandtrailingwhitespacefromtheline.YThen,ifthereisanythingleft,addittothehistorylistYandexecuteit.*/=8荟GChapterf2:ProgrammingwithGNUReadlineʗ6133͍KS s=stripwhite(line);KS if(*s)
TL{^9xadd_history(s);^9xexecute_line(s);TL}KS free(line);A}8lexit(0);.}./*Executeacommandline.*/.int.execute_line(line)Fchar*line;.{8lregisterinti;8lCOMMAND*command;8lchar*word;8l/*Isolatethecommandword.*/8li=0;8lwhile(line[i]&&whitespace(line[i]))Ai++;8lword=line+i;8lwhile(line[i]&&!whitespace(line[i]))Ai++;8lif(line[i])Aline[i++]='\0';8lcommand=find_command(word);8lif(!command)A{KS fprintf(stderr,"%s:NosuchcommandforFileMan.\n",word);KS return(-1);A}8l/*Getargumenttocommand,ifany.*/8lwhile(whitespace(line[i]))Ai++;8lword=line+i;8l/*Callthefunction.*/8lreturn((*(command->func))(word));.}./*LookupNAMEasthenameofacommand,andreturnapointertothat=&^command.	s,ReturnaNULLpointerifNAMEisn'tacommandname.*/.COMMAND*.find_command(name)Fchar*name;.{>@!GChapterf2:ProgrammingwithGNUReadlineʗ6233͍8lregisterinti;8lfor(i=0;commands[i].name;i++)
Aif(strcmp(name,commands[i].name)==0)KS return(&commands[i]);8lreturn((COMMAND*)NULL);.}./*StripwhitespacefromthestartandendofSTRING.	s,Returnapointer=&^intoSTRING.*/.char*.stripwhite(string)Fchar*string;.{8lregisterchar*s,*t;8lfor(s=string;whitespace(*s);s++)A;8lif(*s==0)Areturn(s);8lt=s+strlen(s)-1;8lwhile(t>s&&whitespace(*t))At--;8l*++t='\0';8lreturns;.}./******************************************************************/./*7ج*/./*UInterfacetoReadlineCompletionK`*/./*7ج*/./******************************************************************/.char*command_generatorPARAMS((constchar*,int));.char**fileman_completionPARAMS((constchar*,int,int));./*TelltheGNUReadlinelibraryhowtocomplete.	s,Wewanttotrytocomplete=&^oncommandnamesifthisisthefirstwordintheline,oronfilenames=&^ifnot.*/.initialize_readline().{8l/*Allowconditionalparsingofthe~/.inputrcfile.*/8lrl_readline_name="FileMan";8l/*Tellthecompleterthatwewantacrackfirst.*/8lrl_attempted_completion_function=fileman_completion;.}./*AttempttocompleteonthecontentsofTEXT.	s,STARTandENDboundthe=&^regionofrl_line_bufferthatcontainsthewordtocomplete.	s,TEXTis=&^thewordtocomplete.	s,Wecanusetheentirecontentsofrl_line_buffer=&^incasewewanttodosomesimpleparsing.	s,Returnthearrayofmatches,=&^orNULLiftherearen'tany.*/.char**?ElGChapterf2:ProgrammingwithGNUReadlineʗ6333͍.fileman_completion(text,start,end)
Fconstchar*text;Fintstart,end;.{8lchar**matches;8lmatches=(char**)NULL;8l/*Ifthiswordisatthestartoftheline,thenitisacommand
Ftocomplete.	s,OtherwiseitisthenameofafileinthecurrentFdirectory.*/8lif(start==0)Amatches=rl_completion_matches(text,command_generator);8lreturn(matches);.}./*Generatorfunctionforcommandcompletion.	s,STATEletsusknowwhether=&^tostartfromscratch;withoutanystate(i.e.STATE==0),thenwe=&^startatthetopofthelist.*/.char*.command_generator(text,state)Fconstchar*text;Fintstate;.{8lstaticintlist_index,len;8lchar*name;8l/*Ifthisisanewwordtocomplete,initializenow.	s,ThisincludesFsavingthelengthofTEXTforefficiency,andinitializingtheindexFvariableto0.*/8lif(!state)A{KS list_index=0;KS len=strlen(text);A}8l/*Returnthenextnamewhichpartiallymatchesfromthecommandlist.*/8lwhile(name=commands[list_index].name)A{KS list_index++;KS if(strncmp(name,text,len)==0)TLreturn(dupstr(name));A}8l/*Ifnonamesmatched,thenreturnNULL.*/8lreturn((char*)NULL);.}./******************************************************************/./*7ج*/./*lzFileManCommands*/./*7ج*/./******************************************************************/./*Stringtopasstosystem().	s,ThisisfortheLIST,VIEWandRENAME=&^commands.*/@MGGChapterf2:ProgrammingwithGNUReadlineʗ6433͍.staticcharsyscom[1024];./*Listthefile(s)namedinarg.*/
.com_list(arg)Fchar*arg;.{8lif(!arg)Aarg="";8lsprintf(syscom,"ls-FClg%s",arg);8lreturn(system(syscom));.}.com_view(arg)Fchar*arg;.{8lif(!valid_argument("view",arg))Areturn1;.#ifdefined(__MSDOS__)8l/*more.comdoesn'tgrokslashesinpathnames*/8lsprintf(syscom,"less%s",arg);.#else8lsprintf(syscom,"more%s",arg);.#endif8lreturn(system(syscom));.}.com_rename(arg)Fchar*arg;.{8ltoo_dangerous("rename");8lreturn(1);.}.com_stat(arg)Fchar*arg;.{8lstructstatfinfo;8lif(!valid_argument("stat",arg))Areturn(1);8lif(stat(arg,&finfo)==-1)A{KS perror(arg);KS return(1);A}8lprintf("Statisticsfor`%s':\n",arg);8lprintf("%shas%dlink%s,andis%dbyte%sinlength.\n",8larg,^9xfinfo.st_nlink,^9x(finfo.st_nlink==1)?"":"s",^9xfinfo.st_size,^9x(finfo.st_size==1)?"":"s");8lprintf("InodeLastChangeat:%s",ctime(&finfo.st_ctime));ATэGChapterf2:ProgrammingwithGNUReadlineʗ6533͍8lprintf("YLastaccessat:%s",ctime(&finfo.st_atime));
8lprintf("XLastmodifiedat:%s",ctime(&finfo.st_mtime));8lreturn(0);.}.com_delete(arg)Fchar*arg;.{8ltoo_dangerous("delete");8lreturn(1);.}./*PrintouthelpforARG,orforallofthecommandsifARGis=&^notpresent.*/.com_help(arg)Fchar*arg;.{8lregisterinti;8lintprinted=0;8lfor(i=0;commands[i].name;i++)A{KS if(!*arg||(strcmp(arg,commands[i].name)==0))TL{^9xprintf("%s\t\t%s.\n",commands[i].name,commands[i].doc);^9xprinted++;TL}A}8lif(!printed)A{KS printf("Nocommandsmatch`%s'.	s,Possibilitiesare:\n",arg);KS for(i=0;commands[i].name;i++)TL{^9x/*Printinsixcolumns.*/^9xif(printed==6)g{qprinted=0;qprintf("\n");g}^9xprintf("%s\t",commands[i].name);^9xprinted++;TL}KS if(printed)TLprintf("\n");A}8lreturn(0);.}./*ChangetothedirectoryARG.*/.com_cd(arg)Fchar*arg;.{8lif(chdir(arg)==-1)A{BZtGChapterf2:ProgrammingwithGNUReadlineʗ6633͍KS perror(arg);
KS return1;A}8lcom_pwd("");8lreturn(0);.}./*Printoutthecurrentworkingdirectory.*/.com_pwd(ignore)Fchar*ignore;.{8lchardir[1024],*s;8ls=getcwd(dir,sizeof(dir)-1);8lif(s==0)A{KS printf("Errorgettingpwd:%s\n",dir);KS return1;A}8lprintf("Currentdirectoryis%s\n",dir);8lreturn0;.}./*Theuserwishestoquitusingthisprogram.	s,JustsetDONEnon-zero.*/.com_quit(arg)Fchar*arg;.{8ldone=1;8lreturn(0);.}./*Functionwhichtellsyouthatyoucan'tdothis.*/.too_dangerous(caller)Fchar*caller;.{8lfprintf(stderr,b"%s:Toodangerousformetodistribute.	s,Writeityourself.\n",bcaller);.}./*Returnnon-zeroifARGisavalidargumentforCALLER,elseprint=&^anerrormessageandreturnzero.*/.int.valid_argument(caller,arg)Fchar*caller,*arg;.{8lif(!arg||!*arg)A{KS fprintf(stderr,"%s:Argumentrequired.\n",caller);KS return(0);A}8lreturn(1);.}C_6733͍GTApp=endixzA	QGNUzFaGreeDocumenutationLicenseAVeersionf1.3,3No!vembMerf2008Q.Cop!yrightcf
@2000,f2001,2002,2007,2008FereeSoft!warefFoundation,Inc.
33.http://fsf.org/ff.Ev!eryonefispMermittedtocop!yanddistributeverbatimcopies.offthislicensedoMcumen!t,butchangingitisnotallowed.-0.'PREAMBLE'ThevQpurpMosevRofthisLicenseistomak!eaman!ual,LtextbMook,orvQothervRfunctionaland'usefuldoMcumen!tfree;inthesenseoffreedom:!toassureev!eryonetheeectivefreedom'to9cop!y:andredistributeit,.withorwithoutmoMdifyingit,.eithercommerciallyornon-'commerciallye.cSecondarily,Hthis(aLicense(bpreserv!esfortheauthorandpublisheraw!ay'toW9getcreditW8fortheirw!ork,mwhilenotbMeingconsideredrespMonsibleformodications'madefb!yothers.'This/License0isakindof\cop!yleft",which/meansthatderivdDativ!eworksof0thedoMcument'm!ustthemselvesbMefreeinthesamesense. Itcomplemen!tstheGNUGeneralPublic'License,fwhic!hisacopyleftlicensedesignedforfreesoftware.'Wee#ha!vedesignedthisLicenseinordertouseit"formanualsforfreesoftware,bMecause'free?soft!wareneedsfree>doMcumentation:afreeprogramshould>comewithmanuals'pro!vidingurtheussamefreedomsthatthesoft!wareurdoMes.͌ButthisLicenseisnotlimitedto'soft!waremanuals;itcanbMeusedforan!ytextualw!ork,regardlessofsubjectmatteror'whether2itispublishedasaprin!tedbMook.@BWee2recommendthisLicenseprincipallyfor'w!orksfwhosepurpMoseisinstructionorreference.-1.'APPLICABILITYfANDDEFINITIONSP'This>License=appliestoan!ymanual=orotherwork,inany=medium,thatcontains>a'noticeplacedb!ythecop!yrightholdersayingitcanbMedistributedundertheterms'ofthisLicense.l=Suc!hanoticegrantsaworld-wide,
royalty-freelicense,unlimitedin'duration,
toouseothatw!orkundertheconditionsstatedherein.
9The\DoMcumen!t",'bMelo!w,tkrefersgtoanysuchgmanualorwork.
AnymembMerofthegpublicisalicensee,tkand'isaddressedas\y!ou".@Yeouacceptthelicenseifyoucopye, moMdifyordistributethework'infaw!ayfrequiringpMermissionundercop!yrightflaw.'A\MoMdiedVeersion"oftheDocumen!tmeansanyworkcontainingtheDoMcumentor'ahpMortiongofit,heithercopiedv!erbatim,horwithmoMdicationsand/ortranslatedin!to'anotherflanguage.'A\SecondarySection"isanamedappMendixorafron!t-mattersectionoftheDoMcumen!t'that/dealsexclusiv!ely0withtherelationshipofthepublishersorauthorsoftheDoMcumen!t'toz
thezDoMcumen!t'soverallzsubject(ortorelatedmatters)andcon!tainsnothingthat'couldخfallدdirectlywithinthato!verallsubject.t(Thus,%@iftheخDoMcumentisinدparta'textbMookՆofՅmathematics,MaSecondarySectionma!ynotexplainan!ymathematics.)=The'relationshipGcouldbMeamatterofhistoricalconnectionwiththesubjectorwithrelated'matters,jorBofBlegal,commercial,jphilosophical,ethicalorpMoliticalBpositionregarding'them.'Ther\In!vdDariantsSections"arecertainSecondarySectionswhosetitlesaredesignated,0as'bMeing2Dthose2CofIn!vdDariant2DSections,I}inthenoticethatsa!ysthattheDoMcumen!tisreleasedDexGAppMendixfA:GNUFereeDocumen!tationLicense:6833͍'underS5thisLicense."IfS4asectiondoMesnotttheabMo!veS5denitionofSecondarythenitis
33'notӍallo!wedtoӎbMedesignatedasInvdDariant.eSTheDoMcumentmayӎcontainzeroInvdDariant'Sections.IftheDoMcumen!tdoesnotiden!tifyanyInvdDariantSectionsthentherearenone.&g'Thef\Co!verfTeexts"arecertainshortpassagesoftextthatarelisted,asFeron!t-Cover'Teexts-orBac!k-Cover,Texts,"8in-thenoticethat,sa!ysthattheDoMcument,isreleasedunder'thisLicense.AAnFeron!t-CoverTeextmaybMeatmost5words,6andaBack-CoverTeextmay'bMefatmost25w!ords.&h'AC\Teransparen!t"CcopyofCtheDoMcumentmeansaCmachine-readablecopye,k(represented'inJmaformatJnwhosespMecicationisa!vdDailabletothegeneralpublic,snthatissuitablefor'revisingthedoMcumen!tstraightforwardlywithgenerictexteditorsor(forimagescom-'pMosedofpixels)genericpain!tprogramsor(fordra!wings)somewidelya!vdDailabledrawing'editor,and}thatissuitableforinputto}textformattersorforautomatictranslationto'a9OvdDariet!yof9Nformatssuitableforinputtotextformatters.A93cop!ymadeinanotherwise'Teransparen!tleformatwhosemarkup,orabsenceofmarkup,hasbMeenarrangedto'th!wart0or0discouragesubsequen!tmoMdicationb!yreadersisnotTeransparen!t.Animage'format isnotTeransparen!tifused foranysubstantialamountoftext.MA copythatis'notf\Teransparen!t"iscalled\Opaque".'ExamplescXofsuitablecWformatsforTeransparen!tcopiesincludeplainasci>Kiwithout'markup,TeexinfoXIinputformat,LaT,[wEB	XXJinputformat,K`y

cmr10SGMLorXJXMLusingapublicly'a!vdDailableDTD,andstandard-conformingsimpleHTML,P!ostScriptorPDFdesigned'for.h!umanmoMdication.4ExamplesoftransparentimageformatsincludePNG,ԟXCF'andJPG.OpaqueformatsincludeproprietaryformatsthatcanbMereadandedited'onlysb!ysproprietarywordsproMcessors,&JSGMLorXMLforwhic!htheDTDand/or'proMcessingW*toolsarenotW)generallya!vdDailable,CYandthemachine-generatedHTML,'P!ostScriptforPDFproMducedbysomewordproMcessorsforoutputpurposesonlye.'The\TitleP!age"means,<foraprin!tedbMook,<thetitlepageitself,<plussuc!hfollowing'pagesRasareneededtohold,c}legiblye,theRmaterialthisRLicenserequirestoappMearinthe'title1.page.Feorw!orks1-informatswhic!hdonotha!ve1.anytitle1.pageassuc!h,H\TitlePage"'meansthetextnearthemostprominen!tappMearanceofthew!ork'stitle,Xprecedingthe'bMeginningfofthebodyofthetext.'The)\publisher"means)an!ypMersonorentitythatdistributes)copiesoftheDoMcument'tofthepublic.&h'Asection\En!titledXYZ"meansanamedsubunitoftheDoMcumen!twhosetitleeither'isUpreciselyUXYZUorcon!tainsXYZinparen!thesesUfollowingUtextthattranslatesXYZUin'anotherlanguage.(HereXYZstandsforaspMecicsectionnamemen!tionedbelo!w, :such'asaa\Ac!knowledgements",o/\Dedications",\Endorsemen!ts",or\History".)Teo\Preserv!e'theTitle"ofsuc!hasectionwheny!oumoMdifytheDoMcumen!tmeansthatitremainsa'sectionf\En!titledXYZ"accordingtothisdenition.'TheSuDoMcumen!tmayincludeWearrantyDisclaimersnextSvtothenoticewhichstatesthat'thisLicenseappliestotheDoMcumen!t.TheseWearrantyDisclaimersareconsideredto'bMeincludedb!yreferenceinthisLicense,butonlyasregardsdisclaimingw!arranties:'an!ynothernimplicationthattheseWearran!tyDisclaimersnmayhavenisvoidnandhasno'eectfonthemeaningofthisLicense.-2.'VERBAeTIMfCOPYINGEuGAppMendixfA:GNUFereeDocumen!tationLicense:6933͍'Yeouma!ycopyanddistributetheDoMcumentinanymedium,eithercommerciallyor
33'noncommerciallye,zpro!videdthatthisLicense,thecop!yrightnotices,andthelicense'noticeKsa!yingK
thisLicenseappliestotheDoMcumen!tarereproMducedinallcopies,t7and'that1'y!ouaddno1(otherconditionswhatsoMevertothoseofthisLicense.Yeoumaynotuse'tec!hnicalmeasurestoobstructorcon!trolthereadingorfurthercop!yingofthecopies'y!oumakeordistribute.However,youmayacceptcompMensationinexchangeforcopies.'Ify!oudistributealargeenoughn!umbMerofcopiesy!oumustalsofollo!wtheconditions'infsection3."#'Yeou}ma!yalso}lendcopies,7underthesameconditionsstatedabMo!ve,8andyou}maypublicly'displa!yfcopies.-3.'COPYINGfINQUANTITY'Ify!oupublishprintedcopies(orcopiesinmediathatcommonlyha!veprintedcovers)of'the.DoMcumen!t,numbering.morethan-100,andthe.Documen!t'slicense-noticerequires'Co!verTeexts,<youmustenclosethecopiesincoversthatcarrye,<clearlyandlegibly,<all'these@Co!verTeexts:Fron!t-CoverTeextsonthefrontcover,andBack-CoverTeextson'thebac!kcover.
Bothcoversmustalsoclearlyandlegiblyiden!tifyyouasthepublisher'of,these+copies.H/Thefron!tcovermustpresent+thefulltitlewithallw!ordsofthetitle'equallyxprominen!tandyvisible.Yeoumayyaddothermaterialontheco!versxinaddition.'Cop!yingY4withY3changeslimitedY3totheco!vers,asY3longastheypreserv!ethetitleofthe'DoMcumen!tuandsatisfytheseconditions,canbetreateduasv!erbatimcopyinginother'respMects.'If|therequired}textsforeitherco!ver|aretoMov!oluminoustotlegiblye,youshouldput'therstoneslisted(asman!yastreasonably)ontheactualco!ver,andcontinuethe'restfon!toadjacentpages.""'If?|y!ou?{publishordistributeOpaquecopiesoftheDoMcumen!tnumbMering?|morethan100,'y!ou\3musteither\4includeamachine-readableTeransparentcopyalong\4witheachOpaque'cop!ye,[>or7state7inorwitheac!hOpaquecopy7acomputer-networkloMcation7fromwhich'theSgeneralRnet!work-usingpublichasRaccesstodownloadusingRpublic-standardnetwork'protoMcols=acomplete>Teransparen!tcopyoftheDoMcument,freeofaddedmaterial.cIf'y!ouusethelatteroption,youmusttakereasonablyprudentsteps,whenyoubMegin'distributionlofmOpaquecopiesinquan!titye,ӮtolensurethatthisTeransparen!tcopylwill'remainCth!usaccessibleDatthestatedloMcationuntilDatleastoneyearafterDthelasttime'y!oukdistributekanOpaquecopyk(directlyorthroughyourkagentsorretailers)kofthat'editionftothepublic.'It&Nisrequested,FHbutnotrequired,FGthaty!oucontacttheauthorsoftheDoMcumentwell'bMeforeoredistributingoan!ylargenumbMeroofcopies,ztogiv!ethemac!hancetopro!videyou'withfanupMdatedv!ersionoftheDocumen!t.-4.'MODIFICAeTIONS'Yeou*ma!ycopyand)distributeaMoMdiedVeersionoftheDoMcumen!tundertheconditions'ofsections2and3abMo!ve,]providedthatyoureleasetheMoMdiedVeersionunderprecisely'this{License,`withthe{MoMdiedVeersionllingtheroleoftheDoMcumen!t,`thus{licensing'distributionandmoMdicationoftheModiedVeersiontowhoev!erpossessesacop!yof'it.Infaddition,y!oumustdothesethingsintheMoMdiedVeersion:*A.=nUsepintheTitleP!age(andonthecovers,2ifany)atitledistinctfromthatofthe=nDoMcumen!t,+andfromthoseofpreviousversions(whichshould,+iftherewereanye,FXGAppMendixfA:GNUFereeDocumen!tationLicense:7033͍=nbMelistedintheHistorysectionoftheDocumen!t).3Yeoumayusethesametitleas
33=nafpreviousv!ersioniftheoriginalpublisherofthatversiongivespMermission.+gB.=nList\ontheTitle[P!age,Zasauthors,YoneormorepMersonsoren!titiesrespMonsiblefor=nauthorship"of"themoMdicationsintheMoMdiedVeersion,<|togetherwithatleastv!e=nof߸theprincipalauthorsoftheDoMcumen!t(allofitsprincipalauthors,uifithasfewer=nthanfv!e),unlesstheyreleaseyoufromthisrequirement.+@C.=nStateontheTitlepagethenameofthepublisheroftheMoMdiedVeersion,asthe=npublisher.*D.=nPreserv!efallthecopyrightnoticesoftheDoMcument.+oE.=nAddeandappropriatecop!yrightnoticeeforyouremoMdicationsadjacentetotheother=ncop!yrightfnotices.,LF.=nInclude,hSimmediatelyXafterthecop!yrightXnotices,alicensenoticegivingthepublic=npMermissiontousetheMoMdiedVeersionunderthetermsofthisLicense,Pintheform=nsho!wnfintheAddendumbMelow.*nG.=nPreserv!eminlthatlicensenoticethefulllistsofIn!vdDariantSectionsmandrequiredCo!ver=nTeextsfgiv!enintheDoMcument'slicensenotice.*H.=nIncludefanunalteredcop!yofthisLicense./4I.=nPreserv!eچtheڇsectionEntitledڇ\History",PreserveitsڇTitle,andaddtoitanitem=nstating_at_leastthetitle,mQy!ear,newauthors,and_publisheroftheMoMdiedVeersion=nasXgiv!enonWtheTitlePage.7IfWthereisnosectionEntitled\History"WintheDoMcu-=nmen!t,O#create-eone-dstatingthetitle,O$year,O#authors,and-epublisher-doftheDoMcument=nasWgiv!enonitsTitlePage,FthenaddanitemdescribingtheMoMdiedVeersionas=nstatedfintheprevioussen!tence.-J.=nPreserv!ethenetworkloMcation,ifanye,givenintheDoMcumentforpublicaccessto=naTeransparen!tcopyoftheDoMcument,MandlikewisethenetworkloMcationsgivenin=nthë́DoMcumen!t̓forpreviousversions̓itwasbasedon.S6These̓maybMeplaced̓inthe=n\History"8section.Yeou9ma!yomitanet!work8loMcationforaw!orkthatw!aspublished=natKleastfourKy!earsbMeforetheDocumen!titself,t@oriftheoriginalKpublisherofthe=nv!ersionfitreferstogivespMermission.*K.=nFeorran!ysectionEntitled\Acknowledgements"or\Dedications",oPreservetheTitle=nof/Rthe/Qsection,G#andpreserv!einthesectionallthesubstanceandtoneofeac!hofthe=ncon!tributorfacknowledgementsand/ordedicationsgiventherein.,Q*L.=nPreserv!e?all?theInvdDariant?SectionsoftheDoMcumen!t,f/unalteredintheirtextand=ninPtheirPtitles.@Sectionn!umbMersorPtheequivdDalentParenotconsideredpartofthe=nsectionftitles.)M.=nDelete5an!ysectionEntitled4\Endorsements".JSuchasection4maynotbMeincluded=ninftheMoMdiedVeersion.*N.=nDog!notg"retitlean!yexistingsectiontobMeEn!titled\Endorsements"g"ortocon
ictin=ntitlefwithan!yInvdDariantSection.*O.=nPreserv!efanyWearrantyDisclaimers.΍'IftheMoMdiedVeersionincludesnewfron!t-mattersectionsorappMendicesthatqualify'asXSecondaryX	Sectionsandcon!tainnomaterialcopiedfromtheDoMcumen!t,gyoumayXat'y!ourkoptionldesignatesomeorallofthesesectionsasin!vdDariant.Teodokthis,addtheirGGAppMendixfA:GNUFereeDocumen!tationLicense:7133͍'titles@tothelist@ofIn!vdDariant@SectionsintheMoMdiedVeersion'slicensenotice.These
33'titlesfm!ustbMedistinctfromanyothersectiontitles.('Yeoupma!yqaddasectionEntitledq\Endorsements",sprovideditcontainsqnothingbut'endorsemen!tsofyourMoMdiedVeersionbyvdDariousparties|forexample,Zstatementsof'pMeerD
revieworDthatthetexthasbeenDappro!vedD
byanorganizationDastheauthoritative'denitionfofastandard.('Yeouf,ma!yf-addapassageofuptov!ewordsf-asaFeron!t-Coverf,Text,sandf-apassageofup'to@25w!ords@asaBack-CoverTeext,Tto@theendofthelistofCo!ver@TeextsintheMoMdied'Veersion.+OnlyN+oneN*passageofFron!t-CoverN*TextN+andoneN*ofBac!k-CoverN+TextN*mayN+bMe'addedNb!y(orthrougharrangementsmadeby)Nanyoneentitye.IftheDoMcumentalready'includesaco!vertextforthesameco!ver,/!previouslyaddedbyyouorbyarrangement'made:b!ythesameentityyouareactingonbMehalfof,_youmay:notaddanother;but'y!ou)mayreplace*theoldone,2onexplicitpMermissionfromthepreviouspublisherthat'addedftheoldone.'The^author(s)]andpublisher(s)oftheDoMcumen!tdonotb!ythisLicensegiv!epMermission'tojusetheirknamesforpublicit!yforortoassertorimplyendorsemen!tofan!yMoMdied'Veersion.(-5.'COMBININGfDOCUMENTS'Yeouma!ycombinetheDoMcumentwithotherdoMcumen!tsreleasedunderthisLicense,'understhetermstdenedinsection4abMo!vesformodiedv!ersions,ӷprovidedsthaty!ou'include	in	thecom!binationalloftheIn!vdDariant	SectionsofalloftheoriginaldoMcumen!ts,'unmoMdied,L3and5list5themallasIn!vdDariant5Sectionsofy!ourcombined5workin5itslicense'notice,fandthaty!oupreservealltheirWearrantyDisclaimers.'The@com!binedworkneedonlycontainonecopyofthisLicense,andmultipleidentical'In!vdDariantSectionsma!ybMereplacedwithasinglecopye.BIftherearemultipleInvdDariant'Sections6with6thesamenamebutdieren!tcontents,Mmake6thetitleofeac!hsuch6section'uniquebb!ycaddingattheendofit,1"inparen!theses,1!thenameoftheoriginalauthoror'publisherofthat~sectionifkno!wn,!orelseauniquen!umbMer.Makethesameadjustmen!t'tothesectiontitlesinthelistofIn!vdDariantSectionsinthelicensenoticeofthecom!bined'w!ork.('In"the#com!bination,Jyoumust#combineany#sectionsEntitled#\History"inthevdDari-'ousoriginaldoMcumen!ts,xformingonesectionEn!titled\History";likewisecombineany'sectionsEn!titled\Acknowledgements",ۿandanysectionsEntitled\Dedications".]Yeou'm!ustfdeleteallsectionsEntitled\Endorsements."-6.'COLLECTIONSfOFDOCUMENTS('YeouҤma!ymakeacollectionconsistingofңtheDoMcumentandotherdoMcumentsreleased'underthisLicense,sandreplacetheindividualcopiesofthisLicenseinthevdDarious'doMcumen!tsDwithCasinglecopyCthatisincludedinthecollection,ypro!videdthaty!ou'follo!wtthetrulesofthisLicenseforv!erbatimcopyingtofeachtofthedoMcumen!tsinall'otherfrespMects.'Yeou=ma!yextractasingledoMcumentfromsuchacollection,2anddistributeitindividu-'ally4under4thisLicense,Wnpro!videdyou4insertacop!yofthisLicensein!totheextracted'doMcumen!t,andBfollowAthisLicenseinallotherrespMectsregardingv!erbatimcopyingAof'thatfdoMcumen!t.HGAppMendixfA:GNUFereeDocumen!tationLicense:7233͍-7.'A!GGREGAeTIONfWITHINDEPENDENTWORKS('A]compilation]oftheDoMcumen!t]oritsderivdDativeswithother]separateandindepMendent
33'doMcumen!tshoriworks,inoroniavolumeiofastorageordistributionmedium,iscalled'an\aggregate"ifthe
cop!yrightresultingfromthecompilationisnotusedtolimitthe'legal1	righ!ts1ofthecompilation'susersbMey!ondwhattheindividualw!orkspMermit.When'theDoMcumen!tisincludedinanaggregate,thisLicensedoesnotapplytotheother'w!orksfintheaggregatewhicharenotthemselvesderivdDativeworksoftheDoMcument.('IfVtheCo!verVTeextrequiremen!tofsection3UisapplicabletothesecopiesoftheDoMcument,'thenDifEtheDoMcumen!tislessthanonehalfoftheen!tireaggregate,~theDoMcumen!t'sCover'Teexts0ma!ybMeplacedoncoversthatbrackettheDoMcumentwithinthe0aggregate,Gorthe'electronic5qequivdDalen!t5pofcovers5piftheDoMcumen!tisinelectronicform.Otherwisethey'm!ustfappMearonprintedcoversthatbracketthewholeaggregate.-8.'TRANSLAeTION('Teranslation̯is̰consideredakindofmoMdication,Asoy!oumay̰distributetranslations'ofTtheTDoMcumen!tunderthetermsofsection4.	ReplacingIn!vdDariantSectionsTwith'translationsvrequiresvspMecialpermissionfromtheirvcop!yrightvholders,butyouvmay'includektranslationsofsomejorallIn!vdDariantkSectionsinadditiontotheoriginalv!ersions'oftheseIn!vdDariantSections.=YeoumayincludeatranslationofthisLicense,
andallthe'licensenoticesintheDoMcumen!t,FandanyWearrantyDisclaimers,Fprovidedthatyou'alsoincludetheoriginalEnglishv!ersionofthisLicenseandtheoriginalv!ersionsof'thosenoticesanddisclaimers.5Incaseofadisagreemen!tbMetweenthetranslationand'the:original:v!ersionofthisLicenseoranoticeordisclaimer,_theoriginalv!ersionwill'prevdDail.'IfpasectioninptheDoMcumen!tisEntitled\Acknowledgements",{\Dedications",orp\His-'tory",Athe(requiremen!t(section4)toPreserveitsTitle(section1)willtypicallyrequire'c!hangingftheactualtitle.-9.'TERMINAeTION('Yeouma!ynotcopye,moMdify,sublicense,ordistributetheDoMcumen!texceptasexpressly'pro!videdunderthisLicense.|Anyattemptotherwisetocop!ye,moMdify,sublicense,or'distributefitisv!oid,andwillautomaticallyterminateyourrightsunderthisLicense.'Ho!wever,ifAyou@ceaseallviolationofthisLicense,theny!ourlicensefromaparticular'cop!yrightJholderisJreinstated(a)pro!visionallye,sunlessanduntilJthecopyrightholder'explicitly_andnallyterminatesy!ourlicense,0and(b)pMermanentlye,0ifthecopyright'holder"failstonotifyy!ouoftheviolation"bysomereasonablemeanspriorto60days'afterfthecessation.('Moreo!ver,8your
licensefromaparticularcop!yright
holderisreinstatedpMermanen!tlyif'theV`cop!yrightholderVanotiesyouoftheviolationVabysomereasonablemeans,fbthisisthe'rstWtimey!ouWhaveWreceivednoticeofviolationWofthisLicense(foranyWwork)fromthat'cop!yrightholder,andy!oucuretheviolationpriorto30daysafteryourreceiptofthe'notice.'TeerminationNuofy!ourrightsunderthissectionNtdoMesnotterminatethelicensesofparties'whoqha!vereceivedcopiesorrightsfromyoupunderthisLicense.Ifyourrightshave'bMeenterminatedandnotpermanen!tlyreinstated,:receiptofacopyofsomeorallofthe'samefmaterialdoMesnotgiv!eyouanyrightstouseit.IGAppMendixfA:GNUFereeDocumen!tationLicense:7333͍10.'FUTUREfREVISIONSOFTHISLICENSE33'TheaFereebSoft!wareFeoundationbmaypublishbnew,Urevisedv!ersionsoftheGNU	Feree
33'DoMcumen!tationLicensefromtimetotime.xRSuchnewversionswillbMesimilarinspirit'to thepresen!tversion,?butmaydierindetailtoaddress newproblemsorconcerns.'Seefhttp://www.gnu.org/copyleft/.'Eac!hversionoftheLicenseisgivenadistinguishingversionnumbMer.IftheDocumen!t'spMeciesrthataparticularn!umberedrversionofthisLicense\oranylaterversion"'appliesQtoPit,Ly!ouhaveQtheoptionPoffollowingthetermsPandconditionseitherofthat'spMeciedv!ersionorofanylaterversionthathasbMeenpublished(notasadraft)by'the!Feree"Soft!wareFeoundation.If"theDoMcument"does!notspecify"av!ersionnumbMer!of'this$License,D)y!oumaychoMose$anyversioneverpublished(notasadraft)bytheFeree'Soft!wareUFeoundation.mIftheDoMcumen!tspeciesthatapro!xyTcandecidewhichfuture'v!ersions)of*thisLicensecanbMeused,thatpro!xy'spublicstatement*ofacceptanceofa'v!ersionfpMermanentlyauthorizesyoutochoMosethatversionfortheDoMcument.11.'RELICENSING'\Massiv!e{"Multiauthor{#CollabMorationSite"(or\MMCzSite")meansany{#WeorldWide'WeebLeserv!erthatpublishescopyrightableLfworksandalsoprovidesprominentfacilities'forMan!ybModytoeditthosew!orks.EAMpublicwikithatManybModycaneditisanexampleof'suc!hYaserver.A?\MassiveXMultiauthorCollabMoration"(or\MMC")>containedinthe'sitefmeansan!ysetofcopyrightableworksthuspublishedontheMMCsite.'\CC-BY-SA"8means8the8Creativ!eCommonsAttribution-Share8Alike3.08licensepub-'lished8b!y8CreativeCommons8CorpMoration,N(anot-for-protcorpMorationwithaprincipal'placeofbusinessinSanFerancisco,7California,7asw!ellasfuturecopyleftversionsofthat'licensefpublishedb!ythatsameorganization.'\IncorpMorate"zmeanstopublishyorrepublishaDocumen!t,?inwholeoryinpart,aspart'offanotherDoMcumen!t.'An&\MMC&<is\eligible&]forrelicensing"ifitislicensedunderthisLicense,?andifallw!orks'that
w!ererstpublishedunderthisLicensesomewhereotherthanthisMMC,and'subsequen!tly-incorpMorated-inwholeorinpartin!totheMMC,(1)hadnoco!ver-texts'orfin!vdDariantsections,and(2)werethusincorpMoratedpriortoNovembMer1,2008.'TheopMeratorofanMMCzSitema!yrepublishanMMCzcon!tainedinthesiteunder'CC-BY-SAonthesamesiteatan!ytimebMeforeAugust1,[2009,pro!videdtheMMCis'eligiblefforrelicensing.J<GAppMendixfA:GNUFereeDocumen!tationLicense:7433͍G]ADDENDUM:f@HowtousethisLicenseforyourdos3cuments33GTeo'usethisLicenseinadoMcumen!tyou'havewritten,HUincludeacopyoftheLicenseinthe
33GdoMcumen!tfandputthefollowingcopyrightandlicensenoticesjustafterthetitlepage:
8lCopyright(C)	s,F<x	
cmsltt10Fyearyourname.
8lPermissionisgrantedtocopy,distributeand/ormodifythisdocument8lunderthetermsoftheGNUFreeDocumentationLicense,Version1.38loranylaterversionpublishedbytheFreeSoftwareFoundation;8lwithnoInvariantSections,noFront-CoverTexts,andnoBack-Cover8lTexts.	s,Acopyofthelicenseisincludedinthesectionentitled``GNU8lFreeDocumentationLicense''.O33!GIfy!ouhaveInvdDariantSections,Feront-CoverTeextsandBack-CoverTeexts,replacetheG\with...lTeexts."linefwiththis:AwiththeInvariantSectionsbeingFlisttheirtitles,with
AtheFront-CoverTextsbeingFlist,andwiththeBack-CoverTextsAbeingFlist.%33!GIf:y!ouhaveInvdDariantSectionswithoutCoverTeexts,`"orsomeothercombinationoftheGthree,fmergethoset!wofalternativestosuitthesituation.33!GIf y!ourdoMcumentcontainsnontrivialexamplesofprogramcoMde,awerecommendreleasingGthese-examples-inparallelundery!ourchoice-offreesoft!warelicense,such-astheGNUGGeneralfPublicLicense,topMermittheiruseinfreesoft!ware.KہGConceptfIndex`)7533̍GTConceptzIndex
i.0]AGo		cmr9application-spAecicTcompletionfunctionsGU5"		cmmi9:pU:U:U:U:U:U:$51卑]CGcommandTeditingU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̅1]EGeditingTcommandlinesU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:1]I
/GinitializationTle,readlineԌU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:i4
Gin9teraction,Treadline⍑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:j1]KGkillTringፑU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:n2
GkillingTtext7U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P2.0k]Nunotation,TreadlineQpU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:L10
k]Rtreadline,TfunctionrSU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:30250k]Vv|rariables,TreadlineNU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d+4k]Yuy9ankingTtextTU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:h2Lⵍ7633͍GTFaGunctionzandVariableIndex_33𦍍4+?G_rl_digit_prU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:GO42
G_rl_digit_valueZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;43
G_rl_lowercase_pZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;42G_rl_to_lower7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:43G_rl_to_upper7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:42
G_rl_uppercase_pZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;42"2]A?GabortT(C-g)XU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:p22Gaccept-lineT(NewlineorReturn)ɍU:pU:U:U:U:U:U:U:U:U:U:U:U:17"3]BGbackward-charT(C-b)3U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16
Gbackward-delete-charT(Rubout)卑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:¬19
Gbackward-kill-lineT(C-xRubout)#U:pU:U:U:U:U:U:U:U:U:U:U:U:䅬20Gbackward-kill-wordT(M-DEL)fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C20Gbackward-wordT(M-b)3U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16Gbeginning-of-historyT(M-<)fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C17Gbeginning-of-lineT(C-a)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16GbAell-st9ylegNU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:(*5Gbind-tt9y-spAecial-charsGU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:$5Gblink-matc9hing-parenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:۬5
Gbracketed-paste-beginT()wU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:8i19"2]C?Gcall-last-kbd-macroT(C-xe)]U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ѭ22Gcapitalize-wordT(M-c)U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:19Gcharacter-searchT(C-])zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W23Gcharacter-search-backwardT(M-C-])™U:pU:U:U:U:U:U:U:U:U:v23Gclear-displayT(M-C-l)U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16Gclear-screenT(C-l)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17Gcolored-completion-prexhU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:(5Gcolored-statsDU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:5Gcommen9t-bAegin7U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:5GcompleteT(TAB)lڍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:-21Gcompletion-displa9y-widthU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:I5Gcompletion-ignore-case1U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:M5Gcompletion-map-caseU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̜5Gcompletion-prex-displa9y-lengthU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:5Gcompletion-query-itemsU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d6Gcon9vert-metak7U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:,6Gcopy-backward-wordT()U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:21Gcopy-forward-wordT()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d}21
Gcopy-region-as-killT()zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W21.k]DJdelete-charT(C-d)YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P618
Ǎdelete-char-or-listT()zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W22delete-horizontal-spaceT()fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C20digit-argumentT(FM-0,FM-1,...WjFM--)-U:pU:U:U:U:U:U:U:U:U:	21disable-completionMU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P*6do-lowercase-versionT(M-A,M-B,M-Fx,...B)dU:pU:@22downcase-wordT(M-l)3U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:19dump-functionsT()YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P623
ȍdump-macrosT()lڍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:-24
dump-variablesT()YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P623k]EJec9ho-control-characters܍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:6editing-moAdem⍑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:.6
Ǎemacs-editing-modeT(C-e)wU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:8i24emacs-moAde-stringe+U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:&6enable-brac9keted-pastejkU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:+G6enable-k9eypad+U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:솬7end-kbd-macroT(C-x))'.U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:22Fend-of-fileT(usuallyC-d)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:18end-of-historyT(M->)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d}17end-of-lineT(C-e)YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P616exchange-point-and-markT(C-xC-x)U:pU:U:U:U:U:U:U:U:U:U23expand-tildeōU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:w7\k]FJforward-backward-delete-charT()_U:pU:U:U:U:U:U:U:U:U:U:U: 19forward-charT(C-f)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16
ȍforward-search-historyT(C-s)=@U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17forward-wordT(M-f)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16\k]HJhistory-preserv9e-pAointU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:z7history-search-backwardT()fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C17
Ǎhistory-search-forwardT()(U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:֬17history-size+U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:7history-substring-search-backwardT()U:pU:U:U:U:U:18history-substring-search-forwardT()%sU:pU:U:U:U:U:U:U:P18horizon9tal-scroll-moAdeNU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:D*7;Ik]IJinput-metaMpU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:L7insert-commentT(M-#)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d}23insert-completionsT(M-*)wU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:8i21isearc9h-terminatorsXU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:7MGFeunctionfandVariableIndex7733]KGk9eymapፑU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:88Gkill-lineT(C-k)GU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:$20Gkill-regionT()lڍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:-21Gkill-whole-lineT()@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:20
Gkill-wordT(M-d)GU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:$20&э]MGmark-moAdied-linesJ܍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:8Gmark-symlink9ed-directoriesU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:8Gmatc9h-hidden-les%U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c8Gmenu-completeT()썑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ22Gmenu-complete-backwardT()(U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:֬22Gmen9u-complete-display-prexU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:E8
Gmeta-
agU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:7'ҍ]NGnext-historyT(C-n)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17Gnext-screen-lineT()3U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:1613Gnon-incremental-forward-
QCsearch-historyT(M-n) U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17Gnon-incremental-reverse-
QCsearch-historyT(M-p) U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17)֍]OGoperate-and-get-nextT(C-o)fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C18Goutput-metaSU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W/8
Goverwrite-modeT()YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P620&э]PGpage-completionsFjU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:G9Gpossible-completionsT(M-?)fU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:C21Gprefix-metaT(ESC)YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P622Gprevious-historyT(C-p)zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W17Gprevious-screen-lineT()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16
Gprint-last-kbd-macroT()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:22(ҍ]QkGquoted-insertT(C-qorC-v)ppU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:1M19k]R	re-read-init-fileT(C-xC-r)]U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ѭ22
readliner+U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:325
redraw-current-lineT()zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W17reverse-search-historyT(C-r)=@U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17rev9ert-all-at-newlineU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ij9revert-lineT(M-r)YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P623rl_activate_markˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨44rl_add_defun7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:33rl_add_funmap_entry U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:37rl_add_undorU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:GO38rl_alphabeticU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a42rl_begin_undo_group U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:38rl_bind_keyrU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:GO35rl_bind_key_if_unboundBU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:n35rl_bind_key_if_unbound_in_map*čU:pU:U:U:U:U:U:U:U:U:U:U:U:U:롬35rl_bind_key_in_mapnU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/35rl_bind_keyseqU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά36rl_bind_keyseq_if_unboundV؍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:36rl_bind_keyseq_if_unbound_in_map?U:pU:U:U:U:U:U:U:U:U:U:36rl_bind_keyseq_in_map$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R36rl_callback_handler_installꍑU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ǭ44rl_callback_handler_removeEU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"45rl_callback_read_char$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R44rl_callback_sigcleanupBU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:n44rl_check_signalsˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨50rl_cleanup_after_signalU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:۬50rl_clear_historyˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨43rl_clear_messageˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨39rl_clear_pending_inputBU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:n41rl_clear_signalsˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨51rl_clear_visible_line$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R39rl_completeKǍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:52,T53rl_complete_internal߷U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:52rl_completion_matches$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R53rl_completion_modenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/53rl_copy_keymapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά34rl_copy_text7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:40rl_crlfU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:39rl_deactivate_marknU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/44rl_delete_textU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά40rl_deprep_terminalnU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/41rl_dingU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:42rl_discard_keymap8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~34rl_display_match_list$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R42rl_do_undoU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:38rl_echo_signal_char U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:51rl_empty_keymapZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;34rl_end_undo_group8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~38rl_execute_nextZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;41rl_expand_promptˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨39rl_extend_line_buffer$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R42rl_filename_completion_functionU:pU:U:U:U:U:U:U:U:U:U:U:N{53rl_forced_update_displaykU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:fH38rl_freeU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:42rl_free_keymapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά34N9GFeunctionfandVariableIndex7833FӗGrl_free_line_statenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/50
ˍGrl_free_undo_list8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~38Grl_function_dumpernU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/37Grl_function_of_keyseq$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R37Grl_function_of_keyseq_lenV؍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:37Grl_funmap_namesZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;37Grl_generic_bindZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;36Grl_get_keymapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a34Grl_get_keymap_by_name$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R34Grl_get_keymap_namenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/34Grl_get_screen_sizenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/51Grl_get_termcapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά43Grl_getcU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:40Grl_initializeU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a42Grl_insert_completions$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R53Grl_insert_textU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά40Grl_invoking_keyseqs U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:37Grl_invoking_keyseqs_in_mapEU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"37Grl_keep_mark_active U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:44Grl_kill_text7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:40Grl_list_funmap_names߷U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:37Grl_macro_bindU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a43Grl_macro_dumperZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;43Grl_make_bare_keymap U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:34Grl_make_keymapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά34Grl_mark_active_pˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨44Grl_messageU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:39Grl_modifying7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:38
̍Grl_named_function8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~37Grl_on_new_lineU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά38Grl_on_new_line_with_promptEU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"39Grl_parse_and_bind8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~36Grl_pending_signal8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~50Grl_possible_completionsU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:۬53Grl_prep_terminalˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨41Grl_push_macro_input U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:40Grl_read_init_file8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~36Grl_read_keyrU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:GO40Grl_redisplay7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:38Grl_replace_lineZ^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:;42Grl_reset_after_signal$U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:R50Grl_reset_line_state U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:39Grl_reset_screen_size߷U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:51Grl_reset_terminal8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~41Grl_resize_terminalnU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/51Grl_restore_prompt8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~39Grl_restore_stateˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨42Grl_save_promptU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά39Grl_save_stateU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a41Grl_set_keyU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:36Grl_set_keyboard_input_timeout*čU:pU:U:U:U:U:U:U:U:U:U:U:U:U:롬41Grl_set_keymapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a34Grl_set_keymap_namenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/34Grl_set_paren_blink_timeoutEU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"43Grl_set_promptU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a40Grl_set_screen_sizenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/51Grl_set_signalsU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:iά51ӗrl_show_char7ߍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:39
rl_stuff_charU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a40
rl_tty_set_default_bindingsꍑU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ǭ41rl_tty_set_echoingnU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/41rl_tty_unset_default_bindings*čU:pU:U:U:U:U:U:U:U:U:U:U:U:U:롬41rl_unbind_command_in_mapkU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:fH36rl_unbind_function_in_mapV؍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:35rl_unbind_keyU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:a35rl_unbind_key_in_map߷U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:35rl_username_completion_functionU:pU:U:U:U:U:U:U:U:U:U:U:N{53rl_variable_bindˍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:̨43rl_variable_dumpernU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:/43
rl_variable_value8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~43[k]SWbself-insertT(a,b,A,1,!,...B)aU:pU:U:U:U:U:U:U:U:U:U:U:U:>19set-markT(C-@)lڍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:-23shell-transpose-wordsT(M-C-t)卑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:¬20sho9w-all-if-ambiguousU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:k\9sho9w-all-if-unmoAdiedU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:jc9sho9w-moAde-in-prompt	U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c9skip-completed-textMU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:
9skip-csi-sequenceT()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d}23
start-kbd-macroT(C-x()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:J22ҍk]TWbtab-insertT(M-TAB)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:19tilde-expandT(M-~)@ƍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:23transpose-charsT(C-t)U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:19
transpose-wordsT(M-t)U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:19Ӎk]UWbundoT(C-_orC-xC-u)8U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:~23universal-argumentT()U
U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:21unix-filename-ruboutT()U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:20unix-line-discardT(C-u)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:20unix-word-ruboutT(C-w)zU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:W20
upcase-wordT(M-u)YU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:P619Ӎk]VWbvi-cmd-moAde-stringU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:M10vi-editing-modeT(M-C-j)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:24vi-ins-moAde-string=U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:z10
visible-stats^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:];10k]YWbyankT(C-y)&U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:h21yank-last-argT(M-.orM-_)ppU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:1M18yank-nth-argT(M-C-y)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:d}18
yank-popT(M-y)lڍU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:-21;ïRgN
#cmbx12egffcmmi12]Nffcmbx12TNGcmbx12KNjcmbx12F<x	
cmsltt10Ap0J
cmsl10@<x
cmtt10?!",
3
cmsy10>b>
3
cmmi10=<x
3
cmsltt10<-
3
cmcsc10;m#R
3
cmss10:p0J
3
cmsl109':
3
cmti107<x
3
cmtt106K`y
3
cmr10ߤN		cmtt95"		cmmi9o		cmr9K`y

cmr10

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>