blob: dc408f4102521d6af0b2dc74dcf742d7da529571 [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
David Lawrence Ramseyfd3039a2004-07-17 19:49:12 +000028#include <sys/types.h>
David Lawrence Ramsey84d0d592004-11-04 03:53:11 +000029#include <sys/stat.h>
David Lawrence Ramsey7d367712005-02-14 05:00:15 +000030#include <dirent.h>
Chris Allegretta805c26d2000-09-06 13:39:17 +000031#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +000032#include <regex.h>
Chris Allegretta805c26d2000-09-06 13:39:17 +000033#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000034#include "nano.h"
35
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000036#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000037extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000038#endif
Chris Allegretta17dcb722001-01-20 21:40:07 +000039extern int editwinrows;
David Lawrence Ramsey7a97e182004-10-30 01:03:15 +000040extern size_t current_x;
41extern int current_y;
42extern int totlines;
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +000043extern size_t placewewant;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000044#ifndef NANO_SMALL
David Lawrence Ramsey687776b2004-10-30 01:16:08 +000045extern size_t mark_beginx;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000046#endif
David Lawrence Ramsey23c44502005-01-27 20:49:07 +000047extern size_t totsize;
48extern unsigned long flags;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000049extern ssize_t tabsize;
Chris Allegretta6b58acd2001-04-12 03:01:53 +000050extern int currslen;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000051
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000052#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
53extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000054extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000055#endif
56
Chris Allegrettae4f940d2002-03-03 22:36:36 +000057#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000058extern char *punct;
59extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000060extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000061#ifdef HAVE_REGEX_H
62extern regex_t quotereg;
63extern int quoterc;
64extern char *quoteerr;
65#else
66extern size_t quotelen;
67#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000068#endif
69
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000070#ifndef NANO_SMALL
71extern char *backup_dir;
72#endif
73
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +000074extern WINDOW *topwin, *edit, *bottomwin;
Chris Allegretta1a6e9042000-12-14 13:56:28 +000075extern char *filename;
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000076extern struct stat originalfilestat;
Chris Allegretta31925e42000-11-02 04:40:39 +000077extern char *answer;
Chris Allegretta6df90f52002-07-19 01:08:59 +000078extern char *hblank;
79#ifndef DISABLE_HELP
80extern char *help_text;
81#endif
Chris Allegretta27eb13f2000-11-05 16:52:21 +000082extern char *last_search;
83extern char *last_replace;
Chris Allegrettae1f14522001-09-19 03:19:43 +000084#ifndef DISABLE_OPERATINGDIR
85extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000086extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000087#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +000088#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000089extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000090#endif
91
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000092extern struct stat fileinfo;
David Lawrence Ramseyb9775152004-03-19 02:15:42 +000093extern filestruct *current, *fileage, *edittop, *filebot;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000094extern filestruct *cutbuffer;
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000095#ifndef DISABLE_JUSTIFY
96extern filestruct *jusbuffer;
97#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000098extern partition *filepart;
David Lawrence Ramseyb73c0c02004-11-05 15:25:53 +000099#ifndef NANO_SMALL
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000100extern filestruct *mark_beginbuf;
101#endif
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000102
Chris Allegretta355fbe52001-07-14 19:32:47 +0000103#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000104extern openfilestruct *open_files;
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000105#endif
106
Chris Allegretta08893e02001-11-29 02:42:27 +0000107#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000108extern const colortype *colorstrings;
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000109extern syntaxtype *syntaxes;
Chris Allegretta09900ff2002-05-04 04:23:30 +0000110extern char *syntaxstr;
Chris Allegretta08893e02001-11-29 02:42:27 +0000111#endif
112
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000113extern shortcut *shortcut_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000114extern shortcut *main_list, *whereis_list;
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000115extern shortcut *replace_list, *gotoline_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000116extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000117extern shortcut *replace_list_2;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000118#ifndef NANO_SMALL
119extern shortcut *extcmd_list;
120#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000121#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000122extern shortcut *help_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000123#endif
124#ifndef DISABLE_SPELLER
125extern shortcut *spell_list;
126#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000127#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000128extern shortcut *browser_list, *gotodir_list;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000129#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000130
Chris Allegretta6df90f52002-07-19 01:08:59 +0000131extern const shortcut *currshortcut;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000132
133#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000134extern regex_t search_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000135extern regmatch_t regmatches[10];
Chris Allegretta3533a342002-03-24 23:19:32 +0000136#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000137extern regex_t syntaxfile_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000138extern regmatch_t synfilematches[1];
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000139#endif /* ENABLE_COLOR */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000140#endif /* HAVE_REGEX_H */
141
142#ifndef NANO_SMALL
143extern toggle *toggles;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000144#endif
145
Chris Allegretta5beed502003-01-05 20:41:21 +0000146#ifndef NANO_SMALL
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000147extern filestruct *search_history;
148extern filestruct *searchage;
149extern filestruct *searchbot;
150extern filestruct *replace_history;
151extern filestruct *replaceage;
152extern filestruct *replacebot;
Chris Allegretta5beed502003-01-05 20:41:21 +0000153#endif
154
David Lawrence Ramsey76356bd2004-08-12 04:30:22 +0000155extern bool curses_ended;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000156
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000157extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000158
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +0000159/* The functions we want available. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000160
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000161/* Public functions in chars.c. */
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000162#ifndef HAVE_ISBLANK
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000163int nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000164#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000165#if defined(NANO_WIDE) && !defined(HAVE_ISWBLANK)
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000166int niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000167#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000168bool is_byte(int c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000169bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000170bool is_blank_mbchar(const char *c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000171bool is_cntrl_char(int c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000172#ifdef NANO_WIDE
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000173bool is_cntrl_wchar(wchar_t wc);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000174#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000175bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000176bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000177bool is_word_mbchar(const char *c, bool allow_punct);
David Lawrence Ramsey19462612005-06-12 18:05:42 +0000178char control_rep(char c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000179#ifdef NANO_WIDE
180wchar_t control_wrep(wchar_t c);
181#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000182char *control_mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000183int mbwidth(const char *c);
184int mb_cur_max(void);
David Lawrence Ramseyf0195a82005-03-14 18:47:21 +0000185char *make_mbchar(int chr, int *chr_mb_len);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000186int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
187 *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000188size_t move_mbleft(const char *buf, size_t pos);
189size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000190#ifndef HAVE_STRCASECMP
191int nstrcasecmp(const char *s1, const char *s2);
192#endif
193int mbstrcasecmp(const char *s1, const char *s2);
194#ifndef HAVE_STRNCASECMP
195int nstrncasecmp(const char *s1, const char *s2, size_t n);
196#endif
197int mbstrncasecmp(const char *s1, const char *s2, size_t n);
198#ifndef HAVE_STRCASESTR
199const char *nstrcasestr(const char *haystack, const char *needle);
200#endif
David Lawrence Ramsey42abfe02005-01-22 18:24:16 +0000201const char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000202#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000203const char *revstrstr(const char *haystack, const char *needle, const
204 char *rev_start);
David Lawrence Ramsey7b601fd2005-06-13 13:25:36 +0000205#endif
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000206#ifndef NANO_SMALL
David Lawrence Ramsey3ee4cf32005-01-22 20:49:14 +0000207const char *revstrcasestr(const char *haystack, const char *needle,
208 const char *rev_start);
David Lawrence Ramsey345260c2005-01-24 01:14:17 +0000209const char *mbrevstrcasestr(const char *haystack, const char *needle,
210 const char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000211#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000212size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000213#ifndef HAVE_STRNLEN
214size_t nstrnlen(const char *s, size_t maxlen);
215#endif
216size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000217#ifndef DISABLE_JUSTIFY
David Lawrence Ramseyd5d4dde2005-06-14 01:55:56 +0000218#ifdef ENABLE_NANORC
219bool has_blank_chars(const char *s);
220bool has_blank_mbchars(const char *s);
221#endif
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000222char *mbstrchr(const char *s, char *c);
223#endif
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000224#ifdef ENABLE_NANORC
225bool is_valid_mbstring(const char *s);
226#endif
227#ifdef NANO_EXTRA
228char *make_valid_mbstring(const char *s);
229#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000230
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000231/* Public functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000232#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000233void set_colorpairs(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000234void do_colorinit(void);
235void update_color(void);
236#endif /* ENABLE_COLOR */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000237
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000238/* Public functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000239void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000240void cut_line(void);
David Lawrence Ramsey50af6ea2004-11-07 15:29:40 +0000241#ifndef NANO_SMALL
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000242void cut_marked(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000243void cut_to_eol(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000244#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000245void do_cut_text(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000246#ifndef NANO_SMALL
247void do_cut_till_end(void);
248#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000249void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000250
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000251/* Public functions in files.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000252void new_file(void);
David Lawrence Ramsey50995bd2005-05-16 20:13:09 +0000253filestruct *read_line(char *buf, filestruct *prevnode, bool
David Lawrence Ramsey483f3ac2005-06-19 19:57:13 +0000254 *first_line_ins, size_t buf_len);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000255void load_file(void);
256void read_file(FILE *f, const char *filename);
257int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000258char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000259#ifndef NANO_SMALL
260void execute_command(const char *command);
261#endif
262void load_buffer(const char *name);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000263void do_insertfile(
264#ifndef NANO_SMALL
265 bool execute
266#else
267 void
268#endif
269 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000270void do_insertfile_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000271#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000272openfilestruct *make_new_opennode(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000273void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
274 openfilestruct *end);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000275void unlink_opennode(openfilestruct *fileptr);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000276void delete_opennode(openfilestruct *fileptr);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000277#ifdef DEBUG
Chris Allegretta6df90f52002-07-19 01:08:59 +0000278void free_openfilestruct(openfilestruct *src);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000279#endif
David Lawrence Ramsey3e189a82004-10-03 19:18:48 +0000280void add_open_file(bool update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000281void load_open_file(void);
David Lawrence Ramseyd26f1eb2005-06-15 03:01:41 +0000282void open_prevnext_file(bool next_file);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000283void open_prevfile_void(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000284void open_nextfile_void(void);
David Lawrence Ramsey3e189a82004-10-03 19:18:48 +0000285bool close_open_file(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000286#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000287char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000288char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000289char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000290#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000291void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000292bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000293#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000294#ifndef NANO_SMALL
295void init_backup_dir(void);
296#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000297int copy_file(FILE *inn, FILE *out);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000298int write_file(const char *name, FILE *f_open, bool tmp, int append,
299 bool nonamechange);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000300#ifndef NANO_SMALL
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000301int write_marked(const char *name, FILE *f_open, bool tmp, int append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000302#endif
David Lawrence Ramsey951d7142004-10-04 15:23:47 +0000303int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000304void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000305char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000306#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
307int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000308void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000309#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000310#ifndef DISABLE_TABCOMP
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000311char **username_tab_completion(const char *buf, size_t *num_matches,
312 size_t buflen);
313char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
314 buflen);
315char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000316#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000317const char *tail(const char *foo);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000318#ifndef DISABLE_BROWSER
David Lawrence Ramsey7d367712005-02-14 05:00:15 +0000319void striponedir(char *path);
320char **browser_init(const char *path, int *longest, size_t *numents, DIR
321 *dir);
322char *do_browser(char *path, DIR *dir);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000323char *do_browse_from(const char *inpath);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000324#endif
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000325#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000326char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000327void load_history(void);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000328bool writehist(FILE *hist, filestruct *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000329void save_history(void);
330#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000331
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000332/* Public functions in global.c. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000333size_t length_of_list(const shortcut *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000334#ifndef NANO_SMALL
David Lawrence Ramsey2ad32092004-07-07 14:36:44 +0000335void toggle_init_one(int val, const char *desc, long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000336void toggle_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000337#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000338void sc_init_one(shortcut **shortcutage, int key, const char *desc,
339#ifndef DISABLE_HELP
340 const char *help,
341#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000342 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000343 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000344void shortcut_init(bool unjustify);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000345void free_shortcutage(shortcut **shortcutage);
Chris Allegretta6232d662002-05-12 19:52:15 +0000346#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000347void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000348#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000349
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000350/* Public functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000351void do_first_line(void);
352void do_last_line(void);
353void do_home(void);
354void do_end(void);
355void do_page_up(void);
356void do_page_down(void);
357void do_up(void);
358void do_down(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000359void do_left(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000360void do_left_void(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000361void do_right(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000362void do_right_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000363
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000364/* Public functions in nano.c. */
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000365void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000366void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000367void die(const char *msg, ...);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000368void die_save_file(const char *die_filename);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000369void check_die_too_small(void);
370void resize_variables(void);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000371void global_init(bool save_cutbuffer);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000372void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000373#ifndef DISABLE_MOUSE
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000374void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000375#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000376#ifndef DISABLE_HELP
377void help_init(void);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000378#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000379filestruct *make_new_node(filestruct *prevnode);
380filestruct *copy_node(const filestruct *src);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000381void splice_node(filestruct *begin, filestruct *newnode, filestruct
382 *end);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000383void unlink_node(const filestruct *fileptr);
384void delete_node(filestruct *fileptr);
385filestruct *copy_filestruct(const filestruct *src);
386void free_filestruct(filestruct *src);
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000387partition *partition_filestruct(filestruct *top, size_t top_x,
388 filestruct *bot, size_t bot_x);
David Lawrence Ramsey74d87072004-11-22 00:16:23 +0000389void unpartition_filestruct(partition **p);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000390void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
391 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
392void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000393void renumber_all(void);
394void renumber(filestruct *fileptr);
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000395void print1opt_full(const char *shortflag
396#ifdef HAVE_GETOPT_LONG
397 , const char *longflag
398#endif
399 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000400void usage(void);
401void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000402int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000403int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000404void nano_disabled_msg(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000405#ifndef NANO_SMALL
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000406void cancel_fork(int signal);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000407bool open_pipe(const char *command);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000408#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000409void do_verbatim_input(void);
410void do_backspace(void);
411void do_delete(void);
412void do_tab(void);
413void do_enter(void);
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000414#ifndef NANO_SMALL
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000415bool do_next_word(bool allow_update);
416void do_next_word_void(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000417void do_prev_word(void);
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000418void do_word_count(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000419void do_mark(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000420#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000421#ifndef DISABLE_WRAPPING
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000422void wrap_reset(void);
David Lawrence Ramsey40e211b2005-03-19 21:15:30 +0000423bool do_wrap(filestruct *line);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000424#endif
425#ifndef DISABLE_SPELLER
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000426bool do_int_spell_fix(const char *word);
427const char *do_int_speller(const char *tempfile_name);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000428const char *do_alt_speller(char *tempfile_name);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000429void do_spell(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000430#endif
David Lawrence Ramsey40e211b2005-03-19 21:15:30 +0000431#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
432ssize_t break_line(const char *line, ssize_t goal, bool newline);
David Lawrence Ramsey9bd56202005-03-18 21:29:33 +0000433#endif
David Lawrence Ramseybb50b302004-08-12 21:43:00 +0000434#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000435size_t indent_length(const char *line);
436#endif
437#ifndef DISABLE_JUSTIFY
David Lawrence Ramseye9ac1d72005-03-13 03:28:37 +0000438void justify_format(filestruct *paragraph, size_t skip);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000439size_t quote_length(const char *line);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000440bool quotes_match(const char *a_line, size_t a_quote, const char
441 *b_line);
442bool indents_match(const char *a_line, size_t a_indent, const char
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000443 *b_line, size_t b_indent);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000444bool begpar(const filestruct *const foo);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000445void do_para_begin(bool allow_update);
446void do_para_begin_void(void);
447bool inpar(const filestruct *const foo);
448void do_para_end(bool allow_update);
449void do_para_end_void(void);
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000450filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
451 quote_len);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000452bool find_paragraph(size_t *const quote, size_t *const par);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000453void do_justify(bool full_justify);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000454void do_justify_void(void);
455void do_full_justify(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000456#endif /* !DISABLE_JUSTIFY */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000457void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000458void signal_init(void);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000459void handle_hupterm(int signal);
460void do_suspend(int signal);
461void do_cont(int signal);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000462#ifndef NANO_SMALL
463void handle_sigwinch(int s);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000464void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000465#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000466#ifndef NANO_SMALL
467void do_toggle(const toggle *which);
468#endif
David Lawrence Ramsey8bcac8a2005-06-09 04:02:57 +0000469void disable_extended_io(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000470void disable_signals(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000471#ifndef NANO_SMALL
472void enable_signals(void);
473#endif
474void disable_flow_control(void);
475void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000476void terminal_init(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000477int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000478 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000479#ifndef DISABLE_MOUSE
480bool do_mouse(void);
481#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000482void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000483
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000484/* Public functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000485#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000486void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000487char *parse_next_word(char *ptr);
488char *parse_argument(char *ptr);
489#ifdef ENABLE_COLOR
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000490int color_to_int(const char *colorname, bool *bright);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000491char *parse_next_regex(char *ptr);
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000492bool nregcomp(regex_t *preg, const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000493void parse_syntax(char *ptr);
494void parse_colors(char *ptr);
495#endif /* ENABLE_COLOR */
496void parse_rcfile(FILE *rcstream);
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000497void do_rcfile(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000498#endif /* ENABLE_NANORC */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000499
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000500/* Public functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000501#ifdef HAVE_REGEX_H
Chris Allegretta5d715142003-01-29 04:18:37 +0000502int regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000503void regexp_cleanup(void);
504#endif
505void not_found_msg(const char *str);
506void search_abort(void);
507void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000508int search_init(bool replacing, bool use_answer);
David Lawrence Ramseye1c16b32005-02-12 23:09:27 +0000509bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseyc5100422004-08-27 20:28:34 +0000510bool findnextstr(bool can_display_wrap, bool wholeword, bool
511 no_sameline, const filestruct *begin, size_t beginx, const char
David Lawrence Ramsey77b284a2004-10-27 02:21:01 +0000512 *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000513void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000514void do_search(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000515#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000516void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000517#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000518void replace_abort(void);
519#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000520int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000521#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000522char *replace_line(const char *needle);
David Lawrence Ramsey182b2c92004-11-03 16:02:41 +0000523ssize_t do_replace_loop(const char *needle, const filestruct
524 *real_current, size_t *real_current_x, bool wholewords, bool
525 *canceled);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000526void do_replace(void);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000527void do_gotolinecolumn(int line, ssize_t column, bool use_answer, bool
528 interactive, bool save_pos);
529void do_gotolinecolumn_void(void);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000530#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
David Lawrence Ramsey7a97e182004-10-30 01:03:15 +0000531void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000532#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000533#ifndef NANO_SMALL
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000534#ifdef HAVE_REGEX_H
535void do_find_bracket(void);
536#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000537#ifdef ENABLE_NANORC
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000538bool history_has_changed(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000539#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000540void history_init(void);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000541filestruct *find_history(filestruct *h_start, filestruct *h_end, const
542 char *s, size_t len);
543void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000544char *get_history_older(filestruct **h);
545char *get_history_newer(filestruct **h);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000546#ifndef DISABLE_TABCOMP
547char *get_history_completion(filestruct **h, char *s, size_t len);
548#endif
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000549#endif /* !NANO_SMALL */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000550
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000551/* Public functions in utils.c. */
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000552#ifdef HAVE_REGEX_H
Chris Allegrettad8451932003-03-11 03:50:40 +0000553#ifdef BROKEN_REGEXEC
David Lawrence Ramseyafbcf682005-03-21 06:33:41 +0000554int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
Chris Allegrettad8451932003-03-11 03:50:40 +0000555 regmatch_t pmatch[], int eflags);
556#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000557int regexp_bol_or_eol(const regex_t *preg, const char *string);
558#endif
David Lawrence Ramseyc596c0c2005-04-19 16:32:08 +0000559int digits(size_t n);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000560void get_homedir(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000561bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramseyc5659d32005-05-17 00:25:50 +0000562bool parse_line_column(const char *str, int *line, ssize_t *column);
David Lawrence Ramsey6a0d5b82005-06-13 14:00:22 +0000563void align(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000564void null_at(char **data, size_t index);
565void unsunder(char *str, size_t true_len);
566void sunder(char *str);
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000567#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000568#ifndef HAVE_GETLINE
569ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
570#endif
571#ifndef HAVE_GETDELIM
572ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
573#endif
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000574#endif /* !NANO_SMALL && ENABLE_NANORC */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000575const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000576 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000577void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000578void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000579void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000580char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000581char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000582char *mallocstrassn(char *dest, char *src);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000583void new_magicline(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000584#ifndef NANO_SMALL
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000585void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000586void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000587 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000588#endif
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000589void get_totals(const filestruct *begin, const filestruct *end, int
David Lawrence Ramsey23c44502005-01-27 20:49:07 +0000590 *lines, size_t *size);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000591
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000592/* Public functions in winio.c. */
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000593#ifndef NANO_SMALL
594void reset_kbinput(void);
595#endif
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000596void get_buffer(WINDOW *win);
597size_t get_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000598void unget_input(int *input, size_t input_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000599void unget_kbinput(int kbinput, bool meta_key, bool func_key);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000600int *get_input(WINDOW *win, size_t input_len);
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000601int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000602int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000603#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000604 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000605#endif
606 );
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000607int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000608 *ignore_seq);
609int get_escape_seq_abcd(int kbinput);
David Lawrence Ramseyf0a53f02005-01-03 19:56:56 +0000610int get_byte_kbinput(int kbinput
611#ifndef NANO_SMALL
612 , bool reset
613#endif
614 );
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000615int get_word_kbinput(int kbinput
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000616#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000617 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000618#endif
619 );
620int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000621void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000622int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
623int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000624#ifndef DISABLE_MOUSE
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000625bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
626#endif
David Lawrence Ramsey1483ee32004-11-29 00:30:07 +0000627const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000628 *meta_key, bool *func_key);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000629#ifndef NANO_SMALL
630const toggle *get_toggle(int kbinput, bool meta_key);
631#endif
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000632int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000633 bool *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000634#ifndef DISABLE_MOUSE
635bool do_statusbar_mouse(void);
636#endif
637void do_statusbar_home(void);
638void do_statusbar_end(void);
639void do_statusbar_right(void);
640void do_statusbar_left(void);
641void do_statusbar_backspace(void);
642void do_statusbar_delete(void);
643void do_statusbar_cut_text(void);
David Lawrence Ramseyb80077d2005-01-18 21:25:38 +0000644#ifndef NANO_SMALL
645void do_statusbar_next_word(void);
646void do_statusbar_prev_word(void);
647#endif
David Lawrence Ramseyd9ad76b2005-01-02 22:35:31 +0000648void do_statusbar_verbatim_input(bool *got_enter);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000649void do_statusbar_output(char *output, size_t output_len, bool
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000650 *got_enter, bool allow_cntrls);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000651size_t xplustabs(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000652size_t actual_x(const char *str, size_t xplus);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000653size_t strnlenpt(const char *buf, size_t size);
654size_t strlenpt(const char *buf);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000655void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000656void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000657void blank_edit(void);
658void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000659void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000660void check_statusblank(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000661char *display_string(const char *buf, size_t start_col, size_t len, bool
662 dollars);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000663void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000664int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000665#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000666 filestruct **history_list,
Chris Allegretta5beed502003-01-05 20:41:21 +0000667#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000668 const shortcut *s
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000669#ifndef DISABLE_TABCOMP
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000670 , bool *list
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000671#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000672 );
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000673int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000674#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000675 filestruct **history_list,
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000676#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000677 const char *msg, ...);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000678void statusq_abort(void);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000679void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000680void set_modified(void);
681void statusbar(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000682void bottombars(const shortcut *s);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000683void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramsey2dd7ed12003-09-29 05:15:24 +0000684size_t get_page_start(size_t column);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000685void reset_cursor(void);
David Lawrence Ramsey07d3feb2004-04-16 05:15:11 +0000686void edit_add(const filestruct *fileptr, const char *converted, int
687 yval, size_t start);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000688void update_line(const filestruct *fileptr, size_t index);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000689int need_horizontal_update(size_t old_pww);
690int need_vertical_update(size_t old_pww);
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000691void edit_scroll(updown direction, int nlines);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000692void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000693void edit_refresh(void);
David Lawrence Ramsey20b83502004-08-26 18:07:58 +0000694void edit_update(topmidnone location);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000695int do_yesno(bool all, const char *msg);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000696void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000697void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000698void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000699void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000700void do_cursorpos_void(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000701#ifndef DISABLE_HELP
David Lawrence Ramsey9bd56202005-03-18 21:29:33 +0000702size_t help_line_len(const char *ptr);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000703void do_help(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000704#endif
David Lawrence Ramsey423326f2005-01-03 19:14:39 +0000705void do_replace_highlight(bool highlight_flag, const char *word);
David Lawrence Ramseycc814362005-06-05 19:08:59 +0000706#ifndef NDEBUG
707int check_linenumbers(const filestruct *fileptr);
708#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000709#ifdef DEBUG
710void dump_buffer(const filestruct *inptr);
711void dump_buffer_reverse(void);
712#endif
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000713#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000714void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000715#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000716
717#endif /* !PROTO_H */