complicated for a feature freeze.
- Disable VSTOP keystroke. Stops people accidentally locking up
nano (suggested by David Benbennick).
+ - Pluralize messages with ngettext() where needed. (David
+ Benbennick)
+ - Update nano.1 and nano.1.html to show that nano now does an
+ emergency save on receiving SIGHUP or SIGTERM. (DLR)
+ - Don't include "nowrap" in the long options if
+ DISABLE_WRAPPING is defined. (DLR)
+- files.c:
+ read_file()
+ - Minor efficiency fixes, some of which fit in with the change
+ to ngettext() usage mentioned above. (David Benbennick)
+ do_browser()
+ - Make sure the value of path is mallocstrcpy()ed into retval
+ and not just assigned to it, to avoid memory corruption
+ problems. (DLR)
+- nano.c:
+ justify_format()
+ - Make sure the double space maintained after sentence-ending
+ punctuation is done when that punctuation is immediately
+ followed by a bracket-type character, so justifying e.g.
+ sentences in parentheses works properly. (David Benbennick)
+ handle_hup()
+ - Renamed handle_hupterm() to show that it now handles SIGTERM
+ as well as SIGHUP. (DLR)
+ signal_init()
+ - Do an emergency save on receiving either SIGHUP or SIGTERM,
+ not just SIGHUP. (David Benbennick)
+ main()
+ - Fix a problem where control key commands were printed
+ literally instead of interpreted after a failed search of a
+ one-line file. (David Benbennick)
+- proto.h:
+ handle_hup()
+ - Renamed handle_hupterm(); see above for why. (DLR)
+- winio.c:
+ edit_add()
+ - Fix a potential infinite loop occurring with certain
+ zero-length regexes. (David Benbennick)
GNU nano 1.1.11 - 10/01/2002
- General:
#ifdef ENABLE_COLOR
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
/* For each syntax list entry, we go through the list of colors and
* assign color pairs. */
void set_colorpairs(void)
dnl Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(fcntl.h unistd.h termios.h termio.h limits.h getopt.h regex.h)
+AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h termio.h termios.h regex.h unistd.h)
dnl options
AC_ARG_ENABLE(debug,
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
static int marked_cut; /* Is the cutbuffer from a mark? */
static filestruct *cutbottom = NULL; /* Pointer to end of cutbuffer */
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
#ifndef NANO_SMALL
static int fileformat = 0; /* 0 = *nix, 1 = DOS, 2 = Mac */
#endif
#endif
/* Did we even GET a file if we don't already have one? */
- if (totsize == 0 || fileptr == NULL) {
+ if (totsize == 0 || fileptr == NULL)
new_file();
- statusbar(_("Read %d lines"), num_lines);
- return 1;
- }
/* Did we try to insert a file of 0 bytes? */
- if (num_lines == 0)
- {
- statusbar(_("Read %d lines"), 0);
- return 1;
- }
-
- if (current != NULL) {
- fileptr->next = current;
- current->prev = fileptr;
- renumber(current);
- current_x = 0;
- placewewant = 0;
- } else if (fileptr->next == NULL) {
- filebot = fileptr;
- new_magicline();
- totsize--;
-
- /* Update the edit buffer; note that if using multibuffers, a
- quiet load will update the current open_files entry, while a
- noisy load will add a new open_files entry */
- load_file(quiet);
+ if (num_lines != 0) {
+ if (current != NULL) {
+ fileptr->next = current;
+ current->prev = fileptr;
+ renumber(current);
+ current_x = 0;
+ placewewant = 0;
+ } else if (fileptr->next == NULL) {
+ filebot = fileptr;
+ new_magicline();
+ totsize--;
+ load_file(quiet);
+ }
}
#ifndef NANO_SMALL
if (fileformat == 2)
- statusbar(_("Read %d lines (Converted from Mac format)"), num_lines);
+ statusbar(ngettext("Read %d line (Converted from Mac format)",
+ "Read %d lines (Converted from Mac format)",
+ num_lines), num_lines);
else if (fileformat == 1)
- statusbar(_("Read %d lines (Converted from DOS format)"), num_lines);
+ statusbar(ngettext("Read %d line (Converted from DOS format)",
+ "Read %d lines (Converted from DOS format)",
+ num_lines), num_lines);
else
#endif
- statusbar(_("Read %d lines"), num_lines);
+ statusbar(ngettext("Read %d line", "Read %d lines", num_lines),
+ num_lines);
totlines += num_lines;
/* Update originalfilestat to reference the file as it is now. */
stat(filename, &originalfilestat);
#endif
- statusbar(_("Wrote %d lines"), lineswritten);
+ statusbar(ngettext("Wrote %d line", "Wrote %d lines", lineswritten),
+ lineswritten);
UNSET(MODIFIED);
titlebar(NULL);
}
free(foo);
return do_browser(path);
} else {
- retval = path;
+ retval = mallocstrcpy(retval, path);
abort = 1;
}
break;
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
/*
* Global variables
*/
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
int do_home(void)
{
UNSET(KEEP_CUTBUFFER);
Ignored, for compatibility with Pico.
.SH NOTES
\fBnano\fP will try to dump the buffer into an emergency file in some
-cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or runs
-out of memory, when it will write the buffer into a file named
-"nano.save" if the buffer didn't have a name already, or will add a
-".save" suffix to the current filename. If an emergency file with that
+cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or
+SIGTERM or runs out of memory, when it will write the buffer into a file
+named "nano.save" if the buffer didn't have a name already, or will add
+a ".save" suffix to the current filename. If an emergency file with that
name already exists in the current directory, ".save" and a number (e.g.
".save.1") will be suffixed to the current filename in order to make it
unique. In multibuffer mode, \fBnano\fP will write all the open buffers
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
</HEAD><BODY>
<H1>NANO</H1>
-Section: User Commands (1)<BR>Updated: July 30, 2002<BR><A HREF="#index">Index</A>
+Section: User Commands (1)<BR>Updated: October 13, 2002<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<H2>NOTES</H2>
<B>nano</B> will try to dump the buffer into an emergency file in some
-cases. Mainly, this will happen if <B>nano</B> receives a SIGHUP or runs
-out of memory, when it will write the buffer into a file named
-"nano.save" if the buffer didn't have a name already, or will add a
-".save" suffix to the current filename. If an emergency file with that
+cases. Mainly, this will happen if <B>nano</B> receives a SIGHUP or
+SIGTERM or runs out of memory, when it will write the buffer into a file
+named "nano.save" if the buffer didn't have a name already, or will add
+a ".save" suffix to the current filename. If an emergency file with that
name already exists in the current directory, ".save" and a number (e.g.
".save.1") will be suffixed to the current filename in order to make it
unique. In multibuffer mode, <B>nano</B> will write all the open buffers
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
-Time: 21:12:05 GMT, July 30, 2002
+Time: 16:04:40 GMT, October 13, 2002
</BODY>
</HTML>
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
back = line->data + skip;
front = back;
for (; *front; front++) {
+ int remove_space = 0;
+ /* Do we want to remove this space? */
+
if (*front == '\t') {
if (!changes_allowed)
return 1;
*front = ' ';
}
/* these tests are safe since line->data + skip is not a space */
- if (*front == ' ' && *(front - 1) == ' ' && *(front - 2) != '.' &&
- *(front - 2) != '!' && *(front - 2) != '?') {
+ if (*front == ' ' && *(front-1) == ' ') {
+ const char *brackets = _("'\")}]>");
+ const char *punct = _(".?!");
+ const char *bob = front - 2;
+
+ remove_space = 1;
+ for (bob = front - 2; bob >= line->data + skip; bob--) {
+ if (strchr(punct, *bob) != NULL) {
+ remove_space = 0;
+ break;
+ }
+ if (strchr(brackets, *bob) == NULL)
+ break;
+ }
+ }
+
+ if (remove_space) {
/* Now *front is a space we want to remove. We do that by
- * simply failing to assign it to *back */
+ * simply failing to assign it to *back. */
if (!changes_allowed)
return 1;
#ifndef NANO_SMALL
act.sa_handler = SIG_IGN;
sigaction(SIGINT, &act, NULL);
- /* Trap SIGHUP cuz we want to write the file out. */
- act.sa_handler = handle_hup;
+ /* Trap SIGHUP and SIGTERM cuz we want to write the file out. */
+ act.sa_handler = handle_hupterm;
sigaction(SIGHUP, &act, NULL);
+ sigaction(SIGTERM, &act, NULL);
#ifndef NANO_SMALL
act.sa_handler = handle_sigwinch;
#endif
}
-/* Handler for SIGHUP */
-RETSIGTYPE handle_hup(int signal)
+/* Handler for SIGHUP and SIGTERM */
+RETSIGTYPE handle_hupterm(int signal)
{
- die(_("Received SIGHUP"));
+ die(_("Received SIGHUP or SIGTERM"));
}
/* What do we do when we catch the suspend signal */
#endif
{"tempfile", 0, 0, 't'},
{"view", 0, 0, 'v'},
+#ifndef DISABLE_WRAPPING
{"nowrap", 0, 0, 'w'},
+#endif
{"nohelp", 0, 0, 'x'},
{"suspend", 0, 0, 'z'},
#ifndef NANO_SMALL
while (1) {
-#ifndef DISABLE_MOUSE
+#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP)
currshortcut = main_list;
#endif
#include <curses.h>
#endif /* CURSES_H */
-#ifdef HAVE_LIBINTL_H
-#include <libintl.h>
+#ifdef ENABLE_NLS
+# ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# endif
+# define _(string) gettext(string)
+#else
+# define _(string) (string)
+# define ngettext(singular, plural, number) number == 1 ? singular : plural
#endif
#include <sys/types.h>
int do_justify(void);
int do_exit(void);
void signal_init(void);
-RETSIGTYPE handle_hup(int signal);
+RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_cont(int signal);
#ifndef NANO_SMALL
#ifdef ENABLE_NANORC
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
const static rcoption rcopts[] = {
#ifndef NANO_SMALL
{"autoindent", AUTOINDENT},
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
/* Regular expression helper functions */
#ifdef HAVE_REGEX_H
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
int is_cntrl_char(int c)
{
if (iscntrl(c) || ((c & 127) != 127 && iscntrl(c & 127)))
#include "proto.h"
#include "nano.h"
-#ifdef ENABLE_NLS
-#include <libintl.h>
-#define _(string) gettext(string)
-#else
-#define _(string) (string)
-#endif
-
static int statblank = 0; /* Number of keystrokes left after
we call statusbar(), before we
actually blank the statusbar */
/* Translate the match to the beginning of the line. */
startmatch.rm_so += k;
startmatch.rm_eo += k;
- if (startmatch.rm_so == startmatch.rm_eo)
+ if (startmatch.rm_so == startmatch.rm_eo) {
+ startmatch.rm_eo++;
statusbar(_("Refusing 0 length regex match"));
- else if (startmatch.rm_so < start + COLS &&
+ } else if (startmatch.rm_so < start + COLS &&
startmatch.rm_eo > start) {
x_start = startmatch.rm_so - start;
if (x_start < 0)