blob: cd27a725e6c3025aed6e0bcfbd9b0e9041015a3b [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * global.c *
4 * *
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +00005 * Copyright (C) 1999-2004 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 Allegretta1dd0bc92002-10-13 18:43:45 +000024#include <stdlib.h>
Chris Allegrettadab017e2002-04-23 10:56:06 +000025#include <assert.h>
Chris Allegretta6efda542001-04-28 18:03:52 +000026#include <sys/stat.h>
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000027#include "proto.h"
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000028#include "nano.h"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000029
Chris Allegretta7662c862003-01-13 01:35:15 +000030/* Global variables */
Chris Allegretta48b06702002-02-22 04:30:50 +000031
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000032#ifndef DISABLE_WRAPJUSTIFY
Chris Allegretta6df90f52002-07-19 01:08:59 +000033/* wrap_at might be set in rcfile.c or nano.c */
34int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000035#endif
36
Chris Allegretta6df90f52002-07-19 01:08:59 +000037char *last_search = NULL; /* Last string we searched for */
38char *last_replace = NULL; /* Last replacement string */
39int search_last_line; /* Is this the last search line? */
Chris Allegretta7662c862003-01-13 01:35:15 +000040int search_offscreen; /* Search lines not displayed */
Chris Allegretta6df90f52002-07-19 01:08:59 +000041
Chris Allegretta88520c92001-05-05 17:45:54 +000042int flags = 0; /* Our new flag containing many options */
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000043WINDOW *edit; /* The file portion of the editor */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000044WINDOW *topwin; /* Top line of screen */
45WINDOW *bottomwin; /* Bottom buffer */
Chris Allegretta1a6e9042000-12-14 13:56:28 +000046char *filename = NULL; /* Name of the file */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000047
48#ifndef NANO_SMALL
49struct stat originalfilestat; /* Stat for the file as we loaded it */
50#endif
51
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000052int editwinrows = 0; /* How many rows long is the edit
53 window? */
54filestruct *current; /* Current buffer pointer */
55int current_x = 0, current_y = 0; /* Current position of X and Y in
56 the editor - relative to edit
57 window (0,0) */
58filestruct *fileage = NULL; /* Our file buffer */
59filestruct *edittop = NULL; /* Pointer to the top of the edit
60 buffer with respect to the
61 file struct */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000062filestruct *filebot = NULL; /* Last node in the file struct */
63filestruct *cutbuffer = NULL; /* A place to store cut text */
64
Chris Allegretta355fbe52001-07-14 19:32:47 +000065#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +000066openfilestruct *open_files = NULL; /* The list of open files */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000067#endif
68
Chris Allegrettae4f940d2002-03-03 22:36:36 +000069#ifndef DISABLE_JUSTIFY
Chris Allegretta7662c862003-01-13 01:35:15 +000070char *quotestr = NULL; /* Quote string. The default value is
71 set in main(). */
Chris Allegretta6df90f52002-07-19 01:08:59 +000072#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000073
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +000074#ifndef NANO_SMALL
75char *backup_dir = NULL; /* Backup directory. */
76#endif
77
Chris Allegretta65f075d2003-02-13 03:03:49 +000078int resetstatuspos; /* Hack for resetting the status bar
79 cursor position */
Chris Allegretta6df90f52002-07-19 01:08:59 +000080char *answer = NULL; /* Answer str to many questions */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000081int totlines = 0; /* Total number of lines in the file */
Chris Allegrettab3655b42001-10-22 03:15:31 +000082long totsize = 0; /* Total number of bytes in the file */
Chris Allegretta88520c92001-05-05 17:45:54 +000083int placewewant = 0; /* The column we'd like the cursor
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000084 to jump to when we go to the
85 next or previous line */
86
Chris Allegretta7662c862003-01-13 01:35:15 +000087int tabsize = -1; /* Our internal tabsize variable. The
88 default value 8 is set in main(). */
Chris Allegretta6d690a32000-08-03 22:51:21 +000089
Chris Allegretta7662c862003-01-13 01:35:15 +000090char *hblank = NULL; /* A horizontal blank line */
Chris Allegretta6df90f52002-07-19 01:08:59 +000091#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000092char *help_text; /* The text in the help window */
Chris Allegretta6df90f52002-07-19 01:08:59 +000093#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000094
95/* More stuff for the marker select */
96
Chris Allegretta7662c862003-01-13 01:35:15 +000097#ifndef NANO_SMALL
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +000098filestruct *mark_beginbuf; /* The begin marker buffer */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000099int mark_beginx; /* X value in the string to start */
Chris Allegretta7662c862003-01-13 01:35:15 +0000100#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000101
Chris Allegrettae1f14522001-09-19 03:19:43 +0000102#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000103char *operating_dir = NULL; /* Operating directory, which we can't */
104char *full_operating_dir = NULL;/* go higher than */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000105#endif
106
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000107#ifndef DISABLE_SPELLER
Chris Allegretta7c27be42002-05-05 23:03:54 +0000108char *alt_speller = NULL; /* Alternative spell command */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000109#endif
110
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000111shortcut *main_list = NULL;
112shortcut *whereis_list = NULL;
113shortcut *replace_list = NULL;
Chris Allegretta48b06702002-02-22 04:30:50 +0000114shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000115shortcut *goto_list = NULL;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000116shortcut *writefile_list = NULL;
117shortcut *insertfile_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000118#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000119shortcut *help_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000120#endif
121#ifndef DISABLE_SPELLER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000122shortcut *spell_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000123#endif
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000124#ifndef NANO_SMALL
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000125shortcut *extcmd_list = NULL;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000126#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000127#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000128shortcut *browser_list = NULL;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000129shortcut *gotodir_list = NULL;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000130#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000131
Chris Allegretta8ce24132001-04-30 11:28:46 +0000132#ifdef ENABLE_COLOR
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000133const colortype *colorstrings = NULL;
134syntaxtype *syntaxes = NULL;
135char *syntaxstr = NULL;
Chris Allegretta8ce24132001-04-30 11:28:46 +0000136#endif
137
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000138#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
Chris Allegretta6df90f52002-07-19 01:08:59 +0000139const shortcut *currshortcut; /* Current shortcut list we're using */
Chris Allegretta6fe61492001-05-21 12:56:25 +0000140#endif
Chris Allegretta6b58acd2001-04-12 03:01:53 +0000141
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000142#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000143toggle *toggles = NULL;
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000144#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000145
Chris Allegretta5beed502003-01-05 20:41:21 +0000146#ifndef NANO_SMALL
147historyheadtype search_history;
148historyheadtype replace_history;
149#endif
150
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000151/* Regular expressions */
152
Chris Allegretta805c26d2000-09-06 13:39:17 +0000153#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000154regex_t search_regexp; /* Global to store compiled search regexp */
155regmatch_t regmatches[10]; /* Match positions for parenthetical
156 subexpressions, max of 10 */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000157#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000158
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000159int curses_ended = FALSE; /* Indicates to statusbar() to simply
160 * write to stderr, since endwin() has
161 * ended curses mode. */
162
163
David Lawrence Ramsey221ebcd2004-03-05 20:47:15 +0000164int length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000165{
166 int i = 0;
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000167
Chris Allegrettadab017e2002-04-23 10:56:06 +0000168 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000169 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000170 return i;
171}
172
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000173/* Initialize a struct *without* our lovely braces =( */
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000174void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000175#ifndef DISABLE_HELP
Chris Allegrettaf717f982003-02-13 22:25:01 +0000176 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000177#endif
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000178 int metaval, int funcval, int miscval, int view, int
179 (*func)(void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000180{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000181 shortcut *s;
182
183 if (*shortcutage == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000184 *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000185 s = *shortcutage;
186 } else {
187 for (s = *shortcutage; s->next != NULL; s = s->next)
188 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000189 s->next = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000190 s = s->next;
191 }
192
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000193 s->ctrlval = ctrlval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000194 s->desc = desc;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000195#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000196 s->help = help;
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000197#endif
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000198 s->metaval = metaval;
199 s->funcval = funcval;
200 s->miscval = miscval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000201 s->viewok = view;
202 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000203 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000204}
205
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000206#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000207/* Create one new toggle structure, at the end of the toggles
208 * linked list. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000209void toggle_init_one(int val, const char *desc, int flag)
Chris Allegretta756f2202000-09-01 13:32:47 +0000210{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000211 toggle *u;
212
213 if (toggles == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000214 toggles = (toggle *)nmalloc(sizeof(toggle));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000215 u = toggles;
216 } else {
217 for (u = toggles; u->next != NULL; u = u->next)
218 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000219 u->next = (toggle *)nmalloc(sizeof(toggle));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000220 u = u->next;
221 }
222
223 u->val = val;
224 u->desc = desc;
225 u->flag = flag;
226 u->next = NULL;
Chris Allegretta756f2202000-09-01 13:32:47 +0000227}
228
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000229void toggle_init(void)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000230{
Chris Allegretta756f2202000-09-01 13:32:47 +0000231 char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
Chris Allegretta15c28f82003-01-05 21:47:06 +0000232 *toggle_nohelp_msg, *toggle_cuttoend_msg,
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000233 *toggle_noconvert_msg, *toggle_dos_msg, *toggle_mac_msg,
234 *toggle_backup_msg, *toggle_smooth_msg;
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000235#ifndef DISABLE_MOUSE
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000236 char *toggle_mouse_msg;
237#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000238#ifndef DISABLE_WRAPPING
239 char *toggle_wrap_msg;
240#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000241#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000242 char *toggle_multibuffer_msg;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000243#endif
Chris Allegretta1dd0bc92002-10-13 18:43:45 +0000244#ifdef ENABLE_COLOR
245 char *toggle_syntax_msg;
246#endif
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000247
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000248 /* There is no need to reinitialize the toggles. They can't
Chris Allegretta7662c862003-01-13 01:35:15 +0000249 change. */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000250 if (toggles != NULL)
251 return;
252
Chris Allegretta756f2202000-09-01 13:32:47 +0000253 toggle_const_msg = _("Constant cursor position");
Chris Allegrettaf8163dc2000-09-03 01:06:40 +0000254 toggle_autoindent_msg = _("Auto indent");
Chris Allegretta756f2202000-09-01 13:32:47 +0000255 toggle_suspend_msg = _("Suspend");
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000256 toggle_nohelp_msg = _("Help mode");
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000257#ifndef DISABLE_MOUSE
Chris Allegretta756f2202000-09-01 13:32:47 +0000258 toggle_mouse_msg = _("Mouse support");
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000259#endif
Chris Allegretta756f2202000-09-01 13:32:47 +0000260 toggle_cuttoend_msg = _("Cut to end");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000261 toggle_noconvert_msg = _("No conversion from DOS/Mac format");
Chris Allegretta7004c282001-09-22 00:42:10 +0000262 toggle_dos_msg = _("Writing file in DOS format");
Chris Allegretta995177f2001-09-22 04:34:23 +0000263 toggle_mac_msg = _("Writing file in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000264 toggle_backup_msg = _("Backing up file");
Chris Allegretta3e3ae942001-09-22 19:02:04 +0000265 toggle_smooth_msg = _("Smooth scrolling");
Chris Allegretta1dd0bc92002-10-13 18:43:45 +0000266#ifdef ENABLE_COLOR
267 toggle_syntax_msg = _("Color syntax highlighting");
268#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +0000269#ifndef DISABLE_WRAPPING
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000270 toggle_wrap_msg = _("Auto line wrap");
Chris Allegretta6df90f52002-07-19 01:08:59 +0000271#endif
Chris Allegretta355fbe52001-07-14 19:32:47 +0000272#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000273 toggle_multibuffer_msg = _("Multiple file buffers");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000274#endif
275
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000276 toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
277#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000278 if (!ISSET(RESTRICTED))
279 toggle_init_one(TOGGLE_MULTIBUFFER_KEY, toggle_multibuffer_msg, MULTIBUFFER);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000280#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000281 toggle_init_one(TOGGLE_CONST_KEY, toggle_const_msg, CONSTUPDATE);
282 toggle_init_one(TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg, AUTOINDENT);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000283#ifndef DISABLE_WRAPPING
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000284 toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000285#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000286 toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000287 if (!ISSET(RESTRICTED))
288 toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +0000289#ifndef DISABLE_MOUSE
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000290 toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000291#endif
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000292 if (!ISSET(RESTRICTED)) {
293 toggle_init_one(TOGGLE_NOCONVERT_KEY, toggle_noconvert_msg, NO_CONVERT);
294 toggle_init_one(TOGGLE_DOS_KEY, toggle_dos_msg, DOS_FILE);
295 toggle_init_one(TOGGLE_MAC_KEY, toggle_mac_msg, MAC_FILE);
296 toggle_init_one(TOGGLE_BACKUP_KEY, toggle_backup_msg, BACKUP_FILE);
297 }
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000298 toggle_init_one(TOGGLE_SMOOTH_KEY, toggle_smooth_msg, SMOOTHSCROLL);
Chris Allegretta1dd0bc92002-10-13 18:43:45 +0000299#ifdef ENABLE_COLOR
300 toggle_init_one(TOGGLE_SYNTAX_KEY, toggle_syntax_msg, COLOR_SYNTAX);
301#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000302}
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000303
304#ifdef DEBUG
305/* Deallocate all of the toggles. */
306void free_toggles(void)
307{
308 while (toggles != NULL) {
309 toggle *pt = toggles; /* Think "previous toggle" */
310
311 toggles = toggles->next;
312 free(pt);
313 }
314}
315#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000316#endif /* !NANO_SMALL */
Chris Allegrettadab017e2002-04-23 10:56:06 +0000317
Chris Allegrettadab017e2002-04-23 10:56:06 +0000318/* Deallocate the given shortcut. */
David Lawrence Ramsey0341b582002-08-21 16:10:37 +0000319void free_shortcutage(shortcut **shortcutage)
Chris Allegrettadab017e2002-04-23 10:56:06 +0000320{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000321 assert(shortcutage != NULL);
Chris Allegretta6df90f52002-07-19 01:08:59 +0000322 while (*shortcutage != NULL) {
323 shortcut *ps = *shortcutage;
324 *shortcutage = (*shortcutage)->next;
Chris Allegrettadab017e2002-04-23 10:56:06 +0000325 free(ps);
326 }
Chris Allegretta756f2202000-09-01 13:32:47 +0000327}
328
Chris Allegretta07798352000-11-27 22:58:23 +0000329void shortcut_init(int unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000330{
Chris Allegrettadab017e2002-04-23 10:56:06 +0000331#ifndef DISABLE_HELP
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000332 const char *nano_help_msg = "", *nano_writeout_msg =
333 "", *nano_exit_msg = "", *nano_goto_msg =
334 "", *nano_justify_msg = "", *nano_replace_msg =
335 "", *nano_insert_msg = "", *nano_whereis_msg =
336 "", *nano_whereis_next_msg = "", *nano_prevpage_msg =
337 "", *nano_nextpage_msg = "", *nano_cut_msg =
338 "", *nano_uncut_msg = "", *nano_cursorpos_msg =
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000339 "", *nano_spell_msg = "", *nano_prevline_msg =
340 "", *nano_nextline_msg = "", *nano_forward_msg =
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000341 "", *nano_back_msg = "", *nano_home_msg =
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000342 "", *nano_end_msg = "", *nano_firstline_msg =
343 "", *nano_lastline_msg = "", *nano_refresh_msg =
344 "", *nano_mark_msg = "", *nano_delete_msg =
345 "", *nano_backspace_msg = "", *nano_tab_msg =
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000346 "", *nano_enter_msg = "", *nano_prevword_msg =
347 "", *nano_nextword_msg = "", *nano_verbatim_msg =
348 "", *nano_cancel_msg = "", *nano_unjustify_msg =
349 "", *nano_append_msg = "", *nano_prepend_msg =
350 "", *nano_tofiles_msg = "", *nano_gotodir_msg =
351 "", *nano_case_msg = "", *nano_reverse_msg =
352 "", *nano_execute_msg = "", *nano_dos_msg =
353 "", *nano_mac_msg = "", *nano_backup_msg =
354 "", *nano_editstr_msg = "", *nano_parabegin_msg =
355 "", *nano_paraend_msg = "";
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000356
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000357#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf717f982003-02-13 22:25:01 +0000358 const char *nano_openprev_msg = "", *nano_opennext_msg =
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +0000359 "", *nano_multibuffer_msg = "";
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000360#endif
Chris Allegretta2bef1822001-09-28 19:53:11 +0000361#ifdef HAVE_REGEX_H
Chris Allegrettaf717f982003-02-13 22:25:01 +0000362 const char *nano_regexp_msg = "", *nano_bracket_msg = "";
Chris Allegretta2bef1822001-09-28 19:53:11 +0000363#endif
Chris Allegretta6636dc32001-01-05 05:41:07 +0000364
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000365 nano_help_msg = _("Invoke the help menu");
366 nano_writeout_msg = _("Write the current file to disk");
Chris Allegretta355fbe52001-07-14 19:32:47 +0000367#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaaad3af2003-08-31 16:44:10 +0000368 nano_exit_msg = _("Close current file buffer/Exit from nano");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000369#else
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000370 nano_exit_msg = _("Exit from nano");
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000371#endif
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000372 nano_goto_msg = _("Go to a specific line number");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000373 nano_justify_msg = _("Justify the current paragraph");
Chris Allegretta07798352000-11-27 22:58:23 +0000374 nano_unjustify_msg = _("Unjustify after a justify");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000375 nano_replace_msg = _("Replace text within the editor");
376 nano_insert_msg = _("Insert another file into the current one");
377 nano_whereis_msg = _("Search for text within the editor");
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000378 nano_whereis_next_msg = _("Repeat last search");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000379 nano_prevpage_msg = _("Move to the previous screen");
380 nano_nextpage_msg = _("Move to the next screen");
381 nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
382 nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
Chris Allegretta88520c92001-05-05 17:45:54 +0000383 nano_cursorpos_msg = _("Show the position of the cursor");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000384 nano_spell_msg = _("Invoke the spell checker, if available");
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000385 nano_prevline_msg = _("Move to the previous line");
386 nano_nextline_msg = _("Move to the next line");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000387 nano_forward_msg = _("Move forward one character");
388 nano_back_msg = _("Move back one character");
389 nano_home_msg = _("Move to the beginning of the current line");
390 nano_end_msg = _("Move to the end of the current line");
391 nano_firstline_msg = _("Go to the first line of the file");
392 nano_lastline_msg = _("Go to the last line of the file");
393 nano_refresh_msg = _("Refresh (redraw) the current screen");
394 nano_mark_msg = _("Mark text at the current cursor location");
395 nano_delete_msg = _("Delete the character under the cursor");
396 nano_backspace_msg =
397 _("Delete the character to the left of the cursor");
398 nano_tab_msg = _("Insert a tab character");
399 nano_enter_msg = _("Insert a carriage return at the cursor position");
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000400 nano_prevword_msg = _("Move backward one word");
401 nano_nextword_msg = _("Move forward one word");
402 nano_verbatim_msg = _("Insert character(s) verbatim");
403 nano_enter_msg = _("Insert a carriage return at the cursor position");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000404 nano_case_msg =
405 _("Make the current search or replace case (in)sensitive");
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000406 nano_tofiles_msg = _("Go to file browser");
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000407 nano_execute_msg = _("Execute external command");
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000408 nano_gotodir_msg = _("Go to directory");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000409 nano_cancel_msg = _("Cancel the current function");
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000410 nano_append_msg = _("Append to the current file");
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000411 nano_prepend_msg = _("Prepend to the current file");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000412 nano_reverse_msg = _("Search backwards");
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000413 nano_dos_msg = _("Write file out in DOS format");
414 nano_mac_msg = _("Write file out in Mac format");
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000415 nano_backup_msg = _("Back up original file when saving");
Chris Allegretta5beed502003-01-05 20:41:21 +0000416 nano_editstr_msg = _("Edit the previous search/replace strings");
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000417 nano_parabegin_msg = _("Go to the beginning of the current paragraph");
418 nano_paraend_msg = _("Go to the end of the current paragraph");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000419#ifdef HAVE_REGEX_H
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000420 nano_regexp_msg = _("Use regular expressions");
Chris Allegretta8d990b52001-09-22 22:14:25 +0000421 nano_bracket_msg = _("Find other bracket");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000422#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000423#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyaaad3af2003-08-31 16:44:10 +0000424 nano_openprev_msg = _("Switch to previous file buffer");
425 nano_opennext_msg = _("Switch to next file buffer");
David Lawrence Ramseycb7ee0e2003-08-31 17:08:59 +0000426 nano_multibuffer_msg = _("Toggle insert into new file buffer");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000427#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000428#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000429
Chris Allegrettadab017e2002-04-23 10:56:06 +0000430 free_shortcutage(&main_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000431
David Lawrence Ramsey8e4adcd2004-05-20 03:29:33 +0000432/* The following macro is to be used in calling sc_init_one(). The
433 * point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
434 * defined, when the 4th one should not be there. */
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000435#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000436# define IFHELP(help, nextvar) help, nextvar
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000437#else
438# define IFHELP(help, nextvar) nextvar
Chris Allegrettadab017e2002-04-23 10:56:06 +0000439#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000440
Jordi Mallachf9390af2003-08-05 19:31:12 +0000441 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettadab017e2002-04-23 10:56:06 +0000442 sc_init_one(&main_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000443 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000444 NANO_NO_KEY, VIEW,
445#ifndef DISABLE_HELP
446 do_help
447#else
448 nano_disabled_msg
449#endif
450 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000451
Chris Allegretta355fbe52001-07-14 19:32:47 +0000452#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000453 if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
Jordi Mallachf9390af2003-08-05 19:31:12 +0000454 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000455 sc_init_one(&main_list, NANO_EXIT_KEY, _("Close"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000456 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
457 NANO_NO_KEY, VIEW, do_exit);
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000458 else
459#endif
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000460
Jordi Mallachf9390af2003-08-05 19:31:12 +0000461 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000462 sc_init_one(&main_list, NANO_EXIT_KEY, _("Exit"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000463 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
464 NANO_NO_KEY, VIEW, do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000465
Jordi Mallachf9390af2003-08-05 19:31:12 +0000466 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000467 sc_init_one(&main_list, NANO_WRITEOUT_KEY, _("WriteOut"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000468 IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY,
469 NANO_NO_KEY, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000470
Jordi Mallachf9390af2003-08-05 19:31:12 +0000471 /* Translators: try to keep this string under 10 characters long */
Chris Allegretta15c28f82003-01-05 21:47:06 +0000472 sc_init_one(&main_list, NANO_JUSTIFY_KEY, _("Justify"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000473 IFHELP(nano_justify_msg, NANO_NO_KEY),
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000474 NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW,
475#ifndef NANO_SMALL
David Lawrence Ramsey8d3e7f32004-05-13 17:28:03 +0000476 do_justify_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000477#else
478 nano_disabled_msg
479#endif
480 );
Chris Allegretta32da4562002-01-02 15:12:21 +0000481
Chris Allegrettad8451932003-03-11 03:50:40 +0000482 /* this is so we can view multiple files */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000483 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettad8451932003-03-11 03:50:40 +0000484 sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000485 IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY,
486 NANO_NO_KEY,
Chris Allegretta32da4562002-01-02 15:12:21 +0000487#ifdef ENABLE_MULTIBUFFER
Chris Allegrettad8451932003-03-11 03:50:40 +0000488 VIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000489#else
Chris Allegrettad8451932003-03-11 03:50:40 +0000490 NOVIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000491#endif
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000492 , !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000493
Jordi Mallachf9390af2003-08-05 19:31:12 +0000494 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000495 sc_init_one(&main_list, NANO_WHEREIS_KEY, _("Where Is"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000496 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY,
497 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000498
Jordi Mallachf9390af2003-08-05 19:31:12 +0000499 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000500 sc_init_one(&main_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000501 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
502 NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000503
Jordi Mallachf9390af2003-08-05 19:31:12 +0000504 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000505 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000506 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
507 NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000508
Jordi Mallachf9390af2003-08-05 19:31:12 +0000509 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000510 sc_init_one(&main_list, NANO_CUT_KEY, _("Cut Text"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000511 IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY,
512 NANO_NO_KEY, NOVIEW, do_cut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000513
Chris Allegretta07798352000-11-27 22:58:23 +0000514 if (unjustify)
Jordi Mallachf9390af2003-08-05 19:31:12 +0000515 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000516 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, _("UnJustify"),
David Lawrence Ramseyc91696e2004-01-29 04:16:23 +0000517 IFHELP(nano_unjustify_msg, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
David Lawrence Ramseyba7b1682004-02-29 20:07:14 +0000518 NANO_NO_KEY, NOVIEW, 0);
Chris Allegretta07798352000-11-27 22:58:23 +0000519 else
Jordi Mallachf9390af2003-08-05 19:31:12 +0000520 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000521 sc_init_one(&main_list, NANO_UNCUT_KEY, _("UnCut Txt"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000522 IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY,
523 NANO_NO_KEY, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000524
Jordi Mallachf9390af2003-08-05 19:31:12 +0000525 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000526 sc_init_one(&main_list, NANO_CURSORPOS_KEY, _("Cur Pos"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000527 IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY,
528 NANO_NO_KEY, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000529
Jordi Mallachf9390af2003-08-05 19:31:12 +0000530 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000531 sc_init_one(&main_list, NANO_SPELL_KEY, _("To Spell"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000532 IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000533 NANO_NO_KEY, NOVIEW,
534#ifndef DISABLE_SPELLER
535 !ISSET(RESTRICTED) ? do_spell :
536#endif
537 nano_disabled_msg);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000538
539 sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000540 IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
541 NANO_NO_KEY, VIEW, do_gotoline_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000542
543 sc_init_one(&main_list, NANO_REPLACE_KEY, _("Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000544 IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
545 NANO_NO_KEY, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000546
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000547 sc_init_one(&main_list, NANO_PREVLINE_KEY, _("Prev Line"),
548 IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000549 NANO_NO_KEY, VIEW, do_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000550
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000551 sc_init_one(&main_list, NANO_NEXTLINE_KEY, _("Next Line"),
552 IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000553 NANO_NO_KEY, VIEW, do_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000554
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000555 sc_init_one(&main_list, NANO_FORWARD_KEY, _("Forward"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000556 IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
557 NANO_NO_KEY, VIEW, do_right);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000558
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000559 sc_init_one(&main_list, NANO_BACK_KEY, _("Back"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000560 IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
561 NANO_NO_KEY, VIEW, do_left);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000562
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000563 sc_init_one(&main_list, NANO_HOME_KEY, _("Home"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000564 IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
565 NANO_NO_KEY, VIEW, do_home);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000566
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000567 sc_init_one(&main_list, NANO_END_KEY, _("End"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000568 IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
569 NANO_NO_KEY, VIEW, do_end);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000570
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000571 sc_init_one(&main_list, NANO_REFRESH_KEY, _("Refresh"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000572 IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
573 NANO_NO_KEY, VIEW, total_refresh);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000574
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000575 sc_init_one(&main_list, NANO_MARK_KEY, _("Mark Text"),
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000576 IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000577 NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
578#ifndef NANO_SMALL
579 do_mark
580#else
581 nano_disabled_msg
582#endif
583 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000584
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000585 sc_init_one(&main_list, NANO_DELETE_KEY, _("Delete"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000586 IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
587 NANO_NO_KEY, NOVIEW, do_delete);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000588
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000589 sc_init_one(&main_list, NANO_BACKSPACE_KEY, _("Backspace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000590 IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY,
591 NANO_NO_KEY, NOVIEW, do_backspace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000592
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000593 sc_init_one(&main_list, NANO_TAB_KEY, _("Tab"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000594 IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY,
595 NANO_NO_KEY, NOVIEW, do_tab);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000596
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000597 sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000598 IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
599 NANO_NO_KEY, NOVIEW, do_enter);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000600
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000601#ifndef NANO_SMALL
602 sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000603 IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
604 NANO_NO_KEY, VIEW, do_next_word);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000605
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000606 sc_init_one(&main_list, NANO_NO_KEY, _("Prev Word"),
607 IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
608 NANO_NO_KEY, VIEW, do_prev_word);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000609#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000610
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000611 sc_init_one(&main_list, NANO_NO_KEY, _("Verbatim Input"),
612 IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
David Lawrence Ramsey00c20542004-02-01 06:27:59 +0000613 NANO_NO_KEY, NOVIEW, do_verbatim_input);
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000614
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000615#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000616 sc_init_one(&main_list, NANO_NO_KEY, _("Previous File"),
617 IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
618 NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000619
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000620 sc_init_one(&main_list, NANO_NO_KEY, _("Next File"),
621 IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
622 NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000623#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000624
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000625#ifndef NANO_SMALL
626#ifdef HAVE_REGEX_H
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000627 sc_init_one(&main_list, NANO_NO_KEY, _("Find Other Bracket"),
628 IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
629 NANO_NO_KEY, VIEW, do_find_bracket);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000630#endif
631
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000632 sc_init_one(&main_list, NANO_NO_KEY, _("Where Is Next"),
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000633 IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000634 NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
David Lawrence Ramsey5aa39832004-05-05 21:36:50 +0000635#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000636
Chris Allegrettadab017e2002-04-23 10:56:06 +0000637 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000638
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000639 sc_init_one(&whereis_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000640 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000641 NANO_NO_KEY, VIEW,
642#ifndef DISABLE_HELP
643 do_help
644#else
645 nano_disabled_msg
646#endif
647 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000648
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000649 /* Translators: try to keep this string under 10 characters long */
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000650 sc_init_one(&whereis_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000651 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
652 NANO_NO_KEY, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000653
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000654 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000655 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyd7f5ad92004-03-04 19:30:53 +0000656 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000657 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000658
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000659 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000660 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyd7f5ad92004-03-04 19:30:53 +0000661 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000662 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000663
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000664 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000665 sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, _("Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000666 IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
667 NANO_NO_KEY, VIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000668
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000669 /* Translators: try to keep this string under 10 characters long */
Chris Allegrettad865da12002-07-29 23:46:38 +0000670 sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000671 IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
672 NANO_NO_KEY, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000673
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000674#ifndef DISABLE_JUSTIFY
675 /* Translators: try to keep this string under 10 characters long */
676 sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, _("Beg of Par"),
David Lawrence Ramseydc10ecb2004-03-15 20:03:01 +0000677 IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000678 NANO_NO_KEY, VIEW, do_para_begin);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000679
680 /* Translators: try to keep this string under 10 characters long */
681 sc_init_one(&whereis_list, NANO_PARAEND_KEY, _("End of Par"),
David Lawrence Ramseydc10ecb2004-03-15 20:03:01 +0000682 IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000683 NANO_NO_KEY, VIEW, do_para_end);
David Lawrence Ramsey8d3e7f32004-05-13 17:28:03 +0000684
685 /* Translators: try to keep this string under 10 characters long */
686 sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, _("FullJstify"),
687 IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
688 NANO_NO_KEY, VIEW, do_full_justify);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000689#endif
690
Chris Allegretta5f36c372001-07-16 00:48:53 +0000691#ifndef NANO_SMALL
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000692 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000693 sc_init_one(&whereis_list, NANO_NO_KEY, _("Case Sens"),
694 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
695 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000696
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000697 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000698 sc_init_one(&whereis_list, NANO_NO_KEY, _("Direction"),
699 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
700 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000701
Chris Allegretta658399a2001-06-14 02:54:22 +0000702#ifdef HAVE_REGEX_H
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000703 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000704 sc_init_one(&whereis_list, NANO_NO_KEY, _("Regexp"),
705 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
706 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000707#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000708
709#ifndef NANO_SMALL
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000710 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000711 sc_init_one(&whereis_list, NANO_HISTORY_KEY, _("History"),
712 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
713 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5beed502003-01-05 20:41:21 +0000714#endif
715
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000716#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000717
Chris Allegrettadab017e2002-04-23 10:56:06 +0000718 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000719
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000720 sc_init_one(&replace_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000721 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000722 NANO_NO_KEY, VIEW,
723#ifndef DISABLE_HELP
724 do_help
725#else
726 nano_disabled_msg
727#endif
728 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000729
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000730 sc_init_one(&replace_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000731 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
732 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000733
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000734 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000735 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
736 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000737
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000738 sc_init_one(&replace_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000739 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
740 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000741
Jordi Mallachf9390af2003-08-05 19:31:12 +0000742 /* Translators: try to keep this string under 12 characters long */
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000743 sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, _("No Replace"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000744 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
745 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000746
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000747 sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, _("Go To Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000748 IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
749 NANO_NO_KEY, VIEW, do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000750
Chris Allegretta5f36c372001-07-16 00:48:53 +0000751#ifndef NANO_SMALL
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000752 sc_init_one(&replace_list, NANO_NO_KEY, _("Case Sens"),
753 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
754 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000755
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000756 sc_init_one(&replace_list, NANO_NO_KEY, _("Direction"),
757 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
758 NANO_NO_KEY, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000759
Chris Allegretta658399a2001-06-14 02:54:22 +0000760#ifdef HAVE_REGEX_H
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000761 sc_init_one(&replace_list, NANO_NO_KEY, _("Regexp"),
762 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
763 NANO_NO_KEY, VIEW, 0);
Chris Allegretta658399a2001-06-14 02:54:22 +0000764#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000765
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000766 sc_init_one(&replace_list, NANO_HISTORY_KEY, _("History"),
767 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000768 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000769#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000770
Chris Allegrettadab017e2002-04-23 10:56:06 +0000771 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000772
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000773 sc_init_one(&replace_list_2, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000774 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000775 NANO_NO_KEY, VIEW,
776#ifndef DISABLE_HELP
777 do_help
778#else
779 nano_disabled_msg
780#endif
781 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000782
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000783 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000784 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
785 NANO_NO_KEY, VIEW, 0);
Chris Allegretta105da332000-10-31 05:10:10 +0000786
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000787 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000788 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
789 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000790
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000791 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000792 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
793 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000794
Chris Allegretta5beed502003-01-05 20:41:21 +0000795#ifndef NANO_SMALL
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000796 sc_init_one(&replace_list_2, NANO_HISTORY_KEY, _("History"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000797 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramseyc2c5a512004-01-23 19:26:17 +0000798 NANO_NO_KEY, VIEW, 0);
Chris Allegretta5beed502003-01-05 20:41:21 +0000799#endif
800
Chris Allegrettadab017e2002-04-23 10:56:06 +0000801 free_shortcutage(&goto_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000802
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000803 sc_init_one(&goto_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000804 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000805 NANO_NO_KEY, VIEW,
806#ifndef DISABLE_HELP
807 do_help
808#else
809 nano_disabled_msg
810#endif
811 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000812
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000813 sc_init_one(&goto_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000814 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
815 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000816
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000817 sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000818 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
819 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000820
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000821 sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000822 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
823 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000824
Chris Allegretta7662c862003-01-13 01:35:15 +0000825#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000826 free_shortcutage(&help_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000827
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000828 sc_init_one(&help_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000829 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
830 NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000831
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000832 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000833 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
834 NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000835
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000836 sc_init_one(&help_list, NANO_EXIT_KEY, _("Exit"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000837 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
838 NANO_NO_KEY, VIEW, do_exit);
Chris Allegretta7662c862003-01-13 01:35:15 +0000839#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000840
Chris Allegrettadab017e2002-04-23 10:56:06 +0000841 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000842
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000843 sc_init_one(&writefile_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000844 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000845 NANO_NO_KEY, VIEW,
846#ifndef DISABLE_HELP
847 do_help
848#else
849 nano_disabled_msg
850#endif
851 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000852
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000853#ifndef DISABLE_BROWSER
Jordi Mallachf9390af2003-08-05 19:31:12 +0000854 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000855 if (!ISSET(RESTRICTED))
856 sc_init_one(&writefile_list, NANO_TOFILES_KEY, _("To Files"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000857 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
858 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000859#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000860
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000861#ifndef NANO_SMALL
Jordi Mallachf9390af2003-08-05 19:31:12 +0000862 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000863 if (!ISSET(RESTRICTED))
864 sc_init_one(&writefile_list, NANO_NO_KEY, _("DOS Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000865 IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
866 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000867
Jordi Mallachf9390af2003-08-05 19:31:12 +0000868 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000869 if (!ISSET(RESTRICTED))
870 sc_init_one(&writefile_list, NANO_NO_KEY, _("Mac Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000871 IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
872 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000873#endif
874
Jordi Mallachf9390af2003-08-05 19:31:12 +0000875 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000876 if (!ISSET(RESTRICTED))
877 sc_init_one(&writefile_list, NANO_NO_KEY, _("Append"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000878 IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
879 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000880
Jordi Mallachf9390af2003-08-05 19:31:12 +0000881 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000882 if (!ISSET(RESTRICTED))
883 sc_init_one(&writefile_list, NANO_NO_KEY, _("Prepend"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000884 IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
885 NANO_NO_KEY, NOVIEW, 0);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000886
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000887#ifndef NANO_SMALL
Jordi Mallachf9390af2003-08-05 19:31:12 +0000888 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000889 if (!ISSET(RESTRICTED))
890 sc_init_one(&writefile_list, NANO_NO_KEY, _("Backup File"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000891 IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
892 NANO_NO_KEY, NOVIEW, 0);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000893#endif
894
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000895 sc_init_one(&writefile_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000896 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
897 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000898
Chris Allegrettadab017e2002-04-23 10:56:06 +0000899 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000900
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000901 sc_init_one(&insertfile_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000902 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000903 NANO_NO_KEY, VIEW,
904#ifndef DISABLE_HELP
905 do_help
906#else
907 nano_disabled_msg
908#endif
909 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000910
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000911 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000912 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
913 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000914
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000915#ifndef DISABLE_BROWSER
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000916 if (!ISSET(RESTRICTED))
917 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, _("To Files"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000918 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
919 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000920#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000921
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000922#ifndef NANO_SMALL
Jordi Mallachf9390af2003-08-05 19:31:12 +0000923 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000924 if (!ISSET(RESTRICTED))
925 sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, _("Execute Command"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000926 IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
927 NANO_NO_KEY, NOVIEW, 0);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000928
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000929#ifdef ENABLE_MULTIBUFFER
Jordi Mallachf9390af2003-08-05 19:31:12 +0000930 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000931 if (!ISSET(RESTRICTED))
932 sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000933 IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
934 NANO_NO_KEY, NOVIEW, 0);
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000935#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000936#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000937
Chris Allegretta7662c862003-01-13 01:35:15 +0000938#ifndef DISABLE_SPELLER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000939 free_shortcutage(&spell_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000940
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000941 sc_init_one(&spell_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000942 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000943 NANO_NO_KEY, VIEW,
944#ifndef DISABLE_HELP
945 do_help
946#else
947 nano_disabled_msg
948#endif
949 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000950
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000951 sc_init_one(&spell_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000952 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
953 NANO_NO_KEY, VIEW, 0);
Chris Allegretta7662c862003-01-13 01:35:15 +0000954#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000955
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000956#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000957 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000958
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000959 sc_init_one(&extcmd_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000960 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000961 NANO_NO_KEY, VIEW,
962#ifndef DISABLE_HELP
963 do_help
964#else
965 nano_disabled_msg
966#endif
967 );
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000968
969 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000970 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
971 NANO_NO_KEY, VIEW, 0);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000972#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000973
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000974#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000975 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000976
Chris Allegretta6fe98d72002-05-16 23:30:14 +0000977 sc_init_one(&browser_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000978 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000979 NANO_NO_KEY, VIEW,
980#ifndef DISABLE_HELP
981 do_help
982#else
983 nano_disabled_msg
984#endif
985 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000986
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000987 sc_init_one(&browser_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000988 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
989 NANO_NO_KEY, VIEW, 0);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000990
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000991 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, _("Prev Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000992 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
993 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000994
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000995 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, _("Next Page"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000996 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
997 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000998
Jordi Mallachf9390af2003-08-05 19:31:12 +0000999 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyc5967552002-06-21 03:20:06 +00001000 sc_init_one(&browser_list, NANO_GOTO_KEY, _("Go To Dir"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001001 IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
1002 NANO_NO_KEY, VIEW, 0);
Rocco Corsi12f294c2001-04-14 06:50:24 +00001003
Chris Allegrettadab017e2002-04-23 10:56:06 +00001004 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001005
Chris Allegretta6fe98d72002-05-16 23:30:14 +00001006 sc_init_one(&gotodir_list, NANO_HELP_KEY, _("Get Help"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001007 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001008 NANO_NO_KEY, VIEW,
1009#ifndef DISABLE_HELP
1010 do_help
1011#else
1012 nano_disabled_msg
1013#endif
1014 );
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001015
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001016 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, _("Cancel"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +00001017 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
1018 NANO_NO_KEY, VIEW, 0);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001019#endif
1020
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +00001021#if !defined(DISABLE_BROWSER) || !defined(DISABLE_HELP) || !defined(DISABLE_MOUSE)
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001022 currshortcut = main_list;
1023#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001024#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +00001025 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001026#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +00001027}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001028
Chris Allegretta6232d662002-05-12 19:52:15 +00001029/* This function is called just before calling exit(). Practically, the
1030 * only effect is to cause a segmentation fault if the various data
1031 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +00001032 * function unless debugging is turned on. */
Chris Allegretta6232d662002-05-12 19:52:15 +00001033#ifdef DEBUG
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001034/* added by SPK for memory cleanup, gracefully return our malloc()s */
Chris Allegretta6df90f52002-07-19 01:08:59 +00001035void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001036{
Chris Allegretta7662c862003-01-13 01:35:15 +00001037#ifndef DISABLE_JUSTIFY
1038 if (quotestr != NULL)
1039 free(quotestr);
1040#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +00001041#ifndef NANO_SMALL
1042 if (backup_dir != NULL)
1043 free(backup_dir);
1044#endif
Chris Allegretta2598c662002-03-28 01:59:34 +00001045#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001046 if (operating_dir != NULL)
1047 free(operating_dir);
1048 if (full_operating_dir != NULL)
1049 free(full_operating_dir);
1050#endif
1051 if (last_search != NULL)
1052 free(last_search);
1053 if (last_replace != NULL)
1054 free(last_replace);
1055 if (hblank != NULL)
1056 free(hblank);
1057#ifndef DISABLE_SPELLER
1058 if (alt_speller != NULL)
1059 free(alt_speller);
1060#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001061#ifndef DISABLE_HELP
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001062 if (help_text != NULL)
1063 free(help_text);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001064#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001065 if (filename != NULL)
1066 free(filename);
1067 if (answer != NULL)
1068 free(answer);
1069 if (cutbuffer != NULL)
Chris Allegretta7662c862003-01-13 01:35:15 +00001070 free_filestruct(cutbuffer);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001071
1072 free_shortcutage(&main_list);
1073 free_shortcutage(&whereis_list);
1074 free_shortcutage(&replace_list);
1075 free_shortcutage(&replace_list_2);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001076 free_shortcutage(&goto_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001077 free_shortcutage(&writefile_list);
1078 free_shortcutage(&insertfile_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001079#ifndef DISABLE_HELP
Chris Allegretta6df90f52002-07-19 01:08:59 +00001080 free_shortcutage(&help_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001081#endif
1082#ifndef DISABLE_SPELLER
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001083 free_shortcutage(&spell_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001084#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001085#ifndef NANO_SMALL
1086 free_shortcutage(&extcmd_list);
1087#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001088#ifndef DISABLE_BROWSER
1089 free_shortcutage(&browser_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001090 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001091#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001092
1093#ifndef NANO_SMALL
1094 free_toggles();
1095#endif
1096
1097#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001098 if (open_files != NULL) {
Chris Allegretta6232d662002-05-12 19:52:15 +00001099 /* We free the memory associated with each open file. */
Chris Allegrettace452fb2003-02-03 02:56:44 +00001100 while (open_files->prev != NULL)
1101 open_files = open_files->prev;
Chris Allegretta6df90f52002-07-19 01:08:59 +00001102 free_openfilestruct(open_files);
Chris Allegrettace452fb2003-02-03 02:56:44 +00001103 }
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001104#else
Chris Allegrettace452fb2003-02-03 02:56:44 +00001105 free_filestruct(fileage);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001106#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001107
1108#ifdef ENABLE_COLOR
1109 free(syntaxstr);
1110 while (syntaxes != NULL) {
1111 syntaxtype *bill = syntaxes;
1112
1113 free(syntaxes->desc);
1114 while (syntaxes->extensions != NULL) {
1115 exttype *bob = syntaxes->extensions;
1116
1117 syntaxes->extensions = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001118 regfree(&bob->val);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001119 free(bob);
1120 }
1121 while (syntaxes->color != NULL) {
1122 colortype *bob = syntaxes->color;
1123
1124 syntaxes->color = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001125 regfree(&bob->start);
1126 if (bob->end != NULL)
Chris Allegrettace452fb2003-02-03 02:56:44 +00001127 regfree(bob->end);
1128 free(bob->end);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001129 free(bob);
1130 }
1131 syntaxes = syntaxes->next;
1132 free(bill);
1133 }
1134#endif /* ENABLE_COLOR */
Chris Allegretta5beed502003-01-05 20:41:21 +00001135#ifndef NANO_SMALL
1136 /* free history lists */
1137 free_history(&search_history);
1138 free_history(&replace_history);
1139#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001140}
Chris Allegretta6232d662002-05-12 19:52:15 +00001141#endif /* DEBUG */