readline.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* $NetBSD: readline.h,v 1.1 2001/01/05 21:15:50 jdolecek Exp $ */
  2. /*-
  3. * Copyright (c) 1997 The NetBSD Foundation, Inc.
  4. * All rights reserved.
  5. *
  6. * This code is derived from software contributed to The NetBSD Foundation
  7. * by Jaromir Dolecek.
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. * 1. Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. * 2. Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. * 3. All advertising materials mentioning features or use of this software
  18. * must display the following acknowledgement:
  19. * This product includes software developed by the NetBSD
  20. * Foundation, Inc. and its contributors.
  21. * 4. Neither the name of The NetBSD Foundation nor the names of its
  22. * contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  26. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  27. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  28. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
  29. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. * POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #ifndef _READLINE_H_
  38. #define _READLINE_H_
  39. #include <sys/types.h>
  40. /* list of readline stuff supported by editline library's readline wrapper */
  41. /* typedefs */
  42. typedef int Function(const char *, int);
  43. typedef void VFunction(void);
  44. typedef char *CPFunction(const char *, int);
  45. typedef char **CPPFunction(const char *, int, int);
  46. typedef struct _hist_entry {
  47. const char *line;
  48. const char *data;
  49. } HIST_ENTRY;
  50. /* global variables used by readline enabled applications */
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. extern const char *rl_library_version;
  55. extern char *rl_readline_name;
  56. extern FILE *rl_instream;
  57. extern FILE *rl_outstream;
  58. extern char *rl_line_buffer;
  59. extern int rl_point, rl_end;
  60. extern int history_base, history_length;
  61. extern int max_input_history;
  62. extern char *rl_basic_word_break_characters;
  63. extern char *rl_completer_word_break_characters;
  64. extern char *rl_completer_quote_characters;
  65. extern CPFunction *rl_completion_entry_function;
  66. extern CPPFunction *rl_attempted_completion_function;
  67. extern int rl_completion_type;
  68. extern int rl_completion_query_items;
  69. extern char *rl_special_prefixes;
  70. extern int rl_completion_append_character;
  71. /* supported functions */
  72. char *readline(const char *);
  73. int rl_initialize(void);
  74. void using_history(void);
  75. int add_history(const char *);
  76. void clear_history(void);
  77. void stifle_history(int);
  78. int unstifle_history(void);
  79. int history_is_stifled(void);
  80. int where_history(void);
  81. HIST_ENTRY *current_history(void);
  82. HIST_ENTRY *history_get(int);
  83. int history_total_bytes(void);
  84. int history_set_pos(int);
  85. HIST_ENTRY *previous_history(void);
  86. HIST_ENTRY *next_history(void);
  87. int history_search(const char *, int);
  88. int history_search_prefix(const char *, int);
  89. int history_search_pos(const char *, int, int);
  90. int read_history(const char *);
  91. int write_history(const char *);
  92. int history_expand(char *, char **);
  93. char **history_tokenize(const char *);
  94. char *tilde_expand(char *);
  95. char *filename_completion_function(const char *, int);
  96. char *username_completion_function(const char *, int);
  97. int rl_complete(int, int);
  98. int rl_read_key(void);
  99. char **completion_matches(const char *, CPFunction *);
  100. void rl_display_match_list(char **, int, int);
  101. int rl_insert(int, int);
  102. void rl_reset_terminal(const char *);
  103. int rl_bind_key(int, int (*)(int, int));
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif /* _READLINE_H_ */