blob: 06d278db68007c1229fefc3aca34519df8d0f222 [file] [log] [blame]
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00001/**************************************************************************
Benno Schulenberg514cd9a2016-08-29 17:10:49 +02002 * proto.h -- This file is part of GNU nano. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00003 * *
Chris Allegretta8a07a962009-12-02 03:36:22 +00004 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
Benno Schulenberg7a9f4a42014-04-30 20:18:26 +00005 * 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00006 * *
Benno Schulenberg514cd9a2016-08-29 17:10:49 +02007 * GNU nano is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published *
9 * by the Free Software Foundation, either version 3 of the License, *
10 * or (at your option) any later version. *
11 * *
12 * GNU nano is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty *
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the GNU General Public License for more details. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000016 * *
17 * You should have received a copy of the GNU General Public License *
Benno Schulenberg514cd9a2016-08-29 17:10:49 +020018 * along with this program. If not, see http://www.gnu.org/licenses/. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000019 * *
20 **************************************************************************/
21
David Lawrence Ramseye527e452005-04-15 18:07:26 +000022#ifndef PROTO_H
23#define PROTO_H 1
24
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000025#include "nano.h"
26
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +000027/* All external variables. See global.c for their descriptions. */
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000028#ifndef NANO_TINY
Benno Schulenbergb77e6bd2016-12-14 20:37:03 +010029extern volatile sig_atomic_t the_window_resized;
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000030#endif
31
Benno Schulenberg08cd1972016-09-08 21:00:51 +020032#ifdef __linux__
Benno Schulenberg290d2782016-07-29 09:15:07 +020033extern bool console;
Benno Schulenberg928a24c2016-08-11 12:37:11 +020034#endif
35
Benno Schulenberg7e5324d2014-06-30 18:04:33 +000036extern bool meta_key;
Benno Schulenberg382c9d72016-04-24 11:28:28 +020037extern bool shift_held;
38
Benno Schulenberg07e199f2015-03-28 17:01:46 +000039extern bool focusing;
Benno Schulenbergc8f530a2016-05-19 20:43:08 +020040
Benno Schulenbergeef7d102016-12-20 19:27:41 +010041extern bool as_an_at;
42
Faissal Bensefiade95ca62016-10-20 09:44:29 +010043extern int margin;
44extern int editwincols;
Faissal Bensefiade95ca62016-10-20 09:44:29 +010045
Benno Schulenbergc8f530a2016-05-19 20:43:08 +020046extern message_type lastmessage;
Benno Schulenberg7e5324d2014-06-30 18:04:33 +000047
Sumedh Pendurkardca4ab52016-12-07 09:43:47 +053048extern filestruct *pletion_line;
Sumedh Pendurkardca4ab52016-12-07 09:43:47 +053049
Benno Schulenbergf08d79d2015-11-23 08:52:23 +000050extern int controlleft;
51extern int controlright;
Benno Schulenbergc6dbcf92016-06-25 15:16:52 +020052extern int controlup;
53extern int controldown;
Benno Schulenberg08cd1972016-09-08 21:00:51 +020054#ifndef NANO_TINY
Benno Schulenberg382c9d72016-04-24 11:28:28 +020055extern int shiftcontrolleft;
56extern int shiftcontrolright;
57extern int shiftcontrolup;
58extern int shiftcontroldown;
59extern int shiftaltleft;
60extern int shiftaltright;
61extern int shiftaltup;
62extern int shiftaltdown;
Benno Schulenbergf08d79d2015-11-23 08:52:23 +000063#endif
64
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000065#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000066extern ssize_t fill;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000067extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000068#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000069
70extern char *last_search;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000071
Benno Schulenberge2556272016-04-30 21:22:16 +020072extern char *present_path;
73
Chris Allegrettaa48507d2009-08-14 03:18:29 +000074extern unsigned flags[4];
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000075extern WINDOW *topwin;
76extern WINDOW *edit;
77extern WINDOW *bottomwin;
78extern int editwinrows;
Benno Schulenberg0208ae72017-01-12 17:33:46 +010079extern int maxlines;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000080
81extern filestruct *cutbuffer;
Chris Allegretta12dc8ca2008-07-31 04:24:04 +000082extern filestruct *cutbottom;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000083extern partition *filepart;
84extern openfilestruct *openfile;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000085
David Lawrence Ramseyd89617f2006-01-06 21:51:10 +000086#ifndef NANO_TINY
87extern char *matchbrackets;
88#endif
89
Benno Schulenberg90798fb2015-08-09 16:05:50 +000090#ifndef NANO_TINY
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000091extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000092extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000093#endif
94
Benno Schulenberg11d76442014-04-26 19:01:18 +000095extern const char *exit_tag;
96extern const char *close_tag;
Benno Schulenbergbc6e9aa2014-04-07 09:02:22 +000097extern const char *uncut_tag;
Chris Allegrettae4f940d2002-03-03 22:36:36 +000098#ifndef DISABLE_JUSTIFY
Benno Schulenbergbc6e9aa2014-04-07 09:02:22 +000099extern const char *unjust_tag;
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +0000100extern char *punct;
101extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +0000102extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000103#ifdef HAVE_REGEX_H
104extern regex_t quotereg;
105extern int quoterc;
106extern char *quoteerr;
107#else
108extern size_t quotelen;
109#endif
Benno Schulenberg492e9f62014-06-20 10:48:26 +0000110#endif /* !DISABLE_JUSTIFY */
111
Benno Schulenberg6f129922016-06-30 18:02:45 +0200112extern char *word_chars;
113
Chris Allegrettaf86fa862009-02-25 04:32:15 +0000114extern bool nodelay_mode;
Benno Schulenberg6f129922016-06-30 18:02:45 +0200115
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000116extern char *answer;
117
118extern ssize_t tabsize;
119
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000120#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000121extern char *backup_dir;
Chris Allegretta3116d2f2013-01-03 04:36:39 +0000122extern const char *locking_prefix;
123extern const char *locking_suffix;
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000124#endif
Chris Allegrettae1f14522001-09-19 03:19:43 +0000125#ifndef DISABLE_OPERATINGDIR
126extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000127extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +0000128#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000129
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000130#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000131extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +0000132#endif
133
Benno Schulenberg00389922014-04-04 11:59:03 +0000134#ifndef DISABLE_COLOR
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000135extern syntaxtype *syntaxes;
136extern char *syntaxstr;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000137#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000138
Benno Schulenberg53f4a9f2016-04-25 21:14:18 +0200139extern bool refresh_needed;
Benno Schulenberg4147c5e2014-06-20 07:55:24 +0000140
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000141extern int currmenu;
Benno Schulenberg4147c5e2014-06-20 07:55:24 +0000142extern sc *sclist;
143extern subnfunc *allfuncs;
144extern subnfunc *exitfunc;
145extern subnfunc *uncutfunc;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000146
Benno Schulenbergb341f292014-06-19 20:05:24 +0000147#ifndef DISABLE_HISTORIES
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000148extern filestruct *search_history;
149extern filestruct *searchage;
150extern filestruct *searchbot;
151extern filestruct *replace_history;
152extern filestruct *replaceage;
153extern filestruct *replacebot;
Benno Schulenbergdeb271d2016-01-12 19:20:40 +0000154extern poshiststruct *position_history;
Chris Allegretta5beed502003-01-05 20:41:21 +0000155#endif
156
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000157#ifdef HAVE_REGEX_H
158extern regex_t search_regexp;
159extern regmatch_t regmatches[10];
160#endif
161
Benno Schulenbergc9700352014-05-04 08:53:06 +0000162extern int hilite_attribute;
Benno Schulenberg16639942014-05-03 18:24:45 +0000163#ifndef DISABLE_COLOR
164extern char* specified_color_combo[NUMBER_OF_ELEMENTS];
165#endif
Benno Schulenberg960e8482016-07-12 09:35:48 +0200166extern int interface_color_pair[NUMBER_OF_ELEMENTS];
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000167
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000168extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000169
Benno Schulenberg3933a302014-07-02 08:47:09 +0000170typedef void (*functionptrtype)(void);
171
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000172/* All functions in browser.c. */
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000173#ifndef DISABLE_BROWSER
Rishabh Davebd3f1562016-05-25 11:16:58 +0200174char *do_browser(char *path);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000175char *do_browse_from(const char *inpath);
Benno Schulenbergd3bd8552016-05-25 12:09:22 +0200176void read_the_list(const char *path, DIR *dir);
Benno Schulenberg6418ffa2014-07-02 09:29:05 +0000177functionptrtype parse_browser_input(int *kbinput);
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000178void browser_refresh(void);
Benno Schulenberg2dc9cbe2015-04-08 18:40:40 +0000179void browser_select_dirname(const char *needle);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000180int filesearch_init(void);
Benno Schulenbergd5177052015-04-07 13:34:12 +0000181void findnextfile(const char *needle);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000182void filesearch_abort(void);
183void do_filesearch(void);
184void do_fileresearch(void);
185void do_first_file(void);
186void do_last_file(void);
David Lawrence Ramseya4e92c82006-06-30 14:14:40 +0000187char *striponedir(const char *path);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000188#endif
189
Benno Schulenberg2163d962016-02-16 10:09:26 +0000190/* Most functions in chars.c. */
David Lawrence Ramsey4d72de72006-04-12 15:27:40 +0000191#ifdef ENABLE_UTF8
192void utf8_init(void);
193bool using_utf8(void);
194#endif
Benno Schulenbergf5ac8c12014-05-25 19:41:49 +0000195char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000196#ifndef HAVE_ISBLANK
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000197bool nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000198#endif
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000199#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000200bool niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000201#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000202bool is_byte(int c);
Benno Schulenberg20058a12016-08-02 22:09:22 +0200203bool is_alpha_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000204bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000205bool is_blank_mbchar(const char *c);
David Lawrence Ramsey8e341e12006-05-24 17:36:00 +0000206bool is_ascii_cntrl_char(int c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000207bool is_cntrl_char(int c);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000208bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000209bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000210bool is_word_mbchar(const char *c, bool allow_punct);
Benno Schulenberg03586c62016-05-30 11:28:16 +0200211char control_rep(const signed char c);
Benno Schulenbergeafae5d2016-12-18 09:40:09 +0100212char control_mbrep(const char *c, bool isdata);
Benno Schulenberge33a0b62016-06-06 13:20:04 +0200213int length_of_char(const char *c, int *width);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000214int mbwidth(const char *c);
215int mb_cur_max(void);
David Lawrence Ramsey8b006c22005-08-08 23:03:25 +0000216char *make_mbchar(long chr, int *chr_mb_len);
David Lawrence Ramsey96452cb2005-07-26 06:13:45 +0000217int parse_mbchar(const char *buf, char *chr, size_t *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000218size_t move_mbleft(const char *buf, size_t pos);
219size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000220#ifndef HAVE_STRCASECMP
221int nstrcasecmp(const char *s1, const char *s2);
222#endif
223int mbstrcasecmp(const char *s1, const char *s2);
224#ifndef HAVE_STRNCASECMP
225int nstrncasecmp(const char *s1, const char *s2, size_t n);
226#endif
227int mbstrncasecmp(const char *s1, const char *s2, size_t n);
228#ifndef HAVE_STRCASESTR
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000229char *nstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000230#endif
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000231char *mbstrcasestr(const char *haystack, const char *needle);
Benno Schulenbergcd705a72016-12-18 21:45:47 +0100232char *revstrstr(const char *haystack, const char *needle,
233 const char *pointer);
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000234char *revstrcasestr(const char *haystack, const char *needle, const char
235 *rev_start);
236char *mbrevstrcasestr(const char *haystack, const char *needle, const
237 char *rev_start);
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000238size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000239#ifndef HAVE_STRNLEN
240size_t nstrnlen(const char *s, size_t maxlen);
241#endif
242size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000243#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
244char *mbstrchr(const char *s, const char *c);
245#endif
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000246#ifndef NANO_TINY
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000247char *mbstrpbrk(const char *s, const char *accept);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000248char *revstrpbrk(const char *s, const char *accept, const char
249 *rev_start);
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000250char *mbrevstrpbrk(const char *s, const char *accept, const char
251 *rev_start);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000252#endif
Benno Schulenbergeea09082014-04-13 20:50:20 +0000253#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
David Lawrence Ramseyd5d4dde2005-06-14 01:55:56 +0000254bool has_blank_chars(const char *s);
255bool has_blank_mbchars(const char *s);
256#endif
David Lawrence Ramsey6ff695c2005-08-05 03:14:29 +0000257#ifdef ENABLE_UTF8
258bool is_valid_unicode(wchar_t wc);
259#endif
Benno Schulenbergeea09082014-04-13 20:50:20 +0000260#ifndef DISABLE_NANORC
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000261bool is_valid_mbstring(const char *s);
262#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000263
Benno Schulenberg2163d962016-02-16 10:09:26 +0000264/* Most functions in color.c. */
Benno Schulenberg00389922014-04-04 11:59:03 +0000265#ifndef DISABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000266void set_colorpairs(void);
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000267void color_init(void);
David Lawrence Ramsey43cf7a12005-07-14 18:31:45 +0000268void color_update(void);
Benno Schulenberg9ec546d2017-02-13 19:11:04 +0100269void check_the_multis(filestruct *line);
Benno Schulenberg31f04562015-12-22 16:51:00 +0000270void alloc_multidata_if_needed(filestruct *fileptr);
271void precalc_multicolorinfo(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000272#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000273
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000274/* All functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000275void cutbuffer_reset(void);
Benno Schulenberga8727092014-06-18 19:04:35 +0000276bool keeping_cutbuffer(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000277void cut_line(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000278#ifndef NANO_TINY
Benno Schulenbergd3429a72016-12-31 16:36:14 +0100279void cut_marked(bool *right_side_up);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000280void cut_to_eol(void);
David Lawrence Ramsey41b89722006-05-21 20:03:43 +0000281void cut_to_eof(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000282#endif
Benno Schulenberg72873002016-10-23 19:42:05 +0200283void do_cut_text(bool copy_text, bool cut_till_eof);
David Lawrence Ramseyc87e0c02006-04-25 02:23:28 +0000284void do_cut_text_void(void);
285#ifndef NANO_TINY
286void do_copy_text(void);
Benno Schulenberg95e77a92014-06-30 20:39:27 +0000287void do_cut_till_eof(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000288#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000289void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000290
Benno Schulenbergba987352016-01-31 13:06:06 +0000291/* Most functions in files.c. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000292void make_new_buffer(void);
David Lawrence Ramseyc00513b2005-07-23 00:41:45 +0000293void initialize_buffer_text(void);
Benno Schulenberg37d8ad82015-12-30 10:11:20 +0000294bool open_buffer(const char *filename, bool undoable);
David Lawrence Ramsey9c984e82005-11-08 19:15:58 +0000295#ifndef DISABLE_SPELLER
296void replace_buffer(const char *filename);
297#endif
David Lawrence Ramseye5c7e922005-07-12 23:06:22 +0000298void display_buffer(void);
Benno Schulenberg0636d7b2014-04-03 20:23:07 +0000299#ifndef DISABLE_MULTIBUFFER
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000300void switch_to_prev_buffer_void(void);
301void switch_to_next_buffer_void(void);
Benno Schulenberg906ada82016-05-17 13:37:53 +0200302bool close_buffer(void);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000303#endif
Benno Schulenberg22e92832015-12-18 19:18:23 +0000304filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode);
David Lawrence Ramseyf773d712017-02-09 12:17:54 -0600305void read_file(FILE *f, int fd, const char *filename, bool undoable,
306 bool checkwritable);
Chris Allegretta5b1fb562015-01-20 06:15:34 +0000307int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000308char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000309void do_insertfile_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000310char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000311char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000312char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000313#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000314void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000315bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000316#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000317#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000318void init_backup_dir(void);
Chris Allegrettabf88d272013-01-01 03:24:39 +0000319int delete_lockfile(const char *lockfilename);
Chris Allegretta170607b2013-01-03 03:57:18 +0000320int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000321#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000322int copy_file(FILE *inn, FILE *out);
Benno Schulenbergc2a0c782016-07-15 12:59:59 +0200323bool write_file(const char *name, FILE *f_open, bool tmp,
324 kind_of_writing_type method, bool nonamechange);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000325#ifndef NANO_TINY
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000326bool write_marked_file(const char *name, FILE *f_open, bool tmp,
Benno Schulenbergc2a0c782016-07-15 12:59:59 +0200327 kind_of_writing_type method);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000328#endif
Benno Schulenberg8cc63082015-12-23 16:34:44 +0000329int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000330void do_writeout_void(void);
Benno Schulenbergee7b0952015-07-25 19:25:50 +0000331#ifndef NANO_TINY
332void do_savefile(void);
333#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000334char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000335#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
336int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000337void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000338#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000339#ifndef DISABLE_TABCOMP
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000340bool is_dir(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000341char **username_tab_completion(const char *buf, size_t *num_matches,
David Lawrence Ramsey6e6c80b2007-10-11 15:38:32 +0000342 size_t buf_len);
David Lawrence Ramsey9d8c2842006-02-07 21:11:05 +0000343char **cwd_tab_completion(const char *buf, bool allow_files, size_t
David Lawrence Ramsey6e6c80b2007-10-11 15:38:32 +0000344 *num_matches, size_t buf_len);
Benno Schulenberg36ec76a2016-04-17 18:09:24 +0200345char *input_tab(char *buf, bool allow_files, size_t *place,
Benno Schulenberg30f3c532016-04-26 17:50:25 +0200346 bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta7662c862003-01-13 01:35:15 +0000347#endif
Benno Schulenberg5c5fefc2016-04-23 13:23:49 +0200348const char *tail(const char *path);
Benno Schulenbergb341f292014-06-19 20:05:24 +0000349#ifndef DISABLE_HISTORIES
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000350char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000351void load_history(void);
Benno Schulenbergc0aa5ad2017-01-09 18:25:25 +0100352bool writehist(FILE *hist, const filestruct *head);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000353void save_history(void);
Chris Allegretta9bfda912011-02-16 06:52:30 +0000354int check_dotnano(void);
355void load_poshistory(void);
356void save_poshistory(void);
Benno Schulenberg4147c5e2014-06-20 07:55:24 +0000357void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
Benno Schulenbergdc187462016-12-23 13:49:14 +0100358bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000359#endif
Benno Schulenberg03f37ad2014-06-20 10:34:52 +0000360
361/* Some functions in global.c. */
362size_t length_of_list(int menu);
Benno Schulenberg03f37ad2014-06-20 10:34:52 +0000363const sc *first_sc_for(int menu, void (*func)(void));
Benno Schulenberga9b5a0e2016-12-22 12:02:11 +0100364int the_code_for(void (*func)(void), int defaultval);
Benno Schulenberg3933a302014-07-02 08:47:09 +0000365functionptrtype func_from_key(int *kbinput);
Benno Schulenberg55878ef2016-10-15 17:55:19 +0200366void assign_keyinfo(sc *s, const char *keystring, const int keycode);
Benno Schulenberg03f37ad2014-06-20 10:34:52 +0000367void print_sclist(void);
368void shortcut_init(void);
Benno Schulenberg00389922014-04-04 11:59:03 +0000369#ifndef DISABLE_COLOR
Chris Allegretta4b3f2772015-01-03 07:24:17 +0000370void set_lint_or_format_shortcuts(void);
Chris Allegretta5575bfa2014-02-24 10:18:15 +0000371void set_spell_shortcuts(void);
372#endif
Benno Schulenbergdd29c562016-01-04 09:52:43 +0000373const subnfunc *sctofunc(const sc *s);
Benno Schulenberg03f37ad2014-06-20 10:34:52 +0000374const char *flagtostr(int flag);
Benno Schulenberg539a4b42016-01-04 09:12:21 +0000375sc *strtosc(const char *input);
376int strtomenu(const char *input);
Chris Allegretta6232d662002-05-12 19:52:15 +0000377#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000378void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000379#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000380
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000381/* All functions in help.c. */
Chris Allegretta1d778232008-08-30 21:00:00 +0000382#ifndef DISABLE_HELP
Benno Schulenberg7a1959f2015-08-16 09:28:33 +0000383void do_help(void);
David Lawrence Ramseyd420b5a2005-11-01 23:00:56 +0000384void help_init(void);
Benno Schulenberg6418ffa2014-07-02 09:29:05 +0000385functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramseyc3593012005-11-01 20:11:55 +0000386size_t help_line_len(const char *ptr);
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000387#endif
Benno Schulenberg24d9f312014-04-21 13:00:49 +0000388void do_help_void(void);
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000389
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000390/* All functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000391void do_first_line(void);
392void do_last_line(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000393void do_page_up(void);
394void do_page_down(void);
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000395#ifndef DISABLE_JUSTIFY
396void do_para_begin(bool allow_update);
397void do_para_begin_void(void);
398void do_para_end(bool allow_update);
399void do_para_end_void(void);
400#endif
Benno Schulenbergc6dbcf92016-06-25 15:16:52 +0200401void do_prev_block(void);
402void do_next_block(void);
Benno Schulenberg6620de02015-09-05 09:22:50 +0000403void do_prev_word(bool allow_punct, bool allow_update);
David Lawrence Ramseyc4037f32005-07-20 21:31:19 +0000404void do_prev_word_void(void);
Benno Schulenbergc1151662016-02-22 12:49:08 +0000405bool do_next_word(bool allow_punct, bool allow_update);
406void do_next_word_void(void);
Benno Schulenberg43f35fc2016-10-18 13:03:01 +0200407void ensure_line_is_visible(void);
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000408void do_home(void);
409void do_end(void);
Benno Schulenberg0a3a6442016-07-25 17:23:45 +0200410void do_up(bool scroll_only);
David Lawrence Ramsey2c36e2e2006-07-06 22:17:47 +0000411void do_up_void(void);
Benno Schulenberg0a3a6442016-07-25 17:23:45 +0200412void do_down(bool scroll_only);
David Lawrence Ramsey2c36e2e2006-07-06 22:17:47 +0000413void do_down_void(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000414#ifndef NANO_TINY
Benno Schulenberg0a3a6442016-07-25 17:23:45 +0200415void do_scroll_up(void);
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000416void do_scroll_down(void);
417#endif
David Lawrence Ramsey1c3bfa92005-09-13 04:53:44 +0000418void do_left(void);
419void do_right(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000420
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000421/* All functions in nano.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000422filestruct *make_new_node(filestruct *prevnode);
423filestruct *copy_node(const filestruct *src);
Benno Schulenberge0d0ca42015-11-24 13:28:32 +0000424void splice_node(filestruct *afterthis, filestruct *newnode);
Benno Schulenberg72caa542015-11-22 16:14:42 +0000425void unlink_node(filestruct *fileptr);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000426void delete_node(filestruct *fileptr);
427filestruct *copy_filestruct(const filestruct *src);
428void free_filestruct(filestruct *src);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000429void renumber(filestruct *fileptr);
430partition *partition_filestruct(filestruct *top, size_t top_x,
431 filestruct *bot, size_t bot_x);
432void unpartition_filestruct(partition **p);
David Lawrence Ramsey1cb945f2017-02-14 21:35:01 -0600433void extract_buffer(filestruct **file_top, filestruct **file_bot,
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000434 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
David Lawrence Ramseya847d372017-02-10 00:17:33 -0600435void ingraft_buffer(filestruct *somebuffer);
David Lawrence Ramsey1cb945f2017-02-14 21:35:01 -0600436void copy_from_buffer(filestruct *somebuffer);
David Lawrence Ramseye99494f2005-07-20 21:08:38 +0000437openfilestruct *make_new_opennode(void);
David Lawrence Ramseye99494f2005-07-20 21:08:38 +0000438void unlink_opennode(openfilestruct *fileptr);
439void delete_opennode(openfilestruct *fileptr);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000440void print_view_warning(void);
Benno Schulenberg68476162015-07-30 18:10:16 +0000441void show_restricted_warning(void);
442#ifdef DISABLE_HELP
443void say_there_is_no_help(void);
444#endif
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000445void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000446void die(const char *msg, ...);
Benno Schulenbergf6dd0ad2016-08-02 17:26:25 +0200447void die_save_file(const char *die_filename, struct stat *die_stat);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000448void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000449#ifndef DISABLE_MOUSE
David Lawrence Ramsey503bad02006-06-09 18:24:37 +0000450void disable_mouse_support(void);
451void enable_mouse_support(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000452void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000453#endif
David Lawrence Ramsey660e05b2006-05-12 19:30:28 +0000454void print_opt_full(const char *shortflag
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000455#ifdef HAVE_GETOPT_LONG
456 , const char *longflag
457#endif
458 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000459void usage(void);
460void version(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000461void do_exit(void);
Benno Schulenberg8cc63082015-12-23 16:34:44 +0000462void close_and_go(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000463void signal_init(void);
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000464RETSIGTYPE handle_hupterm(int signal);
465RETSIGTYPE do_suspend(int signal);
466RETSIGTYPE do_continue(int signal);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000467#ifndef NANO_TINY
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000468RETSIGTYPE handle_sigwinch(int signal);
Benno Schulenberg75d64e62015-05-28 13:02:29 +0000469void regenerate_screen(void);
Benno Schulenberg9e6b9a22016-01-04 10:37:11 +0000470void allow_sigwinch(bool allow);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000471void do_toggle(int flag);
Benno Schulenberg03bcaf62015-03-08 12:10:52 +0000472void do_toggle_void(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000473void enable_signals(void);
474#endif
475void disable_flow_control(void);
476void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000477void terminal_init(void);
Benno Schulenberge0c4f9c2016-04-27 14:37:31 +0200478void unbound_key(int code);
Benno Schulenberg7e5324d2014-06-30 18:04:33 +0000479int do_input(bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000480#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000481int do_mouse(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000482#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000483void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000484
Benno Schulenberg379b1552016-12-03 20:37:30 +0100485/* Most functions in prompt.c. */
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000486#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000487int do_statusbar_mouse(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000488#endif
Benno Schulenberge5400532016-02-14 12:03:47 +0000489void do_statusbar_output(int *the_input, size_t input_len,
Benno Schulenberg908663e2016-12-27 12:20:20 +0100490 bool filtering);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000491void do_statusbar_home(void);
492void do_statusbar_end(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000493void do_statusbar_left(void);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000494void do_statusbar_right(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000495void do_statusbar_backspace(void);
496void do_statusbar_delete(void);
497void do_statusbar_cut_text(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000498#ifndef NANO_TINY
Benno Schulenbergeed1aab2016-01-24 15:42:45 +0000499void do_statusbar_prev_word(void);
Benno Schulenbergc1151662016-02-22 12:49:08 +0000500void do_statusbar_next_word(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000501#endif
Benno Schulenberg908663e2016-12-27 12:20:20 +0100502void do_statusbar_verbatim_input(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000503size_t statusbar_xplustabs(void);
504size_t get_statusbar_page_start(size_t start_col, size_t column);
Benno Schulenberg34a20f82016-04-17 15:24:05 +0200505void reinit_statusbar_x(void);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000506void reset_statusbar_cursor(void);
Benno Schulenbergd844f052016-02-06 11:40:15 +0000507void update_the_statusbar(void);
Benno Schulenbergfd0589d2017-01-02 21:12:44 +0100508int do_prompt(bool allow_tabs, bool allow_files,
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000509 int menu, const char *curranswer,
Benno Schulenbergb341f292014-06-19 20:05:24 +0000510#ifndef DISABLE_HISTORIES
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000511 filestruct **history_list,
512#endif
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000513 void (*refresh_func)(void), const char *msg, ...);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000514int do_yesno_prompt(bool all, const char *msg);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000515
Benno Schulenbergcf4f80d2014-05-12 13:52:50 +0000516/* Most functions in rcfile.c. */
Benno Schulenbergb341f292014-06-19 20:05:24 +0000517#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
518char *parse_next_word(char *ptr);
519#endif
Benno Schulenbergeea09082014-04-13 20:50:20 +0000520#ifndef DISABLE_NANORC
Benno Schulenberg00389922014-04-04 11:59:03 +0000521#ifndef DISABLE_COLOR
Benno Schulenberg16639942014-05-03 18:24:45 +0000522bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
Benno Schulenberged296522016-03-10 11:00:59 +0000523void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000524#endif
Benno Schulenberg77023a72016-11-27 16:34:34 +0100525void parse_rcfile(FILE *rcstream, bool syntax_only);
Benno Schulenbergc1a48422016-11-27 18:21:04 +0100526void do_rcfiles(void);
Benno Schulenbergb341f292014-06-19 20:05:24 +0000527#endif /* !DISABLE_NANORC */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000528
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000529/* All functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000530#ifdef HAVE_REGEX_H
David Lawrence Ramsey0ec34ac2007-01-09 23:35:02 +0000531bool regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000532void regexp_cleanup(void);
533#endif
534void not_found_msg(const char *str);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000535void search_replace_abort(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000536int search_init(bool replacing, bool use_answer);
Benno Schulenberg8f10e362017-02-10 13:51:51 +0100537int findnextstr(const char *needle, bool whole_word_only, bool have_region,
538 size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000539void do_search(void);
Benno Schulenberg4990f742015-07-26 09:23:24 +0000540#ifndef NANO_TINY
541void do_findprevious(void);
542void do_findnext(void);
543#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000544void do_research(void);
Benno Schulenberg28487712016-04-04 19:38:57 +0200545void go_looking(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000546#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000547int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000548#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000549char *replace_line(const char *needle);
Benno Schulenberg2cd8ca42016-10-23 17:59:26 +0200550ssize_t do_replace_loop(const char *needle, bool whole_word_only,
551 const filestruct *real_current, size_t *real_current_x);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000552void do_replace(void);
Benno Schulenberg8f0262f2015-12-31 16:49:07 +0000553void goto_line_posx(ssize_t line, size_t pos_x);
David Lawrence Ramsey5beae582005-06-29 00:17:18 +0000554void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
Benno Schulenberg46db6382015-12-31 19:20:40 +0000555 bool interactive);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000556void do_gotolinecolumn_void(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000557#ifndef NANO_TINY
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000558bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000559void do_find_bracket(void);
Benno Schulenbergb341f292014-06-19 20:05:24 +0000560#ifndef DISABLE_TABCOMP
Benno Schulenberge86dc032016-02-20 12:16:43 +0000561char *get_history_completion(filestruct **h, char *s, size_t len);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000562#endif
Benno Schulenbergb341f292014-06-19 20:05:24 +0000563#endif
564#ifndef DISABLE_HISTORIES
565bool history_has_changed(void);
Chris Allegretta5beed502003-01-05 20:41:21 +0000566void history_init(void);
David Lawrence Ramsey0e581b32005-07-18 07:48:50 +0000567void history_reset(const filestruct *h);
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000568filestruct *find_history(const filestruct *h_start, const filestruct
569 *h_end, const char *s, size_t len);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000570void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000571char *get_history_older(filestruct **h);
572char *get_history_newer(filestruct **h);
Chris Allegretta637daa82011-02-07 14:45:56 +0000573void get_history_older_void(void);
574void get_history_newer_void(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000575#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000576
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000577/* All functions in text.c. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000578#ifndef NANO_TINY
David Lawrence Ramsey7ea09e52005-07-25 02:41:59 +0000579void do_mark(void);
580#endif
581void do_delete(void);
582void do_backspace(void);
Benno Schulenbergb3e40512015-07-31 11:52:26 +0000583#ifndef NANO_TINY
584void do_cut_prev_word(void);
585void do_cut_next_word(void);
586#endif
David Lawrence Ramsey7ea09e52005-07-25 02:41:59 +0000587void do_tab(void);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000588#ifndef NANO_TINY
David Lawrence Ramseyaee00d42006-07-05 18:42:22 +0000589void do_indent(ssize_t cols);
590void do_indent_void(void);
591void do_unindent(void);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000592#endif
Benno Schulenberg08cd1972016-09-08 21:00:51 +0200593bool white_string(const char *s);
594#ifdef ENABLE_COMMENT
Mike Scalora6a2032f2016-05-25 22:13:50 +0200595void do_comment(void);
Benno Schulenberg9fa95a32016-12-15 13:04:52 +0100596bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
Mike Scalora6a2032f2016-05-25 22:13:50 +0200597#endif
Benno Schulenberg9fa95a32016-12-15 13:04:52 +0100598void do_undo(void);
599void do_redo(void);
Benno Schulenberg54c2f6b2015-11-11 19:04:31 +0000600void do_enter(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000601#ifndef NANO_TINY
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000602RETSIGTYPE cancel_command(int signal);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000603bool execute_command(const char *command);
Benno Schulenberg9fa95a32016-12-15 13:04:52 +0100604void discard_until(const undo *thisitem, openfilestruct *thefile);
605void add_undo(undo_type action);
606#ifndef DISABLE_COMMENT
607void update_comment_undo(ssize_t lineno);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000608#endif
Benno Schulenberg9fa95a32016-12-15 13:04:52 +0100609void update_undo(undo_type action);
610#endif /* !NANO_TINY */
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000611#ifndef DISABLE_WRAPPING
612void wrap_reset(void);
Benno Schulenbergbe10c2a2014-06-09 10:01:54 +0000613bool do_wrap(filestruct *line);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000614#endif
David Lawrence Ramseyc7c04bb2005-11-29 21:30:00 +0000615#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
David Lawrence Ramseyb9b2fd52005-11-22 21:13:36 +0000616ssize_t break_line(const char *line, ssize_t goal
617#ifndef DISABLE_HELP
Chris Allegretta8b6461f2008-05-31 23:09:40 +0000618 , bool newln
David Lawrence Ramseyb9b2fd52005-11-22 21:13:36 +0000619#endif
620 );
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000621#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000622#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000623size_t indent_length(const char *line);
624#endif
625#ifndef DISABLE_JUSTIFY
626void justify_format(filestruct *paragraph, size_t skip);
627size_t quote_length(const char *line);
628bool quotes_match(const char *a_line, size_t a_quote, const char
629 *b_line);
630bool indents_match(const char *a_line, size_t a_indent, const char
631 *b_line, size_t b_indent);
632bool begpar(const filestruct *const foo);
633bool inpar(const filestruct *const foo);
David Lawrence Ramseycd8f7352005-11-10 21:20:32 +0000634void backup_lines(filestruct *first_line, size_t par_len);
David Lawrence Ramsey79383be2005-11-29 18:34:45 +0000635bool find_paragraph(size_t *const quote, size_t *const par);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000636void do_justify(bool full_justify);
637void do_justify_void(void);
638void do_full_justify(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000639#endif
David Lawrence Ramseycc8185f2005-07-25 02:33:45 +0000640#ifndef DISABLE_SPELLER
641bool do_int_spell_fix(const char *word);
642const char *do_int_speller(const char *tempfile_name);
643const char *do_alt_speller(char *tempfile_name);
644void do_spell(void);
645#endif
Benno Schulenberg24d9f312014-04-21 13:00:49 +0000646#ifndef DISABLE_COLOR
647void do_linter(void);
Chris Allegretta4b3f2772015-01-03 07:24:17 +0000648void do_formatter(void);
Benno Schulenberg24d9f312014-04-21 13:00:49 +0000649#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000650#ifndef NANO_TINY
David Lawrence Ramsey8e942342005-07-25 04:21:46 +0000651void do_wordlinechar_count(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000652#endif
David Lawrence Ramsey37ddfa92005-11-07 06:06:05 +0000653void do_verbatim_input(void);
Sumedh Pendurkardca4ab52016-12-07 09:43:47 +0530654void complete_a_word(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000655
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000656/* All functions in utils.c. */
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000657void get_homedir(void);
David Lawrence Ramseybd920b12016-12-09 11:36:01 -0600658#ifdef ENABLE_LINENUMBERS
659int digits(ssize_t n);
660#endif
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000661bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000662bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
Benno Schulenberg8c7e4f52016-12-16 20:34:38 +0100663void snuggly_fit(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000664void null_at(char **data, size_t index);
665void unsunder(char *str, size_t true_len);
666void sunder(char *str);
Benno Schulenbergeea09082014-04-13 20:50:20 +0000667#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000668#ifndef HAVE_GETLINE
669ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
670#endif
671#ifndef HAVE_GETDELIM
672ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
673#endif
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000674#endif
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000675#ifdef HAVE_REGEX_H
Chris Allegretta6b83e522008-08-30 05:16:20 +0000676const char *fixbounds(const char *r);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000677#endif
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000678#ifndef DISABLE_SPELLER
Benno Schulenbergcc0a3d82016-05-02 22:20:19 +0200679bool is_separate_word(size_t position, size_t length, const char *buf);
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000680#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000681const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000682 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000683void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000684void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000685void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000686char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000687char *mallocstrcpy(char *dest, const char *src);
Benno Schulenberg8b28de12016-07-13 15:04:40 +0200688char *free_and_assign(char *dest, char *src);
David Lawrence Ramsey2b9d6a02005-11-01 17:45:31 +0000689size_t get_page_start(size_t column);
David Lawrence Ramsey81c4e182005-10-31 23:07:58 +0000690size_t xplustabs(void);
691size_t actual_x(const char *s, size_t column);
692size_t strnlenpt(const char *s, size_t maxlen);
693size_t strlenpt(const char *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000694void new_magicline(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000695#ifndef NANO_TINY
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000696void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000697void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000698 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000699#endif
David Lawrence Ramseyc104ef12005-07-17 01:44:35 +0000700size_t get_totsize(const filestruct *begin, const filestruct *end);
Benno Schulenbergd6cc2c42016-12-15 12:45:02 +0100701#ifndef NANO_TINY
Chris Allegretta14c86202008-08-03 04:48:05 +0000702filestruct *fsfromline(ssize_t lineno);
Benno Schulenbergd6cc2c42016-12-15 12:45:02 +0100703#endif
David Lawrence Ramsey00cc5652005-11-02 15:44:01 +0000704#ifdef DEBUG
705void dump_filestruct(const filestruct *inptr);
706void dump_filestruct_reverse(void);
707#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000708
Benno Schulenberg46082bd2015-12-22 19:00:25 +0000709/* Most functions in winio.c. */
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000710void get_key_buffer(WINDOW *win);
711size_t get_key_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000712void unget_input(int *input, size_t input_len);
Benno Schulenberg91951ab2016-07-23 14:01:38 +0200713void unget_kbinput(int kbinput, bool metakey);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000714int *get_input(WINDOW *win, size_t input_len);
Benno Schulenberg7e5324d2014-06-30 18:04:33 +0000715int get_kbinput(WINDOW *win);
716int parse_kbinput(WINDOW *win);
Benno Schulenberg46082bd2015-12-22 19:00:25 +0000717int arrow_from_abcd(int kbinput);
718int parse_escape_sequence(WINDOW *win, int kbinput);
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +0000719int get_byte_kbinput(int kbinput);
David Lawrence Ramsey6fb66892006-05-27 17:39:19 +0000720#ifdef ENABLE_UTF8
David Lawrence Ramsey12e37082006-05-27 15:52:26 +0000721long add_unicode_digit(int kbinput, long factor, long *uni);
David Lawrence Ramseyfc0ddab2016-07-24 12:34:56 +0200722long get_unicode_kbinput(WINDOW *win, int kbinput);
David Lawrence Ramsey6fb66892006-05-27 17:39:19 +0000723#endif
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000724int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000725void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000726int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
Benno Schulenberg08c51cf2016-07-16 19:44:24 +0200727int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000728#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000729int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000730#endif
Benno Schulenberg49816fe2014-07-01 10:41:10 +0000731const sc *get_shortcut(int *kbinput);
Benno Schulenbergf7d320d2017-01-12 17:48:33 +0100732void blank_row(WINDOW *win, int y, int x, int n);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000733void blank_titlebar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000734void blank_edit(void);
735void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000736void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000737void check_statusblank(void);
Benno Schulenberga37cd9f2016-06-14 19:56:16 +0200738char *display_string(const char *buf, size_t start_col, size_t span,
739 bool dollars);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000740void titlebar(const char *path);
Chris Allegretta4b3f2772015-01-03 07:24:17 +0000741extern void set_modified(void);
Benno Schulenberg2535f512016-04-30 17:31:43 +0200742void statusbar(const char *msg);
David Lawrence Ramseye4d45242016-11-27 15:01:54 -0600743void warn_and_shortly_pause(const char *msg);
Benno Schulenbergc8f530a2016-05-19 20:43:08 +0200744void statusline(message_type importance, const char *msg, ...);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000745void bottombars(int menu);
Benno Schulenberg7f3dc2d2016-03-23 20:21:36 +0000746void onekey(const char *keystroke, const char *desc, int length);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000747void reset_cursor(void);
Benno Schulenbergc0aa5ad2017-01-09 18:25:25 +0100748void edit_draw(filestruct *fileptr, const char *converted,
749 int line, size_t from_col);
Chris Allegretta05417a22009-08-17 07:52:10 +0000750int update_line(filestruct *fileptr, size_t index);
Benno Schulenberg2f664762016-07-26 19:47:00 +0200751bool need_horizontal_scroll(const size_t old_column, const size_t new_column);
David Lawrence Ramseyb1b97702017-01-15 12:17:19 -0600752void edit_scroll(scroll_dir direction, int nrows);
Benno Schulenbergaa1ae0a2016-04-10 21:16:19 +0200753void edit_redraw(filestruct *old_current);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000754void edit_refresh(void);
Benno Schulenberg01bbf7e2016-10-20 21:11:11 +0200755void adjust_viewport(update_type location);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000756void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000757void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000758void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000759void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000760void do_cursorpos_void(void);
Benno Schulenbergc98afde2016-03-30 12:09:39 +0000761void spotlight(bool active, const char *word);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000762void xon_complaint(void);
763void xoff_complaint(void);
Chris Allegretta0018d8e2008-03-13 08:23:52 +0000764void do_suspend_void(void);
Chris Allegretta0dc26dc2009-01-24 22:40:41 +0000765void enable_nodelay(void);
766void disable_nodelay(void);
Benno Schulenbergd17438b2014-04-03 20:57:44 +0000767#ifndef DISABLE_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000768void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000769#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000770
Benno Schulenbergd19be5a2014-04-08 18:38:45 +0000771/* May as well throw these here, since they are just placeholders. */
Chris Allegretta637daa82011-02-07 14:45:56 +0000772void do_cancel(void);
773void case_sens_void(void);
774void regexp_void(void);
775void gototext_void(void);
776void to_files_void(void);
777void dos_format_void(void);
778void mac_format_void(void);
779void append_void(void);
780void prepend_void(void);
781void backup_file_void(void);
Benno Schulenberg8cc63082015-12-23 16:34:44 +0000782void discard_buffer(void);
Chris Allegretta637daa82011-02-07 14:45:56 +0000783void new_buffer_void(void);
784void backwards_void(void);
785void goto_dir_void(void);
Benno Schulenberga0f66c02014-06-23 18:30:35 +0000786void flip_replace_void(void);
Benno Schulenberg04a38da2014-06-04 19:15:16 +0000787void flip_execute_void(void);
Chris Allegretta637daa82011-02-07 14:45:56 +0000788
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000789#endif /* !PROTO_H */