blob: fa6a309a429883e19a4dd50251800efbfdedb562 [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * proto.h *
4 * *
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +00005 * Copyright (C) 1999-2005 Chris Allegretta *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00006 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
Chris Allegretta3a24f3f2001-10-24 11:33:54 +00008 * the Free Software Foundation; either version 2, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00009 * any later version. *
10 * *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000011 * This program is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
14 * General Public License for more details. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000015 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
David Lawrence Ramsey6e925cf2005-05-15 19:57:17 +000018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
19 * 02110-1301, USA. *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000020 * *
21 **************************************************************************/
22
David Lawrence Ramseye527e452005-04-15 18:07:26 +000023#ifndef PROTO_H
24#define PROTO_H 1
25
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +000026/* Externs. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000027#include "nano.h"
28
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000029#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey691698a2005-07-24 19:57:51 +000030extern ssize_t fill;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000031extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000032#endif
Chris Allegretta17dcb722001-01-20 21:40:07 +000033extern int editwinrows;
David Lawrence Ramseydb958022005-07-13 20:18:46 +000034extern long flags;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000035extern ssize_t tabsize;
Chris Allegretta6b58acd2001-04-12 03:01:53 +000036extern int currslen;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000037
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000038#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
39extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000040extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000041#endif
42
Chris Allegrettae4f940d2002-03-03 22:36:36 +000043#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000044extern char *punct;
45extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000046extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000047#ifdef HAVE_REGEX_H
48extern regex_t quotereg;
49extern int quoterc;
50extern char *quoteerr;
51#else
52extern size_t quotelen;
53#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000054#endif
55
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000056#ifndef NANO_SMALL
57extern char *backup_dir;
58#endif
59
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +000060extern WINDOW *topwin, *edit, *bottomwin;
Chris Allegretta31925e42000-11-02 04:40:39 +000061extern char *answer;
Chris Allegretta6df90f52002-07-19 01:08:59 +000062#ifndef DISABLE_HELP
63extern char *help_text;
64#endif
Chris Allegretta27eb13f2000-11-05 16:52:21 +000065extern char *last_search;
66extern char *last_replace;
Chris Allegrettae1f14522001-09-19 03:19:43 +000067#ifndef DISABLE_OPERATINGDIR
68extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000069extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000070#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +000071#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000072extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000073#endif
74
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000075extern struct stat fileinfo;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000076extern filestruct *cutbuffer;
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000077#ifndef DISABLE_JUSTIFY
78extern filestruct *jusbuffer;
79#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000080extern partition *filepart;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000081
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +000082extern openfilestruct *openfile;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000083
Chris Allegretta08893e02001-11-29 02:42:27 +000084#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +000085extern syntaxtype *syntaxes;
Chris Allegretta09900ff2002-05-04 04:23:30 +000086extern char *syntaxstr;
Chris Allegretta08893e02001-11-29 02:42:27 +000087#endif
88
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000089extern shortcut *shortcut_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000090extern shortcut *main_list, *whereis_list;
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +000091extern shortcut *replace_list, *gotoline_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000092extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +000093extern shortcut *replace_list_2;
Chris Allegretta7162e3d2002-04-06 05:02:14 +000094#ifndef NANO_SMALL
95extern shortcut *extcmd_list;
96#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +000097#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +000098extern shortcut *help_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +000099#endif
100#ifndef DISABLE_SPELLER
101extern shortcut *spell_list;
102#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000103#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000104extern shortcut *browser_list, *gotodir_list;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000105#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000106
Chris Allegretta6df90f52002-07-19 01:08:59 +0000107extern const shortcut *currshortcut;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000108
109#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000110extern regex_t search_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000111extern regmatch_t regmatches[10];
Chris Allegretta3533a342002-03-24 23:19:32 +0000112#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000113extern regex_t syntaxfile_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000114extern regmatch_t synfilematches[1];
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000115#endif /* ENABLE_COLOR */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000116#endif /* HAVE_REGEX_H */
117
118#ifndef NANO_SMALL
119extern toggle *toggles;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000120#endif
121
Chris Allegretta5beed502003-01-05 20:41:21 +0000122#ifndef NANO_SMALL
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000123extern filestruct *search_history;
124extern filestruct *searchage;
125extern filestruct *searchbot;
126extern filestruct *replace_history;
127extern filestruct *replaceage;
128extern filestruct *replacebot;
Chris Allegretta5beed502003-01-05 20:41:21 +0000129#endif
130
David Lawrence Ramsey76356bd2004-08-12 04:30:22 +0000131extern bool curses_ended;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000132
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000133extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000134
David Lawrence Ramsey61f56732005-07-21 22:12:03 +0000135#ifdef ENABLE_UTF8
136extern const char *bad_mbchar;
137extern const int bad_mbchar_len;
138#endif
139
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +0000140/* The functions we want available. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000141
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000142/* Public functions in chars.c. */
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000143#ifndef HAVE_ISBLANK
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000144bool nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000145#endif
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000146#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000147bool niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000148#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000149bool is_byte(int c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000150bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000151bool is_blank_mbchar(const char *c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000152bool is_cntrl_char(int c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000153#ifdef ENABLE_UTF8
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000154bool is_cntrl_wchar(wchar_t wc);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000155#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000156bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000157bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000158bool is_word_mbchar(const char *c, bool allow_punct);
David Lawrence Ramsey19462612005-06-12 18:05:42 +0000159char control_rep(char c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000160#ifdef ENABLE_UTF8
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000161wchar_t control_wrep(wchar_t c);
162#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000163char *control_mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000164int mbwidth(const char *c);
165int mb_cur_max(void);
David Lawrence Ramseyf0195a82005-03-14 18:47:21 +0000166char *make_mbchar(int chr, int *chr_mb_len);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000167int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
168 *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000169size_t move_mbleft(const char *buf, size_t pos);
170size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000171#ifndef HAVE_STRCASECMP
172int nstrcasecmp(const char *s1, const char *s2);
173#endif
174int mbstrcasecmp(const char *s1, const char *s2);
175#ifndef HAVE_STRNCASECMP
176int nstrncasecmp(const char *s1, const char *s2, size_t n);
177#endif
178int mbstrncasecmp(const char *s1, const char *s2, size_t n);
179#ifndef HAVE_STRCASESTR
180const char *nstrcasestr(const char *haystack, const char *needle);
181#endif
David Lawrence Ramsey42abfe02005-01-22 18:24:16 +0000182const char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000183#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000184const char *revstrstr(const char *haystack, const char *needle, const
185 char *rev_start);
David Lawrence Ramsey7b601fd2005-06-13 13:25:36 +0000186#endif
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000187#ifndef NANO_SMALL
David Lawrence Ramsey3ee4cf32005-01-22 20:49:14 +0000188const char *revstrcasestr(const char *haystack, const char *needle,
189 const char *rev_start);
David Lawrence Ramsey345260c2005-01-24 01:14:17 +0000190const char *mbrevstrcasestr(const char *haystack, const char *needle,
191 const char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000192#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000193size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000194#ifndef HAVE_STRNLEN
195size_t nstrnlen(const char *s, size_t maxlen);
196#endif
197size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000198#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey66444c32005-07-21 18:05:27 +0000199char *mbstrchr(const char *s, char *c);
David Lawrence Ramseyd5d4dde2005-06-14 01:55:56 +0000200#ifdef ENABLE_NANORC
201bool has_blank_chars(const char *s);
202bool has_blank_mbchars(const char *s);
203#endif
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000204#endif
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000205#ifdef ENABLE_NANORC
206bool is_valid_mbstring(const char *s);
207#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000208
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000209/* Public functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000210#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000211void set_colorpairs(void);
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000212void color_init(void);
David Lawrence Ramsey43cf7a12005-07-14 18:31:45 +0000213void color_update(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000214#endif /* ENABLE_COLOR */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000215
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000216/* Public functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000217void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000218void cut_line(void);
David Lawrence Ramsey50af6ea2004-11-07 15:29:40 +0000219#ifndef NANO_SMALL
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000220void cut_marked(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000221void cut_to_eol(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000222#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000223void do_cut_text(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000224#ifndef NANO_SMALL
225void do_cut_till_end(void);
226#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000227void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000228
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000229/* Public functions in files.c. */
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000230void make_new_buffer(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000231void initialize_buffer(void);
David Lawrence Ramseyc00513b2005-07-23 00:41:45 +0000232void initialize_buffer_text(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000233void open_buffer(const char *filename);
David Lawrence Ramseye5c7e922005-07-12 23:06:22 +0000234void display_buffer(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000235#ifdef ENABLE_MULTIBUFFER
236void switch_to_prevnext_buffer(bool next);
237void switch_to_prev_buffer_void(void);
238void switch_to_next_buffer_void(void);
239bool close_buffer(void);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000240#endif
David Lawrence Ramsey50995bd2005-05-16 20:13:09 +0000241filestruct *read_line(char *buf, filestruct *prevnode, bool
David Lawrence Ramsey483f3ac2005-06-19 19:57:13 +0000242 *first_line_ins, size_t buf_len);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000243void read_file(FILE *f, const char *filename);
244int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000245char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000246void do_insertfile(
247#ifndef NANO_SMALL
248 bool execute
249#else
250 void
251#endif
252 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000253void do_insertfile_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000254char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000255char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000256char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000257#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000258void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000259bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000260#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000261#ifndef NANO_SMALL
262void init_backup_dir(void);
263#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000264int copy_file(FILE *inn, FILE *out);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000265int write_file(const char *name, FILE *f_open, bool tmp, int append,
266 bool nonamechange);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000267#ifndef NANO_SMALL
David Lawrence Ramsey222b2012005-07-12 20:09:24 +0000268int write_marked_file(const char *name, FILE *f_open, bool tmp, int
269 append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000270#endif
David Lawrence Ramsey951d7142004-10-04 15:23:47 +0000271int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000272void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000273char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000274#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
275int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000276void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000277#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000278#ifndef DISABLE_TABCOMP
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000279char **username_tab_completion(const char *buf, size_t *num_matches,
280 size_t buflen);
281char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
282 buflen);
283char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000284#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000285const char *tail(const char *foo);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000286#ifndef DISABLE_BROWSER
David Lawrence Ramsey7d367712005-02-14 05:00:15 +0000287void striponedir(char *path);
288char **browser_init(const char *path, int *longest, size_t *numents, DIR
289 *dir);
290char *do_browser(char *path, DIR *dir);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000291char *do_browse_from(const char *inpath);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000292#endif
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000293#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000294char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000295void load_history(void);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000296bool writehist(FILE *hist, filestruct *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000297void save_history(void);
298#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000299
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000300/* Public functions in global.c. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000301size_t length_of_list(const shortcut *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000302#ifndef NANO_SMALL
David Lawrence Ramsey2ad32092004-07-07 14:36:44 +0000303void toggle_init_one(int val, const char *desc, long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000304void toggle_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000305#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000306void sc_init_one(shortcut **shortcutage, int key, const char *desc,
307#ifndef DISABLE_HELP
308 const char *help,
309#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000310 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000311 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000312void shortcut_init(bool unjustify);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000313void free_shortcutage(shortcut **shortcutage);
Chris Allegretta6232d662002-05-12 19:52:15 +0000314#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000315void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000316#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000317
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000318/* Public functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000319void do_first_line(void);
320void do_last_line(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000321void do_page_up(void);
322void do_page_down(void);
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000323#ifndef DISABLE_JUSTIFY
324void do_para_begin(bool allow_update);
325void do_para_begin_void(void);
326void do_para_end(bool allow_update);
327void do_para_end_void(void);
328#endif
David Lawrence Ramseyc4037f32005-07-20 21:31:19 +0000329#ifndef NANO_SMALL
330bool do_next_word(bool allow_punct, bool allow_update);
331void do_next_word_void(void);
332bool do_prev_word(bool allow_punct, bool allow_update);
333void do_prev_word_void(void);
334#endif
David Lawrence Ramseyca62f9f2005-07-20 19:24:11 +0000335void do_home(void);
336void do_end(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000337void do_up(void);
338void do_down(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000339void do_left(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000340void do_left_void(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000341void do_right(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000342void do_right_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000343
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000344/* Public functions in nano.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000345filestruct *make_new_node(filestruct *prevnode);
346filestruct *copy_node(const filestruct *src);
347void splice_node(filestruct *begin, filestruct *newnode, filestruct
348 *end);
349void unlink_node(const filestruct *fileptr);
350void delete_node(filestruct *fileptr);
351filestruct *copy_filestruct(const filestruct *src);
352void free_filestruct(filestruct *src);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000353void renumber(filestruct *fileptr);
354partition *partition_filestruct(filestruct *top, size_t top_x,
355 filestruct *bot, size_t bot_x);
356void unpartition_filestruct(partition **p);
357void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
358 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
359void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramseye99494f2005-07-20 21:08:38 +0000360openfilestruct *make_new_opennode(void);
361void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
362 openfilestruct *end);
363void unlink_opennode(openfilestruct *fileptr);
364void delete_opennode(openfilestruct *fileptr);
365#ifdef DEBUG
366void free_openfilestruct(openfilestruct *src);
367#endif
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000368void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000369void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000370void die(const char *msg, ...);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000371void die_save_file(const char *die_filename);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000372void check_die_too_small(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000373void window_size_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000374void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000375#ifndef DISABLE_MOUSE
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000376void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000377#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000378#ifndef DISABLE_HELP
379void help_init(void);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000380#endif
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000381void print1opt_full(const char *shortflag
382#ifdef HAVE_GETOPT_LONG
383 , const char *longflag
384#endif
385 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000386void usage(void);
387void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000388int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000389int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000390void nano_disabled_msg(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000391void do_verbatim_input(void);
392void do_backspace(void);
393void do_delete(void);
394void do_tab(void);
395void do_enter(void);
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000396#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000397void do_mark(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000398#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000399void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000400void signal_init(void);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000401void handle_hupterm(int signal);
402void do_suspend(int signal);
403void do_cont(int signal);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000404#ifndef NANO_SMALL
405void handle_sigwinch(int s);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000406void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000407#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000408#ifndef NANO_SMALL
409void do_toggle(const toggle *which);
410#endif
David Lawrence Ramsey8bcac8a2005-06-09 04:02:57 +0000411void disable_extended_io(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000412void disable_signals(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000413#ifndef NANO_SMALL
414void enable_signals(void);
415#endif
416void disable_flow_control(void);
417void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000418void terminal_init(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000419int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000420 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000421#ifndef DISABLE_MOUSE
422bool do_mouse(void);
423#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000424void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000425
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000426/* Public functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000427#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000428void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000429char *parse_next_word(char *ptr);
430char *parse_argument(char *ptr);
431#ifdef ENABLE_COLOR
David Lawrence Ramsey150d8892005-07-24 20:23:40 +0000432short color_to_short(const char *colorname, bool *bright);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000433char *parse_next_regex(char *ptr);
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000434bool nregcomp(regex_t *preg, const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000435void parse_syntax(char *ptr);
David Lawrence Ramsey23555f22005-06-27 03:07:10 +0000436void parse_colors(char *ptr, bool icase);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000437#endif /* ENABLE_COLOR */
438void parse_rcfile(FILE *rcstream);
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000439void do_rcfile(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000440#endif /* ENABLE_NANORC */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000441
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000442/* Public functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000443#ifdef HAVE_REGEX_H
Chris Allegretta5d715142003-01-29 04:18:37 +0000444int regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000445void regexp_cleanup(void);
446#endif
447void not_found_msg(const char *str);
448void search_abort(void);
449void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000450int search_init(bool replacing, bool use_answer);
David Lawrence Ramseyc5100422004-08-27 20:28:34 +0000451bool findnextstr(bool can_display_wrap, bool wholeword, bool
David Lawrence Ramsey5128de82005-07-12 17:40:16 +0000452 no_sameline, const filestruct *begin, size_t begin_x, const char
David Lawrence Ramsey77b284a2004-10-27 02:21:01 +0000453 *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000454void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000455void do_search(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000456#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000457void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000458#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000459void replace_abort(void);
460#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000461int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000462#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000463char *replace_line(const char *needle);
David Lawrence Ramsey182b2c92004-11-03 16:02:41 +0000464ssize_t do_replace_loop(const char *needle, const filestruct
465 *real_current, size_t *real_current_x, bool wholewords, bool
466 *canceled);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000467void do_replace(void);
David Lawrence Ramsey5beae582005-06-29 00:17:18 +0000468void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
David Lawrence Ramsey8f1afee2005-07-16 07:06:36 +0000469 bool interactive, bool save_pos, bool allow_update);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000470void do_gotolinecolumn_void(void);
David Lawrence Ramsey8f4762a2005-07-16 22:35:11 +0000471#ifndef DISABLE_SPELLER
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000472void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
473 pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000474#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000475#ifndef NANO_SMALL
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000476#ifdef HAVE_REGEX_H
477void do_find_bracket(void);
478#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000479#ifdef ENABLE_NANORC
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000480bool history_has_changed(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000481#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000482void history_init(void);
David Lawrence Ramsey0e581b32005-07-18 07:48:50 +0000483void history_reset(const filestruct *h);
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000484filestruct *find_history(const filestruct *h_start, const filestruct
485 *h_end, const char *s, size_t len);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000486void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000487char *get_history_older(filestruct **h);
488char *get_history_newer(filestruct **h);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000489#ifndef DISABLE_TABCOMP
David Lawrence Ramsey96e6d562005-07-19 04:53:45 +0000490char *get_history_completion(filestruct **h, const char *s, size_t len);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000491#endif
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000492#endif /* !NANO_SMALL */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000493
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000494/* Public functions in text.c. */
495#ifndef NANO_SMALL
496void cancel_command(int signal);
497bool execute_command(const char *command);
498#endif
499#ifndef DISABLE_WRAPPING
500void wrap_reset(void);
501bool do_wrap(filestruct *line);
502#endif
503#ifndef DISABLE_SPELLER
504bool do_int_spell_fix(const char *word);
505const char *do_int_speller(const char *tempfile_name);
506const char *do_alt_speller(char *tempfile_name);
507void do_spell(void);
508#endif
509#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
510ssize_t break_line(const char *line, ssize_t goal, bool newline);
511#endif
512#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
513size_t indent_length(const char *line);
514#endif
515#ifndef DISABLE_JUSTIFY
516void justify_format(filestruct *paragraph, size_t skip);
517size_t quote_length(const char *line);
518bool quotes_match(const char *a_line, size_t a_quote, const char
519 *b_line);
520bool indents_match(const char *a_line, size_t a_indent, const char
521 *b_line, size_t b_indent);
522bool begpar(const filestruct *const foo);
523bool inpar(const filestruct *const foo);
524filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
525 quote_len);
526bool find_paragraph(size_t *const quote, size_t *const par);
527void do_justify(bool full_justify);
528void do_justify_void(void);
529void do_full_justify(void);
530#endif /* !DISABLE_JUSTIFY */
531#ifndef NANO_SMALL
532void do_word_count(void);
533#endif
534
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000535/* Public functions in utils.c. */
David Lawrence Ramseyc596c0c2005-04-19 16:32:08 +0000536int digits(size_t n);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000537void get_homedir(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000538bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000539bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6a0d5b82005-06-13 14:00:22 +0000540void align(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000541void null_at(char **data, size_t index);
542void unsunder(char *str, size_t true_len);
543void sunder(char *str);
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000544#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000545#ifndef HAVE_GETLINE
546ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
547#endif
548#ifndef HAVE_GETDELIM
549ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
550#endif
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000551#endif /* !NANO_SMALL && ENABLE_NANORC */
David Lawrence Ramsey691698a2005-07-24 19:57:51 +0000552#ifdef HAVE_REGEX_H
553#ifdef BROKEN_REGEXEC
554int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
555 regmatch_t pmatch[], int eflags);
556#endif
557int regexp_bol_or_eol(const regex_t *preg, const char *string);
558#endif
559bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000560const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000561 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000562void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000563void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000564void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000565char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000566char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000567char *mallocstrassn(char *dest, char *src);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000568void new_magicline(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000569#ifndef NANO_SMALL
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000570void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000571void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000572 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000573#endif
David Lawrence Ramseyc104ef12005-07-17 01:44:35 +0000574size_t get_totsize(const filestruct *begin, const filestruct *end);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000575
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000576/* Public functions in winio.c. */
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000577#ifndef NANO_SMALL
578void reset_kbinput(void);
579#endif
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000580void get_key_buffer(WINDOW *win);
581size_t get_key_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000582void unget_input(int *input, size_t input_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000583void unget_kbinput(int kbinput, bool meta_key, bool func_key);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000584int *get_input(WINDOW *win, size_t input_len);
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000585int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000586int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000587#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000588 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000589#endif
590 );
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000591int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000592 *ignore_seq);
593int get_escape_seq_abcd(int kbinput);
David Lawrence Ramseyf0a53f02005-01-03 19:56:56 +0000594int get_byte_kbinput(int kbinput
595#ifndef NANO_SMALL
596 , bool reset
597#endif
598 );
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000599int get_word_kbinput(int kbinput
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000600#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000601 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000602#endif
603 );
604int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000605void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000606int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
607int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000608#ifndef DISABLE_MOUSE
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000609bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
610#endif
David Lawrence Ramsey1483ee32004-11-29 00:30:07 +0000611const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000612 *meta_key, bool *func_key);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000613#ifndef NANO_SMALL
614const toggle *get_toggle(int kbinput, bool meta_key);
615#endif
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000616int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000617 bool *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000618#ifndef DISABLE_MOUSE
619bool do_statusbar_mouse(void);
620#endif
621void do_statusbar_home(void);
622void do_statusbar_end(void);
623void do_statusbar_right(void);
624void do_statusbar_left(void);
625void do_statusbar_backspace(void);
626void do_statusbar_delete(void);
627void do_statusbar_cut_text(void);
David Lawrence Ramseyb80077d2005-01-18 21:25:38 +0000628#ifndef NANO_SMALL
David Lawrence Ramseya8824a12005-06-26 19:03:48 +0000629bool do_statusbar_next_word(bool allow_punct);
630bool do_statusbar_prev_word(bool allow_punct);
David Lawrence Ramseyb80077d2005-01-18 21:25:38 +0000631#endif
David Lawrence Ramseyd9ad76b2005-01-02 22:35:31 +0000632void do_statusbar_verbatim_input(bool *got_enter);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000633void do_statusbar_output(char *output, size_t output_len, bool
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000634 *got_enter, bool allow_cntrls);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000635size_t xplustabs(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000636size_t actual_x(const char *str, size_t xplus);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000637size_t strnlenpt(const char *buf, size_t size);
638size_t strlenpt(const char *buf);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000639void blank_line(WINDOW *win, int y, int x, int n);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000640void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000641void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000642void blank_edit(void);
643void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000644void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000645void check_statusblank(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000646char *display_string(const char *buf, size_t start_col, size_t len, bool
647 dollars);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000648void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000649int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000650#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000651 filestruct **history_list,
Chris Allegretta5beed502003-01-05 20:41:21 +0000652#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000653 const shortcut *s
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000654#ifndef DISABLE_TABCOMP
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000655 , bool *list
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000656#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000657 );
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000658int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000659#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000660 filestruct **history_list,
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000661#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000662 const char *msg, ...);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000663void statusq_abort(void);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000664void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000665void set_modified(void);
666void statusbar(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000667void bottombars(const shortcut *s);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000668void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramsey2dd7ed12003-09-29 05:15:24 +0000669size_t get_page_start(size_t column);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000670void reset_cursor(void);
David Lawrence Ramsey07d3feb2004-04-16 05:15:11 +0000671void edit_add(const filestruct *fileptr, const char *converted, int
672 yval, size_t start);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000673void update_line(const filestruct *fileptr, size_t index);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000674int need_horizontal_update(size_t old_pww);
675int need_vertical_update(size_t old_pww);
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000676void edit_scroll(updown direction, int nlines);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000677void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000678void edit_refresh(void);
David Lawrence Ramsey5b44f372005-07-16 22:47:12 +0000679void edit_update(centernone location);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000680int do_yesno(bool all, const char *msg);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000681void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000682void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000683void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000684void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000685void do_cursorpos_void(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000686#ifndef DISABLE_HELP
David Lawrence Ramsey9bd56202005-03-18 21:29:33 +0000687size_t help_line_len(const char *ptr);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000688void do_help(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000689#endif
David Lawrence Ramsey7bde0532005-06-30 03:55:55 +0000690void do_replace_highlight(bool highlight, const char *word);
David Lawrence Ramseycc814362005-06-05 19:08:59 +0000691#ifndef NDEBUG
692int check_linenumbers(const filestruct *fileptr);
693#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000694#ifdef DEBUG
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000695void dump_filestruct(const filestruct *inptr);
696void dump_filestruct_reverse(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000697#endif
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000698#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000699void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000700#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000701
702#endif /* !PROTO_H */