blob: e8a5c609d2270104f847b61a1e020a12228cd8fe [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 Ramseydb958022005-07-13 20:18:46 +000040extern long flags;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000041extern ssize_t tabsize;
Chris Allegretta6b58acd2001-04-12 03:01:53 +000042extern int currslen;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000043
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000044#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
45extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000046extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000047#endif
48
Chris Allegrettae4f940d2002-03-03 22:36:36 +000049#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000050extern char *punct;
51extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000052extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000053#ifdef HAVE_REGEX_H
54extern regex_t quotereg;
55extern int quoterc;
56extern char *quoteerr;
57#else
58extern size_t quotelen;
59#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000060#endif
61
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000062#ifndef NANO_SMALL
63extern char *backup_dir;
64#endif
65
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +000066extern WINDOW *topwin, *edit, *bottomwin;
Chris Allegretta31925e42000-11-02 04:40:39 +000067extern char *answer;
Chris Allegretta6df90f52002-07-19 01:08:59 +000068#ifndef DISABLE_HELP
69extern char *help_text;
70#endif
Chris Allegretta27eb13f2000-11-05 16:52:21 +000071extern char *last_search;
72extern char *last_replace;
Chris Allegrettae1f14522001-09-19 03:19:43 +000073#ifndef DISABLE_OPERATINGDIR
74extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000075extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000076#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +000077#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000078extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000079#endif
80
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000081extern struct stat fileinfo;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000082extern filestruct *cutbuffer;
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000083#ifndef DISABLE_JUSTIFY
84extern filestruct *jusbuffer;
85#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000086extern partition *filepart;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000087
David Lawrence Ramsey64661ac2005-07-08 19:57:25 +000088extern openfilestruct *openfile;
Chris Allegretta2d7893d2001-07-11 02:08:33 +000089
Chris Allegretta08893e02001-11-29 02:42:27 +000090#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +000091extern syntaxtype *syntaxes;
Chris Allegretta09900ff2002-05-04 04:23:30 +000092extern char *syntaxstr;
Chris Allegretta08893e02001-11-29 02:42:27 +000093#endif
94
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000095extern shortcut *shortcut_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000096extern shortcut *main_list, *whereis_list;
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +000097extern shortcut *replace_list, *gotoline_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +000098extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +000099extern shortcut *replace_list_2;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000100#ifndef NANO_SMALL
101extern shortcut *extcmd_list;
102#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000103#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000104extern shortcut *help_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000105#endif
106#ifndef DISABLE_SPELLER
107extern shortcut *spell_list;
108#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000109#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000110extern shortcut *browser_list, *gotodir_list;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000111#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000112
Chris Allegretta6df90f52002-07-19 01:08:59 +0000113extern const shortcut *currshortcut;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000114
115#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000116extern regex_t search_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000117extern regmatch_t regmatches[10];
Chris Allegretta3533a342002-03-24 23:19:32 +0000118#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000119extern regex_t syntaxfile_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000120extern regmatch_t synfilematches[1];
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000121#endif /* ENABLE_COLOR */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000122#endif /* HAVE_REGEX_H */
123
124#ifndef NANO_SMALL
125extern toggle *toggles;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000126#endif
127
Chris Allegretta5beed502003-01-05 20:41:21 +0000128#ifndef NANO_SMALL
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000129extern filestruct *search_history;
130extern filestruct *searchage;
131extern filestruct *searchbot;
132extern filestruct *replace_history;
133extern filestruct *replaceage;
134extern filestruct *replacebot;
Chris Allegretta5beed502003-01-05 20:41:21 +0000135#endif
136
David Lawrence Ramsey76356bd2004-08-12 04:30:22 +0000137extern bool curses_ended;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000138
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000139extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000140
David Lawrence Ramsey01e13ea2005-06-21 04:16:12 +0000141/* The functions we want available. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000142
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000143/* Public functions in chars.c. */
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000144#ifndef HAVE_ISBLANK
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000145bool nisblank(int c);
David Lawrence Ramsey77abec72005-03-16 17:00:27 +0000146#endif
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000147#if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8)
David Lawrence Ramsey1aee5cc2005-06-29 18:17:54 +0000148bool niswblank(wchar_t wc);
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000149#endif
David Lawrence Ramsey356d2482005-06-13 19:51:56 +0000150bool is_byte(int c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000151bool is_alnum_mbchar(const char *c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000152bool is_blank_mbchar(const char *c);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000153bool is_cntrl_char(int c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000154#ifdef ENABLE_UTF8
David Lawrence Ramseyed7ad332005-06-15 16:07:14 +0000155bool is_cntrl_wchar(wchar_t wc);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000156#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000157bool is_cntrl_mbchar(const char *c);
David Lawrence Ramsey2515ccc2005-06-15 06:04:08 +0000158bool is_punct_mbchar(const char *c);
David Lawrence Ramseye2213112005-06-15 03:03:45 +0000159bool is_word_mbchar(const char *c, bool allow_punct);
David Lawrence Ramsey19462612005-06-12 18:05:42 +0000160char control_rep(char c);
David Lawrence Ramsey7eb30a82005-07-17 02:40:07 +0000161#ifdef ENABLE_UTF8
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000162wchar_t control_wrep(wchar_t c);
163#endif
David Lawrence Ramseyd8640482005-06-12 17:48:46 +0000164char *control_mbrep(const char *c, char *crep, int *crep_len);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000165int mbwidth(const char *c);
166int mb_cur_max(void);
David Lawrence Ramseyf0195a82005-03-14 18:47:21 +0000167char *make_mbchar(int chr, int *chr_mb_len);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000168int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
169 *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000170size_t move_mbleft(const char *buf, size_t pos);
171size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000172#ifndef HAVE_STRCASECMP
173int nstrcasecmp(const char *s1, const char *s2);
174#endif
175int mbstrcasecmp(const char *s1, const char *s2);
176#ifndef HAVE_STRNCASECMP
177int nstrncasecmp(const char *s1, const char *s2, size_t n);
178#endif
179int mbstrncasecmp(const char *s1, const char *s2, size_t n);
180#ifndef HAVE_STRCASESTR
181const char *nstrcasestr(const char *haystack, const char *needle);
182#endif
David Lawrence Ramsey42abfe02005-01-22 18:24:16 +0000183const char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000184#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000185const char *revstrstr(const char *haystack, const char *needle, const
186 char *rev_start);
David Lawrence Ramsey7b601fd2005-06-13 13:25:36 +0000187#endif
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000188#ifndef NANO_SMALL
David Lawrence Ramsey3ee4cf32005-01-22 20:49:14 +0000189const char *revstrcasestr(const char *haystack, const char *needle,
190 const char *rev_start);
David Lawrence Ramsey345260c2005-01-24 01:14:17 +0000191const char *mbrevstrcasestr(const char *haystack, const char *needle,
192 const char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000193#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000194size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000195#ifndef HAVE_STRNLEN
196size_t nstrnlen(const char *s, size_t maxlen);
197#endif
198size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000199#ifndef DISABLE_JUSTIFY
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 +0000204char *mbstrchr(const char *s, char *c);
205#endif
David Lawrence Ramseybdfa9272005-06-14 23:36:13 +0000206#ifdef ENABLE_NANORC
207bool is_valid_mbstring(const char *s);
208#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000209
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000210/* Public functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000211#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000212void set_colorpairs(void);
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000213void color_init(void);
David Lawrence Ramsey43cf7a12005-07-14 18:31:45 +0000214void color_update(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000215#endif /* ENABLE_COLOR */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000216
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000217/* Public functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000218void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000219void cut_line(void);
David Lawrence Ramsey50af6ea2004-11-07 15:29:40 +0000220#ifndef NANO_SMALL
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000221void cut_marked(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000222void cut_to_eol(void);
David Lawrence Ramseyb80d49f2005-03-26 22:49:46 +0000223#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000224void do_cut_text(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000225#ifndef NANO_SMALL
226void do_cut_till_end(void);
227#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000228void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000229
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000230/* Public functions in files.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000231openfilestruct *make_new_opennode(void);
232void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
233 openfilestruct *end);
234void unlink_opennode(openfilestruct *fileptr);
235void delete_opennode(openfilestruct *fileptr);
236#ifdef DEBUG
237void free_openfilestruct(openfilestruct *src);
238#endif
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000239void make_new_buffer(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000240void initialize_buffer(void);
241#ifndef DISABLE_SPELLER
242void reinitialize_buffer(void);
243#endif
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000244void open_buffer(const char *filename);
David Lawrence Ramseye5c7e922005-07-12 23:06:22 +0000245void display_buffer(void);
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000246#ifdef ENABLE_MULTIBUFFER
247void switch_to_prevnext_buffer(bool next);
248void switch_to_prev_buffer_void(void);
249void switch_to_next_buffer_void(void);
250bool close_buffer(void);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000251#endif
David Lawrence Ramsey50995bd2005-05-16 20:13:09 +0000252filestruct *read_line(char *buf, filestruct *prevnode, bool
David Lawrence Ramsey483f3ac2005-06-19 19:57:13 +0000253 *first_line_ins, size_t buf_len);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000254void read_file(FILE *f, const char *filename);
255int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyb9b57222005-05-29 02:22:55 +0000256char *get_next_filename(const char *name, const char *suffix);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000257void do_insertfile(
258#ifndef NANO_SMALL
259 bool execute
260#else
261 void
262#endif
263 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000264void do_insertfile_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000265char *get_full_path(const char *origpath);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000266char *check_writable_directory(const char *path);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000267char *safe_tempfile(FILE **f);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000268#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000269void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000270bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000271#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000272#ifndef NANO_SMALL
273void init_backup_dir(void);
274#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000275int copy_file(FILE *inn, FILE *out);
David Lawrence Ramsey5e068c62005-05-31 04:28:15 +0000276int write_file(const char *name, FILE *f_open, bool tmp, int append,
277 bool nonamechange);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000278#ifndef NANO_SMALL
David Lawrence Ramsey222b2012005-07-12 20:09:24 +0000279int write_marked_file(const char *name, FILE *f_open, bool tmp, int
280 append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000281#endif
David Lawrence Ramsey951d7142004-10-04 15:23:47 +0000282int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000283void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000284char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000285#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
286int diralphasort(const void *va, const void *vb);
David Lawrence Ramseyab41ab92005-06-15 06:30:05 +0000287void free_chararray(char **array, size_t len);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000288#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000289#ifndef DISABLE_TABCOMP
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000290char **username_tab_completion(const char *buf, size_t *num_matches,
291 size_t buflen);
292char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
293 buflen);
294char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000295#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000296const char *tail(const char *foo);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000297#ifndef DISABLE_BROWSER
David Lawrence Ramsey7d367712005-02-14 05:00:15 +0000298void striponedir(char *path);
299char **browser_init(const char *path, int *longest, size_t *numents, DIR
300 *dir);
301char *do_browser(char *path, DIR *dir);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000302char *do_browse_from(const char *inpath);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000303#endif
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000304#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000305char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000306void load_history(void);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000307bool writehist(FILE *hist, filestruct *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000308void save_history(void);
309#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000310
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000311/* Public functions in global.c. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000312size_t length_of_list(const shortcut *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000313#ifndef NANO_SMALL
David Lawrence Ramsey2ad32092004-07-07 14:36:44 +0000314void toggle_init_one(int val, const char *desc, long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000315void toggle_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000316#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000317void sc_init_one(shortcut **shortcutage, int key, const char *desc,
318#ifndef DISABLE_HELP
319 const char *help,
320#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000321 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000322 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000323void shortcut_init(bool unjustify);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000324void free_shortcutage(shortcut **shortcutage);
Chris Allegretta6232d662002-05-12 19:52:15 +0000325#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000326void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000327#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000328
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000329/* Public functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000330void do_first_line(void);
331void do_last_line(void);
332void do_home(void);
333void do_end(void);
334void do_page_up(void);
335void do_page_down(void);
336void do_up(void);
337void do_down(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000338void do_left(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000339void do_left_void(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000340void do_right(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000341void do_right_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000342
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000343/* Public functions in nano.c. */
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000344filestruct *make_new_node(filestruct *prevnode);
345filestruct *copy_node(const filestruct *src);
346void splice_node(filestruct *begin, filestruct *newnode, filestruct
347 *end);
348void unlink_node(const filestruct *fileptr);
349void delete_node(filestruct *fileptr);
350filestruct *copy_filestruct(const filestruct *src);
351void free_filestruct(filestruct *src);
David Lawrence Ramsey90573292005-07-08 02:47:05 +0000352void renumber(filestruct *fileptr);
353partition *partition_filestruct(filestruct *top, size_t top_x,
354 filestruct *bot, size_t bot_x);
355void unpartition_filestruct(partition **p);
356void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
357 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
358void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000359void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000360void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000361void die(const char *msg, ...);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000362void die_save_file(const char *die_filename);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000363void check_die_too_small(void);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000364void window_size_init(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000365void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000366#ifndef DISABLE_MOUSE
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000367void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000368#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000369#ifndef DISABLE_HELP
370void help_init(void);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000371#endif
David Lawrence Ramsey39e8ce62005-03-21 07:24:47 +0000372void print1opt_full(const char *shortflag
373#ifdef HAVE_GETOPT_LONG
374 , const char *longflag
375#endif
376 , const char *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000377void usage(void);
378void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000379int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000380int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000381void nano_disabled_msg(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000382#ifndef NANO_SMALL
David Lawrence Ramsey56001842005-07-09 04:42:47 +0000383void cancel_command(int signal);
384bool execute_command(const char *command);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000385#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000386void do_verbatim_input(void);
387void do_backspace(void);
388void do_delete(void);
389void do_tab(void);
390void do_enter(void);
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000391#ifndef NANO_SMALL
David Lawrence Ramseya8824a12005-06-26 19:03:48 +0000392bool do_next_word(bool allow_punct, bool allow_update);
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000393void do_next_word_void(void);
David Lawrence Ramseya8824a12005-06-26 19:03:48 +0000394bool do_prev_word(bool allow_punct, bool allow_update);
395void do_prev_word_void(void);
David Lawrence Ramseye010edd2005-06-12 22:31:03 +0000396void do_word_count(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000397void do_mark(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000398#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000399#ifndef DISABLE_WRAPPING
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000400void wrap_reset(void);
David Lawrence Ramsey40e211b2005-03-19 21:15:30 +0000401bool do_wrap(filestruct *line);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000402#endif
403#ifndef DISABLE_SPELLER
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000404bool do_int_spell_fix(const char *word);
405const char *do_int_speller(const char *tempfile_name);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000406const char *do_alt_speller(char *tempfile_name);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000407void do_spell(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000408#endif
David Lawrence Ramsey40e211b2005-03-19 21:15:30 +0000409#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
410ssize_t break_line(const char *line, ssize_t goal, bool newline);
David Lawrence Ramsey9bd56202005-03-18 21:29:33 +0000411#endif
David Lawrence Ramseybb50b302004-08-12 21:43:00 +0000412#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000413size_t indent_length(const char *line);
414#endif
415#ifndef DISABLE_JUSTIFY
David Lawrence Ramseye9ac1d72005-03-13 03:28:37 +0000416void justify_format(filestruct *paragraph, size_t skip);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000417size_t quote_length(const char *line);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000418bool quotes_match(const char *a_line, size_t a_quote, const char
419 *b_line);
420bool indents_match(const char *a_line, size_t a_indent, const char
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000421 *b_line, size_t b_indent);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000422bool begpar(const filestruct *const foo);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000423void do_para_begin(bool allow_update);
424void do_para_begin_void(void);
425bool inpar(const filestruct *const foo);
426void do_para_end(bool allow_update);
427void do_para_end_void(void);
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000428filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
429 quote_len);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000430bool find_paragraph(size_t *const quote, size_t *const par);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000431void do_justify(bool full_justify);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000432void do_justify_void(void);
433void do_full_justify(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000434#endif /* !DISABLE_JUSTIFY */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000435void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000436void signal_init(void);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000437void handle_hupterm(int signal);
438void do_suspend(int signal);
439void do_cont(int signal);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000440#ifndef NANO_SMALL
441void handle_sigwinch(int s);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000442void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000443#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000444#ifndef NANO_SMALL
445void do_toggle(const toggle *which);
446#endif
David Lawrence Ramsey8bcac8a2005-06-09 04:02:57 +0000447void disable_extended_io(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000448void disable_signals(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000449#ifndef NANO_SMALL
450void enable_signals(void);
451#endif
452void disable_flow_control(void);
453void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000454void terminal_init(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000455int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000456 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000457#ifndef DISABLE_MOUSE
458bool do_mouse(void);
459#endif
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000460void do_output(char *output, size_t output_len, bool allow_cntrls);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000461
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000462/* Public functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000463#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000464void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000465char *parse_next_word(char *ptr);
466char *parse_argument(char *ptr);
467#ifdef ENABLE_COLOR
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000468int color_to_short(const char *colorname, bool *bright);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000469char *parse_next_regex(char *ptr);
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000470bool nregcomp(regex_t *preg, const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000471void parse_syntax(char *ptr);
David Lawrence Ramsey23555f22005-06-27 03:07:10 +0000472void parse_colors(char *ptr, bool icase);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000473#endif /* ENABLE_COLOR */
474void parse_rcfile(FILE *rcstream);
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000475void do_rcfile(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000476#endif /* ENABLE_NANORC */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000477
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000478/* Public functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000479#ifdef HAVE_REGEX_H
Chris Allegretta5d715142003-01-29 04:18:37 +0000480int regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000481void regexp_cleanup(void);
482#endif
483void not_found_msg(const char *str);
484void search_abort(void);
485void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000486int search_init(bool replacing, bool use_answer);
David Lawrence Ramseye1c16b32005-02-12 23:09:27 +0000487bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseyc5100422004-08-27 20:28:34 +0000488bool findnextstr(bool can_display_wrap, bool wholeword, bool
David Lawrence Ramsey5128de82005-07-12 17:40:16 +0000489 no_sameline, const filestruct *begin, size_t begin_x, const char
David Lawrence Ramsey77b284a2004-10-27 02:21:01 +0000490 *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000491void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000492void do_search(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000493#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000494void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000495#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000496void replace_abort(void);
497#ifdef HAVE_REGEX_H
David Lawrence Ramseye3970f52005-05-26 03:47:24 +0000498int replace_regexp(char *string, bool create);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000499#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000500char *replace_line(const char *needle);
David Lawrence Ramsey182b2c92004-11-03 16:02:41 +0000501ssize_t do_replace_loop(const char *needle, const filestruct
502 *real_current, size_t *real_current_x, bool wholewords, bool
503 *canceled);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000504void do_replace(void);
David Lawrence Ramsey5beae582005-06-29 00:17:18 +0000505void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
David Lawrence Ramsey8f1afee2005-07-16 07:06:36 +0000506 bool interactive, bool save_pos, bool allow_update);
David Lawrence Ramsey9245f972005-05-17 18:06:26 +0000507void do_gotolinecolumn_void(void);
David Lawrence Ramsey8f4762a2005-07-16 22:35:11 +0000508#ifndef DISABLE_SPELLER
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000509void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
510 pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000511#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000512#ifndef NANO_SMALL
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000513#ifdef HAVE_REGEX_H
514void do_find_bracket(void);
515#endif
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000516#ifdef ENABLE_NANORC
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000517bool history_has_changed(void);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000518#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000519void history_init(void);
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000520filestruct *find_history(filestruct *h_start, filestruct *h_end, const
521 char *s, size_t len);
522void update_history(filestruct **h, const char *s);
David Lawrence Ramsey934f9682005-05-23 16:30:06 +0000523char *get_history_older(filestruct **h);
524char *get_history_newer(filestruct **h);
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000525#ifndef DISABLE_TABCOMP
526char *get_history_completion(filestruct **h, char *s, size_t len);
527#endif
David Lawrence Ramseyc4ca5962005-06-16 20:58:19 +0000528#endif /* !NANO_SMALL */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000529
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000530/* Public functions in utils.c. */
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000531#ifdef HAVE_REGEX_H
Chris Allegrettad8451932003-03-11 03:50:40 +0000532#ifdef BROKEN_REGEXEC
David Lawrence Ramseyafbcf682005-03-21 06:33:41 +0000533int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
Chris Allegrettad8451932003-03-11 03:50:40 +0000534 regmatch_t pmatch[], int eflags);
535#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000536int regexp_bol_or_eol(const regex_t *preg, const char *string);
537#endif
David Lawrence Ramseyc596c0c2005-04-19 16:32:08 +0000538int digits(size_t n);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000539void get_homedir(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000540bool parse_num(const char *str, ssize_t *val);
David Lawrence Ramsey2cf6d712005-06-28 06:25:34 +0000541bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
David Lawrence Ramsey6a0d5b82005-06-13 14:00:22 +0000542void align(char **str);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000543void null_at(char **data, size_t index);
544void unsunder(char *str, size_t true_len);
545void sunder(char *str);
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000546#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000547#ifndef HAVE_GETLINE
548ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
549#endif
550#ifndef HAVE_GETDELIM
551ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
552#endif
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000553#endif /* !NANO_SMALL && ENABLE_NANORC */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000554const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000555 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000556void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000557void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000558void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000559char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000560char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000561char *mallocstrassn(char *dest, char *src);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000562void new_magicline(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000563#ifndef NANO_SMALL
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000564void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000565void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000566 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000567#endif
David Lawrence Ramseyc104ef12005-07-17 01:44:35 +0000568size_t get_totsize(const filestruct *begin, const filestruct *end);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000569
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000570/* Public functions in winio.c. */
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000571#ifndef NANO_SMALL
572void reset_kbinput(void);
573#endif
David Lawrence Ramseydb958022005-07-13 20:18:46 +0000574void get_key_buffer(WINDOW *win);
575size_t get_key_buffer_len(void);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000576void unget_input(int *input, size_t input_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000577void unget_kbinput(int kbinput, bool meta_key, bool func_key);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000578int *get_input(WINDOW *win, size_t input_len);
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000579int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000580int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000581#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000582 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000583#endif
584 );
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000585int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000586 *ignore_seq);
587int get_escape_seq_abcd(int kbinput);
David Lawrence Ramseyf0a53f02005-01-03 19:56:56 +0000588int get_byte_kbinput(int kbinput
589#ifndef NANO_SMALL
590 , bool reset
591#endif
592 );
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000593int get_word_kbinput(int kbinput
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000594#ifndef NANO_SMALL
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000595 , bool reset
David Lawrence Ramsey48ae9862004-05-28 17:23:33 +0000596#endif
597 );
598int get_control_kbinput(int kbinput);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000599void unparse_kbinput(char *output, size_t output_len);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000600int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
601int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
David Lawrence Ramsey14bf8032004-05-22 20:19:15 +0000602#ifndef DISABLE_MOUSE
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000603bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
604#endif
David Lawrence Ramsey1483ee32004-11-29 00:30:07 +0000605const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
David Lawrence Ramseyeb16f432004-09-27 01:04:50 +0000606 *meta_key, bool *func_key);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000607#ifndef NANO_SMALL
608const toggle *get_toggle(int kbinput, bool meta_key);
609#endif
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000610int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000611 bool *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramseyc13b7f02005-01-01 07:28:15 +0000612#ifndef DISABLE_MOUSE
613bool do_statusbar_mouse(void);
614#endif
615void do_statusbar_home(void);
616void do_statusbar_end(void);
617void do_statusbar_right(void);
618void do_statusbar_left(void);
619void do_statusbar_backspace(void);
620void do_statusbar_delete(void);
621void do_statusbar_cut_text(void);
David Lawrence Ramseyb80077d2005-01-18 21:25:38 +0000622#ifndef NANO_SMALL
David Lawrence Ramseya8824a12005-06-26 19:03:48 +0000623bool do_statusbar_next_word(bool allow_punct);
624bool do_statusbar_prev_word(bool allow_punct);
David Lawrence Ramseyb80077d2005-01-18 21:25:38 +0000625#endif
David Lawrence Ramseyd9ad76b2005-01-02 22:35:31 +0000626void do_statusbar_verbatim_input(bool *got_enter);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000627void do_statusbar_output(char *output, size_t output_len, bool
David Lawrence Ramseyefec6412005-03-17 03:52:08 +0000628 *got_enter, bool allow_cntrls);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000629size_t xplustabs(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000630size_t actual_x(const char *str, size_t xplus);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000631size_t strnlenpt(const char *buf, size_t size);
632size_t strlenpt(const char *buf);
David Lawrence Ramseyb386a902005-07-10 02:37:38 +0000633void blank_line(WINDOW *win, int y, int x, int n);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000634void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000635void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000636void blank_edit(void);
637void blank_statusbar(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000638void blank_bottombars(void);
David Lawrence Ramseyb9ddb802005-03-17 17:56:48 +0000639void check_statusblank(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000640char *display_string(const char *buf, size_t start_col, size_t len, bool
641 dollars);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000642void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000643int nanogetstr(bool allow_tabs, const char *buf, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000644#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000645 filestruct **history_list,
Chris Allegretta5beed502003-01-05 20:41:21 +0000646#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000647 const shortcut *s
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000648#ifndef DISABLE_TABCOMP
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000649 , bool *list
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000650#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000651 );
David Lawrence Ramsey6f25a672005-05-20 02:57:05 +0000652int statusq(bool allow_tabs, const shortcut *s, const char *curranswer,
David Lawrence Ramsey1addd602005-06-03 19:28:30 +0000653#ifndef NANO_SMALL
David Lawrence Ramsey34bdc352005-06-02 18:41:31 +0000654 filestruct **history_list,
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000655#endif
David Lawrence Ramsey546f5b32005-05-14 23:14:47 +0000656 const char *msg, ...);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000657void statusq_abort(void);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000658void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000659void set_modified(void);
660void statusbar(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000661void bottombars(const shortcut *s);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000662void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramsey2dd7ed12003-09-29 05:15:24 +0000663size_t get_page_start(size_t column);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000664void reset_cursor(void);
David Lawrence Ramsey07d3feb2004-04-16 05:15:11 +0000665void edit_add(const filestruct *fileptr, const char *converted, int
666 yval, size_t start);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000667void update_line(const filestruct *fileptr, size_t index);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000668int need_horizontal_update(size_t old_pww);
669int need_vertical_update(size_t old_pww);
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000670void edit_scroll(updown direction, int nlines);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000671void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000672void edit_refresh(void);
David Lawrence Ramsey5b44f372005-07-16 22:47:12 +0000673void edit_update(centernone location);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000674int do_yesno(bool all, const char *msg);
David Lawrence Ramseyc54c4d12005-06-18 15:49:17 +0000675void total_redraw(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000676void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000677void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000678void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000679void do_cursorpos_void(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000680#ifndef DISABLE_HELP
David Lawrence Ramsey9bd56202005-03-18 21:29:33 +0000681size_t help_line_len(const char *ptr);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000682void do_help(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000683#endif
David Lawrence Ramsey7bde0532005-06-30 03:55:55 +0000684void do_replace_highlight(bool highlight, const char *word);
David Lawrence Ramseycc814362005-06-05 19:08:59 +0000685#ifndef NDEBUG
686int check_linenumbers(const filestruct *fileptr);
687#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000688#ifdef DEBUG
David Lawrence Ramsey6ad59cd2005-07-08 20:09:16 +0000689void dump_filestruct(const filestruct *inptr);
690void dump_filestruct_reverse(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000691#endif
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000692#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000693void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000694#endif
David Lawrence Ramseye527e452005-04-15 18:07:26 +0000695
696#endif /* !PROTO_H */