blob: a80b774e30d56621cb1fc030bf4ce75c75f6a171 [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 Ramseyc13b7f02005-01-01 07:28:15 +00005 * Copyright (C) 1999-2005 Chris Allegretta *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00006 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
Chris Allegretta3a24f3f2001-10-24 11:33:54 +00008 * the Free Software Foundation; either version 2, or (at your option) *
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00009 * any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
19 * *
20 **************************************************************************/
21
Jordi Mallach55381aa2004-11-17 23:17:05 +000022#ifdef HAVE_CONFIG_H
23#include <config.h>
24#endif
Chris Allegretta6efda542001-04-28 18:03:52 +000025
Chris Allegretta1dd0bc92002-10-13 18:43:45 +000026#include <stdlib.h>
Chris Allegrettadab017e2002-04-23 10:56:06 +000027#include <assert.h>
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000028#include "proto.h"
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000029#include "nano.h"
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000030
Chris Allegretta7662c862003-01-13 01:35:15 +000031/* Global variables */
Chris Allegretta48b06702002-02-22 04:30:50 +000032
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000033#ifndef DISABLE_WRAPJUSTIFY
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +000034/* wrap_at might be set in rcfile.c or nano.c. */
35ssize_t wrap_at = -CHARS_FROM_EOL; /* Right justified fill value,
36 allows resize */
David Lawrence Ramseyf5b256b2003-10-03 20:26:25 +000037#endif
38
Chris Allegretta6df90f52002-07-19 01:08:59 +000039char *last_search = NULL; /* Last string we searched for */
40char *last_replace = NULL; /* Last replacement string */
41int search_last_line; /* Is this the last search line? */
42
David Lawrence Ramseyedab0cc2004-07-03 03:09:12 +000043long flags = 0; /* Our flag containing many options */
David Lawrence Ramseyf21cd102002-06-13 00:40:19 +000044WINDOW *edit; /* The file portion of the editor */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000045WINDOW *topwin; /* Top line of screen */
46WINDOW *bottomwin; /* Bottom buffer */
Chris Allegretta1a6e9042000-12-14 13:56:28 +000047char *filename = NULL; /* Name of the file */
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +000048
49#ifndef NANO_SMALL
50struct stat originalfilestat; /* Stat for the file as we loaded it */
51#endif
52
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000053int editwinrows = 0; /* How many rows long is the edit
54 window? */
55filestruct *current; /* Current buffer pointer */
David Lawrence Ramsey7a97e182004-10-30 01:03:15 +000056size_t current_x = 0; /* Current x-coordinate in the edit
57 window */
58int current_y = 0; /* Current y-coordinate in the edit
59 window */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000060filestruct *fileage = NULL; /* Our file buffer */
61filestruct *edittop = NULL; /* Pointer to the top of the edit
62 buffer with respect to the
63 file struct */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000064filestruct *filebot = NULL; /* Last node in the file struct */
65filestruct *cutbuffer = NULL; /* A place to store cut text */
David Lawrence Ramsey93c84052004-11-23 04:08:28 +000066#ifndef DISABLE_JUSTIFY
67filestruct *jusbuffer = NULL; /* A place to store unjustified text */
68#endif
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000069partition *filepart = NULL; /* A place to store a portion of the
70 file struct */
David Lawrence Ramsey40bdb682004-11-03 22:03:41 +000071
Chris Allegretta355fbe52001-07-14 19:32:47 +000072#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey3ece0b92004-12-01 15:11:27 +000073openfilestruct *open_files = NULL; /* The list of open file
74 buffers */
Chris Allegretta2d7893d2001-07-11 02:08:33 +000075#endif
76
David Lawrence Ramsey89bb9372004-05-29 16:47:52 +000077#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
78char *whitespace = NULL; /* Characters used when displaying
79 the first characters of tabs and
80 spaces. */
81#endif
82
Chris Allegrettae4f940d2002-03-03 22:36:36 +000083#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey2c62b072004-05-29 16:38:57 +000084char *punct = NULL; /* Closing punctuation that can end
85 sentences. */
86char *brackets = NULL; /* Closing brackets that can follow
87 closing punctuation and can end
88 sentences. */
Chris Allegretta7662c862003-01-13 01:35:15 +000089char *quotestr = NULL; /* Quote string. The default value is
90 set in main(). */
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +000091#ifdef HAVE_REGEX_H
92regex_t quotereg; /* Compiled quotestr regular expression. */
93int quoterc; /* Did it compile? */
94char *quoteerr = NULL; /* The error message. */
95#else
96size_t quotelen; /* strlen(quotestr) */
97#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +000098#endif
Chris Allegrettae4f940d2002-03-03 22:36:36 +000099
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +0000100#ifndef NANO_SMALL
101char *backup_dir = NULL; /* Backup directory. */
102#endif
103
Chris Allegretta6df90f52002-07-19 01:08:59 +0000104char *answer = NULL; /* Answer str to many questions */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000105int totlines = 0; /* Total number of lines in the file */
Chris Allegrettab3655b42001-10-22 03:15:31 +0000106long totsize = 0; /* Total number of bytes in the file */
David Lawrence Ramsey86e851b2004-07-28 20:46:25 +0000107size_t placewewant = 0; /* The column we'd like the cursor
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000108 to jump to when we go to the
109 next or previous line */
110
David Lawrence Ramsey49c3f242004-07-12 16:07:14 +0000111ssize_t tabsize = -1; /* Our internal tabsize variable. The
112 default value is set in main(). */
Chris Allegretta6d690a32000-08-03 22:51:21 +0000113
Chris Allegretta7662c862003-01-13 01:35:15 +0000114char *hblank = NULL; /* A horizontal blank line */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000115#ifndef DISABLE_HELP
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000116char *help_text; /* The text in the help window */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000117#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000118
119/* More stuff for the marker select */
120
Chris Allegretta7662c862003-01-13 01:35:15 +0000121#ifndef NANO_SMALL
David Lawrence Ramseyf28f50e2004-01-09 23:04:55 +0000122filestruct *mark_beginbuf; /* The begin marker buffer */
David Lawrence Ramsey687776b2004-10-30 01:16:08 +0000123size_t mark_beginx; /* X value in the string to start */
Chris Allegretta7662c862003-01-13 01:35:15 +0000124#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000125
Chris Allegrettae1f14522001-09-19 03:19:43 +0000126#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000127char *operating_dir = NULL; /* Operating directory, which we can't */
128char *full_operating_dir = NULL;/* go higher than */
Chris Allegrettae1f14522001-09-19 03:19:43 +0000129#endif
130
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000131#ifndef DISABLE_SPELLER
Chris Allegretta7c27be42002-05-05 23:03:54 +0000132char *alt_speller = NULL; /* Alternative spell command */
Chris Allegretta8d8e0122001-04-18 04:28:54 +0000133#endif
134
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000135shortcut *main_list = NULL;
136shortcut *whereis_list = NULL;
137shortcut *replace_list = NULL;
Chris Allegretta48b06702002-02-22 04:30:50 +0000138shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000139shortcut *gotoline_list = NULL;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000140shortcut *writefile_list = NULL;
141shortcut *insertfile_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000142#ifndef DISABLE_HELP
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000143shortcut *help_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000144#endif
145#ifndef DISABLE_SPELLER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000146shortcut *spell_list = NULL;
Chris Allegretta7662c862003-01-13 01:35:15 +0000147#endif
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000148#ifndef NANO_SMALL
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000149shortcut *extcmd_list = NULL;
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000150#endif
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000151#ifndef DISABLE_BROWSER
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000152shortcut *browser_list = NULL;
Chris Allegretta201f1d92003-02-05 02:51:19 +0000153shortcut *gotodir_list = NULL;
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000154#endif
Chris Allegretta201f1d92003-02-05 02:51:19 +0000155
Chris Allegretta8ce24132001-04-30 11:28:46 +0000156#ifdef ENABLE_COLOR
David Lawrence Ramsey9b13ff32002-12-22 16:30:00 +0000157const colortype *colorstrings = NULL;
158syntaxtype *syntaxes = NULL;
159char *syntaxstr = NULL;
Chris Allegretta8ce24132001-04-30 11:28:46 +0000160#endif
161
Chris Allegretta6df90f52002-07-19 01:08:59 +0000162const shortcut *currshortcut; /* Current shortcut list we're using */
Chris Allegretta6b58acd2001-04-12 03:01:53 +0000163
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000164#ifndef NANO_SMALL
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000165toggle *toggles = NULL;
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000166#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000167
Chris Allegretta5beed502003-01-05 20:41:21 +0000168#ifndef NANO_SMALL
169historyheadtype search_history;
170historyheadtype replace_history;
171#endif
172
Chris Allegretta9fc8d432000-07-07 01:49:52 +0000173/* Regular expressions */
174
Chris Allegretta805c26d2000-09-06 13:39:17 +0000175#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000176regex_t search_regexp; /* Global to store compiled search regexp */
177regmatch_t regmatches[10]; /* Match positions for parenthetical
178 subexpressions, max of 10 */
Chris Allegretta6df90f52002-07-19 01:08:59 +0000179#endif
Chris Allegretta3533a342002-03-24 23:19:32 +0000180
David Lawrence Ramsey82dc1c12004-08-12 03:27:54 +0000181bool curses_ended = FALSE; /* Indicates to statusbar() to simply
Chris Allegrettaa0d89972003-02-03 03:32:08 +0000182 * write to stderr, since endwin() has
183 * ended curses mode. */
184
David Lawrence Ramseya27bd652004-08-17 05:23:38 +0000185#ifdef ENABLE_NANORC
186char *homedir = NULL; /* $HOME or from /etc/passwd. */
187#endif
188
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000189size_t length_of_list(const shortcut *s)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000190{
David Lawrence Ramseyebd0d7c2004-07-01 18:59:52 +0000191 size_t i = 0;
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000192
Chris Allegrettadab017e2002-04-23 10:56:06 +0000193 for (; s != NULL; s = s->next)
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000194 i++;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000195 return i;
196}
197
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000198/* Initialize a struct *without* our lovely braces =( */
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000199void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
Chris Allegrettadab017e2002-04-23 10:56:06 +0000200#ifndef DISABLE_HELP
Chris Allegrettaf717f982003-02-13 22:25:01 +0000201 const char *help,
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000202#endif
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000203 int metaval, int funcval, int miscval, bool view, void
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000204 (*func)(void))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000205{
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000206 shortcut *s;
207
208 if (*shortcutage == NULL) {
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000209 *shortcutage = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000210 s = *shortcutage;
211 } else {
212 for (s = *shortcutage; s->next != NULL; s = s->next)
213 ;
David Lawrence Ramsey70047ee2003-06-14 20:41:34 +0000214 s->next = (shortcut *)nmalloc(sizeof(shortcut));
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000215 s = s->next;
216 }
217
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000218 s->ctrlval = ctrlval;
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000219 s->desc = _(desc);
Chris Allegrettadab017e2002-04-23 10:56:06 +0000220#ifndef DISABLE_HELP
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000221 s->help = _(help);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000222#endif
David Lawrence Ramsey1576d532004-03-19 21:46:34 +0000223 s->metaval = metaval;
224 s->funcval = funcval;
225 s->miscval = miscval;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000226 s->viewok = view;
227 s->func = func;
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000228 s->next = NULL;
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000229}
230
David Lawrence Ramsey1f1ebb82004-11-11 21:50:01 +0000231void shortcut_init(bool unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000232{
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000233 const char *get_help_msg = N_("Get Help");
234 const char *exit_msg = N_("Exit");
235 const char *prev_page_msg = N_("Prev Page");
236 const char *next_page_msg = N_("Next Page");
237 const char *replace_msg = N_("Replace");
238 const char *go_to_line_msg = N_("Go To Line");
239 const char *cancel_msg = N_("Cancel");
240 const char *first_line_msg = N_("First Line");
241 const char *last_line_msg = N_("Last Line");
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000242#ifndef NANO_SMALL
243 const char *cut_till_end_msg = N_("CutTillEnd");
244#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000245#ifndef DISABLE_JUSTIFY
246 const char *beg_of_par_msg = N_("Beg of Par");
247 const char *end_of_par_msg = N_("End of Par");
248 const char *fulljstify_msg = N_("FullJstify");
249#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000250#ifndef NANO_SMALL
251 const char *case_sens_msg = N_("Case Sens");
252 const char *direction_msg = N_("Direction");
253#ifdef HAVE_REGEX_H
254 const char *regexp_msg = N_("Regexp");
255#endif
256 const char *history_msg = N_("History");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000257#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000258 const char *new_buffer_msg = N_("New Buffer");
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000259#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000260#endif /* !NANO_SMALL */
261#ifndef DISABLE_BROWSER
262 const char *to_files_msg = N_("To Files");
263#endif
264
Chris Allegrettadab017e2002-04-23 10:56:06 +0000265#ifndef DISABLE_HELP
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000266 const char *nano_help_msg = N_("Invoke the help menu");
267 const char *nano_exit_msg =
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000268#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000269 N_("Close currently loaded file/Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000270#else
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000271 N_("Exit from nano")
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000272#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000273 ;
274 const char *nano_writeout_msg = N_("Write the current file to disk");
275 const char *nano_justify_msg = N_("Justify the current paragraph");
276 const char *nano_insert_msg =
277 N_("Insert another file into the current one");
278 const char *nano_whereis_msg = N_("Search for text within the editor");
279 const char *nano_prevpage_msg = N_("Move to the previous screen");
280 const char *nano_nextpage_msg = N_("Move to the next screen");
281 const char *nano_cut_msg =
282 N_("Cut the current line and store it in the cutbuffer");
283 const char *nano_uncut_msg =
284 N_("Uncut from the cutbuffer into the current line");
285 const char *nano_cursorpos_msg = N_("Show the position of the cursor");
286 const char *nano_spell_msg = N_("Invoke the spell checker, if available");
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000287 const char *nano_gotoline_msg = N_("Go to a specific line number");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000288 const char *nano_replace_msg = N_("Replace text within the editor");
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000289#ifndef NANO_SMALL
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000290 const char *nano_mark_msg = N_("Mark text at the cursor position");
291 const char *nano_whereis_next_msg = N_("Repeat last search");
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000292#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000293 const char *nano_prevline_msg = N_("Move to the previous line");
294 const char *nano_nextline_msg = N_("Move to the next line");
295 const char *nano_forward_msg = N_("Move forward one character");
296 const char *nano_back_msg = N_("Move back one character");
297 const char *nano_home_msg = N_("Move to the beginning of the current line");
298 const char *nano_end_msg = N_("Move to the end of the current line");
299 const char *nano_refresh_msg = N_("Refresh (redraw) the current screen");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000300 const char *nano_delete_msg = N_("Delete the character under the cursor");
301 const char *nano_backspace_msg =
302 N_("Delete the character to the left of the cursor");
David Lawrence Ramseye7c41682004-10-23 14:53:07 +0000303 const char *nano_tab_msg =
304 N_("Insert a tab character at the cursor position");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000305 const char *nano_enter_msg =
306 N_("Insert a carriage return at the cursor position");
David Lawrence Ramsey00d77982004-08-07 21:27:37 +0000307#ifndef NANO_SMALL
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000308 const char *nano_nextword_msg = N_("Move forward one word");
309 const char *nano_prevword_msg = N_("Move backward one word");
David Lawrence Ramsey00d77982004-08-07 21:27:37 +0000310#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000311#ifndef DISABLE_JUSTIFY
312 const char *nano_parabegin_msg =
313 N_("Go to the beginning of the current paragraph");
314 const char *nano_paraend_msg =
315 N_("Go to the end of the current paragraph");
316#endif
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000317#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000318 const char *nano_openprev_msg = N_("Switch to the previous file buffer");
319 const char *nano_opennext_msg = N_("Switch to the next file buffer");
320#endif
321 const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000322#ifndef NANO_SMALL
323 const char *nano_cut_till_end_msg =
324 N_("Cut from the cursor position to the end of the file");
325#endif
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000326#ifndef DISABLE_JUSTIFY
327 const char *nano_fulljustify_msg = N_("Justify the entire file");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000328#endif
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000329#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000330 const char *nano_bracket_msg = N_("Find other bracket");
331#endif
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000332 const char *nano_cancel_msg = N_("Cancel the current function");
333 const char *nano_firstline_msg = N_("Go to the first line of the file");
334 const char *nano_lastline_msg = N_("Go to the last line of the file");
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000335#ifndef NANO_SMALL
336 const char *nano_case_msg =
337 N_("Make the current search/replace case (in)sensitive");
338 const char *nano_reverse_msg =
339 N_("Make the current search/replace go backwards");
340#ifdef HAVE_REGEX_H
341 const char *nano_regexp_msg = N_("Use regular expressions");
342#endif
343 const char *nano_editstr_msg =
344 N_("Edit the previous search/replace strings");
345#endif /* !NANO_SMALL */
346
347#ifndef DISABLE_BROWSER
348 const char *nano_tofiles_msg = N_("Go to file browser");
349#endif
350#ifndef NANO_SMALL
351 const char *nano_dos_msg = N_("Write file out in DOS format");
352 const char *nano_mac_msg = N_("Write file out in Mac format");
353#endif
354 const char *nano_append_msg = N_("Append to the current file");
355 const char *nano_prepend_msg = N_("Prepend to the current file");
356#ifndef NANO_SMALL
357 const char *nano_backup_msg = N_("Back up original file when saving");
358 const char *nano_execute_msg = N_("Execute external command");
359#endif
360#if defined(ENABLE_MULTIBUFFER) && !defined(NANO_SMALL)
361 const char *nano_multibuffer_msg = N_("Insert into new buffer");
362#endif
363#ifndef DISABLE_BROWSER
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000364 const char *nano_exitbrowser_msg = N_("Exit from the file browser");
365 const char *nano_gotodir_msg = N_("Go to directory");
Chris Allegretta2bef1822001-09-28 19:53:11 +0000366#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +0000367#endif /* !DISABLE_HELP */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000368
David Lawrence Ramsey8e4adcd2004-05-20 03:29:33 +0000369/* The following macro is to be used in calling sc_init_one(). The
370 * point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
371 * defined, when the 4th one should not be there. */
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000372#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000373# define IFHELP(help, nextvar) help, nextvar
David Lawrence Ramseyea43a1d2004-03-02 22:52:57 +0000374#else
375# define IFHELP(help, nextvar) nextvar
Chris Allegrettadab017e2002-04-23 10:56:06 +0000376#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000377
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000378 free_shortcutage(&main_list);
379
Jordi Mallachf9390af2003-08-05 19:31:12 +0000380 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000381 sc_init_one(&main_list, NANO_HELP_KEY, get_help_msg,
382 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
383 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000384#ifndef DISABLE_HELP
385 do_help
386#else
387 nano_disabled_msg
388#endif
389 );
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000390
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000391 /* Translators: try to keep this string under 10 characters long */
392 sc_init_one(&main_list, NANO_EXIT_KEY,
Chris Allegretta355fbe52001-07-14 19:32:47 +0000393#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000394 open_files != NULL && open_files != open_files->next ?
395 N_("Close") :
Chris Allegretta2d7893d2001-07-11 02:08:33 +0000396#endif
David Lawrence Ramsey5b3dd0f2004-11-25 04:39:07 +0000397 exit_msg, IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
398 NANO_NO_KEY, VIEW, do_exit);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000399
Jordi Mallachf9390af2003-08-05 19:31:12 +0000400 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000401 sc_init_one(&main_list, NANO_WRITEOUT_KEY, N_("WriteOut"),
402 IFHELP(nano_writeout_msg, NANO_NO_KEY), NANO_WRITEOUT_FKEY,
403 NANO_NO_KEY, NOVIEW, do_writeout_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000404
Jordi Mallachf9390af2003-08-05 19:31:12 +0000405 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000406 sc_init_one(&main_list, NANO_JUSTIFY_KEY, N_("Justify"),
407 IFHELP(nano_justify_msg, NANO_NO_KEY),
408 NANO_JUSTIFY_FKEY, NANO_NO_KEY, NOVIEW,
David Lawrence Ramseya539fce2004-06-29 00:43:56 +0000409#ifndef DISABLE_JUSTIFY
David Lawrence Ramsey8d3e7f32004-05-13 17:28:03 +0000410 do_justify_void
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000411#else
412 nano_disabled_msg
413#endif
414 );
Chris Allegretta32da4562002-01-02 15:12:21 +0000415
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000416 /* We allow inserting files in view mode if multibuffers are
417 * available, so that we can view multiple files. */
418 /* If we're using restricted mode, inserting files is disabled since
419 * it allows reading from or writing to files not specified on the
420 * command line. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000421 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000422 sc_init_one(&main_list, NANO_INSERTFILE_KEY, N_("Read File"),
423 IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_INSERTFILE_FKEY,
424 NANO_NO_KEY,
Chris Allegretta32da4562002-01-02 15:12:21 +0000425#ifdef ENABLE_MULTIBUFFER
Chris Allegrettad8451932003-03-11 03:50:40 +0000426 VIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000427#else
Chris Allegrettad8451932003-03-11 03:50:40 +0000428 NOVIEW
Chris Allegretta32da4562002-01-02 15:12:21 +0000429#endif
David Lawrence Ramsey8001e272004-11-12 00:48:18 +0000430 , !ISSET(RESTRICTED) ? do_insertfile_void :
431 nano_disabled_msg);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000432
Jordi Mallachf9390af2003-08-05 19:31:12 +0000433 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000434 sc_init_one(&main_list, NANO_WHEREIS_KEY, N_("Where Is"),
435 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_WHEREIS_FKEY,
436 NANO_NO_KEY, VIEW, do_search);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000437
Jordi Mallachf9390af2003-08-05 19:31:12 +0000438 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000439 sc_init_one(&main_list, NANO_PREVPAGE_KEY, prev_page_msg,
440 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
441 NANO_NO_KEY, VIEW, do_page_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000442
Jordi Mallachf9390af2003-08-05 19:31:12 +0000443 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000444 sc_init_one(&main_list, NANO_NEXTPAGE_KEY, next_page_msg,
445 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
446 NANO_NO_KEY, VIEW, do_page_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000447
Jordi Mallachf9390af2003-08-05 19:31:12 +0000448 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000449 sc_init_one(&main_list, NANO_CUT_KEY, N_("Cut Text"),
450 IFHELP(nano_cut_msg, NANO_NO_KEY), NANO_CUT_FKEY,
451 NANO_NO_KEY, NOVIEW, do_cut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000452
Chris Allegretta07798352000-11-27 22:58:23 +0000453 if (unjustify)
Jordi Mallachf9390af2003-08-05 19:31:12 +0000454 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000455 sc_init_one(&main_list, NANO_UNJUSTIFY_KEY, N_("UnJustify"),
456 IFHELP(NULL, NANO_NO_KEY), NANO_UNJUSTIFY_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000457 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta07798352000-11-27 22:58:23 +0000458 else
Jordi Mallachf9390af2003-08-05 19:31:12 +0000459 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000460 sc_init_one(&main_list, NANO_UNCUT_KEY, N_("UnCut Txt"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000461 IFHELP(nano_uncut_msg, NANO_NO_KEY), NANO_UNCUT_FKEY,
462 NANO_NO_KEY, NOVIEW, do_uncut_text);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000463
Jordi Mallachf9390af2003-08-05 19:31:12 +0000464 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000465 sc_init_one(&main_list, NANO_CURSORPOS_KEY, N_("Cur Pos"),
466 IFHELP(nano_cursorpos_msg, NANO_NO_KEY), NANO_CURSORPOS_FKEY,
467 NANO_NO_KEY, VIEW, do_cursorpos_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000468
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000469 /* If we're using restricted mode, spell checking is disabled
470 * because it allows reading from or writing to files not specified
471 * on the command line. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000472 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000473 sc_init_one(&main_list, NANO_SPELL_KEY, N_("To Spell"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000474 IFHELP(nano_spell_msg, NANO_NO_KEY), NANO_SPELL_FKEY,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000475 NANO_NO_KEY, NOVIEW,
476#ifndef DISABLE_SPELLER
477 !ISSET(RESTRICTED) ? do_spell :
478#endif
479 nano_disabled_msg);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000480
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000481 sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000482 IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY),
483 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, do_gotoline_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000484
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000485 sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000486 IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
487 NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000488
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000489#ifndef NANO_SMALL
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000490 sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
491 IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000492 NANO_NO_KEY, NOVIEW, do_mark);
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000493
494 sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
495 IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000496 NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000497#endif
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000498
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000499 sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
500 IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
501 NANO_NO_KEY, VIEW, do_up);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000502
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000503 sc_init_one(&main_list, NANO_NEXTLINE_KEY, N_("Next Line"),
504 IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
505 NANO_NO_KEY, VIEW, do_down);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000506
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000507 sc_init_one(&main_list, NANO_FORWARD_KEY, N_("Forward"),
508 IFHELP(nano_forward_msg, NANO_NO_KEY), NANO_NO_KEY,
509 NANO_NO_KEY, VIEW, do_right_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000510
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000511 sc_init_one(&main_list, NANO_BACK_KEY, N_("Back"),
512 IFHELP(nano_back_msg, NANO_NO_KEY), NANO_NO_KEY,
513 NANO_NO_KEY, VIEW, do_left_void);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000514
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000515 sc_init_one(&main_list, NANO_HOME_KEY, N_("Home"),
516 IFHELP(nano_home_msg, NANO_NO_KEY), NANO_NO_KEY,
517 NANO_NO_KEY, VIEW, do_home);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000518
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000519 sc_init_one(&main_list, NANO_END_KEY, N_("End"),
520 IFHELP(nano_end_msg, NANO_NO_KEY), NANO_NO_KEY,
521 NANO_NO_KEY, VIEW, do_end);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000522
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000523 sc_init_one(&main_list, NANO_REFRESH_KEY, N_("Refresh"),
524 IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
525 NANO_NO_KEY, VIEW, total_refresh);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000526
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000527 sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
528 IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
529 NANO_NO_KEY, NOVIEW, do_delete);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000530
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000531 sc_init_one(&main_list, NANO_BACKSPACE_KEY, N_("Backspace"),
532 IFHELP(nano_backspace_msg, NANO_NO_KEY), NANO_NO_KEY,
533 NANO_NO_KEY, NOVIEW, do_backspace);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000534
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000535 sc_init_one(&main_list, NANO_TAB_KEY, N_("Tab"),
536 IFHELP(nano_tab_msg, NANO_NO_KEY), NANO_NO_KEY,
537 NANO_NO_KEY, NOVIEW, do_tab);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000538
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000539 sc_init_one(&main_list, NANO_ENTER_KEY, N_("Enter"),
540 IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
541 NANO_NO_KEY, NOVIEW, do_enter);
Chris Allegrettaaf6414a2001-02-11 19:05:05 +0000542
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000543#ifndef NANO_SMALL
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000544 sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
545 IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
546 NANO_NO_KEY, VIEW, do_next_word);
David Lawrence Ramseyc5967552002-06-21 03:20:06 +0000547
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000548 sc_init_one(&main_list, NANO_NO_KEY, N_("Prev Word"),
549 IFHELP(nano_prevword_msg, NANO_PREVWORD_KEY), NANO_NO_KEY,
550 NANO_NO_KEY, VIEW, do_prev_word);
Chris Allegretta8d990b52001-09-22 22:14:25 +0000551#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000552
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000553#ifndef DISABLE_JUSTIFY
554 /* Translators: try to keep this string under 10 characters long */
555 sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
556 IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
557 NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
558
559 /* Translators: try to keep this string under 10 characters long */
560 sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
561 IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
562 NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
563#endif
David Lawrence Ramseye0497062003-08-23 21:11:06 +0000564
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000565#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000566 sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
567 IFHELP(nano_openprev_msg, NANO_OPENPREV_KEY), NANO_NO_KEY,
568 NANO_OPENPREV_ALTKEY, VIEW, open_prevfile_void);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000569
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000570 sc_init_one(&main_list, NANO_NO_KEY, N_("Next File"),
571 IFHELP(nano_opennext_msg, NANO_OPENNEXT_KEY), NANO_NO_KEY,
572 NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000573#endif
Chris Allegrettab3655b42001-10-22 03:15:31 +0000574
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000575 sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
576 IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
577 NANO_NO_KEY, NOVIEW, do_verbatim_input);
578
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000579#ifndef NANO_SMALL
580 /* Translators: try to keep this string under 10 characters long */
581 sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
582 IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
583 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
584#endif
585
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000586#ifndef DISABLE_JUSTIFY
587 /* Translators: try to keep this string under 10 characters long */
588 sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000589 IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
590 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000591#endif
592
David Lawrence Ramsey8381fdd2004-11-01 22:40:02 +0000593#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000594 sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
595 IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
596 NANO_NO_KEY, VIEW, do_find_bracket);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000597#endif
598
Chris Allegrettadab017e2002-04-23 10:56:06 +0000599 free_shortcutage(&whereis_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000600
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000601 sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
602 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
603 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000604#ifndef DISABLE_HELP
605 do_help
606#else
607 nano_disabled_msg
608#endif
609 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000610
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000611 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000612 sc_init_one(&whereis_list, NANO_CANCEL_KEY, cancel_msg,
613 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000614 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000615
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000616 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000617 sc_init_one(&whereis_list, NANO_FIRSTLINE_KEY, first_line_msg,
618 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
619 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000620
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000621 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000622 sc_init_one(&whereis_list, NANO_LASTLINE_KEY, last_line_msg,
623 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
624 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000625
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000626 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000627 sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000628 IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000629 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000630
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000631 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000632 sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
633 IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000634 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000635
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000636#ifndef DISABLE_JUSTIFY
637 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000638 sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000639 IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
640 NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000641
642 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramseydb6015c2004-09-11 21:41:13 +0000643 sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000644 IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
645 NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000646#endif
647
Chris Allegretta5f36c372001-07-16 00:48:53 +0000648#ifndef NANO_SMALL
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000649 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000650 sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
651 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000652 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000653
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000654 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000655 sc_init_one(&whereis_list, NANO_NO_KEY, direction_msg,
656 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000657 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000658
Chris Allegretta658399a2001-06-14 02:54:22 +0000659#ifdef HAVE_REGEX_H
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000660 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000661 sc_init_one(&whereis_list, NANO_NO_KEY, regexp_msg,
662 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000663 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000664#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000665
David Lawrence Ramsey8faf3052003-09-04 20:25:29 +0000666 /* Translators: try to keep this string under 10 characters long */
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000667 sc_init_one(&whereis_list, NANO_HISTORY_KEY, history_msg,
668 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000669 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey295d1722005-01-01 07:43:32 +0000670
671 /* Translators: try to keep this string under 10 characters long */
672 sc_init_one(&whereis_list, NANO_CUTTILLEND_KEY, cut_till_end_msg,
673 IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
674 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_cut_till_end);
David Lawrence Ramsey30412932004-11-23 20:42:35 +0000675#endif /* !NANO_SMALL */
David Lawrence Ramsey02085d72004-11-07 16:04:18 +0000676
677#ifndef DISABLE_JUSTIFY
678 /* Translators: try to keep this string under 10 characters long */
679 sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
680 IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
681 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
682#endif
Chris Allegretta5f36c372001-07-16 00:48:53 +0000683
Chris Allegrettadab017e2002-04-23 10:56:06 +0000684 free_shortcutage(&replace_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000685
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000686 sc_init_one(&replace_list, NANO_HELP_KEY, get_help_msg,
687 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
688 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000689#ifndef DISABLE_HELP
690 do_help
691#else
692 nano_disabled_msg
693#endif
694 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000695
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000696 sc_init_one(&replace_list, NANO_CANCEL_KEY, cancel_msg,
697 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000698 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5f36c372001-07-16 00:48:53 +0000699
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000700 sc_init_one(&replace_list, NANO_FIRSTLINE_KEY, first_line_msg,
701 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_FIRSTLINE_FKEY,
702 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000703
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000704 sc_init_one(&replace_list, NANO_LASTLINE_KEY, last_line_msg,
705 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_LASTLINE_FKEY,
706 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000707
Jordi Mallachf9390af2003-08-05 19:31:12 +0000708 /* Translators: try to keep this string under 12 characters long */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000709 sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000710 IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000711 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000712
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000713 sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
714 IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000715 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000716
Chris Allegretta5f36c372001-07-16 00:48:53 +0000717#ifndef NANO_SMALL
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000718 sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
719 IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000720 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000721
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000722 sc_init_one(&replace_list, NANO_NO_KEY, direction_msg,
723 IFHELP(nano_reverse_msg, TOGGLE_BACKWARDS_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000724 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta105da332000-10-31 05:10:10 +0000725
Chris Allegretta658399a2001-06-14 02:54:22 +0000726#ifdef HAVE_REGEX_H
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000727 sc_init_one(&replace_list, NANO_NO_KEY, regexp_msg,
728 IFHELP(nano_regexp_msg, TOGGLE_REGEXP_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000729 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta658399a2001-06-14 02:54:22 +0000730#endif
Chris Allegretta5beed502003-01-05 20:41:21 +0000731
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000732 sc_init_one(&replace_list, NANO_HISTORY_KEY, history_msg,
733 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000734 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000735#endif /* !NANO_SMALL */
Chris Allegretta5f36c372001-07-16 00:48:53 +0000736
Chris Allegrettadab017e2002-04-23 10:56:06 +0000737 free_shortcutage(&replace_list_2);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000738
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000739 sc_init_one(&replace_list_2, NANO_HELP_KEY, get_help_msg,
740 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
741 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000742#ifndef DISABLE_HELP
743 do_help
744#else
745 nano_disabled_msg
746#endif
747 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000748
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000749 sc_init_one(&replace_list_2, NANO_CANCEL_KEY, cancel_msg,
750 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000751 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta105da332000-10-31 05:10:10 +0000752
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000753 sc_init_one(&replace_list_2, NANO_FIRSTLINE_KEY, first_line_msg,
754 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
755 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000756
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000757 sc_init_one(&replace_list_2, NANO_LASTLINE_KEY, last_line_msg,
758 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
759 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegretta105da332000-10-31 05:10:10 +0000760
Chris Allegretta5beed502003-01-05 20:41:21 +0000761#ifndef NANO_SMALL
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000762 sc_init_one(&replace_list_2, NANO_HISTORY_KEY, history_msg,
763 IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000764 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta5beed502003-01-05 20:41:21 +0000765#endif
766
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000767 free_shortcutage(&gotoline_list);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000768
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000769 sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000770 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
771 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000772#ifndef DISABLE_HELP
773 do_help
774#else
775 nano_disabled_msg
776#endif
777 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000778
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000779 sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000780 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000781 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000782
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000783 sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000784 IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
785 NANO_NO_KEY, VIEW, do_first_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000786
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000787 sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000788 IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
789 NANO_NO_KEY, VIEW, do_last_line);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000790
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000791 sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
792 N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000793 NANO_NO_KEY, NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000794
Chris Allegretta7662c862003-01-13 01:35:15 +0000795#ifndef DISABLE_HELP
Chris Allegrettadab017e2002-04-23 10:56:06 +0000796 free_shortcutage(&help_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000797
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000798 sc_init_one(&help_list, NANO_PREVPAGE_KEY, prev_page_msg,
799 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000800 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000801
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000802 sc_init_one(&help_list, NANO_NEXTPAGE_KEY, next_page_msg,
803 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000804 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseybe265612004-05-29 20:38:08 +0000805
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000806 sc_init_one(&help_list, NANO_PREVLINE_KEY, N_("Prev Line"),
807 IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000808 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseybe265612004-05-29 20:38:08 +0000809
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000810 sc_init_one(&help_list, NANO_NEXTLINE_KEY, N_("Next Line"),
811 IFHELP(nano_nextline_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000812 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000813
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000814 sc_init_one(&help_list, NANO_EXIT_KEY, exit_msg,
815 IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000816 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta7662c862003-01-13 01:35:15 +0000817#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000818
Chris Allegrettadab017e2002-04-23 10:56:06 +0000819 free_shortcutage(&writefile_list);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000820
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000821 sc_init_one(&writefile_list, NANO_HELP_KEY, get_help_msg,
822 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
823 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000824#ifndef DISABLE_HELP
825 do_help
826#else
827 nano_disabled_msg
828#endif
829 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000830
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000831 sc_init_one(&writefile_list, NANO_CANCEL_KEY, cancel_msg,
832 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000833 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000834
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000835#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000836 /* If we're using restricted mode, the file browser is disabled.
837 * It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000838 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000839 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000840 sc_init_one(&writefile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000841 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000842 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000843#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000844
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000845#ifndef NANO_SMALL
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000846 /* If we're using restricted mode, the DOS format, Mac format,
847 * append, prepend, and backup toggles are disabled. The first and
848 * second are useless since inserting files is disabled, the third
849 * and fourth are disabled because they allow writing to files not
850 * specified on the command line, and the fifth is useless since
851 * backups are disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000852 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000853 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000854 sc_init_one(&writefile_list, NANO_NO_KEY, N_("DOS Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000855 IFHELP(nano_dos_msg, TOGGLE_DOS_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000856 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000857
Jordi Mallachf9390af2003-08-05 19:31:12 +0000858 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000859 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000860 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Mac Format"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000861 IFHELP(nano_mac_msg, TOGGLE_MAC_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000862 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000863#endif
864
Jordi Mallachf9390af2003-08-05 19:31:12 +0000865 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000866 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000867 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Append"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000868 IFHELP(nano_append_msg, NANO_APPEND_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000869 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000870
Jordi Mallachf9390af2003-08-05 19:31:12 +0000871 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000872 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000873 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Prepend"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000874 IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000875 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta0e9b7aa2002-04-16 03:15:47 +0000876
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000877#ifndef NANO_SMALL
Jordi Mallachf9390af2003-08-05 19:31:12 +0000878 /* Translators: try to keep this string under 16 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000879 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000880 sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000881 IFHELP(nano_backup_msg, TOGGLE_BACKUP_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000882 NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramsey5db0cdc2002-06-28 22:45:14 +0000883#endif
884
Chris Allegrettadab017e2002-04-23 10:56:06 +0000885 free_shortcutage(&insertfile_list);
Chris Allegrettaa8c22572002-02-15 19:17:02 +0000886
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000887 sc_init_one(&insertfile_list, NANO_HELP_KEY, get_help_msg,
888 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
889 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000890#ifndef DISABLE_HELP
891 do_help
892#else
893 nano_disabled_msg
894#endif
895 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000896
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000897 sc_init_one(&insertfile_list, NANO_CANCEL_KEY, cancel_msg,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000898 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000899 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000900
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000901#ifndef DISABLE_BROWSER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000902 /* If we're using restricted mode, the file browser is disabled.
903 * It's useless since inserting files is disabled. */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000904 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000905 sc_init_one(&insertfile_list, NANO_TOFILES_KEY, to_files_msg,
David Lawrence Ramseyf4276942003-12-24 03:33:09 +0000906 IFHELP(nano_tofiles_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000907 NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000908#endif
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000909
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000910#ifndef NANO_SMALL
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000911 /* If we're using restricted mode, command execution is disabled.
912 * It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000913 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000914 if (!ISSET(RESTRICTED))
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000915 sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
916 N_("Execute Command"), IFHELP(nano_execute_msg,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000917 NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
David Lawrence Ramseya593f532003-11-28 19:47:42 +0000918
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000919#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey32e3b882004-05-29 01:20:17 +0000920 /* If we're using restricted mode, the multibuffer toggle is
921 * disabled. It's useless since inserting files is disabled. */
Jordi Mallachf9390af2003-08-05 19:31:12 +0000922 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000923 if (!ISSET(RESTRICTED))
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000924 sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000925 IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000926 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegrettaf7c68112002-09-03 22:58:40 +0000927#endif
David Lawrence Ramseye21adfa2002-09-13 18:14:04 +0000928#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000929
Chris Allegretta7662c862003-01-13 01:35:15 +0000930#ifndef DISABLE_SPELLER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000931 free_shortcutage(&spell_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000932
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000933 sc_init_one(&spell_list, NANO_HELP_KEY, get_help_msg,
934 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
935 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000936#ifndef DISABLE_HELP
937 do_help
938#else
939 nano_disabled_msg
940#endif
941 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000942
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000943 sc_init_one(&spell_list, NANO_CANCEL_KEY, cancel_msg,
944 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000945 NANO_NO_KEY, VIEW, NULL);
Chris Allegretta7662c862003-01-13 01:35:15 +0000946#endif
Chris Allegrettacc197ef2001-05-29 04:21:44 +0000947
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000948#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +0000949 free_shortcutage(&extcmd_list);
Chris Allegretta7162e3d2002-04-06 05:02:14 +0000950
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000951 sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
952 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
953 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000954#ifndef DISABLE_HELP
955 do_help
956#else
957 nano_disabled_msg
958#endif
959 );
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000960
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000961 sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
962 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000963 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000964
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000965 sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
966 IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000967 NANO_NO_KEY, VIEW, NULL);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +0000968
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000969#ifdef ENABLE_MULTIBUFFER
David Lawrence Ramsey04a8d1c2004-09-28 22:14:58 +0000970 sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +0000971 IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000972 NANO_NO_KEY, NANO_NO_KEY, NOVIEW, NULL);
Chris Allegretta52c5a6e2002-03-21 05:07:28 +0000973#endif
David Lawrence Ramsey47e82b12004-09-28 22:21:46 +0000974#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000975
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000976#ifndef DISABLE_BROWSER
Chris Allegrettadab017e2002-04-23 10:56:06 +0000977 free_shortcutage(&browser_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +0000978
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000979 sc_init_one(&browser_list, NANO_HELP_KEY, get_help_msg,
980 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
981 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +0000982#ifndef DISABLE_HELP
983 do_help
984#else
985 nano_disabled_msg
986#endif
987 );
Chris Allegrettab3655b42001-10-22 03:15:31 +0000988
David Lawrence Ramsey8037fe02004-07-23 12:30:40 +0000989 sc_init_one(&browser_list, NANO_EXIT_KEY, exit_msg,
David Lawrence Ramseyc41d4282004-07-23 12:51:40 +0000990 IFHELP(nano_exitbrowser_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000991 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettab3655b42001-10-22 03:15:31 +0000992
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000993 sc_init_one(&browser_list, NANO_PREVPAGE_KEY, prev_page_msg,
994 IFHELP(nano_prevpage_msg, NANO_NO_KEY), NANO_PREVPAGE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000995 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000996
David Lawrence Ramsey576bf332004-07-12 03:10:30 +0000997 sc_init_one(&browser_list, NANO_NEXTPAGE_KEY, next_page_msg,
998 IFHELP(nano_nextpage_msg, NANO_NO_KEY), NANO_NEXTPAGE_FKEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +0000999 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001000
Jordi Mallachf9390af2003-08-05 19:31:12 +00001001 /* Translators: try to keep this string under 22 characters long */
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001002 sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
David Lawrence Ramsey4b4b6082004-11-01 22:54:40 +00001003 IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001004 NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, NULL);
Rocco Corsi12f294c2001-04-14 06:50:24 +00001005
Chris Allegrettadab017e2002-04-23 10:56:06 +00001006 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001007
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001008 sc_init_one(&gotodir_list, NANO_HELP_KEY, get_help_msg,
1009 IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
1010 NANO_NO_KEY, VIEW,
David Lawrence Ramseyd893fa92004-04-30 04:49:02 +00001011#ifndef DISABLE_HELP
1012 do_help
1013#else
1014 nano_disabled_msg
1015#endif
1016 );
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001017
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001018 sc_init_one(&gotodir_list, NANO_CANCEL_KEY, cancel_msg,
1019 IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001020 NANO_NO_KEY, VIEW, NULL);
Chris Allegrettaf4b96012001-01-03 07:11:47 +00001021#endif
1022
Chris Allegrettaa8c22572002-02-15 19:17:02 +00001023 currshortcut = main_list;
David Lawrence Ramsey35e97132005-01-08 06:04:19 +00001024
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001025#ifndef NANO_SMALL
Chris Allegrettadab017e2002-04-23 10:56:06 +00001026 toggle_init();
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001027#endif
Chris Allegrettadab017e2002-04-23 10:56:06 +00001028}
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001029
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001030/* Deallocate the given shortcut. */
1031void free_shortcutage(shortcut **shortcutage)
1032{
1033 assert(shortcutage != NULL);
1034 while (*shortcutage != NULL) {
1035 shortcut *ps = *shortcutage;
1036 *shortcutage = (*shortcutage)->next;
1037 free(ps);
1038 }
1039}
1040
1041#ifndef NANO_SMALL
1042/* Create one new toggle structure, at the end of the toggles linked
1043 * list. */
1044void toggle_init_one(int val, const char *desc, long flag)
1045{
1046 toggle *u;
1047
1048 if (toggles == NULL) {
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001049 toggles = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001050 u = toggles;
1051 } else {
1052 for (u = toggles; u->next != NULL; u = u->next)
1053 ;
David Lawrence Ramsey94b975c2004-07-20 12:57:34 +00001054 u->next = (toggle *)nmalloc(sizeof(toggle));
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001055 u = u->next;
1056 }
1057
1058 u->val = val;
1059 u->desc = _(desc);
1060 u->flag = flag;
1061 u->next = NULL;
1062}
1063
1064void toggle_init(void)
1065{
1066 /* There is no need to reinitialize the toggles. They can't
1067 * change. */
1068 if (toggles != NULL)
1069 return;
1070
1071 toggle_init_one(TOGGLE_NOHELP_KEY, N_("Help mode"), NO_HELP);
1072#ifdef ENABLE_MULTIBUFFER
1073 /* If we're using restricted mode, the multibuffer toggle is
1074 * disabled. It's useless since inserting files is disabled. */
1075 if (!ISSET(RESTRICTED))
1076 toggle_init_one(TOGGLE_MULTIBUFFER_KEY, N_("Multiple file buffers"),
1077 MULTIBUFFER);
1078#endif
1079 toggle_init_one(TOGGLE_CONST_KEY, N_("Constant cursor position"),
1080 CONSTUPDATE);
1081 toggle_init_one(TOGGLE_AUTOINDENT_KEY, N_("Auto indent"), AUTOINDENT);
1082#ifndef DISABLE_WRAPPING
1083 toggle_init_one(TOGGLE_WRAP_KEY, N_("Auto line wrap"), NO_WRAP);
1084#endif
1085 toggle_init_one(TOGGLE_CUTTOEND_KEY, N_("Cut to end"), CUT_TO_END);
1086 /* If we're using restricted mode, the suspend toggle is disabled.
1087 * It's useless since suspending is disabled. */
1088 if (!ISSET(RESTRICTED))
1089 toggle_init_one(TOGGLE_SUSPEND_KEY, N_("Suspend"), SUSPEND);
1090#ifndef DISABLE_MOUSE
1091 toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
1092#endif
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001093 /* If we're using restricted mode, the DOS/Mac conversion toggle is
1094 * disabled. It's useless since inserting files is disabled. */
1095 if (!ISSET(RESTRICTED))
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001096 toggle_init_one(TOGGLE_NOCONVERT_KEY,
1097 N_("No conversion from DOS/Mac format"), NO_CONVERT);
David Lawrence Ramsey74835712004-12-04 17:41:52 +00001098 /* If we're using restricted mode, the backup toggle is disabled.
1099 * It's useless since backups are disabled. */
1100 if (!ISSET(RESTRICTED))
David Lawrence Ramseyfb8bf402004-07-13 17:43:08 +00001101 toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001102 toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
1103 toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME);
1104#ifdef ENABLE_COLOR
1105 toggle_init_one(TOGGLE_SYNTAX_KEY, N_("Color syntax highlighting"),
1106 COLOR_SYNTAX);
1107#endif
1108#ifdef ENABLE_NANORC
1109 toggle_init_one(TOGGLE_WHITESPACE_KEY, N_("Whitespace display"),
1110 WHITESPACE_DISPLAY);
1111#endif
1112}
1113
1114#ifdef DEBUG
1115/* Deallocate all of the toggles. */
1116void free_toggles(void)
1117{
1118 while (toggles != NULL) {
1119 toggle *pt = toggles; /* Think "previous toggle". */
1120
1121 toggles = toggles->next;
1122 free(pt);
1123 }
1124}
1125#endif
1126#endif /* !NANO_SMALL */
1127
Chris Allegretta6232d662002-05-12 19:52:15 +00001128/* This function is called just before calling exit(). Practically, the
1129 * only effect is to cause a segmentation fault if the various data
1130 * structures got bolloxed earlier. Thus, we don't bother having this
Chris Allegretta6df90f52002-07-19 01:08:59 +00001131 * function unless debugging is turned on. */
Chris Allegretta6232d662002-05-12 19:52:15 +00001132#ifdef DEBUG
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001133/* Added by SPK for memory cleanup; gracefully return our malloc()s. */
Chris Allegretta6df90f52002-07-19 01:08:59 +00001134void thanks_for_all_the_fish(void)
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001135{
David Lawrence Ramsey576bf332004-07-12 03:10:30 +00001136 delwin(topwin);
1137 delwin(edit);
1138 delwin(bottomwin);
1139
Chris Allegretta7662c862003-01-13 01:35:15 +00001140#ifndef DISABLE_JUSTIFY
1141 if (quotestr != NULL)
1142 free(quotestr);
David Lawrence Ramsey819c7f02004-07-30 03:54:34 +00001143#ifdef HAVE_REGEX_H
1144 regfree(&quotereg);
1145 free(quoteerr);
1146#endif
Chris Allegretta7662c862003-01-13 01:35:15 +00001147#endif
David Lawrence Ramsey04e42a62004-02-28 16:24:31 +00001148#ifndef NANO_SMALL
1149 if (backup_dir != NULL)
1150 free(backup_dir);
1151#endif
Chris Allegretta2598c662002-03-28 01:59:34 +00001152#ifndef DISABLE_OPERATINGDIR
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001153 if (operating_dir != NULL)
1154 free(operating_dir);
1155 if (full_operating_dir != NULL)
1156 free(full_operating_dir);
1157#endif
1158 if (last_search != NULL)
1159 free(last_search);
1160 if (last_replace != NULL)
1161 free(last_replace);
1162 if (hblank != NULL)
1163 free(hblank);
1164#ifndef DISABLE_SPELLER
1165 if (alt_speller != NULL)
1166 free(alt_speller);
1167#endif
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001168#ifndef DISABLE_HELP
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001169 if (help_text != NULL)
1170 free(help_text);
David Lawrence Ramseyad40fdb2002-09-06 20:35:28 +00001171#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001172 if (filename != NULL)
1173 free(filename);
1174 if (answer != NULL)
1175 free(answer);
1176 if (cutbuffer != NULL)
Chris Allegretta7662c862003-01-13 01:35:15 +00001177 free_filestruct(cutbuffer);
David Lawrence Ramsey93c84052004-11-23 04:08:28 +00001178#ifndef DISABLE_JUSTIFY
1179 if (jusbuffer != NULL)
1180 free_filestruct(jusbuffer);
1181#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001182 free_shortcutage(&main_list);
1183 free_shortcutage(&whereis_list);
1184 free_shortcutage(&replace_list);
1185 free_shortcutage(&replace_list_2);
David Lawrence Ramseye5d8f322004-09-30 22:07:21 +00001186 free_shortcutage(&gotoline_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001187 free_shortcutage(&writefile_list);
1188 free_shortcutage(&insertfile_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001189#ifndef DISABLE_HELP
Chris Allegretta6df90f52002-07-19 01:08:59 +00001190 free_shortcutage(&help_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001191#endif
1192#ifndef DISABLE_SPELLER
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001193 free_shortcutage(&spell_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001194#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001195#ifndef NANO_SMALL
1196 free_shortcutage(&extcmd_list);
1197#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001198#ifndef DISABLE_BROWSER
1199 free_shortcutage(&browser_list);
Chris Allegretta7662c862003-01-13 01:35:15 +00001200 free_shortcutage(&gotodir_list);
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001201#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001202
1203#ifndef NANO_SMALL
1204 free_toggles();
1205#endif
1206
1207#ifdef ENABLE_MULTIBUFFER
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001208 if (open_files != NULL) {
Chris Allegretta6232d662002-05-12 19:52:15 +00001209 /* We free the memory associated with each open file. */
Chris Allegrettace452fb2003-02-03 02:56:44 +00001210 while (open_files->prev != NULL)
1211 open_files = open_files->prev;
Chris Allegretta6df90f52002-07-19 01:08:59 +00001212 free_openfilestruct(open_files);
Chris Allegrettace452fb2003-02-03 02:56:44 +00001213 }
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001214#else
Chris Allegrettace452fb2003-02-03 02:56:44 +00001215 free_filestruct(fileage);
Chris Allegrettaf2387fb2002-04-10 02:31:20 +00001216#endif
Chris Allegretta6df90f52002-07-19 01:08:59 +00001217
1218#ifdef ENABLE_COLOR
1219 free(syntaxstr);
1220 while (syntaxes != NULL) {
1221 syntaxtype *bill = syntaxes;
1222
1223 free(syntaxes->desc);
1224 while (syntaxes->extensions != NULL) {
1225 exttype *bob = syntaxes->extensions;
1226
1227 syntaxes->extensions = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001228 regfree(&bob->val);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001229 free(bob);
1230 }
1231 while (syntaxes->color != NULL) {
1232 colortype *bob = syntaxes->color;
1233
1234 syntaxes->color = bob->next;
Chris Allegretta7662c862003-01-13 01:35:15 +00001235 regfree(&bob->start);
1236 if (bob->end != NULL)
Chris Allegrettace452fb2003-02-03 02:56:44 +00001237 regfree(bob->end);
1238 free(bob->end);
Chris Allegretta6df90f52002-07-19 01:08:59 +00001239 free(bob);
1240 }
1241 syntaxes = syntaxes->next;
1242 free(bill);
1243 }
1244#endif /* ENABLE_COLOR */
Chris Allegretta5beed502003-01-05 20:41:21 +00001245#ifndef NANO_SMALL
1246 /* free history lists */
1247 free_history(&search_history);
1248 free_history(&replace_history);
1249#endif
David Lawrence Ramseya27bd652004-08-17 05:23:38 +00001250#ifdef ENABLE_NANORC
1251 free(homedir);
1252#endif
Chris Allegrettaf5de33a2002-02-27 04:14:16 +00001253}
Chris Allegretta6232d662002-05-12 19:52:15 +00001254#endif /* DEBUG */