Chris Allegretta | 11b0011 | 2000-08-06 21:13:45 +0000 | [diff] [blame] | 1 | /* $Id$ */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 2 | /************************************************************************** |
| 3 | * proto.h * |
| 4 | * * |
David Lawrence Ramsey | c13b7f0 | 2005-01-01 07:28:15 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2005 Chris Allegretta * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
Chris Allegretta | 3a24f3f | 2001-10-24 11:33:54 +0000 | [diff] [blame] | 8 | * the Free Software Foundation; either version 2, or (at your option) * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 9 | * any later version. * |
| 10 | * * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 11 | * This program is distributed in the hope that it will be useful, but * |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * |
| 14 | * General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the Free Software * |
David Lawrence Ramsey | 6e925cf | 2005-05-15 19:57:17 +0000 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * |
| 19 | * 02110-1301, USA. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 20 | * * |
| 21 | **************************************************************************/ |
| 22 | |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 23 | #ifndef PROTO_H |
| 24 | #define PROTO_H 1 |
| 25 | |
David Lawrence Ramsey | f28f50e | 2004-01-09 23:04:55 +0000 | [diff] [blame] | 26 | /* Externs. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 27 | |
David Lawrence Ramsey | fd3039a | 2004-07-17 19:49:12 +0000 | [diff] [blame] | 28 | #include <sys/types.h> |
David Lawrence Ramsey | 84d0d59 | 2004-11-04 03:53:11 +0000 | [diff] [blame] | 29 | #include <sys/stat.h> |
David Lawrence Ramsey | 7d36771 | 2005-02-14 05:00:15 +0000 | [diff] [blame] | 30 | #include <dirent.h> |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 31 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 32 | #include <regex.h> |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 33 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 34 | #include "nano.h" |
| 35 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 36 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 37 | extern ssize_t wrap_at; |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 38 | #endif |
Chris Allegretta | 17dcb72 | 2001-01-20 21:40:07 +0000 | [diff] [blame] | 39 | extern int editwinrows; |
David Lawrence Ramsey | 7a97e18 | 2004-10-30 01:03:15 +0000 | [diff] [blame] | 40 | extern size_t current_x; |
| 41 | extern int current_y; |
| 42 | extern int totlines; |
David Lawrence Ramsey | 86e851b | 2004-07-28 20:46:25 +0000 | [diff] [blame] | 43 | extern size_t placewewant; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 44 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 687776b | 2004-10-30 01:16:08 +0000 | [diff] [blame] | 45 | extern size_t mark_beginx; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 46 | #endif |
David Lawrence Ramsey | 23c4450 | 2005-01-27 20:49:07 +0000 | [diff] [blame] | 47 | extern size_t totsize; |
| 48 | extern unsigned long flags; |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 49 | extern ssize_t tabsize; |
Chris Allegretta | 6b58acd | 2001-04-12 03:01:53 +0000 | [diff] [blame] | 50 | extern int currslen; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 51 | |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 52 | #if !defined(NANO_SMALL) && defined(ENABLE_NANORC) |
| 53 | extern char *whitespace; |
David Lawrence Ramsey | 6e60db6 | 2005-03-10 22:52:21 +0000 | [diff] [blame] | 54 | extern int whitespace_len[2]; |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 55 | #endif |
| 56 | |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 57 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | 2c62b07 | 2004-05-29 16:38:57 +0000 | [diff] [blame] | 58 | extern char *punct; |
| 59 | extern char *brackets; |
Chris Allegretta | 45329a1 | 2002-03-10 01:22:21 +0000 | [diff] [blame] | 60 | extern char *quotestr; |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 61 | #ifdef HAVE_REGEX_H |
| 62 | extern regex_t quotereg; |
| 63 | extern int quoterc; |
| 64 | extern char *quoteerr; |
| 65 | #else |
| 66 | extern size_t quotelen; |
| 67 | #endif |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 68 | #endif |
| 69 | |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 70 | #ifndef NANO_SMALL |
| 71 | extern char *backup_dir; |
| 72 | #endif |
| 73 | |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 74 | extern WINDOW *topwin, *edit, *bottomwin; |
Chris Allegretta | 1a6e904 | 2000-12-14 13:56:28 +0000 | [diff] [blame] | 75 | extern char *filename; |
David Lawrence Ramsey | 5db0cdc | 2002-06-28 22:45:14 +0000 | [diff] [blame] | 76 | extern struct stat originalfilestat; |
Chris Allegretta | 31925e4 | 2000-11-02 04:40:39 +0000 | [diff] [blame] | 77 | extern char *answer; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 78 | extern char *hblank; |
| 79 | #ifndef DISABLE_HELP |
| 80 | extern char *help_text; |
| 81 | #endif |
Chris Allegretta | 27eb13f | 2000-11-05 16:52:21 +0000 | [diff] [blame] | 82 | extern char *last_search; |
| 83 | extern char *last_replace; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 84 | #ifndef DISABLE_OPERATINGDIR |
| 85 | extern char *operating_dir; |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 86 | extern char *full_operating_dir; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 87 | #endif |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 88 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 89 | extern char *alt_speller; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 90 | #endif |
| 91 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 92 | extern struct stat fileinfo; |
David Lawrence Ramsey | b977515 | 2004-03-19 02:15:42 +0000 | [diff] [blame] | 93 | extern filestruct *current, *fileage, *edittop, *filebot; |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 94 | extern filestruct *cutbuffer; |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 95 | #ifndef DISABLE_JUSTIFY |
| 96 | extern filestruct *jusbuffer; |
| 97 | #endif |
David Lawrence Ramsey | 40bdb68 | 2004-11-03 22:03:41 +0000 | [diff] [blame] | 98 | extern partition *filepart; |
David Lawrence Ramsey | b73c0c0 | 2004-11-05 15:25:53 +0000 | [diff] [blame] | 99 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 100 | extern filestruct *mark_beginbuf; |
| 101 | #endif |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 102 | |
Chris Allegretta | 355fbe5 | 2001-07-14 19:32:47 +0000 | [diff] [blame] | 103 | #ifdef ENABLE_MULTIBUFFER |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 104 | extern openfilestruct *open_files; |
Chris Allegretta | 2d7893d | 2001-07-11 02:08:33 +0000 | [diff] [blame] | 105 | #endif |
| 106 | |
Chris Allegretta | 08893e0 | 2001-11-29 02:42:27 +0000 | [diff] [blame] | 107 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 108 | extern const colortype *colorstrings; |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 109 | extern syntaxtype *syntaxes; |
Chris Allegretta | 09900ff | 2002-05-04 04:23:30 +0000 | [diff] [blame] | 110 | extern char *syntaxstr; |
Chris Allegretta | 08893e0 | 2001-11-29 02:42:27 +0000 | [diff] [blame] | 111 | #endif |
| 112 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 113 | extern shortcut *shortcut_list; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 114 | extern shortcut *main_list, *whereis_list; |
David Lawrence Ramsey | e5d8f32 | 2004-09-30 22:07:21 +0000 | [diff] [blame] | 115 | extern shortcut *replace_list, *gotoline_list; |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 116 | extern shortcut *writefile_list, *insertfile_list; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 117 | extern shortcut *replace_list_2; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 118 | #ifndef NANO_SMALL |
| 119 | extern shortcut *extcmd_list; |
| 120 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 121 | #ifndef DISABLE_HELP |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 122 | extern shortcut *help_list; |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 123 | #endif |
| 124 | #ifndef DISABLE_SPELLER |
| 125 | extern shortcut *spell_list; |
| 126 | #endif |
Rocco Corsi | af5c302 | 2001-01-12 07:51:05 +0000 | [diff] [blame] | 127 | #ifndef DISABLE_BROWSER |
Chris Allegretta | a8c2257 | 2002-02-15 19:17:02 +0000 | [diff] [blame] | 128 | extern shortcut *browser_list, *gotodir_list; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 129 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 130 | |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 131 | extern const shortcut *currshortcut; |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 132 | |
| 133 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 9fc8d43 | 2000-07-07 01:49:52 +0000 | [diff] [blame] | 134 | extern regex_t search_regexp; |
David Lawrence Ramsey | c372488 | 2004-05-27 18:39:16 +0000 | [diff] [blame] | 135 | extern regmatch_t regmatches[10]; |
Chris Allegretta | 3533a34 | 2002-03-24 23:19:32 +0000 | [diff] [blame] | 136 | #ifdef ENABLE_COLOR |
Chris Allegretta | b6c5dc2 | 2002-05-04 03:47:33 +0000 | [diff] [blame] | 137 | extern regex_t syntaxfile_regexp; |
David Lawrence Ramsey | c372488 | 2004-05-27 18:39:16 +0000 | [diff] [blame] | 138 | extern regmatch_t synfilematches[1]; |
Chris Allegretta | 7162e3d | 2002-04-06 05:02:14 +0000 | [diff] [blame] | 139 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 140 | #endif /* HAVE_REGEX_H */ |
| 141 | |
| 142 | #ifndef NANO_SMALL |
| 143 | extern toggle *toggles; |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 144 | #endif |
| 145 | |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 146 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 147 | extern filestruct *search_history; |
| 148 | extern filestruct *searchage; |
| 149 | extern filestruct *searchbot; |
| 150 | extern filestruct *replace_history; |
| 151 | extern filestruct *replaceage; |
| 152 | extern filestruct *replacebot; |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 153 | #endif |
| 154 | |
David Lawrence Ramsey | 76356bd | 2004-08-12 04:30:22 +0000 | [diff] [blame] | 155 | extern bool curses_ended; |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 156 | |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 157 | extern char *homedir; |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 158 | |
David Lawrence Ramsey | 01e13ea | 2005-06-21 04:16:12 +0000 | [diff] [blame] | 159 | /* The functions we want available. */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 160 | |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 161 | /* Public functions in chars.c. */ |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 162 | #ifndef HAVE_ISBLANK |
David Lawrence Ramsey | 356d248 | 2005-06-13 19:51:56 +0000 | [diff] [blame] | 163 | int nisblank(int c); |
David Lawrence Ramsey | 77abec7 | 2005-03-16 17:00:27 +0000 | [diff] [blame] | 164 | #endif |
David Lawrence Ramsey | b2ca88c | 2005-06-22 02:31:12 +0000 | [diff] [blame^] | 165 | #if !defined(HAVE_ISWBLANK) && defined(NANO_WIDE) |
David Lawrence Ramsey | ed7ad33 | 2005-06-15 16:07:14 +0000 | [diff] [blame] | 166 | int niswblank(wchar_t wc); |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 167 | #endif |
David Lawrence Ramsey | 356d248 | 2005-06-13 19:51:56 +0000 | [diff] [blame] | 168 | bool is_byte(int c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 169 | bool is_alnum_mbchar(const char *c); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 170 | bool is_blank_mbchar(const char *c); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 171 | bool is_cntrl_char(int c); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 172 | #ifdef NANO_WIDE |
David Lawrence Ramsey | ed7ad33 | 2005-06-15 16:07:14 +0000 | [diff] [blame] | 173 | bool is_cntrl_wchar(wchar_t wc); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 174 | #endif |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 175 | bool is_cntrl_mbchar(const char *c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 176 | bool is_punct_mbchar(const char *c); |
David Lawrence Ramsey | e221311 | 2005-06-15 03:03:45 +0000 | [diff] [blame] | 177 | bool is_word_mbchar(const char *c, bool allow_punct); |
David Lawrence Ramsey | 1946261 | 2005-06-12 18:05:42 +0000 | [diff] [blame] | 178 | char control_rep(char c); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 179 | #ifdef NANO_WIDE |
| 180 | wchar_t control_wrep(wchar_t c); |
| 181 | #endif |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 182 | char *control_mbrep(const char *c, char *crep, int *crep_len); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 183 | int mbwidth(const char *c); |
| 184 | int mb_cur_max(void); |
David Lawrence Ramsey | f0195a8 | 2005-03-14 18:47:21 +0000 | [diff] [blame] | 185 | char *make_mbchar(int chr, int *chr_mb_len); |
David Lawrence Ramsey | 1b9d3f9 | 2005-02-11 20:09:11 +0000 | [diff] [blame] | 186 | int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t |
| 187 | *col); |
David Lawrence Ramsey | d24fbb7 | 2005-01-14 21:50:32 +0000 | [diff] [blame] | 188 | size_t move_mbleft(const char *buf, size_t pos); |
| 189 | size_t move_mbright(const char *buf, size_t pos); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 190 | #ifndef HAVE_STRCASECMP |
| 191 | int nstrcasecmp(const char *s1, const char *s2); |
| 192 | #endif |
| 193 | int mbstrcasecmp(const char *s1, const char *s2); |
| 194 | #ifndef HAVE_STRNCASECMP |
| 195 | int nstrncasecmp(const char *s1, const char *s2, size_t n); |
| 196 | #endif |
| 197 | int mbstrncasecmp(const char *s1, const char *s2, size_t n); |
| 198 | #ifndef HAVE_STRCASESTR |
| 199 | const char *nstrcasestr(const char *haystack, const char *needle); |
| 200 | #endif |
David Lawrence Ramsey | 42abfe0 | 2005-01-22 18:24:16 +0000 | [diff] [blame] | 201 | const char *mbstrcasestr(const char *haystack, const char *needle); |
David Lawrence Ramsey | ab41ab9 | 2005-06-15 06:30:05 +0000 | [diff] [blame] | 202 | #if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP) |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 203 | const char *revstrstr(const char *haystack, const char *needle, const |
| 204 | char *rev_start); |
David Lawrence Ramsey | 7b601fd | 2005-06-13 13:25:36 +0000 | [diff] [blame] | 205 | #endif |
David Lawrence Ramsey | ab41ab9 | 2005-06-15 06:30:05 +0000 | [diff] [blame] | 206 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 3ee4cf3 | 2005-01-22 20:49:14 +0000 | [diff] [blame] | 207 | const char *revstrcasestr(const char *haystack, const char *needle, |
| 208 | const char *rev_start); |
David Lawrence Ramsey | 345260c | 2005-01-24 01:14:17 +0000 | [diff] [blame] | 209 | const char *mbrevstrcasestr(const char *haystack, const char *needle, |
| 210 | const char *rev_start); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 211 | #endif |
David Lawrence Ramsey | 3f9c635 | 2005-01-25 19:21:11 +0000 | [diff] [blame] | 212 | size_t mbstrlen(const char *s); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 213 | #ifndef HAVE_STRNLEN |
| 214 | size_t nstrnlen(const char *s, size_t maxlen); |
| 215 | #endif |
| 216 | size_t mbstrnlen(const char *s, size_t maxlen); |
David Lawrence Ramsey | 38156d4 | 2005-03-15 05:44:03 +0000 | [diff] [blame] | 217 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | d5d4dde | 2005-06-14 01:55:56 +0000 | [diff] [blame] | 218 | #ifdef ENABLE_NANORC |
| 219 | bool has_blank_chars(const char *s); |
| 220 | bool has_blank_mbchars(const char *s); |
| 221 | #endif |
David Lawrence Ramsey | 38156d4 | 2005-03-15 05:44:03 +0000 | [diff] [blame] | 222 | char *mbstrchr(const char *s, char *c); |
| 223 | #endif |
David Lawrence Ramsey | bdfa927 | 2005-06-14 23:36:13 +0000 | [diff] [blame] | 224 | #ifdef ENABLE_NANORC |
| 225 | bool is_valid_mbstring(const char *s); |
| 226 | #endif |
| 227 | #ifdef NANO_EXTRA |
| 228 | char *make_valid_mbstring(const char *s); |
| 229 | #endif |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 230 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 231 | /* Public functions in color.c. */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 232 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 233 | void set_colorpairs(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 234 | void do_colorinit(void); |
| 235 | void update_color(void); |
| 236 | #endif /* ENABLE_COLOR */ |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 237 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 238 | /* Public functions in cut.c. */ |
David Lawrence Ramsey | c833d9e | 2004-05-29 15:36:58 +0000 | [diff] [blame] | 239 | void cutbuffer_reset(void); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 240 | void cut_line(void); |
David Lawrence Ramsey | 50af6ea | 2004-11-07 15:29:40 +0000 | [diff] [blame] | 241 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 242 | void cut_marked(void); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 243 | void cut_to_eol(void); |
David Lawrence Ramsey | b80d49f | 2005-03-26 22:49:46 +0000 | [diff] [blame] | 244 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 245 | void do_cut_text(void); |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 246 | #ifndef NANO_SMALL |
| 247 | void do_cut_till_end(void); |
| 248 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 249 | void do_uncut_text(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 250 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 251 | /* Public functions in files.c. */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 252 | void new_file(void); |
David Lawrence Ramsey | 50995bd | 2005-05-16 20:13:09 +0000 | [diff] [blame] | 253 | filestruct *read_line(char *buf, filestruct *prevnode, bool |
David Lawrence Ramsey | 483f3ac | 2005-06-19 19:57:13 +0000 | [diff] [blame] | 254 | *first_line_ins, size_t buf_len); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 255 | void load_file(void); |
| 256 | void read_file(FILE *f, const char *filename); |
| 257 | int open_file(const char *filename, bool newfie, FILE **f); |
David Lawrence Ramsey | b9b5722 | 2005-05-29 02:22:55 +0000 | [diff] [blame] | 258 | char *get_next_filename(const char *name, const char *suffix); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 259 | #ifndef NANO_SMALL |
| 260 | void execute_command(const char *command); |
| 261 | #endif |
| 262 | void load_buffer(const char *name); |
David Lawrence Ramsey | be908f6 | 2004-10-01 18:34:30 +0000 | [diff] [blame] | 263 | void do_insertfile( |
| 264 | #ifndef NANO_SMALL |
| 265 | bool execute |
| 266 | #else |
| 267 | void |
| 268 | #endif |
| 269 | ); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 270 | void do_insertfile_void(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 271 | #ifdef ENABLE_MULTIBUFFER |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 272 | openfilestruct *make_new_opennode(void); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 273 | void splice_opennode(openfilestruct *begin, openfilestruct *newnode, |
| 274 | openfilestruct *end); |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 275 | void unlink_opennode(openfilestruct *fileptr); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 276 | void delete_opennode(openfilestruct *fileptr); |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 277 | #ifdef DEBUG |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 278 | void free_openfilestruct(openfilestruct *src); |
David Lawrence Ramsey | 5b3dd0f | 2004-11-25 04:39:07 +0000 | [diff] [blame] | 279 | #endif |
David Lawrence Ramsey | 3e189a8 | 2004-10-03 19:18:48 +0000 | [diff] [blame] | 280 | void add_open_file(bool update); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 281 | void load_open_file(void); |
David Lawrence Ramsey | d26f1eb | 2005-06-15 03:01:41 +0000 | [diff] [blame] | 282 | void open_prevnext_file(bool next_file); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 283 | void open_prevfile_void(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 284 | void open_nextfile_void(void); |
David Lawrence Ramsey | 3e189a8 | 2004-10-03 19:18:48 +0000 | [diff] [blame] | 285 | bool close_open_file(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 286 | #endif |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 287 | char *get_full_path(const char *origpath); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 288 | char *check_writable_directory(const char *path); |
David Lawrence Ramsey | 5e068c6 | 2005-05-31 04:28:15 +0000 | [diff] [blame] | 289 | char *safe_tempfile(FILE **f); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 290 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 291 | void init_operating_dir(void); |
David Lawrence Ramsey | 1b9d3f9 | 2005-02-11 20:09:11 +0000 | [diff] [blame] | 292 | bool check_operating_dir(const char *currpath, bool allow_tabcomp); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 293 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 294 | #ifndef NANO_SMALL |
| 295 | void init_backup_dir(void); |
| 296 | #endif |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 297 | int copy_file(FILE *inn, FILE *out); |
David Lawrence Ramsey | 5e068c6 | 2005-05-31 04:28:15 +0000 | [diff] [blame] | 298 | int write_file(const char *name, FILE *f_open, bool tmp, int append, |
| 299 | bool nonamechange); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 300 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 5e068c6 | 2005-05-31 04:28:15 +0000 | [diff] [blame] | 301 | int write_marked(const char *name, FILE *f_open, bool tmp, int append); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 302 | #endif |
David Lawrence Ramsey | 951d714 | 2004-10-04 15:23:47 +0000 | [diff] [blame] | 303 | int do_writeout(bool exiting); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 304 | void do_writeout_void(void); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 305 | char *real_dir_from_tilde(const char *buf); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 306 | #if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER) |
| 307 | int diralphasort(const void *va, const void *vb); |
David Lawrence Ramsey | ab41ab9 | 2005-06-15 06:30:05 +0000 | [diff] [blame] | 308 | void free_chararray(char **array, size_t len); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 309 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 310 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 311 | char **username_tab_completion(const char *buf, size_t *num_matches, |
| 312 | size_t buflen); |
| 313 | char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t |
| 314 | buflen); |
| 315 | char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 316 | #endif |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 317 | const char *tail(const char *foo); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 318 | #ifndef DISABLE_BROWSER |
David Lawrence Ramsey | 7d36771 | 2005-02-14 05:00:15 +0000 | [diff] [blame] | 319 | void striponedir(char *path); |
| 320 | char **browser_init(const char *path, int *longest, size_t *numents, DIR |
| 321 | *dir); |
| 322 | char *do_browser(char *path, DIR *dir); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 323 | char *do_browse_from(const char *inpath); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 324 | #endif |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 325 | #if !defined(NANO_SMALL) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 326 | char *histfilename(void); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 327 | void load_history(void); |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 328 | bool writehist(FILE *hist, filestruct *histhead); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 329 | void save_history(void); |
| 330 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 331 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 332 | /* Public functions in global.c. */ |
David Lawrence Ramsey | ebd0d7c | 2004-07-01 18:59:52 +0000 | [diff] [blame] | 333 | size_t length_of_list(const shortcut *s); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 334 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 2ad3209 | 2004-07-07 14:36:44 +0000 | [diff] [blame] | 335 | void toggle_init_one(int val, const char *desc, long flag); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 336 | void toggle_init(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 337 | #endif |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 338 | void sc_init_one(shortcut **shortcutage, int key, const char *desc, |
| 339 | #ifndef DISABLE_HELP |
| 340 | const char *help, |
| 341 | #endif |
David Lawrence Ramsey | 35e9713 | 2005-01-08 06:04:19 +0000 | [diff] [blame] | 342 | int metaval, int funcval, int miscval, bool view, void |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 343 | (*func)(void)); |
David Lawrence Ramsey | 1f1ebb8 | 2004-11-11 21:50:01 +0000 | [diff] [blame] | 344 | void shortcut_init(bool unjustify); |
David Lawrence Ramsey | 576bf33 | 2004-07-12 03:10:30 +0000 | [diff] [blame] | 345 | void free_shortcutage(shortcut **shortcutage); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 346 | #ifdef DEBUG |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 347 | void thanks_for_all_the_fish(void); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 348 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 349 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 350 | /* Public functions in move.c. */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 351 | void do_first_line(void); |
| 352 | void do_last_line(void); |
| 353 | void do_home(void); |
| 354 | void do_end(void); |
| 355 | void do_page_up(void); |
| 356 | void do_page_down(void); |
| 357 | void do_up(void); |
| 358 | void do_down(void); |
David Lawrence Ramsey | 3e81914 | 2004-12-31 04:10:28 +0000 | [diff] [blame] | 359 | void do_left(bool allow_update); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 360 | void do_left_void(void); |
David Lawrence Ramsey | 3e81914 | 2004-12-31 04:10:28 +0000 | [diff] [blame] | 361 | void do_right(bool allow_update); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 362 | void do_right_void(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 363 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 364 | /* Public functions in nano.c. */ |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 365 | void print_view_warning(void); |
David Lawrence Ramsey | da14106 | 2004-05-25 19:41:11 +0000 | [diff] [blame] | 366 | void finish(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 367 | void die(const char *msg, ...); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 368 | void die_save_file(const char *die_filename); |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 369 | void check_die_too_small(void); |
| 370 | void resize_variables(void); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 371 | void global_init(bool save_cutbuffer); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 372 | void window_init(void); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 373 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 374 | void mouse_init(void); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 375 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 376 | #ifndef DISABLE_HELP |
| 377 | void help_init(void); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 378 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 379 | filestruct *make_new_node(filestruct *prevnode); |
| 380 | filestruct *copy_node(const filestruct *src); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 381 | void splice_node(filestruct *begin, filestruct *newnode, filestruct |
| 382 | *end); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 383 | void unlink_node(const filestruct *fileptr); |
| 384 | void delete_node(filestruct *fileptr); |
| 385 | filestruct *copy_filestruct(const filestruct *src); |
| 386 | void free_filestruct(filestruct *src); |
David Lawrence Ramsey | 40bdb68 | 2004-11-03 22:03:41 +0000 | [diff] [blame] | 387 | partition *partition_filestruct(filestruct *top, size_t top_x, |
| 388 | filestruct *bot, size_t bot_x); |
David Lawrence Ramsey | 74d8707 | 2004-11-22 00:16:23 +0000 | [diff] [blame] | 389 | void unpartition_filestruct(partition **p); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 390 | void move_to_filestruct(filestruct **file_top, filestruct **file_bot, |
| 391 | filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); |
| 392 | void copy_from_filestruct(filestruct *file_top, filestruct *file_bot); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 393 | void renumber_all(void); |
| 394 | void renumber(filestruct *fileptr); |
David Lawrence Ramsey | 39e8ce6 | 2005-03-21 07:24:47 +0000 | [diff] [blame] | 395 | void print1opt_full(const char *shortflag |
| 396 | #ifdef HAVE_GETOPT_LONG |
| 397 | , const char *longflag |
| 398 | #endif |
| 399 | , const char *desc); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 400 | void usage(void); |
| 401 | void version(void); |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 402 | int no_more_space(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 403 | int no_help(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 404 | void nano_disabled_msg(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 405 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 406 | void cancel_fork(int signal); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 407 | bool open_pipe(const char *command); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 408 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 409 | void do_verbatim_input(void); |
| 410 | void do_backspace(void); |
| 411 | void do_delete(void); |
| 412 | void do_tab(void); |
| 413 | void do_enter(void); |
David Lawrence Ramsey | c97acfb | 2003-09-10 20:08:00 +0000 | [diff] [blame] | 414 | #ifndef NANO_SMALL |
David Lawrence Ramsey | e010edd | 2005-06-12 22:31:03 +0000 | [diff] [blame] | 415 | bool do_next_word(bool allow_update); |
| 416 | void do_next_word_void(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 417 | void do_prev_word(void); |
David Lawrence Ramsey | e010edd | 2005-06-12 22:31:03 +0000 | [diff] [blame] | 418 | void do_word_count(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 419 | void do_mark(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 420 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 421 | #ifndef DISABLE_WRAPPING |
David Lawrence Ramsey | c97acfb | 2003-09-10 20:08:00 +0000 | [diff] [blame] | 422 | void wrap_reset(void); |
David Lawrence Ramsey | 40e211b | 2005-03-19 21:15:30 +0000 | [diff] [blame] | 423 | bool do_wrap(filestruct *line); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 424 | #endif |
| 425 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 426 | bool do_int_spell_fix(const char *word); |
| 427 | const char *do_int_speller(const char *tempfile_name); |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 428 | const char *do_alt_speller(char *tempfile_name); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 429 | void do_spell(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 430 | #endif |
David Lawrence Ramsey | 40e211b | 2005-03-19 21:15:30 +0000 | [diff] [blame] | 431 | #if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING) |
| 432 | ssize_t break_line(const char *line, ssize_t goal, bool newline); |
David Lawrence Ramsey | 9bd5620 | 2005-03-18 21:29:33 +0000 | [diff] [blame] | 433 | #endif |
David Lawrence Ramsey | bb50b30 | 2004-08-12 21:43:00 +0000 | [diff] [blame] | 434 | #if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY) |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 435 | size_t indent_length(const char *line); |
| 436 | #endif |
| 437 | #ifndef DISABLE_JUSTIFY |
David Lawrence Ramsey | e9ac1d7 | 2005-03-13 03:28:37 +0000 | [diff] [blame] | 438 | void justify_format(filestruct *paragraph, size_t skip); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 439 | size_t quote_length(const char *line); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 440 | bool quotes_match(const char *a_line, size_t a_quote, const char |
| 441 | *b_line); |
| 442 | bool indents_match(const char *a_line, size_t a_indent, const char |
David Lawrence Ramsey | d4693cb | 2004-05-14 01:17:25 +0000 | [diff] [blame] | 443 | *b_line, size_t b_indent); |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 444 | bool begpar(const filestruct *const foo); |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 445 | void do_para_begin(bool allow_update); |
| 446 | void do_para_begin_void(void); |
| 447 | bool inpar(const filestruct *const foo); |
| 448 | void do_para_end(bool allow_update); |
| 449 | void do_para_end_void(void); |
David Lawrence Ramsey | d4693cb | 2004-05-14 01:17:25 +0000 | [diff] [blame] | 450 | filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t |
| 451 | quote_len); |
David Lawrence Ramsey | ff4a487 | 2005-03-13 21:12:25 +0000 | [diff] [blame] | 452 | bool find_paragraph(size_t *const quote, size_t *const par); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 453 | void do_justify(bool full_justify); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 454 | void do_justify_void(void); |
| 455 | void do_full_justify(void); |
David Lawrence Ramsey | d893fa9 | 2004-04-30 04:49:02 +0000 | [diff] [blame] | 456 | #endif /* !DISABLE_JUSTIFY */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 457 | void do_exit(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 458 | void signal_init(void); |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 459 | void handle_hupterm(int signal); |
| 460 | void do_suspend(int signal); |
| 461 | void do_cont(int signal); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 462 | #ifndef NANO_SMALL |
| 463 | void handle_sigwinch(int s); |
David Lawrence Ramsey | ce62e82 | 2004-08-05 22:10:22 +0000 | [diff] [blame] | 464 | void allow_pending_sigwinch(bool allow); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 465 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 466 | #ifndef NANO_SMALL |
| 467 | void do_toggle(const toggle *which); |
| 468 | #endif |
David Lawrence Ramsey | 8bcac8a | 2005-06-09 04:02:57 +0000 | [diff] [blame] | 469 | void disable_extended_io(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 470 | void disable_signals(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 471 | #ifndef NANO_SMALL |
| 472 | void enable_signals(void); |
| 473 | #endif |
| 474 | void disable_flow_control(void); |
| 475 | void enable_flow_control(void); |
David Lawrence Ramsey | 8aaf030 | 2004-07-27 16:46:35 +0000 | [diff] [blame] | 476 | void terminal_init(void); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 477 | int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool |
David Lawrence Ramsey | cac0293 | 2005-01-11 23:05:05 +0000 | [diff] [blame] | 478 | *ran_func, bool *finished, bool allow_funcs); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 479 | #ifndef DISABLE_MOUSE |
| 480 | bool do_mouse(void); |
| 481 | #endif |
David Lawrence Ramsey | efec641 | 2005-03-17 03:52:08 +0000 | [diff] [blame] | 482 | void do_output(char *output, size_t output_len, bool allow_cntrls); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 483 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 484 | /* Public functions in rcfile.c. */ |
Chris Allegretta | 7a50009 | 2001-04-19 21:13:46 +0000 | [diff] [blame] | 485 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 486 | void rcfile_error(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 487 | char *parse_next_word(char *ptr); |
| 488 | char *parse_argument(char *ptr); |
| 489 | #ifdef ENABLE_COLOR |
David Lawrence Ramsey | 202d3c2 | 2005-03-10 20:55:11 +0000 | [diff] [blame] | 490 | int color_to_int(const char *colorname, bool *bright); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 491 | char *parse_next_regex(char *ptr); |
David Lawrence Ramsey | 202d3c2 | 2005-03-10 20:55:11 +0000 | [diff] [blame] | 492 | bool nregcomp(regex_t *preg, const char *regex, int eflags); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 493 | void parse_syntax(char *ptr); |
| 494 | void parse_colors(char *ptr); |
| 495 | #endif /* ENABLE_COLOR */ |
| 496 | void parse_rcfile(FILE *rcstream); |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 497 | void do_rcfile(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 498 | #endif /* ENABLE_NANORC */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 499 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 500 | /* Public functions in search.c. */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 501 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 5d71514 | 2003-01-29 04:18:37 +0000 | [diff] [blame] | 502 | int regexp_init(const char *regexp); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 503 | void regexp_cleanup(void); |
| 504 | #endif |
| 505 | void not_found_msg(const char *str); |
| 506 | void search_abort(void); |
| 507 | void search_init_globals(void); |
David Lawrence Ramsey | d532f19 | 2004-10-04 22:37:56 +0000 | [diff] [blame] | 508 | int search_init(bool replacing, bool use_answer); |
David Lawrence Ramsey | e1c16b3 | 2005-02-12 23:09:27 +0000 | [diff] [blame] | 509 | bool is_whole_word(size_t pos, const char *buf, const char *word); |
David Lawrence Ramsey | c510042 | 2004-08-27 20:28:34 +0000 | [diff] [blame] | 510 | bool findnextstr(bool can_display_wrap, bool wholeword, bool |
| 511 | no_sameline, const filestruct *begin, size_t beginx, const char |
David Lawrence Ramsey | 77b284a | 2004-10-27 02:21:01 +0000 | [diff] [blame] | 512 | *needle, size_t *needle_len); |
David Lawrence Ramsey | e5e88fd | 2004-10-31 13:20:30 +0000 | [diff] [blame] | 513 | void findnextstr_wrap_reset(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 514 | void do_search(void); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 515 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 516 | void do_research(void); |
David Lawrence Ramsey | 5aa3983 | 2004-05-05 21:36:50 +0000 | [diff] [blame] | 517 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 518 | void replace_abort(void); |
| 519 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | e3970f5 | 2005-05-26 03:47:24 +0000 | [diff] [blame] | 520 | int replace_regexp(char *string, bool create); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 521 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 522 | char *replace_line(const char *needle); |
David Lawrence Ramsey | 182b2c9 | 2004-11-03 16:02:41 +0000 | [diff] [blame] | 523 | ssize_t do_replace_loop(const char *needle, const filestruct |
| 524 | *real_current, size_t *real_current_x, bool wholewords, bool |
| 525 | *canceled); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 526 | void do_replace(void); |
David Lawrence Ramsey | 9245f97 | 2005-05-17 18:06:26 +0000 | [diff] [blame] | 527 | void do_gotolinecolumn(int line, ssize_t column, bool use_answer, bool |
| 528 | interactive, bool save_pos); |
| 529 | void do_gotolinecolumn_void(void); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 530 | #if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER) |
David Lawrence Ramsey | 7a97e18 | 2004-10-30 01:03:15 +0000 | [diff] [blame] | 531 | void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 532 | #endif |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 533 | #ifndef NANO_SMALL |
David Lawrence Ramsey | c4ca596 | 2005-06-16 20:58:19 +0000 | [diff] [blame] | 534 | #ifdef HAVE_REGEX_H |
| 535 | void do_find_bracket(void); |
| 536 | #endif |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 537 | #ifdef ENABLE_NANORC |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 538 | bool history_has_changed(void); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 539 | #endif |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 540 | void history_init(void); |
David Lawrence Ramsey | 34bdc35 | 2005-06-02 18:41:31 +0000 | [diff] [blame] | 541 | filestruct *find_history(filestruct *h_start, filestruct *h_end, const |
| 542 | char *s, size_t len); |
| 543 | void update_history(filestruct **h, const char *s); |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 544 | char *get_history_older(filestruct **h); |
| 545 | char *get_history_newer(filestruct **h); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 546 | #ifndef DISABLE_TABCOMP |
| 547 | char *get_history_completion(filestruct **h, char *s, size_t len); |
| 548 | #endif |
David Lawrence Ramsey | c4ca596 | 2005-06-16 20:58:19 +0000 | [diff] [blame] | 549 | #endif /* !NANO_SMALL */ |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 550 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 551 | /* Public functions in utils.c. */ |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 552 | #ifdef HAVE_REGEX_H |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 553 | #ifdef BROKEN_REGEXEC |
David Lawrence Ramsey | afbcf68 | 2005-03-21 06:33:41 +0000 | [diff] [blame] | 554 | int safe_regexec(const regex_t *preg, const char *string, size_t nmatch, |
Chris Allegretta | d845193 | 2003-03-11 03:50:40 +0000 | [diff] [blame] | 555 | regmatch_t pmatch[], int eflags); |
| 556 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 557 | int regexp_bol_or_eol(const regex_t *preg, const char *string); |
| 558 | #endif |
David Lawrence Ramsey | c596c0c | 2005-04-19 16:32:08 +0000 | [diff] [blame] | 559 | int digits(size_t n); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 560 | void get_homedir(void); |
David Lawrence Ramsey | c53ab2a | 2004-08-04 18:24:53 +0000 | [diff] [blame] | 561 | bool parse_num(const char *str, ssize_t *val); |
David Lawrence Ramsey | c5659d3 | 2005-05-17 00:25:50 +0000 | [diff] [blame] | 562 | bool parse_line_column(const char *str, int *line, ssize_t *column); |
David Lawrence Ramsey | 6a0d5b8 | 2005-06-13 14:00:22 +0000 | [diff] [blame] | 563 | void align(char **str); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 564 | void null_at(char **data, size_t index); |
| 565 | void unsunder(char *str, size_t true_len); |
| 566 | void sunder(char *str); |
David Lawrence Ramsey | a883470 | 2004-08-17 20:34:57 +0000 | [diff] [blame] | 567 | #if !defined(NANO_SMALL) && defined(ENABLE_NANORC) |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 568 | #ifndef HAVE_GETLINE |
| 569 | ssize_t ngetline(char **lineptr, size_t *n, FILE *stream); |
| 570 | #endif |
| 571 | #ifndef HAVE_GETDELIM |
| 572 | ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream); |
| 573 | #endif |
David Lawrence Ramsey | a883470 | 2004-08-17 20:34:57 +0000 | [diff] [blame] | 574 | #endif /* !NANO_SMALL && ENABLE_NANORC */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 575 | const char *strstrwrapper(const char *haystack, const char *needle, |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 576 | const char *start); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 577 | void nperror(const char *s); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 578 | void *nmalloc(size_t howmuch); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 579 | void *nrealloc(void *ptr, size_t howmuch); |
David Lawrence Ramsey | 4a1fc55 | 2004-11-02 15:18:30 +0000 | [diff] [blame] | 580 | char *mallocstrncpy(char *dest, const char *src, size_t n); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 581 | char *mallocstrcpy(char *dest, const char *src); |
David Lawrence Ramsey | 02517e0 | 2004-09-05 21:40:31 +0000 | [diff] [blame] | 582 | char *mallocstrassn(char *dest, char *src); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 583 | void new_magicline(void); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 584 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 40bdb68 | 2004-11-03 22:03:41 +0000 | [diff] [blame] | 585 | void remove_magicline(void); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 586 | void mark_order(const filestruct **top, size_t *top_x, const filestruct |
David Lawrence Ramsey | 90e59c1 | 2004-11-05 23:03:03 +0000 | [diff] [blame] | 587 | **bot, size_t *bot_x, bool *right_side_up); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 588 | #endif |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 589 | void get_totals(const filestruct *begin, const filestruct *end, int |
David Lawrence Ramsey | 23c4450 | 2005-01-27 20:49:07 +0000 | [diff] [blame] | 590 | *lines, size_t *size); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 591 | |
David Lawrence Ramsey | 8001e27 | 2004-11-12 00:48:18 +0000 | [diff] [blame] | 592 | /* Public functions in winio.c. */ |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 593 | #ifndef NANO_SMALL |
| 594 | void reset_kbinput(void); |
| 595 | #endif |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 596 | void get_buffer(WINDOW *win); |
| 597 | size_t get_buffer_len(void); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 598 | void unget_input(int *input, size_t input_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 599 | void unget_kbinput(int kbinput, bool meta_key, bool func_key); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 600 | int *get_input(WINDOW *win, size_t input_len); |
David Lawrence Ramsey | eb16f43 | 2004-09-27 01:04:50 +0000 | [diff] [blame] | 601 | int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 602 | int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 603 | #ifndef NANO_SMALL |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 604 | , bool reset |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 605 | #endif |
| 606 | ); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 607 | int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 608 | *ignore_seq); |
| 609 | int get_escape_seq_abcd(int kbinput); |
David Lawrence Ramsey | f0a53f0 | 2005-01-03 19:56:56 +0000 | [diff] [blame] | 610 | int get_byte_kbinput(int kbinput |
| 611 | #ifndef NANO_SMALL |
| 612 | , bool reset |
| 613 | #endif |
| 614 | ); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 615 | int get_word_kbinput(int kbinput |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 616 | #ifndef NANO_SMALL |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 617 | , bool reset |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 618 | #endif |
| 619 | ); |
| 620 | int get_control_kbinput(int kbinput); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 621 | void unparse_kbinput(char *output, size_t output_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 622 | int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); |
| 623 | int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 624 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 625 | bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); |
| 626 | #endif |
David Lawrence Ramsey | 1483ee3 | 2004-11-29 00:30:07 +0000 | [diff] [blame] | 627 | const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool |
David Lawrence Ramsey | eb16f43 | 2004-09-27 01:04:50 +0000 | [diff] [blame] | 628 | *meta_key, bool *func_key); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 629 | #ifndef NANO_SMALL |
| 630 | const toggle *get_toggle(int kbinput, bool meta_key); |
| 631 | #endif |
David Lawrence Ramsey | c13b7f0 | 2005-01-01 07:28:15 +0000 | [diff] [blame] | 632 | int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t, |
David Lawrence Ramsey | cac0293 | 2005-01-11 23:05:05 +0000 | [diff] [blame] | 633 | bool *ran_func, bool *finished, bool allow_funcs); |
David Lawrence Ramsey | c13b7f0 | 2005-01-01 07:28:15 +0000 | [diff] [blame] | 634 | #ifndef DISABLE_MOUSE |
| 635 | bool do_statusbar_mouse(void); |
| 636 | #endif |
| 637 | void do_statusbar_home(void); |
| 638 | void do_statusbar_end(void); |
| 639 | void do_statusbar_right(void); |
| 640 | void do_statusbar_left(void); |
| 641 | void do_statusbar_backspace(void); |
| 642 | void do_statusbar_delete(void); |
| 643 | void do_statusbar_cut_text(void); |
David Lawrence Ramsey | b80077d | 2005-01-18 21:25:38 +0000 | [diff] [blame] | 644 | #ifndef NANO_SMALL |
| 645 | void do_statusbar_next_word(void); |
| 646 | void do_statusbar_prev_word(void); |
| 647 | #endif |
David Lawrence Ramsey | d9ad76b | 2005-01-02 22:35:31 +0000 | [diff] [blame] | 648 | void do_statusbar_verbatim_input(bool *got_enter); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 649 | void do_statusbar_output(char *output, size_t output_len, bool |
David Lawrence Ramsey | efec641 | 2005-03-17 03:52:08 +0000 | [diff] [blame] | 650 | *got_enter, bool allow_cntrls); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 651 | size_t xplustabs(void); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 652 | size_t actual_x(const char *str, size_t xplus); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 653 | size_t strnlenpt(const char *buf, size_t size); |
| 654 | size_t strlenpt(const char *buf); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 655 | void blank_titlebar(void); |
David Lawrence Ramsey | 637b8bb | 2005-01-17 05:06:55 +0000 | [diff] [blame] | 656 | void blank_topbar(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 657 | void blank_edit(void); |
| 658 | void blank_statusbar(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 659 | void blank_bottombars(void); |
David Lawrence Ramsey | b9ddb80 | 2005-03-17 17:56:48 +0000 | [diff] [blame] | 660 | void check_statusblank(void); |
David Lawrence Ramsey | fc69321 | 2004-12-23 17:43:27 +0000 | [diff] [blame] | 661 | char *display_string(const char *buf, size_t start_col, size_t len, bool |
| 662 | dollars); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 663 | void nanoget_repaint(const char *buf, const char *inputbuf, size_t x); |
David Lawrence Ramsey | 6f25a67 | 2005-05-20 02:57:05 +0000 | [diff] [blame] | 664 | int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer, |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 665 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 34bdc35 | 2005-06-02 18:41:31 +0000 | [diff] [blame] | 666 | filestruct **history_list, |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 667 | #endif |
David Lawrence Ramsey | 546f5b3 | 2005-05-14 23:14:47 +0000 | [diff] [blame] | 668 | const shortcut *s |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 669 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | 546f5b3 | 2005-05-14 23:14:47 +0000 | [diff] [blame] | 670 | , bool *list |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 671 | #endif |
David Lawrence Ramsey | 546f5b3 | 2005-05-14 23:14:47 +0000 | [diff] [blame] | 672 | ); |
David Lawrence Ramsey | 6f25a67 | 2005-05-20 02:57:05 +0000 | [diff] [blame] | 673 | int statusq(bool allow_tabs, const shortcut *s, const char *curranswer, |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 674 | #ifndef NANO_SMALL |
David Lawrence Ramsey | 34bdc35 | 2005-06-02 18:41:31 +0000 | [diff] [blame] | 675 | filestruct **history_list, |
David Lawrence Ramsey | 045883a | 2004-10-05 20:11:31 +0000 | [diff] [blame] | 676 | #endif |
David Lawrence Ramsey | 546f5b3 | 2005-05-14 23:14:47 +0000 | [diff] [blame] | 677 | const char *msg, ...); |
David Lawrence Ramsey | 045883a | 2004-10-05 20:11:31 +0000 | [diff] [blame] | 678 | void statusq_abort(void); |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 679 | void titlebar(const char *path); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 680 | void set_modified(void); |
| 681 | void statusbar(const char *msg, ...); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 682 | void bottombars(const shortcut *s); |
David Lawrence Ramsey | fa39404 | 2004-05-23 21:11:14 +0000 | [diff] [blame] | 683 | void onekey(const char *keystroke, const char *desc, size_t len); |
David Lawrence Ramsey | 2dd7ed1 | 2003-09-29 05:15:24 +0000 | [diff] [blame] | 684 | size_t get_page_start(size_t column); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 685 | void reset_cursor(void); |
David Lawrence Ramsey | 07d3feb | 2004-04-16 05:15:11 +0000 | [diff] [blame] | 686 | void edit_add(const filestruct *fileptr, const char *converted, int |
| 687 | yval, size_t start); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 688 | void update_line(const filestruct *fileptr, size_t index); |
David Lawrence Ramsey | 86e851b | 2004-07-28 20:46:25 +0000 | [diff] [blame] | 689 | int need_horizontal_update(size_t old_pww); |
| 690 | int need_vertical_update(size_t old_pww); |
David Lawrence Ramsey | 2ed225f | 2004-05-28 20:44:09 +0000 | [diff] [blame] | 691 | void edit_scroll(updown direction, int nlines); |
David Lawrence Ramsey | 86e851b | 2004-07-28 20:46:25 +0000 | [diff] [blame] | 692 | void edit_redraw(const filestruct *old_current, size_t old_pww); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 693 | void edit_refresh(void); |
David Lawrence Ramsey | 20b8350 | 2004-08-26 18:07:58 +0000 | [diff] [blame] | 694 | void edit_update(topmidnone location); |
David Lawrence Ramsey | 045883a | 2004-10-05 20:11:31 +0000 | [diff] [blame] | 695 | int do_yesno(bool all, const char *msg); |
David Lawrence Ramsey | c54c4d1 | 2005-06-18 15:49:17 +0000 | [diff] [blame] | 696 | void total_redraw(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 697 | void total_refresh(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 698 | void display_main_list(void); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 699 | void do_cursorpos(bool constant); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 700 | void do_cursorpos_void(void); |
David Lawrence Ramsey | 8037fe0 | 2004-07-23 12:30:40 +0000 | [diff] [blame] | 701 | #ifndef DISABLE_HELP |
David Lawrence Ramsey | 9bd5620 | 2005-03-18 21:29:33 +0000 | [diff] [blame] | 702 | size_t help_line_len(const char *ptr); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 703 | void do_help(void); |
David Lawrence Ramsey | 8037fe0 | 2004-07-23 12:30:40 +0000 | [diff] [blame] | 704 | #endif |
David Lawrence Ramsey | 423326f | 2005-01-03 19:14:39 +0000 | [diff] [blame] | 705 | void do_replace_highlight(bool highlight_flag, const char *word); |
David Lawrence Ramsey | cc81436 | 2005-06-05 19:08:59 +0000 | [diff] [blame] | 706 | #ifndef NDEBUG |
| 707 | int check_linenumbers(const filestruct *fileptr); |
| 708 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 709 | #ifdef DEBUG |
| 710 | void dump_buffer(const filestruct *inptr); |
| 711 | void dump_buffer_reverse(void); |
| 712 | #endif |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 713 | #ifdef NANO_EXTRA |
Chris Allegretta | 34318ed | 2001-01-31 23:22:36 +0000 | [diff] [blame] | 714 | void do_credits(void); |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 715 | #endif |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 716 | |
| 717 | #endif /* !PROTO_H */ |