; TeX output 2014.02.11:165733GJNj cmbx12JGNUqReadlineLibraryG 0 π6K`y 3 cmr10Editionf6.3,for7 b> 3 cmmi10:ۍ:::::::::::::::::::::::::::::::::::/1 33!G1.2 5ReadlinefIn!teractionQl:ۍ:::::::::::::::::::::::::::::::::::::::::::գ10G1.2.1 5ReadlinefBareEssen!tials-:ۍ::::::::::::::::::::::::::::::::::10G1.2.2 5ReadlinefMo!vementCommandsA*:ۍ:::::::::::::::::::::::::::a20G1.2.3 5ReadlinefKillingCommands:ۍ:::::::::::::::::::::::::::::: #20G1.2.4 5ReadlinefArgumen!ts#:ۍ:::::::::::::::::::::::::::::::::::::: 6[30G1.2.5 5Searc!hingfforCommandsintheHistoryh :ۍ:::::::::::::::::::C3!G1.3 5ReadlinefInitFile:ۍ::::::::::::::::::::::::::::::::::::::::::::: G40G1.3.1 5ReadlinefInitFileSyn!tax:ۍ::::::::::::::::::::::::::::::::: U40G1.3.2 5ConditionalfInitConstructsj:ۍ::::::::::::::::::::::::::::: >110G1.3.3 5SamplefInitFile֍:ۍ::::::::::::::::::::::::::::::::::::::::: B 11!G1.4 5BindablefReadlineCommandsʍ:ۍ:::::::::::::::::::::::::::::::: 3140G1.4.1 5CommandsfFeorMo!ving=P:ۍ::::::::::::::::::::::::::::::::::140G1.4.2 5CommandsfFeorManipulatingTheHistoryh:ۍ::::::::::::::: 1140G1.4.3 5CommandsfFeorChangingText鈍:ۍ:::::::::::::::::::::::::: m160G1.4.4 5KillingfAndYeanking:ۍ:::::::::::::::::::::::::::::::::::: 170G1.4.5 5SpMecifyingfNumericArgumen!ts]^:ۍ:::::::::::::::::::::::::: 180G1.4.6 5LettingfReadlineT!ypMeFeorYouڍ:ۍ:::::::::::::::::::::::::: >180G1.4.7 5KeybMoardfMacros?:ۍ::::::::::::::::::::::::::::::::::::::: Vv190G1.4.8 5SomefMiscellaneousCommandsf:ۍ::::::::::::::::::::::::: S19!G1.5 5ReadlinefviMoMde:ۍ:::::::::::::::::::::::::::::::::::::::::::: 72133G\232ProgrammingffwithGNUReadlineʍ32c:Q 32:32:32:32:32:32:32:32:32:32: 1\22!G2.1 5BasicfBeha!vior썑:ۍ::::::::::::::::::::::::::::::::::::::::::::::: V$22!G2.2 5CustomfFeunctionsE:ۍ::::::::::::::::::::::::::::::::::::::::::::230G2.2.1 5ReadlinefT!ypMedefsN:ۍ:::::::::::::::::::::::::::::::::::::::240G2.2.2 5WeritingfaNewFunctionԍ:ۍ::::::::::::::::::::::::::::::::: e 24!G2.3 5ReadlinefVeariables:ۍ::::::::::::::::::::::::::::::::::::::::::: S025!G2.4 5ReadlinefCon!venienceFeunctionsȍ:ۍ:::::::::::::::::::::::::::::: 3300G2.4.1 5NamingfaFeunction⍑:ۍ:::::::::::::::::::::::::::::::::::::: 300G2.4.2 5SelectingfaKeymap:ۍ::::::::::::::::::::::::::::::::::::: (300G2.4.3 5BindingfKeys;d:ۍ::::::::::::::::::::::::::::::::::::::::::: 310G2.4.4 5AssoMciatingfFeunctionNamesandBindings&ˍ:ۍ::::::::::::::: 330G2.4.5 5Allo!wingfUndoingF:ۍ::::::::::::::::::::::::::::::::::::::: O340G2.4.6 5Redispla!y:ۍ::::::::::::::::::::::::::::::::::::::::::::::: #350G2.4.7 5MoMdifyingfTeextV:ۍ::::::::::::::::::::::::::::::::::::::::: 360G2.4.8 5CharacterfInput:ۍ::::::::::::::::::::::::::::::::::::::::: &360G2.4.9 5TeerminalfManagemen!t :ۍ:::::::::::::::::::::::::::::::::::370G2.4.10 5Utilit!yfFeunctions:ۍ::::::::::::::::::::::::::::::::::::::: a/380G2.4.11 5MiscellaneousfFeunctionsZ:ۍ:::::::::::::::::::::::::::::::: Q390G2.4.12 5AlternatefIn!terface\:ۍ::::::::::::::::::::::::::::::::::::: 400G2.4.13 5AfReadlineExample̍:ۍ::::::::::::::::::::::::::::::::::: f40ii33͍0G2.4.14 5AlternatefIn!terfaceExampleA+:ۍ::::::::::::::::::::::::::::b42 33!G2.5 5ReadlinefSignalHandling.W:ۍ:::::::::::::::::::::::::::::::::::::43!G2.6 5CustomfCompleters>荑:ۍ:::::::::::::::::::::::::::::::::::::::::: 460G2.6.1 5Ho!wfCompletingWeorks:ۍ::::::::::::::::::::::::::::::::: ZS460G2.6.2 5CompletionfFeunctionsQ:ۍ::::::::::::::::::::::::::::::::::: 470G2.6.3 5CompletionfVeariables)܍:ۍ::::::::::::::::::::::::::::::::::::480G2.6.4 5AfShortCompletionExample?/:ۍ::::::::::::::::::::::::::: g5233G\Apps3endixffA|(GNUffFfreeDos3cumentationLicense4w32c: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:32:32:32:32:32:32:32:32:32:32:32: 3\61 GConceptffIndex632c: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: \69GFfunctionffandVariableIndex=32c:Q 32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32: \70=GChapterf1:CommandLineEditingMH133͍GS1 QCommandzLineEditingGThisfc!hapterdescribMesthebasicfeaturesofthe<- 3 cmcsc10gnucommandlineeditinginterface.ȍG\1.1Intros3ductionf@toLineEditing33GTheffollo!wingparagraphsdescribMethenotationusedtorepresentkeystrokes.,!GTheYtextY=Kik!eysequencebystrippingtheeighthbitandpre xinglGChapterf1:CommandLineEditingMH633͍-anESCc!haracter,convertingthemtoameta-pre xedk!eysequence. 33-ThefdefaultvdDalueis`on'.K:disable-completion-Ifgsettog`On',?Readlinewillginhibitw!ordcompletion.Completion-c!haracters!willbMe!insertedintothelineasif!theyhadbMeenmapped-tofself-insert.Thedefaultis`off'.K:editing-mode-Therediting-modevdDariablecon!trolswhichrdefaultsetofkeybind--ings?is>used.&Bydefault,#ReadlinestartsupinEmacseditingmoMde,-where~the~k!eystrokesare~mostsimilartoEmacs.ПThisvdDariablecan-bMefsettoeither`emacs'or`vi'.K:echo-control-characters-Whensetto`on',onopMeratingsystemsthatindicatetheysuppMort-it,readlineec!hoMesacharactercorrespMondingtoasignalgenerated-fromfthek!eybMoard.Thedefaultis`on'.K:enable-keypad-Whensetto`on',mReadlinewilltrytoenabletheapplicationk!eypad-when1it1iscalled.Somesystemsneedthistoenablethearro!wkeys.-Thefdefaultis`off'.K:enable-meta-key-WhenJsetIto`on',Readlinewilltrytoenablean!ymetamoMdi er-k!eytheterminalclaimstosuppMortwhenitiscalled.Onman!y-terminals,^=the9ymetak!eyisusedtosendeight-bitcharacters.The-defaultfis`on'.K: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!triesfisnotlimited.K:horizontal-scroll-mode-ThisNvdDariableNcanbMesettoeither`on'or`off'. Settingitto`on'-means$jthatthetextofthe$ilinesbMeingeditedwillscrollhorizon!tally-onasinglescreenlinewhentheyarelongerthanthewidthofthe-screen,:insteadofwrappingon!toanewscreenline.Bydefault,this-vdDariablefissetto`off'.GChapterf1:CommandLineEditingMH733͍K:input-meta 33-Ifsetto`on',Readlinewillenableeigh!t-bitinput(itwillnotclear-the"eigh!thbitin!thecharactersitreads), Pregardlessofwhatthe-terminalclaimsitcansuppMort.Q.ThedefaultvdDalueis`off'.Q-The-namefmeta-flagisasynon!ymforthisvdDariable.oK:isearch-terminators-The5string5ofc!haractersthatshouldterminateanincremen!tal-searc!h|withoutsubsequentlyexecutingthecharacterasacommand-(seeZSection1.2.5[Searc!hing],page3). IfthisvdDariablehasnot-bMeenBggiv!enavdDalue,igthecharactersBfESCandC-Jwillterminatean-incremen!talfsearch.nK:keymapRSets5Readline's6ideaofthecurren!tkeymap6forkey6bindingcom--mands. AcceptableSPkeymapSOnamesareemacs,emacs-standard,-emacs-meta, 0emacs-ctlx,vi, 0vi-move,vi-command,and-vi-insert.viisequivdDalen!ttovi-command;2emacsisequivalen!t-toӯemacs-standard.eThedefaultvdDalueisemacs.ThevdDalueofthe-editing-modefvdDariablealsoa ectsthedefaultk!eymap.K: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.K: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.nK: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 lenameGChapterf1:CommandLineEditingMH833͍-completion.Ifsetto`off',Jtheleading`.'m!ustbMesuppliedby 33-theLuserMinthe lenametobMecompleted.9ThisvdDariableis`on'b!y-default.K: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-defaultfis`off'.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-IfKsettoK`on',uaddac!haractertothebMeginningofthepromptin--dicatingtheeditingmoMde:emacs(`@'),a_vicommand(`:'),a`orvi-insertionf(`+').ThedefaultvdDalueis`off'.K:skip-completed-text-Ifjsetto`on',+thisialtersthedefaultcompletionbMeha!viorwhenin--serting}=a}output"-In \the \abMo!veexample, JSC-uisbMoundto \thefunction-universal-argument,|M-DEL &is %bMoundtothefunction-backward-kill-word, andiLC-oiKisbMoundtorunthemacro-expressed~Jonthe~Irigh!thandside(thatis,Btoinsertthetext`>-output'fin!totheline).P-Anbn!umbMero[ofsym!bolicc!haracternamesarerecognizedwhile-proMcessing3thisk!eybindingsyntax:%wDEL,&ESC,ESCAPE,LFD,-NEWLINE,fRET,RETURN,R!UBOUT,SPeACE,SPC,andTeAB.oK:"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 zGChapterf1:CommandLineEditingӮ1033͍"\e[11~":"FunctionKey1"-IntheabMo!veexample,C-uisagainboundtothefunction 33-universal-argument?(justasitw!asinthe rst?example),=`C-x-C-r'isbMoundtothefunctionre-read-init-file,&and`ESCf[11-~'fisbMoundtoinsertthetext`FunctionKey1'.dK: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!kslashK: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-threefdigits)K:\xHH"Ktheeigh!t-bitcharacterwhosevdDalueisthehexadecimalvdDalueHH-(onefort!wofhexdigits)K:When}en!teringthetextofamacro,singleordoublequotesmustbMeusedtoK:indicateamacrode nition.?UnquotedtextisassumedtobMeafunctionname.?InK:themacrobModye,~thebac!kslashescapesdescribedabo!veareexpanded.BackslashK:willquotean!yothercharacterinthemacrotext,including`"'and`''.RFeorK:example,4 thefollo!wingbindingwillmake`C-xf\'insertasingle`\'in!totheline:hʏ"\C-x\\":"\\" ǼGChapterf1:CommandLineEditingӮ1133͍Ge1.3.2d(ConditionalMInitConstructs3GReadlineiimplemen!tsafacilitysimilarinispirittotheconditionalcompilationfeaturesof 33GtheJCHpreproMcessorKwhic!hallowsKkeybindingsandKvdDariablesettingstobMeperformedKastheGresultfoftests.Therearefourparserdirectiv!esused.33G$if(TheN$ifconstructallo!wsbindingstobMeOmadebasedontheeditingmode,ʈtheK:terminalbMeingused,͘ortheapplicationusingReadline.VThetextofthetestK:extendsftotheendoftheline;noc!haractersarerequiredtoisolateit.K: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.K: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:toryfasnecessarye.Thisisanincremen!talsearch.Gforward-search-historyf(C-s)K:Searc!hforwardstartingatthecurrentlineandmoving`down'throughthetheK:historyfasnecessarye.Thisisanincremen!talsearch.Gnon-incremental-reverse-search-historyf(M-p)K:Searc!h:backwardstarting;atthecurrentlineandmoving;`up'throughthehis-K:toryRyasnecessaryusingRxanon-incremen!talsearchforastringRxsuppliedbytheK:user.Gnon-incremental-forward-search-historyf(M-n)K:Searc!hforwardstartingatthecurrentlineandmoving`down'throughthetheK:history3as3necessaryusinganon-incremen!talsearchfor3astringsuppliedb!ytheK:user.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. ThesearchQstringmustmatchQattheK:bMeginning"ofahistoryline.Thisisanon-incremen!talsearch.Bydefault,thisK:commandfisun!bMound.Ghistory-substr-search-forwardf()K:Searc!hOforwardthroughPthehistoryforthestringofc!haractersbMetweentheK:startuofuthecurren!tlineandthepMoin!t.ͳThesearchstringmayumatchanywhereK:in"ahistoryline.Thisisanon-incremen!talsearch.Bydefault,thiscommandK:isfun!bMound.Ghistory-substr-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!ordfromGChapterf1:CommandLineEditingӮ1633͍K:the0previouscommand(thew!ordsin0thepreviouscommandbMeginwithword 33K: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.[Ge1.4.3d(CommandsMFģorChangingTextaGend-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.Gbackward-delete-charf(Rubout)K: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.Gtranspose-charsf(C-t)K:Dragthec!haracterbMeforethecursorforwardoverthecharacteratthecursor,K:mo!vingC"thecursorC!forwardaswell.IftheinsertionC!pMointisattheC!endoftheK:line,thenthistranspMosesthelastt!wocharactersoftheline.Negativ!eargumentsK:ha!vefnoe ect.yGChapterf1:CommandLineEditingӮ1733͍Gtranspose-wordsf(M-t) 33K: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.Goverwrite-modef()K: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.䍍Ge1.4.4d(KillingMAndYģanking$Gkill-linef(C-k)K:KillfthetextfrompMoin!ttotheendoftheline.Gbackward-kill-linef(C-xRubout)K:Killfbac!kwardtothebMeginningoftheline.Gunix-line-discardf(C-u)K:Killfbac!kwardfromthecursortothebMeginningofthecurrentline.Gkill-whole-linef()K:Killcjallc!haracterscionthecurrentline,nomatterwherepMointis.Bydefault,K:thisfisun!bMound.Gkill-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.Gunix-word-ruboutf(C-w)K:KillLthew!ordbMehindpoin!t,usingwhitespaceasawordbMoundarye.RThekilledK:textfissa!vedfonthekill-ring. "GChapterf1:CommandLineEditingӮ1833͍Gunix-filename-ruboutf() 33K:Kill]thew!ordbMehindpoin!t,usingwhitespaceandtheslashcharacterastheK:w!ordfbMoundaries.Thekilledtextissavedonthekill-ring.Gdelete-horizontal-spacef()K:DeletefallspacesandtabsaroundpMoin!t.Bydefault,thisisunbMound.Gkill-regionf()K:Killfthetextinthecurren!tregion.Bydefault,thiscommandisunbMound.퍑Gcopy-region-as-killf()K:Cop!ythetextintheregiontothekillbu er,0EsoitcanbMey!ankedrightawaye.K:Byfdefault,thiscommandisun!bMound.Gcopy-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.軍Ge1.4.5d(SpiecifyingMNumericArgumentsGdigit-argumentf(M-0,M-1,...M--)K:Add:Lthis:Kdigittotheargumen!talreadyaccumulating,Oorstarta:Knewargument.K:M--fstartsanegativ!eargument.Guniversal-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:orZwmin!usZxsign,itheargumentZwcountforZwthenextcommandism!ultipliedbyZwfour.K:The{targumen!t{ucountisinitially{uone,soexecutingthisfunctionthe rsttimeK:mak!es2theargumentcountfour,easecond3timemakestheargumentcountsix-K:teen,fandsoon.Bydefault,thisisnotbMoundtoak!eye.軍Ge1.4.6d(LettingMReadlineTypieFģorYouGcompletef(TAB)K:A!ttempttopMerformcompletiononthetextbMeforepoin!t. TheactualcompletionK:pMerformedfisapplication-speci c.Thedefaultis lenamecompletion.GChapterf1:CommandLineEditingӮ1933͍Gpossible-completionsf(M-?) 33K: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.UGmenu-completef()K: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.O!Ge1.4.7d(KeybioardMMacrosčGstart-kbd-macrof(C-x()K:Beginfsa!vingthecharacterstypMedintothecurrentkeybMoardmacro.Gend-kbd-macrof(C-x))K:StopG!sa!vingthecharactersG"typMedintothecurrentkeybMoardmacroG"andsavetheK:de nition.UGcall-last-kbd-macrof(C-xe)K:Re-execute9Bthelast9Ck!eybMoardmacrode ned,]bymakingthe9CcharactersintheK:macrofappMearasift!ypedatthek!eyboard.Gprint-last-kbd-macrof()K:Prin!tfthelastkebMoardmacrode nedinaformatsuitablefortheinputrcPj le.O!Ge1.4.8d(SomeMMiscellaneousCommandsč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).!ZGChapterf1:CommandLineEditingӮ2033͍Gdo-uppercase-versionf(M-a,M-b,M-x,...e) 33K:IfQthemeta edc!haracterxTislowercase,brunthecommandthatisbMoundtotheK:correspMondingfuppercasec!haracter.Gprefix-metaf(ESC)K:Metafy2the1nextc!haractertypMed.q@This2isfork!eybMoardswithoutametak!eye.K:T!ypingf`ESCf'isequivdDalenttotypingM-f.Gundof(C-_orC-xC-u)K: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.-GChapterf1:CommandLineEditingӮ2133͍Gdump-variablesf() 33K:Prin!tallofthesettablevdDariablesandtheirvaluestotheReadlineoutputstream.K:Ifan!umericargumentissupplied,theoutputisformattedinsuc!hawaythatK:itfcanbMemadepartofaninputrcPj le.Thiscommandisun!boundb!ydefault.33Gdump-macrosf()K:Prin!t allofthe ReadlinekeysequencesbMoundtomacros andthestringstheyK:output.rIf-Jan!umericargumentis-Ksupplied,Otheoutputisformattedinsuc!haK:w!aythatitcanbMemadepartofaninputrcD le.Thiscommandisun!bMoundbyK:default.Gemacs-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.:GChapterf2:ProgrammingwithGNUReadlineʗ2233͍GS2 QProgrammingzwithGNUReadlinelGThis 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(). a!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,Gsofonlythetextremains.!GIfreadlineencoun!tersanEOFwhilereadingtheline,*^andthelineisemptyatthatGpMoin!t,^then(charf*)NULLisreturned.oOtherwise,thelineisendedjustasifanewlinehadGbMeenft!yped.!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,sinceusersrarelyhaveaGburning4needto5reuseablankline.Hereisafunctionwhic!husefullyreplacesthestandardGgets()flibraryfunction,andhastheadvdDan!tageofnostaticbu ertoover ow:./*Astaticvariableforholdingtheline.*/.staticchar*line_read=(char*)NULL;ff./*Readastring,andreturnapointertoit.@8ReturnsNULLonEOF.*/.char*.rl_gets().{:x/*Ifthebufferhasalreadybeenallocated,Kreturnthememorytothefreepool.*/:xif(line_read)ED{Qwfree(line_read);BGChapterf2:ProgrammingwithGNUReadlineʗ2333͍Qwline_read=(char*)NULL; 33ED}ff:x/*Getalinefromtheuser.*/:xline_read=readline("");:x/*Ifthelinehasanytextinit,Ksaveitonthehistory.*/:xif(line_read&&*line_read)EDadd_history(line_read);:xreturn(line_read);.}n}!GThis`functiongiv!estheuserthedefaultbMehaviourofTABcompletion:completionon leGnames.Ify!oudonotwantReadlinetocompleteon lenames,youcanchangethebindingGofftheTABk!eywithrl_bind_key().n|.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).n|!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],page46).XG\2.2Customf@Ffunctions33GReadlineEpro!videsmanyfunctionsforEmanipulatingthetextoftheline,Y3butitisn'tpMossibleGtodcan!ticipatethedbneedsofallprograms.ThissectiondescribMesthevdDariousfunctionsandGvdDariables"de nedwithinthe"Readlinelibrarywhic!hallowauser"programtoaddcustomizedGfunctionalit!yftoReadline.n|!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(maybMeusedtoconditionallycompileapplicationcodedependingGon4theinstalled4Readlinev!ersion.ThevdDalueisahexadecimalencoMdingofthemajorandGminorPv!ersionnumbMersOofthelibrarye,8oftheform0xMMmm.setfromtheargumen!ttoreadline(),=yandshould.not:^bMeassignedto:]directlye.Therl_set_prompt()function(seeSection2.4.6[Redis-.pla!y],fpage35)maybMeusedtomodifythepromptstringaftercallingreadline().p3[Veariable]G@charL*rl_display_prompt.Thestringdispla!yedastheprompt.Z=Thisisusuallyiden!ticaltorl>xHtprompt,9butma!y.bMe[c!hangedtemporarilyb!yfunctionsthatusethepromptstringasamessagearea,.suc!hfasincrementalsearch.p3[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.p3[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.p3[Veariable]G@constLchar*rl_readline_name.ThisvdDariableissettoauniquenameb!yeachapplicationusingReadline.)4ThevdDalue.allo!ws]wconditionalparsing]voftheinputrc le(seeSection1.3.2[ConditionalInitCon-.structs],fpage11).3[Veariable]G@FILEL*rl_instream.Thestdiostreamfromwhic!hReadlinereadsinput.*IfNULL,?FReadlinedefaultsto.stdin.p3[Veariable]G@FILEL*rl_outstream.The#Rstdio#Qstreamtowhic!hReadlinepMerformsoutput.TIfNULL,BReadlinedefaultsto.stdout.3[Veariable]G@intLrl_prefer_env_winsize.Ifh non-zero,tReadlinegiv!esvdDaluesfoundinthehLINESandCOLUMNSenvironmentvdDari-.ablesgreaterprecedencethanvdDaluesfetc!hedfromthekernelwhencomputingthe.screenfdimensions.sGChapterf2:ProgrammingwithGNUReadlineʗ2733͍3[Veariable]G@rl_command_func_tL*rl_last_func 33.The-)addressofthelastcommandfunctionReadline-*executed.r&Ma!ybMeusedtotest.whetherfornotafunctionisbMeingexecutedt!wiceinsuccession,forexample.fg3[Veariable]G@rl_hook_func_tL*rl_startup_hook.Ifnon-zero,>thisistheaddressofafunctiontocalljustbMeforereadlineprin!tsthe. rstfprompt.fh3[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],page36).Ingeneral,anapplicationthat.setsfrl>xHtgetc>xHfunctionshouldconsidersettingrl>xHinput>xHa!vdDailable>xHhoMokPjasw!ell.3[Veariable]G@rl_hook_func_tL*rl_signal_event_hook.If>non-zero,Sthisis>theaddressofafunctiontocallifareadsystemcallisin!terrupted.whenfReadlineisreadingterminalinput.fh3[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],page40),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.3[Veariable]G@rl_voidfunc_tL*rl_redisplay_function.IfSnon-zero,~ReadlinewillcallindirectlythroughthisSpMoin!tertoupdatethedispla!y.with=thecurren!t=contents=oftheeditingbu er.Bydefault,Ritissettorl_redisplay,.thefdefaultReadlineredispla!yfunction(seeSection2.4.6[Redisplay],page35)..GChapterf2:ProgrammingwithGNUReadlineʗ2833͍3[Veariable]G@rl_vintfunc_tL*rl_prep_term_function 33.Ifnon-zero, ReadlinewillcallindirectlythroughthispMoin!tertoinitializetheterminal..Theufunctiontak!esausingleargument,Ganint agthatsayswhetheruornottouse.eigh!t-bitcharacters.5Bydefault,5athisissettorl_prep_terminal(seeSection2.4.9.[TeerminalfManagemen!t],page37).Z[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],page37).3[Veariable]G@KeymapLrl_executing_keymap.ThisROvdDariableRNissettothek!eymap(seeSection2.4.2[Keymaps],}Hpage30)inwhic!h.thefcurren!tlyexecutingreadlinefunctionwasfound.ZZ3[Veariable]G@KeymapLrl_binding_keymap.ThisROvdDariableRNissettothek!eymap(seeSection2.4.2[Keymaps],}Hpage30)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..RL_STATE_TERMPREPPEDhʏReadliner[hasmoMdi edtheterminalmodestodoitso!wninputandredis-hʏpla!ye..RL_STATE_READCMDhʏReadlinefisreadingacommandfromthek!eybMoard.3GChapterf2:ProgrammingwithGNUReadlineʗ2933͍.RL_STATE_METANEXT 33hʏReadlinefisreadingmoreinputafterreadingthemeta-pre xc!haracter.00.RL_STATE_DISPATCHINGhʏReadlinefisdispatc!hingtoacommand.01.RL_STATE_MOREINPUThʏReadlinefisreadingmoreinputwhileexecutinganeditingcommand..RL_STATE_ISEARCHhʏReadlinefispMerforminganincremen!talhistorysearch.01.RL_STATE_NSEARCHhʏReadlinefispMerforminganon-incremen!talhistorysearch..RL_STATE_SEARCHhʏReadlinepispsearc!hingbackwardorpforwardthroughpthehistoryforastring..RL_STATE_NUMERICARGhʏReadlinefisreadingan!umericargument.01.RL_STATE_MACROINPUThʏReadlineiscurren!tlygettingitsinputfromapreviously-de nedk!eybMoardhʏmacro..RL_STATE_MACRODEFhʏReadlinefiscurren!tlyreadingcharactersde ningakeybMoardmacro.01.RL_STATE_OVERWRITEhʏReadlinefisino!verwritefmoMde..RL_STATE_COMPLETINGhʏReadlinefispMerformingw!ordcompletion.01.RL_STATE_SIGHANDLERhʏReadlinefiscurren!tlyexecutingthereadlinesignalhandler..RL_STATE_UNDOINGhʏReadlinefispMerforminganundo..RL_STATE_INPUTPENDINGhʏReadlinefhasinputpMendingduetoacalltorl_execute_next().01.RL_STATE_TTYCSAVEDhʏReadlinefhassa!vedfthevdDaluesoftheterminal'sspMecialc!haracters..RL_STATE_CALLBACKhʏReadline+is+curren!tlyusingthealternate(callbac!k)interface+(seeSec-hʏtionf2.4.12[AlternateIn!terface],page40).01.RL_STATE_VIMOTIONhʏReadlinefisreadingtheargumen!ttoavi-moMde"motion"command..RL_STATE_MULTIKEYhʏReadlinefisreadingam!ultiple-keystrokefcommand.GChapterf2:ProgrammingwithGNUReadlineʗ3033͍.RL_STATE_VICMDONCE 33hʏReadlinehasen!teredvicommand(mo!vement)moMdeatleastonetimehʏduringfthecurren!tcalltoreadline().T.RL_STATE_DONEhʏReadlineThasreadak!eysequenceTbMoundtoaccept-lineandisabouttohʏreturnfthelinetothecaller.8䍍3[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.Y!G\2.4Readlinef@ConvenienceFfunctionsGe2.4.1d(NamingMaFģunction3GTheusercandynamicallyc!hangethebindingsofkeyswhileusingReadline.]ThisisdonebyGrepresen!ting"the#functionwithadescriptiv!ename.Theuserisabletot!ypMethedescriptiv!eGnamefwhenreferringtothefunction.Th!us,inaninit le,onemight ndč.Meta-Rubout: Tbackward-kill-wordÍ!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(constfc!har*name,rl>xHtcommand>xHfunc>xHtf*function,intDGk!ey).AddxHtinsert,|thelowercase.Metac!haractersbMoundtoruntheirequivdDalents,andtheMetadigitsbMoundtoproduce.n!umericfarguments.Hz[Feunction]G@voidLrl_discard_keymapy(Keymapfk!eymap).FereethestorageassoMciatedwiththedataink!eymap. Thecallershouldfreek!eymap.z[Feunction]G@voidLrl_free_keymapy(Keymapfk!eymap).FereeallstorageassoMciatedwithk!eymap.Thiscallsrl_discard_keymaptofreesub-.ordindatefk!eymapsandmacros.!GReadlineqhassev!eralqinternalqkeymaps. >ThesefunctionsallowyouqtochangewhichGk!eymapfisactive.z[Feunction]G@KeymapLrl_get_keymapy(v!oid).Returnsfthecurren!tlyactivekeymap.Hz[Feunction]G@voidLrl_set_keymapy(Keymapfk!eymap).Mak!esfkeymapgthecurrentlyactivekeymap.z[Feunction]G@KeymapLrl_get_keymap_by_namey(constfc!har*name).Return>thek!eymap=matching>name.dnameEisonewhic!hwould>bMesuppliedinaset.keymapfinputrcline(seeSection1.3[ReadlineInitFile],page4).z[Feunction]G@charL*rl_get_keymap_namey(Keymapfk!eymap).Return>thename=matc!hingkeymap.dnameEisonewhich=wouldbMesuppliedin=aset.keymapfinputrcline(seeSection1.3[ReadlineInitFile],page4).dGe2.4.3d(BindingMKeys3GKeysequencesareassoMciatewithfunctionsthroughthek!eymap.2;Readlinehassev!eralin-Gternalk!eymaps:emacs_standard_keymap,xHtcommand>xHfunc>xHt*function).Bindsk!eytofunctioninthecurrentlyactivekeymap.Returnsnon-zerointhecase.offanin!vdDalidkey.Iz[Feunction]G@intLrl_bind_key_in_mapy(in!tfkeye,rl>xHtcommand>xHfunc>xHt*function,DGKeymapfmap).Bindfk!ey~tofunctioninmap.Returnsnon-zerointhecaseofaninvdDalidkey. GChapterf2:ProgrammingwithGNUReadlineʗ3233͍z[Feunction]G@intLrl_bind_key_if_unboundy(in!tfkeye,rl>xHtcommand>xHfunc>xHt*function) 33.BindsIk!ey9-tofunctionifIitisnotalreadybMoundinthecurren!tlyactiveIkeymap..Returnsfnon-zerointhecaseofanin!vdDalidkey~orifkey~isalreadybMound.fgz[Feunction]G@intLrl_bind_key_if_unbound_in_mapy(in!tfkeye,rl>xHtcommand>xHfunc>xHtDG*function,fKeymapmap).BindsGk!ey7tofunctionifitisnotalreadybMoundinmap.WReturnsnon-zerointhecase.offanin!vdDalidkey~orifkey~isalreadybMound.z[Feunction]G@intLrl_unbind_keyy(in!tfkey).Bind[rk!eyKtothe[snullfunction[sinthecurren!tlyactive[skeymap.Returnsnon-zero[rin.casefoferror.z[Feunction]G@intLrl_unbind_key_in_mapy(in!tfkeye,Keymapmap).Bindfk!ey~tothenullfunctioninmap.Returnsnon-zeroincaseoferror.z[Feunction]G@intLrl_unbind_function_in_mapy(rl>xHtcommand>xHfunc>xHtf*function,DGKeymapfmap).Un!bindfallkeysthatexecutefunctioninmap.z[Feunction]G@intLrl_unbind_command_in_mapy(constfc!har*command,Keymapmap).Un!bindfallkeysthatarebMoundtocommandinmap.ffz[Feunction]G@intLrl_bind_keyseqy(constfc!har*keyseq,rl>xHtcommand>xHfunc>xHtf*function).Bind,thek!eysequence,representedbythestringkeyseqmtto,thefunctionfunction,.bMeginningcincthecurren!tkeymap.ǠThismakescnewk!eymapsasnecessarye.ǟThereturn.vdDaluefisnon-zeroifk!eyseqLisinvdDalid.z[Feunction]G@intLrl_bind_keyseq_in_mapy(constfc!har*keyseq,rl>xHtcommand>xHfunc>xHtDG*function,fKeymapmap).Bindthek!eysequencerepresentedbythestringkeyseqBtothefunctionfunction.This.mak!es&newkeymapsasnecessarye.Initial%bindingsarepMerformedinmap.Thereturn.vdDaluefisnon-zeroifk!eyseqLisinvdDalid.z[Feunction]G@intLrl_set_keyy(constfc!har*keyseq,rl>xHtcommand>xHfunc>xHtf*function,DGKeymapfmap).EquivdDalen!tftorl_bind_keyseq_in_map.z[Feunction]G@intLrl_bind_keyseq_if_unboundy(constfc!har*keyseq,DGrl>xHtcommand>xHfunc>xHtf*function).BindsCk!eyseqtofunctionifCitisnotalreadybMoundinthecurren!tlyactiveCkeymap..Returnsfnon-zerointhecaseofanin!vdDalidkeyseqLorifkeyseqLisalreadybMound.z[Feunction]G@intLrl_bind_keyseq_if_unbound_in_mapy(constfc!har*keyseq,DGrl>xHtcommand>xHfunc>xHtf*function,Keymapmap).Bindsk!eyseqtofunctionifitisnotalreadybMoundinmap.oReturnsnon-zerointhe.casefofanin!vdDalidkeyseqLorifkeyseqLisalreadybMound.!GChapterf2:ProgrammingwithGNUReadlineʗ3333͍z[Feunction]G@intLrl_generic_bindy(in!tftypMe,constchar*keyseq,char*data,Keymap 33DGmap).Bind>the>k!eysequencerepresen!tedby>thestringk!eyseqtothearbitrarypMoin!terdata..t!ypMesaysjwhatjkindofdataispoin!tedjtobydata;~thiscanbMeajfunction(ISFUNC),va.macro(ISMACR),(orak!eymap(ISKMAP).ԙThismak!esnewkeymapsasnecessarye.ԙThe.initialfk!eymapinwhichtodobindingsismap.덍z[Feunction]G@intLrl_parse_and_bindy(c!harf*line).P!arseyline$asxifithadbMeenreadfromtheinputrc leandpMerforman!ykeybindings.andfvdDariableassignmen!tsfound(seeSection1.3[ReadlineInitFile],page4).썍z[Feunction]G@intLrl_read_init_filey(constfc!har* lename).Read8k!eybindingsand9vdDariableassignmentsfrom lenamee?(see9Section1.3[Readline.InitfFile],page4).%Ge2.4.4d(AssoiciatingMFģunctionNamesandBindings3GThesefunctionsallo!wyouto ndoutwhatk!eysinvokenamedfunctionsandthefunctionsGin!vokedMLbyMMaparticularkeysequence.*YeouMMmayalsoassoMciateMManewfunctionnamewithanGarbitraryffunction.z[Feunction]G@rl_command_func_tL*rl_named_functiony(constfc!har*name).Returnfthefunctionwithnamename.덍z[Feunction]G@rl_command_func_tL*rl_function_of_keyseqy(constfc!har*keyseq,DGKeymapfmap,in!t*typMe).Returnthefunctionin!vokedbykeyseq)inkeymapmap.Ifmap=isNULL,Ethecurren!t.k!eymapqisqused.?IftypMeisnotqNULL,sthetypMeqoftheobjectqisreturnedintheint.vdDariablefitpMoin!tsto(oneofISFUNC,ISKMAP,orISMACR).z[Feunction]G@charL**rl_invoking_keyseqsy(rl>xHtcommand>xHfunc>xHtf*function).Returnanarra!yofstringsrepresen!tingthek!eysequencesusedtoin!vokefunctionin.thefcurren!tkeymap.썍z[Feunction]G@charL**rl_invoking_keyseqs_in_mapy(rl>xHtcommand>xHfunc>xHtDG*function,fKeymapmap).Returnanarra!yofstringsrepresen!tingthek!eysequencesusedtoin!vokefunctionin.thefk!eymapmap.z[Feunction]G@voidLrl_function_dumpery(in!tfreadable).Prin!tthereadlinefunctionnamesandthekeysequencescurrentlybMoundtothemto.rl_outstream.IfLLreadableTisLMnon-zero,^Rthelistisformattedinsuc!hawaythatLLitcan.bMefmadepartofaninputrc leandre-read.썍z[Feunction]G@voidLrl_list_funmap_namesy(v!oid).Prin!tfthenamesofallbindableReadlinefunctionstorl_outstream.z[Feunction]G@constLchar**rl_funmap_namesy(v!oid).ReturnSaRNULL1terminatedarra!yofkno!wnfunctionnames.Thearra!yissorted.The.arra!y\hitself\iisalloMcated,k5butnotthestringsinside.3Yeoushouldfreethearra!ye,k5butnot.thefpMoin!ters,usingfreeorrl_freewhenyouaredone."ζGChapterf2:ProgrammingwithGNUReadlineʗ3433͍z[Feunction]G@intLrl_add_funmap_entryy(constfc!har*name,rl>xHtcommand>xHfunc>xHt 33DG*function).AddnametothelistofbindableReadlinecommandnames,Gandmak!efunctionthe.functionftobMecalledwhennameCmisin!voked.MGe2.4.5d(AllowingMUndoing3GSuppMortingLtheLundocommandisapainlessthing,vGandmak!esyourLfunctionsmuchLmoreGuseful.Itfiscertainlyeasytotrysomethingify!ouknowyoucanundoit.鍑!GIf*y!our+functionsimplyinsertstextonce,8ordeletestextonce,8andusesrl_insert_Gtext()Y)orrl_delete_text()Y*todoit,hthenundoingisalreadydonefory!ouautomaticallye.荑!GIfuy!oudomultipleinsertionsormultipledeletions,oranycombinationoftheseopMerations,Gy!oushouldgroupthemtogetherin!tooneopMeration.\Thisisdonewithrl_begin_undo_Ggroup()fandrl_end_undo_group().!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().Νz[Feunction]G@intLrl_begin_undo_groupy(v!oid).Beginssa!vingundoinformationinagroupconstruct.ATheundoinformationusually.comesIfromHcallstorl_insert_text()andrl_delete_text(),TAbutcouldbMethe.resultfofcallstorl_add_undo().Ξz[Feunction]G@intLrl_end_undo_groupy(v!oid).Closes{the{curren!tundogroupstartedwithrl_begin_undo_groupf().mThereshould.bMefonecalltorl_end_undo_group()foreac!hcalltorl_begin_undo_group().z[Feunction]G@voidLrl_add_undoy(en!umfundo>xHtcoMdewhat,intstart,intend,char*text).Remem!bMerhowtoundoanevent(accordingtowhat=)./rThea ectedtextrunsfrom.startftofend,andencompassestext.Ξz[Feunction]G@voidLrl_free_undo_listy(v!oid).Fereeftheexistingundolist.z[Feunction]G@intLrl_do_undoy(v!oid).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(in!tfstart,intend).Teell-Readlineto.sa!ve-thetextbMet!weenstart-and-endBasasingleundounit.g3Itis.assumedfthaty!ouwillsubsequentlymoMdifythattext.#xGChapterf2:ProgrammingwithGNUReadlineʗ3533͍Ge2.4.6d(Redisplay#z[Feunction]G@voidLrl_redisplayy(v!oid) 33.Changewhat'sdispla!yedonthescreentore ectthecurren!tcontentsofrl_line_.buffer.ލz[Feunction]G@intLrl_forced_update_displayy(v!oid).FeorcethelinetobMeupdatedandredispla!yed, whetherornotReadlinethinksthe.screenfdispla!yiscorrect.ݍz[Feunction]G@intLrl_on_new_liney(v!oid).TeelltheupMdatefunctionsthatw!ehavemovedontoanew(empty)line,!usuallyafter.outputtingfanewline.z[Feunction]G@intLrl_on_new_line_with_prompty(v!oid).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_reset_line_statey(v!oid).Reset*the*displa!ystatetoacleanstateandredispla!ythecurren!tlinestartingona.newfline.z[Feunction]G@intLrl_crlfy(v!oid).Mo!vefthecursortothestartofthenextscreenline.ݍz[Feunction]G@intLrl_show_chary(in!tfc).Displa!ycharacterconrl_outstream.IfReadlinehasnotbMeensettodispla!ymeta.c!haractersdirectlye,9(thiswillconvertmetacharacterstoameta-pre xedk!eysequence..Thisfisin!tendedforusebyapplicationswhichwishtodotheirownredisplaye.z[Feunction]G@intLrl_messagey(constfc!har*,PJ...5).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(v!oid).Clearzthemessagezintheec!hoarea.Ifthepromptw!assavedwithazcalltorl_save_.promptobMeforetheplastcalltorl_message,callrl_restore_promptbMeforecalling.thisffunction.z[Feunction]G@voidLrl_save_prompty(v!oid).Sa!ve,the, loMcalReadlinepromptdispla!ystateinpreparationfordispla!yinganew.messagefinthemessageareawithrl_message().$XGChapterf2:ProgrammingwithGNUReadlineʗ3633͍z[Feunction]G@voidLrl_restore_prompty(v!oid) 33.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(c!harf*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.theXFpromptcon!tainscharactersXGthattakeupnophysicalscreenXGspacewhendisplayed.b!yxbracketingwasequenceofsuc!hcharactersxwiththespMecialmark!ersRL_PROMPT_.START_IGNOREMandMRL_PROMPT_END_IGNORE(declaredinreadline.h.eThisma!ybMe.usedftoem!bMedterminal-speci cescapesequencesinprompts.z[Feunction]G@intLrl_set_prompty(constfc!har*prompt).Mak!e;Readlineusepromptxforsubsequentredisplaye.LThiscallsrl_expand_prompt().tofexpandthepromptandsetsrl_prompttotheresult.LGe2.4.7d(MoidifyingMTģext`~z[Feunction]G@intLrl_insert_texty(constfc!har*text).Inserttextin!tothelineatthecurren!tcursorpMosition.MReturnsthen!umbMerofchar-.actersfinserted.z[Feunction]G@intLrl_delete_texty(in!tfstart,intend).DeletethetextbMet!weenstartŁandendinthecurren!tline..Returnsthen!umbMerof.c!haractersfdeleted.z[Feunction]G@charL*rl_copy_texty(in!tfstart,intend).Returnfacop!yofthetextbMetweenstartfandendinthecurrentline.z[Feunction]G@intLrl_kill_texty(in!tfstart,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(c!harf*macro).CausedmacrobtobMeinsertedin!totheline,qasifithadbeenin!vokeddbyakeybMoundto.afmacro.NotespMeciallyuseful;userl_insert_text()instead.LGe2.4.8d(CharacterMInput`~z[Feunction]G@intLrl_read_keyy(v!oid).Return7the8nextc!haracteravdDailable7fromReadline'scurren!tinputstream.yThishan-.dles.Sinputinsertedin!totheinputstream.Tviarl>xHtpMending>xHinputkS(see.SSection2.3[Read-.lineVeariables],:page25)andrl_stuff_char(),9macros,andc!haractersreadfrom%VGChapterf2:ProgrammingwithGNUReadlineʗ3733͍.thek!eybMoard.2.Whilewaitingforinput,43thisfunctionwillcallan!yfunctionassigned 33.toftherl_event_hookvdDariable.=z[Feunction]G@intLrl_getcy(FILEf*stream).Returnthenextc!haracteravdDailablefromstream,whichisassumedtobMethekeybMoard.z[Feunction]G@intLrl_stuff_chary(in!tfc).Insertcin!totheReadlineinputstream.ItwillbMe"read"beforeReadlineattempts.to6read6c!haractersfromtheterminalwithrl_read_key().Upto512c!haractersmay.bMe+pushedbac!k.,rl_stuff_charreturns1ifthecharacterwassuccessfullyinserted;.0fotherwise.z[Feunction]G@intLrl_execute_nexty(in!tfc).Mak!eHcbMetheHnextcommandtobMeexecutedwhenrl_read_key()iscalled.This.setsfrl>xHtpMending>xHinput.z[Feunction]G@intLrl_clear_pending_inputy(v!oid).Unset|rl>xHtpMending>xHinput,\e ectiv!elynegatingthee ect{ofanypreviouscalltorl_.execute_next().zYThis:w!orksonlyifthepMendinginputhasnotalreadybeenread.withfrl_read_key().z[Feunction]G@intLrl_set_keyboard_input_timeouty(in!tfu).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.\~Ge2.4.9d(TģerminalMManagementz[Feunction]G@voidLrl_prep_terminaly(in!tfmeta>xHt ag).MoMdifytheterminalsettingsforReadline'suse,wsoreadline()canreadasingle.c!haracter,at-atimefromthek!eybMoard. 0Themeta>xHt agDargument,shouldbMenon-zero.iffReadlineshouldreadeigh!t-bitinput.z[Feunction]G@voidLrl_deprep_terminaly(v!oid).Undo˭theˬe ectsofrl_prep_terminal(),lea!vingtheterminalinthestateinwhic!h.itfw!asbMeforethemostrecentcalltorl_prep_terminal().z[Feunction]G@voidLrl_tty_set_default_bindingsy(Keymapfkmap).ReadotheoopMeratingsystem'sterminaleditingc!haracters(aswouldbMeodisplayedby.stty)ftotheirReadlineequivdDalen!ts.ThebindingsarepMerformedinkmap.z[Feunction]G@voidLrl_tty_unset_default_bindingsy(Keymapfkmap).Reset;thebindingsmanipulatedb!y:rl_tty_set_default_bindingssothattheter-.minal¯editing°c!haractersarebMoundtorl_insert.2ThebindingsarepMerformedin.kmap.z[Feunction]G@intLrl_reset_terminaly(constfc!har*terminal>xHtname).ReinitializeReadline'sideaoftheterminalsettingsusingterminal>xHtnamexasthetermi-.nalѢt!ypMeѡ(e.g.,qvt100)._Ifterminal>xHtnamenisNULL,theѡvdDalueoftheTERMen!vironment.vdDariablefisused.&]GChapterf2:ProgrammingwithGNUReadlineʗ3833͍Ge2.4.10d(UtilityMFģunctionsIz[Feunction]G@intLrl_save_statey(structfreadline>xHtstate*sp) 33.Sa!vekaksnapshotofReadline'sin!ternalstatetosp.Thecon!tentskofthereadline>xHtstate.structurearedoMcumen!tedinreadline.h.ѶThecallerisresponsibleforallocatingthe.structure.`z[Feunction]G@intLrl_restore_statey(structfreadline>xHtstate*sp).Restore Readline'sin!ternalstatetothatstoredinsp,whic!hmusthavebMeensavedbya.call|torl_save_state.The|con!tents|ofthereadline>xHtstatestructurearedoMcumen!ted.infreadline.h.ThecallerisrespMonsibleforfreeingthestructure._z[Feunction]G@voidLrl_freey(v!oidf*mem).DealloMcatethememorypoin!tedtobymem.memmusthavebMeenallocatedb!ymalloc.z[Feunction]G@voidLrl_replace_liney(constfc!har*text,intclear>xHtundo).ReplaceJtheKcon!tentsofrl_line_bufferKwithtext.ThepMoin!tandmarkarepre-.serv!ed,.eifepMossible.Ifclear>xHtundo5isdnon-zero,.ftheundolistassoMciatedwiththecurren!t.linefiscleared.z[Feunction]G@voidLrl_extend_line_buffery(in!tflen).Ensure4thatrl_line_bufferhas5enoughspacetoholdlenc!haracters,pMossiblyreal-.loMcatingfitifnecessarye._z[Feunction]G@intLrl_initializey(v!oid).Initializen8orn7re-initializeReadline'sin!ternalstate.5RIt'snotstrictlynecessarytocall.this;freadline()callsitbMeforereadingan!yinput.z[Feunction]G@intLrl_dingy(v!oid).RingftheterminalbMell,obeyingthesettingofbell-style._z[Feunction]G@intLrl_alphabeticy(in!tfc).Returnf1ifcPjisanalphabMeticc!haracter.z[Feunction]G@voidLrl_display_match_listy(c!harf**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.($NGChapterf2:ProgrammingwithGNUReadlineʗ4033͍z[Feunction]G@voidLrl_clear_historyy(v!oid) 33.ClearC%thehistoryC$listb!ydeletingalloftheen!tries,VinthesamemannerastheHistory.library's%>clear_history()%=function. ZeThisdi ersfromclear_historybMecauseit.freesfprivdDatedataReadlinesa!vesfinthehistorylist.Ge2.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.fhz[Feunction]G@voidLrl_callback_handler_instally(constfc!har*prompt,DGrl>xHtv!cpfunc>xHtf*lhandler).SetuptheterminalforreadlineI/Oanddispla!ytheinitialexpandedvdDalueofprompt..Sa!vec!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;)2鍟GChapterf2:ProgrammingwithGNUReadlineʗ4133:xstart=rl_point;ff: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{Qwinttemp=start;Qwstart=end;Qwend=temp;ED}: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);*A፟GChapterf2:ProgrammingwithGNUReadlineʗ4233͍.} эGe2.4.14d(AlternateMInterfaceExample3GHereisacompleteprogramthatillustratesReadline'salternatein!terface. Itreadslines 33Gfrom0theterminalanddispla!ysthem,providingthestandardhistoryandTeAB+completionGfunctions.ItfunderstandstheEOFc!haracteror"exit"toexittheprogram.@./*Standardincludefiles.stdio.hisrequired.*/.#include.#includeff./*Usedforselect(2)*/.#include.#include.#include./*Standardreadlineincludefiles.*/.#include.#include.staticvoidcb_linehandler(char*);.intrunning;.constchar*prompt="rltest$";./*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{+FGChapterf2:ProgrammingwithGNUReadlineʗ4333͍Qwif(*line) 33\add_history(line);Qwprintf("inputline:%s\n",line);Qwfree(line);ED}.}ff.int.main(intc,char**v).{:xfd_setfds;:xintr;: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)\{hv@perror("rltest:select");hv@rl_callback_handler_remove();hv@break;\}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. Thereisaclass,MэGChapterf2:ProgrammingwithGNUReadlineʗ4433͍GofusignalsuthatcanbMesen!ttotheproMcesscurren!tlyreadinginputfromthek!eybMoard.͐Since 33GReadlineWc!hangesWtheterminalattributeswhenitiscalled,itneedstopMerformspecialGproMcessingOBwhenOAsuc!hasignalisreceiv!edinordertorestoretheterminaltoasanestate,`orGpro!videfapplicationwriterswithfunctionstodosomanuallye.!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).!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.!GReadlineo#pro!videstwovdDariablesthatallowo"applicationwriterstocontrolwhetherornotGit.will/catc!hcertainsignalsandactonthemwhentheyarereceiv!ed.6ItisimpMortan!tthatGapplicationsfc!hangefthevdDaluesofthesevdDariablesonlywhencallingreadline(),notinaGsignalfhandler,soReadline'sin!ternalsignalstateisnotcorrupted.΍3[Veariable]G@intLrl_catch_signals.Ifw*thisw)vdDariableisnon-zero,ReadlinewillinstallsignalhandlersforSIGINT,SIGQUIT,.SIGTERM,fSIGHUP,SIGALRM,SIGTSTP,SIGTTIN,andSIGTTOU..ThefdefaultvdDalueofrl_catch_signalsis1.΍3[Veariable]G@intLrl_catch_sigwinch.IfTthisvdDariableissettoanon-zerovalue,Readlinewillinstallasignalhandlerfor.SIGWINCH..ThefdefaultvdDalueofrl_catch_sigwinchis1.΍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.-TAGChapterf2:ProgrammingwithGNUReadlineʗ4533͍z[Feunction]G@voidLrl_cleanup_after_signaly(v!oid) 33.Thisfunctionwillresetthestateoftheterminaltowhatitw!asbMeforereadline().w!ascalled,~andremovetheReadlinesignalhandlersforallsignals,depMendingonthe.vdDaluesfofrl_catch_signalsandrl_catch_sigwinch.~z[Feunction]G@voidLrl_free_line_statey(v!oid).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(v!oid).Thiskwillreinitializetheterminalandreinstallkan!yReadlinesignalhandlers,wsdepMend-.ingfonthevdDaluesofrl_catch_signalsandrl_catch_sigwinch.!GIfanapplicationdoMesnotwishReadlinetocatc!hSIGWINCH, itmaycallrl_resize_Gterminal()Borrl_set_screen_size()toforceReadlinetoupMdateitsideaoftheterminalGsizefwhenaSIGWINCHisreceiv!ed.}z[Feunction]G@voidLrl_echo_signal_chary(in!tfsig).If;anapplicationwishestoinstallits;o!wnsignalhandlers,butstillhavereadline.displa!ycharactersthatgeneratesignals,gcallingthisfunctionwithsigsettoSIGINT,.SIGQUIT,forSIGTSTPwilldispla!ythecharactergeneratingthatsignal.z[Feunction]G@voidLrl_resize_terminaly(v!oid).UpMdatefReadline'sin!ternalscreensizebyreadingvdDaluesfromthekernel.}z[Feunction]G@voidLrl_set_screen_sizey(in!tfrows,intcols).SetXReadline'sideaXoftheterminalsizetoro!wsGrowsXandcolscolumns.Ifeitherro!ws.or9columnsZislessthan9orequalto0,^Readline'sideaofthatterminaldimensionis.unc!hanged.!GIfanapplicationdoMesnotw!anttoinstallaSIGWINCHhandler,butisstillin!terestedinGthefscreendimensions,Readline'sideaofthescreensizema!ybMequeried.z[Feunction]G@voidLrl_get_screen_sizey(in!tf*rows,int*cols).ReturnGReadline'sideaofHtheterminal'ssizeinthevdDariablespMoin!tedtob!ytheargu-.men!ts.}z[Feunction]G@voidLrl_reset_screen_sizey(v!oid).CausefReadlinetoreobtainthescreensizeandrecalculateitsdimensions.!GTheffollo!wingfunctionsinstallandremoveReadline'ssignalhandlers.}z[Feunction]G@intLrl_set_signalsy(v!oid).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.9-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.Fiz[Feunction]G@intLrl_completey(in!tfignore,intinvoking>xHtkey).Completetthesw!ordatorbMeforepoin!t.YeouhavesuppliedsthefunctionthatdoMesthe.initialsimplematc!hingselectionalgorithm(seerl_completion_matches()).wThe.defaultfistodo lenamecompletion.Fh3[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./rGChapterf2:ProgrammingwithGNUReadlineʗ4733͍Ge2.6.2d(CompletionMFģunctions3GHerefisthecompletelistofcallablecompletionfunctionspresen!tinReadline.\*z[Feunction]G@intLrl_complete_internaly(in!tfwhat>xHtto>xHdo) 33.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.z[Feunction]G@intLrl_completey(in!tfignore,intinvoking>xHtkey).Completethew!ordatorbMeforepoin!t.aYeouhavesuppliedthefunctionthatdoMes.theinitialsimplematc!hingselectionalgorithm(seerl_completion_matches()and.rl_completion_entry_function).XTheNdefaultNistodo lenamecompletion.XThis.callsfrl_complete_internal()withanargumen!tdepMendingoninvoking>xHtkey.\)z[Feunction]G@intLrl_possible_completionsy(in!tfcount,intinvoking>xHtkey).ListthepMossiblecompletions.Seedescriptionofrl_completef().Thiscallsrl_.complete_internal()fwithanargumen!tof`?'.z[Feunction]G@intLrl_insert_completionsy(in!tfcount,intinvoking>xHtkey).Insert the listofpMossiblecompletionsin!totheline,"deletingthepartially-completed.w!ord.WSeedescriptionofrl_complete().Thiscallsrl_complete_internal()with.anfargumen!tof`*'.z[Feunction]G@intLrl_completion_modey(rl>xHtcommand>xHfunc>xHtf*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(constfc!har*text,DGrl>xHtcompMen!try>xHfunc>xHtf*entry>xHfunc).Returns^an]arra!yofstringswhich]isalistofcompletionsfortext.Ifthereareno.completions,C;returns#NULL.VCThe# rsten!tryinthereturnedarra!yisthesubstitution.for)Gtext.(Theremainingen!triesarethepMossiblecompletions.Thearra!yisterminated.withfaNULLpMoin!ter.Ǯ.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(constfc!har*text,intDGstate).Ageneratorfunctionfor lenamecompletioninthegeneralcase.textPisapartial le-.name.UTheBashsourceisausefulreferenceforwritingapplication-spMeci ccompletion.functionsf(theBashcompletionfunctionscallthisandotherReadlinefunctions).0 GChapterf2:ProgrammingwithGNUReadlineʗ4833͍z[Feunction]G@charL*rl_username_completion_functiony(constfc!har*text,int 33DGstate).Al&completionl4generatorl5forusernames.xtext4con!tainsapartialusernameprecededb!y.arandomc!haracter(usually`~').Aswithallcompletiongenerators,stateHiszeroon.thef rstcallandnon-zeroforsubsequen!tcalls.0Ge2.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.|3[Veariable]G@rl_completion_func_tL*rl_attempted_completion_function.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.1GChapterf2:ProgrammingwithGNUReadlineʗ4933͍3[Veariable]G@rl_compignore_func_tL*rl_ignore_some_completions_function 33.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.B3[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!veYa.trailing2slash.ThemoMdi edvdDalue2willbeusedas2partofthecompletion,Ureplacing.the}directory~pMortionofthepathnametheusert!ypMed.S#Atthe}least,Devenif~noother.expansionEQispMerformed,m thisfunctionshouldremo!veEQanyERquotecharactersfromthe.directoryfname,bMecauseitsresultwillbepasseddirectlytoopendir().軍.ThedirectorycompletionhoMokreturnsanin!tegerthatshouldbMenon-zeroifthefunc-.tionmoMdi esitsdirectoryargumen!t.;ThefunctionshouldnotmoMdifythedirectory.argumen!tfifitreturns0.C3[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-.tionVmoMd esitsdirectoryargumen!t.addressofafunctionforthecompletertocallbMeforedeciding.whic!hcharactertoappMendtoacompletedname.ThisfunctionmoMdi esits lename.nameFargumen!t,mandthemoMdi edvdDalueispassedtostat()todeterminethe le's.t!ypMe:andcharacteristics.YThisfunction;doMesnotneedtoremovequotecharacters.fromfthe lename.軍.ThestathoMokreturnsanin!tegerthatshouldbMenon-zeroifthefunctionmoMd esits.directoryeargumen!t.ThefunctionfshouldnotmoMdifythedirectoryargumen!tifit.returnsf0.B3[Veariable]G@rl_dequote_func_tL*rl_filename_rewrite_hook.If non-zero,thisistheaddressofafunctioncalledwhenreadingdirectoryen!tries.fromthe lesystemforcompletionandcomparingthemtothepartialw!ordtobMe.completed.zThe?>function?=shouldpMerforman!ynecessaryapplicationorsystem-spMeci c2㍟GChapterf2:ProgrammingwithGNUReadlineʗ5033͍.con!versiononthe lename,9$suc!hascon!vertingbMetweencharactersetsorcon!verting 33.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.s43[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>xHtmatchesisthe.n!umbMer}wof}vstringsinthatarra!ye,andmax>xHtlengthisthelengthofthelongeststringin.that_@arra!ye.&Readlineprovidesaconveniencefunction,m{rl_display_match_list,that.tak!es-careofdoingthedisplaytoReadline's-outputstream.sThatfunctionmaybMe.calledffromthishoMok.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.Programscanusethistohelpdeterminewhat3GChapterf2:ProgrammingwithGNUReadlineʗ5133͍.kindUofUcompletingtodo. Feorinstance,fBashsetsthisvdDariableto"$@"sothatitcan 33.completefshellvdDariablesandhostnames.fg3[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'). FSettingsthistothesn!ullcharacter(`\0')preventssanythingbMeingappended.automaticallye.ThiscanbMec!hangedinapplication-speci ccompletionfunctionsto.pro!videthe\mostsensiblew!ordseparatorcharacter"accordingtoanapplication-.spMeci cfcommandlinesyn!taxspeci cation.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.fh3[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.4GChapterf2:ProgrammingwithGNUReadlineʗ5233͍3[Veariable]G@intLrl_filename_completion_desired 33.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.333[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.3[Veariable]G@intLrl_attempted_completion_over.If Oanapplication-spMeci ccompletion Ofunctionassignedtorl_attempted_.completion_functionbsetsbthisvdDariabletoanon-zerovdDalue,Readlinewillnot.pMerformitsdefault lenamecompletionev!eniftheapplication'scompletionfunction.returnsfnomatc!hes.ItshouldbMesetonlybyanapplication'scompletionfunction.3[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],%pageg47)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.Ge2.6.4d(AMShortCompletionExample3GHere}aisa}`smallapplicationdemonstratingtheuseoftheGNU}VReadlinelibrarye.0ItiscalledGfileman, 0andthesourcecoMderesidesinexamples/fileman.c.6)ThissampleapplicationGpro!vides#completionof#commandnames,>lineeditingfeatures,andaccessto#thehistorylist.5qGChapterf2:ProgrammingwithGNUReadlineʗ5333͍./*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;6GChapterf2:ProgrammingwithGNUReadlineʗ5433L͍.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.*/70GChapterf2:ProgrammingwithGNUReadlineʗ5533͍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;.{8iGChapterf2:ProgrammingwithGNUReadlineʗ5633͍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**9GChapterf2:ProgrammingwithGNUReadlineʗ5733͍.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.*/:GChapterf2:ProgrammingwithGNUReadlineʗ5833͍.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));;GChapterf2:ProgrammingwithGNUReadlineʗ5933͍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,Possibiltiesare:\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{< GChapterf2:ProgrammingwithGNUReadlineʗ6033͍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);.}=>GAppMendixfA:GNUFereeDocumen!tationLicense:6133͍GSApp=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!tisreleased>GAppMendixfA:GNUFereeDocumen!tationLicense:6233͍'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,@;ۍGAppMendixfA:GNUFereeDocumen!tationLicense:6433͍=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,addtheirAN=GAppMendixfA:GNUFereeDocumen!tationLicense:6533͍'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.B^GAppMendixfA:GNUFereeDocumen!tationLicense:6633͍-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.CpGAppMendixfA:GNUFereeDocumen!tationLicense:6733͍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&)iU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: +$15end-of-lineT(C-e)ꍑ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:14exchange-point-and-markT(C-xC-x)KU:pU:U:U:U:U:U:U:U:U:20expand-tildeVU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:06)\F)forward-backward-delete-charT()PU:pU:U:U:U:U:U:U:U:U:U:U: 16forward-charT(C-f)WU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:14forward-search-historyT(C-s) U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:Ĭ15forward-wordT(M-f)WU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:14(\Hhistory-preserv9e-pAointe/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:6history-search-backwardT()!U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:S15history-search-forwardT()pU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:E15history-size0U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:bv6 ^history-substr-search-backwardT() *U:pU:U:U:U:U:U:U:U:U:;15history-substr-search-forwardT()XU:pU:U:U:U:U:U:U:U:U:U:x15horizon9tal-scroll-moAdeU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: Ѭ6捒\Iinput-meta9U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:7insert-commentT(M-#)iU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: +$20insert-completionsT(M-*)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ج19isearc9h-terminatorsU:pU:U:U:U: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捒\Kk9eymap9rU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: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-7kill-lineT(C-k)tU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ˬ17kill-regionT()£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:^18 ^kill-whole-lineT()WU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17kill-wordT(M-d)tU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ˬ17(\Mmark-moAdi ed-linesmU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:'7mark-symlink9ed-directoriesDKU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:v7matc9h-hidden- les{PU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: 7GHGFeunctionfandVariableIndex7133͍Gmenu-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:W819 :Gmenu-complete-backwardT()pU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:E19Gmen9u-complete-display-pre xmU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: '8Gmeta- 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:Qe7 gG\N Gnext-historyT(C-n)WU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:15Gnon-incremental-forward-search-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:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:J15Gnon-incremental-reverse-search-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:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:J15$G\O Goutput-meta䍑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:8Goverwrite-modeT()ꍑ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:17 fG\PGpage-completions3U:pU:U:U:U:U:U: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 9Gpossible-completionsT(M-?)!U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:S19Gprefix-metaT(ESC)ꍑ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:20Gprevious-historyT(C-p)\CU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:14Gprint-last-kbd-macroT() U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:?k19`gG\QGquoted-insertT(C-qorC-v)9U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16G\RGre-read-init-fileT(C-xC-r)U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:@19 :GreadlineU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:w22Gredraw-current-lineT()\CU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:14Greverse-search-historyT(C-r) U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:Ĭ15Grev9ert-all-at-newlineVU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: 8Grevert-lineT(M-r)ꍑ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:20Grl_add_defunU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c30Grl_add_funmap_entryuۍ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:34Grl_add_undo;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: 34 9Grl_alphabetic?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:pЬ38Grl_already_prompteduۍ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:26Grl_attempted_completion_functionԍU:pU:U:U:U:U:U:U:U:U:Ə48Grl_attempted_completion_over荑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:52Grl_basic_quote_charactersU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:\50Grl_basic_word_break_characters#U:pU:U:U:U:U:U:U:U:U:U:U:U:U}50Grl_begin_undo_groupuۍ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:34Grl_bind_key;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: 31Grl_bind_key_if_unbound"U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ݬ32Grl_bind_key_if_unbound_in_maprUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:32Grl_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:)31Grl_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:"=32Grl_bind_keyseq_if_unboundU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:\32Grl_bind_keyseq_if_unbound_in_mapԍU:pU:U:U:U:U:U:U:U:U:Ə32Grl_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: p32Grl_binding_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:U:U:628Grl_callback_handler_install{U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:A640͍rl_callback_handler_remove^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ40 rl_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: p40rl_catch_signalsS\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_catch_sigwinchɍ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:644 rl_change_environmentصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p44rl_char_is_quoted_puۍ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:48rl_cleanup_after_signal;U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:mJ45rl_clear_historyS\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:40rl_clear_messageS\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:35rl_clear_pending_input"U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ݬ37rl_clear_signalsS\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:45rl_completeXU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:46,T47rl_complete_internal'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y47rl_completer_quote_charactersrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:50rl_completer_word_break_charactersU:pU:U:U:U:U:U:U:)i50rl_completion_append_character#U:pU:U:U:U:U:U:U:U:U:U:U:U:U}51rl_completion_display_matches_hookU:pU:U:U:U:U:U:U:)i50rl_completion_entry_function=U:pU:U:U:U:U:U:U:U:U:U:46,T48rl_completion_found_quoteU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:\51rl_completion_invoking_key^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ52rl_completion_mark_symlink_dirsgU:pU:U:U:U:U:U:U:U:U:U: "51rl_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: p47rl_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:)47rl_completion_query_itemsU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:\51rl_completion_quote_characterrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:51rl_completion_suppress_appendrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:51rl_completion_suppress_quote荑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:51rl_completion_typenU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:)52rl_completion_word_break_hookrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:50rl_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:"=31rl_copy_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:U:U:c36rl_crlfOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U: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_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:"=36rl_deprep_term_function;U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:mJ28rl_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:)37rl_dingOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U: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_directory_completion_hook荑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:49rl_directory_rewrite_hook;^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ49rl_discard_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:U:U:631rl_dispatchingU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"=25rl_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: p38rl_display_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:626rl_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:NQ34rl_doneOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:: 25rl_echo_signal_charuۍ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:45rl_editing_mode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:Ӫ30rl_endV⍑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:25rl_end_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:U:U:634rl_erase_empty_lineuۍ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:25rl_event_hook?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:pЬ27rl_execute_next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:Ӫ37rl_executing_keyS\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:28rl_executing_keymapuۍ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:28rl_executing_keysequۍ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:28rl_executing_macronU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:)28rl_expand_promptS\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:36rl_explicit_arg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:Ӫ30rl_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: p38HGFeunctionfandVariableIndex7233͍Grl_filename_completion_desired#U:pU:U:U:U:U:U:U:U:U:U:U:U:U}52 Grl_filename_completion_functiongU:pU:U:U:U:U:U:U:U:U:U: "47Grl_filename_dequoting_function#U:pU:U:U:U:U:U:U:U:U:U:U:U:U}48Grl_filename_quote_characters荑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:50 Grl_filename_quoting_desired{U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:A652Grl_filename_quoting_function荑U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:48Grl_filename_rewrite_hook4U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: ,49Grl_filename_stat_hookصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p49Grl_forced_update_display4U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: ,35Grl_freeOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U: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_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:"=31Grl_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:)45Grl_free_undo_listɍ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:634Grl_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:)33Grl_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: p33Grl_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:U:U:U:U:U:U:Ӫ33Grl_generic_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:U:Ӫ33Grl_get_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:U:U:U:U:U:U:pЬ31Grl_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: p31Grl_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:)31Grl_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:)45Grl_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:"=39Grl_getcOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U: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_getc_functionS\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:27Grl_gnu_readline_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:626Grl_ignore_completion_duplicatesgU:pU:U:U:U:U:U:U:U:U:U: "51Grl_ignore_some_completions_functionU:pU:U:U:U:U:U:֬49Grl_inhibit_completionصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p52Grl_initialize?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:pЬ38Grl_input_available_hook;U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:mJ27Grl_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: p47Grl_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:"=36Grl_instream;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: 26Grl_invoking_keyseqsuۍ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:33Grl_invoking_keyseqs_in_map^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ33Grl_key_sequence_length"U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ݬ28Grl_kill_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:U:U:c36Grl_last_funcU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c27Grl_library_versionnU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:)26Grl_line_bufferU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"=25Grl_list_funmap_names'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y33Grl_macro_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:U:U:U:pЬ39Grl_macro_dumper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:Ӫ39Grl_make_bare_keymapuۍ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:30Grl_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:"=31Grl_markOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:: 25Grl_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:NQ35Grl_modifyingU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c34Grl_named_functionɍ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:633Grl_num_chars_to_read'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y25Grl_numeric_argU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:"=30Grl_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:"=35Grl_on_new_line_with_prompt^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ35Grl_outstreamU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c26Grl_parse_and_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:633Grl_pending_inputS\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:25Grl_pointU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:w25Grl_possible_completions;U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:mJ47͍rl_pre_input_hookɍ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:627 rl_prefer_env_winsizeصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p26 rl_prep_term_functionصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p28rl_prep_terminalS\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:37rl_promptk)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:26rl_push_macro_inputuۍ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:36rl_read_init_fileɍ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:633rl_read_key;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: 36rl_readline_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:U:U:U:U:U:26rl_readline_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:628rl_readline_versionuۍ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:26rl_redisplayU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:c35rl_redisplay_functionصU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: p27rl_replace_line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:Ӫ38rl_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: p45rl_reset_line_stateuۍ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:35rl_reset_screen_size'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y45rl_reset_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:637rl_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:)45rl_restore_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:636rl_restore_stateS\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:38rl_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:"=35rl_save_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:U:U:U:pЬ38rl_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:NQ32rl_set_keyboard_input_timeoutrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:37rl_set_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:U:U:U:U:U:U:pЬ31rl_set_paren_blink_timeout^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ39rl_set_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:U:U:U:pЬ36rl_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:)45rl_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:"=45rl_show_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:U:c35rl_signal_event_hook'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y27rl_sort_completion_matches^U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ɬ52rl_special_prefixesuۍ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:50rl_startup_hook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:Ӫ27rl_stuff_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:U:U:U:U:U:U:pЬ37rl_terminal_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:U:U:U:U:U:26rl_tty_set_default_bindings{U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:A637rl_tty_unset_default_bindingsrUU:pU:U:U:U:U:U:U:U:U:U:U:U:U:37rl_unbind_command_in_map4U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: ,32rl_unbind_function_in_mapU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:\32rl_unbind_key?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:pЬ32rl_unbind_key_in_map'HU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Y32rl_username_completion_functiongU:pU:U:U:U:U:U:U:U:U:U: "48rl_variable_bindS\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_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:)39rl_variable_valueɍ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:639\Sself-insertT(a,b,A,1,!,...B)VU:pU:U:U:U:U:U:U:U:U:U:U:U:16set-markT(C-@)£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:^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:#ˬ8sho9w-all-if-unmoAdi edOU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: 1 8sho9w-moAde-in-promptQU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:Ҭ8skip-completed-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:`8skip-csi-sequenceT()iU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: +$20start-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: 19ILUGFeunctionfandVariableIndex7333$ɔ|9G\T Gtab-insertT(M-TAB)WU:pU:U: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 0Gtilde-expandT(M-~)WU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:20Gtranspose-charsT(C-t)֍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ܑ16Gtranspose-wordsT(M-t)֍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ܑ17`4G\UGundoT(C-_orC-xC-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:U:620 1Guniversal-argumentT()֍U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:ܑ18Gunix-filename-ruboutT() U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:?k18Gunix-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:?k17Gunix-word-ruboutT(C-w)\CU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:17|9upcase-wordT(M-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:U:U:U:U:17W덒\V`\vi-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:?k21 _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:U:Wq9\Y`[yankT(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: r18 `yank-last-argT(M-.orM-_)9U:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:16yank-nth-argT(M-C-y)iU:pU:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U: +$15yank-popT(M-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:^18;ïMeN # cmbx12cgff cmmi12\Nff cmbx12SNG cmbx12JNj cmbx12E b> 3 cmmi10=