blob: 6f26c0e8826da765a2073718011c3c3281f67462 [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * proto.h *
4 * *
Chris Allegretta8a07a962009-12-02 03:36:22 +00005 * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
6 * 2008, 2009 Free Software Foundation, Inc. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00007 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
David Lawrence Ramseyd0035b42007-08-11 05:17:36 +00009 * the Free Software Foundation; either version 3, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000010 * any later version. *
11 * *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000012 * This program is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15 * 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 *
18 * along with this program; if not, write to the Free Software *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
20 * 02110-1301, USA. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000021 * *
22 **************************************************************************/
23
David Lawrence Ramseye527e452005-04-15 18:07:26 +000024#ifndef PROTO_H
25#define PROTO_H 1
26
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000027#include "nano.h"
28
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +000029/* All external variables. See global.c for their descriptions. */
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000030#ifndef NANO_TINY
David Lawrence Ramsey1c5af642006-05-10 15:15:06 +000031extern sigjmp_buf jump_buf;
32extern bool jump_buf_main;
Chris Allegrettaad37e672009-07-12 03:36:58 +000033extern bool use_undo;
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +000034#endif
35
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000036#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000037extern ssize_t fill;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000038extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000039#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000040
41extern char *last_search;
42extern char *last_replace;
43
Chris Allegrettaa48507d2009-08-14 03:18:29 +000044extern unsigned flags[4];
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000045extern WINDOW *topwin;
46extern WINDOW *edit;
47extern WINDOW *bottomwin;
48extern int editwinrows;
Chris Allegretta8c1edd12009-11-16 04:28:40 +000049extern int maxrows;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000050
51extern filestruct *cutbuffer;
Chris Allegretta12dc8ca2008-07-31 04:24:04 +000052extern filestruct *cutbottom;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000053#ifndef DISABLE_JUSTIFY
54extern filestruct *jusbuffer;
55#endif
56extern partition *filepart;
57extern openfilestruct *openfile;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000058
David Lawrence Ramseyd89617f2006-01-06 21:51:10 +000059#ifndef NANO_TINY
60extern char *matchbrackets;
61#endif
62
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000063#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000064extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000065extern int whitespace_len[2];
Chris Allegretta07fcc4c2008-07-10 20:13:04 +000066extern undo_type last_action;
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000067#endif
68
Chris Allegrettae4f940d2002-03-03 22:36:36 +000069#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000070extern char *punct;
71extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000072extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000073#ifdef HAVE_REGEX_H
74extern regex_t quotereg;
75extern int quoterc;
76extern char *quoteerr;
77#else
78extern size_t quotelen;
79#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000080#endif
Chris Allegrettaf86fa862009-02-25 04:32:15 +000081extern bool nodelay_mode;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000082extern char *answer;
83
84extern ssize_t tabsize;
85
David Lawrence Ramseyebe34252005-11-15 03:17:35 +000086#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000087extern char *backup_dir;
Chris Allegretta3116d2f2013-01-03 04:36:39 +000088extern const char *locking_prefix;
89extern const char *locking_suffix;
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000090#endif
Chris Allegrettae1f14522001-09-19 03:19:43 +000091#ifndef DISABLE_OPERATINGDIR
92extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000093extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000094#endif
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +000095
Chris Allegretta8d8e0122001-04-18 04:28:54 +000096#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000097extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000098#endif
99
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000100extern sc *sclist;
101extern subnfunc *allfuncs;
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000102#ifdef ENABLE_COLOR
103extern syntaxtype *syntaxes;
104extern char *syntaxstr;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000105#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000106
Chris Allegrettafd265af2009-02-06 03:41:02 +0000107extern bool edit_refresh_needed;
Chris Allegretta6df90f52002-07-19 01:08:59 +0000108extern const shortcut *currshortcut;
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000109extern int currmenu;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000110
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000111#ifndef NANO_TINY
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000112extern filestruct *search_history;
113extern filestruct *searchage;
114extern filestruct *searchbot;
115extern filestruct *replace_history;
116extern filestruct *replaceage;
117extern filestruct *replacebot;
Chris Allegretta9bfda912011-02-16 06:52:30 +0000118extern poshiststruct *poshistory;
Chris Allegretta8e2a9302011-02-18 07:30:57 +0000119void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
Chris Allegretta5beed502003-01-05 20:41:21 +0000120#endif
121
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000122#ifdef HAVE_REGEX_H
123extern regex_t search_regexp;
124extern regmatch_t regmatches[10];
125#endif
126
David Lawrence Ramsey4d72de72006-04-12 15:27:40 +0000127extern int reverse_attr;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000128
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000129extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000130
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000131/* All functions in browser.c. */
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000132#ifndef DISABLE_BROWSER
David Lawrence Ramseyb08c9f02006-07-11 18:12:24 +0000133char *do_browser(char *path, DIR *dir);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000134char *do_browse_from(const char *inpath);
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000135void browser_init(const char *path, DIR *dir);
David Lawrence Ramsey91a2a692006-02-07 04:41:44 +0000136void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key);
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000137void browser_refresh(void);
David Lawrence Ramseya43b1082006-06-30 22:28:37 +0000138bool browser_select_filename(const char *needle);
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000139int filesearch_init(void);
140bool findnextfile(bool no_sameline, size_t begin, const char *needle);
141void findnextfile_wrap_reset(void);
142void filesearch_abort(void);
143void do_filesearch(void);
144void do_fileresearch(void);
145void do_first_file(void);
146void do_last_file(void);
David Lawrence Ramseya4e92c82006-06-30 14:14:40 +0000147char *striponedir(const char *path);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000148#endif
149
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000150/* All functions in chars.c. */
David Lawrence Ramsey4d72de72006-04-12 15:27:40 +0000151#ifdef ENABLE_UTF8
152void utf8_init(void);
153bool using_utf8(void);
154#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000155#ifndef HAVE_ISBLANK
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000156bool nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000157#endif
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000158#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000159bool niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000160#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000161bool is_byte(int c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000162bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000163bool is_blank_mbchar(const char *c);
David Lawrence Ramsey8e341e12006-05-24 17:36:00 +0000164bool is_ascii_cntrl_char(int c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000165bool is_cntrl_char(int c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000166#ifdef ENABLE_UTF8
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000167bool is_cntrl_wchar(wchar_t wc);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000168#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000169bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000170bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000171bool is_word_mbchar(const char *c, bool allow_punct);
David Lawrence Ramsey19462612005-06-12 18:05:42 +0000172char control_rep(char c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000173#ifdef ENABLE_UTF8
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000174wchar_t control_wrep(wchar_t c);
175#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000176char *control_mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramsey96452cb2005-07-26 06:13:45 +0000177char *mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000178int mbwidth(const char *c);
179int mb_cur_max(void);
David Lawrence Ramsey8b006c22005-08-08 23:03:25 +0000180char *make_mbchar(long chr, int *chr_mb_len);
David Lawrence Ramsey96452cb2005-07-26 06:13:45 +0000181int parse_mbchar(const char *buf, char *chr, size_t *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000182size_t move_mbleft(const char *buf, size_t pos);
183size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000184#ifndef HAVE_STRCASECMP
185int nstrcasecmp(const char *s1, const char *s2);
186#endif
187int mbstrcasecmp(const char *s1, const char *s2);
188#ifndef HAVE_STRNCASECMP
189int nstrncasecmp(const char *s1, const char *s2, size_t n);
190#endif
191int mbstrncasecmp(const char *s1, const char *s2, size_t n);
192#ifndef HAVE_STRCASESTR
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000193char *nstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000194#endif
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000195char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000196#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000197char *revstrstr(const char *haystack, const char *needle, const char
198 *rev_start);
David Lawrence Ramsey7b601fd2005-06-13 13:25:36 +0000199#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000200#ifndef NANO_TINY
David Lawrence Ramseyae46b912007-07-06 13:44:13 +0000201char *revstrcasestr(const char *haystack, const char *needle, const char
202 *rev_start);
203char *mbrevstrcasestr(const char *haystack, const char *needle, const
204 char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000205#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000206size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000207#ifndef HAVE_STRNLEN
208size_t nstrnlen(const char *s, size_t maxlen);
209#endif
210size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000211#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
212char *mbstrchr(const char *s, const char *c);
213#endif
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000214#ifndef NANO_TINY
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000215char *mbstrpbrk(const char *s, const char *accept);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000216char *revstrpbrk(const char *s, const char *accept, const char
217 *rev_start);
David Lawrence Ramseya2488632006-01-06 07:10:30 +0000218char *mbrevstrpbrk(const char *s, const char *accept, const char
219 *rev_start);
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000220#endif
David Lawrence Ramsey1a16df92006-01-06 22:04:38 +0000221#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
David Lawrence Ramseyd5d4dde2005-06-14 01:55:56 +0000222bool has_blank_chars(const char *s);
223bool has_blank_mbchars(const char *s);
224#endif
David Lawrence Ramsey6ff695c2005-08-05 03:14:29 +0000225#ifdef ENABLE_UTF8
226bool is_valid_unicode(wchar_t wc);
227#endif
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000228#ifdef ENABLE_NANORC
229bool is_valid_mbstring(const char *s);
230#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000231
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000232/* All functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000233#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000234void set_colorpairs(void);
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000235void color_init(void);
David Lawrence Ramsey43cf7a12005-07-14 18:31:45 +0000236void color_update(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000237#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000238
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000239/* All functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000240void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000241void cut_line(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000242#ifndef NANO_TINY
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000243void cut_marked(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000244void cut_to_eol(void);
David Lawrence Ramsey41b89722006-05-21 20:03:43 +0000245void cut_to_eof(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000246#endif
David Lawrence Ramseyc87e0c02006-04-25 02:23:28 +0000247void do_cut_text(
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000248#ifndef NANO_TINY
Chris Allegretta91a18622008-08-01 03:50:20 +0000249 bool copy_text, bool cut_till_end, bool undoing
David Lawrence Ramseyc87e0c02006-04-25 02:23:28 +0000250#else
251 void
252#endif
253 );
254void do_cut_text_void(void);
255#ifndef NANO_TINY
256void do_copy_text(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000257void do_cut_till_end(void);
Chris Allegrettabf88d272013-01-01 03:24:39 +0000258
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000259#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000260void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000261
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000262/* All functions in files.c. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000263void make_new_buffer(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000264void initialize_buffer(void);
David Lawrence Ramseyc00513b2005-07-23 00:41:45 +0000265void initialize_buffer_text(void);
Chris Allegretta14c86202008-08-03 04:48:05 +0000266void open_buffer(const char *filename, bool undoable);
David Lawrence Ramsey9c984e82005-11-08 19:15:58 +0000267#ifndef DISABLE_SPELLER
268void replace_buffer(const char *filename);
269#endif
David Lawrence Ramseye5c7e922005-07-12 23:06:22 +0000270void display_buffer(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000271#ifdef ENABLE_MULTIBUFFER
272void switch_to_prevnext_buffer(bool next);
273void switch_to_prev_buffer_void(void);
274void switch_to_next_buffer_void(void);
275bool close_buffer(void);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000276#endif
David Lawrence Ramsey50995bd2005-05-16 20:13:09 +0000277filestruct *read_line(char *buf, filestruct *prevnode, bool
David Lawrence Ramsey483f3ac2005-06-19 19:57:13 +0000278 *first_line_ins, size_t buf_len);
Chris Allegretta2c7b5062009-12-09 16:51:43 +0000279void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000280int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000281char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000282void do_insertfile(
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000283#ifndef NANO_TINY
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000284 bool execute
285#else
286 void
287#endif
288 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000289void do_insertfile_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000290char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000291char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000292char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000293#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000294void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000295bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000296#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000297#ifndef NANO_TINY
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000298void init_backup_dir(void);
Chris Allegrettabf88d272013-01-01 03:24:39 +0000299int delete_lockfile(const char *lockfilename);
Chris Allegretta170607b2013-01-03 03:57:18 +0000300int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000301#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000302int copy_file(FILE *inn, FILE *out);
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000303bool write_file(const char *name, FILE *f_open, bool tmp, append_type
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000304 append, bool nonamechange);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000305#ifndef NANO_TINY
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000306bool write_marked_file(const char *name, FILE *f_open, bool tmp,
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000307 append_type append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000308#endif
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000309bool do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000310void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000311char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000312#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
313int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000314void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000315#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000316#ifndef DISABLE_TABCOMP
David Lawrence Ramsey4154d082007-01-11 21:36:29 +0000317bool is_dir(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000318char **username_tab_completion(const char *buf, size_t *num_matches,
David Lawrence Ramsey6e6c80b2007-10-11 15:38:32 +0000319 size_t buf_len);
David Lawrence Ramsey9d8c2842006-02-07 21:11:05 +0000320char **cwd_tab_completion(const char *buf, bool allow_files, size_t
David Lawrence Ramsey6e6c80b2007-10-11 15:38:32 +0000321 *num_matches, size_t buf_len);
David Lawrence Ramsey9d8c2842006-02-07 21:11:05 +0000322char *input_tab(char *buf, bool allow_files, size_t *place, bool
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000323 *lastwastab, void (*refresh_func)(void), bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000324#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000325const char *tail(const char *foo);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000326#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000327char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000328void load_history(void);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000329bool writehist(FILE *hist, filestruct *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000330void save_history(void);
Chris Allegretta9bfda912011-02-16 06:52:30 +0000331int check_dotnano(void);
332void load_poshistory(void);
333void save_poshistory(void);
334int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000335#endif
Chris Allegretta5575bfa2014-02-24 10:18:15 +0000336#ifdef ENABLE_COLOR
337void do_linter(void);
338void set_lint_shortcuts(void);
339void set_spell_shortcuts(void);
340#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000341
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000342/* All functions in global.c. */
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000343size_t length_of_list(int menu);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000344#ifndef NANO_TINY
David Lawrence Ramseybd28ee42006-07-25 21:13:30 +0000345void toggle_init_one(int val
346#ifndef DISABLE_HELP
347 , const char *desc, bool blank_after
348#endif
349 , long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000350void toggle_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000351#endif
David Lawrence Ramseybd28ee42006-07-25 21:13:30 +0000352void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000353#ifndef DISABLE_HELP
David Lawrence Ramseybd28ee42006-07-25 21:13:30 +0000354 , const char *help, bool blank_after
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000355#endif
David Lawrence Ramseybd28ee42006-07-25 21:13:30 +0000356 , int metaval, int funcval, int miscval, bool view, void
357 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000358void shortcut_init(bool unjustify);
Chris Allegretta6232d662002-05-12 19:52:15 +0000359#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000360void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000361#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000362
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000363/* All functions in help.c. */
David Lawrence Ramseye38b8082006-03-30 07:03:04 +0000364#ifndef DISABLE_BROWSER
365void do_browser_help(void);
366#endif
Chris Allegretta1d778232008-08-30 21:00:00 +0000367void do_help_void(void);
368#ifndef DISABLE_HELP
369void do_help(void (*refresh_func)(void));
David Lawrence Ramseyd420b5a2005-11-01 23:00:56 +0000370void help_init(void);
David Lawrence Ramseybc80cb12006-04-24 23:03:21 +0000371void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
David Lawrence Ramseyc3593012005-11-01 20:11:55 +0000372size_t help_line_len(const char *ptr);
David Lawrence Ramsey7e2d6732005-11-01 19:32:45 +0000373#endif
374
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000375/* All functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000376void do_first_line(void);
377void do_last_line(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000378void do_page_up(void);
379void do_page_down(void);
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000380#ifndef DISABLE_JUSTIFY
381void do_para_begin(bool allow_update);
382void do_para_begin_void(void);
383void do_para_end(bool allow_update);
384void do_para_end_void(void);
385#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000386#ifndef NANO_TINY
David Lawrence Ramseyc4037f32005-07-20 21:31:19 +0000387bool do_next_word(bool allow_punct, bool allow_update);
388void do_next_word_void(void);
389bool do_prev_word(bool allow_punct, bool allow_update);
390void do_prev_word_void(void);
391#endif
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000392void do_home(void);
393void do_end(void);
David Lawrence Ramsey2c36e2e2006-07-06 22:17:47 +0000394void do_up(
395#ifndef NANO_TINY
396 bool scroll_only
397#else
398 void
399#endif
400 );
401void do_up_void(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000402#ifndef NANO_TINY
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000403void do_scroll_up(void);
404#endif
David Lawrence Ramsey2c36e2e2006-07-06 22:17:47 +0000405void do_down(
406#ifndef NANO_TINY
407 bool scroll_only
408#else
409 void
410#endif
411 );
412void do_down_void(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000413#ifndef NANO_TINY
David Lawrence Ramsey2de84c12005-10-24 02:12:09 +0000414void do_scroll_down(void);
415#endif
David Lawrence Ramsey1c3bfa92005-09-13 04:53:44 +0000416void do_left(void);
417void do_right(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000418
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000419/* All functions in nano.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000420filestruct *make_new_node(filestruct *prevnode);
421filestruct *copy_node(const filestruct *src);
422void splice_node(filestruct *begin, filestruct *newnode, filestruct
423 *end);
424void unlink_node(const filestruct *fileptr);
425void delete_node(filestruct *fileptr);
426filestruct *copy_filestruct(const filestruct *src);
427void free_filestruct(filestruct *src);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000428void renumber(filestruct *fileptr);
429partition *partition_filestruct(filestruct *top, size_t top_x,
430 filestruct *bot, size_t bot_x);
431void unpartition_filestruct(partition **p);
432void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
433 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
434void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramseye99494f2005-07-20 21:08:38 +0000435openfilestruct *make_new_opennode(void);
436void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
437 openfilestruct *end);
438void unlink_opennode(openfilestruct *fileptr);
439void delete_opennode(openfilestruct *fileptr);
440#ifdef DEBUG
441void free_openfilestruct(openfilestruct *src);
442#endif
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000443void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000444void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000445void die(const char *msg, ...);
Chris Allegretta8b6f6fc2009-11-22 21:35:56 +0000446void die_save_file(const char *die_filename
447#ifndef NANO_TINY
448 , struct stat *die_stat
449#endif
450 );
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000451void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000452#ifndef DISABLE_MOUSE
David Lawrence Ramsey503bad02006-06-09 18:24:37 +0000453void disable_mouse_support(void);
454void enable_mouse_support(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000455void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000456#endif
David Lawrence Ramsey660e05b2006-05-12 19:30:28 +0000457void print_opt_full(const char *shortflag
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000458#ifdef HAVE_GETOPT_LONG
459 , const char *longflag
460#endif
461 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000462void usage(void);
463void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000464int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000465int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000466void nano_disabled_msg(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000467void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000468void signal_init(void);
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000469RETSIGTYPE handle_hupterm(int signal);
470RETSIGTYPE do_suspend(int signal);
471RETSIGTYPE do_continue(int signal);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000472#ifndef NANO_TINY
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000473RETSIGTYPE handle_sigwinch(int signal);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000474void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000475#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000476#ifndef NANO_TINY
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000477void do_toggle(int flag);
Chris Allegretta637daa82011-02-07 14:45:56 +0000478void do_toggle_void(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000479#endif
David Lawrence Ramsey8bcac8a2005-06-09 04:02:57 +0000480void disable_extended_io(void);
David Lawrence Ramseyf78bc852007-12-18 15:55:48 +0000481#ifdef USE_SLANG
482void disable_signals(void);
483#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000484#ifndef NANO_TINY
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000485void enable_signals(void);
486#endif
487void disable_flow_control(void);
488void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000489void terminal_init(void);
Chris Allegrettaeb643142008-03-12 04:44:14 +0000490int do_input(bool *meta_key, bool *func_key, bool *have_shortcut, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000491 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000492#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000493int do_mouse(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000494#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000495void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000496
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000497/* All functions in prompt.c. */
Chris Allegrettaeb643142008-03-12 04:44:14 +0000498int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000499 bool *ran_func, bool *finished, bool allow_funcs, void
500 (*refresh_func)(void));
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000501#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000502int do_statusbar_mouse(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000503#endif
504void do_statusbar_output(char *output, size_t output_len, bool
David Lawrence Ramsey81371022006-11-27 04:56:16 +0000505 *got_enter, bool allow_cntrls);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000506void do_statusbar_home(void);
507void do_statusbar_end(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000508void do_statusbar_left(void);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000509void do_statusbar_right(void);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000510void do_statusbar_backspace(void);
511void do_statusbar_delete(void);
512void do_statusbar_cut_text(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000513#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000514bool do_statusbar_next_word(bool allow_punct);
515bool do_statusbar_prev_word(bool allow_punct);
516#endif
517void do_statusbar_verbatim_input(bool *got_enter);
David Lawrence Ramseyc4993822005-11-16 04:14:03 +0000518#ifndef NANO_TINY
David Lawrence Ramsey5ab56ea2005-11-16 13:45:41 +0000519bool find_statusbar_bracket_match(bool reverse, const char
520 *bracket_set);
David Lawrence Ramseyc4993822005-11-16 04:14:03 +0000521void do_statusbar_find_bracket(void);
522#endif
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000523size_t statusbar_xplustabs(void);
524size_t get_statusbar_page_start(size_t start_col, size_t column);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000525void reset_statusbar_cursor(void);
David Lawrence Ramsey60edb0a2006-05-15 15:17:50 +0000526void update_statusbar_line(const char *curranswer, size_t index);
David Lawrence Ramseyfa387952006-08-26 16:50:51 +0000527bool need_statusbar_horizontal_update(size_t pww_save);
David Lawrence Ramsey60edb0a2006-05-15 15:17:50 +0000528void total_statusbar_refresh(void (*refresh_func)(void));
Chris Allegrettaeb643142008-03-12 04:44:14 +0000529const sc *get_prompt_string(int *value, bool allow_tabs,
David Lawrence Ramsey9d8c2842006-02-07 21:11:05 +0000530#ifndef DISABLE_TABCOMP
531 bool allow_files,
532#endif
533 const char *curranswer,
Chris Allegretta10f868d2008-03-14 04:08:51 +0000534 bool *meta_key, bool *func_key,
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000535#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000536 filestruct **history_list,
537#endif
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000538 void (*refresh_func)(void), int menu
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000539#ifndef DISABLE_TABCOMP
540 , bool *list
541#endif
542 );
David Lawrence Ramsey9d8c2842006-02-07 21:11:05 +0000543int do_prompt(bool allow_tabs,
544#ifndef DISABLE_TABCOMP
545 bool allow_files,
546#endif
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000547 int menu, const char *curranswer,
Chris Allegretta10f868d2008-03-14 04:08:51 +0000548 bool *meta_key, bool *func_key,
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000549#ifndef NANO_TINY
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000550 filestruct **history_list,
551#endif
David Lawrence Ramsey68160072006-02-18 21:32:29 +0000552 void (*refresh_func)(void), const char *msg, ...);
David Lawrence Ramseye19449e2005-11-07 21:45:44 +0000553void do_prompt_abort(void);
554int do_yesno_prompt(bool all, const char *msg);
David Lawrence Ramseyd24d0a42005-11-01 17:37:44 +0000555
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000556/* All functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000557#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000558void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000559char *parse_next_word(char *ptr);
560char *parse_argument(char *ptr);
561#ifdef ENABLE_COLOR
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000562char *parse_next_regex(char *ptr);
Chris Allegretta22c83ec2013-03-17 22:09:38 +0000563bool nregcomp(const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000564void parse_syntax(char *ptr);
Chris Allegrettab00d0b92011-02-13 04:23:10 +0000565void parse_magic_syntax(char *ptr);
David Lawrence Ramseycee20e52006-04-13 02:43:54 +0000566void parse_include(char *ptr);
David Lawrence Ramseya8239c32006-05-28 22:24:03 +0000567short color_to_short(const char *colorname, bool *bright);
David Lawrence Ramsey23555f22005-06-27 03:07:10 +0000568void parse_colors(char *ptr, bool icase);
Chris Allegretta9555e1d2009-02-16 21:04:00 +0000569void reset_multis(filestruct *fileptr, bool force);
Chris Allegretta56a295b2009-02-07 14:48:30 +0000570void alloc_multidata_if_needed(filestruct *fileptr);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000571#endif
David Lawrence Ramseycee20e52006-04-13 02:43:54 +0000572void parse_rcfile(FILE *rcstream
573#ifdef ENABLE_COLOR
574 , bool syntax_only
575#endif
576 );
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000577void do_rcfile(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000578#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000579
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000580/* All functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000581#ifdef HAVE_REGEX_H
David Lawrence Ramsey0ec34ac2007-01-09 23:35:02 +0000582bool regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000583void regexp_cleanup(void);
584#endif
585void not_found_msg(const char *str);
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000586void search_replace_abort(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000587void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000588int search_init(bool replacing, bool use_answer);
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000589bool findnextstr(
590#ifndef DISABLE_SPELLER
591 bool whole_word,
592#endif
593 bool no_sameline, const filestruct *begin, size_t begin_x, const
594 char *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000595void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000596void do_search(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000597#ifndef NANO_TINY
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000598void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000599#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000600#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000601int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000602#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000603char *replace_line(const char *needle);
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000604ssize_t do_replace_loop(
605#ifndef DISABLE_SPELLER
606 bool whole_word,
607#endif
608 bool *canceled, const filestruct *real_current, size_t
609 *real_current_x, const char *needle);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000610void do_replace(void);
David Lawrence Ramsey5beae582005-06-29 00:17:18 +0000611void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
David Lawrence Ramsey8f1afee2005-07-16 07:06:36 +0000612 bool interactive, bool save_pos, bool allow_update);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000613void do_gotolinecolumn_void(void);
David Lawrence Ramsey8f4762a2005-07-16 22:35:11 +0000614#ifndef DISABLE_SPELLER
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000615void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000616 pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000617#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000618#ifndef NANO_TINY
David Lawrence Ramseyc5c52302005-11-15 23:45:29 +0000619bool find_bracket_match(bool reverse, const char *bracket_set);
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000620void do_find_bracket(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000621#ifdef ENABLE_NANORC
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000622bool history_has_changed(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000623#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000624void history_init(void);
David Lawrence Ramsey0e581b32005-07-18 07:48:50 +0000625void history_reset(const filestruct *h);
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000626filestruct *find_history(const filestruct *h_start, const filestruct
627 *h_end, const char *s, size_t len);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000628void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000629char *get_history_older(filestruct **h);
630char *get_history_newer(filestruct **h);
Chris Allegretta637daa82011-02-07 14:45:56 +0000631void get_history_older_void(void);
632void get_history_newer_void(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000633#ifndef DISABLE_TABCOMP
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000634char *get_history_completion(filestruct **h, const char *s, size_t len);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000635#endif
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000636#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000637
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000638/* All functions in text.c. */
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000639#ifndef NANO_TINY
David Lawrence Ramsey7ea09e52005-07-25 02:41:59 +0000640void do_mark(void);
641#endif
642void do_delete(void);
643void do_backspace(void);
644void do_tab(void);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000645#ifndef NANO_TINY
David Lawrence Ramseyaee00d42006-07-05 18:42:22 +0000646void do_indent(ssize_t cols);
647void do_indent_void(void);
648void do_unindent(void);
Chris Allegretta07fcc4c2008-07-10 20:13:04 +0000649void do_undo(void);
650void do_redo(void);
David Lawrence Ramseyf85001a2006-04-28 13:19:56 +0000651#endif
Chris Allegrettae061a0d2009-04-25 03:31:30 +0000652void do_enter(bool undoing);
Chris Allegretta637daa82011-02-07 14:45:56 +0000653void do_enter_void(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000654#ifndef NANO_TINY
David Lawrence Ramsey8befda62005-12-06 19:39:56 +0000655RETSIGTYPE cancel_command(int signal);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000656bool execute_command(const char *command);
657#endif
658#ifndef DISABLE_WRAPPING
659void wrap_reset(void);
Chris Allegrettaa4c2b992009-04-29 22:34:27 +0000660bool do_wrap(filestruct *line, bool undoing);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000661#endif
David Lawrence Ramseyc7c04bb2005-11-29 21:30:00 +0000662#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
David Lawrence Ramseyb9b2fd52005-11-22 21:13:36 +0000663ssize_t break_line(const char *line, ssize_t goal
664#ifndef DISABLE_HELP
Chris Allegretta8b6461f2008-05-31 23:09:40 +0000665 , bool newln
David Lawrence Ramseyb9b2fd52005-11-22 21:13:36 +0000666#endif
667 );
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000668#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000669#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000670size_t indent_length(const char *line);
671#endif
672#ifndef DISABLE_JUSTIFY
673void justify_format(filestruct *paragraph, size_t skip);
674size_t quote_length(const char *line);
675bool quotes_match(const char *a_line, size_t a_quote, const char
676 *b_line);
677bool indents_match(const char *a_line, size_t a_indent, const char
678 *b_line, size_t b_indent);
679bool begpar(const filestruct *const foo);
680bool inpar(const filestruct *const foo);
David Lawrence Ramseycd8f7352005-11-10 21:20:32 +0000681void backup_lines(filestruct *first_line, size_t par_len);
David Lawrence Ramsey79383be2005-11-29 18:34:45 +0000682bool find_paragraph(size_t *const quote, size_t *const par);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000683void do_justify(bool full_justify);
684void do_justify_void(void);
685void do_full_justify(void);
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000686#endif
David Lawrence Ramseycc8185f2005-07-25 02:33:45 +0000687#ifndef DISABLE_SPELLER
688bool do_int_spell_fix(const char *word);
689const char *do_int_speller(const char *tempfile_name);
690const char *do_alt_speller(char *tempfile_name);
691void do_spell(void);
692#endif
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000693#ifndef NANO_TINY
David Lawrence Ramsey8e942342005-07-25 04:21:46 +0000694void do_wordlinechar_count(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000695#endif
David Lawrence Ramsey37ddfa92005-11-07 06:06:05 +0000696void do_verbatim_input(void);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000697
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000698/* All functions in utils.c. */
David Lawrence Ramseyc596c0c2005-04-19 16:32:08 +0000699int digits(size_t n);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000700void get_homedir(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000701bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000702bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6a0d5b82005-06-13 14:00:22 +0000703void align(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000704void null_at(char **data, size_t index);
705void unsunder(char *str, size_t true_len);
706void sunder(char *str);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000707#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000708#ifndef HAVE_GETLINE
709ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
710#endif
711#ifndef HAVE_GETDELIM
712ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
713#endif
David Lawrence Ramseybbac1bb2005-11-14 21:32:42 +0000714#endif
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000715#ifdef HAVE_REGEX_H
David Lawrence Ramsey6d6a36c2005-12-08 07:09:08 +0000716bool regexp_bol_or_eol(const regex_t *preg, const char *string);
Chris Allegretta6b83e522008-08-30 05:16:20 +0000717const char *fixbounds(const char *r);
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000718#endif
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000719#ifndef DISABLE_SPELLER
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000720bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseycf9c34a2005-11-16 05:59:06 +0000721#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000722const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000723 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000724void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000725void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000726void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000727char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000728char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000729char *mallocstrassn(char *dest, char *src);
David Lawrence Ramsey2b9d6a02005-11-01 17:45:31 +0000730size_t get_page_start(size_t column);
David Lawrence Ramsey81c4e182005-10-31 23:07:58 +0000731size_t xplustabs(void);
732size_t actual_x(const char *s, size_t column);
733size_t strnlenpt(const char *s, size_t maxlen);
734size_t strlenpt(const char *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000735void new_magicline(void);
David Lawrence Ramseyebe34252005-11-15 03:17:35 +0000736#ifndef NANO_TINY
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000737void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000738void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000739 **bot, size_t *bot_x, bool *right_side_up);
Chris Allegretta14c86202008-08-03 04:48:05 +0000740void add_undo(undo_type current_action);
741void update_undo(undo_type action);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000742#endif
David Lawrence Ramseyc104ef12005-07-17 01:44:35 +0000743size_t get_totsize(const filestruct *begin, const filestruct *end);
Chris Allegretta14c86202008-08-03 04:48:05 +0000744filestruct *fsfromline(ssize_t lineno);
David Lawrence Ramsey00cc5652005-11-02 15:44:01 +0000745#ifdef DEBUG
746void dump_filestruct(const filestruct *inptr);
747void dump_filestruct_reverse(void);
748#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000749
David Lawrence Ramsey6335fb52007-01-01 05:15:32 +0000750/* All functions in winio.c. */
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000751void get_key_buffer(WINDOW *win);
752size_t get_key_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000753void unget_input(int *input, size_t input_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000754void unget_kbinput(int kbinput, bool meta_key, bool func_key);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000755int *get_input(WINDOW *win, size_t input_len);
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000756int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +0000757int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramsey1b4ae692006-07-25 19:23:35 +0000758int get_escape_seq_kbinput(const int *seq, size_t seq_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000759int get_escape_seq_abcd(int kbinput);
David Lawrence Ramsey5370b0c2006-07-23 17:54:35 +0000760int parse_escape_seq_kbinput(WINDOW *win, int kbinput);
David Lawrence Ramseyfc0f8f82006-05-10 13:41:53 +0000761int get_byte_kbinput(int kbinput);
David Lawrence Ramsey6fb66892006-05-27 17:39:19 +0000762#ifdef ENABLE_UTF8
David Lawrence Ramsey12e37082006-05-27 15:52:26 +0000763long add_unicode_digit(int kbinput, long factor, long *uni);
David Lawrence Ramsey7f1b1192006-05-28 17:30:28 +0000764long get_unicode_kbinput(int kbinput);
David Lawrence Ramsey6fb66892006-05-27 17:39:19 +0000765#endif
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000766int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000767void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000768int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
769int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000770#ifndef DISABLE_MOUSE
David Lawrence Ramsey3a5eaeb2007-05-20 23:41:56 +0000771int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000772#endif
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000773const sc *get_shortcut(int menu, int *kbinput, bool
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000774 *meta_key, bool *func_key);
Chris Allegretta637daa82011-02-07 14:45:56 +0000775const sc *first_sc_for(int menu, void (*func)(void));
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000776void blank_line(WINDOW *win, int y, int x, int n);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000777void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000778void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000779void blank_edit(void);
780void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000781void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000782void check_statusblank(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000783char *display_string(const char *buf, size_t start_col, size_t len, bool
784 dollars);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000785void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000786void set_modified(void);
787void statusbar(const char *msg, ...);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000788void bottombars(int menu);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000789void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000790void reset_cursor(void);
Chris Allegrettad47d8cd2009-01-25 07:25:17 +0000791void edit_draw(filestruct *fileptr, const char *converted, int
David Lawrence Ramseya0aff672005-10-27 20:10:45 +0000792 line, size_t start);
Chris Allegretta05417a22009-08-17 07:52:10 +0000793int update_line(filestruct *fileptr, size_t index);
David Lawrence Ramseyfa387952006-08-26 16:50:51 +0000794bool need_horizontal_update(size_t pww_save);
795bool need_vertical_update(size_t pww_save);
David Lawrence Ramsey107e8162005-08-01 21:05:29 +0000796void edit_scroll(scroll_dir direction, ssize_t nlines);
Chris Allegrettad47d8cd2009-01-25 07:25:17 +0000797void edit_redraw(filestruct *old_current, size_t pww_save);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000798void edit_refresh(void);
David Lawrence Ramseybf0e47d2005-08-01 18:27:10 +0000799void edit_update(update_type location);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000800void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000801void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000802void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000803void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000804void do_cursorpos_void(void);
David Lawrence Ramsey7bde0532005-06-30 03:55:55 +0000805void do_replace_highlight(bool highlight, const char *word);
Chris Allegretta5a018f02009-11-29 06:13:22 +0000806const char *flagtostr(int flag);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000807const subnfunc *sctofunc(sc *s);
Chris Allegretta0dc26dc2009-01-24 22:40:41 +0000808const subnfunc *getfuncfromkey(WINDOW *win);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000809void print_sclist(void);
810sc *strtosc(int menu, char *input);
Chris Allegretta5a018f02009-11-29 06:13:22 +0000811function_type strtokeytype(const char *str);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000812int strtomenu(char *input);
813void assign_keyinfo(sc *s);
814void xon_complaint(void);
815void xoff_complaint(void);
Chris Allegretta637daa82011-02-07 14:45:56 +0000816int sc_seq_or (void (*func)(void), int defaultval);
Chris Allegretta0018d8e2008-03-13 08:23:52 +0000817void do_suspend_void(void);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000818
Chris Allegretta5a018f02009-11-29 06:13:22 +0000819extern const char *cancel_msg;
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000820#ifndef NANO_TINY
Chris Allegretta5a018f02009-11-29 06:13:22 +0000821extern const char *case_sens_msg;
822extern const char *backwards_msg;
823extern const char *prev_history_msg;
824extern const char *next_history_msg;
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000825#endif
Chris Allegretta5a018f02009-11-29 06:13:22 +0000826extern const char *replace_msg;
827extern const char *no_replace_msg;
828extern const char *go_to_line_msg;
829extern const char *whereis_next_msg;
830extern const char *first_file_msg;
831extern const char *last_file_msg;
832extern const char *goto_dir_msg;
833extern const char *ext_cmd_msg;
834extern const char *to_files_msg;
835extern const char *dos_format_msg;
836extern const char *mac_format_msg;
837extern const char *append_msg;
838extern const char *prepend_msg;
839extern const char *backup_file_msg;
840extern const char *gototext_msg;
841extern const char *new_buffer_msg;
842
Chris Allegretta0dc26dc2009-01-24 22:40:41 +0000843void enable_nodelay(void);
844void disable_nodelay(void);
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000845
846#ifdef HAVE_REGEX_H
Chris Allegretta5a018f02009-11-29 06:13:22 +0000847extern const char *regexp_msg;
Chris Allegretta79a33bb2008-03-05 07:34:01 +0000848#endif
849
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000850#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000851void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000852#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000853
Chris Allegretta637daa82011-02-07 14:45:56 +0000854/* May as just throw these here since they are just placeholders */
855void do_cancel(void);
Chris Allegretta5575bfa2014-02-24 10:18:15 +0000856void do_page_up(void);
857void do_page_down(void);
Chris Allegretta637daa82011-02-07 14:45:56 +0000858void case_sens_void(void);
859void regexp_void(void);
860void gototext_void(void);
861void to_files_void(void);
862void dos_format_void(void);
863void mac_format_void(void);
864void append_void(void);
865void prepend_void(void);
866void backup_file_void(void);
867void new_buffer_void(void);
868void backwards_void(void);
869void goto_dir_void(void);
870void no_replace_void(void);
871void ext_cmd_void(void);
872
873
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000874#endif /* !PROTO_H */