blob: 01b9a9a2af4f1a34ec31ffe8660bf6026dffae1b [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 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
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 *
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
19 * *
20 **************************************************************************/
21
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +000022/* Externs. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000023
David Lawrence Ramseyfd3039a2004-07-17 19:49:12 +000024#include <sys/types.h>
David Lawrence Ramsey84d0d592004-11-04 03:53:11 +000025#include <sys/stat.h>
David Lawrence Ramsey7d367712005-02-14 05:00:15 +000026#include <dirent.h>
Chris Allegretta805c26d2000-09-06 13:39:17 +000027#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +000028#include <regex.h>
Chris Allegretta805c26d2000-09-06 13:39:17 +000029#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000030#include "nano.h"
31
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000032#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000033extern ssize_t wrap_at;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000034#endif
Chris Allegretta17dcb722001-01-20 21:40:07 +000035extern int editwinrows;
David Lawrence Ramsey7a97e182004-10-30 01:03:15 +000036extern size_t current_x;
37extern int current_y;
38extern int totlines;
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +000039extern size_t placewewant;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000040#ifndef NANO_SMALL
David Lawrence Ramsey687776b2004-10-30 01:16:08 +000041extern size_t mark_beginx;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000042#endif
David Lawrence Ramsey23c44502005-01-27 20:49:07 +000043extern size_t totsize;
44extern unsigned long flags;
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000045extern ssize_t tabsize;
Chris Allegretta6b58acd2001-04-12 03:01:53 +000046extern int currslen;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000047
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000048#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
49extern char *whitespace;
David Lawrence Ramsey6e60db62005-03-10 22:52:21 +000050extern int whitespace_len[2];
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000051#endif
52
Chris Allegrettae4f940d2002-03-03 22:36:36 +000053#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000054extern char *punct;
55extern char *brackets;
Chris Allegretta45329a12002-03-10 01:22:21 +000056extern char *quotestr;
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000057#ifdef HAVE_REGEX_H
58extern regex_t quotereg;
59extern int quoterc;
60extern char *quoteerr;
61#else
62extern size_t quotelen;
63#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000064#endif
65
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000066#ifndef NANO_SMALL
67extern char *backup_dir;
68#endif
69
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +000070extern WINDOW *topwin, *edit, *bottomwin;
Chris Allegretta1a6e9042000-12-14 13:56:28 +000071extern char *filename;
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000072extern struct stat originalfilestat;
Chris Allegretta31925e42000-11-02 04:40:39 +000073extern char *answer;
Chris Allegretta6df90f52002-07-19 01:08:59 +000074extern char *hblank;
75#ifndef DISABLE_HELP
76extern char *help_text;
77#endif
Chris Allegretta27eb13f2000-11-05 16:52:21 +000078extern char *last_search;
79extern char *last_replace;
Chris Allegrettae1f14522001-09-19 03:19:43 +000080#ifndef DISABLE_OPERATINGDIR
81extern char *operating_dir;
Chris Allegrettaf5de33a2002-02-27 04:14:16 +000082extern char *full_operating_dir;
Chris Allegrettae1f14522001-09-19 03:19:43 +000083#endif
Chris Allegretta8d8e0122001-04-18 04:28:54 +000084#ifndef DISABLE_SPELLER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +000085extern char *alt_speller;
Chris Allegretta6df90f52002-07-19 01:08:59 +000086#endif
87
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000088extern struct stat fileinfo;
David Lawrence Ramseyb9775152004-03-19 02:15:42 +000089extern filestruct *current, *fileage, *edittop, *filebot;
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000090extern filestruct *cutbuffer;
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000091#ifndef DISABLE_JUSTIFY
92extern filestruct *jusbuffer;
93#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000094extern partition *filepart;
David Lawrence Ramseyb73c0c02004-11-05 15:25:53 +000095#ifndef NANO_SMALL
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +000096extern filestruct *mark_beginbuf;
97#endif
Chris Allegretta2d7893d2001-07-11 02:08:33 +000098
Chris Allegretta355fbe52001-07-14 19:32:47 +000099#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000100extern openfilestruct *open_files;
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000101#endif
102
Chris Allegretta08893e02001-11-29 02:42:27 +0000103#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000104extern const colortype *colorstrings;
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000105extern syntaxtype *syntaxes;
Chris Allegretta09900ff2002-05-04 04:23:30 +0000106extern char *syntaxstr;
Chris Allegretta08893e02001-11-29 02:42:27 +0000107#endif
108
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000109extern shortcut *shortcut_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000110extern shortcut *main_list, *whereis_list;
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000111extern shortcut *replace_list, *gotoline_list;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000112extern shortcut *writefile_list, *insertfile_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000113extern shortcut *replace_list_2;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000114#ifndef NANO_SMALL
115extern shortcut *extcmd_list;
116#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000117#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000118extern shortcut *help_list;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000119#endif
120#ifndef DISABLE_SPELLER
121extern shortcut *spell_list;
122#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000123#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000124extern shortcut *browser_list, *gotodir_list;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000125#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000126
Chris Allegretta6df90f52002-07-19 01:08:59 +0000127extern const shortcut *currshortcut;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000128
129#ifdef HAVE_REGEX_H
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000130extern regex_t search_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000131extern regmatch_t regmatches[10];
Chris Allegretta3533a342002-03-24 23:19:32 +0000132#ifdef ENABLE_COLOR
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000133extern regex_t syntaxfile_regexp;
David Lawrence Ramseyc3724882004-05-27 18:39:16 +0000134extern regmatch_t synfilematches[1];
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000135#endif /* ENABLE_COLOR */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000136#endif /* HAVE_REGEX_H */
137
138#ifndef NANO_SMALL
139extern toggle *toggles;
Chris Allegretta805c26d2000-09-06 13:39:17 +0000140#endif
141
Chris Allegretta5beed502003-01-05 20:41:21 +0000142#ifndef NANO_SMALL
143extern historyheadtype search_history;
144extern historyheadtype replace_history;
145#endif
146
David Lawrence Ramsey76356bd2004-08-12 04:30:22 +0000147extern bool curses_ended;
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000148
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000149extern char *homedir;
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000150
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +0000151/* Functions we want available. */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000152
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000153/* Public functions in chars.c. */
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000154bool is_byte(int c);
155bool is_alnum_char(int c);
David Lawrence Ramsey1fe2eeb2005-01-14 21:33:47 +0000156bool is_alnum_mbchar(const char *c);
157#ifdef NANO_WIDE
158bool is_alnum_wchar(wchar_t wc);
159#endif
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000160bool is_blank_char(int c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000161bool is_blank_mbchar(const char *c);
162#ifdef NANO_WIDE
163bool is_blank_wchar(wchar_t wc);
164#endif
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000165bool is_cntrl_char(int c);
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000166bool is_cntrl_mbchar(const char *c);
167#ifdef NANO_WIDE
168bool is_cntrl_wchar(wchar_t wc);
169#endif
170unsigned char control_rep(unsigned char c);
171char *control_mbrep(const char *c, char *crep, int *crep_len);
172#ifdef NANO_WIDE
173wchar_t control_wrep(wchar_t c);
174#endif
175int mbwidth(const char *c);
176int mb_cur_max(void);
David Lawrence Ramseyf0195a82005-03-14 18:47:21 +0000177char *make_mbchar(int chr, int *chr_mb_len);
David Lawrence Ramsey7d7e7d52005-03-14 18:54:33 +0000178#ifdef ENABLE_NANORC
David Lawrence Ramseyf0195a82005-03-14 18:47:21 +0000179char *make_mbstring(char *str);
David Lawrence Ramseye0fb4d52005-03-11 04:03:32 +0000180#endif
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000181int parse_mbchar(const char *buf, char *chr, bool *bad_chr, size_t
182 *col);
David Lawrence Ramseyd24fbb72005-01-14 21:50:32 +0000183size_t move_mbleft(const char *buf, size_t pos);
184size_t move_mbright(const char *buf, size_t pos);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000185#ifndef HAVE_STRCASECMP
186int nstrcasecmp(const char *s1, const char *s2);
187#endif
188int mbstrcasecmp(const char *s1, const char *s2);
189#ifndef HAVE_STRNCASECMP
190int nstrncasecmp(const char *s1, const char *s2, size_t n);
191#endif
192int mbstrncasecmp(const char *s1, const char *s2, size_t n);
193#ifndef HAVE_STRCASESTR
194const char *nstrcasestr(const char *haystack, const char *needle);
195#endif
David Lawrence Ramsey42abfe02005-01-22 18:24:16 +0000196const char *mbstrcasestr(const char *haystack, const char *needle);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000197#ifndef NANO_SMALL
198const char *revstrstr(const char *haystack, const char *needle, const
199 char *rev_start);
David Lawrence Ramsey3ee4cf32005-01-22 20:49:14 +0000200const char *revstrcasestr(const char *haystack, const char *needle,
201 const char *rev_start);
David Lawrence Ramsey345260c2005-01-24 01:14:17 +0000202const char *mbrevstrcasestr(const char *haystack, const char *needle,
203 const char *rev_start);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000204#endif
David Lawrence Ramsey3f9c6352005-01-25 19:21:11 +0000205size_t mbstrlen(const char *s);
David Lawrence Ramsey3a1fc8f2005-01-16 18:49:19 +0000206#ifndef HAVE_STRNLEN
207size_t nstrnlen(const char *s, size_t maxlen);
208#endif
209size_t mbstrnlen(const char *s, size_t maxlen);
David Lawrence Ramsey38156d42005-03-15 05:44:03 +0000210#ifndef DISABLE_JUSTIFY
211char *mbstrchr(const char *s, char *c);
212#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000213
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000214/* Public functions in color.c. */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000215#ifdef ENABLE_COLOR
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000216void set_colorpairs(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000217void do_colorinit(void);
218void update_color(void);
219#endif /* ENABLE_COLOR */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000220
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000221/* Public functions in cut.c. */
David Lawrence Ramseyc833d9e2004-05-29 15:36:58 +0000222void cutbuffer_reset(void);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000223void cut_line(void);
David Lawrence Ramsey50af6ea2004-11-07 15:29:40 +0000224#ifndef NANO_SMALL
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000225void cut_marked(void);
David Lawrence Ramsey50af6ea2004-11-07 15:29:40 +0000226#endif
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000227void cut_to_eol(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000228void do_cut_text(void);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000229#ifndef NANO_SMALL
230void do_cut_till_end(void);
231#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000232void do_uncut_text(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000233
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000234/* Public functions in files.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000235void new_file(void);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000236filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
237 size_t len);
238void load_file(void);
239void read_file(FILE *f, const char *filename);
240int open_file(const char *filename, bool newfie, FILE **f);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000241char *get_next_filename(const char *name);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000242#ifndef NANO_SMALL
243void execute_command(const char *command);
244#endif
245void load_buffer(const char *name);
David Lawrence Ramseybe908f62004-10-01 18:34:30 +0000246void do_insertfile(
247#ifndef NANO_SMALL
248 bool execute
249#else
250 void
251#endif
252 );
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000253void do_insertfile_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000254#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000255openfilestruct *make_new_opennode(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000256void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
257 openfilestruct *end);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000258void unlink_opennode(openfilestruct *fileptr);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000259void delete_opennode(openfilestruct *fileptr);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000260#ifdef DEBUG
Chris Allegretta6df90f52002-07-19 01:08:59 +0000261void free_openfilestruct(openfilestruct *src);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000262#endif
David Lawrence Ramsey3e189a82004-10-03 19:18:48 +0000263void add_open_file(bool update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000264void load_open_file(void);
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000265void open_prevnext_file(bool next);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000266void open_prevfile_void(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000267void open_nextfile_void(void);
David Lawrence Ramsey3e189a82004-10-03 19:18:48 +0000268bool close_open_file(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000269#endif
270#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000271char *get_full_path(const char *origpath);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000272#endif
273#ifndef DISABLE_SPELLER
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000274char *check_writable_directory(const char *path);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000275char *safe_tempnam(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000276#endif
277#ifndef DISABLE_OPERATINGDIR
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000278void init_operating_dir(void);
David Lawrence Ramsey1b9d3f92005-02-11 20:09:11 +0000279bool check_operating_dir(const char *currpath, bool allow_tabcomp);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000280#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000281#ifndef NANO_SMALL
282void init_backup_dir(void);
283#endif
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000284int copy_file(FILE *inn, FILE *out);
David Lawrence Ramsey8c16bac2004-11-06 15:10:57 +0000285int write_file(const char *name, bool tmp, int append, bool
286 nonamechange);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000287#ifndef NANO_SMALL
David Lawrence Ramsey8c16bac2004-11-06 15:10:57 +0000288int write_marked(const char *name, bool tmp, int append);
David Lawrence Ramsey35961c42004-01-23 19:34:03 +0000289#endif
David Lawrence Ramsey951d7142004-10-04 15:23:47 +0000290int do_writeout(bool exiting);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000291void do_writeout_void(void);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000292char *real_dir_from_tilde(const char *buf);
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000293#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
294int diralphasort(const void *va, const void *vb);
295#endif
Chris Allegretta7662c862003-01-13 01:35:15 +0000296#ifndef DISABLE_TABCOMP
David Lawrence Ramsey65e6ecb2005-02-08 20:37:53 +0000297char **username_tab_completion(const char *buf, size_t *num_matches,
298 size_t buflen);
299char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
300 buflen);
301char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
Chris Allegretta7662c862003-01-13 01:35:15 +0000302#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000303const char *tail(const char *foo);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000304#ifndef DISABLE_BROWSER
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000305void free_charptrarray(char **array, size_t len);
David Lawrence Ramsey7d367712005-02-14 05:00:15 +0000306void striponedir(char *path);
307char **browser_init(const char *path, int *longest, size_t *numents, DIR
308 *dir);
309char *do_browser(char *path, DIR *dir);
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000310char *do_browse_from(const char *inpath);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000311#endif
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000312#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000313char *histfilename(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000314void load_history(void);
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000315bool writehist(FILE *hist, historyheadtype *histhead);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000316void save_history(void);
317#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000318
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000319/* Public functions in global.c. */
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000320size_t length_of_list(const shortcut *s);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000321#ifndef NANO_SMALL
David Lawrence Ramsey2ad32092004-07-07 14:36:44 +0000322void toggle_init_one(int val, const char *desc, long flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000323void toggle_init(void);
324#ifdef DEBUG
325void free_toggles(void);
326#endif
327#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000328void sc_init_one(shortcut **shortcutage, int key, const char *desc,
329#ifndef DISABLE_HELP
330 const char *help,
331#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000332 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000333 (*func)(void));
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000334void shortcut_init(bool unjustify);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000335void free_shortcutage(shortcut **shortcutage);
Chris Allegretta6232d662002-05-12 19:52:15 +0000336#ifdef DEBUG
Chris Allegrettadab017e2002-04-23 10:56:06 +0000337void thanks_for_all_the_fish(void);
Chris Allegretta6232d662002-05-12 19:52:15 +0000338#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000339
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000340/* Public functions in move.c. */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000341void do_first_line(void);
342void do_last_line(void);
343void do_home(void);
344void do_end(void);
345void do_page_up(void);
346void do_page_down(void);
347void do_up(void);
348void do_down(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000349void do_left(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000350void do_left_void(void);
David Lawrence Ramsey3e819142004-12-31 04:10:28 +0000351void do_right(bool allow_update);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000352void do_right_void(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000353
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000354/* Public functions in nano.c. */
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000355void print_view_warning(void);
David Lawrence Ramseyda141062004-05-25 19:41:11 +0000356void finish(void);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000357void die(const char *msg, ...);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000358void die_save_file(const char *die_filename);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000359void check_die_too_small(void);
360void resize_variables(void);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000361void global_init(bool save_cutbuffer);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000362void window_init(void);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000363#ifndef DISABLE_MOUSE
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000364void mouse_init(void);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000365#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000366#ifndef DISABLE_HELP
367void help_init(void);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000368#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000369filestruct *make_new_node(filestruct *prevnode);
370filestruct *copy_node(const filestruct *src);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000371void splice_node(filestruct *begin, filestruct *newnode, filestruct
372 *end);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000373void unlink_node(const filestruct *fileptr);
374void delete_node(filestruct *fileptr);
375filestruct *copy_filestruct(const filestruct *src);
376void free_filestruct(filestruct *src);
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000377partition *partition_filestruct(filestruct *top, size_t top_x,
378 filestruct *bot, size_t bot_x);
David Lawrence Ramsey74d87072004-11-22 00:16:23 +0000379void unpartition_filestruct(partition **p);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000380void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
381 filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
382void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000383void renumber_all(void);
384void renumber(filestruct *fileptr);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000385void print1opt(const char *shortflag, const char *longflag, const char
386 *desc);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000387void usage(void);
388void version(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000389int no_more_space(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000390int no_help(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000391void nano_disabled_msg(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000392#ifndef NANO_SMALL
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000393void cancel_fork(int signal);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000394bool open_pipe(const char *command);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000395#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000396void do_verbatim_input(void);
397void do_backspace(void);
398void do_delete(void);
399void do_tab(void);
400void do_enter(void);
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000401#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000402void do_next_word(void);
403void do_prev_word(void);
404void do_mark(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000405#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000406#ifndef DISABLE_WRAPPING
David Lawrence Ramseyc97acfb2003-09-10 20:08:00 +0000407void wrap_reset(void);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000408bool do_wrap(filestruct *inptr);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000409#endif
410#ifndef DISABLE_SPELLER
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000411bool do_int_spell_fix(const char *word);
412const char *do_int_speller(const char *tempfile_name);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000413const char *do_alt_speller(char *tempfile_name);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000414void do_spell(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000415#endif
David Lawrence Ramseybb50b302004-08-12 21:43:00 +0000416#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000417size_t indent_length(const char *line);
418#endif
419#ifndef DISABLE_JUSTIFY
David Lawrence Ramseye9ac1d72005-03-13 03:28:37 +0000420void justify_format(filestruct *paragraph, size_t skip);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000421size_t quote_length(const char *line);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000422bool quotes_match(const char *a_line, size_t a_quote, const char
423 *b_line);
424bool indents_match(const char *a_line, size_t a_indent, const char
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000425 *b_line, size_t b_indent);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +0000426bool begpar(const filestruct *const foo);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000427void do_para_begin(bool allow_update);
428void do_para_begin_void(void);
429bool inpar(const filestruct *const foo);
430void do_para_end(bool allow_update);
431void do_para_end_void(void);
David Lawrence Ramseyd4693cb2004-05-14 01:17:25 +0000432filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
433 quote_len);
David Lawrence Ramseyd08348b2004-09-18 22:02:21 +0000434ssize_t break_line(const char *line, ssize_t goal, bool force);
David Lawrence Ramseyff4a4872005-03-13 21:12:25 +0000435bool find_paragraph(size_t *const quote, size_t *const par);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000436void do_justify(bool full_justify);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000437void do_justify_void(void);
438void do_full_justify(void);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000439#endif /* !DISABLE_JUSTIFY */
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000440void do_exit(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000441void signal_init(void);
David Lawrence Ramsey50406662005-01-19 19:52:42 +0000442void handle_hupterm(int signal);
443void do_suspend(int signal);
444void do_cont(int signal);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000445#ifndef NANO_SMALL
446void handle_sigwinch(int s);
David Lawrence Ramseyce62e822004-08-05 22:10:22 +0000447void allow_pending_sigwinch(bool allow);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000448#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000449#ifndef NANO_SMALL
450void do_toggle(const toggle *which);
451#endif
David Lawrence Ramsey013344c2004-09-22 22:45:08 +0000452void disable_extended_input(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000453void disable_signals(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000454#ifndef NANO_SMALL
455void enable_signals(void);
456#endif
457void disable_flow_control(void);
458void enable_flow_control(void);
David Lawrence Ramsey8aaf0302004-07-27 16:46:35 +0000459void terminal_init(void);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000460int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
David Lawrence Ramseycac02932005-01-11 23:05:05 +0000461 *ran_func, bool *finished, bool allow_funcs);
David Lawrence Ramsey74835712004-12-04 17:41:52 +0000462#ifndef DISABLE_MOUSE
463bool do_mouse(void);
464#endif
David Lawrence Ramseyb54155c2005-01-12 03:25:57 +0000465void do_output(char *output, size_t output_len);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000466
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000467/* Public functions in rcfile.c. */
Chris Allegretta7a500092001-04-19 21:13:46 +0000468#ifdef ENABLE_NANORC
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000469void rcfile_error(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000470char *parse_next_word(char *ptr);
471char *parse_argument(char *ptr);
472#ifdef ENABLE_COLOR
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000473int color_to_int(const char *colorname, bool *bright);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000474char *parse_next_regex(char *ptr);
David Lawrence Ramsey202d3c22005-03-10 20:55:11 +0000475bool nregcomp(regex_t *preg, const char *regex, int eflags);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000476void parse_syntax(char *ptr);
477void parse_colors(char *ptr);
478#endif /* ENABLE_COLOR */
479void parse_rcfile(FILE *rcstream);
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000480void do_rcfile(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000481#endif /* ENABLE_NANORC */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000482
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000483/* Public functions in search.c. */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000484#ifdef HAVE_REGEX_H
Chris Allegretta5d715142003-01-29 04:18:37 +0000485int regexp_init(const char *regexp);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000486void regexp_cleanup(void);
487#endif
488void not_found_msg(const char *str);
489void search_abort(void);
490void search_init_globals(void);
David Lawrence Ramseyd532f192004-10-04 22:37:56 +0000491int search_init(bool replacing, bool use_answer);
David Lawrence Ramseye1c16b32005-02-12 23:09:27 +0000492bool is_whole_word(size_t pos, const char *buf, const char *word);
David Lawrence Ramseyc5100422004-08-27 20:28:34 +0000493bool findnextstr(bool can_display_wrap, bool wholeword, bool
494 no_sameline, const filestruct *begin, size_t beginx, const char
David Lawrence Ramsey77b284a2004-10-27 02:21:01 +0000495 *needle, size_t *needle_len);
David Lawrence Ramseye5e88fd2004-10-31 13:20:30 +0000496void findnextstr_wrap_reset(void);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000497void do_search(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000498#ifndef NANO_SMALL
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000499void do_research(void);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000500#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000501void replace_abort(void);
502#ifdef HAVE_REGEX_H
David Lawrence Ramseyc5100422004-08-27 20:28:34 +0000503int replace_regexp(char *string, bool create_flag);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000504#endif
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000505char *replace_line(const char *needle);
David Lawrence Ramsey182b2c92004-11-03 16:02:41 +0000506ssize_t do_replace_loop(const char *needle, const filestruct
507 *real_current, size_t *real_current_x, bool wholewords, bool
508 *canceled);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000509void do_replace(void);
David Lawrence Ramseyc53ab2a2004-08-04 18:24:53 +0000510void do_gotoline(int line, bool save_pos);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000511void do_gotoline_void(void);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000512#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
David Lawrence Ramsey7a97e182004-10-30 01:03:15 +0000513void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000514#endif
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000515void do_find_bracket(void);
Chris Allegretta5beed502003-01-05 20:41:21 +0000516#ifndef NANO_SMALL
517void history_init(void);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000518historytype *find_node(historytype *h, const char *s);
Chris Allegretta5beed502003-01-05 20:41:21 +0000519void remove_node(historytype *r);
520void insert_node(historytype *h, const char *s);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000521void update_history(historyheadtype *h, const char *s);
Chris Allegretta5beed502003-01-05 20:41:21 +0000522char *get_history_older(historyheadtype *h);
523char *get_history_newer(historyheadtype *h);
524char *get_history_completion(historyheadtype *h, char *s);
David Lawrence Ramsey6420d442004-08-11 05:13:08 +0000525#ifdef DEBUG
Chris Allegretta5beed502003-01-05 20:41:21 +0000526void free_history(historyheadtype *h);
Chris Allegrettaf3de8b52003-01-16 23:44:46 +0000527#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000528#endif
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
533int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
534 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
Chris Allegretta6df90f52002-07-19 01:08:59 +0000538int num_of_digits(int 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);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000541void align(char **strp);
542void null_at(char **data, size_t index);
543void unsunder(char *str, size_t true_len);
544void sunder(char *str);
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000545#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000546#ifndef HAVE_GETLINE
547ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
548#endif
549#ifndef HAVE_GETDELIM
550ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream);
551#endif
David Lawrence Ramseya8834702004-08-17 20:34:57 +0000552#endif /* !NANO_SMALL && ENABLE_NANORC */
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000553const char *strstrwrapper(const char *haystack, const char *needle,
David Lawrence Ramsey1044d742004-02-24 20:41:39 +0000554 const char *start);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000555void nperror(const char *s);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000556void *nmalloc(size_t howmuch);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000557void *nrealloc(void *ptr, size_t howmuch);
David Lawrence Ramsey4a1fc552004-11-02 15:18:30 +0000558char *mallocstrncpy(char *dest, const char *src, size_t n);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000559char *mallocstrcpy(char *dest, const char *src);
David Lawrence Ramsey02517e02004-09-05 21:40:31 +0000560char *mallocstrassn(char *dest, char *src);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000561void new_magicline(void);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000562#ifndef NANO_SMALL
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +0000563void remove_magicline(void);
David Lawrence Ramseyf7080372004-07-08 17:15:10 +0000564void mark_order(const filestruct **top, size_t *top_x, const filestruct
David Lawrence Ramsey90e59c12004-11-05 23:03:03 +0000565 **bot, size_t *bot_x, bool *right_side_up);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000566#endif
David Lawrence Ramsey93c84052004-11-23 04:08:28 +0000567void get_totals(const filestruct *begin, const filestruct *end, int
David Lawrence Ramsey23c44502005-01-27 20:49:07 +0000568 *lines, size_t *size);
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 Ramsey74835712004-12-04 17:41:52 +0000574void get_buffer(WINDOW *win);
575size_t get_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
623void do_statusbar_next_word(void);
624void do_statusbar_prev_word(void);
625#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 Ramseyd9ad76b2005-01-02 22:35:31 +0000628 *got_enter);
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 Ramseyd7fd2002004-05-18 01:20:36 +0000633void blank_titlebar(void);
David Lawrence Ramsey637b8bb2005-01-17 05:06:55 +0000634void blank_topbar(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000635void blank_edit(void);
636void blank_statusbar(void);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000637void check_statusblank(void);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000638void blank_bottombars(void);
David Lawrence Ramseyfc693212004-12-23 17:43:27 +0000639char *display_string(const char *buf, size_t start_col, size_t len, bool
640 dollars);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000641void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000642int nanogetstr(bool allow_tabs, const char *buf, const char *def,
Chris Allegretta5beed502003-01-05 20:41:21 +0000643#ifndef NANO_SMALL
644 historyheadtype *history_list,
645#endif
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000646 const shortcut *s
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000647#ifndef DISABLE_TABCOMP
David Lawrence Ramsey4d44d2d2004-08-01 22:35:31 +0000648 , bool *list
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000649#endif
Chris Allegretta65f075d2003-02-13 03:03:49 +0000650 );
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000651int statusq(bool allow_tabs, const shortcut *s, const char *def,
652#ifndef NANO_SMALL
653 historyheadtype *history_list,
654#endif
655 const char *msg, ...);
656void statusq_abort(void);
Chris Allegrettaf717f982003-02-13 22:25:01 +0000657void titlebar(const char *path);
David Lawrence Ramseyd7fd2002004-05-18 01:20:36 +0000658void set_modified(void);
659void statusbar(const char *msg, ...);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000660void bottombars(const shortcut *s);
David Lawrence Ramseyfa394042004-05-23 21:11:14 +0000661void onekey(const char *keystroke, const char *desc, size_t len);
David Lawrence Ramsey1f28b8f2002-09-27 14:21:59 +0000662#ifndef NDEBUG
663int check_linenumbers(const filestruct *fileptr);
664#endif
David Lawrence Ramsey2dd7ed12003-09-29 05:15:24 +0000665size_t get_page_start(size_t column);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000666void reset_cursor(void);
David Lawrence Ramsey07d3feb2004-04-16 05:15:11 +0000667void edit_add(const filestruct *fileptr, const char *converted, int
668 yval, size_t start);
David Lawrence Ramsey5ffbec52003-09-16 01:16:49 +0000669void update_line(const filestruct *fileptr, size_t index);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000670int need_horizontal_update(size_t old_pww);
671int need_vertical_update(size_t old_pww);
David Lawrence Ramsey2ed225f2004-05-28 20:44:09 +0000672void edit_scroll(updown direction, int nlines);
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000673void edit_redraw(const filestruct *old_current, size_t old_pww);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000674void edit_refresh(void);
David Lawrence Ramsey20b83502004-08-26 18:07:58 +0000675void edit_update(topmidnone location);
David Lawrence Ramsey045883a2004-10-05 20:11:31 +0000676int do_yesno(bool all, const char *msg);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000677void total_refresh(void);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000678void display_main_list(void);
David Lawrence Ramseya0b5ba22004-08-25 15:39:10 +0000679void do_cursorpos(bool constant);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000680void do_cursorpos_void(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000681#ifndef DISABLE_HELP
682int help_line_len(const char *ptr);
David Lawrence Ramsey72e51ab2004-07-02 14:31:03 +0000683void do_help(void);
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000684#endif
David Lawrence Ramsey423326f2005-01-03 19:14:39 +0000685void do_replace_highlight(bool highlight_flag, const char *word);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000686#ifdef DEBUG
687void dump_buffer(const filestruct *inptr);
688void dump_buffer_reverse(void);
689#endif
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000690#ifdef NANO_EXTRA
Chris Allegretta34318ed2001-01-31 23:22:36 +0000691void do_credits(void);
Chris Allegretta8a0de3b2000-11-24 20:45:14 +0000692#endif