121 D E end
+%%EndProlog
+%%BeginSetup
+%%Feature: *Resolution 300dpi
+TeXDict begin
+%%PaperSize: A4
+
+%%EndSetup
+%%Page: 1 1
+1 0 bop 75 693 a Fp(GNU)33 b(History)f(Library)p 75 743
+1800 17 v 960 791 a Fo(Edition)16 b(4.0,)e(for)h Fn(History)f(Library)g
+Fo(V)l(ersion)i(4.0.)1572 845 y(Decem)o(b)q(er)g(1998)75
+2467 y Fm(Brian)23 b(F)-6 b(o)n(x,)23 b(F)-6 b(ree)23
+b(Soft)n(w)n(are)f(F)-6 b(oundation)75 2534 y(Chet)22
+b(Ramey)-6 b(,)23 b(Case)e(W)-6 b(estern)23 b(Reserv)n(e)f(Univ)n
+(ersit)n(y)p 75 2570 1800 9 v eop
+%%Page: 2 2
+2 1 bop 75 250 a Fo(This)21 b(do)q(cumen)o(t)g(describ)q(es)h(the)f
+(GNU)f(History)g(library)l(,)j(a)d(programming)g(to)q(ol)g(that)g(pro)o
+(vides)h(a)75 305 y(consisten)o(t)15 b(user)h(in)o(terface)f(for)g
+(recalling)i(lines)f(of)f(previously)i(t)o(yp)q(ed)e(input.)75
+373 y(Published)i(b)o(y)f(the)f(F)l(ree)g(Soft)o(w)o(are)f(F)l
+(oundation)75 427 y(675)g(Massac)o(h)o(usetts)g(Av)o(en)o(ue,)75
+482 y(Cam)o(bridge,)h(MA)g(02139)f(USA)75 549 y(P)o(ermission)j(is)f
+(gran)o(ted)g(to)f(mak)o(e)h(and)g(distribute)i(v)o(erbatim)d(copies)i
+(of)f(this)h(man)o(ual)f(pro)o(vided)h(the)75 604 y(cop)o(yrigh)o(t)e
+(notice)h(and)f(this)h(p)q(ermission)g(notice)g(are)f(preserv)o(ed)h
+(on)f(all)h(copies.)75 671 y(P)o(ermission)c(is)h(gran)o(ted)e(to)g
+(cop)o(y)h(and)g(distribute)h(mo)q(di\014ed)g(v)o(ersions)f(of)f(this)h
+(man)o(ual)g(under)h(the)f(con-)75 726 y(ditions)k(for)e(v)o(erbatim)h
+(cop)o(ying,)g(pro)o(vided)h(that)e(the)h(en)o(tire)h(resulting)g
+(deriv)o(ed)g(w)o(ork)e(is)h(distributed)75 781 y(under)h(the)f(terms)g
+(of)g(a)f(p)q(ermission)j(notice)f(iden)o(tical)h(to)e(this)g(one.)75
+848 y(P)o(ermission)i(is)g(gran)o(ted)f(to)g(cop)o(y)h(and)f
+(distribute)i(translations)f(of)f(this)h(man)o(ual)g(in)o(to)f(another)
+g(lan-)75 903 y(guage,)e(under)h(the)f(ab)q(o)o(v)o(e)g(conditions)i
+(for)d(mo)q(di\014ed)j(v)o(ersions,)e(except)h(that)f(this)h(p)q
+(ermission)g(notice)75 958 y(ma)o(y)f(b)q(e)i(stated)f(in)h(a)f
+(translation)g(appro)o(v)o(ed)g(b)o(y)g(the)g(F)l(ree)h(Soft)o(w)o(are)
+d(F)l(oundation.)75 2661 y(Cop)o(yrigh)o(t)301 2660 y(c)289
+2661 y Fl(\015)i Fo(1988-1999)e(F)l(ree)i(Soft)o(w)o(are)f(F)l
+(oundation,)h(Inc.)p eop
+%%Page: 1 3
+1 2 bop 75 -58 a Fo(Chapter)15 b(1:)k(Using)d(History)f(In)o(teractiv)o
+(ely)1007 b(1)75 183 y Fk(1)41 b(Using)26 b(History)h(In)n(teractiv)n
+(ely)137 317 y Fo(This)16 b(c)o(hapter)f(describ)q(es)i(ho)o(w)d(to)h
+(use)g(the)g(GNU)g(History)g(Library)h(in)o(teractiv)o(ely)l(,)g(from)e
+(a)h(user's)75 372 y(standp)q(oin)o(t.)35 b(It)20 b(should)g(b)q(e)h
+(considered)h(a)d(user's)h(guide.)35 b(F)l(or)19 b(information)h(on)g
+(using)h(the)f(GNU)75 427 y(History)d(Library)h(in)h(y)o(our)e(o)o(wn)g
+(programs,)f(see)i(Chapter)f(2)h([Programming)e(with)i(GNU)f(History],)
+75 482 y(page)e(3.)75 625 y Fm(1.1)33 b(History)22 b(Expansion)137
+727 y Fo(The)c(History)g(library)h(pro)o(vides)f(a)f(history)h
+(expansion)h(feature)e(that)h(is)g(similar)h(to)e(the)h(history)75
+782 y(expansion)12 b(pro)o(vided)g(b)o(y)f Fn(csh)p Fo(.)18
+b(This)11 b(section)h(describ)q(es)g(the)g(syn)o(tax)e(used)h(to)g
+(manipulate)h(the)f(history)75 836 y(information.)137
+909 y(History)k(expansions)h(in)o(tro)q(duce)h(w)o(ords)d(from)g(the)i
+(history)f(list)h(in)o(to)f(the)h(input)g(stream,)e(making)75
+964 y(it)h(easy)g(to)g(rep)q(eat)g(commands,)g(insert)h(the)f(argumen)o
+(ts)f(to)h(a)g(previous)h(command)f(in)o(to)g(the)g(curren)o(t)75
+1019 y(input)h(line,)h(or)d(\014x)i(errors)e(in)i(previous)g(commands)f
+(quic)o(kly)l(.)137 1092 y(History)j(expansion)i(tak)o(es)d(place)i(in)
+h(t)o(w)o(o)d(parts.)28 b(The)19 b(\014rst)f(is)g(to)g(determine)i
+(whic)o(h)f(line)h(from)75 1147 y(the)h(history)f(list)i(should)g(b)q
+(e)f(used)g(during)h(substitution.)37 b(The)21 b(second)g(is)g(to)f
+(select)i(p)q(ortions)e(of)75 1202 y(that)15 b(line)i(for)d(inclusion)k
+(in)o(to)d(the)h(curren)o(t)f(one.)20 b(The)c(line)g(selected)h(from)e
+(the)g(history)g(is)h(called)h(the)75 1256 y Fj(ev)o(en)o(t)p
+Fo(,)c(and)h(the)g(p)q(ortions)g(of)f(that)g(line)i(that)e(are)g(acted)
+h(up)q(on)g(are)f(called)j Fj(w)o(ords)p Fo(.)i(V)l(arious)c
+Fj(mo)q(di\014ers)75 1311 y Fo(are)i(a)o(v)m(ailable)i(to)e(manipulate)
+i(the)e(selected)i(w)o(ords.)23 b(The)17 b(line)h(is)f(brok)o(en)f(in)o
+(to)h(w)o(ords)e(in)j(the)e(same)75 1366 y(fashion)c(that)e(Bash)i(do)q
+(es,)g(so)f(that)g(sev)o(eral)g(w)o(ords)g(surrounded)h(b)o(y)f(quotes)
+h(are)f(considered)h(one)g(w)o(ord.)75 1421 y(History)18
+b(expansions)h(are)g(in)o(tro)q(duced)g(b)o(y)f(the)h(app)q(earance)g
+(of)f(the)g(history)h(expansion)g(c)o(haracter,)75 1475
+y(whic)o(h)d(is)g(`)p Fn(!)p Fo(')e(b)o(y)h(default.)75
+1599 y Fi(1.1.1)30 b(Ev)n(en)n(t)21 b(Designators)137
+1701 y Fo(An)16 b(ev)o(en)o(t)f(designator)g(is)g(a)g(reference)h(to)f
+(a)g(command)g(line)i(en)o(try)d(in)i(the)g(history)f(list.)75
+1789 y Fn(!)216 b Fo(Start)16 b(a)g(history)h(substitution,)g(except)h
+(when)f(follo)o(w)o(ed)g(b)o(y)f(a)h(space,)g(tab,)f(the)h(end)g(of)315
+1844 y(the)e(line,)i(`)p Fn(=)p Fo(')d(or)h(`)p Fn(\()p
+Fo('.)75 1929 y Fn(!)p Fj(n)191 b Fo(Refer)16 b(to)e(command)h(line)i
+Fj(n)p Fo(.)75 2015 y Fn(!-)p Fj(n)167 b Fo(Refer)16
+b(to)e(the)i(command)f Fj(n)g Fo(lines)i(bac)o(k.)75
+2100 y Fn(!!)192 b Fo(Refer)16 b(to)e(the)i(previous)f(command.)20
+b(This)c(is)g(a)f(synon)o(ym)g(for)f(`)p Fn(!-1)p Fo('.)75
+2186 y Fn(!)p Fj(string)102 b Fo(Refer)16 b(to)e(the)i(most)e(recen)o
+(t)h(command)g(starting)g(with)g Fj(string)p Fo(.)75
+2271 y Fn(!?)p Fj(string)t Fn([?])315 2326 y Fo(Refer)i(to)f(the)h
+(most)f(recen)o(t)h(command)g(con)o(taining)g Fj(string)p
+Fo(.)25 b(The)17 b(trailing)g(`)p Fn(?)p Fo(')f(ma)o(y)g(b)q(e)315
+2381 y(omitted)f(if)h(the)f Fj(string)k Fo(is)d(follo)o(w)o(ed)f
+(immediately)i(b)o(y)e(a)g(newline.)75 2466 y Fn(^)p
+Fj(string1)t Fn(^)p Fj(string2)t Fn(^)315 2521 y Fo(Quic)o(k)i
+(Substitution.)23 b(Rep)q(eat)17 b(the)f(last)f(command,)h(replacing)h
+Fj(string1)i Fo(with)e Fj(string2)p Fo(.)315 2576 y(Equiv)m(alen)o(t)g
+(to)d Fn(!!:s/)p Fj(string1)t Fn(/)p Fj(string2)t Fn(/)p
+Fo(.)75 2661 y Fn(!#)192 b Fo(The)15 b(en)o(tire)h(command)f(line)i(t)o
+(yp)q(ed)f(so)e(far.)p eop
+%%Page: 2 4
+2 3 bop 75 -58 a Fo(2)1347 b(GNU)15 b(History)g(Library)75
+183 y Fi(1.1.2)30 b(W)-5 b(ord)20 b(Designators)137 279
+y Fo(W)l(ord)d(designators)g(are)g(used)h(to)f(select)h(desired)h(w)o
+(ords)d(from)h(the)g(ev)o(en)o(t.)26 b(A)18 b(`)p Fn(:)p
+Fo(')e(separates)h(the)75 333 y(ev)o(en)o(t)j(sp)q(eci\014cation)h
+(from)e(the)h(w)o(ord)f(designator.)34 b(It)20 b(ma)o(y)f(b)q(e)h
+(omitted)g(if)g(the)g(w)o(ord)f(designator)75 388 y(b)q(egins)f(with)g
+(a)e(`)p Fn(^)p Fo(',)h(`)p Fn($)p Fo(',)f(`)p Fn(*)p
+Fo(',)g(`)p Fn(-)p Fo(',)g(or)h(`)p Fn(\045)p Fo('.)24
+b(W)l(ords)17 b(are)g(n)o(um)o(b)q(ered)g(from)g(the)g(b)q(eginning)i
+(of)e(the)g(line,)75 443 y(with)j(the)g(\014rst)f(w)o(ord)h(b)q(eing)h
+(denoted)f(b)o(y)g(0)f(\(zero\).)33 b(W)l(ords)20 b(are)f(inserted)i
+(in)o(to)f(the)g(curren)o(t)f(line)75 498 y(separated)c(b)o(y)g(single)
+i(spaces.)75 575 y Fn(0)e(\(zero\))57 b Fo(The)15 b Fn(0)p
+Fo(th)g(w)o(ord.)20 b(F)l(or)14 b(man)o(y)h(applications,)h(this)g(is)g
+(the)f(command)g(w)o(ord.)75 653 y Fj(n)215 b Fo(The)15
+b Fj(n)p Fo(th)h(w)o(ord.)75 731 y Fn(^)216 b Fo(The)15
+b(\014rst)g(argumen)o(t;)f(that)h(is,)g(w)o(ord)g(1.)75
+808 y Fn($)216 b Fo(The)15 b(last)h(argumen)o(t.)75 886
+y Fn(\045)216 b Fo(The)15 b(w)o(ord)g(matc)o(hed)g(b)o(y)g(the)g(most)g
+(recen)o(t)g(`)p Fn(?)p Fj(string)t Fn(?)p Fo(')f(searc)o(h.)75
+964 y Fj(x)p Fn(-)p Fj(y)168 b Fo(A)15 b(range)g(of)g(w)o(ords;)f(`)p
+Fn(-)p Fj(y)t Fo(')g(abbreviates)i(`)p Fn(0-)p Fj(y)t
+Fo('.)75 1042 y Fn(*)216 b Fo(All)15 b(of)f(the)f(w)o(ords,)g(except)i
+(the)f Fn(0)p Fo(th.)19 b(This)14 b(is)h(a)e(synon)o(ym)h(for)f(`)p
+Fn(1-$)p Fo('.)18 b(It)c(is)g(not)g(an)g(error)315 1096
+y(to)g(use)h(`)p Fn(*)p Fo(')f(if)i(there)e(is)i(just)e(one)h(w)o(ord)f
+(in)i(the)f(ev)o(en)o(t;)f(the)h(empt)o(y)g(string)g(is)g(returned)g
+(in)315 1151 y(that)f(case.)75 1229 y Fj(x)s Fn(*)189
+b Fo(Abbreviates)16 b(`)p Fj(x)p Fn(-$)p Fo(')75 1307
+y Fj(x)p Fn(-)192 b Fo(Abbreviates)16 b(`)p Fj(x)p Fn(-$)p
+Fo(')e(lik)o(e)i(`)p Fj(x)s Fn(*)p Fo(',)e(but)i(omits)f(the)g(last)g
+(w)o(ord.)137 1384 y(If)i(a)g(w)o(ord)f(designator)h(is)h(supplied)h
+(without)e(an)g(ev)o(en)o(t)f(sp)q(eci\014cation,)j(the)e(previous)h
+(command)75 1439 y(is)e(used)f(as)g(the)h(ev)o(en)o(t.)75
+1548 y Fi(1.1.3)30 b(Mo)r(di\014ers)137 1643 y Fo(After)10
+b(the)h(optional)g(w)o(ord)e(designator,)i(y)o(ou)f(can)h(add)f(a)g
+(sequence)i(of)e(one)g(or)g(more)g(of)g(the)g(follo)o(wing)75
+1698 y(mo)q(di\014ers,)16 b(eac)o(h)f(preceded)i(b)o(y)e(a)g(`)p
+Fn(:)p Fo('.)75 1776 y Fn(h)216 b Fo(Remo)o(v)o(e)15
+b(a)g(trailing)h(pathname)f(comp)q(onen)o(t,)g(lea)o(ving)h(only)g(the)
+f(head.)75 1854 y Fn(t)216 b Fo(Remo)o(v)o(e)15 b(all)h(leading)h
+(pathname)e(comp)q(onen)o(ts,)g(lea)o(ving)h(the)f(tail.)75
+1931 y Fn(r)216 b Fo(Remo)o(v)o(e)15 b(a)g(trailing)h(su\016x)f(of)g
+(the)g(form)g(`)p Fn(.)p Fj(su\016x)s Fo(',)f(lea)o(ving)i(the)f
+(basename.)75 2009 y Fn(e)216 b Fo(Remo)o(v)o(e)15 b(all)h(but)g(the)f
+(trailing)h(su\016x.)75 2087 y Fn(p)216 b Fo(Prin)o(t)15
+b(the)g(new)h(command)f(but)g(do)g(not)g(execute)h(it.)75
+2164 y Fn(s/)p Fj(old)r Fn(/)p Fj(new)t Fn(/)315 2219
+y Fo(Substitute)h Fj(new)j Fo(for)c(the)h(\014rst)e(o)q(ccurrence)j(of)
+e Fj(old)i Fo(in)f(the)g(ev)o(en)o(t)f(line.)25 b(An)o(y)16
+b(delimiter)315 2274 y(ma)o(y)c(b)q(e)h(used)g(in)g(place)g(of)f(`)p
+Fn(/)p Fo('.)18 b(The)13 b(delimiter)h(ma)o(y)e(b)q(e)h(quoted)f(in)i
+Fj(old)g Fo(and)f Fj(new)k Fo(with)12 b(a)315 2329 y(single)j(bac)o
+(kslash.)20 b(If)15 b(`)p Fn(&)p Fo(')e(app)q(ears)h(in)h
+Fj(new)p Fo(,)f(it)g(is)h(replaced)g(b)o(y)f Fj(old)p
+Fo(.)20 b(A)14 b(single)i(bac)o(kslash)315 2383 y(will)j(quote)e(the)h
+(`)p Fn(&)p Fo('.)25 b(The)17 b(\014nal)i(delimiter)g(is)f(optional)g
+(if)f(it)h(is)g(the)f(last)g(c)o(haracter)g(on)315 2438
+y(the)e(input)h(line.)75 2516 y Fn(&)216 b Fo(Rep)q(eat)16
+b(the)f(previous)h(substitution.)75 2594 y Fn(g)216 b
+Fo(Cause)19 b(c)o(hanges)h(to)e(b)q(e)i(applied)h(o)o(v)o(er)e(the)g
+(en)o(tire)h(ev)o(en)o(t)f(line.)34 b(Used)20 b(in)g(conjunction)315
+2648 y(with)c(`)p Fn(s)p Fo(',)d(as)i(in)h Fn(gs/)p Fj(old)r
+Fn(/)p Fj(new)t Fn(/)p Fo(,)f(or)g(with)g(`)p Fn(&)p
+Fo('.)p eop
+%%Page: 3 5
+3 4 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g
+(History)889 b(3)75 183 y Fk(2)41 b(Programming)28 b(with)e(GNU)i
+(History)137 323 y Fo(This)16 b(c)o(hapter)e(describ)q(es)j(ho)o(w)d
+(to)g(in)o(terface)h(programs)e(that)h(y)o(ou)h(write)g(with)g(the)g
+(GNU)f(History)75 378 y(Library)l(.)24 b(It)17 b(should)g(b)q(e)g
+(considered)h(a)e(tec)o(hnical)i(guide.)25 b(F)l(or)15
+b(information)i(on)f(the)h(in)o(teractiv)o(e)g(use)75
+433 y(of)e(GNU)g(History)l(,)g(see)g(Chapter)g(1)g([Using)g(History)g
+(In)o(teractiv)o(ely],)h(page)f(1.)75 581 y Fm(2.1)33
+b(In)n(tro)r(duction)24 b(to)e(History)137 685 y Fo(Man)o(y)c(programs)
+g(read)h(input)g(from)f(the)h(user)g(a)f(line)j(at)d(a)g(time.)31
+b(The)19 b(GNU)g(History)f(library)75 740 y(is)k(able)g(to)e(k)o(eep)i
+(trac)o(k)e(of)h(those)g(lines,)j(asso)q(ciate)d(arbitrary)g(data)f
+(with)i(eac)o(h)f(line,)j(and)e(utilize)75 795 y(information)15
+b(from)g(previous)h(lines)h(in)f(comp)q(osing)f(new)h(ones.)137
+870 y(The)e(programmer)f(using)h(the)g(History)g(library)g(has)g(a)o(v)
+m(ailable)h(functions)g(for)e(remem)o(b)q(ering)h(lines)75
+924 y(on)c(a)g(history)h(list,)g(asso)q(ciating)g(arbitrary)f(data)f
+(with)i(a)f(line,)j(remo)o(ving)d(lines)i(from)d(the)i(list,)h(searc)o
+(hing)75 979 y(through)17 b(the)h(list)g(for)f(a)h(line)h(con)o
+(taining)f(an)g(arbitrary)f(text)g(string,)h(and)g(referencing)h(an)o
+(y)e(line)i(in)75 1034 y(the)c(list)i(directly)l(.)22
+b(In)16 b(addition,)g(a)f(history)g Fj(expansion)h Fo(function)h(is)e
+(a)o(v)m(ailable)i(whic)o(h)g(pro)o(vides)f(for)e(a)75
+1089 y(consisten)o(t)h(user)h(in)o(terface)f(across)g(di\013eren)o(t)g
+(programs.)137 1164 y(The)f(user)h(using)f(programs)f(written)h(with)g
+(the)g(History)g(library)h(has)f(the)g(b)q(ene\014t)h(of)e(a)h
+(consisten)o(t)75 1219 y(user)20 b(in)o(terface)f(with)h(a)f(set)h(of)f
+(w)o(ell-kno)o(wn)h(commands)g(for)e(manipulating)k(the)d(text)g(of)g
+(previous)75 1273 y(lines)c(and)f(using)h(that)e(text)g(in)i(new)f
+(commands.)19 b(The)14 b(basic)h(history)e(manipulation)j(commands)d
+(are)75 1328 y(similar)j(to)f(the)g(history)g(substitution)h(pro)o
+(vided)g(b)o(y)g Fn(csh)p Fo(.)137 1403 y(If)f(the)g(programmer)f
+(desires,)h(he)g(can)g(use)g(the)g(Readline)i(library)l(,)f(whic)o(h)f
+(includes)j(some)c(history)75 1458 y(manipulation)j(b)o(y)e(default,)g
+(and)h(has)f(the)g(added)h(adv)m(an)o(tage)f(of)f(command)h(line)i
+(editing.)75 1606 y Fm(2.2)33 b(History)22 b(Storage)137
+1710 y Fo(The)16 b(history)f(list)h(is)g(an)f(arra)o(y)f(of)g(history)i
+(en)o(tries.)k(A)15 b(history)g(en)o(try)g(is)h(declared)g(as)f(follo)o
+(ws:)195 1782 y Fn(typedef)23 b(struct)g(_hist_entry)f({)243
+1834 y(char)h(*line;)243 1886 y(char)g(*data;)195 1938
+y(})h(HIST_ENTRY;)137 2013 y Fo(The)16 b(history)f(list)h(itself)g
+(migh)o(t)f(therefore)g(b)q(e)h(declared)g(as)195 2085
+y Fn(HIST_ENTRY)22 b(**the_history_list;)137 2160 y Fo(The)16
+b(state)e(of)h(the)g(History)g(library)h(is)g(encapsulated)g(in)o(to)f
+(a)g(single)i(structure:)195 2232 y Fn(/*)24 b(A)f(structure)g(used)g
+(to)h(pass)f(the)h(current)f(state)g(of)g(the)h(history)f(stuff)g
+(around.)g(*/)p 2033 2242 21 42 v 195 2284 a(typedef)g(struct)g
+(_hist_state)f({)243 2336 y(HIST_ENTRY)g(**entries;)214
+b(/*)23 b(Pointer)g(to)h(the)f(entries)g(themselves.)f(*/)243
+2387 y(int)h(offset;)453 b(/*)23 b(The)h(location)e(pointer)h(within)g
+(this)h(array.)f(*/)p 2033 2398 V 243 2439 a(int)g(length;)453
+b(/*)23 b(Number)g(of)h(elements)f(within)g(this)g(array.)g(*/)p
+1985 2449 V 243 2491 a(int)g(size;)501 b(/*)23 b(Number)g(of)h(slots)f
+(allocated)g(to)g(this)h(array.)f(*/)p 2057 2501 V 243
+2543 a(int)g(flags;)195 2595 y(})h(HISTORY_STATE;)137
+2670 y Fo(If)16 b(the)f(\015ags)g(mem)o(b)q(er)g(includes)j
+Fn(HS_STIFLED)p Fo(,)13 b(the)i(history)h(has)f(b)q(een)h(sti\015ed.)p
+eop
+%%Page: 4 6
+4 5 bop 75 -58 a Fo(4)1347 b(GNU)15 b(History)g(Library)75
+183 y Fm(2.3)33 b(History)22 b(F)-6 b(unctions)137 278
+y Fo(This)21 b(section)g(describ)q(es)h(the)f(calling)h(sequence)g(for)
+e(the)g(v)m(arious)h(functions)g(presen)o(t)g(in)g(GNU)75
+333 y(History)l(.)75 441 y Fi(2.3.1)30 b(Initializing)20
+b(History)h(and)f(State)g(Managemen)n(t)137 536 y Fo(This)e(section)g
+(describ)q(es)h(functions)f(used)g(to)e(initialize)21
+b(and)c(manage)g(the)g(state)g(of)g(the)g(History)75
+591 y(library)f(when)g(y)o(ou)f(w)o(an)o(t)f(to)g(use)i(the)f(history)g
+(functions)h(in)g(y)o(our)f(program.)1650 679 y(F)l(unction)-1749
+b Fh(void)20 b Fg(using)p 333 679 18 3 v 20 w(history)j
+Ff(\(\))195 734 y Fo(Begin)18 b(a)f(session)h(in)g(whic)o(h)g(the)g
+(history)f(functions)h(migh)o(t)f(b)q(e)h(used.)27 b(This)18
+b(initializes)195 788 y(the)d(in)o(teractiv)o(e)h(v)m(ariables.)1650
+877 y(F)l(unction)-1749 b Fh(HISTORY_STATE)21 b(*)e Fg(history)p
+657 877 V 21 w(get)p 755 877 V 21 w(history)p 951 877
+V 21 w(state)j Ff(\(\))195 931 y Fo(Return)16 b(a)f(structure)g
+(describing)i(the)e(curren)o(t)g(state)f(of)h(the)g(input)i(history)l
+(.)1650 1019 y(F)l(unction)-1749 b Fh(void)20 b Fg(history)p
+377 1019 V 20 w(set)p 468 1019 V 21 w(history)p 664 1019
+V 21 w(state)j Ff(\()p Fn(HISTORY_STATE)13 b(*state)p
+Ff(\))195 1074 y Fo(Set)i(the)h(state)e(of)h(the)g(history)g(list)h
+(according)g(to)e Fj(state)p Fo(.)75 1182 y Fi(2.3.2)30
+b(History)20 b(List)h(Managemen)n(t)137 1277 y Fo(These)11
+b(functions)h(manage)e(individual)k(en)o(tries)d(on)g(the)g(history)f
+(list,)i(or)f(set)f(parameters)g(managing)75 1332 y(the)15
+b(list)h(itself.)1650 1420 y(F)l(unction)-1749 b Fh(void)20
+b Fg(add)p 294 1420 V 20 w(history)j Ff(\()p Fn(char)14
+b(*string)p Ff(\))195 1475 y Fo(Place)i Fj(string)j Fo(at)c(the)g(end)i
+(of)d(the)i(history)f(list.)22 b(The)15 b(asso)q(ciated)h(data)f
+(\014eld)h(\(if)g(an)o(y\))e(is)195 1530 y(set)h(to)g
+Fn(NULL)p Fo(.)1650 1618 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21
+b(*)e Fg(remo)n(v)n(e)p 584 1618 V 20 w(history)k Ff(\()p
+Fn(int)14 b(which)p Ff(\))195 1673 y Fo(Remo)o(v)o(e)g(history)g(en)o
+(try)f(at)h(o\013set)f Fj(whic)o(h)h Fo(from)g(the)g(history)l(.)19
+b(The)14 b(remo)o(v)o(ed)g(elemen)o(t)g(is)195 1727 y(returned)i(so)e
+(y)o(ou)h(can)h(free)f(the)g(line,)i(data,)d(and)h(con)o(taining)h
+(structure.)1650 1816 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21
+b(*)e Fg(replace)p 580 1816 V 22 w(history)p 777 1816
+V 20 w(en)n(try)24 b Ff(\()p Fn(int)14 b(which,)g(char)283
+1870 y(*line,)g(char)g(*data)p Ff(\))195 1925 y Fo(Mak)o(e)f(the)h
+(history)f(en)o(try)g(at)g(o\013set)g Fj(whic)o(h)h Fo(ha)o(v)o(e)g
+Fj(line)k Fo(and)13 b Fj(data)p Fo(.)19 b(This)14 b(returns)g(the)f
+(old)195 1980 y(en)o(try)k(so)g(y)o(ou)g(can)g(disp)q(ose)i(of)d(the)i
+(data.)25 b(In)18 b(the)f(case)h(of)f(an)g(in)o(v)m(alid)i
+Fj(whic)o(h)p Fo(,)g(a)e Fn(NULL)195 2035 y Fo(p)q(oin)o(ter)f(is)f
+(returned.)1650 2123 y(F)l(unction)-1749 b Fh(void)20
+b Fg(clear)p 320 2123 V 21 w(history)j Ff(\(\))195 2178
+y Fo(Clear)15 b(the)h(history)f(list)h(b)o(y)f(deleting)i(all)f(the)f
+(en)o(tries.)1650 2266 y(F)l(unction)-1749 b Fh(void)20
+b Fg(sti\015e)p 320 2266 V 21 w(history)j Ff(\()p Fn(int)14
+b(max)p Ff(\))195 2321 y Fo(Sti\015e)i(the)f(history)h(list,)f(remem)o
+(b)q(ering)h(only)g(the)f(last)g Fj(max)j Fo(en)o(tries.)1650
+2409 y(F)l(unction)-1749 b Fh(int)20 b Fg(unsti\015e)p
+358 2409 V 21 w(history)i Ff(\(\))195 2463 y Fo(Stop)e(sti\015ing)i
+(the)f(history)l(.)36 b(This)21 b(returns)g(the)f(previous)i(amoun)o(t)
+e(the)g(history)h(w)o(as)195 2518 y(sti\015ed.)g(The)15
+b(v)m(alue)i(is)e(p)q(ositiv)o(e)i(if)e(the)g(history)h(w)o(as)e
+(sti\015ed,)i(negativ)o(e)f(if)h(it)f(w)o(asn't.)1650
+2606 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p 351
+2606 V 20 w(is)p 409 2606 V 21 w(sti\015ed)k Ff(\(\))195
+2661 y Fo(Returns)16 b(non-zero)f(if)h(the)f(history)g(is)h(sti\015ed,)
+g(zero)f(if)g(it)h(is)g(not.)p eop
+%%Page: 5 7
+5 6 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g
+(History)889 b(5)75 183 y Fi(2.3.3)30 b(Information)19
+b(Ab)r(out)i(the)f(History)h(List)137 279 y Fo(These)13
+b(functions)h(return)f(information)g(ab)q(out)f(the)h(en)o(tire)h
+(history)e(list)i(or)e(individual)k(list)e(en)o(tries.)1650
+371 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 b(**)e Fg(history)p
+605 371 18 3 v 21 w(list)24 b Ff(\(\))195 426 y Fo(Return)f(a)g
+Fn(NULL)f Fo(terminated)g(arra)o(y)g(of)g Fn(HIST_ENTRY)f
+Fo(whic)o(h)j(is)f(the)f(curren)o(t)h(input)195 481 y(history)l(.)j
+(Elemen)o(t)18 b(0)e(of)h(this)h(list)g(is)f(the)h(b)q(eginning)h(of)e
+(time.)26 b(If)17 b(there)g(is)h(no)f(history)l(,)195
+535 y(return)e Fn(NULL)p Fo(.)1650 627 y(F)l(unction)-1749
+b Fh(int)20 b Fg(where)p 325 627 V 20 w(history)j Ff(\(\))195
+682 y Fo(Returns)16 b(the)f(o\013set)f(of)h(the)g(curren)o(t)g(history)
+g(elemen)o(t.)1650 773 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21
+b(*)e Fg(curren)n(t)p 587 773 V 21 w(history)k Ff(\(\))195
+828 y Fo(Return)g(the)f(history)g(en)o(try)g(at)f(the)h(curren)o(t)g(p)
+q(osition,)j(as)c(determined)j(b)o(y)e Fn(where_)195
+883 y(history)14 b(\(\))p Fo(.)20 b(If)15 b(there)g(is)h(no)f(en)o(try)
+g(there,)g(return)g(a)g Fn(NULL)g Fo(p)q(oin)o(ter.)1650
+975 y(F)l(unction)-1749 b Fh(HIST_ENTRY)21 b(*)e Fg(history)p
+579 975 V 21 w(get)j Ff(\()p Fn(int)15 b(offset)p Ff(\))195
+1029 y Fo(Return)21 b(the)g(history)g(en)o(try)f(at)g(p)q(osition)i
+Fj(o\013set)p Fo(,)e(starting)g(from)g Fn(history_base)p
+Fo(.)35 b(If)195 1084 y(there)16 b(is)h(no)g(en)o(try)f(there,)g(or)g
+(if)g Fj(o\013set)h Fo(is)g(greater)e(than)h(the)h(history)f(length,)h
+(return)f(a)195 1139 y Fn(NULL)f Fo(p)q(oin)o(ter.)1650
+1231 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p 351
+1231 V 20 w(total)p 487 1231 V 22 w(b)n(ytes)j Ff(\(\))195
+1285 y Fo(Return)c(the)f(n)o(um)o(b)q(er)g(of)g(b)o(ytes)g(that)f(the)h
+(primary)h(history)f(en)o(tries)g(are)g(using.)29 b(This)195
+1340 y(function)16 b(returns)f(the)g(sum)h(of)e(the)i(lengths)f(of)g
+(all)h(the)g(lines)g(in)g(the)g(history)l(.)75 1452 y
+Fi(2.3.4)30 b(Mo)n(ving)21 b(Around)f(the)h(History)g(List)137
+1548 y Fo(These)16 b(functions)g(allo)o(w)f(the)g(curren)o(t)h(index)g
+(in)o(to)f(the)h(history)f(list)h(to)e(b)q(e)i(set)f(or)g(c)o(hanged.)
+1650 1640 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p
+351 1640 V 20 w(set)p 442 1640 V 21 w(p)r(os)h Ff(\()p
+Fn(int)15 b(pos)p Ff(\))195 1694 y Fo(Set)g(the)h(p)q(osition)g(in)g
+(the)f(history)g(list)h(to)f Fj(p)q(os)p Fo(,)g(an)g(absolute)g(index)i
+(in)o(to)e(the)g(list.)1650 1786 y(F)l(unction)-1749
+b Fh(HIST_ENTRY)21 b(*)e Fg(previous)p 615 1786 V 20
+w(history)k Ff(\(\))195 1841 y Fo(Bac)o(k)17 b(up)h(the)f(curren)o(t)g
+(history)g(o\013set)f(to)h(the)g(previous)h(history)f(en)o(try)l(,)g
+(and)g(return)g(a)195 1896 y(p)q(oin)o(ter)f(to)e(that)h(en)o(try)l(.)k
+(If)d(there)f(is)h(no)f(previous)h(en)o(try)l(,)f(return)g(a)g
+Fn(NULL)f Fo(p)q(oin)o(ter.)1650 1987 y(F)l(unction)-1749
+b Fh(HIST_ENTRY)21 b(*)e Fg(next)p 514 1987 V 21 w(history)k
+Ff(\(\))195 2042 y Fo(Mo)o(v)o(e)17 b(the)h(curren)o(t)g(history)f
+(o\013set)g(forw)o(ard)g(to)g(the)h(next)g(history)g(en)o(try)l(,)g
+(and)g(return)195 2097 y(the)d(a)g(p)q(oin)o(ter)h(to)e(that)h(en)o
+(try)l(.)20 b(If)15 b(there)g(is)h(no)f(next)g(en)o(try)l(,)g(return)g
+(a)g Fn(NULL)g Fo(p)q(oin)o(ter.)75 2208 y Fi(2.3.5)30
+b(Searc)n(hing)21 b(the)f(History)h(List)137 2304 y Fo(These)14
+b(functions)g(allo)o(w)g(searc)o(hing)g(of)e(the)i(history)f(list)h
+(for)f(en)o(tries)h(con)o(taining)g(a)f(sp)q(eci\014c)i(string.)75
+2359 y(Searc)o(hing)f(ma)o(y)g(b)q(e)g(p)q(erformed)g(b)q(oth)g(forw)o
+(ard)e(and)i(bac)o(kw)o(ard)f(from)g(the)h(curren)o(t)g(history)f(p)q
+(osition.)75 2414 y(The)j(searc)o(h)f(ma)o(y)g(b)q(e)i
+Fj(anc)o(hored)p Fo(,)e(meaning)h(that)f(the)h(string)g(m)o(ust)f(matc)
+o(h)g(at)g(the)h(b)q(eginning)i(of)d(the)75 2469 y(history)g(en)o(try)l
+(.)1650 2560 y(F)l(unction)-1749 b Fh(int)20 b Fg(history)p
+351 2560 V 20 w(searc)n(h)j Ff(\()p Fn(char)14 b(*string,)g(int)h
+(direction)p Ff(\))195 2615 y Fo(Searc)o(h)g(the)h(history)f(for)f
+Fj(string)p Fo(,)h(starting)f(at)h(the)g(curren)o(t)g(history)g
+(o\013set.)k(If)d Fj(direction)195 2670 y Fn(<)j Fo(0,)g(then)g(the)h
+(searc)o(h)e(is)i(through)e(previous)i(en)o(tries,)g(else)g(through)f
+(subsequen)o(t.)32 b(If)p eop
+%%Page: 6 8
+6 7 bop 75 -58 a Fo(6)1347 b(GNU)15 b(History)g(Library)195
+183 y Fj(string)k Fo(is)d(found,)f(then)h(the)f(curren)o(t)g(history)g
+(index)i(is)f(set)f(to)f(that)h(history)g(en)o(try)l(,)g(and)195
+238 y(the)g(v)m(alue)h(returned)f(is)g(the)g(o\013set)f(in)h(the)g
+(line)h(of)e(the)h(en)o(try)g(where)g Fj(string)j Fo(w)o(as)c(found.)
+195 293 y(Otherwise,)i(nothing)f(is)h(c)o(hanged,)f(and)h(a)e(-1)h(is)h
+(returned.)1650 396 y(F)l(unction)-1749 b Fh(int)20 b
+Fg(history)p 351 396 18 3 v 20 w(searc)n(h)p 527 396
+V 21 w(pre\014x)i Ff(\()p Fn(char)15 b(*string,)f(int)g(direction)p
+Ff(\))195 451 y Fo(Searc)o(h)i(the)f(history)g(for)g
+Fj(string)p Fo(,)g(starting)g(at)g(the)g(curren)o(t)h(history)f
+(o\013set.)k(The)d(searc)o(h)195 506 y(is)h(anc)o(hored:)23
+b(matc)o(hing)17 b(lines)h(m)o(ust)e(b)q(egin)i(with)f
+Fj(string)p Fo(.)25 b(If)17 b Fj(direction)h Fn(<)e Fo(0,)h(then)g(the)
+195 560 y(searc)o(h)f(is)g(through)f(previous)i(en)o(tries,)f(else)g
+(through)g(subsequen)o(t.)22 b(If)16 b Fj(string)k Fo(is)c(found,)195
+615 y(then)i(the)g(curren)o(t)g(history)g(index)h(is)g(set)e(to)h(that)
+f(en)o(try)l(,)h(and)g(the)g(return)g(v)m(alue)h(is)g(0.)195
+670 y(Otherwise,)d(nothing)f(is)h(c)o(hanged,)f(and)h(a)e(-1)h(is)h
+(returned.)1650 773 y(F)l(unction)-1749 b Fh(int)20 b
+Fg(history)p 351 773 V 20 w(searc)n(h)p 527 773 V 21
+w(p)r(os)h Ff(\()p Fn(char)15 b(*string,)f(int)g(direction,)g(int)283
+828 y(pos)p Ff(\))195 883 y Fo(Searc)o(h)h(for)g Fj(string)k
+Fo(in)d(the)f(history)g(list,)g(starting)g(at)f Fj(p)q(os)p
+Fo(,)h(an)g(absolute)g(index)i(in)o(to)e(the)195 937
+y(list.)21 b(If)15 b Fj(direction)h Fo(is)g(negativ)o(e,)f(the)g(searc)
+o(h)g(pro)q(ceeds)g(bac)o(kw)o(ard)g(from)f Fj(p)q(os)p
+Fo(,)h(otherwise)195 992 y(forw)o(ard.)27 b(Returns)18
+b(the)g(absolute)g(index)h(of)f(the)g(history)f(elemen)o(t)i(where)f
+Fj(string)k Fo(w)o(as)195 1047 y(found,)15 b(or)g(-1)g(otherwise.)75
+1170 y Fi(2.3.6)30 b(Managing)20 b(the)g(History)h(File)137
+1272 y Fo(The)16 b(History)g(library)h(can)e(read)h(the)g(history)g
+(from)f(and)h(write)g(it)g(to)f(a)h(\014le.)22 b(This)17
+b(section)f(do)q(cu-)75 1327 y(men)o(ts)f(the)g(functions)h(for)f
+(managing)g(a)g(history)g(\014le.)1650 1430 y(F)l(unction)-1749
+b Fh(int)20 b Fg(read)p 286 1430 V 20 w(history)i Ff(\()p
+Fn(char)15 b(*filename)p Ff(\))195 1485 y Fo(Add)h(the)f(con)o(ten)o
+(ts)f(of)h Fj(\014lename)j Fo(to)d(the)g(history)g(list,)g(a)g(line)h
+(at)f(a)f(time.)21 b(If)15 b Fj(\014lename)j Fo(is)195
+1539 y Fn(NULL)p Fo(,)c(then)i(read)f(from)f(`)p Fn(~/.history)p
+Fo('.)k(Returns)e(0)f(if)g(successful,)i(or)d(errno)h(if)h(not.)1650
+1643 y(F)l(unction)-1749 b Fh(int)20 b Fg(read)p 286
+1643 V 20 w(history)p 481 1643 V 20 w(range)i Ff(\()p
+Fn(char)15 b(*filename,)e(int)i(from,)g(int)f(to)p Ff(\))195
+1697 y Fo(Read)21 b(a)f(range)g(of)g(lines)i(from)e Fj(\014lename)p
+Fo(,)i(adding)f(them)g(to)f(the)g(history)h(list.)36
+b(Start)195 1752 y(reading)15 b(at)e(line)j Fj(from)e
+Fo(and)g(end)h(at)e Fj(to)p Fo(.)19 b(If)c Fj(from)e
+Fo(is)i(zero,)f(start)f(at)g(the)h(b)q(eginning.)22 b(If)15
+b Fj(to)195 1807 y Fo(is)i(less)g(than)f Fj(from)p Fo(,)g(then)h(read)f
+(un)o(til)i(the)e(end)h(of)f(the)h(\014le.)24 b(If)17
+b Fj(\014lename)j Fo(is)d Fn(NULL)p Fo(,)f(then)195 1862
+y(read)f(from)g(`)p Fn(~/.history)p Fo('.)i(Returns)f(0)f(if)h
+(successful,)g(or)e Fn(errno)h Fo(if)h(not.)1650 1965
+y(F)l(unction)-1749 b Fh(int)20 b Fg(write)p 304 1965
+V 22 w(history)i Ff(\()p Fn(char)15 b(*filename)p Ff(\))195
+2020 y Fo(W)l(rite)23 b(the)f(curren)o(t)g(history)h(to)f
+Fj(\014lename)p Fo(,)j(o)o(v)o(erwriting)d Fj(\014lename)k
+Fo(if)d(necessary)l(.)42 b(If)195 2074 y Fj(\014lename)20
+b Fo(is)d Fn(NULL)p Fo(,)f(then)g(write)h(the)f(history)h(list)g(to)f
+(`)p Fn(~/.history)p Fo('.)21 b(V)l(alues)d(returned)195
+2129 y(are)d(as)g(in)h Fn(read_history)d(\(\))p Fo(.)1650
+2232 y(F)l(unction)-1749 b Fh(int)20 b Fg(app)r(end)p
+360 2232 V 19 w(history)j Ff(\()p Fn(int)14 b(nelements,)g(char)h
+(*filename)p Ff(\))195 2287 y Fo(App)q(end)i(the)e(last)g
+Fj(nelemen)o(ts)j Fo(of)d(the)g(history)g(list)h(to)f
+Fj(\014lename)p Fo(.)1650 2390 y(F)l(unction)-1749 b
+Fh(int)20 b Fg(history)p 351 2390 V 20 w(truncate)p 582
+2390 V 21 w(\014le)k Ff(\()p Fn(char)14 b(*filename,)g(int)h(nlines)p
+Ff(\))195 2445 y Fo(T)l(runcate)g(the)h(history)f(\014le)h
+Fj(\014lename)p Fo(,)g(lea)o(ving)g(only)g(the)f(last)g
+Fj(nlines)k Fo(lines.)75 2568 y Fi(2.3.7)30 b(History)20
+b(Expansion)137 2670 y Fo(These)c(functions)g(implemen)o(t)g
+Fn(csh)p Fo(-lik)o(e)g(history)g(expansion.)p eop
+%%Page: 7 9
+7 8 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g
+(History)889 b(7)1650 183 y(F)l(unction)-1749 b Fh(int)20
+b Fg(history)p 351 183 18 3 v 20 w(expand)j Ff(\()p Fn(char)14
+b(*string,)g(char)h(**output)p Ff(\))195 238 y Fo(Expand)k
+Fj(string)p Fo(,)g(placing)h(the)e(result)h(in)o(to)g
+Fj(output)p Fo(,)g(a)f(p)q(oin)o(ter)h(to)f(a)g(string)h(\(see)f(Sec-)
+195 293 y(tion)d(1.1)g([History)f(In)o(teraction],)h(page)g(1\).)k
+(Returns:)195 370 y Fn(0)216 b Fo(If)16 b(no)g(expansions)h(to)q(ok)e
+(place)i(\(or,)d(if)j(the)f(only)g(c)o(hange)g(in)h(the)e(text)h(w)o
+(as)435 425 y(the)f(de-slashifying)j(of)c(the)i(history)f(expansion)h
+(c)o(haracter\);)195 502 y Fn(1)216 b Fo(if)16 b(expansions)g(did)g
+(tak)o(e)e(place;)195 580 y Fn(-1)192 b Fo(if)16 b(there)f(w)o(as)f(an)
+h(error)g(in)h(expansion;)195 657 y Fn(2)216 b Fo(if)16
+b(the)g(returned)g(line)i(should)f(only)f(b)q(e)h(displa)o(y)o(ed,)f
+(but)g(not)g(executed,)g(as)435 712 y(with)g(the)f Fn(:p)g
+Fo(mo)q(di\014er)h(\(see)f(Section)h(1.1.3)e([Mo)q(di\014ers],)g(page)i
+(2\).)195 789 y(If)f(an)g(error)f(o)q(curred)i(in)g(expansion,)f(then)h
+Fj(output)f Fo(con)o(tains)g(a)g(descriptiv)o(e)i(error)d(mes-)195
+844 y(sage.)1650 932 y(F)l(unction)-1749 b Fh(char)20
+b(*)f Fg(history)p 422 932 V 21 w(arg)p 524 932 V 19
+w(extract)24 b Ff(\()p Fn(int)14 b(first,)h(int)g(last,)f(char)283
+987 y(*string)p Ff(\))195 1042 y Fo(Extract)g(a)g(string)g(segmen)o(t)g
+(consisting)i(of)e(the)g Fj(\014rst)i Fo(through)e Fj(last)h
+Fo(argumen)o(ts)f(presen)o(t)195 1097 y(in)i Fj(string)p
+Fo(.)k(Argumen)o(ts)15 b(are)f(brok)o(en)i(up)f(as)g(in)h(Bash.)1650
+1185 y(F)l(unction)-1749 b Fh(char)20 b(*)f Fg(get)p
+324 1185 V 21 w(history)p 520 1185 V 20 w(ev)n(en)n(t)25
+b Ff(\()p Fn(char)14 b(*string,)g(int)h(*cindex,)f(int)283
+1240 y(qchar)p Ff(\))195 1295 y Fo(Returns)h(the)g(text)f(of)g(the)h
+(history)g(ev)o(en)o(t)f(b)q(eginning)j(at)d Fj(string)k
+Fn(+)d Fj(*cindex)p Fo(.)20 b Fj(*cindex)f Fo(is)195
+1350 y(mo)q(di\014ed)e(to)e(p)q(oin)o(t)h(to)f(after)g(the)h(ev)o(en)o
+(t)f(sp)q(eci\014er.)23 b(A)o(t)16 b(function)g(en)o(try)l(,)f
+Fj(cindex)21 b Fo(p)q(oin)o(ts)195 1404 y(to)16 b(the)h(index)h(in)o
+(to)e Fj(string)21 b Fo(where)c(the)g(history)f(ev)o(en)o(t)h(sp)q
+(eci\014cation)h(b)q(egins.)26 b Fj(qc)o(har)19 b Fo(is)195
+1459 y(a)h(c)o(haracter)g(that)g(is)h(allo)o(w)o(ed)f(to)g(end)h(the)g
+(ev)o(en)o(t)f(sp)q(eci\014cation)i(in)g(addition)f(to)f(the)195
+1514 y(\\normal")15 b(terminating)g(c)o(haracters.)1650
+1602 y(F)l(unction)-1749 b Fh(char)20 b(**)f Fg(history)p
+448 1602 V 21 w(tok)n(enize)25 b Ff(\()p Fn(char)14 b(*string)p
+Ff(\))195 1657 y Fo(Return)j(an)g(arra)o(y)f(of)g(tok)o(ens)g(parsed)h
+(out)g(of)f Fj(string)p Fo(,)h(m)o(uc)o(h)g(as)f(the)h(shell)h(migh)o
+(t.)25 b(The)195 1712 y(tok)o(ens)d(are)g(split)i(on)f(white)g(space)g
+(and)f(on)h(the)g(c)o(haracters)f Fn(\(\)<>;&|$)p Fo(,)h(and)f(shell)
+195 1767 y(quoting)15 b(con)o(v)o(en)o(tions)h(are)e(ob)q(ey)o(ed.)75
+1892 y Fm(2.4)33 b(History)22 b(V)-6 b(ariables)137 1987
+y Fo(This)23 b(section)f(describ)q(es)h(the)f(externally)h(visible)h(v)
+m(ariables)f(exp)q(orted)f(b)o(y)g(the)g(GNU)f(History)75
+2042 y(Library)l(.)1661 2130 y(V)l(ariable)-1749 b Fh(int)20
+b Fg(history)p 351 2130 V 20 w(base)195 2185 y Fo(The)15
+b(logical)i(o\013set)d(of)h(the)g(\014rst)g(en)o(try)g(in)h(the)f
+(history)g(list.)1661 2274 y(V)l(ariable)-1749 b Fh(int)20
+b Fg(history)p 351 2274 V 20 w(length)195 2329 y Fo(The)15
+b(n)o(um)o(b)q(er)h(of)f(en)o(tries)g(curren)o(tly)h(stored)f(in)h(the)
+f(history)g(list.)1661 2417 y(V)l(ariable)-1749 b Fh(int)20
+b Fg(max)p 283 2417 V 19 w(input)p 435 2417 V 21 w(history)195
+2472 y Fo(The)14 b(maxim)o(um)f(n)o(um)o(b)q(er)h(of)e(history)i(en)o
+(tries.)19 b(This)14 b(m)o(ust)f(b)q(e)h(c)o(hanged)g(using)g
+Fn(stifle_)195 2527 y(history)g(\(\))p Fo(.)1661 2615
+y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377 2615
+V 20 w(expansion)p 644 2615 V 21 w(c)n(har)195 2670 y
+Fo(The)15 b(c)o(haracter)g(that)f(starts)g(a)h(history)g(ev)o(en)o(t.)
+20 b(The)15 b(default)h(is)g(`)p Fn(!)p Fo('.)p eop
+%%Page: 8 10
+8 9 bop 75 -58 a Fo(8)1347 b(GNU)15 b(History)g(Library)1661
+183 y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377
+183 18 3 v 20 w(subst)p 529 183 V 20 w(c)n(har)195 238
+y Fo(The)13 b(c)o(haracter)e(that)h(in)o(v)o(ok)o(es)g(w)o(ord)g
+(substitution)h(if)g(found)g(at)e(the)i(start)e(of)h(a)g(line.)21
+b(The)195 293 y(default)16 b(is)f(`)p Fn(^)p Fo('.)1661
+388 y(V)l(ariable)-1749 b Fh(char)20 b Fg(history)p 377
+388 V 20 w(commen)n(t)p 627 388 V 19 w(c)n(har)195 443
+y Fo(During)e(tok)o(enization,)h(if)f(this)h(c)o(haracter)e(is)i(seen)f
+(as)g(the)g(\014rst)g(c)o(haracter)f(of)g(a)h(w)o(ord,)195
+498 y(then)e(it)g(and)g(all)h(subsequen)o(t)g(c)o(haracters)e(up)h(to)g
+(a)f(newline)j(are)e(ignored,)g(suppressing)195 553 y(history)f
+(expansion)h(for)f(the)g(remainder)h(of)f(the)g(line.)22
+b(This)15 b(is)h(disabled)h(b)o(y)e(default.)1661 648
+y(V)l(ariable)-1749 b Fh(char)20 b(*)f Fg(history)p 422
+648 V 21 w(no)p 504 648 V 20 w(expand)p 704 648 V 20
+w(c)n(hars)195 703 y Fo(The)j(list)h(of)f(c)o(haracters)f(whic)o(h)i
+(inhibit)h(history)e(expansion)h(if)g(found)f(immediately)195
+758 y(follo)o(wing)16 b Fj(history)p 528 758 14 2 v 16
+w(expansion)p 739 758 V 18 w(c)o(har)p Fo(.)j(The)d(default)f(is)h
+(whitespace)g(and)g(`)p Fn(=)p Fo('.)1661 853 y(V)l(ariable)-1749
+b Fh(char)20 b(*)f Fg(history)p 422 853 18 3 v 21 w(searc)n(h)p
+599 853 V 20 w(delimiter)p 843 853 V 23 w(c)n(hars)195
+908 y Fo(The)f(list)h(of)e(additional)i(c)o(haracters)e(whic)o(h)i(can)
+f(delimit)h(a)f(history)g(searc)o(h)f(string,)h(in)195
+963 y(addition)c(to)d(whitespace,)j(`)p Fn(:)p Fo(')d(and)i(`)p
+Fn(?)p Fo(')f(in)h(the)f(case)h(of)f(a)g(substring)h(searc)o(h.)19
+b(The)12 b(default)195 1018 y(is)k(empt)o(y)l(.)1661
+1113 y(V)l(ariable)-1749 b Fh(int)20 b Fg(history)p 351
+1113 V 20 w(quotes)p 533 1113 V 21 w(inhibit)p 717 1113
+V 23 w(expansion)195 1168 y Fo(If)13 b(non-zero,)f(single-quoted)i(w)o
+(ords)e(are)g(not)g(scanned)h(for)f(the)g(history)h(expansion)g(c)o
+(har-)195 1223 y(acter.)19 b(The)d(default)g(v)m(alue)g(is)g(0.)1661
+1318 y(V)l(ariable)-1749 b Fh(Function)20 b(*)g Fg(history)p
+527 1318 V 20 w(inhibit)p 710 1318 V 23 w(expansion)p
+980 1318 V 21 w(function)195 1373 y Fo(This)12 b(should)g(b)q(e)g(set)f
+(to)f(the)i(address)f(of)g(a)g(function)h(that)e(tak)o(es)h(t)o(w)o(o)f
+(argumen)o(ts:)17 b(a)11 b Fn(char)195 1428 y(*)j Fo(\()p
+Fj(string)t Fo(\))f(and)i(an)f(in)o(teger)g(index)h(in)o(to)f(that)g
+(string)g(\()p Fj(i)r Fo(\).)20 b(It)14 b(should)h(return)f(a)g
+(non-zero)195 1482 y(v)m(alue)g(if)e(the)h(history)f(expansion)h
+(starting)f(at)g Fj(string[i])i Fo(should)f(not)f(b)q(e)h(p)q
+(erformed;)g(zero)195 1537 y(if)g(the)h(expansion)f(should)h(b)q(e)g
+(done.)20 b(It)13 b(is)g(in)o(tended)i(for)d(use)h(b)o(y)g
+(applications)i(lik)o(e)f(Bash)195 1592 y(that)j(use)h(the)g(history)f
+(expansion)i(c)o(haracter)e(for)g(additional)i(purp)q(oses.)28
+b(By)18 b(default,)195 1647 y(this)e(v)m(ariable)g(is)g(set)f(to)f
+(NULL.)75 1780 y Fm(2.5)33 b(History)22 b(Programming)h(Example)137
+1878 y Fo(The)16 b(follo)o(wing)g(program)e(demonstrates)g(simple)j
+(use)e(of)g(the)g(GNU)g(History)g(Library)l(.)195 1944
+y Fn(main)23 b(\(\))195 1995 y({)243 2047 y(char)g(line[1024],)f(*t;)
+243 2099 y(int)h(len,)g(done)h(=)g(0;)243 2203 y(line[0])f(=)g(0;)243
+2307 y(using_history)f(\(\);)243 2359 y(while)h(\(!done\))290
+2411 y({)338 2462 y(printf)g(\("history$)g("\);)338 2514
+y(fflush)g(\(stdout\);)338 2566 y(t)h(=)g(fgets)f(\(line,)g(sizeof)g
+(\(line\))g(-)h(1,)f(stdin\);)338 2618 y(if)h(\(t)f(&&)h(*t\))386
+2670 y({)p eop
+%%Page: 9 11
+9 10 bop 75 -58 a Fo(Chapter)15 b(2:)k(Programming)c(with)g(GNU)g
+(History)889 b(9)434 183 y Fn(len)23 b(=)h(strlen)f(\(t\);)434
+235 y(if)g(\(t[len)g(-)h(1])g(==)f('\\n'\))481 287 y(t[len)h(-)f(1])h
+(=)g('\\0';)386 339 y(})338 443 y(if)g(\(!t\))386 495
+y(strcpy)f(\(line,)g("quit"\);)338 598 y(if)h(\(line[0]\))386
+650 y({)434 702 y(char)f(*expansion;)434 754 y(int)g(result;)434
+858 y(result)g(=)g(history_expand)f(\(line,)h(&expansion\);)434
+910 y(if)g(\(result\))481 962 y(fprintf)g(\(stderr,)g("\045s\\n",)g
+(expansion\);)434 1065 y(if)g(\(result)g(<)h(0)g(||)f(result)g(==)h
+(2\))481 1117 y({)529 1169 y(free)f(\(expansion\);)529
+1221 y(continue;)481 1273 y(})434 1377 y(add_history)f(\(expansion\);)
+434 1429 y(strncpy)h(\(line,)g(expansion,)f(sizeof)h(\(line\))g(-)h
+(1\);)434 1480 y(free)f(\(expansion\);)386 1532 y(})338
+1636 y(if)h(\(strcmp)f(\(line,)g("quit"\))g(==)g(0\))386
+1688 y(done)g(=)h(1;)338 1740 y(else)f(if)h(\(strcmp)f(\(line,)g
+("save"\))g(==)h(0\))386 1792 y(write_history)e(\("history_file"\);)338
+1844 y(else)h(if)h(\(strcmp)f(\(line,)g("read"\))g(==)h(0\))386
+1896 y(read_history)e(\("history_file"\);)338 1947 y(else)h(if)h
+(\(strcmp)f(\(line,)g("list"\))g(==)h(0\))386 1999 y({)434
+2051 y(register)e(HIST_ENTRY)h(**the_list;)434 2103 y(register)f(int)i
+(i;)434 2207 y(the_list)e(=)i(history_list)e(\(\);)434
+2259 y(if)h(\(the_list\))481 2311 y(for)h(\(i)f(=)h(0;)g(the_list[i];)e
+(i++\))529 2363 y(printf)h(\("\045d:)g(\045s\\n",)g(i)h(+)g
+(history_base,)e(the_list[i]->line\);)386 2414 y(})338
+2466 y(else)h(if)h(\(strncmp)f(\(line,)g("delete",)g(6\))g(==)h(0\))386
+2518 y({)434 2570 y(int)f(which;)434 2622 y(if)g(\(\(sscanf)g(\(line)g
+(+)h(6,)f("\045d",)h(&which\)\))e(==)i(1\))p eop
+%%Page: 10 12
+10 11 bop 75 -58 a Fo(10)1324 b(GNU)15 b(History)g(Library)481
+183 y Fn({)529 235 y(HIST_ENTRY)23 b(*entry)g(=)g(remove_history)f
+(\(which\);)529 287 y(if)i(\(!entry\))577 339 y(fprintf)f(\(stderr,)f
+("No)i(such)f(entry)g(\045d\\n",)g(which\);)529 391 y(else)577
+443 y({)625 495 y(free)g(\(entry->line\);)625 546 y(free)g(\(entry\);)
+577 598 y(})481 650 y(})434 702 y(else)481 754 y({)529
+806 y(fprintf)g(\(stderr,)g("non-numeric)f(arg)h(given)h(to)f
+(`delete'\\n"\);)481 858 y(})386 910 y(})290 962 y(})195
+1013 y(})p eop
+%%Page: 11 13
+11 12 bop 75 -58 a Fo(App)q(endix)17 b(A:)e(Concept)g(Index)1196
+b(11)75 183 y Fk(App)r(endix)25 b(A)41 b(Concept)27 b(Index)75
+359 y Fm(A)75 417 y Fe(anc)o(hored)14 b(searc)o(h)s Fd(.)7
+b(.)f(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)16
+b Fe(5)75 517 y Fm(E)75 575 y Fe(ev)o(en)o(t)d(designators)c
+Fd(.)g(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)21
+b Fe(1)1012 359 y Fm(H)1012 417 y Fe(history)15 b(ev)o(en)o(ts)s
+Fd(.)7 b(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)
+g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g
+(.)16 b Fe(1)1012 467 y(history)f(expansion)6 b Fd(.)j(.)d(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)19 b Fe(1)1012 517 y(History)14
+b(Searc)o(hing)5 b Fd(.)j(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)18 b Fe(5)p eop
+%%Page: 12 14
+12 13 bop 75 -58 a Fo(12)1324 b(GNU)15 b(History)g(Library)p
+eop
+%%Page: 13 15
+13 14 bop 75 -58 a Fo(App)q(endix)17 b(B:)e(F)l(unction)h(and)g(V)l
+(ariable)g(Index)919 b(13)75 183 y Fk(App)r(endix)25
+b(B)41 b(F)-7 b(unction)26 b(and)h(V)-7 b(ariable)26
+b(Index)75 359 y Fm(A)75 417 y Fc(add)p 137 417 12 2
+v 13 w(history)6 b Fd(.)s(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)h(.)18 b Fe(4)75 467 y Fc(append)p
+197 467 V 12 w(history)8 b Fd(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)
+g(.)g(.)g(.)g(.)23 b Fe(6)75 567 y Fm(C)75 625 y Fc(clear)p
+177 625 V 12 w(history)s Fd(.)t(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)16 b Fe(4)75 675 y Fc(current)p
+217 675 V 11 w(history)7 b Fd(.)f(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)22 b Fe(5)75 774 y Fm(G)75 832 y Fc(get)p
+137 832 V 13 w(history)p 290 832 V 11 w(event)8 b Fd(.)e(.)g(.)g(.)g(.)
+g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
+(.)f(.)g(.)g(.)g(.)g(.)g(.)22 b Fe(7)75 932 y Fm(H)75
+990 y Fc(history)p 217 990 V 11 w(arg)p 288 990 V 13
+w(extract)7 b Fd(.)t(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)
+g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)20
+b Fe(7)75 1040 y Fc(history)p 217 1040 V 11 w(base)f
+Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)
+g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)19
+b Fe(7)75 1090 y Fc(history_co)o(mm)o(ent)o(_c)o(har)h
+Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)h(.)f(.)23 b Fe(8)75 1139 y Fc(history)p
+217 1139 V 11 w(expand)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)
+g(.)g(.)g(.)g(.)23 b Fe(7)75 1189 y Fc(history)p 217
+1189 V 11 w(expansion)p 408 1189 V 11 w(char)17 b Fd(.)6
+b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)18 b Fe(7)75 1239 y Fc(history)p 217
+1239 V 11 w(get)6 b Fd(.)f(.)h(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)h(.)18 b Fe(5)75 1289 y Fc(history)p
+217 1289 V 11 w(get)p 288 1289 V 13 w(history)p 441 1289
+V 12 w(state)9 b Fd(.)d(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)23 b Fe(4)75 1339 y Fc(history_in)o(hi)o
+(bit)o(_e)o(xpa)o(nsi)o(on)o(_fu)o(nc)o(tio)o(n)d Fd(.)6
+b(.)g(.)g(.)g(.)g(.)g(.)g(.)23 b Fe(8)75 1389 y Fc(history)p
+217 1389 V 11 w(is)p 268 1389 V 14 w(stifled)8 b Fd(.)s(.)f(.)f(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)21 b Fe(4)75 1438 y Fc(history)p
+217 1438 V 11 w(length)15 b Fd(.)6 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)17 b Fe(7)75 1488 y Fc(history)p 217
+1488 V 11 w(list)5 b Fd(.)g(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)
+f(.)g(.)g(.)g(.)g(.)17 b Fe(5)75 1538 y Fc(history_no)o(_e)o(xpa)o(nd)o
+(_ch)o(ars)f Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)20 b Fe(8)75 1588 y Fc(history_qu)o(ot)o
+(es_)o(in)o(hib)o(it_)o(ex)o(pan)o(si)o(on)14 b Fd(.)6
+b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)17 b Fe(8)75
+1638 y Fc(history)p 217 1638 V 11 w(search)9 b Fd(.)d(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)23 b Fe(5)75 1687
+y Fc(history_se)o(ar)o(ch_)o(de)o(lim)o(ite)o(r_)o(cha)o(rs)16
+b Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)19
+b Fe(8)75 1737 y Fc(history)p 217 1737 V 11 w(search)p
+348 1737 V 12 w(pos)8 b Fd(.)d(.)i(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)21
+b Fe(6)75 1787 y Fc(history)p 217 1787 V 11 w(search)p
+348 1787 V 12 w(prefix)5 b Fd(.)t(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)17
+b Fe(6)75 1837 y Fc(history)p 217 1837 V 11 w(set)p 288
+1837 V 13 w(history)p 441 1837 V 12 w(state)9 b Fd(.)d(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)23
+b Fe(4)75 1887 y Fc(history)p 217 1887 V 11 w(set)p 288
+1887 V 13 w(pos)t Fd(.)5 b(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)
+g(.)g(.)16 b Fe(5)1012 359 y Fc(history_sub)o(st)o(_ch)o(ar)e
+Fd(.)6 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)18 b Fe(8)1012
+409 y Fc(history)p 1154 409 V 12 w(tokenize)8 b Fd(.)s(.)e(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)h(.)f(.)g(.)g(.)g(.)21 b Fe(7)1012 459 y Fc(history)p
+1154 459 V 12 w(total)p 1266 459 V 12 w(bytes)7 b Fd(.)t(.)f(.)g(.)g(.)
+g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f
+(.)g(.)g(.)g(.)g(.)20 b Fe(5)1012 509 y Fc(history)p
+1154 509 V 12 w(truncate)p 1326 509 V 11 w(file)5 b Fd(.)t(.)h(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)18 b Fe(6)1012 612 y Fm(M)1012 670 y Fc(max)p
+1074 670 V 13 w(input)p 1187 670 V 13 w(history)13 b
+Fd(.)6 b(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)16 b
+Fe(7)1012 773 y Fm(N)1012 831 y Fc(next)p 1094 831 V
+13 w(history)5 b Fd(.)s(.)h(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)18 b Fe(5)1012 934 y Fm(P)1012 992 y
+Fc(previous)p 1174 992 V 11 w(history)8 b Fd(.)t(.)e(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)21 b Fe(5)1012 1096 y Fm(R)1012
+1154 y Fc(read)p 1094 1154 V 13 w(history)5 b Fd(.)s(.)h(.)g(.)g(.)g(.)
+g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)18 b Fe(6)1012
+1204 y Fc(read)p 1094 1204 V 13 w(history)p 1247 1204
+V 11 w(range)8 b Fd(.)d(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)21
+b Fe(6)1012 1253 y Fc(remove)p 1134 1253 V 12 w(history)8
+b Fd(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)24
+b Fe(4)1012 1303 y Fc(replace)p 1154 1303 V 12 w(history)p
+1306 1303 V 11 w(entry)5 b Fd(.)t(.)h(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)18
+b Fe(4)1012 1406 y Fm(S)1012 1464 y Fc(stifle)p 1134
+1464 V 12 w(history)8 b Fd(.)e(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)24 b Fe(4)1012 1568 y Fm(U)1012 1626 y Fc(unstifle)p
+1174 1626 V 11 w(history)8 b Fd(.)t(.)e(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h
+(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)
+g(.)g(.)21 b Fe(4)1012 1676 y Fc(using)p 1114 1676 V
+13 w(history)s Fd(.)s(.)6 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)17 b Fe(4)1012 1779 y Fm(W)1012 1837 y Fc(where)p
+1114 1837 V 13 w(history)s Fd(.)s(.)6 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)17 b Fe(5)1012 1887 y Fc(write)p
+1114 1887 V 13 w(history)s Fd(.)s(.)6 b(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g
+(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)g(.)
+g(.)g(.)g(.)g(.)g(.)g(.)17 b Fe(6)p eop
+%%Page: 14 16
+14 15 bop 75 -58 a Fo(14)1324 b(GNU)15 b(History)g(Library)p
+eop
+%%Page: -1 17
+-1 16 bop 1862 -58 a Fo(i)75 183 y Fk(T)-7 b(able)27
+b(of)f(Con)n(ten)n(ts)75 354 y Fm(1)67 b(Using)22 b(History)h(In)n
+(teractiv)n(ely)9 b Fb(.)k(.)d(.)h(.)f(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h
+(.)f(.)g(.)g(.)h(.)31 b Fm(1)224 423 y Fo(1.1)45 b(History)15
+b(Expansion)5 b Fa(.)j(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)19 b Fo(1)374 478 y(1.1.1)44
+b(Ev)o(en)o(t)14 b(Designators)e Fa(.)7 b(.)h(.)f(.)h(.)f(.)h(.)f(.)h
+(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)26 b Fo(1)374 532 y(1.1.2)44 b(W)l(ord)15
+b(Designators)5 b Fa(.)h(.)i(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h
+(.)19 b Fo(2)374 587 y(1.1.3)44 b(Mo)q(di\014ers)t Fa(.)8
+b(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)19 b Fo(2)75 708 y Fm(2)67 b(Programming)23
+b(with)g(GNU)f(History)16 b Fb(.)10 b(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f
+(.)g(.)38 b Fm(3)224 777 y Fo(2.1)45 b(In)o(tro)q(duction)16
+b(to)f(History)10 b Fa(.)d(.)g(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)24 b Fo(3)224 832 y(2.2)45 b(History)15
+b(Storage)c Fa(.)d(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26 b Fo(3)224 886
+y(2.3)45 b(History)15 b(F)l(unctions)d Fa(.)c(.)f(.)h(.)f(.)h(.)f(.)h
+(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)26
+b Fo(4)374 941 y(2.3.1)44 b(Initializing)18 b(History)d(and)h(State)e
+(Managemen)o(t)g Fa(.)7 b(.)h(.)g(.)f(.)h(.)f(.)29 b
+Fo(4)374 996 y(2.3.2)44 b(History)15 b(List)h(Managemen)o(t)d
+Fa(.)7 b(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)
+h(.)f(.)h(.)f(.)h(.)f(.)29 b Fo(4)374 1051 y(2.3.3)44
+b(Information)15 b(Ab)q(out)g(the)h(History)f(List)c
+Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)26
+b Fo(5)374 1106 y(2.3.4)44 b(Mo)o(ving)15 b(Around)g(the)g(History)g
+(List)c Fa(.)d(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f
+(.)h(.)25 b Fo(5)374 1160 y(2.3.5)44 b(Searc)o(hing)16
+b(the)f(History)g(List)7 b Fa(.)h(.)g(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22
+b Fo(5)374 1215 y(2.3.6)44 b(Managing)15 b(the)g(History)g(File)6
+b Fa(.)i(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)f(.)h(.)20 b Fo(6)374 1270 y(2.3.7)44
+b(History)15 b(Expansion)9 b Fa(.)f(.)g(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h
+(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)
+h(.)f(.)24 b Fo(6)224 1325 y(2.4)45 b(History)15 b(V)l(ariables)6
+b Fa(.)j(.)e(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)g(.)f(.)h(.)f(.)h(.)
+f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h
+(.)f(.)h(.)f(.)h(.)f(.)21 b Fo(7)224 1380 y(2.5)45 b(History)15
+b(Programming)f(Example)7 b Fa(.)i(.)e(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f
+(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)h(.)f(.)22
+b Fo(8)75 1501 y Fm(App)r(endix)i(A)67 b(Concept)22 b(Index)17
+b Fb(.)10 b(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)g(.)h(.)f(.)g(.)g(.)h(.)f(.)g
+(.)38 b Fm(11)75 1636 y(App)r(endix)24 b(B)67 b(F)-6
+b(unction)25 b(and)e(V)-6 b(ariable)24 b(Index)16 b Fb(.)10
+b(.)g(.)g(.)38 b Fm(13)p eop
+%%Page: -2 18
+-2 17 bop 75 -58 a Fo(ii)1346 b(GNU)15 b(History)g(Library)p
+eop
+%%Trailer
+end
+userdict /end-hook known{end-hook}if
+%%EOF
diff --git a/readline/doc/hsuser.texinfo b/readline/doc/hsuser.texinfo
index 7c4582d2ace..76cb63b1eee 100644
--- a/readline/doc/hsuser.texinfo
+++ b/readline/doc/hsuser.texinfo
@@ -117,7 +117,7 @@ history list and history file.
@table @code
@item fc
-@comment btindex fc
+@btindex fc
@example
@code{fc [-e @var{ename}] [-nlr] [@var{first}] [@var{last}]}
@code{fc -s [@var{pat}=@var{rep}] [@var{command}]}
@@ -149,7 +149,7 @@ that typing @samp{r cc} runs the last command beginning with @code{cc}
and typing @samp{r} re-executes the last command (@pxref{Aliases}).
@item history
-@comment btindex history
+@btindex history
@example
history [-c] [@var{n}]
history [-anrw] [@var{filename}]
diff --git a/readline/doc/readline.dvi b/readline/doc/readline.dvi
new file mode 100644
index 00000000000..8335d6a21f2
Binary files /dev/null and b/readline/doc/readline.dvi differ
diff --git a/readline/doc/readline.html b/readline/doc/readline.html
new file mode 100644
index 00000000000..f4ea74d1ee6
--- /dev/null
+++ b/readline/doc/readline.html
@@ -0,0 +1,4230 @@
+
+
+
+
+GNU Readline Library
+
+
+GNU Readline Library
+Edition 4.0, for Readline Library
Version 4.0.
+December 1998
+Brian Fox, Free Software Foundation
+Chet Ramey, Case Western Reserve University
+
+
+
Table of Contents
+
+
+
+
+This document describes the GNU Readline Library, a utility which aids
+in the consistency of user interface across discrete programs that need
+to provide a command line interface.
+
+
+
+Published by the Free Software Foundation
+675 Massachusetts Avenue,
+Cambridge, MA 02139 USA
+
+
+
+Permission is granted to make and distribute verbatim copies of
+this manual provided the copyright notice and this permission notice
+are preserved on all copies.
+
+
+
+Permission is granted to copy and distribute modified versions of this
+manual under the conditions for verbatim copying, provided that the entire
+resulting derived work is distributed under the terms of a permission
+notice identical to this one.
+
+
+
+Permission is granted to copy and distribute translations of this manual
+into another language, under the above conditions for modified versions,
+except that this permission notice may be stated in a translation approved
+by the Free Software Foundation.
+
+
+
+Copyright (C) 1988-1999 Free Software Foundation, Inc.
+
+
+
+
+
+
+
+
+This chapter describes the basic features of the GNU
+command line editing interface.
+
+
+
+
+
+
+
+
+
+
+The following paragraphs describe the notation used to represent
+keystrokes.
+
+
+
+The text C-k is read as `Control-K' and describes the character
+produced when the k key is pressed while the Control key
+is depressed.
+
+
+
+The text M-k is read as `Meta-K' and describes the character
+produced when the meta key (if you have one) is depressed, and the k
+key is pressed. If you do not have a meta key, the identical keystroke
+can be generated by typing ESC first, and then typing k.
+Either process is known as metafying the k key.
+
+
+
+The text M-C-k is read as `Meta-Control-k' and describes the
+character produced by metafying C-k.
+
+
+
+In addition, several keys have their own names. Specifically,
+DEL, ESC, LFD, SPC, RET, and TAB all
+stand for themselves when seen in this text, or in an init file
+(see section Readline Init File).
+
+
+
+
+
+
+
+
+
+
+Often during an interactive session you type in a long line of text,
+only to notice that the first word on the line is misspelled. The
+Readline library gives you a set of commands for manipulating the text
+as you type it in, allowing you to just fix your typo, and not forcing
+you to retype the majority of the line. Using these editing commands,
+you move the cursor to the place that needs correction, and delete or
+insert the text of the corrections. Then, when you are satisfied with
+the line, you simply press RETURN. You do not have to be at the
+end of the line to press RETURN; the entire line is accepted
+regardless of the location of the cursor within the line.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+In order to enter characters into the line, simply type them. The typed
+character appears where the cursor was, and then the cursor moves one
+space to the right. If you mistype a character, you can use your
+erase character to back up and delete the mistyped character.
+
+
+
+Sometimes you may miss typing a character that you wanted to type, and
+not notice your error until you have typed several other characters. In
+that case, you can type C-b to move the cursor to the left, and then
+correct your mistake. Afterwards, you can move the cursor to the right
+with C-f.
+
+
+
+When you add text in the middle of a line, you will notice that characters
+to the right of the cursor are `pushed over' to make room for the text
+that you have inserted. Likewise, when you delete text behind the cursor,
+characters to the right of the cursor are `pulled back' to fill in the
+blank space created by the removal of the text. A list of the basic bare
+essentials for editing the text of an input line follows.
+
+
+
+
+- C-b
+
-
+Move back one character.
+
- C-f
+
-
+Move forward one character.
+
- DEL
+
-
+Delete the character to the left of the cursor.
+
- C-d
+
-
+Delete the character underneath the cursor.
+
- Printing characters
+
-
+Insert the character into the line at the cursor.
+
- C-_
+
-
+Undo the last editing command. You can undo all the way back to an
+empty line.
+
+
+
+
+
+
+
+The above table describes the most basic possible keystrokes that you need
+in order to do editing of the input line. For your convenience, many
+other commands have been added in addition to C-b, C-f,
+C-d, and DEL. Here are some commands for moving more rapidly
+about the line.
+
+
+
+
+- C-a
+
-
+Move to the start of the line.
+
- C-e
+
-
+Move to the end of the line.
+
- M-f
+
-
+Move forward a word, where a word is composed of letters and digits.
+
- M-b
+
-
+Move backward a word.
+
- C-l
+
-
+Clear the screen, reprinting the current line at the top.
+
+
+
+Notice how C-f moves forward a character, while M-f moves
+forward a word. It is a loose convention that control keystrokes
+operate on characters while meta keystrokes operate on words.
+
+
+
+
+
+
+
+
+
+
+
+
+Killing text means to delete the text from the line, but to save
+it away for later use, usually by yanking (re-inserting)
+it back into the line.
+If the description for a command says that it `kills' text, then you can
+be sure that you can get the text back in a different (or the same)
+place later.
+
+
+
+When you use a kill command, the text is saved in a kill-ring.
+Any number of consecutive kills save all of the killed text together, so
+that when you yank it back, you get it all. The kill
+ring is not line specific; the text that you killed on a previously
+typed line is available to be yanked back later, when you are typing
+another line.
+
+
+
+
+Here is the list of commands for killing text.
+
+
+
+
+- C-k
+
-
+Kill the text from the current cursor position to the end of the line.
+
+
- M-d
+
-
+Kill from the cursor to the end of the current word, or if between
+words, to the end of the next word.
+
+
- M-DEL
+
-
+Kill from the cursor the start of the previous word, or if between
+words, to the start of the previous word.
+
+
- C-w
+
-
+Kill from the cursor to the previous whitespace. This is different than
+M-DEL because the word boundaries differ.
+
+
+
+
+Here is how to yank the text back into the line. Yanking
+means to copy the most-recently-killed text from the kill buffer.
+
+
+
+
+- C-y
+
-
+Yank the most recently killed text back into the buffer at the cursor.
+
+
- M-y
+
-
+Rotate the kill-ring, and yank the new top. You can only do this if
+the prior command is C-y or M-y.
+
+
+
+
+
+
+
+You can pass numeric arguments to Readline commands. Sometimes the
+argument acts as a repeat count, other times it is the sign of the
+argument that is significant. If you pass a negative argument to a
+command which normally acts in a forward direction, that command will
+act in a backward direction. For example, to kill text back to the
+start of the line, you might type `M-- C-k'.
+
+
+
+The general way to pass numeric arguments to a command is to type meta
+digits before the command. If the first `digit' typed is a minus
+sign (-), then the sign of the argument will be negative. Once
+you have typed one meta digit to get the argument started, you can type
+the remainder of the digits, and then the command. For example, to give
+the C-d command an argument of 10, you could type `M-1 0 C-d'.
+
+
+
+
+
+
+
+Readline provides commands for searching through the command history
+for lines containing a specified string.
+There are two search modes: incremental and non-incremental.
+
+
+
+Incremental searches begin before the user has finished typing the
+search string.
+As each character of the search string is typed, Readline displays
+the next entry from the history matching the string typed so far.
+An incremental search requires only as many characters as needed to
+find the desired history entry.
+The characters present in the value of the isearch-terminators variable
+are used to terminate an incremental search.
+If that variable has not been assigned a value, the ESC and
+C-J characters will terminate an incremental search.
+C-g will abort an incremental search and restore the original line.
+When the search is terminated, the history entry containing the
+search string becomes the current line.
+To find other matching entries in the history list, type C-s or
+C-r as appropriate.
+This will search backward or forward in the history for the next
+entry matching the search string typed so far.
+Any other key sequence bound to a Readline command will terminate
+the search and execute that command.
+For instance, a RET will terminate the search and accept
+the line, thereby executing the command from the history list.
+
+
+
+Non-incremental searches read the entire search string before starting
+to search for matching history lines. The search string may be
+typed by the user or be part of the contents of the current line.
+
+
+
+
+
+
+
+
+
+
+Although the Readline library comes with a set of emacs
-like
+keybindings installed by default, it is possible to use a different set
+of keybindings.
+Any user can customize programs that use Readline by putting
+commands in an inputrc file in his home directory.
+The name of this
+file is taken from the value of the environment variable INPUTRC
. If
+that variable is unset, the default is `~/.inputrc'.
+
+
+
+When a program which uses the Readline library starts up, the
+init file is read, and the key bindings are set.
+
+
+
+In addition, the C-x C-r
command re-reads this init file, thus
+incorporating any changes that you might have made to it.
+
+
+
+
+
+
+
+
+
+
+There are only a few basic constructs allowed in the
+Readline init file. Blank lines are ignored.
+Lines beginning with a `#' are comments.
+Lines beginning with a `$' indicate conditional
+constructs (see section Conditional Init Constructs). Other lines
+denote variable settings and key bindings.
+
+
+
+
+- Variable Settings
+
-
+You can modify the run-time behavior of Readline by
+altering the values of variables in Readline
+using the
set
command within the init file. Here is how to
+change from the default Emacs-like key binding to use
+vi
line editing commands:
+
+
+
+set editing-mode vi
+
+
+A great deal of run-time behavior is changeable with the following
+variables.
+
+
+
+bell-style
+-
+
+Controls what happens when Readline wants to ring the terminal bell.
+If set to `none', Readline never rings the bell. If set to
+`visible', Readline uses a visible bell if one is available.
+If set to `audible' (the default), Readline attempts to ring
+the terminal's bell.
+
+
comment-begin
+-
+
+The string to insert at the beginning of the line when the
+
insert-comment
command is executed. The default value
+is "#"
.
+
+ completion-ignore-case
+-
+If set to `on', Readline performs filename matching and completion
+in a case-insensitive fashion.
+The default value is `off'.
+
+
completion-query-items
+-
+
+The number of possible completions that determines when the user is
+asked whether he wants to see the list of possibilities. If the
+number of possible completions is greater than this value,
+Readline will ask the user whether or not he wishes to view
+them; otherwise, they are simply listed. The default limit is
+
100
.
+
+ convert-meta
+-
+
+If set to `on', Readline will convert characters with the
+eighth bit set to an ASCII key sequence by stripping the eighth
+bit and prepending an ESC character, converting them to a
+meta-prefixed key sequence. The default value is `on'.
+
+
disable-completion
+-
+
+If set to `On', Readline will inhibit word completion.
+Completion characters will be inserted into the line as if they had
+been mapped to
self-insert
. The default is `off'.
+
+ editing-mode
+-
+
+The
editing-mode
variable controls which default set of
+key bindings is used. By default, Readline starts up in Emacs editing
+mode, where the keystrokes are most similar to Emacs. This variable can be
+set to either `emacs' or `vi'.
+
+ enable-keypad
+-
+
+When set to `on', Readline will try to enable the application
+keypad when it is called. Some systems need this to enable the
+arrow keys. The default is `off'.
+
+
expand-tilde
+-
+
+If set to `on', tilde expansion is performed when Readline
+attempts word completion. The default is `off'.
+
+
horizontal-scroll-mode
+-
+
+This variable can be set to either `on' or `off'. Setting it
+to `on' means that the text of the lines being edited will scroll
+horizontally on a single screen line when they are longer than the width
+of the screen, instead of wrapping onto a new screen line. By default,
+this variable is set to `off'.
+
+
input-meta
+-
+
+
+If set to `on', Readline will enable eight-bit input (it
+will not strip the eighth bit from the characters it reads),
+regardless of what the terminal claims it can support. The
+default value is `off'. The name
meta-flag
is a
+synonym for this variable.
+
+ isearch-terminators
+-
+
+The string of characters that should terminate an incremental search without
+subsequently executing the character as a command (see section Searching for Commands in the History).
+If this variable has not been given a value, the characters ESC and
+C-J will terminate an incremental search.
+
+
keymap
+-
+
+Sets Readline's idea of the current keymap for key binding commands.
+Acceptable
keymap
names are
+emacs
,
+emacs-standard
,
+emacs-meta
,
+emacs-ctlx
,
+vi
,
+vi-command
, and
+vi-insert
.
+vi
is equivalent to vi-command
; emacs
is
+equivalent to emacs-standard
. The default value is emacs
.
+The value of the editing-mode
variable also affects the
+default keymap.
+
+ mark-directories
+-
+If set to `on', completed directory names have a slash
+appended. The default is `on'.
+
+
mark-modified-lines
+-
+
+This variable, when set to `on', causes Readline to display an
+asterisk (`*') at the start of history lines which have been modified.
+This variable is `off' by default.
+
+
output-meta
+-
+
+If set to `on', Readline will display characters with the
+eighth bit set directly rather than as a meta-prefixed escape
+sequence. The default is `off'.
+
+
print-completions-horizontally
+-
+If set to `on', Readline will display completions with matches
+sorted horizontally in alphabetical order, rather than down the screen.
+The default is `off'.
+
+
show-all-if-ambiguous
+-
+
+This alters the default behavior of the completion functions. If
+set to `on',
+words which have more than one possible completion cause the
+matches to be listed immediately instead of ringing the bell.
+The default value is `off'.
+
+
visible-stats
+-
+
+If set to `on', a character denoting a file's type
+is appended to the filename when listing possible
+completions. The default is `off'.
+
+
+
+ - Key Bindings
+
-
+The syntax for controlling key bindings in the init file is
+simple. First you have to know the name of the command that you
+want to change. The following sections contain tables of the command
+name, the default keybinding, if any, and a short description of what
+the command does.
+
+Once you know the name of the command, simply place the name of the key
+you wish to bind the command to, a colon, and then the name of the
+command on a line in the init file. The name of the key
+can be expressed in different ways, depending on which is most
+comfortable for you.
+
+
+
+- keyname: function-name or macro
+
-
+keyname is the name of a key spelled out in English. For example:
+
+
+Control-u: universal-argument
+Meta-Rubout: backward-kill-word
+Control-o: "> output"
+
+
+In the above example, C-u is bound to the function
+universal-argument
, and C-o is bound to run the macro
+expressed on the right hand side (that is, to insert the text
+`> output' into the line).
+
+ - "keyseq": function-name or macro
+
-
+keyseq differs from keyname above in that strings
+denoting an entire key sequence can be specified, by placing
+the key sequence in double quotes. Some GNU Emacs style key
+escapes can be used, as in the following example, but the
+special character names are not recognized.
+
+
+
+"\C-u": universal-argument
+"\C-x\C-r": re-read-init-file
+"\e[11~": "Function Key 1"
+
+
+In the above example, C-u is bound to the function
+universal-argument
(just as it was in the first example),
+`C-x C-r' is bound to the function re-read-init-file
,
+and `ESC [ 1 1 ~' is bound to insert
+the text `Function Key 1'.
+
+
+
+The following GNU Emacs style escape sequences are available when
+specifying key sequences:
+
+
+
+\C-
+-
+control prefix
+
\M-
+-
+meta prefix
+
\e
+-
+an escape character
+
\\
+-
+backslash
+
\"
+-
+"
+
\'
+-
+'
+
+
+In addition to the GNU Emacs style escape sequences, a second
+set of backslash escapes is available:
+
+
+
+\a
+-
+alert (bell)
+
\b
+-
+backspace
+
\d
+-
+delete
+
\f
+-
+form feed
+
\n
+-
+newline
+
\r
+-
+carriage return
+
\t
+-
+horizontal tab
+
\v
+-
+vertical tab
+
\nnn
+-
+the character whose ASCII code is the octal value nnn
+(one to three digits)
+
\xnnn
+-
+the character whose ASCII code is the hexadecimal value nnn
+(one to three digits)
+
+
+When entering the text of a macro, single or double quotes must
+be used to indicate a macro definition.
+Unquoted text is assumed to be a function name.
+In the macro body, the backslash escapes described above are expanded.
+Backslash will quote any other character in the macro text,
+including `"' and `''.
+For example, the following binding will make `C-x \'
+insert a single `\' into the line:
+
+
+"\C-x\\": "\\"
+
+
+
+
+
+
+
+
+
+Readline implements a facility similar in spirit to the conditional
+compilation features of the C preprocessor which allows key
+bindings and variable settings to be performed as the result
+of tests. There are four parser directives used.
+
+
+
+
+$if
+-
+The
$if
construct allows bindings to be made based on the
+editing mode, the terminal being used, or the application using
+Readline. The text of the test extends to the end of the line;
+no characters are required to isolate it.
+
+
+
+mode
+-
+The
mode=
form of the $if
directive is used to test
+whether Readline is in emacs
or vi
mode.
+This may be used in conjunction
+with the `set keymap' command, for instance, to set bindings in
+the emacs-standard
and emacs-ctlx
keymaps only if
+Readline is starting out in emacs
mode.
+
+ term
+-
+The
term=
form may be used to include terminal-specific
+key bindings, perhaps to bind the key sequences output by the
+terminal's function keys. The word on the right side of the
+`=' is tested against both the full name of the terminal and
+the portion of the terminal name before the first `-'. This
+allows sun
to match both sun
and sun-cmd
,
+for instance.
+
+ application
+-
+The application construct is used to include
+application-specific settings. Each program using the Readline
+library sets the application name, and you can test for it.
+This could be used to bind key sequences to functions useful for
+a specific program. For instance, the following command adds a
+key sequence that quotes the current or previous word in Bash:
+
+
+$if Bash
+# Quote the current or previous word
+"\C-xq": "\eb\"\ef\""
+$endif
+
+
+
+
+ $endif
+-
+This command, as seen in the previous example, terminates an
+
$if
command.
+
+ $else
+-
+Commands in this branch of the
$if
directive are executed if
+the test fails.
+
+ $include
+-
+This directive takes a single filename as an argument and reads commands
+and bindings from that file.
+
+
+$include /etc/inputrc
+
+
+
+
+
+
+
+
+
+Here is an example of an inputrc file. This illustrates key
+binding, variable assignment, and conditional syntax.
+
+
+
+
+# This file controls the behaviour of line input editing for
+# programs that use the Gnu Readline library. Existing programs
+# include FTP, Bash, and Gdb.
+#
+# You can re-read the inputrc file with C-x C-r.
+# Lines beginning with '#' are comments.
+#
+# First, include any systemwide bindings and variable assignments from
+# /etc/Inputrc
+$include /etc/Inputrc
+
+#
+# Set various bindings for emacs mode.
+
+set editing-mode emacs
+
+$if mode=emacs
+
+Meta-Control-h: backward-kill-word Text after the function name is ignored
+
+#
+# Arrow keys in keypad mode
+#
+#"\M-OD": backward-char
+#"\M-OC": forward-char
+#"\M-OA": previous-history
+#"\M-OB": next-history
+#
+# Arrow keys in ANSI mode
+#
+"\M-[D": backward-char
+"\M-[C": forward-char
+"\M-[A": previous-history
+"\M-[B": next-history
+#
+# Arrow keys in 8 bit keypad mode
+#
+#"\M-\C-OD": backward-char
+#"\M-\C-OC": forward-char
+#"\M-\C-OA": previous-history
+#"\M-\C-OB": next-history
+#
+# Arrow keys in 8 bit ANSI mode
+#
+#"\M-\C-[D": backward-char
+#"\M-\C-[C": forward-char
+#"\M-\C-[A": previous-history
+#"\M-\C-[B": next-history
+
+C-q: quoted-insert
+
+$endif
+
+# An old-style binding. This happens to be the default.
+TAB: complete
+
+# Macros that are convenient for shell interaction
+$if Bash
+# edit the path
+"\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
+# prepare to type a quoted word -- insert open and close double quotes
+# and move to just after the open quote
+"\C-x\"": "\"\"\C-b"
+# insert a backslash (testing backslash escapes in sequences and macros)
+"\C-x\\": "\\"
+# Quote the current or previous word
+"\C-xq": "\eb\"\ef\""
+# Add a binding to refresh the line, which is unbound
+"\C-xr": redraw-current-line
+# Edit variable on current line.
+"\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
+$endif
+
+# use a visible bell if one is available
+set bell-style visible
+
+# don't strip characters to 7 bits when reading
+set input-meta on
+
+# allow iso-latin1 characters to be inserted rather than converted to
+# prefix-meta sequences
+set convert-meta off
+
+# display characters with the eighth bit set directly rather than
+# as meta-prefixed characters
+set output-meta on
+
+# if there are more than 150 possible completions for a word, ask the
+# user if he wants to see all of them
+set completion-query-items 150
+
+# For FTP
+$if Ftp
+"\C-xg": "get \M-?"
+"\C-xt": "put \M-?"
+"\M-.": yank-last-arg
+$endif
+
+
+
+
+
+
+
+
+
+
+This section describes Readline commands that may be bound to key
+sequences.
+
+
+
+
+
+
+
+beginning-of-line (C-a)
+-
+
+Move to the start of the current line.
+
+
end-of-line (C-e)
+-
+
+Move to the end of the line.
+
+
forward-char (C-f)
+-
+
+Move forward a character.
+
+
backward-char (C-b)
+-
+
+Move back a character.
+
+
forward-word (M-f)
+-
+
+Move forward to the end of the next word. Words are composed of
+letters and digits.
+
+
backward-word (M-b)
+-
+
+Move back to the start of this, or the previous, word. Words are
+composed of letters and digits.
+
+
clear-screen (C-l)
+-
+
+Clear the screen and redraw the current line,
+leaving the current line at the top of the screen.
+
+
redraw-current-line ()
+-
+
+Refresh the current line. By default, this is unbound.
+
+
+
+
+
+
+
+
+
+accept-line (Newline, Return)
+-
+
+Accept the line regardless of where the cursor is. If this line is
+non-empty, add it to the history list. If this line was a history
+line, then restore the history line to its original state.
+
+
previous-history (C-p)
+-
+
+Move `up' through the history list.
+
+
next-history (C-n)
+-
+
+Move `down' through the history list.
+
+
beginning-of-history (M-<)
+-
+
+Move to the first line in the history.
+
+
end-of-history (M->)
+-
+
+Move to the end of the input history, i.e., the line currently
+being entered.
+
+
reverse-search-history (C-r)
+-
+
+Search backward starting at the current line and moving `up' through
+the history as necessary. This is an incremental search.
+
+
forward-search-history (C-s)
+-
+
+Search forward starting at the current line and moving `down' through
+the the history as necessary. This is an incremental search.
+
+
non-incremental-reverse-search-history (M-p)
+-
+
+Search backward starting at the current line and moving `up'
+through the history as necessary using a non-incremental search
+for a string supplied by the user.
+
+
non-incremental-forward-search-history (M-n)
+-
+
+Search forward starting at the current line and moving `down'
+through the the history as necessary using a non-incremental search
+for a string supplied by the user.
+
+
history-search-forward ()
+-
+
+Search forward through the history for the string of characters
+between the start of the current line and the current cursor
+position (the point). This is a non-incremental search. By
+default, this command is unbound.
+
+
history-search-backward ()
+-
+
+Search backward through the history for the string of characters
+between the start of the current line and the point. This
+is a non-incremental search. By default, this command is unbound.
+
+
yank-nth-arg (M-C-y)
+-
+
+Insert the first argument to the previous command (usually
+the second word on the previous line). With an argument n,
+insert the nth word from the previous command (the words
+in the previous command begin with word 0). A negative argument
+inserts the nth word from the end of the previous command.
+
+
yank-last-arg (M-., M-_)
+-
+
+Insert last argument to the previous command (the last word of the
+previous history entry). With an
+argument, behave exactly like
yank-nth-arg
.
+Successive calls to yank-last-arg
move back through the history
+list, inserting the last argument of each line in turn.
+
+
+
+
+
+
+
+
+
+delete-char (C-d)
+-
+
+Delete the character under the cursor. If the cursor is at the
+beginning of the line, there are no characters in the line, and
+the last character typed was not bound to
delete-char
, then
+return EOF
.
+
+ backward-delete-char (Rubout)
+-
+
+Delete the character behind the cursor. A numeric argument means
+to kill the characters instead of deleting them.
+
+
forward-backward-delete-char ()
+-
+
+Delete the character under the cursor, unless the cursor is at the
+end of the line, in which case the character behind the cursor is
+deleted. By default, this is not bound to a key.
+
+
quoted-insert (C-q, C-v)
+-
+
+Add the next character typed to the line verbatim. This is
+how to insert key sequences like C-q, for example.
+
+
tab-insert (M-TAB)
+-
+
+Insert a tab character.
+
+
self-insert (a, b, A, 1, !, ...)
+-
+
+Insert yourself.
+
+
transpose-chars (C-t)
+-
+
+Drag the character before the cursor forward over
+the character at the cursor, moving the
+cursor forward as well. If the insertion point
+is at the end of the line, then this
+transposes the last two characters of the line.
+Negative arguments don't work.
+
+
transpose-words (M-t)
+-
+
+Drag the word behind the cursor past the word in front of the cursor
+moving the cursor over that word as well.
+
+
upcase-word (M-u)
+-
+
+Uppercase the current (or following) word. With a negative argument,
+uppercase the previous word, but do not move the cursor.
+
+
downcase-word (M-l)
+-
+
+Lowercase the current (or following) word. With a negative argument,
+lowercase the previous word, but do not move the cursor.
+
+
capitalize-word (M-c)
+-
+
+Capitalize the current (or following) word. With a negative argument,
+capitalize the previous word, but do not move the cursor.
+
+
+
+
+
+
+
+
+
+kill-line (C-k)
+-
+
+Kill the text from the current cursor position to the end of the line.
+
+
backward-kill-line (C-x Rubout)
+-
+
+Kill backward to the beginning of the line.
+
+
unix-line-discard (C-u)
+-
+
+Kill backward from the cursor to the beginning of the current line.
+The killed text is saved on the kill-ring.
+
+
kill-whole-line ()
+-
+
+Kill all characters on the current line, no matter where the
+cursor is. By default, this is unbound.
+
+
kill-word (M-d)
+-
+
+Kill from the cursor to the end of the current word, or if between
+words, to the end of the next word. Word boundaries are the same
+as
forward-word
.
+
+ backward-kill-word (M-DEL)
+-
+
+Kill the word behind the cursor. Word boundaries are the same
+as
backward-word
.
+
+ unix-word-rubout (C-w)
+-
+
+Kill the word behind the cursor, using white space as a word
+boundary. The killed text is saved on the kill-ring.
+
+
delete-horizontal-space ()
+-
+
+Delete all spaces and tabs around point. By default, this is unbound.
+
+
kill-region ()
+-
+
+Kill the text between the point and the mark (saved
+cursor position). This text is referred to as the region.
+By default, this command is unbound.
+
+
copy-region-as-kill ()
+-
+
+Copy the text in the region to the kill buffer, so it can be yanked
+right away. By default, this command is unbound.
+
+
copy-backward-word ()
+-
+
+Copy the word before point to the kill buffer.
+The word boundaries are the same as
backward-word
.
+By default, this command is unbound.
+
+ copy-forward-word ()
+-
+
+Copy the word following point to the kill buffer.
+The word boundaries are the same as
forward-word
.
+By default, this command is unbound.
+
+ yank (C-y)
+-
+
+Yank the top of the kill ring into the buffer at the current
+cursor position.
+
+
yank-pop (M-y)
+-
+
+Rotate the kill-ring, and yank the new top. You can only do this if
+the prior command is yank or yank-pop.
+
+
+
+
+
+
+
+digit-argument (M-0, M-1, ... M--)
+-
+
+Add this digit to the argument already accumulating, or start a new
+argument. M-- starts a negative argument.
+
+
universal-argument ()
+-
+
+This is another way to specify an argument.
+If this command is followed by one or more digits, optionally with a
+leading minus sign, those digits define the argument.
+If the command is followed by digits, executing
universal-argument
+again ends the numeric argument, but is otherwise ignored.
+As a special case, if this command is immediately followed by a
+character that is neither a digit or minus sign, the argument count
+for the next command is multiplied by four.
+The argument count is initially one, so executing this function the
+first time makes the argument count four, a second time makes the
+argument count sixteen, and so on.
+By default, this is not bound to a key.
+
+
+
+
+
+
+
+
+complete (TAB)
+-
+
+Attempt to do completion on the text before the cursor. This is
+application-specific. Generally, if you are typing a filename
+argument, you can do filename completion; if you are typing a command,
+you can do command completion; if you are typing in a symbol to GDB, you
+can do symbol name completion; if you are typing in a variable to Bash,
+you can do variable name completion, and so on.
+
+
possible-completions (M-?)
+-
+
+List the possible completions of the text before the cursor.
+
+
insert-completions (M-*)
+-
+
+Insert all completions of the text before point that would have
+been generated by
possible-completions
.
+
+ menu-complete ()
+-
+
+Similar to
complete
, but replaces the word to be completed
+with a single match from the list of possible completions.
+Repeated execution of menu-complete
steps through the list
+of possible completions, inserting each match in turn.
+At the end of the list of completions, the bell is rung and the
+original text is restored.
+An argument of n moves n positions forward in the list
+of matches; a negative argument may be used to move backward
+through the list.
+This command is intended to be bound to TAB
, but is unbound
+by default.
+
+ delete-char-or-list ()
+-
+
+Deletes the character under the cursor if not at the beginning or
+end of the line (like
delete-char
).
+If at the end of the line, behaves identically to
+possible-completions
.
+This command is unbound by default.
+
+
+
+
+
+
+
+
+start-kbd-macro (C-x ()
+-
+
+Begin saving the characters typed into the current keyboard macro.
+
+
end-kbd-macro (C-x ))
+-
+
+Stop saving the characters typed into the current keyboard macro
+and save the definition.
+
+
call-last-kbd-macro (C-x e)
+-
+
+Re-execute the last keyboard macro defined, by making the characters
+in the macro appear as if typed at the keyboard.
+
+
+
+
+
+
+
+
+re-read-init-file (C-x C-r)
+-
+
+Read in the contents of the inputrc file, and incorporate
+any bindings or variable assignments found there.
+
+
abort (C-g)
+-
+
+Abort the current editing command and
+ring the terminal's bell (subject to the setting of
+
bell-style
).
+
+ do-uppercase-version (M-a, M-b, M-x, ...)
+-
+
+If the metafied character x is lowercase, run the command
+that is bound to the corresponding uppercase character.
+
+
prefix-meta (ESC)
+-
+
+Make the next character typed be metafied. This is for keyboards
+without a meta key. Typing `ESC f' is equivalent to typing
+`M-f'.
+
+
undo (C-_, C-x C-u)
+-
+
+Incremental undo, separately remembered for each line.
+
+
revert-line (M-r)
+-
+
+Undo all changes made to this line. This is like executing the
undo
+command enough times to get back to the beginning.
+
+ tilde-expand (M-~)
+-
+
+Perform tilde expansion on the current word.
+
+
set-mark (C-@)
+-
+
+Set the mark to the current point. If a
+numeric argument is supplied, the mark is set to that position.
+
+
exchange-point-and-mark (C-x C-x)
+-
+
+Swap the point with the mark. The current cursor position is set to
+the saved position, and the old cursor position is saved as the mark.
+
+
character-search (C-])
+-
+
+A character is read and point is moved to the next occurrence of that
+character. A negative count searches for previous occurrences.
+
+
character-search-backward (M-C-])
+-
+
+A character is read and point is moved to the previous occurrence
+of that character. A negative count searches for subsequent
+occurrences.
+
+
insert-comment (M-#)
+-
+
+The value of the
comment-begin
+variable is inserted at the beginning of the current line,
+and the line is accepted as if a newline had been typed.
+
+ dump-functions ()
+-
+
+Print all of the functions and their key bindings to the
+Readline output stream. If a numeric argument is supplied,
+the output is formatted in such a way that it can be made part
+of an inputrc file. This command is unbound by default.
+
+
dump-variables ()
+-
+
+Print all of the settable variables and their values to the
+Readline output stream. If a numeric argument is supplied,
+the output is formatted in such a way that it can be made part
+of an inputrc file. This command is unbound by default.
+
+
dump-macros ()
+-
+
+Print all of the Readline key sequences bound to macros and the
+strings they ouput. If a numeric argument is supplied,
+the output is formatted in such a way that it can be made part
+of an inputrc file. This command is unbound by default.
+
+
+
+
+
+
+
+
+While the Readline library does not have a full set of vi
+editing functions, it does contain enough to allow simple editing
+of the line. The Readline vi
mode behaves as specified in
+the POSIX 1003.2 standard.
+
+
+
+In order to switch interactively between emacs
and vi
+editing modes, use the command M-C-j (toggle-editing-mode).
+The Readline default is emacs
mode.
+
+
+
+When you enter a line in vi
mode, you are already placed in
+`insertion' mode, as if you had typed an `i'. Pressing ESC
+switches you into `command' mode, where you can edit the text of the
+line with the standard vi
movement keys, move to previous
+history lines with `k' and subsequent lines with `j', and
+so forth.
+
+
+
+
+
+
+
+
+This chapter describes the interface between the GNU Readline Library and
+other programs. If you are a programmer, and you wish to include the
+features found in GNU Readline
+such as completion, line editing, and interactive history manipulation
+in your own programs, this section is for you.
+
+
+
+
+
+
+
+
+
+
+Many programs provide a command line interface, such as mail
,
+ftp
, and sh
. For such programs, the default behaviour of
+Readline is sufficient. This section describes how to use Readline in
+the simplest way possible, perhaps to replace calls in your code to
+gets()
or fgets ()
.
+
+
+
+
+
+The function readline ()
prints a prompt and then reads and returns
+a single line of text from the user. The line readline
+returns is allocated with malloc ()
; you should free ()
+the line when you are done with it. The declaration for readline
+in ANSI C is
+
+
+
+
+char *readline (char *prompt);
+
+
+
+So, one might say
+
+
+char *line = readline ("Enter a line: ");
+
+
+
+in order to read a line of text from the user.
+The line returned has the final newline removed, so only the
+text remains.
+
+
+
+If readline
encounters an EOF
while reading the line, and the
+line is empty at that point, then (char *)NULL
is returned.
+Otherwise, the line is ended just as if a newline had been typed.
+
+
+
+If you want the user to be able to get at the line later, (with
+C-p for example), you must call add_history ()
to save the
+line away in a history list of such lines.
+
+
+
+
+add_history (line)
;
+
+
+
+For full details on the GNU History Library, see the associated manual.
+
+
+
+It is preferable to avoid saving empty lines on the history list, since
+users rarely have a burning need to reuse a blank line. Here is
+a function which usefully replaces the standard gets ()
library
+function, and has the advantage of no static buffer to overflow:
+
+
+
+
+/* A static variable for holding the line. */
+static char *line_read = (char *)NULL;
+
+/* Read a string, and return a pointer to it. Returns NULL on EOF. */
+char *
+rl_gets ()
+{
+ /* If the buffer has already been allocated, return the memory
+ to the free pool. */
+ if (line_read)
+ {
+ free (line_read);
+ line_read = (char *)NULL;
+ }
+
+ /* Get a line from the user. */
+ line_read = readline ("");
+
+ /* If the line has any text in it, save it on the history. */
+ if (line_read && *line_read)
+ add_history (line_read);
+
+ return (line_read);
+}
+
+
+
+This function gives the user the default behaviour of TAB
+completion: completion on file names. If you do not want Readline to
+complete on filenames, you can change the binding of the TAB key
+with rl_bind_key ()
.
+
+
+
+
+int rl_bind_key (int key, int (*function)());
+
+
+
+rl_bind_key ()
takes two arguments: key is the character that
+you want to bind, and function is the address of the function to
+call when key is pressed. Binding TAB to rl_insert ()
+makes TAB insert itself.
+rl_bind_key ()
returns non-zero if key is not a valid
+ASCII character code (between 0 and 255).
+
+
+
+Thus, to disable the default TAB behavior, the following suffices:
+
+
+rl_bind_key ('\t', rl_insert);
+
+
+
+This code should be executed once at the start of your program; you
+might write a function called initialize_readline ()
which
+performs this and other desired initializations, such as installing
+custom completers (see section Custom Completers).
+
+
+
+
+
+
+
+Readline provides many functions for manipulating the text of
+the line, but it isn't possible to anticipate the needs of all
+programs. This section describes the various functions and variables
+defined within the Readline library which allow a user program to add
+customized functionality to Readline.
+
+
+
+
+
+
+
+
+
+
+For readabilty, we declare a new type of object, called
+Function. A Function
is a C function which
+returns an int
. The type declaration for Function
is:
+
+
+
+typedef int Function ();
+
+
+
+The reason for declaring this new type is to make it easier to write
+code describing pointers to C functions. Let us say we had a variable
+called func which was a pointer to a function. Instead of the
+classic C declaration
+
+
+
+int (*)()func;
+
+
+
+we may write
+
+
+
+Function *func;
+
+
+
+Similarly, there are
+
+
+
+
+typedef void VFunction ();
+typedef char *CPFunction (); and
+typedef char **CPPFunction ();
+
+
+
+for functions returning no value, pointer to char
, and
+pointer to pointer to char
, respectively.
+
+
+
+
+
+
+
+In order to write new functions for Readline, you need to know the
+calling conventions for keyboard-invoked functions, and the names of the
+variables that describe the current state of the line read so far.
+
+
+
+The calling sequence for a command foo
looks like
+
+
+
+
+foo (int count, int key)
+
+
+
+where count is the numeric argument (or 1 if defaulted) and
+key is the key that invoked this function.
+
+
+
+It is completely up to the function as to what should be done with the
+numeric argument. Some functions use it as a repeat count, some
+as a flag, and others to choose alternate behavior (refreshing the current
+line as opposed to refreshing the screen, for example). Some choose to
+ignore it. In general, if a
+function uses the numeric argument as a repeat count, it should be able
+to do something useful with both negative and positive arguments.
+At the very least, it should be aware that it can be passed a
+negative argument.
+
+
+
+
+
+
+
+These variables are available to function writers.
+
+
+
+
+- Variable: char * rl_line_buffer
+
-
+This is the line gathered so far. You are welcome to modify the
+contents of the line, but see section Allowing Undoing.
+
+
+
+
+
+- Variable: int rl_point
+
-
+The offset of the current cursor position in
rl_line_buffer
+(the point).
+
+
+
+
+
+- Variable: int rl_end
+
-
+The number of characters present in
rl_line_buffer
. When
+rl_point
is at the end of the line, rl_point
and
+rl_end
are equal.
+
+
+
+
+
+- Variable: int rl_mark
+
-
+The mark (saved position) in the current line. If set, the mark
+and point define a region.
+
+
+
+
+
+- Variable: int rl_done
+
-
+Setting this to a non-zero value causes Readline to return the current
+line immediately.
+
+
+
+
+
+- Variable: int rl_pending_input
+
-
+Setting this to a value makes it the next keystroke read. This is a
+way to stuff a single character into the input stream.
+
+
+
+
+
+- Variable: int rl_erase_empty_line
+
-
+Setting this to a non-zero value causes Readline to completely erase
+the current line, including any prompt, any time a newline is typed as
+the only character on an otherwise-empty line. The cursor is moved to
+the beginning of the newly-blank line.
+
+
+
+
+
+- Variable: char * rl_prompt
+
-
+The prompt Readline uses. This is set from the argument to
+
readline ()
, and should not be assigned to directly.
+
+
+
+
+
+- Variable: char * rl_library_version
+
-
+The version number of this revision of the library.
+
+
+
+
+
+- Variable: char * rl_terminal_name
+
-
+The terminal type, used for initialization.
+
+
+
+
+
+- Variable: char * rl_readline_name
+
-
+This variable is set to a unique name by each application using Readline.
+The value allows conditional parsing of the inputrc file
+(see section Conditional Init Constructs).
+
+
+
+
+
+- Variable: FILE * rl_instream
+
-
+The stdio stream from which Readline reads input.
+
+
+
+
+
+- Variable: FILE * rl_outstream
+
-
+The stdio stream to which Readline performs output.
+
+
+
+
+
+- Variable: Function * rl_startup_hook
+
-
+If non-zero, this is the address of a function to call just
+before
readline
prints the first prompt.
+
+
+
+
+
+- Variable: Function * rl_pre_input_hook
+
-
+If non-zero, this is the address of a function to call after
+the first prompt has been printed and just before
readline
+starts reading input characters.
+
+
+
+
+
+- Variable: Function * rl_event_hook
+
-
+If non-zero, this is the address of a function to call periodically
+when readline is waiting for terminal input.
+
+
+
+
+
+- Variable: Function * rl_getc_function
+
-
+If non-zero,
readline
will call indirectly through this pointer
+to get a character from the input stream. By default, it is set to
+rl_getc
, the default readline
character input function
+(see section Utility Functions).
+
+
+
+
+
+- Variable: VFunction * rl_redisplay_function
+
-
+If non-zero,
readline
will call indirectly through this pointer
+to update the display with the current contents of the editing buffer.
+By default, it is set to rl_redisplay
, the default readline
+redisplay function (see section Redisplay).
+
+
+
+
+
+- Variable: Keymap rl_executing_keymap
+
-
+This variable is set to the keymap (see section Selecting a Keymap) in which the
+currently executing readline function was found.
+
+
+
+
+
+- Variable: Keymap rl_binding_keymap
+
-
+This variable is set to the keymap (see section Selecting a Keymap) in which the
+last key binding occurred.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+The user can dynamically change the bindings of keys while using
+Readline. This is done by representing the function with a descriptive
+name. The user is able to type the descriptive name when referring to
+the function. Thus, in an init file, one might find
+
+
+
+
+Meta-Rubout: backward-kill-word
+
+
+
+This binds the keystroke Meta-Rubout to the function
+descriptively named backward-kill-word
. You, as the
+programmer, should bind the functions you write to descriptive names as
+well. Readline provides a function for doing that:
+
+
+
+
+- Function: int rl_add_defun (char *name, Function *function, int key)
+
-
+Add name to the list of named functions. Make function be
+the function that gets called. If key is not -1, then bind it to
+function using
rl_bind_key ()
.
+
+
+
+
+Using this function alone is sufficient for most applications. It is
+the recommended way to add a few functions to the default functions that
+Readline has built in. If you need to do something other
+than adding a function to Readline, you may need to use the
+underlying functions described below.
+
+
+
+
+
+
+
+Key bindings take place on a keymap. The keymap is the
+association between the keys that the user types and the functions that
+get run. You can make your own keymaps, copy existing keymaps, and tell
+Readline which keymap to use.
+
+
+
+
+- Function: Keymap rl_make_bare_keymap ()
+
-
+Returns a new, empty keymap. The space for the keymap is allocated with
+
malloc ()
; you should free ()
it when you are done.
+
+
+
+
+
+- Function: Keymap rl_copy_keymap (Keymap map)
+
-
+Return a new keymap which is a copy of map.
+
+
+
+
+
+- Function: Keymap rl_make_keymap ()
+
-
+Return a new keymap with the printing characters bound to rl_insert,
+the lowercase Meta characters bound to run their equivalents, and
+the Meta digits bound to produce numeric arguments.
+
+
+
+
+
+- Function: void rl_discard_keymap (Keymap keymap)
+
-
+Free the storage associated with keymap.
+
+
+
+
+Readline has several internal keymaps. These functions allow you to
+change which keymap is active.
+
+
+
+
+- Function: Keymap rl_get_keymap ()
+
-
+Returns the currently active keymap.
+
+
+
+
+
+- Function: void rl_set_keymap (Keymap keymap)
+
-
+Makes keymap the currently active keymap.
+
+
+
+
+
+- Function: Keymap rl_get_keymap_by_name (char *name)
+
-
+Return the keymap matching name. name is one which would
+be supplied in a
set keymap
inputrc line (see section Readline Init File).
+
+
+
+
+
+- Function: char * rl_get_keymap_name (Keymap keymap)
+
-
+Return the name matching keymap. name is one which would
+be supplied in a
set keymap
inputrc line (see section Readline Init File).
+
+
+
+
+
+
+
+
+You associate keys with functions through the keymap. Readline has
+several internal keymaps: emacs_standard_keymap
,
+emacs_meta_keymap
, emacs_ctlx_keymap
,
+vi_movement_keymap
, and vi_insertion_keymap
.
+emacs_standard_keymap
is the default, and the examples in
+this manual assume that.
+
+
+
+These functions manage key bindings.
+
+
+
+
+- Function: int rl_bind_key (int key, Function *function)
+
-
+Binds key to function in the currently active keymap.
+Returns non-zero in the case of an invalid key.
+
+
+
+
+
+- Function: int rl_bind_key_in_map (int key, Function *function, Keymap map)
+
-
+Bind key to function in map. Returns non-zero in the case
+of an invalid key.
+
+
+
+
+
+- Function: int rl_unbind_key (int key)
+
-
+Bind key to the null function in the currently active keymap.
+Returns non-zero in case of error.
+
+
+
+
+
+- Function: int rl_unbind_key_in_map (int key, Keymap map)
+
-
+Bind key to the null function in map.
+Returns non-zero in case of error.
+
+
+
+
+
+- Function: int rl_unbind_function_in_map (Function *function, Keymap map)
+
-
+Unbind all keys that execute function in map.
+
+
+
+
+
+- Function: int rl_unbind_command_in_map (char *command, Keymap map)
+
-
+Unbind all keys that are bound to command in map.
+
+
+
+
+
+- Function: int rl_generic_bind (int type, char *keyseq, char *data, Keymap map)
+
-
+Bind the key sequence represented by the string keyseq to the arbitrary
+pointer data. type says what kind of data is pointed to by
+data; this can be a function (
ISFUNC
), a macro
+(ISMACR
), or a keymap (ISKMAP
). This makes new keymaps as
+necessary. The initial keymap in which to do bindings is map.
+
+
+
+
+
+- Function: int rl_parse_and_bind (char *line)
+
-
+Parse line as if it had been read from the
inputrc
file and
+perform any key bindings and variable assignments found
+(see section Readline Init File).
+
+
+
+
+
+- Function: int rl_read_init_file (char *filename)
+
-
+Read keybindings and variable assignments from filename
+(see section Readline Init File).
+
+
+
+
+
+
+
+
+These functions allow you to find out what keys invoke named functions
+and the functions invoked by a particular key sequence.
+
+
+
+
+- Function: Function * rl_named_function (char *name)
+
-
+Return the function with name name.
+
+
+
+
+
+- Function: Function * rl_function_of_keyseq (char *keyseq, Keymap map, int *type)
+
-
+Return the function invoked by keyseq in keymap map.
+If map is NULL, the current keymap is used. If type is
+not NULL, the type of the object is returned in it (one of
ISFUNC
,
+ISKMAP
, or ISMACR
).
+
+
+
+
+
+- Function: char ** rl_invoking_keyseqs (Function *function)
+
-
+Return an array of strings representing the key sequences used to
+invoke function in the current keymap.
+
+
+
+
+
+- Function: char ** rl_invoking_keyseqs_in_map (Function *function, Keymap map)
+
-
+Return an array of strings representing the key sequences used to
+invoke function in the keymap map.
+
+
+
+
+
+- Function: void rl_function_dumper (int readable)
+
-
+Print the readline function names and the key sequences currently
+bound to them to
rl_outstream
. If readable is non-zero,
+the list is formatted in such a way that it can be made part of an
+inputrc
file and re-read.
+
+
+
+
+
+- Function: void rl_list_funmap_names ()
+
-
+Print the names of all bindable Readline functions to
rl_outstream
.
+
+
+
+
+
+
+
+
+Supporting the undo command is a painless thing, and makes your
+functions much more useful. It is certainly easy to try
+something if you know you can undo it. I could use an undo function for
+the stock market.
+
+
+
+If your function simply inserts text once, or deletes text once, and
+uses rl_insert_text ()
or rl_delete_text ()
to do it, then
+undoing is already done for you automatically.
+
+
+
+If you do multiple insertions or multiple deletions, or any combination
+of these operations, you should group them together into one operation.
+This is done with rl_begin_undo_group ()
and
+rl_end_undo_group ()
.
+
+
+
+The types of events that can be undone are:
+
+
+
+
+enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
+
+
+
+Notice that UNDO_DELETE
means to insert some text, and
+UNDO_INSERT
means to delete some text. That is, the undo code
+tells undo what to undo, not how to undo it. UNDO_BEGIN
and
+UNDO_END
are tags added by rl_begin_undo_group ()
and
+rl_end_undo_group ()
.
+
+
+
+
+- Function: int rl_begin_undo_group ()
+
-
+Begins saving undo information in a group construct. The undo
+information usually comes from calls to
rl_insert_text ()
and
+rl_delete_text ()
, but could be the result of calls to
+rl_add_undo ()
.
+
+
+
+
+
+- Function: int rl_end_undo_group ()
+
-
+Closes the current undo group started with
rl_begin_undo_group
+()
. There should be one call to rl_end_undo_group ()
+for each call to rl_begin_undo_group ()
.
+
+
+
+
+
+- Function: void rl_add_undo (enum undo_code what, int start, int end, char *text)
+
-
+Remember how to undo an event (according to what). The affected
+text runs from start to end, and encompasses text.
+
+
+
+
+
+- Function: void free_undo_list ()
+
-
+Free the existing undo list.
+
+
+
+
+
+- Function: int rl_do_undo ()
+
-
+Undo the first thing on the undo list. Returns
0
if there was
+nothing to undo, non-zero if something was undone.
+
+
+
+
+Finally, if you neither insert nor delete text, but directly modify the
+existing text (e.g., change its case), call rl_modifying ()
+once, just before you modify the text. You must supply the indices of
+the text range that you are going to modify.
+
+
+
+
+- Function: int rl_modifying (int start, int end)
+
-
+Tell Readline to save the text between start and end as a
+single undo unit. It is assumed that you will subsequently modify
+that text.
+
+
+
+
+
+
+
+
+
+- Function: void rl_redisplay ()
+
-
+Change what's displayed on the screen to reflect the current contents
+of
rl_line_buffer
.
+
+
+
+
+
+- Function: int rl_forced_update_display ()
+
-
+Force the line to be updated and redisplayed, whether or not
+Readline thinks the screen display is correct.
+
+
+
+
+
+- Function: int rl_on_new_line ()
+
-
+Tell the update routines that we have moved onto a new (empty) line,
+usually after ouputting a newline.
+
+
+
+
+
+- Function: int rl_reset_line_state ()
+
-
+Reset the display state to a clean state and redisplay the current line
+starting on a new line.
+
+
+
+
+
+- Function: int rl_message (va_alist)
+
-
+The arguments are a string as would be supplied to
printf
. The
+resulting string is displayed in the echo area. The echo area
+is also used to display numeric arguments and search strings.
+
+
+
+
+
+- Function: int rl_clear_message ()
+
-
+Clear the message in the echo area.
+
+
+
+
+
+- Function: void rl_save_prompt ()
+
-
+Save the local Readline prompt display state in preparation for
+displaying a new message in the message area with
rl_message
.
+
+
+
+
+
+- Function: void rl_restore_prompt ()
+
-
+Restore the local Readline prompt display state saved by the most
+recent call to
rl_save_prompt
.
+
+
+
+
+
+
+
+
+
+- Function: int rl_insert_text (char *text)
+
-
+Insert text into the line at the current cursor position.
+
+
+
+
+
+- Function: int rl_delete_text (int start, int end)
+
-
+Delete the text between start and end in the current line.
+
+
+
+
+
+- Function: char * rl_copy_text (int start, int end)
+
-
+Return a copy of the text between start and end in
+the current line.
+
+
+
+
+
+- Function: int rl_kill_text (int start, int end)
+
-
+Copy the text between start and end in the current line
+to the kill ring, appending or prepending to the last kill if the
+last command was a kill command. The text is deleted.
+If start is less than end,
+the text is appended, otherwise prepended. If the last command was
+not a kill, a new kill ring slot is used.
+
+
+
+
+
+
+
+
+
+- Function: int rl_read_key ()
+
-
+Return the next character available. This handles input inserted into
+the input stream via pending input (see section Readline Variables)
+and
rl_stuff_char ()
, macros, and characters read from the keyboard.
+
+
+
+
+
+- Function: int rl_getc (FILE *)
+
-
+Return the next character available from the keyboard.
+
+
+
+
+
+- Function: int rl_stuff_char (int c)
+
-
+Insert c into the Readline input stream. It will be "read"
+before Readline attempts to read characters from the terminal with
+
rl_read_key ()
.
+
+
+
+
+
+- Function: rl_extend_line_buffer (int len)
+
-
+Ensure that
rl_line_buffer
has enough space to hold len
+characters, possibly reallocating it if necessary.
+
+
+
+
+
+- Function: int rl_initialize ()
+
-
+Initialize or re-initialize Readline's internal state.
+
+
+
+
+
+- Function: int rl_reset_terminal (char *terminal_name)
+
-
+Reinitialize Readline's idea of the terminal settings using
+terminal_name as the terminal type (e.g.,
vt100
).
+
+
+
+
+
+- Function: int alphabetic (int c)
+
-
+Return 1 if c is an alphabetic character.
+
+
+
+
+
+- Function: int numeric (int c)
+
-
+Return 1 if c is a numeric character.
+
+
+
+
+
+- Function: int ding ()
+
-
+Ring the terminal bell, obeying the setting of
bell-style
.
+
+
+
+
+
+- Function: void rl_display_match_list (char **matches, int len, int max)
+
-
+A convenience function for displaying a list of strings in
+columnar format on Readline's output stream.
matches
is the list
+of strings, in argv format, such as a list of completion matches.
+len
is the number of strings in matches
, and max
+is the length of the longest string in matches
. This function uses
+the setting of print-completions-horizontally
to select how the
+matches are displayed (see section Readline Init File Syntax).
+
+
+
+
+The following are implemented as macros, defined in chartypes.h
.
+
+
+
+
+- Function: int uppercase_p (int c)
+
-
+Return 1 if c is an uppercase alphabetic character.
+
+
+
+
+
+- Function: int lowercase_p (int c)
+
-
+Return 1 if c is a lowercase alphabetic character.
+
+
+
+
+
+- Function: int digit_p (int c)
+
-
+Return 1 if c is a numeric character.
+
+
+
+
+
+- Function: int to_upper (int c)
+
-
+If c is a lowercase alphabetic character, return the corresponding
+uppercase character.
+
+
+
+
+
+- Function: int to_lower (int c)
+
-
+If c is an uppercase alphabetic character, return the corresponding
+lowercase character.
+
+
+
+
+
+- Function: int digit_value (int c)
+
-
+If c is a number, return the value it represents.
+
+
+
+
+
+
+
+
+An alternate interface is available to plain readline()
. Some
+applications need to interleave keyboard I/O with file, device, or
+window system I/O, typically by using a main loop to select()
+on various file descriptors. To accomodate this need, readline can
+also be invoked as a `callback' function from an event loop. There
+are functions available to make this easy.
+
+
+
+
+- Function: void rl_callback_handler_install (char *prompt, Vfunction *lhandler)
+
-
+Set up the terminal for readline I/O and display the initial
+expanded value of prompt. Save the value of lhandler to
+use as a callback when a complete line of input has been entered.
+
+
+
+
+
+- Function: void rl_callback_read_char ()
+
-
+Whenever an application determines that keyboard input is available, it
+should call
rl_callback_read_char()
, which will read the next
+character from the current input source. If that character completes the
+line, rl_callback_read_char
will invoke the lhandler
+function saved by rl_callback_handler_install
to process the
+line. EOF
is indicated by calling lhandler with a
+NULL
line.
+
+
+
+
+
+- Function: void rl_callback_handler_remove ()
+
-
+Restore the terminal to its initial state and remove the line handler.
+This may be called from within a callback as well as independently.
+
+
+
+
+
+
+
+
+Here is a function which changes lowercase characters to their uppercase
+equivalents, and uppercase characters to lowercase. If
+this function was bound to `M-c', then typing `M-c' would
+change the case of the character under point. Typing `M-1 0 M-c'
+would change the case of the following 10 characters, leaving the cursor on
+the last character changed.
+
+
+
+
+/* Invert the case of the COUNT following characters. */
+int
+invert_case_line (count, key)
+ int count, key;
+{
+ register int start, end, i;
+
+ start = rl_point;
+
+ if (rl_point >= rl_end)
+ return (0);
+
+ if (count < 0)
+ {
+ direction = -1;
+ count = -count;
+ }
+ else
+ direction = 1;
+
+ /* Find the end of the range to modify. */
+ end = start + (count * direction);
+
+ /* Force it to be within range. */
+ if (end > rl_end)
+ end = rl_end;
+ else if (end < 0)
+ end = 0;
+
+ if (start == end)
+ return (0);
+
+ if (start > end)
+ {
+ int temp = start;
+ start = end;
+ end = temp;
+ }
+
+ /* Tell readline that we are modifying the line, so it will save
+ the undo information. */
+ rl_modifying (start, end);
+
+ for (i = start; i != end; i++)
+ {
+ if (uppercase_p (rl_line_buffer[i]))
+ rl_line_buffer[i] = to_lower (rl_line_buffer[i]);
+ else if (lowercase_p (rl_line_buffer[i]))
+ rl_line_buffer[i] = to_upper (rl_line_buffer[i]);
+ }
+ /* Move point to on top of the last character changed. */
+ rl_point = (direction == 1) ? end - 1 : start;
+ return (0);
+}
+
+
+
+
+
+
+
+Signals are asynchronous events sent to a process by the Unix kernel,
+sometimes on behalf of another process. They are intended to indicate
+exceptional events, like a user pressing the interrupt key on his
+terminal, or a network connection being broken. There is a class of
+signals that can be sent to the process currently reading input from
+the keyboard. Since Readline changes the terminal attributes when it
+is called, it needs to perform special processing when a signal is
+received to restore the terminal to a sane state, or provide application
+writers with functions to do so manually.
+
+
+
+Readline contains an internal signal handler that is installed for a
+number of signals (SIGINT
, SIGQUIT
, SIGTERM
,
+SIGALRM
, SIGTSTP
, SIGTTIN
, and SIGTTOU
).
+When one of these signals is received, the signal handler
+will reset the terminal attributes to those that were in effect before
+readline ()
was called, reset the signal handling to what it was
+before readline ()
was called, and resend the signal to the calling
+application.
+If and when the calling application's signal handler returns, Readline
+will reinitialize the terminal and continue to accept input.
+When a SIGINT
is received, the Readline signal handler performs
+some additional work, which will cause any partially-entered line to be
+aborted (see the description of rl_free_line_state ()
).
+
+
+
+There is an additional Readline signal handler, for SIGWINCH
, which
+the kernel sends to a process whenever the terminal's size changes (for
+example, if a user resizes an xterm
). The Readline SIGWINCH
+handler updates Readline's internal screen size state, and then calls any
+SIGWINCH
signal handler the calling application has installed.
+Readline calls the application's SIGWINCH
signal handler without
+resetting the terminal to its original state. If the application's signal
+handler does more than update its idea of the terminal size and return (for
+example, a longjmp
back to a main processing loop), it must
+call rl_cleanup_after_signal ()
(described below), to restore the
+terminal state.
+
+
+
+Readline provides two variables that allow application writers to
+control whether or not it will catch certain signals and act on them
+when they are received. It is important that applications change the
+values of these variables only when calling readline ()
, not in
+a signal handler, so Readline's internal signal state is not corrupted.
+
+
+
+
+- Variable: int rl_catch_signals
+
-
+If this variable is non-zero, Readline will install signal handlers for
+
SIGINT
, SIGQUIT
, SIGTERM
, SIGALRM
,
+SIGTSTP
, SIGTTIN
, and SIGTTOU
.
+
+
+
+The default value of rl_catch_signals
is 1.
+
+
+
+
+
+- Variable: int rl_catch_sigwinch
+
-
+If this variable is non-zero, Readline will install a signal handler for
+
SIGWINCH
.
+
+
+
+The default value of rl_catch_sigwinch
is 1.
+
+
+
+
+If an application does not wish to have Readline catch any signals, or
+to handle signals other than those Readline catches (SIGHUP
,
+for example),
+Readline provides convenience functions to do the necessary terminal
+and internal state cleanup upon receipt of a signal.
+
+
+
+
+- Function: void rl_cleanup_after_signal (void)
+
-
+This function will reset the state of the terminal to what it was before
+
readline ()
was called, and remove the Readline signal handlers for
+all signals, depending on the values of rl_catch_signals
and
+rl_catch_sigwinch
.
+
+
+
+
+
+- Function: void rl_free_line_state (void)
+
-
+This will free any partial state associated with the current input line
+(undo information, any partial history entry, any partially-entered
+keyboard macro, and any partially-entered numeric argument). This
+should be called before
rl_cleanup_after_signal ()
. The
+Readline signal handler for SIGINT
calls this to abort the
+current input line.
+
+
+
+
+
+- Function: void rl_reset_after_signal (void)
+
-
+This will reinitialize the terminal and reinstall any Readline signal
+handlers, depending on the values of
rl_catch_signals
and
+rl_catch_sigwinch
.
+
+
+
+
+If an application does not wish Readline to catch SIGWINCH
, it may
+call rl_resize_terminal ()
to force Readline to update its idea of
+the terminal size when a SIGWINCH
is received.
+
+
+
+
+- Function: void rl_resize_terminal (void)
+
-
+Update Readline's internal screen size.
+
+
+
+
+The following functions install and remove Readline's signal handlers.
+
+
+
+
+- Function: int rl_set_signals (void)
+
-
+Install Readline's signal handler for
SIGINT
, SIGQUIT
,
+SIGTERM
, SIGALRM
, SIGTSTP
, SIGTTIN
,
+SIGTTOU
, and SIGWINCH
, depending on the values of
+rl_catch_signals
and rl_catch_sigwinch
.
+
+
+
+
+
+- Function: int rl_clear_signals (void)
+
-
+Remove all of the Readline signal handlers installed by
+
rl_set_signals ()
.
+
+
+
+
+
+
+
+
+Typically, a program that reads commands from the user has a way of
+disambiguating commands and data. If your program is one of these, then
+it can provide completion for commands, data, or both.
+The following sections describe how your program and Readline
+cooperate to provide this service.
+
+
+
+
+
+
+
+
+
+
+In order to complete some text, the full list of possible completions
+must be available. That is, it is not possible to accurately
+expand a partial word without knowing all of the possible words
+which make sense in that context. The Readline library provides
+the user interface to completion, and two of the most common
+completion functions: filename and username. For completing other types
+of text, you must write your own completion function. This section
+describes exactly what such functions must do, and provides an example.
+
+
+
+There are three major functions used to perform completion:
+
+
+
+
+-
+
+The user-interface function
rl_complete ()
. This function is
+called with the same arguments as other Readline
+functions intended for interactive use: count and
+invoking_key. It isolates the word to be completed and calls
+completion_matches ()
to generate a list of possible completions.
+It then either lists the possible completions, inserts the possible
+completions, or actually performs the
+completion, depending on which behavior is desired.
+
+ -
+
+The internal function
completion_matches ()
uses your
+generator function to generate the list of possible matches, and
+then returns the array of these matches. You should place the address
+of your generator function in rl_completion_entry_function
.
+
+ -
+
+The generator function is called repeatedly from
+
completion_matches ()
, returning a string each time. The
+arguments to the generator function are text and state.
+text is the partial word to be completed. state is zero the
+first time the function is called, allowing the generator to perform
+any necessary initialization, and a positive non-zero integer for
+each subsequent call. When the generator function returns
+(char *)NULL
this signals completion_matches ()
that there are
+no more possibilities left. Usually the generator function computes the
+list of possible completions when state is zero, and returns them
+one at a time on subsequent calls. Each string the generator function
+returns as a match must be allocated with malloc()
; Readline
+frees the strings when it has finished with them.
+
+
+
+
+
+- Function: int rl_complete (int ignore, int invoking_key)
+
-
+Complete the word at or before point. You have supplied the function
+that does the initial simple matching selection algorithm (see
+
completion_matches ()
). The default is to do filename completion.
+
+
+
+
+
+- Variable: Function * rl_completion_entry_function
+
-
+This is a pointer to the generator function for
completion_matches
+()
. If the value of rl_completion_entry_function
is
+(Function *)NULL
then the default filename generator function,
+filename_completion_function ()
, is used.
+
+
+
+
+
+
+
+
+Here is the complete list of callable completion functions present in
+Readline.
+
+
+
+
+- Function: int rl_complete_internal (int what_to_do)
+
-
+Complete the word at or before point. what_to_do says what to do
+with the completion. A value of `?' means list the possible
+completions. `TAB' means do standard completion. `*' means
+insert all of the possible completions. `!' means to display
+all of the possible completions, if there is more than one, as well as
+performing partial completion.
+
+
+
+
+
+- Function: int rl_complete (int ignore, int invoking_key)
+
-
+Complete the word at or before point. You have supplied the function
+that does the initial simple matching selection algorithm (see
+
completion_matches ()
and rl_completion_entry_function
).
+The default is to do filename
+completion. This calls rl_complete_internal ()
with an
+argument depending on invoking_key.
+
+
+
+
+
+- Function: int rl_possible_completions (int count, int invoking_key))
+
-
+List the possible completions. See description of
rl_complete
+()
. This calls rl_complete_internal ()
with an argument of
+`?'.
+
+
+
+
+
+- Function: int rl_insert_completions (int count, int invoking_key))
+
-
+Insert the list of possible completions into the line, deleting the
+partially-completed word. See description of
rl_complete ()
.
+This calls rl_complete_internal ()
with an argument of `*'.
+
+
+
+
+
+- Function: char ** completion_matches (char *text, CPFunction *entry_func)
+
-
+Returns an array of
(char *)
which is a list of completions for
+text. If there are no completions, returns (char **)NULL
.
+The first entry in the returned array is the substitution for text.
+The remaining entries are the possible completions. The array is
+terminated with a NULL
pointer.
+
+
+
+entry_func is a function of two args, and returns a
+(char *)
. The first argument is text. The second is a
+state argument; it is zero on the first call, and non-zero on subsequent
+calls. entry_func returns a NULL
pointer to the caller
+when there are no more matches.
+
+
+
+
+
+- Function: char * filename_completion_function (char *text, int state)
+
-
+A generator function for filename completion in the general case. Note
+that completion in Bash is a little different because of all
+the pathnames that must be followed when looking up completions for a
+command. The Bash source is a useful reference for writing custom
+completion functions.
+
+
+
+
+
+- Function: char * username_completion_function (char *text, int state)
+
-
+A completion generator for usernames. text contains a partial
+username preceded by a random character (usually `~'). As with all
+completion generators, state is zero on the first call and non-zero
+for subsequent calls.
+
+
+
+
+
+
+
+
+
+- Variable: Function * rl_completion_entry_function
+
-
+A pointer to the generator function for
completion_matches ()
.
+NULL
means to use filename_entry_function ()
, the default
+filename completer.
+
+
+
+
+
+- Variable: CPPFunction * rl_attempted_completion_function
+
-
+A pointer to an alternative function to create matches.
+The function is called with text, start, and end.
+start and end are indices in
rl_line_buffer
saying
+what the boundaries of text are. If this function exists and
+returns NULL
, or if this variable is set to NULL
, then
+rl_complete ()
will call the value of
+rl_completion_entry_function
to generate matches, otherwise the
+array of strings returned will be used.
+
+
+
+
+
+- Variable: CPFunction * rl_filename_quoting_function
+
-
+A pointer to a function that will quote a filename in an application-
+specific fashion. This is called if filename completion is being
+attempted and one of the characters in
rl_filename_quote_characters
+appears in a completed filename. The function is called with
+text, match_type, and quote_pointer. The text
+is the filename to be quoted. The match_type is either
+SINGLE_MATCH
, if there is only one completion match, or
+MULT_MATCH
. Some functions use this to decide whether or not to
+insert a closing quote character. The quote_pointer is a pointer
+to any opening quote character the user typed. Some functions choose
+to reset this character.
+
+
+
+
+
+- Variable: CPFunction * rl_filename_dequoting_function
+
-
+A pointer to a function that will remove application-specific quoting
+characters from a filename before completion is attempted, so those
+characters do not interfere with matching the text against names in
+the filesystem. It is called with text, the text of the word
+to be dequoted, and quote_char, which is the quoting character
+that delimits the filename (usually `'' or `"'). If
+quote_char is zero, the filename was not in an embedded string.
+
+
+
+
+
+- Variable: Function * rl_char_is_quoted_p
+
-
+A pointer to a function to call that determines whether or not a specific
+character in the line buffer is quoted, according to whatever quoting
+mechanism the program calling readline uses. The function is called with
+two arguments: text, the text of the line, and index, the
+index of the character in the line. It is used to decide whether a
+character found in
rl_completer_word_break_characters
should be
+used to break words for the completer.
+
+
+
+
+
+- Variable: int rl_completion_query_items
+
-
+Up to this many items will be displayed in response to a
+possible-completions call. After that, we ask the user if she is sure
+she wants to see them all. The default value is 100.
+
+
+
+
+
+- Variable: char * rl_basic_word_break_characters
+
-
+The basic list of characters that signal a break between words for the
+completer routine. The default value of this variable is the characters
+which break words for completion in Bash, i.e.,
+
" \t\n\"\\'`@$><=;|&{("
.
+
+
+
+
+
+- Variable: char * rl_basic_quote_characters
+
-
+List of quote characters which can cause a word break.
+
+
+
+
+
+- Variable: char * rl_completer_word_break_characters
+
-
+The list of characters that signal a break between words for
+
rl_complete_internal ()
. The default list is the value of
+rl_basic_word_break_characters
.
+
+
+
+
+
+- Variable: char * rl_completer_quote_characters
+
-
+List of characters which can be used to quote a substring of the line.
+Completion occurs on the entire substring, and within the substring
+
rl_completer_word_break_characters
are treated as any other character,
+unless they also appear within this list.
+
+
+
+
+
+- Variable: char * rl_filename_quote_characters
+
-
+A list of characters that cause a filename to be quoted by the completer
+when they appear in a completed filename. The default is the null string.
+
+
+
+
+
+- Variable: char * rl_special_prefixes
+
-
+The list of characters that are word break characters, but should be
+left in text when it is passed to the completion function.
+Programs can use this to help determine what kind of completing to do.
+For instance, Bash sets this variable to "$@" so that it can complete
+shell variables and hostnames.
+
+
+
+
+
+- Variable: int rl_completion_append_character
+
-
+When a single completion alternative matches at the end of the command
+line, this character is appended to the inserted completion text. The
+default is a space character (` '). Setting this to the null
+character (`\0') prevents anything being appended automatically.
+This can be changed in custom completion functions to
+provide the "most sensible word separator character" according to
+an application-specific command line syntax specification.
+
+
+
+
+
+- Variable: int rl_ignore_completion_duplicates
+
-
+If non-zero, then disallow duplicates in the matches. Default is 1.
+
+
+
+
+
+- Variable: int rl_filename_completion_desired
+
-
+Non-zero means that the results of the matches are to be treated as
+filenames. This is always zero on entry, and can only be changed
+within a completion entry generator function. If it is set to a non-zero
+value, directory names have a slash appended and Readline attempts to
+quote completed filenames if they contain any embedded word break
+characters.
+
+
+
+
+
+- Variable: int rl_filename_quoting_desired
+
-
+Non-zero means that the results of the matches are to be quoted using
+double quotes (or an application-specific quoting mechanism) if the
+completed filename contains any characters in
+
rl_filename_quote_chars
. This is always non-zero
+on entry, and can only be changed within a completion entry generator
+function. The quoting is effected via a call to the function pointed to
+by rl_filename_quoting_function
.
+
+
+
+
+
+- Variable: int rl_inhibit_completion
+
-
+If this variable is non-zero, completion is inhibit<ed. The completion
+character will be inserted as any other bound to
self-insert
.
+
+
+
+
+
+- Variable: Function * rl_ignore_some_completions_function
+
-
+This function, if defined, is called by the completer when real filename
+completion is done, after all the matching names have been generated.
+It is passed a
NULL
terminated array of matches.
+The first element (matches[0]
) is the
+maximal substring common to all matches. This function can
+re-arrange the list of matches as required, but each element deleted
+from the array must be freed.
+
+
+
+
+
+- Variable: Function * rl_directory_completion_hook
+
-
+This function, if defined, is allowed to modify the directory portion
+of filenames Readline completes. It is called with the address of a
+string (the current directory name) as an argument. It could be used
+to expand symbolic links or shell variables in pathnames.
+
+
+
+
+
+- Variable: VFunction * rl_completion_display_matches_hook
+
-
+If non-zero, then this is the address of a function to call when
+completing a word would normally display the list of possible matches.
+This function is called in lieu of Readline displaying the list.
+It takes three arguments:
+(
char **
matches, int
num_matches, int
max_length)
+where matches is the array of matching strings,
+num_matches is the number of strings in that array, and
+max_length is the length of the longest string in that array.
+Readline provides a convenience function, rl_display_match_list
,
+that takes care of doing the display to Readline's output stream. That
+function may be called from this hook.
+
+
+
+
+
+
+
+
+Here is a small application demonstrating the use of the GNU Readline
+library. It is called fileman
, and the source code resides in
+`examples/fileman.c'. This sample application provides
+completion of command names, line editing features, and access to the
+history list.
+
+
+
+
+/* fileman.c -- A tiny application which demonstrates how to use the
+ GNU Readline library. This application interactively allows users
+ to manipulate files and their modes. */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/errno.h>
+
+#include <readline/readline.h>
+#include <readline/history.h>
+
+extern char *getwd ();
+extern char *xmalloc ();
+
+/* The names of functions that actually do the manipulation. */
+int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
+int com_delete (), com_help (), com_cd (), com_quit ();
+
+/* A structure which contains information on the commands this program
+ can understand. */
+
+typedef struct {
+ char *name; /* User printable name of the function. */
+ Function *func; /* Function to call to do the job. */
+ char *doc; /* Documentation for this function. */
+} COMMAND;
+
+COMMAND commands[] = {
+ { "cd", com_cd, "Change to directory DIR" },
+ { "delete", com_delete, "Delete FILE" },
+ { "help", com_help, "Display this text" },
+ { "?", com_help, "Synonym for `help'" },
+ { "list", com_list, "List files in DIR" },
+ { "ls", com_list, "Synonym for `list'" },
+ { "pwd", com_pwd, "Print the current working directory" },
+ { "quit", com_quit, "Quit using Fileman" },
+ { "rename", com_rename, "Rename FILE to NEWNAME" },
+ { "stat", com_stat, "Print out statistics on FILE" },
+ { "view", com_view, "View the contents of FILE" },
+ { (char *)NULL, (Function *)NULL, (char *)NULL }
+};
+
+/* Forward declarations. */
+char *stripwhite ();
+COMMAND *find_command ();
+
+/* The name of this program, as taken from argv[0]. */
+char *progname;
+
+/* When non-zero, this global means the user is done using this program. */
+int done;
+
+char *
+dupstr (s)
+ int s;
+{
+ char *r;
+
+ r = xmalloc (strlen (s) + 1);
+ strcpy (r, s);
+ return (r);
+}
+
+main (argc, argv)
+ int argc;
+ char **argv;
+{
+ char *line, *s;
+
+ progname = argv[0];
+
+ initialize_readline (); /* Bind our completer. */
+
+ /* Loop reading and executing lines until the user quits. */
+ for ( ; done == 0; )
+ {
+ line = readline ("FileMan: ");
+
+ if (!line)
+ break;
+
+ /* Remove leading and trailing whitespace from the line.
+ Then, if there is anything left, add it to the history list
+ and execute it. */
+ s = stripwhite (line);
+
+ if (*s)
+ {
+ add_history (s);
+ execute_line (s);
+ }
+
+ free (line);
+ }
+ exit (0);
+}
+
+/* Execute a command line. */
+int
+execute_line (line)
+ char *line;
+{
+ register int i;
+ COMMAND *command;
+ char *word;
+
+ /* Isolate the command word. */
+ i = 0;
+ while (line[i] && whitespace (line[i]))
+ i++;
+ word = line + i;
+
+ while (line[i] && !whitespace (line[i]))
+ i++;
+
+ if (line[i])
+ line[i++] = '\0';
+
+ command = find_command (word);
+
+ if (!command)
+ {
+ fprintf (stderr, "%s: No such command for FileMan.\n", word);
+ return (-1);
+ }
+
+ /* Get argument to command, if any. */
+ while (whitespace (line[i]))
+ i++;
+
+ word = line + i;
+
+ /* Call the function. */
+ return ((*(command->func)) (word));
+}
+
+/* Look up NAME as the name of a command, and return a pointer to that
+ command. Return a NULL pointer if NAME isn't a command name. */
+COMMAND *
+find_command (name)
+ char *name;
+{
+ register int i;
+
+ for (i = 0; commands[i].name; i++)
+ if (strcmp (name, commands[i].name) == 0)
+ return (&commands[i]);
+
+ return ((COMMAND *)NULL);
+}
+
+/* Strip whitespace from the start and end of STRING. Return a pointer
+ into STRING. */
+char *
+stripwhite (string)
+ char *string;
+{
+ register char *s, *t;
+
+ for (s = string; whitespace (*s); s++)
+ ;
+
+ if (*s == 0)
+ return (s);
+
+ t = s + strlen (s) - 1;
+ while (t > s && whitespace (*t))
+ t--;
+ *++t = '\0';
+
+ return s;
+}
+
+/* **************************************************************** */
+/* */
+/* Interface to Readline Completion */
+/* */
+/* **************************************************************** */
+
+char *command_generator ();
+char **fileman_completion ();
+
+/* Tell the GNU Readline library how to complete. We want to try to complete
+ on command names if this is the first word in the line, or on filenames
+ if not. */
+initialize_readline ()
+{
+ /* Allow conditional parsing of the ~/.inputrc file. */
+ rl_readline_name = "FileMan";
+
+ /* Tell the completer that we want a crack first. */
+ rl_attempted_completion_function = (CPPFunction *)fileman_completion;
+}
+
+/* Attempt to complete on the contents of TEXT. START and END bound the
+ region of rl_line_buffer that contains the word to complete. TEXT is
+ the word to complete. We can use the entire contents of rl_line_buffer
+ in case we want to do some simple parsing. Return the array of matches,
+ or NULL if there aren't any. */
+char **
+fileman_completion (text, start, end)
+ char *text;
+ int start, end;
+{
+ char **matches;
+
+ matches = (char **)NULL;
+
+ /* If this word is at the start of the line, then it is a command
+ to complete. Otherwise it is the name of a file in the current
+ directory. */
+ if (start == 0)
+ matches = completion_matches (text, command_generator);
+
+ return (matches);
+}
+
+/* Generator function for command completion. STATE lets us know whether
+ to start from scratch; without any state (i.e. STATE == 0), then we
+ start at the top of the list. */
+char *
+command_generator (text, state)
+ char *text;
+ int state;
+{
+ static int list_index, len;
+ char *name;
+
+ /* If this is a new word to complete, initialize now. This includes
+ saving the length of TEXT for efficiency, and initializing the index
+ variable to 0. */
+ if (!state)
+ {
+ list_index = 0;
+ len = strlen (text);
+ }
+
+ /* Return the next name which partially matches from the command list. */
+ while (name = commands[list_index].name)
+ {
+ list_index++;
+
+ if (strncmp (name, text, len) == 0)
+ return (dupstr(name));
+ }
+
+ /* If no names matched, then return NULL. */
+ return ((char *)NULL);
+}
+
+/* **************************************************************** */
+/* */
+/* FileMan Commands */
+/* */
+/* **************************************************************** */
+
+/* String to pass to system (). This is for the LIST, VIEW and RENAME
+ commands. */
+static char syscom[1024];
+
+/* List the file(s) named in arg. */
+com_list (arg)
+ char *arg;
+{
+ if (!arg)
+ arg = "";
+
+ sprintf (syscom, "ls -FClg %s", arg);
+ return (system (syscom));
+}
+
+com_view (arg)
+ char *arg;
+{
+ if (!valid_argument ("view", arg))
+ return 1;
+
+ sprintf (syscom, "more %s", arg);
+ return (system (syscom));
+}
+
+com_rename (arg)
+ char *arg;
+{
+ too_dangerous ("rename");
+ return (1);
+}
+
+com_stat (arg)
+ char *arg;
+{
+ struct stat finfo;
+
+ if (!valid_argument ("stat", arg))
+ return (1);
+
+ if (stat (arg, &finfo) == -1)
+ {
+ perror (arg);
+ return (1);
+ }
+
+ printf ("Statistics for `%s':\n", arg);
+
+ printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
+ finfo.st_nlink,
+ (finfo.st_nlink == 1) ? "" : "s",
+ finfo.st_size,
+ (finfo.st_size == 1) ? "" : "s");
+ printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
+ printf (" Last access at: %s", ctime (&finfo.st_atime));
+ printf (" Last modified at: %s", ctime (&finfo.st_mtime));
+ return (0);
+}
+
+com_delete (arg)
+ char *arg;
+{
+ too_dangerous ("delete");
+ return (1);
+}
+
+/* Print out help for ARG, or for all of the commands if ARG is
+ not present. */
+com_help (arg)
+ char *arg;
+{
+ register int i;
+ int printed = 0;
+
+ for (i = 0; commands[i].name; i++)
+ {
+ if (!*arg || (strcmp (arg, commands[i].name) == 0))
+ {
+ printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
+ printed++;
+ }
+ }
+
+ if (!printed)
+ {
+ printf ("No commands match `%s'. Possibilties are:\n", arg);
+
+ for (i = 0; commands[i].name; i++)
+ {
+ /* Print in six columns. */
+ if (printed == 6)
+ {
+ printed = 0;
+ printf ("\n");
+ }
+
+ printf ("%s\t", commands[i].name);
+ printed++;
+ }
+
+ if (printed)
+ printf ("\n");
+ }
+ return (0);
+}
+
+/* Change to the directory ARG. */
+com_cd (arg)
+ char *arg;
+{
+ if (chdir (arg) == -1)
+ {
+ perror (arg);
+ return 1;
+ }
+
+ com_pwd ("");
+ return (0);
+}
+
+/* Print out the current working directory. */
+com_pwd (ignore)
+ char *ignore;
+{
+ char dir[1024], *s;
+
+ s = getwd (dir);
+ if (s == 0)
+ {
+ printf ("Error getting pwd: %s\n", dir);
+ return 1;
+ }
+
+ printf ("Current directory is %s\n", dir);
+ return 0;
+}
+
+/* The user wishes to quit using this program. Just set DONE non-zero. */
+com_quit (arg)
+ char *arg;
+{
+ done = 1;
+ return (0);
+}
+
+/* Function which tells you that you can't do this. */
+too_dangerous (caller)
+ char *caller;
+{
+ fprintf (stderr,
+ "%s: Too dangerous for me to distribute. Write it yourself.\n",
+ caller);
+}
+
+/* Return non-zero if ARG is a valid argument for CALLER, else print
+ an error message and return zero. */
+int
+valid_argument (caller, arg)
+ char *caller, *arg;
+{
+ if (!arg || !*arg)
+ {
+ fprintf (stderr, "%s: Argument required.\n", caller);
+ return (0);
+ }
+
+ return (1);
+}
+
+
+
+
+
+
+Jump to:
+c
+-
+e
+-
+i
+-
+k
+-
+n
+-
+r
+-
+y
+
+
+
+command editing
+
+
+
+editing command lines
+
+
+
+initialization file, readline
+interaction, readline
+
+
+
+kill ring
+killing text
+
+
+
+notation, readline
+
+
+
+readline, function
+
+
+
+yanking text
+
+
+
+
+
+
+
+Jump to:
+(
+-
+a
+-
+b
+-
+c
+-
+d
+-
+e
+-
+f
+-
+h
+-
+i
+-
+k
+-
+l
+-
+m
+-
+n
+-
+o
+-
+p
+-
+q
+-
+r
+-
+s
+-
+t
+-
+u
+-
+v
+-
+y
+
+
+
+(int
+
+
+
+abort (C-g)
+accept-line (Newline, Return)
+alphabetic
+
+
+
+backward-char (C-b)
+backward-delete-char (Rubout)
+backward-kill-line (C-x Rubout)
+backward-kill-word (M-DEL)
+backward-word (M-b)
+beginning-of-history (M-<)
+beginning-of-line (C-a)
+bell-style
+
+
+
+call-last-kbd-macro (C-x e)
+capitalize-word (M-c)
+character-search (C-])
+character-search-backward (M-C-])
+clear-screen (C-l)
+comment-begin
+complete (TAB)
+completion-query-items
+completion_matches
+convert-meta
+copy-backward-word ()
+copy-forward-word ()
+copy-region-as-kill ()
+
+
+
+delete-char (C-d)
+delete-char-or-list ()
+delete-horizontal-space ()
+digit-argument (M-0, M-1, ... M--)
+digit_p
+digit_value
+ding
+disable-completion
+do-uppercase-version (M-a, M-b, M-x, ...)
+downcase-word (M-l)
+dump-functions ()
+dump-macros ()
+dump-variables ()
+
+
+
+editing-mode
+enable-keypad
+end-kbd-macro (C-x ))
+end-of-history (M->)
+end-of-line (C-e)
+exchange-point-and-mark (C-x C-x)
+expand-tilde
+
+
+
+filename_completion_function
+forward-backward-delete-char ()
+forward-char (C-f)
+forward-search-history (C-s)
+forward-word (M-f)
+free_undo_list
+
+
+
+history-search-backward ()
+history-search-forward ()
+horizontal-scroll-mode
+
+
+
+input-meta
+insert-comment (M-#)
+insert-completions (M-*)
+isearch-terminators
+
+
+
+keymap
+kill-line (C-k)
+kill-region ()
+kill-whole-line ()
+kill-word (M-d)
+
+
+
+lowercase_p
+
+
+
+mark-modified-lines
+menu-complete ()
+meta-flag
+
+
+
+next-history (C-n)
+non-incremental-forward-search-history (M-n)
+non-incremental-reverse-search-history (M-p)
+numeric
+
+
+
+output-meta
+
+
+
+possible-completions (M-?)
+prefix-meta (ESC)
+previous-history (C-p)
+
+
+
+quoted-insert (C-q, C-v)
+
+
+
+re-read-init-file (C-x C-r)
+readline
+redraw-current-line ()
+reverse-search-history (C-r)
+revert-line (M-r)
+rl_add_defun
+rl_add_undo
+rl_attempted_completion_function
+rl_basic_quote_characters
+rl_basic_word_break_characters
+rl_begin_undo_group
+rl_bind_key
+rl_bind_key_in_map
+rl_binding_keymap
+rl_callback_handler_install
+rl_callback_handler_remove
+rl_callback_read_char
+rl_catch_signals
+rl_catch_sigwinch
+rl_char_is_quoted_p
+rl_cleanup_after_signal
+rl_clear_message
+rl_clear_signals
+rl_complete, rl_complete
+rl_complete_internal
+rl_completer_quote_characters
+rl_completer_word_break_characters
+rl_completion_append_character
+rl_completion_display_matches_hook
+rl_completion_entry_function, rl_completion_entry_function
+rl_completion_query_items
+rl_copy_keymap
+rl_copy_text
+rl_delete_text
+rl_directory_completion_hook
+rl_discard_keymap
+rl_display_match_list
+rl_do_undo
+rl_done
+rl_end
+rl_end_undo_group
+rl_erase_empty_line
+rl_event_hook
+rl_executing_keymap
+rl_filename_completion_desired
+rl_filename_dequoting_function
+rl_filename_quote_characters
+rl_filename_quoting_desired
+rl_filename_quoting_function
+rl_forced_update_display
+rl_free_line_state
+rl_function_dumper
+rl_function_of_keyseq
+rl_generic_bind
+rl_get_keymap
+rl_get_keymap_by_name
+rl_get_keymap_name
+rl_getc
+rl_getc_function
+rl_ignore_completion_duplicates
+rl_ignore_some_completions_function
+rl_inhibit_completion
+rl_initialize
+rl_insert_completions
+rl_insert_text
+rl_instream
+rl_invoking_keyseqs
+rl_invoking_keyseqs_in_map
+rl_kill_text
+rl_library_version
+rl_line_buffer
+rl_list_funmap_names
+rl_make_bare_keymap
+rl_make_keymap
+rl_mark
+rl_message
+rl_modifying
+rl_named_function
+rl_on_new_line
+rl_outstream
+rl_parse_and_bind
+rl_pending_input
+rl_point
+rl_possible_completions
+rl_pre_input_hook
+rl_prompt
+rl_read_init_file
+rl_read_key
+rl_readline_name
+rl_redisplay
+rl_redisplay_function
+rl_reset_after_signal
+rl_reset_line_state
+rl_reset_terminal
+rl_resize_terminal
+rl_restore_prompt
+rl_save_prompt
+rl_set_keymap
+rl_set_signals
+rl_special_prefixes
+rl_startup_hook
+rl_stuff_char
+rl_terminal_name
+rl_unbind_command_in_map
+rl_unbind_function_in_map
+rl_unbind_key
+rl_unbind_key_in_map
+
+
+
+self-insert (a, b, A, 1, !, ...)
+set-mark (C-@)
+show-all-if-ambiguous
+start-kbd-macro (C-x ()
+
+
+
+tab-insert (M-TAB)
+tilde-expand (M-~)
+to_lower
+to_upper
+transpose-chars (C-t)
+transpose-words (M-t)
+
+
+
+undo (C-_, C-x C-u)
+universal-argument ()
+unix-line-discard (C-u)
+unix-word-rubout (C-w)
+upcase-word (M-u)
+uppercase_p
+username_completion_function
+
+
+
+visible-stats
+
+
+
+yank (C-y)
+yank-last-arg (M-., M-_)
+yank-nth-arg (M-C-y)
+yank-pop (M-y)
+
+
+
+
+This document was generated on 31 December 1998 using the
+texi2html
+translator version 1.52.
+
+
diff --git a/readline/doc/readline.info b/readline/doc/readline.info
new file mode 100644
index 00000000000..1aa2848be1c
--- /dev/null
+++ b/readline/doc/readline.info
@@ -0,0 +1,3039 @@
+This is Info file readline.info, produced by Makeinfo version 1.67 from
+the input file /usr/homes/chet/src/bash/readline-src/doc/rlman.texinfo.
+
+INFO-DIR-SECTION Libraries
+START-INFO-DIR-ENTRY
+* Readline: (readline). The GNU readline library API
+END-INFO-DIR-ENTRY
+
+ This document describes the GNU Readline Library, a utility which
+aids in the consistency of user interface across discrete programs that
+need to provide a command line interface.
+
+ Copyright (C) 1988-1999 Free Software Foundation, Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice pare
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Free Software Foundation.
+
+
+File: readline.info, Node: Top, Next: Command Line Editing, Up: (dir)
+
+GNU Readline Library
+********************
+
+ This document describes the GNU Readline Library, a utility which
+aids in the consistency of user interface across discrete programs that
+need to provide a command line interface.
+
+* Menu:
+
+* Command Line Editing:: GNU Readline User's Manual.
+* Programming with GNU Readline:: GNU Readline Programmer's Manual.
+* Concept Index:: Index of concepts described in this manual.
+* Function and Variable Index:: Index of externally visible functions
+ and variables.
+
+
+File: readline.info, Node: Command Line Editing, Next: Programming with GNU Readline, Prev: Top, Up: Top
+
+Command Line Editing
+********************
+
+ This chapter describes the basic features of the GNU command line
+editing interface.
+
+* Menu:
+
+* Introduction and Notation:: Notation used in this text.
+* Readline Interaction:: The minimum set of commands for editing a line.
+* Readline Init File:: Customizing Readline from a user's view.
+* Bindable Readline Commands:: A description of most of the Readline commands
+ available for binding
+* Readline vi Mode:: A short description of how to make Readline
+ behave like the vi editor.
+
+
+File: readline.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
+
+Introduction to Line Editing
+============================
+
+ The following paragraphs describe the notation used to represent
+keystrokes.
+
+ The text is read as `Control-K' and describes the character
+produced when the key is pressed while the Control key is depressed.
+
+ The text is read as `Meta-K' and describes the character
+produced when the meta key (if you have one) is depressed, and the
+key is pressed. If you do not have a meta key, the identical keystroke
+can be generated by typing first, and then typing . Either
+process is known as "metafying" the key.
+
+ The text is read as `Meta-Control-k' and describes the
+character produced by "metafying" .
+
+ In addition, several keys have their own names. Specifically,
+, , , , , and all stand for themselves
+when seen in this text, or in an init file (*note Readline Init
+File::.).
+
+
+File: readline.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
+
+Readline Interaction
+====================
+
+ Often during an interactive session you type in a long line of text,
+only to notice that the first word on the line is misspelled. The
+Readline library gives you a set of commands for manipulating the text
+as you type it in, allowing you to just fix your typo, and not forcing
+you to retype the majority of the line. Using these editing commands,
+you move the cursor to the place that needs correction, and delete or
+insert the text of the corrections. Then, when you are satisfied with
+the line, you simply press . You do not have to be at the end
+of the line to press ; the entire line is accepted regardless
+of the location of the cursor within the line.
+
+* Menu:
+
+* Readline Bare Essentials:: The least you need to know about Readline.
+* Readline Movement Commands:: Moving about the input line.
+* Readline Killing Commands:: How to delete text, and how to get it back!
+* Readline Arguments:: Giving numeric arguments to commands.
+* Searching:: Searching through previous lines.
+
+
+File: readline.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
+
+Readline Bare Essentials
+------------------------
+
+ In order to enter characters into the line, simply type them. The
+typed character appears where the cursor was, and then the cursor moves
+one space to the right. If you mistype a character, you can use your
+erase character to back up and delete the mistyped character.
+
+ Sometimes you may miss typing a character that you wanted to type,
+and not notice your error until you have typed several other
+characters. In that case, you can type to move the cursor to the
+left, and then correct your mistake. Afterwards, you can move the
+cursor to the right with .
+
+ When you add text in the middle of a line, you will notice that
+characters to the right of the cursor are `pushed over' to make room
+for the text that you have inserted. Likewise, when you delete text
+behind the cursor, characters to the right of the cursor are `pulled
+back' to fill in the blank space created by the removal of the text. A
+list of the basic bare essentials for editing the text of an input line
+follows.
+
+
+ Move back one character.
+
+
+ Move forward one character.
+
+
+ Delete the character to the left of the cursor.
+
+
+ Delete the character underneath the cursor.
+
+Printing characters
+ Insert the character into the line at the cursor.
+
+
+ Undo the last editing command. You can undo all the way back to an
+ empty line.
+
+
+File: readline.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
+
+Readline Movement Commands
+--------------------------
+
+ The above table describes the most basic possible keystrokes that
+you need in order to do editing of the input line. For your
+convenience, many other commands have been added in addition to ,
+, , and . Here are some commands for moving more rapidly
+about the line.
+
+
+ Move to the start of the line.
+
+
+ Move to the end of the line.
+
+
+ Move forward a word, where a word is composed of letters and
+ digits.
+
+
+ Move backward a word.
+
+
+ Clear the screen, reprinting the current line at the top.
+
+ Notice how moves forward a character, while moves
+forward a word. It is a loose convention that control keystrokes
+operate on characters while meta keystrokes operate on words.
+
+
+File: readline.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
+
+Readline Killing Commands
+-------------------------
+
+ "Killing" text means to delete the text from the line, but to save
+it away for later use, usually by "yanking" (re-inserting) it back into
+the line. If the description for a command says that it `kills' text,
+then you can be sure that you can get the text back in a different (or
+the same) place later.
+
+ When you use a kill command, the text is saved in a "kill-ring".
+Any number of consecutive kills save all of the killed text together, so
+that when you yank it back, you get it all. The kill ring is not line
+specific; the text that you killed on a previously typed line is
+available to be yanked back later, when you are typing another line.
+
+ Here is the list of commands for killing text.
+
+
+ Kill the text from the current cursor position to the end of the
+ line.
+
+
+ Kill from the cursor to the end of the current word, or if between
+ words, to the end of the next word.
+
+
+ Kill from the cursor the start of the previous word, or if between
+ words, to the start of the previous word.
+
+
+ Kill from the cursor to the previous whitespace. This is
+ different than because the word boundaries differ.
+
+ Here is how to "yank" the text back into the line. Yanking means to
+copy the most-recently-killed text from the kill buffer.
+
+
+ Yank the most recently killed text back into the buffer at the
+ cursor.
+
+
+ Rotate the kill-ring, and yank the new top. You can only do this
+ if the prior command is or .
+
+
+File: readline.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
+
+Readline Arguments
+------------------
+
+ You can pass numeric arguments to Readline commands. Sometimes the
+argument acts as a repeat count, other times it is the sign of the
+argument that is significant. If you pass a negative argument to a
+command which normally acts in a forward direction, that command will
+act in a backward direction. For example, to kill text back to the
+start of the line, you might type `M-- C-k'.
+
+ The general way to pass numeric arguments to a command is to type
+meta digits before the command. If the first `digit' typed is a minus
+sign (<->), then the sign of the argument will be negative. Once you
+have typed one meta digit to get the argument started, you can type the
+remainder of the digits, and then the command. For example, to give
+the command an argument of 10, you could type `M-1 0 C-d'.
+
+
+File: readline.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
+
+Searching for Commands in the History
+-------------------------------------
+
+ Readline provides commands for searching through the command history
+for lines containing a specified string. There are two search modes:
+INCREMENTAL and NON-INCREMENTAL.
+
+ Incremental searches begin before the user has finished typing the
+search string. As each character of the search string is typed,
+Readline displays the next entry from the history matching the string
+typed so far. An incremental search requires only as many characters
+as needed to find the desired history entry. The characters present in
+the value of the ISEARCH-TERMINATORS variable are used to terminate an
+incremental search. If that variable has not been assigned a value,
+the and characters will terminate an incremental search.
+ will abort an incremental search and restore the original line.
+When the search is terminated, the history entry containing the search
+string becomes the current line. To find other matching entries in the
+history list, type or as appropriate. This will search
+backward or forward in the history for the next entry matching the
+search string typed so far. Any other key sequence bound to a Readline
+command will terminate the search and execute that command. For
+instance, a will terminate the search and accept the line,
+thereby executing the command from the history list.
+
+ Non-incremental searches read the entire search string before
+starting to search for matching history lines. The search string may be
+typed by the user or be part of the contents of the current line.
+
+
+File: readline.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
+
+Readline Init File
+==================
+
+ Although the Readline library comes with a set of `emacs'-like
+keybindings installed by default, it is possible to use a different set
+of keybindings. Any user can customize programs that use Readline by
+putting commands in an "inputrc" file in his home directory. The name
+of this file is taken from the value of the environment variable
+`INPUTRC'. If that variable is unset, the default is `~/.inputrc'.
+
+ When a program which uses the Readline library starts up, the init
+file is read, and the key bindings are set.
+
+ In addition, the `C-x C-r' command re-reads this init file, thus
+incorporating any changes that you might have made to it.
+
+* Menu:
+
+* Readline Init File Syntax:: Syntax for the commands in the inputrc file.
+
+* Conditional Init Constructs:: Conditional key bindings in the inputrc file.
+
+* Sample Init File:: An example inputrc file.
+
+
+File: readline.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
+
+Readline Init File Syntax
+-------------------------
+
+ There are only a few basic constructs allowed in the Readline init
+file. Blank lines are ignored. Lines beginning with a `#' are
+comments. Lines beginning with a `$' indicate conditional constructs
+(*note Conditional Init Constructs::.). Other lines denote variable
+settings and key bindings.
+
+Variable Settings
+ You can modify the run-time behavior of Readline by altering the
+ values of variables in Readline using the `set' command within the
+ init file. Here is how to change from the default Emacs-like key
+ binding to use `vi' line editing commands:
+
+ set editing-mode vi
+
+ A great deal of run-time behavior is changeable with the following
+ variables.
+
+ `bell-style'
+ Controls what happens when Readline wants to ring the
+ terminal bell. If set to `none', Readline never rings the
+ bell. If set to `visible', Readline uses a visible bell if
+ one is available. If set to `audible' (the default),
+ Readline attempts to ring the terminal's bell.
+
+ `comment-begin'
+ The string to insert at the beginning of the line when the
+ `insert-comment' command is executed. The default value is
+ `"#"'.
+
+ `completion-ignore-case'
+ If set to `on', Readline performs filename matching and
+ completion in a case-insensitive fashion. The default value
+ is `off'.
+
+ `completion-query-items'
+ The number of possible completions that determines when the
+ user is asked whether he wants to see the list of
+ possibilities. If the number of possible completions is
+ greater than this value, Readline will ask the user whether
+ or not he wishes to view them; otherwise, they are simply
+ listed. The default limit is `100'.
+
+ `convert-meta'
+ If set to `on', Readline will convert characters with the
+ eighth bit set to an ASCII key sequence by stripping the
+ eighth bit and prepending an character, converting them
+ to a meta-prefixed key sequence. The default value is `on'.
+
+ `disable-completion'
+ If set to `On', Readline will inhibit word completion.
+ Completion characters will be inserted into the line as if
+ they had been mapped to `self-insert'. The default is `off'.
+
+ `editing-mode'
+ The `editing-mode' variable controls which default set of key
+ bindings is used. By default, Readline starts up in Emacs
+ editing mode, where the keystrokes are most similar to Emacs.
+ This variable can be set to either `emacs' or `vi'.
+
+ `enable-keypad'
+ When set to `on', Readline will try to enable the application
+ keypad when it is called. Some systems need this to enable
+ the arrow keys. The default is `off'.
+
+ `expand-tilde'
+ If set to `on', tilde expansion is performed when Readline
+ attempts word completion. The default is `off'.
+
+ `horizontal-scroll-mode'
+ This variable can be set to either `on' or `off'. Setting it
+ to `on' means that the text of the lines being edited will
+ scroll horizontally on a single screen line when they are
+ longer than the width of the screen, instead of wrapping onto
+ a new screen line. By default, this variable is set to `off'.
+
+ `input-meta'
+ If set to `on', Readline will enable eight-bit input (it will
+ not strip the eighth bit from the characters it reads),
+ regardless of what the terminal claims it can support. The
+ default value is `off'. The name `meta-flag' is a synonym
+ for this variable.
+
+ `isearch-terminators'
+ The string of characters that should terminate an incremental
+ search without subsequently executing the character as a
+ command (*note Searching::.). If this variable has not been
+ given a value, the characters and will terminate
+ an incremental search.
+
+ `keymap'
+ Sets Readline's idea of the current keymap for key binding
+ commands. Acceptable `keymap' names are `emacs',
+ `emacs-standard', `emacs-meta', `emacs-ctlx', `vi',
+ `vi-command', and `vi-insert'. `vi' is equivalent to
+ `vi-command'; `emacs' is equivalent to `emacs-standard'. The
+ default value is `emacs'. The value of the `editing-mode'
+ variable also affects the default keymap.
+
+ `mark-directories'
+ If set to `on', completed directory names have a slash
+ appended. The default is `on'.
+
+ `mark-modified-lines'
+ This variable, when set to `on', causes Readline to display an
+ asterisk (`*') at the start of history lines which have been
+ modified. This variable is `off' by default.
+
+ `output-meta'
+ If set to `on', Readline will display characters with the
+ eighth bit set directly rather than as a meta-prefixed escape
+ sequence. The default is `off'.
+
+ `print-completions-horizontally'
+ If set to `on', Readline will display completions with matches
+ sorted horizontally in alphabetical order, rather than down
+ the screen. The default is `off'.
+
+ `show-all-if-ambiguous'
+ This alters the default behavior of the completion functions.
+ If set to `on', words which have more than one possible
+ completion cause the matches to be listed immediately instead
+ of ringing the bell. The default value is `off'.
+
+ `visible-stats'
+ If set to `on', a character denoting a file's type is
+ appended to the filename when listing possible completions.
+ The default is `off'.
+
+Key Bindings
+ The syntax for controlling key bindings in the init file is
+ simple. First you have to know the name of the command that you
+ want to change. The following sections contain tables of the
+ command name, the default keybinding, if any, and a short
+ description of what the command does.
+
+ Once you know the name of the command, simply place the name of
+ the key you wish to bind the command to, a colon, and then the
+ name of the command on a line in the init file. The name of the
+ key can be expressed in different ways, depending on which is most
+ comfortable for you.
+
+ KEYNAME: FUNCTION-NAME or MACRO
+ KEYNAME is the name of a key spelled out in English. For
+ example:
+ Control-u: universal-argument
+ Meta-Rubout: backward-kill-word
+ Control-o: "> output"
+
+ In the above example, is bound to the function
+ `universal-argument', and is bound to run the macro
+ expressed on the right hand side (that is, to insert the text
+ `> output' into the line).
+
+ "KEYSEQ": FUNCTION-NAME or MACRO
+ KEYSEQ differs from KEYNAME above in that strings denoting an
+ entire key sequence can be specified, by placing the key
+ sequence in double quotes. Some GNU Emacs style key escapes
+ can be used, as in the following example, but the special
+ character names are not recognized.
+
+ "\C-u": universal-argument
+ "\C-x\C-r": re-read-init-file
+ "\e[11~": "Function Key 1"
+
+ In the above example, is bound to the function
+ `universal-argument' (just as it was in the first example),
+ ` ' is bound to the function `re-read-init-file',
+ and ` <[> <1> <1> <~>' is bound to insert the text
+ `Function Key 1'.
+
+ The following GNU Emacs style escape sequences are available when
+ specifying key sequences:
+
+ `\C-'
+ control prefix
+
+ `\M-'
+ meta prefix
+
+ `\e'
+ an escape character
+
+ `\\'
+ backslash
+
+ `\"'
+ <">
+
+ `\''
+ <'>
+
+ In addition to the GNU Emacs style escape sequences, a second set
+ of backslash escapes is available:
+
+ `\a'
+ alert (bell)
+
+ `\b'
+ backspace
+
+ `\d'
+ delete
+
+ `\f'
+ form feed
+
+ `\n'
+ newline
+
+ `\r'
+ carriage return
+
+ `\t'
+ horizontal tab
+
+ `\v'
+ vertical tab
+
+ `\NNN'
+ the character whose ASCII code is the octal value NNN (one to
+ three digits)
+
+ `\xNNN'
+ the character whose ASCII code is the hexadecimal value NNN
+ (one to three digits)
+
+ When entering the text of a macro, single or double quotes must be
+ used to indicate a macro definition. Unquoted text is assumed to
+ be a function name. In the macro body, the backslash escapes
+ described above are expanded. Backslash will quote any other
+ character in the macro text, including `"' and `''. For example,
+ the following binding will make `C-x \' insert a single `\' into
+ the line:
+ "\C-x\\": "\\"
+
+
+File: readline.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
+
+Conditional Init Constructs
+---------------------------
+
+ Readline implements a facility similar in spirit to the conditional
+compilation features of the C preprocessor which allows key bindings
+and variable settings to be performed as the result of tests. There
+are four parser directives used.
+
+`$if'
+ The `$if' construct allows bindings to be made based on the
+ editing mode, the terminal being used, or the application using
+ Readline. The text of the test extends to the end of the line; no
+ characters are required to isolate it.
+
+ `mode'
+ The `mode=' form of the `$if' directive is used to test
+ whether Readline is in `emacs' or `vi' mode. This may be
+ used in conjunction with the `set keymap' command, for
+ instance, to set bindings in the `emacs-standard' and
+ `emacs-ctlx' keymaps only if Readline is starting out in
+ `emacs' mode.
+
+ `term'
+ The `term=' form may be used to include terminal-specific key
+ bindings, perhaps to bind the key sequences output by the
+ terminal's function keys. The word on the right side of the
+ `=' is tested against both the full name of the terminal and
+ the portion of the terminal name before the first `-'. This
+ allows `sun' to match both `sun' and `sun-cmd', for instance.
+
+ `application'
+ The APPLICATION construct is used to include
+ application-specific settings. Each program using the
+ Readline library sets the APPLICATION NAME, and you can test
+ for it. This could be used to bind key sequences to
+ functions useful for a specific program. For instance, the
+ following command adds a key sequence that quotes the current
+ or previous word in Bash:
+ $if Bash
+ # Quote the current or previous word
+ "\C-xq": "\eb\"\ef\""
+ $endif
+
+`$endif'
+ This command, as seen in the previous example, terminates an `$if'
+ command.
+
+`$else'
+ Commands in this branch of the `$if' directive are executed if the
+ test fails.
+
+`$include'
+ This directive takes a single filename as an argument and reads
+ commands and bindings from that file.
+ $include /etc/inputrc
+
+
+File: readline.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
+
+Sample Init File
+----------------
+
+ Here is an example of an inputrc file. This illustrates key
+binding, variable assignment, and conditional syntax.
+
+
+ # This file controls the behaviour of line input editing for
+ # programs that use the Gnu Readline library. Existing programs
+ # include FTP, Bash, and Gdb.
+ #
+ # You can re-read the inputrc file with C-x C-r.
+ # Lines beginning with '#' are comments.
+ #
+ # First, include any systemwide bindings and variable assignments from
+ # /etc/Inputrc
+ $include /etc/Inputrc
+
+ #
+ # Set various bindings for emacs mode.
+
+ set editing-mode emacs
+
+ $if mode=emacs
+
+ Meta-Control-h: backward-kill-word Text after the function name is ignored
+
+ #
+ # Arrow keys in keypad mode
+ #
+ #"\M-OD": backward-char
+ #"\M-OC": forward-char
+ #"\M-OA": previous-history
+ #"\M-OB": next-history
+ #
+ # Arrow keys in ANSI mode
+ #
+ "\M-[D": backward-char
+ "\M-[C": forward-char
+ "\M-[A": previous-history
+ "\M-[B": next-history
+ #
+ # Arrow keys in 8 bit keypad mode
+ #
+ #"\M-\C-OD": backward-char
+ #"\M-\C-OC": forward-char
+ #"\M-\C-OA": previous-history
+ #"\M-\C-OB": next-history
+ #
+ # Arrow keys in 8 bit ANSI mode
+ #
+ #"\M-\C-[D": backward-char
+ #"\M-\C-[C": forward-char
+ #"\M-\C-[A": previous-history
+ #"\M-\C-[B": next-history
+
+ C-q: quoted-insert
+
+ $endif
+
+ # An old-style binding. This happens to be the default.
+ TAB: complete
+
+ # Macros that are convenient for shell interaction
+ $if Bash
+ # edit the path
+ "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
+ # prepare to type a quoted word -- insert open and close double quotes
+ # and move to just after the open quote
+ "\C-x\"": "\"\"\C-b"
+ # insert a backslash (testing backslash escapes in sequences and macros)
+ "\C-x\\": "\\"
+ # Quote the current or previous word
+ "\C-xq": "\eb\"\ef\""
+ # Add a binding to refresh the line, which is unbound
+ "\C-xr": redraw-current-line
+ # Edit variable on current line.
+ "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
+ $endif
+
+ # use a visible bell if one is available
+ set bell-style visible
+
+ # don't strip characters to 7 bits when reading
+ set input-meta on
+
+ # allow iso-latin1 characters to be inserted rather than converted to
+ # prefix-meta sequences
+ set convert-meta off
+
+ # display characters with the eighth bit set directly rather than
+ # as meta-prefixed characters
+ set output-meta on
+
+ # if there are more than 150 possible completions for a word, ask the
+ # user if he wants to see all of them
+ set completion-query-items 150
+
+ # For FTP
+ $if Ftp
+ "\C-xg": "get \M-?"
+ "\C-xt": "put \M-?"
+ "\M-.": yank-last-arg
+ $endif
+
+
+File: readline.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
+
+Bindable Readline Commands
+==========================
+
+* Menu:
+
+* Commands For Moving:: Moving about the line.
+* Commands For History:: Getting at previous lines.
+* Commands For Text:: Commands for changing text.
+* Commands For Killing:: Commands for killing and yanking.
+* Numeric Arguments:: Specifying numeric arguments, repeat counts.
+* Commands For Completion:: Getting Readline to do the typing for you.
+* Keyboard Macros:: Saving and re-executing typed characters
+* Miscellaneous Commands:: Other miscellaneous commands.
+
+ This section describes Readline commands that may be bound to key
+sequences.
+
+
+File: readline.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
+
+Commands For Moving
+-------------------
+
+`beginning-of-line (C-a)'
+ Move to the start of the current line.
+
+`end-of-line (C-e)'
+ Move to the end of the line.
+
+`forward-char (C-f)'
+ Move forward a character.
+
+`backward-char (C-b)'
+ Move back a character.
+
+`forward-word (M-f)'
+ Move forward to the end of the next word. Words are composed of
+ letters and digits.
+
+`backward-word (M-b)'
+ Move back to the start of this, or the previous, word. Words are
+ composed of letters and digits.
+
+`clear-screen (C-l)'
+ Clear the screen and redraw the current line, leaving the current
+ line at the top of the screen.
+
+`redraw-current-line ()'
+ Refresh the current line. By default, this is unbound.
+
+
+File: readline.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
+
+Commands For Manipulating The History
+-------------------------------------
+
+`accept-line (Newline, Return)'
+ Accept the line regardless of where the cursor is. If this line is
+ non-empty, add it to the history list. If this line was a history
+ line, then restore the history line to its original state.
+
+`previous-history (C-p)'
+ Move `up' through the history list.
+
+`next-history (C-n)'
+ Move `down' through the history list.
+
+`beginning-of-history (M-<)'
+ Move to the first line in the history.
+
+`end-of-history (M->)'
+ Move to the end of the input history, i.e., the line currently
+ being entered.
+
+`reverse-search-history (C-r)'
+ Search backward starting at the current line and moving `up'
+ through the history as necessary. This is an incremental search.
+
+`forward-search-history (C-s)'
+ Search forward starting at the current line and moving `down'
+ through the the history as necessary. This is an incremental
+ search.
+
+`non-incremental-reverse-search-history (M-p)'
+ Search backward starting at the current line and moving `up'
+ through the history as necessary using a non-incremental search
+ for a string supplied by the user.
+
+`non-incremental-forward-search-history (M-n)'
+ Search forward starting at the current line and moving `down'
+ through the the history as necessary using a non-incremental search
+ for a string supplied by the user.
+
+`history-search-forward ()'
+ Search forward through the history for the string of characters
+ between the start of the current line and the current cursor
+ position (the POINT). This is a non-incremental search. By
+ default, this command is unbound.
+
+`history-search-backward ()'
+ Search backward through the history for the string of characters
+ between the start of the current line and the point. This is a
+ non-incremental search. By default, this command is unbound.
+
+`yank-nth-arg (M-C-y)'
+ Insert the first argument to the previous command (usually the
+ second word on the previous line). With an argument N, insert the
+ Nth word from the previous command (the words in the previous
+ command begin with word 0). A negative argument inserts the Nth
+ word from the end of the previous command.
+
+`yank-last-arg (M-., M-_)'
+ Insert last argument to the previous command (the last word of the
+ previous history entry). With an argument, behave exactly like
+ `yank-nth-arg'. Successive calls to `yank-last-arg' move back
+ through the history list, inserting the last argument of each line
+ in turn.
+
+
+File: readline.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
+
+Commands For Changing Text
+--------------------------
+
+`delete-char (C-d)'
+ Delete the character under the cursor. If the cursor is at the
+ beginning of the line, there are no characters in the line, and
+ the last character typed was not bound to `delete-char', then
+ return `EOF'.
+
+`backward-delete-char (Rubout)'
+ Delete the character behind the cursor. A numeric argument means
+ to kill the characters instead of deleting them.
+
+`forward-backward-delete-char ()'
+ Delete the character under the cursor, unless the cursor is at the
+ end of the line, in which case the character behind the cursor is
+ deleted. By default, this is not bound to a key.
+
+`quoted-insert (C-q, C-v)'
+ Add the next character typed to the line verbatim. This is how to
+ insert key sequences like , for example.
+
+`tab-insert (M-TAB)'
+ Insert a tab character.
+
+`self-insert (a, b, A, 1, !, ...)'
+ Insert yourself.
+
+`transpose-chars (C-t)'
+ Drag the character before the cursor forward over the character at
+ the cursor, moving the cursor forward as well. If the insertion
+ point is at the end of the line, then this transposes the last two
+ characters of the line. Negative arguments don't work.
+
+`transpose-words (M-t)'
+ Drag the word behind the cursor past the word in front of the
+ cursor moving the cursor over that word as well.
+
+`upcase-word (M-u)'
+ Uppercase the current (or following) word. With a negative
+ argument, uppercase the previous word, but do not move the cursor.
+
+`downcase-word (M-l)'
+ Lowercase the current (or following) word. With a negative
+ argument, lowercase the previous word, but do not move the cursor.
+
+`capitalize-word (M-c)'
+ Capitalize the current (or following) word. With a negative
+ argument, capitalize the previous word, but do not move the cursor.
+
+
+File: readline.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
+
+Killing And Yanking
+-------------------
+
+`kill-line (C-k)'
+ Kill the text from the current cursor position to the end of the
+ line.
+
+`backward-kill-line (C-x Rubout)'
+ Kill backward to the beginning of the line.
+
+`unix-line-discard (C-u)'
+ Kill backward from the cursor to the beginning of the current line.
+ The killed text is saved on the kill-ring.
+
+`kill-whole-line ()'
+ Kill all characters on the current line, no matter where the
+ cursor is. By default, this is unbound.
+
+`kill-word (M-d)'
+ Kill from the cursor to the end of the current word, or if between
+ words, to the end of the next word. Word boundaries are the same
+ as `forward-word'.
+
+`backward-kill-word (M-DEL)'
+ Kill the word behind the cursor. Word boundaries are the same as
+ `backward-word'.
+
+`unix-word-rubout (C-w)'
+ Kill the word behind the cursor, using white space as a word
+ boundary. The killed text is saved on the kill-ring.
+
+`delete-horizontal-space ()'
+ Delete all spaces and tabs around point. By default, this is
+ unbound.
+
+`kill-region ()'
+ Kill the text between the point and the *mark* (saved cursor
+ position). This text is referred to as the REGION. By default,
+ this command is unbound.
+
+`copy-region-as-kill ()'
+ Copy the text in the region to the kill buffer, so it can be yanked
+ right away. By default, this command is unbound.
+
+`copy-backward-word ()'
+ Copy the word before point to the kill buffer. The word
+ boundaries are the same as `backward-word'. By default, this
+ command is unbound.
+
+`copy-forward-word ()'
+ Copy the word following point to the kill buffer. The word
+ boundaries are the same as `forward-word'. By default, this
+ command is unbound.
+
+`yank (C-y)'
+ Yank the top of the kill ring into the buffer at the current
+ cursor position.
+
+`yank-pop (M-y)'
+ Rotate the kill-ring, and yank the new top. You can only do this
+ if the prior command is yank or yank-pop.
+
+
+File: readline.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
+
+Specifying Numeric Arguments
+----------------------------
+
+`digit-argument (M-0, M-1, ... M--)'
+ Add this digit to the argument already accumulating, or start a new
+ argument. starts a negative argument.
+
+`universal-argument ()'
+ This is another way to specify an argument. If this command is
+ followed by one or more digits, optionally with a leading minus
+ sign, those digits define the argument. If the command is
+ followed by digits, executing `universal-argument' again ends the
+ numeric argument, but is otherwise ignored. As a special case, if
+ this command is immediately followed by a character that is
+ neither a digit or minus sign, the argument count for the next
+ command is multiplied by four. The argument count is initially
+ one, so executing this function the first time makes the argument
+ count four, a second time makes the argument count sixteen, and so
+ on. By default, this is not bound to a key.
+
+
+File: readline.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
+
+Letting Readline Type For You
+-----------------------------
+
+`complete (TAB)'
+ Attempt to do completion on the text before the cursor. This is
+ application-specific. Generally, if you are typing a filename
+ argument, you can do filename completion; if you are typing a
+ command, you can do command completion; if you are typing in a
+ symbol to GDB, you can do symbol name completion; if you are
+ typing in a variable to Bash, you can do variable name completion,
+ and so on.
+
+`possible-completions (M-?)'
+ List the possible completions of the text before the cursor.
+
+`insert-completions (M-*)'
+ Insert all completions of the text before point that would have
+ been generated by `possible-completions'.
+
+`menu-complete ()'
+ Similar to `complete', but replaces the word to be completed with
+ a single match from the list of possible completions. Repeated
+ execution of `menu-complete' steps through the list of possible
+ completions, inserting each match in turn. At the end of the list
+ of completions, the bell is rung and the original text is restored.
+ An argument of N moves N positions forward in the list of matches;
+ a negative argument may be used to move backward through the list.
+ This command is intended to be bound to `TAB', but is unbound by
+ default.
+
+`delete-char-or-list ()'
+ Deletes the character under the cursor if not at the beginning or
+ end of the line (like `delete-char'). If at the end of the line,
+ behaves identically to `possible-completions'. This command is
+ unbound by default.
+
+
+File: readline.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
+
+Keyboard Macros
+---------------
+
+`start-kbd-macro (C-x ()'
+ Begin saving the characters typed into the current keyboard macro.
+
+`end-kbd-macro (C-x ))'
+ Stop saving the characters typed into the current keyboard macro
+ and save the definition.
+
+`call-last-kbd-macro (C-x e)'
+ Re-execute the last keyboard macro defined, by making the
+ characters in the macro appear as if typed at the keyboard.
+
+
+File: readline.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
+
+Some Miscellaneous Commands
+---------------------------
+
+`re-read-init-file (C-x C-r)'
+ Read in the contents of the inputrc file, and incorporate any
+ bindings or variable assignments found there.
+
+`abort (C-g)'
+ Abort the current editing command and ring the terminal's bell
+ (subject to the setting of `bell-style').
+
+`do-uppercase-version (M-a, M-b, M-X, ...)'
+ If the metafied character X is lowercase, run the command that is
+ bound to the corresponding uppercase character.
+
+`prefix-meta (ESC)'
+ Make the next character typed be metafied. This is for keyboards
+ without a meta key. Typing `ESC f' is equivalent to typing `M-f'.
+
+`undo (C-_, C-x C-u)'
+ Incremental undo, separately remembered for each line.
+
+`revert-line (M-r)'
+ Undo all changes made to this line. This is like executing the
+ `undo' command enough times to get back to the beginning.
+
+`tilde-expand (M-~)'
+ Perform tilde expansion on the current word.
+
+`set-mark (C-@)'
+ Set the mark to the current point. If a numeric argument is
+ supplied, the mark is set to that position.
+
+`exchange-point-and-mark (C-x C-x)'
+ Swap the point with the mark. The current cursor position is set
+ to the saved position, and the old cursor position is saved as the
+ mark.
+
+`character-search (C-])'
+ A character is read and point is moved to the next occurrence of
+ that character. A negative count searches for previous
+ occurrences.
+
+`character-search-backward (M-C-])'
+ A character is read and point is moved to the previous occurrence
+ of that character. A negative count searches for subsequent
+ occurrences.
+
+`insert-comment (M-#)'
+ The value of the `comment-begin' variable is inserted at the
+ beginning of the current line, and the line is accepted as if a
+ newline had been typed.
+
+`dump-functions ()'
+ Print all of the functions and their key bindings to the Readline
+ output stream. If a numeric argument is supplied, the output is
+ formatted in such a way that it can be made part of an INPUTRC
+ file. This command is unbound by default.
+
+`dump-variables ()'
+ Print all of the settable variables and their values to the
+ Readline output stream. If a numeric argument is supplied, the
+ output is formatted in such a way that it can be made part of an
+ INPUTRC file. This command is unbound by default.
+
+`dump-macros ()'
+ Print all of the Readline key sequences bound to macros and the
+ strings they ouput. If a numeric argument is supplied, the output
+ is formatted in such a way that it can be made part of an INPUTRC
+ file. This command is unbound by default.
+
+
+File: readline.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
+
+Readline vi Mode
+================
+
+ While the Readline library does not have a full set of `vi' editing
+functions, it does contain enough to allow simple editing of the line.
+The Readline `vi' mode behaves as specified in the POSIX 1003.2
+standard.
+
+ In order to switch interactively between `emacs' and `vi' editing
+modes, use the command M-C-j (toggle-editing-mode). The Readline
+default is `emacs' mode.
+
+ When you enter a line in `vi' mode, you are already placed in
+`insertion' mode, as if you had typed an `i'. Pressing switches
+you into `command' mode, where you can edit the text of the line with
+the standard `vi' movement keys, move to previous history lines with
+`k' and subsequent lines with `j', and so forth.
+
+ This document describes the GNU Readline Library, a utility for
+aiding in the consitency of user interface across discrete programs
+that need to provide a command line interface.
+
+ Copyright (C) 1988, 1994, 1996, 1998, 1999 Free Software Foundation,
+Inc.
+
+ Permission is granted to make and distribute verbatim copies of this
+manual provided the copyright notice and this permission notice pare
+preserved on all copies.
+
+ Permission is granted to copy and distribute modified versions of
+this manual under the conditions for verbatim copying, provided that
+the entire resulting derived work is distributed under the terms of a
+permission notice identical to this one.
+
+ Permission is granted to copy and distribute translations of this
+manual into another language, under the above conditions for modified
+versions, except that this permission notice may be stated in a
+translation approved by the Foundation.
+
+
+File: readline.info, Node: Programming with GNU Readline, Next: Concept Index, Prev: Command Line Editing, Up: Top
+
+Programming with GNU Readline
+*****************************
+
+ This chapter describes the interface between the GNU Readline
+Library and other programs. If you are a programmer, and you wish to
+include the features found in GNU Readline such as completion, line
+editing, and interactive history manipulation in your own programs,
+this section is for you.
+
+* Menu:
+
+* Basic Behavior:: Using the default behavior of Readline.
+* Custom Functions:: Adding your own functions to Readline.
+* Readline Variables:: Variables accessible to custom
+ functions.
+* Readline Convenience Functions:: Functions which Readline supplies to
+ aid in writing your own custom
+ functions.
+* Readline Signal Handling:: How Readline behaves when it receives signals.
+* Custom Completers:: Supplanting or supplementing Readline's
+ completion functions.
+
+
+File: readline.info, Node: Basic Behavior, Next: Custom Functions, Up: Programming with GNU Readline
+
+Basic Behavior
+==============
+
+ Many programs provide a command line interface, such as `mail',
+`ftp', and `sh'. For such programs, the default behaviour of Readline
+is sufficient. This section describes how to use Readline in the
+simplest way possible, perhaps to replace calls in your code to
+`gets()' or `fgets ()'.
+
+ The function `readline ()' prints a prompt and then reads and returns
+a single line of text from the user. The line `readline' returns is
+allocated with `malloc ()'; you should `free ()' the line when you are
+done with it. The declaration for `readline' in ANSI C is
+
+ `char *readline (char *PROMPT);'
+
+So, one might say
+ `char *line = readline ("Enter a line: ");'
+
+in order to read a line of text from the user. The line returned has
+the final newline removed, so only the text remains.
+
+ If `readline' encounters an `EOF' while reading the line, and the
+line is empty at that point, then `(char *)NULL' is returned.
+Otherwise, the line is ended just as if a newline had been typed.
+
+ If you want the user to be able to get at the line later, (with
+ for example), you must call `add_history ()' to save the line
+away in a "history" list of such lines.
+
+ `add_history (line)';
+
+For full details on the GNU History Library, see the associated manual.
+
+ It is preferable to avoid saving empty lines on the history list,
+since users rarely have a burning need to reuse a blank line. Here is
+a function which usefully replaces the standard `gets ()' library
+function, and has the advantage of no static buffer to overflow:
+
+ /* A static variable for holding the line. */
+ static char *line_read = (char *)NULL;
+
+ /* Read a string, and return a pointer to it. Returns NULL on EOF. */
+ char *
+ rl_gets ()
+ {
+ /* If the buffer has already been allocated, return the memory
+ to the free pool. */
+ if (line_read)
+ {
+ free (line_read);
+ line_read = (char *)NULL;
+ }
+
+ /* Get a line from the user. */
+ line_read = readline ("");
+
+ /* If the line has any text in it, save it on the history. */
+ if (line_read && *line_read)
+ add_history (line_read);
+
+ return (line_read);
+ }
+
+ This function gives the user the default behaviour of
+completion: completion on file names. If you do not want Readline to
+complete on filenames, you can change the binding of the key with
+`rl_bind_key ()'.
+
+ `int rl_bind_key (int KEY, int (*FUNCTION)());'
+
+ `rl_bind_key ()' takes two arguments: KEY is the character that you
+want to bind, and FUNCTION is the address of the function to call when
+KEY is pressed. Binding to `rl_insert ()' makes insert
+itself. `rl_bind_key ()' returns non-zero if KEY is not a valid ASCII
+character code (between 0 and 255).
+
+ Thus, to disable the default behavior, the following suffices:
+ `rl_bind_key ('\t', rl_insert);'
+
+ This code should be executed once at the start of your program; you
+might write a function called `initialize_readline ()' which performs
+this and other desired initializations, such as installing custom
+completers (*note Custom Completers::.).
+
+
+File: readline.info, Node: Custom Functions, Next: Readline Variables, Prev: Basic Behavior, Up: Programming with GNU Readline
+
+Custom Functions
+================
+
+ Readline provides many functions for manipulating the text of the
+line, but it isn't possible to anticipate the needs of all programs.
+This section describes the various functions and variables defined
+within the Readline library which allow a user program to add
+customized functionality to Readline.
+
+* Menu:
+
+* The Function Type:: C declarations to make code readable.
+* Function Writing:: Variables and calling conventions.
+
+
+File: readline.info, Node: The Function Type, Next: Function Writing, Up: Custom Functions
+
+The Function Type
+-----------------
+
+ For readabilty, we declare a new type of object, called "Function".
+A `Function' is a C function which returns an `int'. The type
+declaration for `Function' is:
+
+`typedef int Function ();'
+
+ The reason for declaring this new type is to make it easier to write
+code describing pointers to C functions. Let us say we had a variable
+called FUNC which was a pointer to a function. Instead of the classic
+C declaration
+
+ `int (*)()func;'
+
+we may write
+
+ `Function *func;'
+
+Similarly, there are
+
+ typedef void VFunction ();
+ typedef char *CPFunction (); and
+ typedef char **CPPFunction ();
+
+for functions returning no value, `pointer to char', and `pointer to
+pointer to char', respectively.
+
+
+File: readline.info, Node: Function Writing, Prev: The Function Type, Up: Custom Functions
+
+Writing a New Function
+----------------------
+
+ In order to write new functions for Readline, you need to know the
+calling conventions for keyboard-invoked functions, and the names of the
+variables that describe the current state of the line read so far.
+
+ The calling sequence for a command `foo' looks like
+
+ `foo (int count, int key)'
+
+where COUNT is the numeric argument (or 1 if defaulted) and KEY is the
+key that invoked this function.
+
+ It is completely up to the function as to what should be done with
+the numeric argument. Some functions use it as a repeat count, some as
+a flag, and others to choose alternate behavior (refreshing the current
+line as opposed to refreshing the screen, for example). Some choose to
+ignore it. In general, if a function uses the numeric argument as a
+repeat count, it should be able to do something useful with both
+negative and positive arguments. At the very least, it should be aware
+that it can be passed a negative argument.
+
+
+File: readline.info, Node: Readline Variables, Next: Readline Convenience Functions, Prev: Custom Functions, Up: Programming with GNU Readline
+
+Readline Variables
+==================
+
+ These variables are available to function writers.
+
+ - Variable: char * rl_line_buffer
+ This is the line gathered so far. You are welcome to modify the
+ contents of the line, but see *Note Allowing Undoing::.
+
+ - Variable: int rl_point
+ The offset of the current cursor position in `rl_line_buffer' (the
+ *point*).
+
+ - Variable: int rl_end
+ The number of characters present in `rl_line_buffer'. When
+ `rl_point' is at the end of the line, `rl_point' and `rl_end' are
+ equal.
+
+ - Variable: int rl_mark
+ The mark (saved position) in the current line. If set, the mark
+ and point define a *region*.
+
+ - Variable: int rl_done
+ Setting this to a non-zero value causes Readline to return the
+ current line immediately.
+
+ - Variable: int rl_pending_input
+ Setting this to a value makes it the next keystroke read. This is
+ a way to stuff a single character into the input stream.
+
+ - Variable: int rl_erase_empty_line
+ Setting this to a non-zero value causes Readline to completely
+ erase the current line, including any prompt, any time a newline
+ is typed as the only character on an otherwise-empty line. The
+ cursor is moved to the beginning of the newly-blank line.
+
+ - Variable: char * rl_prompt
+ The prompt Readline uses. This is set from the argument to
+ `readline ()', and should not be assigned to directly.
+
+ - Variable: char * rl_library_version
+ The version number of this revision of the library.
+
+ - Variable: char * rl_terminal_name
+ The terminal type, used for initialization.
+
+ - Variable: char * rl_readline_name
+ This variable is set to a unique name by each application using
+ Readline. The value allows conditional parsing of the inputrc file
+ (*note Conditional Init Constructs::.).
+
+ - Variable: FILE * rl_instream
+ The stdio stream from which Readline reads input.
+
+ - Variable: FILE * rl_outstream
+ The stdio stream to which Readline performs output.
+
+ - Variable: Function * rl_startup_hook
+ If non-zero, this is the address of a function to call just before
+ `readline' prints the first prompt.
+
+ - Variable: Function * rl_pre_input_hook
+ If non-zero, this is the address of a function to call after the
+ first prompt has been printed and just before `readline' starts
+ reading input characters.
+
+ - Variable: Function * rl_event_hook
+ If non-zero, this is the address of a function to call periodically
+ when readline is waiting for terminal input.
+
+ - Variable: Function * rl_getc_function
+ If non-zero, `readline' will call indirectly through this pointer
+ to get a character from the input stream. By default, it is set to
+ `rl_getc', the default `readline' character input function (*note
+ Utility Functions::.).
+
+ - Variable: VFunction * rl_redisplay_function
+ If non-zero, `readline' will call indirectly through this pointer
+ to update the display with the current contents of the editing
+ buffer. By default, it is set to `rl_redisplay', the default
+ `readline' redisplay function (*note Redisplay::.).
+
+ - Variable: Keymap rl_executing_keymap
+ This variable is set to the keymap (*note Keymaps::.) in which the
+ currently executing readline function was found.
+
+ - Variable: Keymap rl_binding_keymap
+ This variable is set to the keymap (*note Keymaps::.) in which the
+ last key binding occurred.
+
+
+File: readline.info, Node: Readline Convenience Functions, Next: Readline Signal Handling, Prev: Readline Variables, Up: Programming with GNU Readline
+
+Readline Convenience Functions
+==============================
+
+* Menu:
+
+* Function Naming:: How to give a function you write a name.
+* Keymaps:: Making keymaps.
+* Binding Keys:: Changing Keymaps.
+* Associating Function Names and Bindings:: Translate function names to
+ key sequences.
+* Allowing Undoing:: How to make your functions undoable.
+* Redisplay:: Functions to control line display.
+* Modifying Text:: Functions to modify `rl_line_buffer'.
+* Utility Functions:: Generally useful functions and hooks.
+* Alternate Interface:: Using Readline in a `callback' fashion.
+
+
+File: readline.info, Node: Function Naming, Next: Keymaps, Up: Readline Convenience Functions
+
+Naming a Function
+-----------------
+
+ The user can dynamically change the bindings of keys while using
+Readline. This is done by representing the function with a descriptive
+name. The user is able to type the descriptive name when referring to
+the function. Thus, in an init file, one might find
+
+ Meta-Rubout: backward-kill-word
+
+ This binds the keystroke to the function
+*descriptively* named `backward-kill-word'. You, as the programmer,
+should bind the functions you write to descriptive names as well.
+Readline provides a function for doing that:
+
+ - Function: int rl_add_defun (char *name, Function *function, int key)
+ Add NAME to the list of named functions. Make FUNCTION be the
+ function that gets called. If KEY is not -1, then bind it to
+ FUNCTION using `rl_bind_key ()'.
+
+ Using this function alone is sufficient for most applications. It is
+the recommended way to add a few functions to the default functions that
+Readline has built in. If you need to do something other than adding a
+function to Readline, you may need to use the underlying functions
+described below.
+
+
+File: readline.info, Node: Keymaps, Next: Binding Keys, Prev: Function Naming, Up: Readline Convenience Functions
+
+Selecting a Keymap
+------------------
+
+ Key bindings take place on a "keymap". The keymap is the
+association between the keys that the user types and the functions that
+get run. You can make your own keymaps, copy existing keymaps, and tell
+Readline which keymap to use.
+
+ - Function: Keymap rl_make_bare_keymap ()
+ Returns a new, empty keymap. The space for the keymap is
+ allocated with `malloc ()'; you should `free ()' it when you are
+ done.
+
+ - Function: Keymap rl_copy_keymap (Keymap map)
+ Return a new keymap which is a copy of MAP.
+
+ - Function: Keymap rl_make_keymap ()
+ Return a new keymap with the printing characters bound to
+ rl_insert, the lowercase Meta characters bound to run their
+ equivalents, and the Meta digits bound to produce numeric
+ arguments.
+
+ - Function: void rl_discard_keymap (Keymap keymap)
+ Free the storage associated with KEYMAP.
+
+ Readline has several internal keymaps. These functions allow you to
+change which keymap is active.
+
+ - Function: Keymap rl_get_keymap ()
+ Returns the currently active keymap.
+
+ - Function: void rl_set_keymap (Keymap keymap)
+ Makes KEYMAP the currently active keymap.
+
+ - Function: Keymap rl_get_keymap_by_name (char *name)
+ Return the keymap matching NAME. NAME is one which would be
+ supplied in a `set keymap' inputrc line (*note Readline Init
+ File::.).
+
+ - Function: char * rl_get_keymap_name (Keymap keymap)
+ Return the name matching KEYMAP. NAME is one which would be
+ supplied in a `set keymap' inputrc line (*note Readline Init
+ File::.).
+
+
+File: readline.info, Node: Binding Keys, Next: Associating Function Names and Bindings, Prev: Keymaps, Up: Readline Convenience Functions
+
+Binding Keys
+------------
+
+ You associate keys with functions through the keymap. Readline has
+several internal keymaps: `emacs_standard_keymap', `emacs_meta_keymap',
+`emacs_ctlx_keymap', `vi_movement_keymap', and `vi_insertion_keymap'.
+`emacs_standard_keymap' is the default, and the examples in this manual
+assume that.
+
+ These functions manage key bindings.
+
+ - Function: int rl_bind_key (int key, Function *function)
+ Binds KEY to FUNCTION in the currently active keymap. Returns
+ non-zero in the case of an invalid KEY.
+
+ - Function: int rl_bind_key_in_map (int key, Function *function,
+ Keymap map)
+ Bind KEY to FUNCTION in MAP. Returns non-zero in the case of an
+ invalid KEY.
+
+ - Function: int rl_unbind_key (int key)
+ Bind KEY to the null function in the currently active keymap.
+ Returns non-zero in case of error.
+
+ - Function: int rl_unbind_key_in_map (int key, Keymap map)
+ Bind KEY to the null function in MAP. Returns non-zero in case of
+ error.
+
+ - Function: int rl_unbind_function_in_map (Function *function, Keymap
+ map)
+ Unbind all keys that execute FUNCTION in MAP.
+
+ - Function: int rl_unbind_command_in_map (char *command, Keymap map)
+ Unbind all keys that are bound to COMMAND in MAP.
+
+ - Function: int rl_generic_bind (int type, char *keyseq, char *data,
+ Keymap map)
+ Bind the key sequence represented by the string KEYSEQ to the
+ arbitrary pointer DATA. TYPE says what kind of data is pointed to
+ by DATA; this can be a function (`ISFUNC'), a macro (`ISMACR'), or
+ a keymap (`ISKMAP'). This makes new keymaps as necessary. The
+ initial keymap in which to do bindings is MAP.
+
+ - Function: int rl_parse_and_bind (char *line)
+ Parse LINE as if it had been read from the `inputrc' file and
+ perform any key bindings and variable assignments found (*note
+ Readline Init File::.).
+
+ - Function: int rl_read_init_file (char *filename)
+ Read keybindings and variable assignments from FILENAME (*note
+ Readline Init File::.).
+
+
+File: readline.info, Node: Associating Function Names and Bindings, Next: Allowing Undoing, Prev: Binding Keys, Up: Readline Convenience Functions
+
+Associating Function Names and Bindings
+---------------------------------------
+
+ These functions allow you to find out what keys invoke named
+functions and the functions invoked by a particular key sequence.
+
+ - Function: Function * rl_named_function (char *name)
+ Return the function with name NAME.
+
+ - Function: Function * rl_function_of_keyseq (char *keyseq, Keymap
+ map, int *type)
+ Return the function invoked by KEYSEQ in keymap MAP. If MAP is
+ NULL, the current keymap is used. If TYPE is not NULL, the type
+ of the object is returned in it (one of `ISFUNC', `ISKMAP', or
+ `ISMACR').
+
+ - Function: char ** rl_invoking_keyseqs (Function *function)
+ Return an array of strings representing the key sequences used to
+ invoke FUNCTION in the current keymap.
+
+ - Function: char ** rl_invoking_keyseqs_in_map (Function *function,
+ Keymap map)
+ Return an array of strings representing the key sequences used to
+ invoke FUNCTION in the keymap MAP.
+
+ - Function: void rl_function_dumper (int readable)
+ Print the readline function names and the key sequences currently
+ bound to them to `rl_outstream'. If READABLE is non-zero, the
+ list is formatted in such a way that it can be made part of an
+ `inputrc' file and re-read.
+
+ - Function: void rl_list_funmap_names ()
+ Print the names of all bindable Readline functions to
+ `rl_outstream'.
+
+
+File: readline.info, Node: Allowing Undoing, Next: Redisplay, Prev: Associating Function Names and Bindings, Up: Readline Convenience Functions
+
+Allowing Undoing
+----------------
+
+ Supporting the undo command is a painless thing, and makes your
+functions much more useful. It is certainly easy to try something if
+you know you can undo it. I could use an undo function for the stock
+market.
+
+ If your function simply inserts text once, or deletes text once, and
+uses `rl_insert_text ()' or `rl_delete_text ()' to do it, then undoing
+is already done for you automatically.
+
+ If you do multiple insertions or multiple deletions, or any
+combination of these operations, you should group them together into
+one operation. This is done with `rl_begin_undo_group ()' and
+`rl_end_undo_group ()'.
+
+ The types of events that can be undone are:
+
+ enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
+
+ Notice that `UNDO_DELETE' means to insert some text, and
+`UNDO_INSERT' means to delete some text. That is, the undo code tells
+undo what to undo, not how to undo it. `UNDO_BEGIN' and `UNDO_END' are
+tags added by `rl_begin_undo_group ()' and `rl_end_undo_group ()'.
+
+ - Function: int rl_begin_undo_group ()
+ Begins saving undo information in a group construct. The undo
+ information usually comes from calls to `rl_insert_text ()' and
+ `rl_delete_text ()', but could be the result of calls to
+ `rl_add_undo ()'.
+
+ - Function: int rl_end_undo_group ()
+ Closes the current undo group started with `rl_begin_undo_group
+ ()'. There should be one call to `rl_end_undo_group ()' for each
+ call to `rl_begin_undo_group ()'.
+
+ - Function: void rl_add_undo (enum undo_code what, int start, int end,
+ char *text)
+ Remember how to undo an event (according to WHAT). The affected
+ text runs from START to END, and encompasses TEXT.
+
+ - Function: void free_undo_list ()
+ Free the existing undo list.
+
+ - Function: int rl_do_undo ()
+ Undo the first thing on the undo list. Returns `0' if there was
+ nothing to undo, non-zero if something was undone.
+
+ Finally, if you neither insert nor delete text, but directly modify
+the existing text (e.g., change its case), call `rl_modifying ()' once,
+just before you modify the text. You must supply the indices of the
+text range that you are going to modify.
+
+ - Function: int rl_modifying (int start, int end)
+ Tell Readline to save the text between START and END as a single
+ undo unit. It is assumed that you will subsequently modify that
+ text.
+
+
+File: readline.info, Node: Redisplay, Next: Modifying Text, Prev: Allowing Undoing, Up: Readline Convenience Functions
+
+Redisplay
+---------
+
+ - Function: void rl_redisplay ()
+ Change what's displayed on the screen to reflect the current
+ contents of `rl_line_buffer'.
+
+ - Function: int rl_forced_update_display ()
+ Force the line to be updated and redisplayed, whether or not
+ Readline thinks the screen display is correct.
+
+ - Function: int rl_on_new_line ()
+ Tell the update routines that we have moved onto a new (empty)
+ line, usually after ouputting a newline.
+
+ - Function: int rl_reset_line_state ()
+ Reset the display state to a clean state and redisplay the current
+ line starting on a new line.
+
+ - Function: int rl_message (va_alist)
+ The arguments are a string as would be supplied to `printf'. The
+ resulting string is displayed in the "echo area". The echo area
+ is also used to display numeric arguments and search strings.
+
+ - Function: int rl_clear_message ()
+ Clear the message in the echo area.
+
+ - Function: void rl_save_prompt ()
+ Save the local Readline prompt display state in preparation for
+ displaying a new message in the message area with `rl_message'.
+
+ - Function: void rl_restore_prompt ()
+ Restore the local Readline prompt display state saved by the most
+ recent call to `rl_save_prompt'.
+
+
+File: readline.info, Node: Modifying Text, Next: Utility Functions, Prev: Redisplay, Up: Readline Convenience Functions
+
+Modifying Text
+--------------
+
+ - Function: int rl_insert_text (char *text)
+ Insert TEXT into the line at the current cursor position.
+
+ - Function: int rl_delete_text (int start, int end)
+ Delete the text between START and END in the current line.
+
+ - Function: char * rl_copy_text (int start, int end)
+ Return a copy of the text between START and END in the current
+ line.
+
+ - Function: int rl_kill_text (int start, int end)
+ Copy the text between START and END in the current line to the
+ kill ring, appending or prepending to the last kill if the last
+ command was a kill command. The text is deleted. If START is
+ less than END, the text is appended, otherwise prepended. If the
+ last command was not a kill, a new kill ring slot is used.
+
+
+File: readline.info, Node: Utility Functions, Next: Alternate Interface, Prev: Modifying Text, Up: Readline Convenience Functions
+
+Utility Functions
+-----------------
+
+ - Function: int rl_read_key ()
+ Return the next character available. This handles input inserted
+ into the input stream via PENDING INPUT (*note Readline
+ Variables::.) and `rl_stuff_char ()', macros, and characters read
+ from the keyboard.
+
+ - Function: int rl_getc (FILE *)
+ Return the next character available from the keyboard.
+
+ - Function: int rl_stuff_char (int c)
+ Insert C into the Readline input stream. It will be "read" before
+ Readline attempts to read characters from the terminal with
+ `rl_read_key ()'.
+
+ - Function: rl_extend_line_buffer (int len)
+ Ensure that `rl_line_buffer' has enough space to hold LEN
+ characters, possibly reallocating it if necessary.
+
+ - Function: int rl_initialize ()
+ Initialize or re-initialize Readline's internal state.
+
+ - Function: int rl_reset_terminal (char *terminal_name)
+ Reinitialize Readline's idea of the terminal settings using
+ TERMINAL_NAME as the terminal type (e.g., `vt100').
+
+ - Function: int alphabetic (int c)
+ Return 1 if C is an alphabetic character.
+
+ - Function: int numeric (int c)
+ Return 1 if C is a numeric character.
+
+ - Function: int ding ()
+ Ring the terminal bell, obeying the setting of `bell-style'.
+
+ - Function: void rl_display_match_list (char **matches, int len, int
+ max)
+ A convenience function for displaying a list of strings in
+ columnar format on Readline's output stream. `matches' is the list
+ of strings, in argv format, such as a list of completion matches.
+ `len' is the number of strings in `matches', and `max' is the
+ length of the longest string in `matches'. This function uses the
+ setting of `print-completions-horizontally' to select how the
+ matches are displayed (*note Readline Init File Syntax::.).
+
+ The following are implemented as macros, defined in `chartypes.h'.
+
+ - Function: int uppercase_p (int c)
+ Return 1 if C is an uppercase alphabetic character.
+
+ - Function: int lowercase_p (int c)
+ Return 1 if C is a lowercase alphabetic character.
+
+ - Function: int digit_p (int c)
+ Return 1 if C is a numeric character.
+
+ - Function: int to_upper (int c)
+ If C is a lowercase alphabetic character, return the corresponding
+ uppercase character.
+
+ - Function: int to_lower (int c)
+ If C is an uppercase alphabetic character, return the corresponding
+ lowercase character.
+
+ - Function: int digit_value (int c)
+ If C is a number, return the value it represents.
+
+
+File: readline.info, Node: Alternate Interface, Prev: Utility Functions, Up: Readline Convenience Functions
+
+Alternate Interface
+-------------------
+
+ An alternate interface is available to plain `readline()'. Some
+applications need to interleave keyboard I/O with file, device, or
+window system I/O, typically by using a main loop to `select()' on
+various file descriptors. To accomodate this need, readline can also
+be invoked as a `callback' function from an event loop. There are
+functions available to make this easy.
+
+ - Function: void rl_callback_handler_install (char *prompt, Vfunction
+ *lhandler)
+ Set up the terminal for readline I/O and display the initial
+ expanded value of PROMPT. Save the value of LHANDLER to use as a
+ callback when a complete line of input has been entered.
+
+ - Function: void rl_callback_read_char ()
+ Whenever an application determines that keyboard input is
+ available, it should call `rl_callback_read_char()', which will
+ read the next character from the current input source. If that
+ character completes the line, `rl_callback_read_char' will invoke
+ the LHANDLER function saved by `rl_callback_handler_install' to
+ process the line. `EOF' is indicated by calling LHANDLER with a
+ `NULL' line.
+
+ - Function: void rl_callback_handler_remove ()
+ Restore the terminal to its initial state and remove the line
+ handler. This may be called from within a callback as well as
+ independently.
+
+An Example
+----------
+
+ Here is a function which changes lowercase characters to their
+uppercase equivalents, and uppercase characters to lowercase. If this
+function was bound to `M-c', then typing `M-c' would change the case of
+the character under point. Typing `M-1 0 M-c' would change the case of
+the following 10 characters, leaving the cursor on the last character
+changed.
+
+ /* Invert the case of the COUNT following characters. */
+ int
+ invert_case_line (count, key)
+ int count, key;
+ {
+ register int start, end, i;
+
+ start = rl_point;
+
+ if (rl_point >= rl_end)
+ return (0);
+
+ if (count < 0)
+ {
+ direction = -1;
+ count = -count;
+ }
+ else
+ direction = 1;
+
+ /* Find the end of the range to modify. */
+ end = start + (count * direction);
+
+ /* Force it to be within range. */
+ if (end > rl_end)
+ end = rl_end;
+ else if (end < 0)
+ end = 0;
+
+ if (start == end)
+ return (0);
+
+ if (start > end)
+ {
+ int temp = start;
+ start = end;
+ end = temp;
+ }
+
+ /* Tell readline that we are modifying the line, so it will save
+ the undo information. */
+ rl_modifying (start, end);
+
+ for (i = start; i != end; i++)
+ {
+ if (uppercase_p (rl_line_buffer[i]))
+ rl_line_buffer[i] = to_lower (rl_line_buffer[i]);
+ else if (lowercase_p (rl_line_buffer[i]))
+ rl_line_buffer[i] = to_upper (rl_line_buffer[i]);
+ }
+ /* Move point to on top of the last character changed. */
+ rl_point = (direction == 1) ? end - 1 : start;
+ return (0);
+ }
+
+
+File: readline.info, Node: Readline Signal Handling, Next: Custom Completers, Prev: Readline Convenience Functions, Up: Programming with GNU Readline
+
+Readline Signal Handling
+========================
+
+ Signals are asynchronous events sent to a process by the Unix kernel,
+sometimes on behalf of another process. They are intended to indicate
+exceptional events, like a user pressing the interrupt key on his
+terminal, or a network connection being broken. There is a class of
+signals that can be sent to the process currently reading input from
+the keyboard. Since Readline changes the terminal attributes when it
+is called, it needs to perform special processing when a signal is
+received to restore the terminal to a sane state, or provide application
+writers with functions to do so manually.
+
+ Readline contains an internal signal handler that is installed for a
+number of signals (`SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM',
+`SIGTSTP', `SIGTTIN', and `SIGTTOU'). When one of these signals is
+received, the signal handler will reset the terminal attributes to
+those that were in effect before `readline ()' was called, reset the
+signal handling to what it was before `readline ()' was called, and
+resend the signal to the calling application. If and when the calling
+application's signal handler returns, Readline will reinitialize the
+terminal and continue to accept input. When a `SIGINT' is received,
+the Readline signal handler performs some additional work, which will
+cause any partially-entered line to be aborted (see the description of
+`rl_free_line_state ()').
+
+ There is an additional Readline signal handler, for `SIGWINCH', which
+the kernel sends to a process whenever the terminal's size changes (for
+example, if a user resizes an `xterm'). The Readline `SIGWINCH'
+handler updates Readline's internal screen size state, and then calls
+any `SIGWINCH' signal handler the calling application has installed.
+Readline calls the application's `SIGWINCH' signal handler without
+resetting the terminal to its original state. If the application's
+signal handler does more than update its idea of the terminal size and
+return (for example, a `longjmp' back to a main processing loop), it
+*must* call `rl_cleanup_after_signal ()' (described below), to restore
+the terminal state.
+
+ Readline provides two variables that allow application writers to
+control whether or not it will catch certain signals and act on them
+when they are received. It is important that applications change the
+values of these variables only when calling `readline ()', not in a
+signal handler, so Readline's internal signal state is not corrupted.
+
+ - Variable: int rl_catch_signals
+ If this variable is non-zero, Readline will install signal
+ handlers for `SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM', `SIGTSTP',
+ `SIGTTIN', and `SIGTTOU'.
+
+ The default value of `rl_catch_signals' is 1.
+
+ - Variable: int rl_catch_sigwinch
+ If this variable is non-zero, Readline will install a signal
+ handler for `SIGWINCH'.
+
+ The default value of `rl_catch_sigwinch' is 1.
+
+ If an application does not wish to have Readline catch any signals,
+or to handle signals other than those Readline catches (`SIGHUP', for
+example), Readline provides convenience functions to do the necessary
+terminal and internal state cleanup upon receipt of a signal.
+
+ - Function: void rl_cleanup_after_signal (void)
+ This function will reset the state of the terminal to what it was
+ before `readline ()' was called, and remove the Readline signal
+ handlers for all signals, depending on the values of
+ `rl_catch_signals' and `rl_catch_sigwinch'.
+
+ - Function: void rl_free_line_state (void)
+ This will free any partial state associated with the current input
+ line (undo information, any partial history entry, any
+ partially-entered keyboard macro, and any partially-entered
+ numeric argument). This should be called before
+ `rl_cleanup_after_signal ()'. The Readline signal handler for
+ `SIGINT' calls this to abort the current input line.
+
+ - Function: void rl_reset_after_signal (void)
+ This will reinitialize the terminal and reinstall any Readline
+ signal handlers, depending on the values of `rl_catch_signals' and
+ `rl_catch_sigwinch'.
+
+ If an application does not wish Readline to catch `SIGWINCH', it may
+call `rl_resize_terminal ()' to force Readline to update its idea of
+the terminal size when a `SIGWINCH' is received.
+
+ - Function: void rl_resize_terminal (void)
+ Update Readline's internal screen size.
+
+ The following functions install and remove Readline's signal
+handlers.
+
+ - Function: int rl_set_signals (void)
+ Install Readline's signal handler for `SIGINT', `SIGQUIT',
+ `SIGTERM', `SIGALRM', `SIGTSTP', `SIGTTIN', `SIGTTOU', and
+ `SIGWINCH', depending on the values of `rl_catch_signals' and
+ `rl_catch_sigwinch'.
+
+ - Function: int rl_clear_signals (void)
+ Remove all of the Readline signal handlers installed by
+ `rl_set_signals ()'.
+
+
+File: readline.info, Node: Custom Completers, Prev: Readline Signal Handling, Up: Programming with GNU Readline
+
+Custom Completers
+=================
+
+ Typically, a program that reads commands from the user has a way of
+disambiguating commands and data. If your program is one of these, then
+it can provide completion for commands, data, or both. The following
+sections describe how your program and Readline cooperate to provide
+this service.
+
+* Menu:
+
+* How Completing Works:: The logic used to do completion.
+* Completion Functions:: Functions provided by Readline.
+* Completion Variables:: Variables which control completion.
+* A Short Completion Example:: An example of writing completer subroutines.
+
+
+File: readline.info, Node: How Completing Works, Next: Completion Functions, Up: Custom Completers
+
+How Completing Works
+--------------------
+
+ In order to complete some text, the full list of possible completions
+must be available. That is, it is not possible to accurately expand a
+partial word without knowing all of the possible words which make sense
+in that context. The Readline library provides the user interface to
+completion, and two of the most common completion functions: filename
+and username. For completing other types of text, you must write your
+own completion function. This section describes exactly what such
+functions must do, and provides an example.
+
+ There are three major functions used to perform completion:
+
+ 1. The user-interface function `rl_complete ()'. This function is
+ called with the same arguments as other Readline functions
+ intended for interactive use: COUNT and INVOKING_KEY. It
+ isolates the word to be completed and calls `completion_matches
+ ()' to generate a list of possible completions. It then either
+ lists the possible completions, inserts the possible completions,
+ or actually performs the completion, depending on which behavior
+ is desired.
+
+ 2. The internal function `completion_matches ()' uses your
+ "generator" function to generate the list of possible matches, and
+ then returns the array of these matches. You should place the
+ address of your generator function in
+ `rl_completion_entry_function'.
+
+ 3. The generator function is called repeatedly from
+ `completion_matches ()', returning a string each time. The
+ arguments to the generator function are TEXT and STATE. TEXT is
+ the partial word to be completed. STATE is zero the first time
+ the function is called, allowing the generator to perform any
+ necessary initialization, and a positive non-zero integer for each
+ subsequent call. When the generator function returns `(char
+ *)NULL' this signals `completion_matches ()' that there are no
+ more possibilities left. Usually the generator function computes
+ the list of possible completions when STATE is zero, and returns
+ them one at a time on subsequent calls. Each string the generator
+ function returns as a match must be allocated with `malloc()';
+ Readline frees the strings when it has finished with them.
+
+
+ - Function: int rl_complete (int ignore, int invoking_key)
+ Complete the word at or before point. You have supplied the
+ function that does the initial simple matching selection algorithm
+ (see `completion_matches ()'). The default is to do filename
+ completion.
+
+ - Variable: Function * rl_completion_entry_function
+ This is a pointer to the generator function for `completion_matches
+ ()'. If the value of `rl_completion_entry_function' is `(Function
+ *)NULL' then the default filename generator function,
+ `filename_completion_function ()', is used.
+
+
+File: readline.info, Node: Completion Functions, Next: Completion Variables, Prev: How Completing Works, Up: Custom Completers
+
+Completion Functions
+--------------------
+
+ Here is the complete list of callable completion functions present in
+Readline.
+
+ - Function: int rl_complete_internal (int what_to_do)
+ Complete the word at or before point. WHAT_TO_DO says what to do
+ with the completion. A value of `?' means list the possible
+ completions. `TAB' means do standard completion. `*' means
+ insert all of the possible completions. `!' means to display all
+ of the possible completions, if there is more than one, as well as
+ performing partial completion.
+
+ - Function: int rl_complete (int ignore, int invoking_key)
+ Complete the word at or before point. You have supplied the
+ function that does the initial simple matching selection algorithm
+ (see `completion_matches ()' and `rl_completion_entry_function').
+ The default is to do filename completion. This calls
+ `rl_complete_internal ()' with an argument depending on
+ INVOKING_KEY.
+
+ - Function: int rl_possible_completions (int count, int invoking_key))
+ List the possible completions. See description of `rl_complete
+ ()'. This calls `rl_complete_internal ()' with an argument of `?'.
+
+ - Function: int rl_insert_completions (int count, int invoking_key))
+ Insert the list of possible completions into the line, deleting the
+ partially-completed word. See description of `rl_complete ()'.
+ This calls `rl_complete_internal ()' with an argument of `*'.
+
+ - Function: char ** completion_matches (char *text, CPFunction
+ *entry_func)
+ Returns an array of `(char *)' which is a list of completions for
+ TEXT. If there are no completions, returns `(char **)NULL'. The
+ first entry in the returned array is the substitution for TEXT.
+ The remaining entries are the possible completions. The array is
+ terminated with a `NULL' pointer.
+
+ ENTRY_FUNC is a function of two args, and returns a `(char *)'.
+ The first argument is TEXT. The second is a state argument; it is
+ zero on the first call, and non-zero on subsequent calls.
+ ENTRY_FUNC returns a `NULL' pointer to the caller when there are
+ no more matches.
+
+ - Function: char * filename_completion_function (char *text, int state)
+ A generator function for filename completion in the general case.
+ Note that completion in Bash is a little different because of all
+ the pathnames that must be followed when looking up completions
+ for a command. The Bash source is a useful reference for writing
+ custom completion functions.
+
+ - Function: char * username_completion_function (char *text, int state)
+ A completion generator for usernames. TEXT contains a partial
+ username preceded by a random character (usually `~'). As with all
+ completion generators, STATE is zero on the first call and non-zero
+ for subsequent calls.
+
+
+File: readline.info, Node: Completion Variables, Next: A Short Completion Example, Prev: Completion Functions, Up: Custom Completers
+
+Completion Variables
+--------------------
+
+ - Variable: Function * rl_completion_entry_function
+ A pointer to the generator function for `completion_matches ()'.
+ `NULL' means to use `filename_entry_function ()', the default
+ filename completer.
+
+ - Variable: CPPFunction * rl_attempted_completion_function
+ A pointer to an alternative function to create matches. The
+ function is called with TEXT, START, and END. START and END are
+ indices in `rl_line_buffer' saying what the boundaries of TEXT
+ are. If this function exists and returns `NULL', or if this
+ variable is set to `NULL', then `rl_complete ()' will call the
+ value of `rl_completion_entry_function' to generate matches,
+ otherwise the array of strings returned will be used.
+
+ - Variable: CPFunction * rl_filename_quoting_function
+ A pointer to a function that will quote a filename in an
+ application- specific fashion. This is called if filename
+ completion is being attempted and one of the characters in
+ `rl_filename_quote_characters' appears in a completed filename.
+ The function is called with TEXT, MATCH_TYPE, and QUOTE_POINTER.
+ The TEXT is the filename to be quoted. The MATCH_TYPE is either
+ `SINGLE_MATCH', if there is only one completion match, or
+ `MULT_MATCH'. Some functions use this to decide whether or not to
+ insert a closing quote character. The QUOTE_POINTER is a pointer
+ to any opening quote character the user typed. Some functions
+ choose to reset this character.
+
+ - Variable: CPFunction * rl_filename_dequoting_function
+ A pointer to a function that will remove application-specific
+ quoting characters from a filename before completion is attempted,
+ so those characters do not interfere with matching the text
+ against names in the filesystem. It is called with TEXT, the text
+ of the word to be dequoted, and QUOTE_CHAR, which is the quoting
+ character that delimits the filename (usually `'' or `"'). If
+ QUOTE_CHAR is zero, the filename was not in an embedded string.
+
+ - Variable: Function * rl_char_is_quoted_p
+ A pointer to a function to call that determines whether or not a
+ specific character in the line buffer is quoted, according to
+ whatever quoting mechanism the program calling readline uses. The
+ function is called with two arguments: TEXT, the text of the line,
+ and INDEX, the index of the character in the line. It is used to
+ decide whether a character found in
+ `rl_completer_word_break_characters' should be used to break words
+ for the completer.
+
+ - Variable: int rl_completion_query_items
+ Up to this many items will be displayed in response to a
+ possible-completions call. After that, we ask the user if she is
+ sure she wants to see them all. The default value is 100.
+
+ - Variable: char * rl_basic_word_break_characters
+ The basic list of characters that signal a break between words for
+ the completer routine. The default value of this variable is the
+ characters which break words for completion in Bash, i.e., `"
+ \t\n\"\\'`@$><=;|&{("'.
+
+ - Variable: char * rl_basic_quote_characters
+ List of quote characters which can cause a word break.
+
+ - Variable: char * rl_completer_word_break_characters
+ The list of characters that signal a break between words for
+ `rl_complete_internal ()'. The default list is the value of
+ `rl_basic_word_break_characters'.
+
+ - Variable: char * rl_completer_quote_characters
+ List of characters which can be used to quote a substring of the
+ line. Completion occurs on the entire substring, and within the
+ substring `rl_completer_word_break_characters' are treated as any
+ other character, unless they also appear within this list.
+
+ - Variable: char * rl_filename_quote_characters
+ A list of characters that cause a filename to be quoted by the
+ completer when they appear in a completed filename. The default
+ is the null string.
+
+ - Variable: char * rl_special_prefixes
+ The list of characters that are word break characters, but should
+ be left in TEXT when it is passed to the completion function.
+ Programs can use this to help determine what kind of completing to
+ do. For instance, Bash sets this variable to "$@" so that it can
+ complete shell variables and hostnames.
+
+ - Variable: int rl_completion_append_character
+ When a single completion alternative matches at the end of the
+ command line, this character is appended to the inserted
+ completion text. The default is a space character (` '). Setting
+ this to the null character (`\0') prevents anything being appended
+ automatically. This can be changed in custom completion functions
+ to provide the "most sensible word separator character" according
+ to an application-specific command line syntax specification.
+
+ - Variable: int rl_ignore_completion_duplicates
+ If non-zero, then disallow duplicates in the matches. Default is
+ 1.
+
+ - Variable: int rl_filename_completion_desired
+ Non-zero means that the results of the matches are to be treated as
+ filenames. This is *always* zero on entry, and can only be changed
+ within a completion entry generator function. If it is set to a
+ non-zero value, directory names have a slash appended and Readline
+ attempts to quote completed filenames if they contain any embedded
+ word break characters.
+
+ - Variable: int rl_filename_quoting_desired
+ Non-zero means that the results of the matches are to be quoted
+ using double quotes (or an application-specific quoting mechanism)
+ if the completed filename contains any characters in
+ `rl_filename_quote_chars'. This is *always* non-zero on entry,
+ and can only be changed within a completion entry generator
+ function. The quoting is effected via a call to the function
+ pointed to by `rl_filename_quoting_function'.
+
+ - Variable: int rl_inhibit_completion
+ If this variable is non-zero, completion is inhibit
+ #include
+ #include
+ #include
+ #include
+
+ #include
+ #include
+
+ extern char *getwd ();
+ extern char *xmalloc ();
+
+ /* The names of functions that actually do the manipulation. */
+ int com_list (), com_view (), com_rename (), com_stat (), com_pwd ();
+ int com_delete (), com_help (), com_cd (), com_quit ();
+
+ /* A structure which contains information on the commands this program
+ can understand. */
+
+ typedef struct {
+ char *name; /* User printable name of the function. */
+ Function *func; /* Function to call to do the job. */
+ char *doc; /* Documentation for this function. */
+ } COMMAND;
+
+ COMMAND commands[] = {
+ { "cd", com_cd, "Change to directory DIR" },
+ { "delete", com_delete, "Delete FILE" },
+ { "help", com_help, "Display this text" },
+ { "?", com_help, "Synonym for `help'" },
+ { "list", com_list, "List files in DIR" },
+ { "ls", com_list, "Synonym for `list'" },
+ { "pwd", com_pwd, "Print the current working directory" },
+ { "quit", com_quit, "Quit using Fileman" },
+ { "rename", com_rename, "Rename FILE to NEWNAME" },
+ { "stat", com_stat, "Print out statistics on FILE" },
+ { "view", com_view, "View the contents of FILE" },
+ { (char *)NULL, (Function *)NULL, (char *)NULL }
+ };
+
+ /* Forward declarations. */
+ char *stripwhite ();
+ COMMAND *find_command ();
+
+ /* The name of this program, as taken from argv[0]. */
+ char *progname;
+
+ /* When non-zero, this global means the user is done using this program. */
+ int done;
+
+ char *
+ dupstr (s)
+ int s;
+ {
+ char *r;
+
+ r = xmalloc (strlen (s) + 1);
+ strcpy (r, s);
+ return (r);
+ }
+
+ main (argc, argv)
+ int argc;
+ char **argv;
+ {
+ char *line, *s;
+
+ progname = argv[0];
+
+ initialize_readline (); /* Bind our completer. */
+
+ /* Loop reading and executing lines until the user quits. */
+ for ( ; done == 0; )
+ {
+ line = readline ("FileMan: ");
+
+ if (!line)
+ break;
+
+ /* Remove leading and trailing whitespace from the line.
+ Then, if there is anything left, add it to the history list
+ and execute it. */
+ s = stripwhite (line);
+
+ if (*s)
+ {
+ add_history (s);
+ execute_line (s);
+ }
+
+ free (line);
+ }
+ exit (0);
+ }
+
+ /* Execute a command line. */
+ int
+ execute_line (line)
+ char *line;
+ {
+ register int i;
+ COMMAND *command;
+ char *word;
+
+ /* Isolate the command word. */
+ i = 0;
+ while (line[i] && whitespace (line[i]))
+ i++;
+ word = line + i;
+
+ while (line[i] && !whitespace (line[i]))
+ i++;
+
+ if (line[i])
+ line[i++] = '\0';
+
+ command = find_command (word);
+
+ if (!command)
+ {
+ fprintf (stderr, "%s: No such command for FileMan.\n", word);
+ return (-1);
+ }
+
+ /* Get argument to command, if any. */
+ while (whitespace (line[i]))
+ i++;
+
+ word = line + i;
+
+ /* Call the function. */
+ return ((*(command->func)) (word));
+ }
+
+ /* Look up NAME as the name of a command, and return a pointer to that
+ command. Return a NULL pointer if NAME isn't a command name. */
+ COMMAND *
+ find_command (name)
+ char *name;
+ {
+ register int i;
+
+ for (i = 0; commands[i].name; i++)
+ if (strcmp (name, commands[i].name) == 0)
+ return (&commands[i]);
+
+ return ((COMMAND *)NULL);
+ }
+
+ /* Strip whitespace from the start and end of STRING. Return a pointer
+ into STRING. */
+ char *
+ stripwhite (string)
+ char *string;
+ {
+ register char *s, *t;
+
+ for (s = string; whitespace (*s); s++)
+ ;
+
+ if (*s == 0)
+ return (s);
+
+ t = s + strlen (s) - 1;
+ while (t > s && whitespace (*t))
+ t--;
+ *++t = '\0';
+
+ return s;
+ }
+
+ /* **************************************************************** */
+ /* */
+ /* Interface to Readline Completion */
+ /* */
+ /* **************************************************************** */
+
+ char *command_generator ();
+ char **fileman_completion ();
+
+ /* Tell the GNU Readline library how to complete. We want to try to complete
+ on command names if this is the first word in the line, or on filenames
+ if not. */
+ initialize_readline ()
+ {
+ /* Allow conditional parsing of the ~/.inputrc file. */
+ rl_readline_name = "FileMan";
+
+ /* Tell the completer that we want a crack first. */
+ rl_attempted_completion_function = (CPPFunction *)fileman_completion;
+ }
+
+ /* Attempt to complete on the contents of TEXT. START and END bound the
+ region of rl_line_buffer that contains the word to complete. TEXT is
+ the word to complete. We can use the entire contents of rl_line_buffer
+ in case we want to do some simple parsing. Return the array of matches,
+ or NULL if there aren't any. */
+ char **
+ fileman_completion (text, start, end)
+ char *text;
+ int start, end;
+ {
+ char **matches;
+
+ matches = (char **)NULL;
+
+ /* If this word is at the start of the line, then it is a command
+ to complete. Otherwise it is the name of a file in the current
+ directory. */
+ if (start == 0)
+ matches = completion_matches (text, command_generator);
+
+ return (matches);
+ }
+
+ /* Generator function for command completion. STATE lets us know whether
+ to start from scratch; without any state (i.e. STATE == 0), then we
+ start at the top of the list. */
+ char *
+ command_generator (text, state)
+ char *text;
+ int state;
+ {
+ static int list_index, len;
+ char *name;
+
+ /* If this is a new word to complete, initialize now. This includes
+ saving the length of TEXT for efficiency, and initializing the index
+ variable to 0. */
+ if (!state)
+ {
+ list_index = 0;
+ len = strlen (text);
+ }
+
+ /* Return the next name which partially matches from the command list. */
+ while (name = commands[list_index].name)
+ {
+ list_index++;
+
+ if (strncmp (name, text, len) == 0)
+ return (dupstr(name));
+ }
+
+ /* If no names matched, then return NULL. */
+ return ((char *)NULL);
+ }
+
+ /* **************************************************************** */
+ /* */
+ /* FileMan Commands */
+ /* */
+ /* **************************************************************** */
+
+ /* String to pass to system (). This is for the LIST, VIEW and RENAME
+ commands. */
+ static char syscom[1024];
+
+ /* List the file(s) named in arg. */
+ com_list (arg)
+ char *arg;
+ {
+ if (!arg)
+ arg = "";
+
+ sprintf (syscom, "ls -FClg %s", arg);
+ return (system (syscom));
+ }
+
+ com_view (arg)
+ char *arg;
+ {
+ if (!valid_argument ("view", arg))
+ return 1;
+
+ sprintf (syscom, "more %s", arg);
+ return (system (syscom));
+ }
+
+ com_rename (arg)
+ char *arg;
+ {
+ too_dangerous ("rename");
+ return (1);
+ }
+
+ com_stat (arg)
+ char *arg;
+ {
+ struct stat finfo;
+
+ if (!valid_argument ("stat", arg))
+ return (1);
+
+ if (stat (arg, &finfo) == -1)
+ {
+ perror (arg);
+ return (1);
+ }
+
+ printf ("Statistics for `%s':\n", arg);
+
+ printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
+ finfo.st_nlink,
+ (finfo.st_nlink == 1) ? "" : "s",
+ finfo.st_size,
+ (finfo.st_size == 1) ? "" : "s");
+ printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
+ printf (" Last access at: %s", ctime (&finfo.st_atime));
+ printf (" Last modified at: %s", ctime (&finfo.st_mtime));
+ return (0);
+ }
+
+ com_delete (arg)
+ char *arg;
+ {
+ too_dangerous ("delete");
+ return (1);
+ }
+
+ /* Print out help for ARG, or for all of the commands if ARG is
+ not present. */
+ com_help (arg)
+ char *arg;
+ {
+ register int i;
+ int printed = 0;
+
+ for (i = 0; commands[i].name; i++)
+ {
+ if (!*arg || (strcmp (arg, commands[i].name) == 0))
+ {
+ printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
+ printed++;
+ }
+ }
+
+ if (!printed)
+ {
+ printf ("No commands match `%s'. Possibilties are:\n", arg);
+
+ for (i = 0; commands[i].name; i++)
+ {
+ /* Print in six columns. */
+ if (printed == 6)
+ {
+ printed = 0;
+ printf ("\n");
+ }
+
+ printf ("%s\t", commands[i].name);
+ printed++;
+ }
+
+ if (printed)
+ printf ("\n");
+ }
+ return (0);
+ }
+
+ /* Change to the directory ARG. */
+ com_cd (arg)
+ char *arg;
+ {
+ if (chdir (arg) == -1)
+ {
+ perror (arg);
+ return 1;
+ }
+
+ com_pwd ("");
+ return (0);
+ }
+
+ /* Print out the current working directory. */
+ com_pwd (ignore)
+ char *ignore;
+ {
+ char dir[1024], *s;
+
+ s = getwd (dir);
+ if (s == 0)
+ {
+ printf ("Error getting pwd: %s\n", dir);
+ return 1;
+ }
+
+ printf ("Current directory is %s\n", dir);
+ return 0;
+ }
+
+ /* The user wishes to quit using this program. Just set DONE non-zero. */
+ com_quit (arg)
+ char *arg;
+ {
+ done = 1;
+ return (0);
+ }
+
+ /* Function which tells you that you can't do this. */
+ too_dangerous (caller)
+ char *caller;
+ {
+ fprintf (stderr,
+ "%s: Too dangerous for me to distribute. Write it yourself.\n",
+ caller);
+ }
+
+ /* Return non-zero if ARG is a valid argument for CALLER, else print
+ an error message and return zero. */
+ int
+ valid_argument (caller, arg)
+ char *caller, *arg;
+ {
+ if (!arg || !*arg)
+ {
+ fprintf (stderr, "%s: Argument required.\n", caller);
+ return (0);
+ }
+
+ return (1);
+ }
+
+
+File: readline.info, Node: Concept Index, Next: Function and Variable Index, Prev: Programming with GNU Readline, Up: Top
+
+Concept Index
+*************
+
+* Menu:
+
+* command editing: Readline Bare Essentials.
+* editing command lines: Readline Bare Essentials.
+* initialization file, readline: Readline Init File.
+* interaction, readline: Readline Interaction.
+* kill ring: Readline Killing Commands.
+* killing text: Readline Killing Commands.
+* notation, readline: Readline Bare Essentials.
+* readline, function: Basic Behavior.
+* yanking text: Readline Killing Commands.
+
+
+File: readline.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
+
+Function and Variable Index
+***************************
+
+* Menu:
+
+* (: Utility Functions.
+* abort (C-g): Miscellaneous Commands.
+* accept-line (Newline, Return): Commands For History.
+* alphabetic: Utility Functions.
+* backward-char (C-b): Commands For Moving.
+* backward-delete-char (Rubout): Commands For Text.
+* backward-kill-line (C-x Rubout): Commands For Killing.
+* backward-kill-word (M-DEL): Commands For Killing.
+* backward-word (M-b): Commands For Moving.
+* beginning-of-history (M-<): Commands For History.
+* beginning-of-line (C-a): Commands For Moving.
+* bell-style: Readline Init File Syntax.
+* call-last-kbd-macro (C-x e): Keyboard Macros.
+* capitalize-word (M-c): Commands For Text.
+* character-search (C-]): Miscellaneous Commands.
+* character-search-backward (M-C-]): Miscellaneous Commands.
+* clear-screen (C-l): Commands For Moving.
+* comment-begin: Readline Init File Syntax.
+* complete (TAB): Commands For Completion.
+* completion-query-items: Readline Init File Syntax.
+* completion_matches: Completion Functions.
+* convert-meta: Readline Init File Syntax.
+* copy-backward-word (): Commands For Killing.
+* copy-forward-word (): Commands For Killing.
+* copy-region-as-kill (): Commands For Killing.
+* delete-char (C-d): Commands For Text.
+* delete-char-or-list (): Commands For Completion.
+* delete-horizontal-space (): Commands For Killing.
+* digit-argument (M-0, M-1, ... M--): Numeric Arguments.
+* digit_p: Utility Functions.
+* digit_value: Utility Functions.
+* ding: Utility Functions.
+* disable-completion: Readline Init File Syntax.
+* do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
+* downcase-word (M-l): Commands For Text.
+* dump-functions (): Miscellaneous Commands.
+* dump-macros (): Miscellaneous Commands.
+* dump-variables (): Miscellaneous Commands.
+* editing-mode: Readline Init File Syntax.
+* enable-keypad: Readline Init File Syntax.
+* end-kbd-macro (C-x )): Keyboard Macros.
+* end-of-history (M->): Commands For History.
+* end-of-line (C-e): Commands For Moving.
+* exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
+* expand-tilde: Readline Init File Syntax.
+* filename_completion_function: Completion Functions.
+* forward-backward-delete-char (): Commands For Text.
+* forward-char (C-f): Commands For Moving.
+* forward-search-history (C-s): Commands For History.
+* forward-word (M-f): Commands For Moving.
+* free_undo_list: Allowing Undoing.
+* history-search-backward (): Commands For History.
+* history-search-forward (): Commands For History.
+* horizontal-scroll-mode: Readline Init File Syntax.
+* input-meta: Readline Init File Syntax.
+* insert-comment (M-#): Miscellaneous Commands.
+* insert-completions (M-*): Commands For Completion.
+* isearch-terminators: Readline Init File Syntax.
+* keymap: Readline Init File Syntax.
+* kill-line (C-k): Commands For Killing.
+* kill-region (): Commands For Killing.
+* kill-whole-line (): Commands For Killing.
+* kill-word (M-d): Commands For Killing.
+* lowercase_p: Utility Functions.
+* mark-modified-lines: Readline Init File Syntax.
+* menu-complete (): Commands For Completion.
+* meta-flag: Readline Init File Syntax.
+* next-history (C-n): Commands For History.
+* non-incremental-forward-search-history (M-n): Commands For History.
+* non-incremental-reverse-search-history (M-p): Commands For History.
+* numeric: Utility Functions.
+* output-meta: Readline Init File Syntax.
+* possible-completions (M-?): Commands For Completion.
+* prefix-meta (ESC): Miscellaneous Commands.
+* previous-history (C-p): Commands For History.
+* quoted-insert (C-q, C-v): Commands For Text.
+* re-read-init-file (C-x C-r): Miscellaneous Commands.
+* readline: Basic Behavior.
+* redraw-current-line (): Commands For Moving.
+* reverse-search-history (C-r): Commands For History.
+* revert-line (M-r): Miscellaneous Commands.
+* rl_add_defun: Function Naming.
+* rl_add_undo: Allowing Undoing.
+* rl_attempted_completion_function: Completion Variables.
+* rl_basic_quote_characters: Completion Variables.
+* rl_basic_word_break_characters: Completion Variables.
+* rl_begin_undo_group: Allowing Undoing.
+* rl_bind_key: Binding Keys.
+* rl_bind_key_in_map: Binding Keys.
+* rl_binding_keymap: Readline Variables.
+* rl_callback_handler_install: Alternate Interface.
+* rl_callback_handler_remove: Alternate Interface.
+* rl_callback_read_char: Alternate Interface.
+* rl_catch_signals: Readline Signal Handling.
+* rl_catch_sigwinch: Readline Signal Handling.
+* rl_char_is_quoted_p: Completion Variables.
+* rl_cleanup_after_signal: Readline Signal Handling.
+* rl_clear_message: Redisplay.
+* rl_clear_signals: Readline Signal Handling.
+* rl_complete <1>: Completion Functions.
+* rl_complete: How Completing Works.
+* rl_complete_internal: Completion Functions.
+* rl_completer_quote_characters: Completion Variables.
+* rl_completer_word_break_characters: Completion Variables.
+* rl_completion_append_character: Completion Variables.
+* rl_completion_display_matches_hook: Completion Variables.
+* rl_completion_entry_function <1>: How Completing Works.
+* rl_completion_entry_function: Completion Variables.
+* rl_completion_query_items: Completion Variables.
+* rl_copy_keymap: Keymaps.
+* rl_copy_text: Modifying Text.
+* rl_delete_text: Modifying Text.
+* rl_directory_completion_hook: Completion Variables.
+* rl_discard_keymap: Keymaps.
+* rl_display_match_list: Utility Functions.
+* rl_do_undo: Allowing Undoing.
+* rl_done: Readline Variables.
+* rl_end: Readline Variables.
+* rl_end_undo_group: Allowing Undoing.
+* rl_erase_empty_line: Readline Variables.
+* rl_event_hook: Readline Variables.
+* rl_executing_keymap: Readline Variables.
+* rl_filename_completion_desired: Completion Variables.
+* rl_filename_dequoting_function: Completion Variables.
+* rl_filename_quote_characters: Completion Variables.
+* rl_filename_quoting_desired: Completion Variables.
+* rl_filename_quoting_function: Completion Variables.
+* rl_forced_update_display: Redisplay.
+* rl_free_line_state: Readline Signal Handling.
+* rl_function_dumper: Associating Function Names and Bindings.
+* rl_function_of_keyseq: Associating Function Names and Bindings.
+* rl_generic_bind: Binding Keys.
+* rl_get_keymap: Keymaps.
+* rl_get_keymap_by_name: Keymaps.
+* rl_get_keymap_name: Keymaps.
+* rl_getc: Utility Functions.
+* rl_getc_function: Readline Variables.
+* rl_ignore_completion_duplicates: Completion Variables.
+* rl_ignore_some_completions_function: Completion Variables.
+* rl_inhibit_completion: Completion Variables.
+* rl_initialize: Utility Functions.
+* rl_insert_completions: Completion Functions.
+* rl_insert_text: Modifying Text.
+* rl_instream: Readline Variables.
+* rl_invoking_keyseqs: Associating Function Names and Bindings.
+* rl_invoking_keyseqs_in_map: Associating Function Names and Bindings.
+* rl_kill_text: Modifying Text.
+* rl_library_version: Readline Variables.
+* rl_line_buffer: Readline Variables.
+* rl_list_funmap_names: Associating Function Names and Bindings.
+* rl_make_bare_keymap: Keymaps.
+* rl_make_keymap: Keymaps.
+* rl_mark: Readline Variables.
+* rl_message: Redisplay.
+* rl_modifying: Allowing Undoing.
+* rl_named_function: Associating Function Names and Bindings.
+* rl_on_new_line: Redisplay.
+* rl_outstream: Readline Variables.
+* rl_parse_and_bind: Binding Keys.
+* rl_pending_input: Readline Variables.
+* rl_point: Readline Variables.
+* rl_possible_completions: Completion Functions.
+* rl_pre_input_hook: Readline Variables.
+* rl_prompt: Readline Variables.
+* rl_read_init_file: Binding Keys.
+* rl_read_key: Utility Functions.
+* rl_readline_name: Readline Variables.
+* rl_redisplay: Redisplay.
+* rl_redisplay_function: Readline Variables.
+* rl_reset_after_signal: Readline Signal Handling.
+* rl_reset_line_state: Redisplay.
+* rl_reset_terminal: Utility Functions.
+* rl_resize_terminal: Readline Signal Handling.
+* rl_restore_prompt: Redisplay.
+* rl_save_prompt: Redisplay.
+* rl_set_keymap: Keymaps.
+* rl_set_signals: Readline Signal Handling.
+* rl_special_prefixes: Completion Variables.
+* rl_startup_hook: Readline Variables.
+* rl_stuff_char: Utility Functions.
+* rl_terminal_name: Readline Variables.
+* rl_unbind_command_in_map: Binding Keys.
+* rl_unbind_function_in_map: Binding Keys.
+* rl_unbind_key: Binding Keys.
+* rl_unbind_key_in_map: Binding Keys.
+* self-insert (a, b, A, 1, !, ...): Commands For Text.
+* set-mark (C-@): Miscellaneous Commands.
+* show-all-if-ambiguous: Readline Init File Syntax.
+* start-kbd-macro (C-x (): Keyboard Macros.
+* to_lower: Utility Functions.
+* to_upper: Utility Functions.
+* transpose-chars (C-t): Commands For Text.
+* transpose-words (M-t): Commands For Text.
+* undo (C-_, C-x C-u): Miscellaneous Commands.
+* universal-argument (): Numeric Arguments.
+* unix-line-discard (C-u): Commands For Killing.
+* unix-word-rubout (C-w): Commands For Killing.
+* upcase-word (M-u): Commands For Text.
+* uppercase_p: Utility Functions.
+* username_completion_function: Completion Functions.
+* visible-stats: Readline Init File Syntax.
+* yank (C-y): Commands For Killing.
+* yank-last-arg (M-., M-_): Commands For History.
+* yank-nth-arg (M-C-y): Commands For History.
+* yank-pop (M-y): Commands For Killing.
+
+
+
+Tag Table:
+Node: Top1190
+Node: Command Line Editing1789
+Node: Introduction and Notation2440
+Node: Readline Interaction3479
+Node: Readline Bare Essentials4672
+Node: Readline Movement Commands6213
+Node: Readline Killing Commands7179
+Node: Readline Arguments8895
+Node: Searching9870
+Node: Readline Init File11583
+Node: Readline Init File Syntax12630
+Node: Conditional Init Constructs21837
+Node: Sample Init File24276
+Node: Bindable Readline Commands27446
+Node: Commands For Moving28197
+Node: Commands For History29045
+Node: Commands For Text31797
+Node: Commands For Killing33816
+Node: Numeric Arguments35966
+Node: Commands For Completion37093
+Node: Keyboard Macros38841
+Node: Miscellaneous Commands39400
+Node: Readline vi Mode42204
+Node: Programming with GNU Readline43974
+Node: Basic Behavior44942
+Node: Custom Functions48268
+Node: The Function Type48869
+Node: Function Writing49714
+Node: Readline Variables50798
+Node: Readline Convenience Functions54407
+Node: Function Naming55145
+Node: Keymaps56373
+Node: Binding Keys58087
+Node: Associating Function Names and Bindings60295
+Node: Allowing Undoing61873
+Node: Redisplay64458
+Node: Modifying Text65853
+Node: Utility Functions66764
+Node: Alternate Interface69448
+Node: Readline Signal Handling72742
+Node: Custom Completers77788
+Node: How Completing Works78503
+Node: Completion Functions81499
+Node: Completion Variables84514
+Node: A Short Completion Example92412
+Node: Concept Index104718
+Node: Function and Variable Index105472
+
+End Tag Table
diff --git a/readline/doc/readline.ps b/readline/doc/readline.ps
new file mode 100644
index 00000000000..cff4c3ccf98
--- /dev/null
+++ b/readline/doc/readline.ps
@@ -0,0 +1,5225 @@
+%!PS-Adobe-2.0
+%%Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software
+%%Title: readline.dvi
+%%Pages: 56
+%%PageOrder: Ascend
+%%BoundingBox: 0 0 596 842
+%%DocumentPaperSizes: A4
+%%EndComments
+%DVIPSCommandLine: dvips -D 300 -o readline.ps readline.dvi
+%DVIPSParameters: dpi=300, comments removed
+%DVIPSSource: TeX output 1998.12.31:1253
+%%BeginProcSet: tex.pro
+/TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N
+/X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72
+mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1}
+ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale
+isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div
+hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul
+TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if}
+forall round exch round exch]setmatrix}N /@landscape{/isls true N}B
+/@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B
+/FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{
+/nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N
+string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N
+end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{
+/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0]
+N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup
+length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{
+128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub
+get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data
+dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N
+/rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup
+/base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx
+0 ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff
+setcachedevice ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff
+.1 sub]{ch-image}imagemask restore}B /D{/cc X dup type /stringtype ne{]}
+if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{dup dup
+length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N}B /I{
+cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin
+0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul
+add .99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore userdict
+/eop-hook known{eop-hook}if showpage}N /@start{userdict /start-hook
+known{start-hook}if pop /VResolution X /Resolution X 1000 div /DVImag X
+/IE 256 array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for
+65781.76 div /vsize X 65781.76 div /hsize X}N /p{show}N /RMat[1 0 0 -1 0
+0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X /rulex X V}B /V
+{}B /RV statusdict begin /product where{pop product dup length 7 ge{0 7
+getinterval dup(Display)eq exch 0 4 getinterval(NeXT)eq or}{pop false}
+ifelse}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale rulex ruley false
+RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR rulex ruley scale 1 1
+false RMat{BDot}imagemask grestore}}ifelse B /QV{gsave newpath transform
+round exch round exch itransform moveto rulex 0 rlineto 0 ruley neg
+rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N /tail
+{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M}
+B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{
+4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{
+p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p
+a}B /bos{/SS save N}B /eos{SS restore}B end
+%%EndProcSet
+TeXDict begin 39158280 55380996 1000 300 300 (readline.dvi)
+@start /Fa 1 47 df<70F8F8F0E005057B840E>46 D E /Fb 1
+47 df<0E003F007F807F80FF80FF80FF007E003C000909798815>46
+D E /Fc 1 59 df<60F0F06004047D830B>58 D E /Fd 53 127
+df<60F0F0F0F0F0F0F0F0F0F0F0F0F0600000000060F0F0600417789614>33
+D<071C00071C00071C00071C00071C00FFFF80FFFF807FFF800E38000E38000E38000E38
+000E38000E38000E38007FFF80FFFF80FFFF801C70001C70001C70001C70001C70001117
+7F9614>35 D<0180038006000C001C0018003800700070007000E000E000E000E000E000
+E000E000E000E000700070007000380018001C000C00060003800180091D799914>40
+D<80C0603038181C0E0E0E0707070707070707070E0E0E1C18383060C080081D7C9914>
+I<038003800380638CF39E7FFC3FF80FE00FE03FF87FFCF39E638C0380038003800F107E
+9214>I<70F8FCFC7C0C1830E0C0060A798414>44 DI<70F8
+F8F8700505798414>I<07C00FE01C7038383018701C701CE00EE00EE00EE00EE00EE00E
+E00EE00EE00E701C701C383838381C700FE007C00F177E9614>48
+D<0300030007000F003F00F7004700070007000700070007000700070007000700070007
+000700070007007FF07FF00C177C9614>I<0006001E003E00F801F003C00F801F003C00
+F800F000F8003C001F000F8003C001F000F8003E001E00060F157E9514>60
+D62 D<1FE03FF8701CE00EE00E400E003C007000E001C003
+800380038003800300000000000000000003000780078003000F177E9614>I<01E007F0
+0E38181C38FC71FC731E771EEE0EEE0EEE0EEE0EEE0EEE0EEE0E771C731871F038E01806
+0E1E07F801F00F177E9614>I<01C00003E00003E0000360000360000770000770000770
+000770000630000E38000E38000E38000E38001C1C001FFC001FFC001C1C001C1C00380E
+00380E00FE3F80FE3F8011177F9614>II<01F1
+8007FF800E1F801C0780380780700380700380700380E00000E00000E00000E00000E000
+00E00000E000007003807003807003803807001C07000E0E0007FC0001F00011177F9614
+>III76
+DII82 D<0FCC1FFC307C603CE01CE01CE01CE00070007E003FE0
+0FF001F8001C001E000E600EE00EE00EF01CF838FFF0C7E00F177E9614>I<7FFF80FFFF
+80E1C380E1C380E1C380E1C38001C00001C00001C00001C00001C00001C00001C00001C0
+0001C00001C00001C00001C00001C00001C00001C0000FF8000FF80011177F9614>I93
+D95 D<1FC0007FF000707800201800001C00001C0007FC00
+1FFC003C1C00701C00E01C00E01C00E01C00707C003FFF800F8F8011107E8F14>97
+DI<03F80FFE1C0E380470006000E000E000E000E00060007000380E1C1E0FFC03
+F00F107E8F14>I<007E00007E00000E00000E00000E00000E00000E0007CE000FFE001C
+3E00301E00700E00E00E00E00E00E00E00E00E00E00E00E00E00700E00301E00383E001F
+EFC007CFC012177F9614>I<07E00FF01C38301C700CE00EE00EFFFEFFFEE00060007000
+380E1C1E0FFC03F00F107E8F14>I<00FC01FE038E07040700070007007FFEFFFE070007
+000700070007000700070007000700070007000700FFF8FFF80F177F9614>I<07CF001F
+FF80383B80301800701C00701C00701C003018003838003FF00037C0007000007000003F
+F8001FFC003FFE00700F00E00380E00380E00380E003807007003C1E001FFC0007F00011
+197F8F14>II<06000F000F0006000000000000000000FF00FF00070007000700
+070007000700070007000700070007000700FFF8FFF80D187C9714>I107
+DI
+II<07C01FF03C78701C701CE00EE00EE00E
+E00EE00EE00E701C783C3C781FF007C00F107E8F14>II<03E7000FF700
+1C1F00300F00700F00E00700E00700E00700E00700E00700E00700700F00300F001C3F00
+0FF70007C700000700000700000700000700000700000700003FE0003FE013187F8F14>
+II<0FD83FF86038C038C038F0007F803FF0
+07F8001C6006E006F006F81CFFF8CFE00F107E8F14>I<06000E000E000E000E007FFCFF
+FC0E000E000E000E000E000E000E000E000E0E0E0E0E0E0E1C07F801F00F157F9414>I<
+FC3F00FC3F001C07001C07001C07001C07001C07001C07001C07001C07001C07001C0700
+1C07001C1F000FFFE003E7E01310808F14>III<7E3F007E3F001E3C000E7800077000
+07E00003E00001C00003C00003E0000770000E78000E38001C1C00FE3F80FE3F8011107F
+8F14>II<3FFF7FFF700E701C7038007000E001C0038007000E001C0738
+077007FFFFFFFF10107F8F14>I<1C103F38E7E041C00D047D9614>126
+D E /Fe 2 121 df<7070F06004047D830B>46 D<3FC7E007838007020003840003C800
+01D80000F00000E00000F00001F000013800023800041C00081E00381E00FC3FC013107F
+8F14>120 D E /Ff 38 123 df<00FE000381000601800E03801C01001C00001C00001C
+00001C00001C0000FFFF801C03801C03801C03801C03801C03801C03801C03801C03801C
+03801C03801C03801C03801C03801C0380FF8FF0141A809915>12
+D<00FF800383800603800E03801C03801C03801C03801C03801C03801C0380FFFF801C03
+801C03801C03801C03801C03801C03801C03801C03801C03801C03801C03801C03801C03
+801C0380FF9FF0141A809915>I<60F0F07010101020204040040B7D830B>44
+DI<03000700FF00070007000700070007000700070007000700
+070007000700070007000700070007000700070007007FF80D187D9713>49
+D<0F80106020304038803CC01CE01C401C003C003800380070006000C001800100020004
+040804100430083FF87FF8FFF80E187E9713>I<07E01838201C601E700E201E001E001C
+001C0038007007E00038001C000E000F000FE00FE00FC00F400E601C183807E010187F97
+13>I<001800180038007800F800B8013802380238043808381838103820384038C038FF
+FF00380038003800380038003803FF10187F9713>I<30183FF03FE03F80200020002000
+200020002FC03060203000380018001C001C401CE01CE01C80184038403030E00F800E18
+7E9713>I<01F807040C06180E300E300070006000E000E3E0E418E80CF00EE006E007E0
+07E007600760077006300E180C0C3807E010187F9713>I<40007FFF7FFE7FFE40048008
+80108010002000400040008001800100030003000700060006000E000E000E000E000E00
+040010197E9813>I<07E01818300C2006600660067006780C3E181F3007C003E00CF830
+7C601E600FC007C003C003C00360022004181807E010187F9713>I<07E01C303018700C
+600EE006E006E007E007E0076007700F3017182707C700070006000E000C700C70186030
+30600F8010187F9713>I<1FC000387000383800101C00001C00001C0003FC001E1C0038
+1C00701C00E01C00E01C80E01C80E03C80705F801F8F0011107F8F13>97
+DI<07F81C1C381C70087000E000E000E000E000E000E000
+7000700438081C1807E00E107F8F11>I<003F0000070000070000070000070000070000
+070000070000070000070003E7000C1700180F00300700700700E00700E00700E00700E0
+0700E00700E00700600700700700380F001C370007C7E0131A7F9915>I<07C01C303018
+7018600CE00CFFFCE000E000E000E0006000700438081C1807E00E107F8F11>I<01F007
+180E381C101C001C001C001C001C001C00FFC01C001C001C001C001C001C001C001C001C
+001C001C001C001C001C00FF800D1A80990C>I<0FCF0018718030300070380070380070
+38007038003030001860002FC0006000006000007000003FF0003FFC001FFE00600F00C0
+0300C00300C00300C00300600600381C0007E00011187F8F13>II<183C3C18000000000000FC1C1C1C1C1C1C1C1C1C1C1C1C1C1CFF081A80990A>I<
+FC00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C1FC01C0F00
+1C0C001C18001C20001C40001CE0001DE0001E70001C78001C38001C1C001C1E001C0F00
+1C0F80FF9FE0131A809914>107 DI
+II<07E01C38300C700E6006E007E007E007
+E007E007E0076006700E381C1C3807E010107F8F13>II<03E1000C1300180B00
+300F00700700E00700E00700E00700E00700E00700E00700700700700700380F001C3700
+07C700000700000700000700000700000700000700003FE013177F8F14>II<1F20
+60E04020C020C020F0007F003FC01FE000F080708030C030C020F0408F800C107F8F0F>
+I<0800080008000800180018003800FFC038003800380038003800380038003800382038
+203820382018201C4007800B177F960F>I
+IIIIII E /Fg 2 42 df<00E001C00380078007000F001E001E001C003C00
+3C0038007800780078007000F000F000F000F000F000F000F000F000F000F000F000F000
+F000F000700078007800780038003C003C001C001E001E000F0007000780038001C000E0
+0B2E7CA112>40 DI
+E /Fh 28 123 df<000FF83F00007FFDFFC001FC1FE3E003F03FC7E007E03FC7E00FC03F
+87E00FC03F83C00FC01F80000FC01F80000FC01F80000FC01F80000FC01F80000FC01F80
+00FFFFFFFC00FFFFFFFC000FC01F80000FC01F80000FC01F80000FC01F80000FC01F8000
+0FC01F80000FC01F80000FC01F80000FC01F80000FC01F80000FC01F80000FC01F80000F
+C01F80000FC01F80000FC01F80000FC01F80000FC01F80000FC01F80007FF8FFF8007FF8
+FFF80023237FA221>11 D<0007F800007FFC0001FC0E0003F01F0007E03F000FC03F000F
+C03F000FC03F000FC01E000FC00C000FC000000FC000000FC0FF80FFFFFF80FFFFFF800F
+C01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F800F
+C01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F800FC01F807F
+F8FFF07FF8FFF01C237FA220>I<00180030006000C001C00380078007000F001E001E00
+3E003C003C007C007C007C007800F800F800F800F800F800F800F800F800F800F800F800
+F800F80078007C007C007C003C003C003E001E001E000F0007000780038001C000C00060
+003000180D317BA416>40 D<07FE00001FFF80003F07E0003F03F0003F01F0003F01F800
+1E01F8000001F8000001F800003FF80003FDF8001F81F8003E01F8007C01F800F801F800
+F801F800F801F800F801F8007C02F8007E0CF8001FF87F8007E03F8019167E951C>97
+DI<00FF8007FFE00F83F01F03F03E03F07E03F07C01E07C0000FC0000FC0000FC00
+00FC0000FC0000FC00007C00007E00007E00003E00181F00300FC06007FFC000FF001516
+7E9519>I<0001FF000001FF0000003F0000003F0000003F0000003F0000003F0000003F
+0000003F0000003F0000003F0000003F0000003F0000FE3F0007FFBF000FC1FF001F007F
+003E003F007E003F007C003F007C003F00FC003F00FC003F00FC003F00FC003F00FC003F
+00FC003F00FC003F007C003F007E003F003E003F001F007F000F81FF0007FF3FE001FC3F
+E01B237EA220>I<00FE0007FF800F83C01E01E03E00F07E00F07C00F87C0078FC0078FF
+FFF8FFFFF8FC0000FC0000FC00007C00007C00003E00183E00181F00300F80E003FFC000
+FF0015167E951A>I<001F8000FFE001F1F003E3F007E3F00FC3F00FC1E00FC0000FC000
+0FC0000FC0000FC0000FC000FFFE00FFFE000FC0000FC0000FC0000FC0000FC0000FC000
+0FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC000
+7FFC007FFC0014237EA212>I<00FE0F8003FF9FC00F83E3C01F01F3C01E00F0003E00F8
+003E00F8003E00F8003E00F8003E00F8001E00F0001F01F0000F83E0000BFF800008FE00
+0018000000180000001C0000001FFFE0001FFFFC000FFFFF0007FFFF001FFFFF807C001F
+C078000FC0F80007C0F80007C0F80007C07C000F803E001F001F807E000FFFFC0001FFE0
+001A217F951D>II<1E003F007F807F807F807F803F001E00000000000000000000
+000000FF80FF801F801F801F801F801F801F801F801F801F801F801F801F801F801F801F
+801F801F801F80FFF0FFF00C247EA30F>I107 DIII<00FF0007FFE00F81F01F00F83E007C7C003E7C003E7C003EFC00
+3FFC003FFC003FFC003FFC003FFC003FFC003F7C003E7E007E3E007C1F00F80F81F007FF
+E000FF0018167E951D>I