121308Sache/* histlib.h -- internal definitions for the history library. */
221308Sache/* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
321308Sache
421308Sache   This file contains the GNU History Library (the Library), a set of
521308Sache   routines for managing the text of previously typed lines.
621308Sache
721308Sache   The Library is free software; you can redistribute it and/or modify
821308Sache   it under the terms of the GNU General Public License as published by
958310Sache   the Free Software Foundation; either version 2, or (at your option)
1021308Sache   any later version.
1121308Sache
1221308Sache   The Library is distributed in the hope that it will be useful, but
1321308Sache   WITHOUT ANY WARRANTY; without even the implied warranty of
1421308Sache   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1521308Sache   General Public License for more details.
1621308Sache
1721308Sache   The GNU General Public License is often shipped with GNU software, and
1821308Sache   is generally kept in a file called COPYING or LICENSE.  If you do not
1921308Sache   have a copy of the license, write to the Free Software Foundation,
2058310Sache   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2121308Sache
2221308Sache#if !defined (_HISTLIB_H_)
2321308Sache#define _HISTLIB_H_
2421308Sache
25119610Sache#if defined (HAVE_STRING_H)
26119610Sache#  include <string.h>
27119610Sache#else
28119610Sache#  include <strings.h>
29119610Sache#endif /* !HAVE_STRING_H */
30119610Sache
3158310Sache#if !defined (STREQ)
3221308Sache#define STREQ(a, b)	(((a)[0] == (b)[0]) && (strcmp ((a), (b)) == 0))
3358310Sache#define STREQN(a, b, n) (((n) == 0) ? (1) \
3458310Sache				    : ((a)[0] == (b)[0]) && (strncmp ((a), (b), (n)) == 0))
3558310Sache#endif
3621308Sache
3721308Sache#ifndef savestring
3821308Sache#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
3921308Sache#endif
4021308Sache
4121308Sache#ifndef whitespace
4221308Sache#define whitespace(c) (((c) == ' ') || ((c) == '\t'))
4321308Sache#endif
4421308Sache
4521308Sache#ifndef _rl_digit_p
4621308Sache#define _rl_digit_p(c)  ((c) >= '0' && (c) <= '9')
4721308Sache#endif
4821308Sache
4921308Sache#ifndef _rl_digit_value
5021308Sache#define _rl_digit_value(c) ((c) - '0')
5121308Sache#endif
5221308Sache
5321308Sache#ifndef member
5421308Sache#  ifndef strchr
5521308Sacheextern char *strchr ();
5621308Sache#  endif
5721308Sache#define member(c, s) ((c) ? ((char *)strchr ((s), (c)) != (char *)NULL) : 0)
5821308Sache#endif
5921308Sache
6021308Sache#ifndef FREE
6121308Sache#  define FREE(x)	if (x) free (x)
6221308Sache#endif
6321308Sache
6421308Sache/* Possible history errors passed to hist_error. */
6521308Sache#define EVENT_NOT_FOUND 0
6621308Sache#define BAD_WORD_SPEC	1
6721308Sache#define SUBST_FAILED	2
6821308Sache#define BAD_MODIFIER	3
6947558Sache#define NO_PREV_SUBST	4
7021308Sache
7121308Sache/* Possible definitions for history starting point specification. */
7221308Sache#define ANCHORED_SEARCH 1
7321308Sache#define NON_ANCHORED_SEARCH 0
7421308Sache
7521308Sache/* Possible definitions for what style of writing the history file we want. */
7621308Sache#define HISTORY_APPEND 0
7721308Sache#define HISTORY_OVERWRITE 1
7821308Sache
7958310Sache/* Some variable definitions shared across history source files. */
8058310Sacheextern int history_offset;
8158310Sache
8221308Sache#endif /* !_HISTLIB_H_ */
83