; TeX output 2020.10.30:100733GKNj cmbx12KGNUqReadlineLibraryG 0 π6K`y 3 cmr10Editionf8.1,for7 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:Q 32: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:Q 32: @]67!GConceptffIndex#C32e:Q 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:32: ]75GFfunctionffandVariableIndex;32e:Q 32: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=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--mon pre x ofthesetofpMossiblecompletionsusingadi eren!tcolor.-The colorde nitionsaretak!enfromthevdDalueoftheLS_COLORS-en!vironmentfvdDariable.Thedefaultis`off'.K:colored-stats-If0*set0+to`on',GReadlinedispla!yspMossiblecompletionsusingdi eren!t-colorstoindicatetheir let!ypMe.iThecolorde nitionsaretak!en-from;theKik!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#intotheeditingbu erasasingle-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-modevdDariablealsoa ectsthedefaultk!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 set to`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}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!eyseqdi ersfromkeynameVabMoveinthatstringsdenotinganen--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)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,seeabMoveforthee ects.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!vefnoe ect.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.=Thiscommanda ectsonlyemacsmoMde;vimodedoeso!verwriteK:di eren!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:Kill frompMoin!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!ythetextintheregiontothekillbu er,0EsoitcanbMey!ankedrightawaye.K:Byfdefault,thiscommandisun!bMound.UGcopy-backward-wordf()K:Cop!ythewordbMeforepoin!ttothekillbu er.ThewordbMoundariesaretheK:samefasbackward-word.Bydefault,thiscommandisun!bMound.Gcopy-forward-wordf()K:Cop!y8thewordfollowing9pMointtothekillbu er.SThe9wordbMoundariesaretheK:samefasforward-word.Bydefault,thiscommandisun!bMound.Gyankf(C-y)K:Yeankfthetopofthekillringin!tothebu eratpMoint.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ֈhavenoe ectunlessexplicitlybMoundֈtoareadlineK:command,insteadXofinsertingstra!ycharactersintotheeditingWbu er.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!tageofnostaticbu ertoover 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 leGinan!y lethatusesReadline'sfeatures.?Sincesomeofthede -Gnitionsinreadline.husethestdiolibrarye,ċthe leshouldbMeincludedbMeforeGreadline.h.!Greadline.h2de nes3aC1preproMcessorvdDariablethatshouldbMetreatedasanin!teger,RL_GREADLINE_VERSION,whic!h(maybMeusedtoconditionallycompileapplicationcodedependinguߍGChapterf2:ProgrammingwithGNUReadlineʗ2733͍Gon4theinstalled4Readlinev!ersion.ThevdDalueisahexadecimalencoMdingofthemajorand 33GminorPv!ersionnumbMersOofthelibrarye,8oftheform0xMMmm.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;@:ifanapplicationisusingadi eren!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,,Corotherapplicationsusingadi erentinput.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=oftheeditingbu er.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..This4functionshouldundo4thee ectsofrl_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 Mutothefunctiondescriptively EunamedGbackward-kill-word.4Yeou, asYtheprogrammer, shouldbindthefunctionsZy!ouwritetoGdescriptiv!efnamesaswell.Readlineprovidesafunctionfordoingthat:z[Feunction]G@intLrl_add_defuny;m#R 3 cmss10(Ap0J cmsl10Aconstochar*name,rlFGcommandFfuncFto*function,DGintkey).AddxHtinsert,|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;nyoumayrnotaddadi eren!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.The returnvdDalue isgreaterthanzerounlessnameFisoneofReadline'sbuiltin.k!eymapfnamesorkeymapgisoneofReadline'sbuiltinkeymaps.@Gg2.4.3d(BindingMKeys3GKeysequencesareassoMciatewithfunctionsthroughthek!eymap.2;Readlinehassev!eralin-Gternalk!eymaps:emacs_standard_keymap,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=)./rThea ectedtextrunsfrom.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,\e ectiv!elynegatingthee ect{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ˬe ectsofrl_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,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. ZeThisdi ersfromclear_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).Teurnfo theactiv!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!vexHtcallbac!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!y 1rl_callback_handler_install 0doMesnotexittheprogram,*;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.#include.#include.#include./*Usedforselect(2)*/.#include.#include.#include.#include./*Standardreadlineincludefiles.*/.#include.#include.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!ereine ectbMeforereadline()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,andxHtkey.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#_bu erisquoted,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..The stathoMokreturnsanin!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.}Thequotingise ectedviaacalltothefunctionpMoin!tedtob!yrl_filename_.quoting_function.:BGChapterf2:ProgrammingwithGNUReadlineʗ5833͍3[Veariable]G@intLrl_attempted_completion_over 33.If Oanapplication-spMeci ccompletion Ofunctionassignedtorl_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.#endif.#include.#ifdefHAVE_SYS_FILE_H.# s,include.#endif.#include.#ifdefHAVE_UNISTD_H.# s,include.#endif.#include.#include.#include.#ifdefined(HAVE_STRING_H).# s,include.#else/*!HAVE_STRING_H*/.# s,include.#endif/*!HAVE_STRING_H*/.#ifdefHAVE_STDLIB_H.# s,include.#endif.#include.#include.#include.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!eryonethee ectivefreedom'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 ed Veersion" oftheDocumen!tmeans anyworkcontainingthe DoMcumentor'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,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'Sections6with6thesamenamebutdi eren!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!yright resultingfromthecompilationisnotusedtolimitthe'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,?butmaydi erindetailtoaddress 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&)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:8 8Gkill-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 b> 3 cmmi10=