blob: 7a9cf7259ed4435244536a6be95e92694a4fca06 [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * global.c *
4 * *
Jordi Mallach8ae57892002-01-04 17:57:40 +00005 * Copyright (C) 1999-2002 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
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000022#include "config.h"
Chris Allegretta6efda542001-04-28 18:03:52 +000023
Chris Allegrettadab017e2002-04-23 10:56:06 +000024#include <assert.h>
Chris Allegretta6efda542001-04-28 18:03:52 +000025#include <sys/stat.h>
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000026#include "proto.h"
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000027#include "nano.h"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000028
Chris Allegretta6232d662002-05-12 19:52:15 +000029#ifdef ENABLE_NLS
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000030#include <libintl.h>
31#define _(string) gettext(string)
32#else
33#define _(string) (string)
34#endif
35
36/*
37 * Global variables
38 */
Chris Allegretta48b06702002-02-22 04:30:50 +000039
Chris Allegretta6df90f52002-07-19 01:08:59 +000040/* wrap_at might be set in rcfile.c or nano.c */
41int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
42char *last_search = NULL; /* Last string we searched for */
43char *last_replace = NULL; /* Last replacement string */
44int search_last_line; /* Is this the last search line? */
45
Chris Allegretta88520c92001-05-05 17:45:54 +000046int flags = 0; /* Our new flag containing many options */
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000047WINDOW *edit; /* The file portion of the editor */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000048WINDOW *topwin; /* Top line of screen */
49WINDOW *bottomwin; /* Bottom buffer */
Chris Allegretta1a6e9042000-12-14 13:56:28 +000050char *filename = NULL; /* Name of the file */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000051
52#ifndef NANO_SMALL
53struct stat originalfilestat; /* Stat for the file as we loaded it */
54#endif
55
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000056int editwinrows = 0; /* How many rows long is the edit
57 window? */
58filestruct *current; /* Current buffer pointer */
59int current_x = 0, current_y = 0; /* Current position of X and Y in
60 the editor - relative to edit
61 window (0,0) */
62filestruct *fileage = NULL; /* Our file buffer */
63filestruct *edittop = NULL; /* Pointer to the top of the edit
64 buffer with respect to the
65 file struct */
66filestruct *editbot = NULL; /* Same for the bottom */
67filestruct *filebot = NULL; /* Last node in the file struct */
68filestruct *cutbuffer = NULL; /* A place to store cut text */
69
Chris Allegretta355fbe52001-07-14 19:32:47 +000070#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +000071openfilestruct *open_files = NULL; /* The list of open files */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000072#endif
73
Chris Allegrettae4f940d2002-03-03 22:36:36 +000074#ifndef DISABLE_JUSTIFY
Chris Allegretta6df90f52002-07-19 01:08:59 +000075#ifdef HAVE_REGEX_H
76char *quotestr = "^([ \t]*[|>:}#])+";
77#else
Chris Allegrettae4f940d2002-03-03 22:36:36 +000078char *quotestr = "> "; /* Quote string */
79#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +000080#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000081
Chris Allegretta6df90f52002-07-19 01:08:59 +000082char *answer = NULL; /* Answer str to many questions */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000083int totlines = 0; /* Total number of lines in the file */
Chris Allegrettab3655b42001-10-22 03:15:31 +000084long totsize = 0; /* Total number of bytes in the file */
Chris Allegretta88520c92001-05-05 17:45:54 +000085int placewewant = 0; /* The column we'd like the cursor
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000086 to jump to when we go to the
87 next or previous line */
88
Chris Allegretta6d690a32000-08-03 22:51:21 +000089int tabsize = 8; /* Our internal tabsize variable */
90
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000091char *hblank; /* A horizontal blank line */
Chris Allegretta6df90f52002-07-19 01:08:59 +000092#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000093char *help_text; /* The text in the help window */
Chris Allegretta6df90f52002-07-19 01:08:59 +000094#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000095
96/* More stuff for the marker select */
97
98filestruct *mark_beginbuf; /* the begin marker buffer */
99int mark_beginx; /* X value in the string to start */
100
Chris Allegrettae1f14522001-09-19 03:19:43 +0000101#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000102char *operating_dir = NULL; /* Operating directory, which we can't */
103char *full_operating_dir = NULL;/* go higher than */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000104#endif
105
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000106#ifndef DISABLE_SPELLER
Chris Allegretta7c27be42002-05-05 23:03:54 +0000107char *alt_speller = NULL; /* Alternative spell command */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000108#endif
109
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000110shortcut *main_list = NULL;
111shortcut *whereis_list = NULL;
112shortcut *replace_list = NULL;
Chris Allegretta48b06702002-02-22 04:30:50 +0000113shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000114shortcut *goto_list = NULL;
115shortcut *gotodir_list = NULL;
116shortcut *writefile_list = NULL;
117shortcut *insertfile_list = NULL;
118shortcut *help_list = NULL;
119shortcut *spell_list = NULL;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000120#ifndef NANO_SMALL
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000121shortcut *extcmd_list = NULL;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000122#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000123#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000124shortcut *browser_list = NULL;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000125#endif
126
Chris Allegretta8ce24132001-04-30 11:28:46 +0000127#ifdef ENABLE_COLOR
Chris Allegretta08893e02001-11-29 02:42:27 +0000128 colortype *colorstrings = NULL;
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000129 syntaxtype *syntaxes = NULL;
Chris Allegretta09900ff2002-05-04 04:23:30 +0000130 char *syntaxstr = NULL;
Chris Allegretta8ce24132001-04-30 11:28:46 +0000131#endif
132
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000133#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP)
Chris Allegretta6df90f52002-07-19 01:08:59 +0000134const shortcut *currshortcut; /* Current shortcut list we're using */
Chris Allegretta6fe61492001-05-21 12:56:25 +0000135#endif
Chris Allegretta6b58acd2001-04-12 03:01:53 +0000136
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000137#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000138toggle *toggles = NULL;
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000139#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000140
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000141/* Regular expressions */
142
Chris Allegretta805c26d2000-09-06 13:39:17 +0000143#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000144regex_t search_regexp; /* Global to store compiled search regexp */
145regmatch_t regmatches[10]; /* Match positions for parenthetical
146 subexpressions, max of 10 */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000147#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000148#ifdef ENABLE_COLOR
Chris Allegretta6df90f52002-07-19 01:08:59 +0000149regex_t color_regexp; /* Global to store compiled search regexp */
150regmatch_t colormatches[1]; /* Match positions for parenthetical */
Chris Allegrettab6c5dc22002-05-04 03:47:33 +0000151
Chris Allegretta6df90f52002-07-19 01:08:59 +0000152regex_t syntaxfile_regexp; /* Global to store compiled search regexp */
153regmatch_t synfilematches[1]; /* Match positions for parenthetical */
Chris Allegretta3533a342002-03-24 23:19:32 +0000154#endif /* ENABLE_COLOR */
155
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000156
Chris Allegrettadab017e2002-04-23 10:56:06 +0000157int length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000158{
159 int i = 0;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000160 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000161 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000162 return i;
163}
164
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000165/* Initialize a struct *without* our lovely braces =( */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000166void sc_init_one(shortcut **shortcutage, int key, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000167#ifndef DISABLE_HELP
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000168 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000169#endif
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000170 int alt, int misc1, int misc2, int view, int (*func) (void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000171{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000172 shortcut *s;
173
174 if (*shortcutage == NULL) {
175 *shortcutage = nmalloc(sizeof(shortcut));
176 s = *shortcutage;
177 } else {
178 for (s = *shortcutage; s->next != NULL; s = s->next)
179 ;
180 s->next = nmalloc(sizeof(shortcut));
181 s = s->next;
182 }
183
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000184 s->val = key;
185 s->desc = desc;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000186#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000187 s->help = help;
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000188#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000189 s->altval = alt;
190 s->misc1 = misc1;
191 s->misc2 = misc2;
192 s->viewok = view;
193 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000194 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000195}
196
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000197#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000198/* Create one new toggle structure, at the end of the toggles
199 * linked list. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000200void toggle_init_one(int val, const char *desc, int flag)
Chris Allegretta756f2202000-09-01 13:32:47 +0000201{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000202 toggle *u;
203
204 if (toggles == NULL) {
205 toggles = nmalloc(sizeof(toggle));
206 u = toggles;
207 } else {
208 for (u = toggles; u->next != NULL; u = u->next)
209 ;
210 u->next = nmalloc(sizeof(toggle));
211 u = u->next;
212 }
213
214 u->val = val;
215 u->desc = desc;
216 u->flag = flag;
217 u->next = NULL;
Chris Allegretta756f2202000-09-01 13:32:47 +0000218}
219
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000220void toggle_init(void)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000221{
Chris Allegretta756f2202000-09-01 13:32:47 +0000222 char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
223 *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
Chris Allegretta6df90f52002-07-19 01:08:59 +0000224 *toggle_cuttoend_msg, *toggle_noconvert_msg, *toggle_dos_msg,
225 *toggle_mac_msg, *toggle_backup_msg, *toggle_smooth_msg;
226#ifndef DISABLE_WRAPPING
227 char *toggle_wrap_msg;
228#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000229#ifdef ENABLE_MULTIBUFFER
230 char *toggle_load_msg;
231#endif
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000232
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000233 /* There is no need to reinitialize the toggles. They can't
234 change. In fact, reinitializing them causes a segfault in
235 nano.c:do_toggle() when it is called with the Pico-mode
236 toggle. */
237 if (toggles != NULL)
238 return;
239
Chris Allegretta756f2202000-09-01 13:32:47 +0000240 toggle_const_msg = _("Constant cursor position");
Chris Allegrettaf8163dc2000-09-03 01:06:40 +0000241 toggle_autoindent_msg = _("Auto indent");
Chris Allegretta756f2202000-09-01 13:32:47 +0000242 toggle_suspend_msg = _("Suspend");
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000243 toggle_nohelp_msg = _("Help mode");
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000244 toggle_picomode_msg = _("Pico mode");
Chris Allegretta756f2202000-09-01 13:32:47 +0000245 toggle_mouse_msg = _("Mouse support");
246 toggle_cuttoend_msg = _("Cut to end");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000247 toggle_noconvert_msg = _("No conversion from DOS/Mac format");
Chris Allegretta7004c282001-09-22 00:42:10 +0000248 toggle_dos_msg = _("Writing file in DOS format");
Chris Allegretta995177f2001-09-22 04:34:23 +0000249 toggle_mac_msg = _("Writing file in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000250 toggle_backup_msg = _("Backing up file");
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000251 toggle_smooth_msg = _("Smooth scrolling");
Chris Allegretta6df90f52002-07-19 01:08:59 +0000252#ifndef DISABLE_WRAPPING
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000253 toggle_wrap_msg = _("Auto wrap");
Chris Allegretta6df90f52002-07-19 01:08:59 +0000254#endif
Chris Allegretta355fbe52001-07-14 19:32:47 +0000255#ifdef ENABLE_MULTIBUFFER
256 toggle_load_msg = _("Multiple file buffers");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000257#endif
258
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000259 toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
260 toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
261 toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
262 toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
263 toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000264#ifndef DISABLE_WRAPPING
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000265 toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000266#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000267 toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
268 toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000269#ifdef ENABLE_MULTIBUFFER
270 toggle_init_one(TOGGLE_LOAD_KEY, toggle_load_msg, MULTIBUFFER);
Chris Allegretta805c26d2000-09-06 13:39:17 +0000271#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000272 toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
273 toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
274 toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000275 toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000276 toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
Chris Allegrettadab017e2002-04-23 10:56:06 +0000277}
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000278
279#ifdef DEBUG
280/* Deallocate all of the toggles. */
281void free_toggles(void)
282{
283 while (toggles != NULL) {
284 toggle *pt = toggles; /* Think "previous toggle" */
285
286 toggles = toggles->next;
287 free(pt);
288 }
289}
290#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000291#endif /* !NANO_SMALL */
Chris Allegrettadab017e2002-04-23 10:56:06 +0000292
Chris Allegrettadab017e2002-04-23 10:56:06 +0000293/* Deallocate the given shortcut. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000294void free_shortcutage(shortcut **shortcutage)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000295{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000296 assert(shortcutage != NULL);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000297 while (*shortcutage != NULL) {
298 shortcut *ps = *shortcutage;
299 *shortcutage = (*shortcutage)->next;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000300 free(ps);
301 }
Chris Allegretta756f2202000-09-01 13:32:47 +0000302}
303
Chris Allegretta07798352000-11-27 22:58:23 +0000304void shortcut_init(int unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000305{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000306#ifndef DISABLE_HELP
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000307 char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg =
308 "", *nano_goto_msg = "", *nano_justify_msg =
309 "", *nano_replace_msg = "", *nano_insert_msg =
310 "", *nano_whereis_msg = "", *nano_prevpage_msg =
311 "", *nano_nextpage_msg = "", *nano_cut_msg =
312 "", *nano_uncut_msg = "", *nano_cursorpos_msg =
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000313 "", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
314 "", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
315 "", *nano_end_msg = "", *nano_firstline_msg =
316 "", *nano_lastline_msg = "", *nano_refresh_msg =
317 "", *nano_mark_msg = "", *nano_delete_msg =
318 "", *nano_backspace_msg = "", *nano_tab_msg =
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000319 "", *nano_enter_msg = "", *nano_cancel_msg =
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000320 "", *nano_unjustify_msg = "", *nano_append_msg =
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000321 "", *nano_prepend_msg = "", *nano_tofiles_msg =
322 "", *nano_gotodir_msg = "", *nano_case_msg =
323 "", *nano_reverse_msg = "", *nano_execute_msg =
324 "", *nano_dos_msg = "", *nano_mac_msg =
325 "", *nano_backup_msg = "";
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000326
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000327#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000328 char *nano_openprev_msg = "", *nano_opennext_msg =
329 "", *nano_multibuffer_msg = "";
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000330#endif
Chris Allegretta2bef1822001-09-28 19:53:11 +0000331#ifdef HAVE_REGEX_H
332 char *nano_regexp_msg = "", *nano_bracket_msg = "";
333#endif
Chris Allegretta6636dc32001-01-05 05:41:07 +0000334
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000335 nano_help_msg = _("Invoke the help menu");
336 nano_writeout_msg = _("Write the current file to disk");
Chris Allegretta355fbe52001-07-14 19:32:47 +0000337#ifdef ENABLE_MULTIBUFFER
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000338 nano_exit_msg = _("Close currently loaded file/Exit from nano");
339#else
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000340 nano_exit_msg = _("Exit from nano");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000341#endif
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000342 nano_goto_msg = _("Go to a specific line number");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000343 nano_justify_msg = _("Justify the current paragraph");
Chris Allegretta07798352000-11-27 22:58:23 +0000344 nano_unjustify_msg = _("Unjustify after a justify");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000345 nano_replace_msg = _("Replace text within the editor");
346 nano_insert_msg = _("Insert another file into the current one");
347 nano_whereis_msg = _("Search for text within the editor");
348 nano_prevpage_msg = _("Move to the previous screen");
349 nano_nextpage_msg = _("Move to the next screen");
350 nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
351 nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
Chris Allegretta88520c92001-05-05 17:45:54 +0000352 nano_cursorpos_msg = _("Show the position of the cursor");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000353 nano_spell_msg = _("Invoke the spell checker, if available");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000354 nano_up_msg = _("Move up one line");
355 nano_down_msg = _("Move down one line");
356 nano_forward_msg = _("Move forward one character");
357 nano_back_msg = _("Move back one character");
358 nano_home_msg = _("Move to the beginning of the current line");
359 nano_end_msg = _("Move to the end of the current line");
360 nano_firstline_msg = _("Go to the first line of the file");
361 nano_lastline_msg = _("Go to the last line of the file");
362 nano_refresh_msg = _("Refresh (redraw) the current screen");
363 nano_mark_msg = _("Mark text at the current cursor location");
364 nano_delete_msg = _("Delete the character under the cursor");
365 nano_backspace_msg =
366 _("Delete the character to the left of the cursor");
367 nano_tab_msg = _("Insert a tab character");
368 nano_enter_msg = _("Insert a carriage return at the cursor position");
369 nano_case_msg =
370 _("Make the current search or replace case (in)sensitive");
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000371 nano_tofiles_msg = _("Go to file browser");
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000372 nano_execute_msg = _("Execute external command");
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000373 nano_gotodir_msg = _("Go to directory");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000374 nano_cancel_msg = _("Cancel the current function");
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000375 nano_append_msg = _("Append to the current file");
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000376 nano_prepend_msg = _("Prepend to the current file");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000377 nano_reverse_msg = _("Search backwards");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000378 nano_dos_msg = _("Write file out in DOS format");
379 nano_mac_msg = _("Write file out in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000380 nano_backup_msg = _("Back up original file when saving");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000381#ifdef HAVE_REGEX_H
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000382 nano_regexp_msg = _("Use regular expressions");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000383 nano_bracket_msg = _("Find other bracket");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000384#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000385#ifdef ENABLE_MULTIBUFFER
386 nano_openprev_msg = _("Open previously loaded file");
387 nano_opennext_msg = _("Open next loaded file");
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000388 nano_multibuffer_msg = _("Toggle insert into new buffer");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000389#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000390#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000391
Chris Allegrettadab017e2002-04-23 10:56:06 +0000392 free_shortcutage(&main_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000393
Chris Allegrettadab017e2002-04-23 10:56:06 +0000394/* The following macro is to be used in calling sc_init_one. The point is
395 * that sc_init_one takes 9 arguments, unless DISABLE_HELP is defined,
396 * when the fourth one should not be there. */
397#ifdef DISABLE_HELP
398# define IFHELP(help, nextvar) nextvar
399#else
400# define IFHELP(help, nextvar) help, nextvar
401#endif
402
403 sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000404 IFHELP(nano_help_msg, 0), NANO_HELP_FKEY, 0, VIEW,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000405 do_help);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000406
Chris Allegretta355fbe52001-07-14 19:32:47 +0000407#ifdef ENABLE_MULTIBUFFER
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000408 if (open_files != NULL && (open_files->prev || open_files->next))
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000409 sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000410 IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000411 do_exit);
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000412 else
413#endif
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000414
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000415 sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000416 IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000417 do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000418
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000419 sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000420 IFHELP(nano_writeout_msg, 0),
421 NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000422
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000423 if (ISSET(PICO_MODE))
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000424 sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000425 IFHELP(nano_justify_msg, 0), NANO_JUSTIFY_FKEY, 0,
Chris Allegretta16e41682000-09-11 22:33:54 +0000426 NOVIEW, do_justify);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000427 else
Chris Allegretta32da4562002-01-02 15:12:21 +0000428
429#ifdef ENABLE_MULTIBUFFER
430 /* this is so we can view multiple files */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000431 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000432 IFHELP(nano_insert_msg, 0),
433 NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
Chris Allegretta32da4562002-01-02 15:12:21 +0000434#else
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000435 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000436 IFHELP(nano_insert_msg, 0),
437 NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
Chris Allegretta32da4562002-01-02 15:12:21 +0000438#endif
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000439
440 if (ISSET(PICO_MODE))
Chris Allegretta32da4562002-01-02 15:12:21 +0000441#ifdef ENABLE_MULTIBUFFER
442 /* this is so we can view multiple files */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000443 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000444 IFHELP(nano_insert_msg, 0),
445 NANO_INSERTFILE_FKEY, 0, VIEW, do_insertfile_void);
Chris Allegretta32da4562002-01-02 15:12:21 +0000446#else
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000447 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000448 IFHELP(nano_insert_msg, 0),
449 NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile_void);
Chris Allegretta32da4562002-01-02 15:12:21 +0000450#endif
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000451 else
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000452 sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000453 IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
454 NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000455
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000456 sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000457 IFHELP(nano_whereis_msg, 0),
458 NANO_WHEREIS_FKEY, 0, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000459
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000460 sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000461 IFHELP(nano_prevpage_msg, 0),
462 NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000463
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000464 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000465 IFHELP(nano_nextpage_msg, 0),
466 NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000467
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000468 sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000469 IFHELP(nano_cut_msg, 0),
470 NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000471
Chris Allegretta07798352000-11-27 22:58:23 +0000472 if (unjustify)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000473 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000474 IFHELP(nano_unjustify_msg, 0),
475 0, 0, NOVIEW, do_uncut_text);
Chris Allegretta07798352000-11-27 22:58:23 +0000476 else
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000477 sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000478 IFHELP(nano_uncut_msg, 0),
479 NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000480
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000481 sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000482 IFHELP(nano_cursorpos_msg, 0),
483 NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000484
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000485 sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000486 IFHELP(nano_spell_msg, 0),
487 NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000488
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000489 sc_init_one(&main_list, NANO_UP_KEY, _("Up"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000490 IFHELP(nano_up_msg, 0),
491 KEY_UP, 0, VIEW, do_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000492
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000493 sc_init_one(&main_list, NANO_DOWN_KEY, _("Down"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000494 IFHELP(nano_down_msg, 0),
495 KEY_DOWN, 0, VIEW, do_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000496
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000497 sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000498 IFHELP(nano_forward_msg, 0),
499 KEY_RIGHT, 0, VIEW, do_right);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000500
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000501 sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000502 IFHELP(nano_back_msg, 0),
503 KEY_LEFT, 0, VIEW, do_left);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000504
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000505 sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000506 IFHELP(nano_home_msg, 0),
507 KEY_HOME, 362, VIEW, do_home);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000508
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000509 sc_init_one(&main_list, NANO_END_KEY, _("End"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000510 IFHELP(nano_end_msg, 0),
511 KEY_END, 385, VIEW, do_end);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000512
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000513 sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000514 IFHELP(nano_refresh_msg, 0),
515 0, 0, VIEW, total_refresh);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000516
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000517 sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000518 IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
519 0, 0, NOVIEW, do_mark);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000520
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000521 sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000522 IFHELP(nano_delete_msg, 0), KEY_DC,
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000523 NANO_CONTROL_D, NOVIEW, do_delete);
524
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000525 sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000526 IFHELP(nano_backspace_msg, 0),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000527 KEY_BACKSPACE, 127, NOVIEW, do_backspace);
528
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000529 sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000530 IFHELP(nano_tab_msg, 0), 0, 0, NOVIEW, do_tab);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000531
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000532 if (ISSET(PICO_MODE))
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000533 sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000534 IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
535 NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000536 else
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000537 sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000538 IFHELP(nano_justify_msg, 0),
539 NANO_JUSTIFY_FKEY, 0, NOVIEW, do_justify);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000540
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000541 sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000542 IFHELP(nano_enter_msg, 0),
Chris Allegretta6df90f52002-07-19 01:08:59 +0000543 KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000544
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000545 sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000546 IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
547 NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000548
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000549#ifndef NANO_SMALL
550 sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
551 IFHELP(_("Move forward one word"), 0),
Chris Allegretta6df90f52002-07-19 01:08:59 +0000552 0, 0, VIEW, do_next_word);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000553
554 sc_init_one(&main_list, -9, _("Prev Word"),
555 IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
Chris Allegretta6df90f52002-07-19 01:08:59 +0000556 VIEW, do_prev_word);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000557#endif
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000558#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000559 sc_init_one(&main_list, -9, _("Find Other Bracket"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000560 IFHELP(nano_bracket_msg, NANO_BRACKET_KEY),
561 0, 0, VIEW, do_find_bracket);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000562#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000563#ifdef ENABLE_MULTIBUFFER
564 sc_init_one(&main_list, -9, _("Previous File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000565 IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY),
566 0, 0, VIEW, open_prevfile_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000567 sc_init_one(&main_list, -9, _("Next File"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000568 IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY),
569 0, 0, VIEW, open_nextfile_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000570#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000571
Chris Allegrettadab017e2002-04-23 10:56:06 +0000572 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000573
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000574 sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
575 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000576
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000577 sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
578 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000579
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000580 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000581 IFHELP(nano_firstline_msg, 0),
582 0, 0, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000583
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000584 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000585 IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000586
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000587 sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000588 IFHELP(nano_replace_msg, 0), 0, 0, VIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000589
Chris Allegrettad865da12002-07-29 23:46:38 +0000590 sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000591 IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000592
Chris Allegretta5f36c372001-07-16 00:48:53 +0000593#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000594 sc_init_one(&whereis_list, TOGGLE_CASE_KEY, _("Case Sens"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000595 IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000596
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000597 sc_init_one(&whereis_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000598 IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000599
Chris Allegretta658399a2001-06-14 02:54:22 +0000600#ifdef HAVE_REGEX_H
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000601 sc_init_one(&whereis_list, TOGGLE_REGEXP_KEY, _("Regexp"),
602 IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000603#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000604#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000605
Chris Allegrettadab017e2002-04-23 10:56:06 +0000606 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000607
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000608 sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
609 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000610
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000611 sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
612 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000613
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000614 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000615 IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000616
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000617 sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000618 IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000619
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000620 sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000621 IFHELP(nano_whereis_msg, 0), 0, 0, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000622
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000623 sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000624 IFHELP(nano_goto_msg, 0), 0, 0, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000625
Chris Allegretta5f36c372001-07-16 00:48:53 +0000626#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000627 sc_init_one(&replace_list, TOGGLE_CASE_KEY, _("Case Sens"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000628 IFHELP(nano_case_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000629
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000630 sc_init_one(&replace_list, TOGGLE_BACKWARDS_KEY, _("Direction"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000631 IFHELP(nano_reverse_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000632
Chris Allegretta658399a2001-06-14 02:54:22 +0000633#ifdef HAVE_REGEX_H
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000634 sc_init_one(&replace_list, TOGGLE_REGEXP_KEY, _("Regexp"),
635 IFHELP(nano_regexp_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000636#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000637#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000638
Chris Allegrettadab017e2002-04-23 10:56:06 +0000639 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000640
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000641 sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
642 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000643
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000644 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
645 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000646
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000647 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000648 IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000649
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000650 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000651 IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000652
Chris Allegrettadab017e2002-04-23 10:56:06 +0000653 free_shortcutage(&goto_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000654
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000655 sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
656 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000657
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000658 sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000659 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000660
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000661 sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
Chris Allegretta6df90f52002-07-19 01:08:59 +0000662 IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000663
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000664 sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
Chris Allegretta6df90f52002-07-19 01:08:59 +0000665 IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000666
Chris Allegrettadab017e2002-04-23 10:56:06 +0000667 free_shortcutage(&help_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000668
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000669 sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000670 IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
671 KEY_PPAGE, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000672
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000673 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000674 IFHELP(nano_nextpage_msg, 0),
675 NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000676
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000677 sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000678 IFHELP(nano_exit_msg, 0), NANO_EXIT_FKEY, 0, VIEW,
679 do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000680
Chris Allegrettadab017e2002-04-23 10:56:06 +0000681 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000682
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000683 sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
684 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000685
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000686#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000687 sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000688 IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000689#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000690
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000691#ifndef NANO_SMALL
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000692 sc_init_one(&writefile_list, TOGGLE_DOS_KEY, _("DOS Format"),
693 IFHELP(nano_dos_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000694
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000695 sc_init_one(&writefile_list, TOGGLE_MAC_KEY, _("Mac Format"),
696 IFHELP(nano_mac_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000697#endif
698
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000699 sc_init_one(&writefile_list, NANO_APPEND_KEY, _("Append"),
700 IFHELP(nano_append_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000701
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000702 sc_init_one(&writefile_list, NANO_PREPEND_KEY, _("Prepend"),
703 IFHELP(nano_prepend_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000704
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000705#ifndef NANO_SMALL
706 sc_init_one(&writefile_list, TOGGLE_BACKUP_KEY, _("Backup File"),
707 IFHELP(nano_backup_msg, 0), 0, 0, NOVIEW, 0);
708#endif
709
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000710 sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
711 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000712
Chris Allegrettadab017e2002-04-23 10:56:06 +0000713 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000714
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000715 sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
716 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000717
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000718 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000719 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000720
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000721#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000722 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000723 IFHELP(nano_tofiles_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000724#endif
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000725#ifndef NANO_SMALL
726 sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000727 IFHELP(nano_execute_msg, 0), 0, 0, NOVIEW, 0);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000728#endif
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000729#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000730 sc_init_one(&insertfile_list, NANO_LOAD_KEY, _("New Buffer"),
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000731 IFHELP(nano_multibuffer_msg, 0), 0, 0, NOVIEW, 0);
732#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000733
Chris Allegrettadab017e2002-04-23 10:56:06 +0000734 free_shortcutage(&spell_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000735
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000736 sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
737 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000738
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000739 sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000740 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000741
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000742#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000743 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000744
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000745 sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
746 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000747
748 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000749 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000750#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000751
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000752#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000753 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000754
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000755 sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
756 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000757
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000758 sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
759 IFHELP(nano_cancel_msg, 0), NANO_EXIT_FKEY, 0, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000760
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000761 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000762 IFHELP(nano_prevpage_msg, 0), NANO_PREVPAGE_FKEY,
763 KEY_PPAGE, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000764
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000765 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000766 IFHELP(nano_nextpage_msg, 0), NANO_NEXTPAGE_FKEY,
767 KEY_NPAGE, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000768
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000769 sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000770 IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY),
771 NANO_GOTO_FKEY, 0, VIEW, 0);
Rocco Corsi12f294c2001-04-14 06:50:24 +0000772
Chris Allegrettadab017e2002-04-23 10:56:06 +0000773 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000774
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000775 sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
776 IFHELP(nano_help_msg, 0), 0, 0, VIEW, do_help);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000777
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000778 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000779 IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000780#endif
781
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000782#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined (DISABLE_HELP)
783 currshortcut = main_list;
784#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000785#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000786 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000787#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000788}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000789
Chris Allegretta6232d662002-05-12 19:52:15 +0000790/* This function is called just before calling exit(). Practically, the
791 * only effect is to cause a segmentation fault if the various data
792 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +0000793 * function unless debugging is turned on. */
Chris Allegretta6232d662002-05-12 19:52:15 +0000794#ifdef DEBUG
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000795/* added by SPK for memory cleanup, gracefully return our malloc()s */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000796void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000797{
Chris Allegretta2598c662002-03-28 01:59:34 +0000798#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000799 if (operating_dir != NULL)
800 free(operating_dir);
801 if (full_operating_dir != NULL)
802 free(full_operating_dir);
803#endif
804 if (last_search != NULL)
805 free(last_search);
806 if (last_replace != NULL)
807 free(last_replace);
808 if (hblank != NULL)
809 free(hblank);
810#ifndef DISABLE_SPELLER
811 if (alt_speller != NULL)
812 free(alt_speller);
813#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000814#ifndef DISABLE_HELP
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000815 if (help_text != NULL)
816 free(help_text);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000817#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000818 if (filename != NULL)
819 free(filename);
820 if (answer != NULL)
821 free(answer);
822 if (cutbuffer != NULL)
823 free_filestruct(cutbuffer);
824
825 free_shortcutage(&main_list);
826 free_shortcutage(&whereis_list);
827 free_shortcutage(&replace_list);
828 free_shortcutage(&replace_list_2);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000829 free_shortcutage(&goto_list);
830 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000831 free_shortcutage(&writefile_list);
832 free_shortcutage(&insertfile_list);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000833 free_shortcutage(&help_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000834 free_shortcutage(&spell_list);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000835#ifndef NANO_SMALL
836 free_shortcutage(&extcmd_list);
837#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000838#ifndef DISABLE_BROWSER
839 free_shortcutage(&browser_list);
840#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000841
842#ifndef NANO_SMALL
843 free_toggles();
844#endif
845
846#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000847 if (open_files != NULL) {
Chris Allegretta6232d662002-05-12 19:52:15 +0000848 /* We free the memory associated with each open file. */
Chris Allegretta6232d662002-05-12 19:52:15 +0000849 while (open_files->prev != NULL)
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000850 open_files = open_files->prev;
Chris Allegretta6df90f52002-07-19 01:08:59 +0000851 free_openfilestruct(open_files);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000852 }
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000853#else
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000854 if (fileage != NULL)
Chris Allegrettaf2387fb2002-04-10 02:31:20 +0000855 free_filestruct(fileage);
856#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000857
858#ifdef ENABLE_COLOR
859 free(syntaxstr);
860 while (syntaxes != NULL) {
861 syntaxtype *bill = syntaxes;
862
863 free(syntaxes->desc);
864 while (syntaxes->extensions != NULL) {
865 exttype *bob = syntaxes->extensions;
866
867 syntaxes->extensions = bob->next;
868 free(bob->val);
869 free(bob);
870 }
871 while (syntaxes->color != NULL) {
872 colortype *bob = syntaxes->color;
873
874 syntaxes->color = bob->next;
875 free(bob->start);
876 free(bob->end);
877 free(bob);
878 }
879 syntaxes = syntaxes->next;
880 free(bill);
881 }
882#endif /* ENABLE_COLOR */
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000883}
Chris Allegretta6232d662002-05-12 19:52:15 +0000884#endif /* DEBUG */