Annotation of embedaddon/readline/doc/history.0, revision 1.1

1.1     ! misho       1: HISTORY(3)                                                          HISTORY(3)
        !             2: 
        !             3: 
        !             4: 
        !             5: NNAAMMEE
        !             6:        history - GNU History Library
        !             7: 
        !             8: CCOOPPYYRRIIGGHHTT
        !             9:        The GNU History Library is Copyright (C) 1989-2011 by the Free Software
        !            10:        Foundation, Inc.
        !            11: 
        !            12: DDEESSCCRRIIPPTTIIOONN
        !            13:        Many programs read input from the user a line at a time.  The GNU  His-
        !            14:        tory  library is able to keep track of those lines, associate arbitrary
        !            15:        data with each line, and utilize information  from  previous  lines  in
        !            16:        composing new ones.
        !            17: 
        !            18: 
        !            19: HHIISSTTOORRYY EEXXPPAANNSSIIOONN
        !            20:        The  history library supports a history expansion feature that is iden-
        !            21:        tical to the history expansion in bbaasshh..  This  section  describes  what
        !            22:        syntax features are available.
        !            23: 
        !            24:        History expansions introduce words from the history list into the input
        !            25:        stream, making it easy to repeat commands, insert the  arguments  to  a
        !            26:        previous command into the current input line, or fix errors in previous
        !            27:        commands quickly.
        !            28: 
        !            29:        History expansion is usually performed  immediately  after  a  complete
        !            30:        line  is read.  It takes place in two parts.  The first is to determine
        !            31:        which line from the history list to use during substitution.  The  sec-
        !            32:        ond  is  to select portions of that line for inclusion into the current
        !            33:        one.  The line selected from the history is the _e_v_e_n_t, and the portions
        !            34:        of  that  line  that  are  acted upon are _w_o_r_d_s.  Various _m_o_d_i_f_i_e_r_s are
        !            35:        available to manipulate the selected words.  The line  is  broken  into
        !            36:        words in the same fashion as bbaasshh does when reading input, so that sev-
        !            37:        eral words that would otherwise be separated are  considered  one  word
        !            38:        when  surrounded  by  quotes (see the description of hhiissttoorryy__ttookkeenniizzee(())
        !            39:        below).  History expansions are introduced by  the  appearance  of  the
        !            40:        history expansion character, which is !! by default.  Only backslash (\\)
        !            41:        and single quotes can quote the history expansion character.
        !            42: 
        !            43:    EEvveenntt DDeessiiggnnaattoorrss
        !            44:        An event designator is a reference to a command line entry in the  his-
        !            45:        tory  list.   Unless  the reference is absolute, events are relative to
        !            46:        the current position in the history list.
        !            47: 
        !            48:        !!      Start a history substitution, except when followed by  a  bbllaannkk,
        !            49:               newline, = or (.
        !            50:        !!_n     Refer to command line _n.
        !            51:        !!--_n    Refer to the current command minus _n.
        !            52:        !!!!     Refer to the previous command.  This is a synonym for `!-1'.
        !            53:        !!_s_t_r_i_n_g
        !            54:               Refer  to the most recent command preceding the current position
        !            55:               in the history list starting with _s_t_r_i_n_g.
        !            56:        !!??_s_t_r_i_n_g[[??]]
        !            57:               Refer to the most recent command preceding the current  position
        !            58:               in  the  history  list containing _s_t_r_i_n_g.  The trailing ?? may be
        !            59:               omitted if _s_t_r_i_n_g is followed immediately by a newline.
        !            60:        ^^_s_t_r_i_n_g_1^^_s_t_r_i_n_g_2^^
        !            61:               Quick substitution.  Repeat the last command, replacing  _s_t_r_i_n_g_1
        !            62:               with _s_t_r_i_n_g_2.  Equivalent to ``!!:s/_s_t_r_i_n_g_1/_s_t_r_i_n_g_2/'' (see MMoodd--
        !            63:               iiffiieerrss below).
        !            64:        !!##     The entire command line typed so far.
        !            65: 
        !            66:    WWoorrdd DDeessiiggnnaattoorrss
        !            67:        Word designators are used to select desired words from the event.  A  ::
        !            68:        separates  the event specification from the word designator.  It may be
        !            69:        omitted if the word designator begins with a ^^, $$, **, --, or  %%.   Words
        !            70:        are  numbered from the beginning of the line, with the first word being
        !            71:        denoted by 0 (zero).  Words are inserted into the  current  line  sepa-
        !            72:        rated by single spaces.
        !            73: 
        !            74:        00 ((zzeerroo))
        !            75:               The zeroth word.  For the shell, this is the command word.
        !            76:        _n      The _nth word.
        !            77:        ^^      The first argument.  That is, word 1.
        !            78:        $$      The  last  word.   This  is  usually the last argument, but will
        !            79:               expand to the zeroth word if there is only one word in the line.
        !            80:        %%      The word matched by the most recent `?_s_t_r_i_n_g?' search.
        !            81:        _x--_y    A range of words; `-_y' abbreviates `0-_y'.
        !            82:        **      All  of  the words but the zeroth.  This is a synonym for `_1_-_$'.
        !            83:               It is not an error to use ** if there is just  one  word  in  the
        !            84:               event; the empty string is returned in that case.
        !            85:        xx**     Abbreviates _x_-_$.
        !            86:        xx--     Abbreviates _x_-_$ like xx**, but omits the last word.
        !            87: 
        !            88:        If  a  word  designator is supplied without an event specification, the
        !            89:        previous command is used as the event.
        !            90: 
        !            91:    MMooddiiffiieerrss
        !            92:        After the optional word designator, there may appear a sequence of  one
        !            93:        or more of the following modifiers, each preceded by a `:'.
        !            94: 
        !            95:        hh      Remove a trailing file name component, leaving only the head.
        !            96:        tt      Remove all leading file name components, leaving the tail.
        !            97:        rr      Remove a trailing suffix of the form _._x_x_x, leaving the basename.
        !            98:        ee      Remove all but the trailing suffix.
        !            99:        pp      Print the new command but do not execute it.
        !           100:        qq      Quote the substituted words, escaping further substitutions.
        !           101:        xx      Quote the substituted words as with qq, but break into  words  at
        !           102:               bbllaannkkss and newlines.
        !           103:        ss//_o_l_d//_n_e_w//
        !           104:               Substitute  _n_e_w  for  the  first  occurrence of _o_l_d in the event
        !           105:               line.  Any delimiter can be used  in  place  of  /.   The  final
        !           106:               delimiter  is  optional if it is the last character of the event
        !           107:               line.  The delimiter may be quoted in _o_l_d and _n_e_w with a  single
        !           108:               backslash.   If & appears in _n_e_w, it is replaced by _o_l_d.  A sin-
        !           109:               gle backslash will quote the &.  If _o_l_d is null, it  is  set  to
        !           110:               the  last  _o_l_d substituted, or, if no previous history substitu-
        !           111:               tions took place, the last _s_t_r_i_n_g in a !!??_s_t_r_i_n_g[[??]]  search.
        !           112:        &&      Repeat the previous substitution.
        !           113:        gg      Cause changes to be applied over the entire event line.  This is
        !           114:               used  in  conjunction  with `::ss' (e.g., `::ggss//_o_l_d//_n_e_w//') or `::&&'.
        !           115:               If used with `::ss', any delimiter can be used in place of /,  and
        !           116:               the  final  delimiter is optional if it is the last character of
        !           117:               the event line.  An aa may be used as a synonym for gg.
        !           118:        GG      Apply the following `ss' modifier once to each word in the  event
        !           119:               line.
        !           120: 
        !           121: PPRROOGGRRAAMMMMIINNGG WWIITTHH HHIISSTTOORRYY FFUUNNCCTTIIOONNSS
        !           122:        This  section  describes  how  to use the History library in other pro-
        !           123:        grams.
        !           124: 
        !           125:    IInnttrroodduuccttiioonn ttoo HHiissttoorryy
        !           126:        The programmer using the History library has  available  functions  for
        !           127:        remembering  lines on a history list, associating arbitrary data with a
        !           128:        line, removing lines from the list, searching through the  list  for  a
        !           129:        line  containing  an arbitrary text string, and referencing any line in
        !           130:        the list directly.  In addition, a history _e_x_p_a_n_s_i_o_n function is avail-
        !           131:        able  which  provides  for a consistent user interface across different
        !           132:        programs.
        !           133: 
        !           134:        The user using programs written with the History library has the  bene-
        !           135:        fit  of  a  consistent user interface with a set of well-known commands
        !           136:        for manipulating the text of previous lines and using that text in  new
        !           137:        commands.  The basic history manipulation commands are identical to the
        !           138:        history substitution provided by bbaasshh.
        !           139: 
        !           140:        If the programmer desires, he  can  use  the  Readline  library,  which
        !           141:        includes some history manipulation by default, and has the added advan-
        !           142:        tage of command line editing.
        !           143: 
        !           144:        Before declaring any functions  using  any  functionality  the  History
        !           145:        library  provides  in  other code, an application writer should include
        !           146:        the file  _<_r_e_a_d_l_i_n_e_/_h_i_s_t_o_r_y_._h_>  in  any  file  that  uses  the  History
        !           147:        library's  features.   It  supplies  extern declarations for all of the
        !           148:        library's public functions and variables, and declares all of the  pub-
        !           149:        lic data structures.
        !           150: 
        !           151: 
        !           152:    HHiissttoorryy SSttoorraaggee
        !           153:        The  history  list  is an array of history entries.  A history entry is
        !           154:        declared as follows:
        !           155: 
        !           156:        _t_y_p_e_d_e_f _v_o_i_d _* hhiissttddaattaa__tt;;
        !           157: 
        !           158:        typedef struct _hist_entry {
        !           159:          char *line;
        !           160:          char *timestamp;
        !           161:          histdata_t data;
        !           162:        } HIST_ENTRY;
        !           163: 
        !           164:        The history list itself might therefore be declared as
        !           165: 
        !           166:        _H_I_S_T___E_N_T_R_Y _*_* tthhee__hhiissttoorryy__lliisstt;;
        !           167: 
        !           168:        The state of the History library is encapsulated into a  single  struc-
        !           169:        ture:
        !           170: 
        !           171:        /*
        !           172:         * A structure used to pass around the current state of the history.
        !           173:         */
        !           174:        typedef struct _hist_state {
        !           175:          HIST_ENTRY **entries; /* Pointer to the entries themselves. */
        !           176:          int offset;           /* The location pointer within this array. */
        !           177:          int length;           /* Number of elements within this array. */
        !           178:          int size;             /* Number of slots allocated to this array. */
        !           179:          int flags;
        !           180:        } HISTORY_STATE;
        !           181: 
        !           182:        If  the flags member includes HHSS__SSTTIIFFLLEEDD, the history has been stifled.
        !           183: 
        !           184: HHiissttoorryy FFuunnccttiioonnss
        !           185:        This section describes the calling sequence for the  various  functions
        !           186:        exported by the GNU History library.
        !           187: 
        !           188:    IInniittiiaalliizziinngg HHiissttoorryy aanndd SSttaattee MMaannaaggeemmeenntt
        !           189:        This  section  describes  functions  used  to initialize and manage the
        !           190:        state of the History library when you want to use the history functions
        !           191:        in your program.
        !           192: 
        !           193:        _v_o_i_d uussiinngg__hhiissttoorryy (_v_o_i_d)
        !           194:        Begin  a  session  in  which the history functions might be used.  This
        !           195:        initializes the interactive variables.
        !           196: 
        !           197:        _H_I_S_T_O_R_Y___S_T_A_T_E _* hhiissttoorryy__ggeett__hhiissttoorryy__ssttaattee (_v_o_i_d)
        !           198:        Return a structure describing the current state of the input history.
        !           199: 
        !           200:        _v_o_i_d hhiissttoorryy__sseett__hhiissttoorryy__ssttaattee (_H_I_S_T_O_R_Y___S_T_A_T_E _*_s_t_a_t_e)
        !           201:        Set the state of the history list according to _s_t_a_t_e.
        !           202: 
        !           203: 
        !           204:    HHiissttoorryy LLiisstt MMaannaaggeemmeenntt
        !           205:        These functions manage individual entries on the history list,  or  set
        !           206:        parameters managing the list itself.
        !           207: 
        !           208:        _v_o_i_d aadddd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g)
        !           209:        Place _s_t_r_i_n_g at the end of the history list.  The associated data field
        !           210:        (if any) is set to NNUULLLL.
        !           211: 
        !           212:        _v_o_i_d aadddd__hhiissttoorryy__ttiimmee (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g)
        !           213:        Change the time stamp associated with the most recent history entry  to
        !           214:        _s_t_r_i_n_g.
        !           215: 
        !           216:        _H_I_S_T___E_N_T_R_Y _* rreemmoovvee__hhiissttoorryy (_i_n_t _w_h_i_c_h)
        !           217:        Remove  history  entry  at  offset _w_h_i_c_h from the history.  The removed
        !           218:        element is returned so you can free  the  line,  data,  and  containing
        !           219:        structure.
        !           220: 
        !           221:        _h_i_s_t_d_a_t_a___t ffrreeee__hhiissttoorryy__eennttrryy (_H_I_S_T___E_N_T_R_Y _*_h_i_s_t_e_n_t)
        !           222:        Free  the  history  entry  _h_i_s_t_e_n_t and any history library private data
        !           223:        associated with it.   Returns  the  application-specific  data  so  the
        !           224:        caller can dispose of it.
        !           225: 
        !           226:        _H_I_S_T___E_N_T_R_Y  _* rreeppllaaccee__hhiissttoorryy__eennttrryy (_i_n_t _w_h_i_c_h_, _c_o_n_s_t _c_h_a_r _*_l_i_n_e_, _h_i_s_t_-
        !           227:        _d_a_t_a___t _d_a_t_a)
        !           228:        Make the history entry at  offset  _w_h_i_c_h  have  _l_i_n_e  and  _d_a_t_a.   This
        !           229:        returns the old entry so the caller can dispose of any application-spe-
        !           230:        cific data.  In the case  of  an  invalid  _w_h_i_c_h,  a  NNUULLLL  pointer  is
        !           231:        returned.
        !           232: 
        !           233:        _v_o_i_d cclleeaarr__hhiissttoorryy (_v_o_i_d)
        !           234:        Clear the history list by deleting all the entries.
        !           235: 
        !           236:        _v_o_i_d ssttiiffllee__hhiissttoorryy (_i_n_t _m_a_x)
        !           237:        Stifle the history list, remembering only the last _m_a_x entries.
        !           238: 
        !           239:        _i_n_t uunnssttiiffllee__hhiissttoorryy (_v_o_i_d)
        !           240:        Stop  stifling  the  history.   This returns the previously-set maximum
        !           241:        number of history entries (as set by  ssttiiffllee__hhiissttoorryy(())).   history  was
        !           242:        stifled.  The value is positive if the history was stifled, negative if
        !           243:        it wasn't.
        !           244: 
        !           245:        _i_n_t hhiissttoorryy__iiss__ssttiifflleedd (_v_o_i_d)
        !           246:        Returns non-zero if the history is stifled, zero if it is not.
        !           247: 
        !           248: 
        !           249:    IInnffoorrmmaattiioonn AAbboouutt tthhee HHiissttoorryy LLiisstt
        !           250:        These functions return information about the  entire  history  list  or
        !           251:        individual list entries.
        !           252: 
        !           253:        _H_I_S_T___E_N_T_R_Y _*_* hhiissttoorryy__lliisstt (_v_o_i_d)
        !           254:        Return  a  NNUULLLL  terminated  array of _H_I_S_T___E_N_T_R_Y _* which is the current
        !           255:        input history.  Element 0 of this list is the beginning  of  time.   If
        !           256:        there is no history, return NNUULLLL.
        !           257: 
        !           258:        _i_n_t wwhheerree__hhiissttoorryy (_v_o_i_d)
        !           259:        Returns the offset of the current history element.
        !           260: 
        !           261:        _H_I_S_T___E_N_T_R_Y _* ccuurrrreenntt__hhiissttoorryy (_v_o_i_d)
        !           262:        Return  the  history  entry  at  the current position, as determined by
        !           263:        wwhheerree__hhiissttoorryy(()).  If there is no entry there, return a NNUULLLL pointer.
        !           264: 
        !           265:        _H_I_S_T___E_N_T_R_Y _* hhiissttoorryy__ggeett (_i_n_t _o_f_f_s_e_t)
        !           266:        Return the  history  entry  at  position  _o_f_f_s_e_t,  starting  from  hhiiss--
        !           267:        ttoorryy__bbaassee.   If  there  is no entry there, or if _o_f_f_s_e_t is greater than
        !           268:        the history length, return a NNUULLLL pointer.
        !           269: 
        !           270:        _t_i_m_e___t hhiissttoorryy__ggeett__ttiimmee (_H_I_S_T___E_N_T_R_Y _*)
        !           271:        Return the time stamp associated with the history entry passed  as  the
        !           272:        argument.
        !           273: 
        !           274:        _i_n_t hhiissttoorryy__ttoottaall__bbyytteess (_v_o_i_d)
        !           275:        Return  the number of bytes that the primary history entries are using.
        !           276:        This function returns the sum of the lengths of all the  lines  in  the
        !           277:        history.
        !           278: 
        !           279: 
        !           280:    MMoovviinngg AArroouunndd tthhee HHiissttoorryy LLiisstt
        !           281:        These functions allow the current index into the history list to be set
        !           282:        or changed.
        !           283: 
        !           284:        _i_n_t hhiissttoorryy__sseett__ppooss (_i_n_t _p_o_s)
        !           285:        Set the current history offset to _p_o_s, an absolute index into the list.
        !           286:        Returns  1  on  success, 0 if _p_o_s is less than zero or greater than the
        !           287:        number of history entries.
        !           288: 
        !           289:        _H_I_S_T___E_N_T_R_Y _* pprreevviioouuss__hhiissttoorryy (_v_o_i_d)
        !           290:        Back up the current history offset to the previous history  entry,  and
        !           291:        return  a pointer to that entry.  If there is no previous entry, return
        !           292:        a NNUULLLL pointer.
        !           293: 
        !           294:        _H_I_S_T___E_N_T_R_Y _* nneexxtt__hhiissttoorryy (_v_o_i_d)
        !           295:        Move the current history offset forward to the next history entry,  and
        !           296:        return  the a pointer to that entry.  If there is no next entry, return
        !           297:        a NNUULLLL pointer.
        !           298: 
        !           299: 
        !           300:    SSeeaarrcchhiinngg tthhee HHiissttoorryy LLiisstt
        !           301:        These functions allow searching of the history list  for  entries  con-
        !           302:        taining a specific string.  Searching may be performed both forward and
        !           303:        backward  from  the  current  history  position.   The  search  may  be
        !           304:        _a_n_c_h_o_r_e_d,  meaning  that  the string must match at the beginning of the
        !           305:        history entry.
        !           306: 
        !           307:        _i_n_t hhiissttoorryy__sseeaarrcchh (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n)
        !           308:        Search the history for _s_t_r_i_n_g, starting at the current history  offset.
        !           309:        If  _d_i_r_e_c_t_i_o_n  is  less  than  0,  then  the search is through previous
        !           310:        entries, otherwise through subsequent entries.   If  _s_t_r_i_n_g  is  found,
        !           311:        then  the  current  history index is set to that history entry, and the
        !           312:        value returned is the offset in the line of the entry where _s_t_r_i_n_g  was
        !           313:        found.  Otherwise, nothing is changed, and a -1 is returned.
        !           314: 
        !           315:        _i_n_t hhiissttoorryy__sseeaarrcchh__pprreeffiixx (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n)
        !           316:        Search  the history for _s_t_r_i_n_g, starting at the current history offset.
        !           317:        The search is anchored: matching lines  must  begin  with  _s_t_r_i_n_g.   If
        !           318:        _d_i_r_e_c_t_i_o_n  is less than 0, then the search is through previous entries,
        !           319:        otherwise through subsequent entries.  If _s_t_r_i_n_g  is  found,  then  the
        !           320:        current  history index is set to that entry, and the return value is 0.
        !           321:        Otherwise, nothing is changed, and a -1 is returned.
        !           322: 
        !           323:        _i_n_t hhiissttoorryy__sseeaarrcchh__ppooss (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _d_i_r_e_c_t_i_o_n_, _i_n_t _p_o_s)
        !           324:        Search for _s_t_r_i_n_g in the history list, starting  at  _p_o_s,  an  absolute
        !           325:        index  into  the  list.   If _d_i_r_e_c_t_i_o_n is negative, the search proceeds
        !           326:        backward from _p_o_s, otherwise forward.  Returns the  absolute  index  of
        !           327:        the history element where _s_t_r_i_n_g was found, or -1 otherwise.
        !           328: 
        !           329: 
        !           330:    MMaannaaggiinngg tthhee HHiissttoorryy FFiillee
        !           331:        The  History  library can read the history from and write it to a file.
        !           332:        This section documents the functions for managing a history file.
        !           333: 
        !           334:        _i_n_t rreeaadd__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e)
        !           335:        Add the contents of _f_i_l_e_n_a_m_e to the history list, a line at a time.  If
        !           336:        _f_i_l_e_n_a_m_e  is NNUULLLL, then read from _~_/_._h_i_s_t_o_r_y.  Returns 0 if successful,
        !           337:        or eerrrrnnoo if not.
        !           338: 
        !           339:        _i_n_t rreeaadd__hhiissttoorryy__rraannggee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t _f_r_o_m_, _i_n_t _t_o)
        !           340:        Read a range of lines from _f_i_l_e_n_a_m_e, adding them to the  history  list.
        !           341:        Start  reading  at  line _f_r_o_m and end at _t_o.  If _f_r_o_m is zero, start at
        !           342:        the beginning.  If _t_o is less than _f_r_o_m, then read until the end of the
        !           343:        file.   If  _f_i_l_e_n_a_m_e  is NNUULLLL, then read from _~_/_._h_i_s_t_o_r_y.  Returns 0 if
        !           344:        successful, or eerrrrnnoo if not.
        !           345: 
        !           346:        _i_n_t wwrriittee__hhiissttoorryy (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e)
        !           347:        Write the current history to _f_i_l_e_n_a_m_e, overwriting _f_i_l_e_n_a_m_e  if  neces-
        !           348:        sary.   If _f_i_l_e_n_a_m_e is NNUULLLL, then write the history list to _~_/_._h_i_s_t_o_r_y.
        !           349:        Returns 0 on success, or eerrrrnnoo on a read or write error.
        !           350: 
        !           351: 
        !           352:        _i_n_t aappppeenndd__hhiissttoorryy (_i_n_t _n_e_l_e_m_e_n_t_s_, _c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e)
        !           353:        Append the last _n_e_l_e_m_e_n_t_s of the history list to _f_i_l_e_n_a_m_e.  If _f_i_l_e_n_a_m_e
        !           354:        is  NNUULLLL, then append to _~_/_._h_i_s_t_o_r_y.  Returns 0 on success, or eerrrrnnoo on
        !           355:        a read or write error.
        !           356: 
        !           357:        _i_n_t hhiissttoorryy__ttrruunnccaattee__ffiillee (_c_o_n_s_t _c_h_a_r _*_f_i_l_e_n_a_m_e_, _i_n_t _n_l_i_n_e_s)
        !           358:        Truncate the history file _f_i_l_e_n_a_m_e, leaving only the last _n_l_i_n_e_s lines.
        !           359:        If  _f_i_l_e_n_a_m_e  is NNUULLLL, then _~_/_._h_i_s_t_o_r_y is truncated.  Returns 0 on suc-
        !           360:        cess, or eerrrrnnoo on failure.
        !           361: 
        !           362: 
        !           363:    HHiissttoorryy EExxppaannssiioonn
        !           364:        These functions implement history expansion.
        !           365: 
        !           366:        _i_n_t hhiissttoorryy__eexxppaanndd (_c_h_a_r _*_s_t_r_i_n_g_, _c_h_a_r _*_*_o_u_t_p_u_t)
        !           367:        Expand _s_t_r_i_n_g, placing the result into _o_u_t_p_u_t, a pointer to  a  string.
        !           368:        Returns:
        !           369:               0      If  no  expansions  took place (or, if the only change in
        !           370:                      the text was the removal of escape  characters  preceding
        !           371:                      the history expansion character);
        !           372:               1      if expansions did take place;
        !           373:               -1     if there was an error in expansion;
        !           374:               2      if  the  returned  line should be displayed, but not exe-
        !           375:                      cuted, as with the ::pp modifier.
        !           376:        If an error ocurred in expansion, then _o_u_t_p_u_t  contains  a  descriptive
        !           377:        error message.
        !           378: 
        !           379:        _c_h_a_r _* ggeett__hhiissttoorryy__eevveenntt (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g_, _i_n_t _*_c_i_n_d_e_x_, _i_n_t _q_c_h_a_r)
        !           380:        Returns  the  text  of the history event beginning at _s_t_r_i_n_g + _*_c_i_n_d_e_x.
        !           381:        _*_c_i_n_d_e_x is modified to point to after the event specifier.  At function
        !           382:        entry,  _c_i_n_d_e_x  points to the index into _s_t_r_i_n_g where the history event
        !           383:        specification begins.  _q_c_h_a_r is a character that is allowed to end  the
        !           384:        event  specification  in addition to the ``normal'' terminating charac-
        !           385:        ters.
        !           386: 
        !           387:        _c_h_a_r _*_* hhiissttoorryy__ttookkeenniizzee (_c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g)
        !           388:        Return an array of tokens parsed out  of  _s_t_r_i_n_g,  much  as  the  shell
        !           389:        might.    The   tokens   are  split  on  the  characters  in  the  hhiiss--
        !           390:        ttoorryy__wwoorrdd__ddeelliimmiitteerrss  variable,  and  shell  quoting  conventions   are
        !           391:        obeyed.
        !           392: 
        !           393:        _c_h_a_r _* hhiissttoorryy__aarrgg__eexxttrraacctt (_i_n_t _f_i_r_s_t_, _i_n_t _l_a_s_t_, _c_o_n_s_t _c_h_a_r _*_s_t_r_i_n_g)
        !           394:        Extract a string segment consisting of the _f_i_r_s_t through _l_a_s_t arguments
        !           395:        present in _s_t_r_i_n_g.  Arguments are split using hhiissttoorryy__ttookkeenniizzee(()).
        !           396: 
        !           397: 
        !           398:    HHiissttoorryy VVaarriiaabblleess
        !           399:        This section describes the externally-visible variables exported by the
        !           400:        GNU History Library.
        !           401: 
        !           402:        _i_n_t hhiissttoorryy__bbaassee
        !           403:        The logical offset of the first entry in the history list.
        !           404: 
        !           405:        _i_n_t hhiissttoorryy__lleennggtthh
        !           406:        The number of entries currently stored in the history list.
        !           407: 
        !           408:        _i_n_t hhiissttoorryy__mmaaxx__eennttrriieess
        !           409:        The maximum number of history entries.  This must be changed using ssttii--
        !           410:        ffllee__hhiissttoorryy(()).
        !           411: 
        !           412:        _i_n_t hhiissttoorryy__wwiittee__ttiimmeessttaammppss
        !           413:        If non-zero, timestamps are written to the history file, so they can be
        !           414:        preserved between sessions.  The default value is 0, meaning that time-
        !           415:        stamps are not saved.  The current timestamp format uses the  value  of
        !           416:        _h_i_s_t_o_r_y___c_o_m_m_e_n_t___c_h_a_r  to delimit timestamp entries in the history file.
        !           417:        If that variable does not have a value (the default),  timestamps  will
        !           418:        not be written.
        !           419: 
        !           420:        _c_h_a_r hhiissttoorryy__eexxppaannssiioonn__cchhaarr
        !           421:        The character that introduces a history event.  The default is !!.  Set-
        !           422:        ting this to 0 inhibits history expansion.
        !           423: 
        !           424:        _c_h_a_r hhiissttoorryy__ssuubbsstt__cchhaarr
        !           425:        The character that invokes word substitution if found at the start of a
        !           426:        line.  The default is ^^.
        !           427: 
        !           428:        _c_h_a_r hhiissttoorryy__ccoommmmeenntt__cchhaarr
        !           429:        During  tokenization,  if this character is seen as the first character
        !           430:        of a word, then it and all subsequent characters up to  a  newline  are
        !           431:        ignored,  suppressing  history expansion for the remainder of the line.
        !           432:        This is disabled by default.
        !           433: 
        !           434:        _c_h_a_r _* hhiissttoorryy__wwoorrdd__ddeelliimmiitteerrss
        !           435:        The  characters  that  separate  tokens  for  hhiissttoorryy__ttookkeenniizzee(()).   The
        !           436:        default value is "" \\tt\\nn(())<<>>;;&&||"".
        !           437: 
        !           438:        _c_h_a_r _* hhiissttoorryy__nnoo__eexxppaanndd__cchhaarrss
        !           439:        The list of characters which inhibit history expansion if found immedi-
        !           440:        ately following hhiissttoorryy__eexxppaannssiioonn__cchhaarr.  The  default  is  space,  tab,
        !           441:        newline, \\rr, and ==.
        !           442: 
        !           443:        _c_h_a_r _* hhiissttoorryy__sseeaarrcchh__ddeelliimmiitteerr__cchhaarrss
        !           444:        The  list  of  additional characters which can delimit a history search
        !           445:        string, in addition to space, tab, _: and _? in the case of  a  substring
        !           446:        search.  The default is empty.
        !           447: 
        !           448:        _i_n_t hhiissttoorryy__qquuootteess__iinnhhiibbiitt__eexxppaannssiioonn
        !           449:        If non-zero, single-quoted words are not scanned for the history expan-
        !           450:        sion character.  The default value is 0.
        !           451: 
        !           452:        _r_l___l_i_n_e_b_u_f___f_u_n_c___t _* hhiissttoorryy__iinnhhiibbiitt__eexxppaannssiioonn__ffuunnccttiioonn
        !           453:        This should be set to the address of a function that  takes  two  argu-
        !           454:        ments:  a  cchhaarr  **  (_s_t_r_i_n_g) and an iinntt index into that string (_i).  It
        !           455:        should return a non-zero value if the  history  expansion  starting  at
        !           456:        _s_t_r_i_n_g_[_i_]  should  not  be  performed;  zero if the expansion should be
        !           457:        done.  It is intended for use by applications like bbaasshh  that  use  the
        !           458:        history  expansion character for additional purposes.  By default, this
        !           459:        variable is set to NNUULLLL.
        !           460: 
        !           461: FFIILLEESS
        !           462:        _~_/_._h_i_s_t_o_r_y
        !           463:               Default filename for reading and writing saved history
        !           464: 
        !           465: SSEEEE AALLSSOO
        !           466:        _T_h_e _G_n_u _R_e_a_d_l_i_n_e _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
        !           467:        _T_h_e _G_n_u _H_i_s_t_o_r_y _L_i_b_r_a_r_y, Brian Fox and Chet Ramey
        !           468:        _b_a_s_h(1)
        !           469:        _r_e_a_d_l_i_n_e(3)
        !           470: 
        !           471: AAUUTTHHOORRSS
        !           472:        Brian Fox, Free Software Foundation
        !           473:        bfox@gnu.org
        !           474: 
        !           475:        Chet Ramey, Case Western Reserve University
        !           476:        chet.ramey@case.edu
        !           477: 
        !           478: BBUUGG RREEPPOORRTTSS
        !           479:        If you find a bug in the hhiissttoorryy library, you should  report  it.   But
        !           480:        first,  you  should  make  sure  that  it  really is a bug, and that it
        !           481:        appears in the latest version of the hhiissttoorryy library that you have.
        !           482: 
        !           483:        Once you have determined that a bug actually exists, mail a bug  report
        !           484:        to  _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g.   If  you have a fix, you are welcome to mail
        !           485:        that as well!  Suggestions  and  `philosophical'  bug  reports  may  be
        !           486:        mailed  to  _b_u_g_-_r_e_a_d_l_i_n_e@_g_n_u_._o_r_g  or  posted  to  the  Usenet newsgroup
        !           487:        ggnnuu..bbaasshh..bbuugg.
        !           488: 
        !           489:        Comments and bug reports concerning this manual page should be directed
        !           490:        to _c_h_e_t_._r_a_m_e_y_@_c_a_s_e_._e_d_u.
        !           491: 
        !           492: 
        !           493: 
        !           494: GNU History 6.3                  2013 June 27                       HISTORY(3)

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