Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8a890962f8 | ||
|
|
50ee461ff5 | ||
|
|
15c9b9a3a2 | ||
|
|
f8770d632e | ||
|
|
2ceb858030 | ||
|
|
35bd350c03 | ||
|
|
b995263309 | ||
|
|
b1eb0ee20b | ||
|
|
86058fa97f | ||
|
|
ec71964386 | ||
|
|
a4ede3c21e | ||
|
|
99c61e207f | ||
|
|
2aa69bcf27 | ||
|
|
3c019ef217 | ||
|
|
870dc48ef0 | ||
|
|
6dfd398531 | ||
|
|
a9003419e1 | ||
|
|
33b0c6874a | ||
|
|
0e1df431a8 | ||
|
|
d8d19ba324 | ||
|
|
5314b8dd8a | ||
|
|
cc91cf41a0 | ||
|
|
e44cd2dfba | ||
|
|
9e7b2d572c | ||
|
|
30ca7d5219 | ||
|
|
6e1cd2d2f3 | ||
|
|
4154d08362 | ||
|
|
8310cd3de6 | ||
|
|
f38b27e0a1 | ||
|
|
9eaa50d69c | ||
|
|
61848f172a | ||
|
|
0ec34ac28a | ||
|
|
cb04b56c92 | ||
|
|
5d7a1017ef | ||
|
|
9009890726 | ||
|
|
4554520805 | ||
|
|
70afb990b3 | ||
|
|
b5ba9df80f | ||
|
|
904a510ee1 | ||
|
|
c4592f3a55 | ||
|
|
44e671f2de | ||
|
|
ce270393be | ||
|
|
6335fb54d5 | ||
|
|
4b1c73ee17 | ||
|
|
bd34da7d1d | ||
|
|
0c7e6d7aed | ||
|
|
fc77fde448 | ||
|
|
e9252c55e2 |
@@ -4,7 +4,7 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh \
|
||||
missing mkinstalldirs nano.spec
|
||||
README README.CVS THANKS TODO UPGRADE config.rpath \
|
||||
install-sh missing mkinstalldirs nano.spec
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
11
NEWS
11
NEWS
@@ -1,3 +1,10 @@
|
||||
2007.01.29 - GNU nano 2.0.3 flows toward its ending. This release
|
||||
contains several minor optimizations to make the
|
||||
executable a little smaller under some circumstances,
|
||||
some translation updates, improvements to the color
|
||||
syntax for Python, and still more minor documentation
|
||||
updates. Have fun.
|
||||
|
||||
2006.12.20 - GNU nano 2.0.2 forges ahead. This release fixes a segfault
|
||||
when trying to save in a nonexistent directory; fixes
|
||||
handling of strings containing nulls at the "Write File",
|
||||
@@ -220,8 +227,8 @@
|
||||
and replacing all text in a file now properly updates
|
||||
the screen in all cases. New features include sample
|
||||
regexes for patch files, improvements to the sample
|
||||
regexes for C files, and support for strings
|
||||
greater than 1023 characters and/or containing nulls in
|
||||
regexes for C files, and support for strings greater
|
||||
than 1023 characters and/or containing nulls in
|
||||
.nano_history. Additionally, the full justify keystroke
|
||||
has been changed to match current Pico, and whitespace
|
||||
display mode is now turned off by default. Enjoy.
|
||||
|
||||
4
README
4
README
@@ -19,7 +19,7 @@ Overview
|
||||
|
||||
The nano editor is now an official GNU package. For more
|
||||
information on GNU and the Free Software Foundation, please see
|
||||
http://www.gnu.org.
|
||||
http://www.gnu.org/.
|
||||
|
||||
How to compile and install nano
|
||||
|
||||
@@ -67,6 +67,4 @@ Current Status
|
||||
|
||||
GNU nano has reached its third stable milestone, 2.0.x.
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -42,11 +42,7 @@ If you're using a C shell (e.g. tcsh or csh), do
|
||||
After that's set up, cd to your src directory and use the following
|
||||
command to download the CVS tree:
|
||||
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_2_branch":
|
||||
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_1_2_branch nano
|
||||
$ cvs -z3 -d:pserver:anonymous@cvs.savannah.gnu.org:/sources/nano checkout -r nano_2_0_branch nano
|
||||
|
||||
|
||||
Generate the configure script
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.0.2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.0.3], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -372,6 +372,7 @@ int main(void)
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
|
||||
AM_CONDITIONAL(USE_NANORC, test x$nanorc_support = xyes)
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 2.0.2. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 2.0.3. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.0/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
@@ -171,9 +171,11 @@
|
||||
<hr width="100%">
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<blockquote><p>If a command line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number and the latter is always treated as a filename. If a command line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:</p>
|
||||
<p>To open '+filename.txt' starting on line 1: <b>nano +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10: <b>nano +10 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1, column 20: <b>nano +,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 10, column 20: <b>nano +10,20 +filename.txt</b><br>
|
||||
To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 10 (if nano has been compiled with multibuffer support): <b>nano +1 +filename.txt +20 filename.txt</b></p></blockquote>
|
||||
<h2><a name="4.2"></a>4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</h2>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.</p>
|
||||
@@ -254,7 +256,8 @@
|
||||
<h2><a name="7.5"></a>7.5. Can I have CVS write access?</h2>
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote><p>2006/11/25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
<blockquote><p>2007/01/01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006/11/25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006/10/28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006/10/06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006/07/25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
|
||||
@@ -4,15 +4,22 @@ else
|
||||
SUBDIRS =
|
||||
endif
|
||||
|
||||
if USE_NANORC
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
|
||||
else
|
||||
man_MANS = nano.1 rnano.1
|
||||
BUILT_SOURCES = nano.1.html rnano.1.html
|
||||
endif
|
||||
|
||||
nano_man_mans = nano.1 nanorc.5 rnano.1
|
||||
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
rnano.1.html: rnano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
|
||||
mandir = @mandir@/fr
|
||||
|
||||
if USE_NANORC
|
||||
man_MANS = nano.1 nanorc.5 rnano.1
|
||||
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
|
||||
else
|
||||
man_MANS = nano.1 rnano.1
|
||||
BUILT_SOURCES = nano.1.html rnano.1.html
|
||||
endif
|
||||
|
||||
nano_man_mans = nano.1 nanorc.5 rnano.1
|
||||
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
|
||||
|
||||
nano.1.html: nano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
nanorc.5.html: nanorc.5
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
rnano.1.html: rnano.1
|
||||
cat $< | groff -t -mandoc -Thtml > $@
|
||||
groff -t -mandoc -Thtml < $< > $@
|
||||
|
||||
EXTRA_DIST = $(man_MANS) $(BUILT_SOURCES)
|
||||
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
syntax "python" "\.py$"
|
||||
icolor brightblue "def [0-9A-Z_]+"
|
||||
color brightcyan "\<(and|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|map|not|or|pass|print|raise|return|try|while)\>"
|
||||
color brightgreen "["'].*[^\\]["']" "["']{3}.*[^\\]["']{3}"
|
||||
color brightgreen "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color brightgreen "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
color brightgreen start=""""[^"]" end=""""" start="'''[^']" end="'''"
|
||||
color brightred "#.*$"
|
||||
|
||||
@@ -5,6 +5,6 @@ MAKEINFO = makeinfo --no-split
|
||||
BUILT_SOURCES = nano.html
|
||||
|
||||
nano.html: nano.texi
|
||||
cat $< | makeinfo --no-split --html > $@
|
||||
makeinfo --no-split --html < $< > $@
|
||||
|
||||
EXTRA_DIST = $(info_TEXINFOS) $(BUILT_SOURCES)
|
||||
|
||||
@@ -19,6 +19,9 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run
|
||||
gmodule)
|
||||
pkg_config_args="$pkg_config_args gmodule-2.0"
|
||||
;;
|
||||
gmodule-no-export)
|
||||
pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
|
||||
;;
|
||||
gobject)
|
||||
pkg_config_args="$pkg_config_args gobject-2.0"
|
||||
;;
|
||||
|
||||
32
po/ChangeLog
32
po/ChangeLog
@@ -1,7 +1,25 @@
|
||||
2007-01-29 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* ru.po: Updated Russian translation by Dimitriy Ryazantcev.
|
||||
* ru.po: Fix incorrect "Project-Id-Version" entry and misplaced
|
||||
space.
|
||||
|
||||
2007-01-13 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* es.po: Fix misplaced space.
|
||||
* eu.po: Fix typos and misplaced space.
|
||||
* fr.po: Fix misplaced space.
|
||||
* gl.po: Fix typos and misplaced space.
|
||||
* nb.po: Fix typos and more misplaced space.
|
||||
|
||||
2007-01-06 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* nb.po: Fix misplaced space.
|
||||
|
||||
2006-12-06 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* hu.po: Removed unneeded duplicate plural forms again.
|
||||
* ms.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* ms.po: Fix incorrect "Project-Id-Version" entry.
|
||||
|
||||
2006-12-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -12,7 +30,7 @@
|
||||
2006-11-20 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* tr.po: Removed unneeded blank plural forms, as gettext 0.15
|
||||
generates errors upon encountering them.
|
||||
generates errors upon encountering them.
|
||||
|
||||
2006-10-25 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -93,9 +111,9 @@
|
||||
2006-08-15 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* hu.po: Removed unneeded duplicate plural forms, as gettext
|
||||
0.15 generates errors upon encountering them.
|
||||
0.15 generates errors upon encountering them.
|
||||
* id.po: Removed unneeded duplicate plural forms, as gettext
|
||||
0.15 generates errors upon encountering them.
|
||||
0.15 generates errors upon encountering them.
|
||||
|
||||
2006-06-20 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
@@ -106,9 +124,9 @@
|
||||
|
||||
2006-06-20 David Lawrence Ramsey <pooka109@cox.net>
|
||||
|
||||
* fr.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* hu.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* it.po: Fixed incorrect "Project-Id-Version" entry.
|
||||
* fr.po: Fix incorrect "Project-Id-Version" entry.
|
||||
* hu.po: Fix incorrect "Project-Id-Version" entry.
|
||||
* it.po: Fix incorrect "Project-Id-Version" entry.
|
||||
|
||||
2006-06-19 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
|
||||
649
po/pt_BR.po
649
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1943
po/zh_TW.po
1943
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -44,7 +44,7 @@ static size_t selected = 0;
|
||||
static bool search_last_file = FALSE;
|
||||
/* Have we gone past the last file while searching? */
|
||||
|
||||
/* Our main file browser function. path is the tilde-expanded path to
|
||||
/* Our main file browser function. path is the tilde-expanded path we
|
||||
* start browsing from. */
|
||||
char *do_browser(char *path, DIR *dir)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* The directory we were in, if any, before backing up via
|
||||
* browsing to "..". */
|
||||
char *ans = NULL;
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
size_t old_selected;
|
||||
/* The selected file we had before the current selected file. */
|
||||
|
||||
@@ -844,9 +844,8 @@ int filesearch_init(void)
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Use last_search if answer is an empty string, or
|
||||
* answer if it isn't. */
|
||||
if (ISSET(USE_REGEXP) &&
|
||||
regexp_init((i == -2) ? last_search :
|
||||
answer) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
|
||||
last_search : answer))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -1030,7 +1029,7 @@ void do_fileresearch(void)
|
||||
if (last_search[0] != '\0') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -38,9 +38,8 @@ static bool use_utf8 = FALSE;
|
||||
/* Whether we've enabled UTF-8 support. */
|
||||
static const wchar_t bad_wchar = 0xFFFD;
|
||||
/* If we get an invalid multibyte sequence, we treat it as
|
||||
* Unicode FFFD (Replacement Character), unless we're
|
||||
* determining if it's a control character or searching for a
|
||||
* match to it. */
|
||||
* Unicode FFFD (Replacement Character), unless we're searching
|
||||
* for a match to it. */
|
||||
static const char *const bad_mbchar = "\xEF\xBF\xBD";
|
||||
static const int bad_mbchar_len = 3;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -29,7 +29,7 @@
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
/* For each syntax list entry, go through the list of colors and assign
|
||||
* color pairs. */
|
||||
* the color pairs. */
|
||||
void set_colorpairs(void)
|
||||
{
|
||||
const syntaxtype *this_syntax = syntaxes;
|
||||
|
||||
10
src/cut.c
10
src/cut.c
@@ -3,7 +3,7 @@
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -146,7 +146,7 @@ void do_cut_text(
|
||||
if (copy_text) {
|
||||
if (cutbuffer != NULL) {
|
||||
/* If the cutbuffer isn't empty, save where it currently
|
||||
* ends. This is where the new text will be added. */
|
||||
* ends. This is where we'll add the new text. */
|
||||
cb_save = cutbottom;
|
||||
cb_save_len = strlen(cutbottom->data);
|
||||
}
|
||||
@@ -173,12 +173,12 @@ void do_cut_text(
|
||||
cut_marked();
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
/* If the CUT_TO_END flag is set, move all text up to the end of
|
||||
* the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
/* Move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
|
||||
85
src/files.c
85
src/files.c
@@ -3,7 +3,7 @@
|
||||
* files.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -579,9 +579,9 @@ void read_file(FILE *f, const char *filename)
|
||||
* "New File" if the file is missing. Otherwise, say "[filename] not
|
||||
* found".
|
||||
*
|
||||
* Return -2 if we say "New File". Otherwise, -1 if the file isn't
|
||||
* opened, 0 otherwise. The file might still have an error while
|
||||
* reading with a 0 return value. *f is set to the opened file. */
|
||||
* Return -2 if we say "New File", -1 if the file isn't opened, and 0
|
||||
* otherwise. The file might still have an error while reading with a 0
|
||||
* return value. *f is set to the opened file. */
|
||||
int open_file(const char *filename, bool newfie, FILE **f)
|
||||
{
|
||||
struct stat fileinfo;
|
||||
@@ -681,7 +681,7 @@ void do_insertfile(
|
||||
int i;
|
||||
const char *msg;
|
||||
char *ans = mallocstrcpy(NULL, "");
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
filestruct *edittop_save = openfile->edittop;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
@@ -1250,28 +1250,27 @@ int copy_file(FILE *inn, FILE *out)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Write a file out. If f_open isn't NULL, we assume that it is a
|
||||
* stream associated with the file, and we don't try to open it
|
||||
/* Write a file out to disk. If f_open isn't NULL, we assume that it is
|
||||
* a stream associated with the file, and we don't try to open it
|
||||
* ourselves. If tmp is TRUE, we set the umask to disallow anyone else
|
||||
* from accessing the file, we don't set the filename to its name, and
|
||||
* we don't print out how many lines we wrote on the statusbar.
|
||||
*
|
||||
* tmp means we are writing a temporary file in a secure fashion. We
|
||||
* use it when spell checking or dumping the file on an error.
|
||||
* use it when spell checking or dumping the file on an error. If
|
||||
* append is APPEND, it means we are appending instead of overwriting.
|
||||
* If append is PREPEND, it means we are prepending instead of
|
||||
* overwriting. If nonamechange is TRUE, we don't change the current
|
||||
* filename. nonamechange is ignored if tmp is FALSE, we're appending,
|
||||
* or we're prepending.
|
||||
*
|
||||
* append == APPEND means we are appending instead of overwriting.
|
||||
* append == PREPEND means we are prepending instead of overwriting.
|
||||
*
|
||||
* nonamechange means don't change the current filename. It is ignored
|
||||
* if tmp is FALSE or if we're appending/prepending.
|
||||
*
|
||||
* Return 0 on success or -1 on error. */
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
* Return TRUE on success or FALSE on error. */
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange)
|
||||
{
|
||||
int retval = -1;
|
||||
bool retval = FALSE;
|
||||
/* Instead of returning in this function, you should always
|
||||
* merely set retval and then goto cleanup_and_exit. */
|
||||
* set retval and then goto cleanup_and_exit. */
|
||||
size_t lineswritten = 0;
|
||||
const filestruct *fileptr = openfile->fileage;
|
||||
int fd;
|
||||
@@ -1686,7 +1685,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
titlebar(NULL);
|
||||
}
|
||||
|
||||
retval = 0;
|
||||
retval = TRUE;
|
||||
|
||||
cleanup_and_exit:
|
||||
free(realname);
|
||||
@@ -1697,11 +1696,12 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Write a marked selection from a file out. */
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
/* Write a marked selection from a file out to disk. Return TRUE on
|
||||
* success or FALSE on error. */
|
||||
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append)
|
||||
{
|
||||
int retval = -1;
|
||||
bool retval;
|
||||
bool old_modified = openfile->modified;
|
||||
/* write_file() unsets the modified flag. */
|
||||
bool added_magicline = FALSE;
|
||||
@@ -1746,16 +1746,17 @@ int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
/* Write the current file to disk. If the mark is on, write the current
|
||||
* marked selection to disk. If exiting is TRUE, write the file to disk
|
||||
* regardless of whether the mark is on, and without prompting if the
|
||||
* TEMP_FILE flag is set. */
|
||||
int do_writeout(bool exiting)
|
||||
* TEMP_FILE flag is set. Return TRUE on success or FALSE on error. */
|
||||
bool do_writeout(bool exiting)
|
||||
{
|
||||
int i, retval = 0;
|
||||
int i;
|
||||
append_type append = OVERWRITE;
|
||||
char *ans;
|
||||
/* The last answer the user typed on the statusbar. */
|
||||
/* The last answer the user typed at the statusbar prompt. */
|
||||
#ifdef NANO_EXTRA
|
||||
static bool did_credits = FALSE;
|
||||
#endif
|
||||
bool retval = FALSE;
|
||||
|
||||
currshortcut = writefile_list;
|
||||
|
||||
@@ -1764,7 +1765,7 @@ int do_writeout(bool exiting)
|
||||
FALSE);
|
||||
|
||||
/* Write succeeded. */
|
||||
if (retval == 0)
|
||||
if (retval)
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1820,7 +1821,7 @@ int do_writeout(bool exiting)
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || answer[0] == '\n') {
|
||||
statusbar(_("Cancelled"));
|
||||
retval = -1;
|
||||
retval = FALSE;
|
||||
break;
|
||||
} else {
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
@@ -1874,7 +1875,7 @@ int do_writeout(bool exiting)
|
||||
strcasecmp(answer, "zzy") == 0) {
|
||||
do_credits();
|
||||
did_credits = TRUE;
|
||||
retval = -1;
|
||||
retval = FALSE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -1940,16 +1941,16 @@ int do_writeout(bool exiting)
|
||||
sunder(answer);
|
||||
align(&answer);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Here's where we allow the selected text to be written to
|
||||
* a separate file. If we're using restricted mode, this is
|
||||
* disabled, since it allows reading from or writing to
|
||||
* files not specified on the command line. */
|
||||
if (!ISSET(RESTRICTED) && !exiting && openfile->mark_set)
|
||||
retval = write_marked_file(answer, NULL, FALSE, append);
|
||||
else
|
||||
retval =
|
||||
#ifndef NANO_TINY
|
||||
(!ISSET(RESTRICTED) && !exiting && openfile->mark_set) ?
|
||||
write_marked_file(answer, NULL, FALSE, append) :
|
||||
#endif
|
||||
retval = write_file(answer, NULL, FALSE, append, FALSE);
|
||||
write_file(answer, NULL, FALSE, append, FALSE);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2049,15 +2050,19 @@ void free_chararray(char **array, size_t len)
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* Is the given file a directory? */
|
||||
int is_dir(const char *buf)
|
||||
/* Is the given path a directory? */
|
||||
bool is_dir(const char *buf)
|
||||
{
|
||||
char *dirptr = real_dir_from_tilde(buf);
|
||||
char *dirptr;
|
||||
struct stat fileinfo;
|
||||
int retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
bool retval;
|
||||
|
||||
assert(buf != NULL && dirptr != buf);
|
||||
assert(buf != NULL);
|
||||
|
||||
dirptr = real_dir_from_tilde(buf);
|
||||
|
||||
retval = (stat(dirptr, &fileinfo) != -1 &&
|
||||
S_ISDIR(fileinfo.st_mode));
|
||||
|
||||
free(dirptr);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* global.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -110,7 +110,7 @@ size_t quotelen;
|
||||
#endif
|
||||
|
||||
char *answer = NULL;
|
||||
/* The answer string used in the statusbar prompt. */
|
||||
/* The answer string used by the statusbar prompt. */
|
||||
|
||||
ssize_t tabsize = -1;
|
||||
/* The width of a tab in spaces. The default value is set in
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* help.c *
|
||||
* *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -51,7 +51,7 @@ void do_help(void (*refresh_func)(void))
|
||||
/* The current shortcut list. */
|
||||
#endif
|
||||
const char *ptr;
|
||||
/* The current line of help text. */
|
||||
/* The current line of the help text. */
|
||||
size_t old_line = (size_t)-1;
|
||||
/* The line we were on before the current line. */
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -272,8 +272,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
||||
|
||||
free(char_mb);
|
||||
|
||||
/* If we haven't found it, leave the cursor at the end of the
|
||||
* file. */
|
||||
/* If we haven't found it, move to the end of the file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->filebot;
|
||||
|
||||
@@ -371,8 +370,7 @@ bool do_prev_word(bool allow_punct, bool allow_update)
|
||||
}
|
||||
}
|
||||
|
||||
/* If we haven't found it, leave the cursor at the beginning of the
|
||||
* file. */
|
||||
/* If we haven't found it, move to the beginning of the file. */
|
||||
if (openfile->current == NULL)
|
||||
openfile->current = openfile->fileage;
|
||||
/* If we've found it, move backward until we find the character
|
||||
|
||||
33
src/nano.c
33
src/nano.c
@@ -3,7 +3,7 @@
|
||||
* nano.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -47,7 +47,7 @@ static bool no_rcfiles = FALSE;
|
||||
static struct termios oldterm;
|
||||
/* The user's original terminal settings. */
|
||||
static struct sigaction act;
|
||||
/* For all our fun signal handlers. */
|
||||
/* Used to set up all our fun signal handlers. */
|
||||
|
||||
/* Create a new filestruct node. Note that we do not set prevnode->next
|
||||
* to the new line. */
|
||||
@@ -168,8 +168,8 @@ void renumber(filestruct *fileptr)
|
||||
fileptr->lineno = ++line;
|
||||
}
|
||||
|
||||
/* Partition a filestruct so it begins at (top, top_x) and ends at (bot,
|
||||
* bot_x). */
|
||||
/* Partition a filestruct so that it begins at (top, top_x) and ends at
|
||||
* (bot, bot_x). */
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x)
|
||||
{
|
||||
@@ -221,8 +221,8 @@ partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
return p;
|
||||
}
|
||||
|
||||
/* Unpartition a filestruct so it begins at (fileage, 0) and ends at
|
||||
* (filebot, strlen(filebot->data)) again. */
|
||||
/* Unpartition a filestruct so that it begins at (fileage, 0) and ends
|
||||
* at (filebot, strlen(filebot->data)) again. */
|
||||
void unpartition_filestruct(partition **p)
|
||||
{
|
||||
char *tmp;
|
||||
@@ -523,7 +523,7 @@ void print_view_warning(void)
|
||||
statusbar(_("Key invalid in view mode"));
|
||||
}
|
||||
|
||||
/* What we do when we're all set to exit. */
|
||||
/* Make nano exit gracefully. */
|
||||
void finish(void)
|
||||
{
|
||||
/* Blank the statusbar (and shortcut list, if applicable), and move
|
||||
@@ -547,10 +547,11 @@ void finish(void)
|
||||
thanks_for_all_the_fish();
|
||||
#endif
|
||||
|
||||
/* Get out. */
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Die (gracefully?). */
|
||||
/* Make nano die gracefully. */
|
||||
void die(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -605,15 +606,14 @@ void die_save_file(const char *die_filename)
|
||||
if (ISSET(RESTRICTED))
|
||||
return;
|
||||
|
||||
/* If we can't save, we have REAL bad problems, but we might as well
|
||||
* TRY. */
|
||||
/* If we can't save, we have really bad problems, but we might as
|
||||
* well try. */
|
||||
if (die_filename[0] == '\0')
|
||||
die_filename = "nano";
|
||||
|
||||
retval = get_next_filename(die_filename, ".save");
|
||||
if (retval[0] != '\0')
|
||||
failed = (write_file(retval, NULL, TRUE, OVERWRITE,
|
||||
TRUE) == -1);
|
||||
failed = !write_file(retval, NULL, TRUE, OVERWRITE, TRUE);
|
||||
|
||||
if (!failed)
|
||||
fprintf(stderr, _("\nBuffer written to %s\n"), retval);
|
||||
@@ -698,7 +698,7 @@ void mouse_init(void)
|
||||
|
||||
/* Print one usage string to the screen. This cuts down on duplicate
|
||||
* strings to translate, and leaves out the parts that shouldn't be
|
||||
* translatable (the flag names). */
|
||||
* translatable (i.e. the flag names). */
|
||||
void print_opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
@@ -924,6 +924,11 @@ void nano_disabled_msg(void)
|
||||
statusbar(_("Sorry, support for this function has been disabled"));
|
||||
}
|
||||
|
||||
/* If the current file buffer has been modified, and the TEMP_FILE flag
|
||||
* isn't set, ask whether or not to save the file buffer. If the
|
||||
* TEMP_FILE flag is set, save it unconditionally. Then, if more than
|
||||
* one file buffer is open, close the current file buffer and switch to
|
||||
* the next one. If only one file buffer is open, exit from nano. */
|
||||
void do_exit(void)
|
||||
{
|
||||
int i;
|
||||
@@ -946,7 +951,7 @@ void do_exit(void)
|
||||
|
||||
/* If the user chose not to save, or if the user chose to save and
|
||||
* the save succeeded, we're ready to exit. */
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE) == 0)) {
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -50,7 +50,7 @@
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Macros for character allocation, etc. */
|
||||
/* Macros for character allocation and more. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* prompt.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <string.h>
|
||||
|
||||
static char *prompt = NULL;
|
||||
/* The prompt string for statusbar questions. */
|
||||
/* The prompt string used for statusbar questions. */
|
||||
static size_t statusbar_x = (size_t)-1;
|
||||
/* The cursor position in answer. */
|
||||
static size_t statusbar_pww = (size_t)-1;
|
||||
|
||||
44
src/proto.h
44
src/proto.h
@@ -3,7 +3,7 @@
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -26,8 +26,7 @@
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
/* All public external variables. See global.c for their
|
||||
* descriptions. */
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
#ifndef NANO_TINY
|
||||
extern sigjmp_buf jump_buf;
|
||||
extern bool jump_buf_main;
|
||||
@@ -142,7 +141,7 @@ extern int reverse_attr;
|
||||
|
||||
extern char *homedir;
|
||||
|
||||
/* All public functions in browser.c. */
|
||||
/* All functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path, DIR *dir);
|
||||
char *do_browse_from(const char *inpath);
|
||||
@@ -161,7 +160,7 @@ void do_last_file(void);
|
||||
char *striponedir(const char *path);
|
||||
#endif
|
||||
|
||||
/* All public functions in chars.c. */
|
||||
/* All functions in chars.c. */
|
||||
#ifdef ENABLE_UTF8
|
||||
void utf8_init(void);
|
||||
bool using_utf8(void);
|
||||
@@ -243,14 +242,14 @@ bool is_valid_unicode(wchar_t wc);
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
/* All public functions in color.c. */
|
||||
/* All functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void color_init(void);
|
||||
void color_update(void);
|
||||
#endif
|
||||
|
||||
/* All public functions in cut.c. */
|
||||
/* All functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
@@ -272,7 +271,7 @@ void do_cut_till_end(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* All public functions in files.c. */
|
||||
/* All functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
@@ -311,13 +310,13 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange);
|
||||
#ifndef NANO_TINY
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append);
|
||||
#endif
|
||||
int do_writeout(bool exiting);
|
||||
bool do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
@@ -325,6 +324,7 @@ int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool is_dir(const char *buf);
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
size_t buflen);
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
@@ -340,7 +340,7 @@ bool writehist(FILE *hist, filestruct *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* All public functions in global.c. */
|
||||
/* All functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_TINY
|
||||
void toggle_init_one(int val
|
||||
@@ -362,7 +362,7 @@ void free_shortcutage(shortcut **shortcutage);
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* All public functions in help.c. */
|
||||
/* All functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
void do_help(void (*refresh_func)(void));
|
||||
void do_help_void(void);
|
||||
@@ -374,7 +374,7 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key);
|
||||
size_t help_line_len(const char *ptr);
|
||||
#endif
|
||||
|
||||
/* All public functions in move.c. */
|
||||
/* All functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_page_up(void);
|
||||
@@ -418,7 +418,7 @@ void do_scroll_down(void);
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* All public functions in nano.c. */
|
||||
/* All functions in nano.c. */
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *begin, filestruct *newnode, filestruct
|
||||
@@ -489,7 +489,7 @@ bool do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* All public functions in prompt.c. */
|
||||
/* All functions in prompt.c. */
|
||||
int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
||||
bool *ran_func, bool *finished, bool allow_funcs, void
|
||||
(*refresh_func)(void));
|
||||
@@ -546,7 +546,7 @@ int do_prompt(bool allow_tabs,
|
||||
void do_prompt_abort(void);
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* All public functions in rcfile.c. */
|
||||
/* All functions in rcfile.c. */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
@@ -567,9 +567,9 @@ void parse_rcfile(FILE *rcstream
|
||||
void do_rcfile(void);
|
||||
#endif
|
||||
|
||||
/* All public functions in search.c. */
|
||||
/* All functions in search.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
int regexp_init(const char *regexp);
|
||||
bool regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
#endif
|
||||
void not_found_msg(const char *str);
|
||||
@@ -623,7 +623,7 @@ char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* All public functions in text.c. */
|
||||
/* All functions in text.c. */
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
@@ -680,7 +680,7 @@ void do_wordlinechar_count(void);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
|
||||
/* All public functions in utils.c. */
|
||||
/* All functions in utils.c. */
|
||||
int digits(size_t n);
|
||||
void get_homedir(void);
|
||||
bool parse_num(const char *str, ssize_t *val);
|
||||
@@ -728,7 +728,7 @@ void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
|
||||
/* All public functions in winio.c. */
|
||||
/* All functions in winio.c. */
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -97,8 +97,7 @@ static const rcoption rcopts[] = {
|
||||
static bool errors = FALSE;
|
||||
/* Whether we got any errors while parsing an rcfile. */
|
||||
static size_t lineno = 0;
|
||||
/* If we did, the line number where the current error
|
||||
* occurred. */
|
||||
/* If we did, the line number where the last error occurred. */
|
||||
static char *nanorc = NULL;
|
||||
/* The path to the rcfile we're parsing. */
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
34
src/search.c
34
src/search.c
@@ -3,7 +3,7 @@
|
||||
* search.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -39,21 +39,20 @@ static bool history_changed = FALSE;
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
|
||||
/* Regular expression helper functions. */
|
||||
|
||||
/* Compile the given regular expression. Return value 0 means the
|
||||
* expression was invalid, and we wrote an error message on the status
|
||||
* bar. Return value 1 means success. */
|
||||
int regexp_init(const char *regexp)
|
||||
/* Compile the regular expression regexp to see if it's valid. Return
|
||||
* TRUE if it is, or FALSE otherwise. */
|
||||
bool regexp_init(const char *regexp)
|
||||
{
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
int rc;
|
||||
|
||||
assert(!regexp_compiled);
|
||||
|
||||
rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
#ifndef NANO_TINY
|
||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||
#endif
|
||||
);
|
||||
|
||||
assert(!regexp_compiled);
|
||||
|
||||
if (rc != 0) {
|
||||
size_t len = regerror(rc, &search_regexp, NULL, 0);
|
||||
char *str = charalloc(len);
|
||||
@@ -61,11 +60,13 @@ int regexp_init(const char *regexp)
|
||||
regerror(rc, &search_regexp, str, len);
|
||||
statusbar(_("Bad regex \"%s\": %s"), regexp, str);
|
||||
free(str);
|
||||
return 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
regexp_compiled = TRUE;
|
||||
return 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Decompile the compiled regular expression we used in the last
|
||||
@@ -218,9 +219,8 @@ int search_init(bool replacing, bool use_answer)
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Use last_search if answer is an empty string, or
|
||||
* answer if it isn't. */
|
||||
if (ISSET(USE_REGEXP) &&
|
||||
regexp_init((i == -2) ? last_search :
|
||||
answer) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init((i == -2) ?
|
||||
last_search : answer))
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
@@ -511,7 +511,7 @@ void do_research(void)
|
||||
if (last_search[0] != '\0') {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return;
|
||||
#endif
|
||||
|
||||
@@ -977,7 +977,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
if (interactive) {
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
|
||||
/* Ask for it. */
|
||||
/* Ask for the line and column. */
|
||||
int i = do_prompt(FALSE,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
TRUE,
|
||||
|
||||
28
src/text.c
28
src/text.c
@@ -3,7 +3,7 @@
|
||||
* text.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -191,11 +191,11 @@ void do_tab(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Indent or unindent the current line (or all lines covered by the mark
|
||||
* if the mark is on) len columns, depending on whether len is positive
|
||||
* or negative. If the TABS_TO_SPACES flag is set, indent/unindent by
|
||||
* len spaces. Otherwise, indent/unindent by (len / tabsize) tabs and
|
||||
* (len % tabsize) spaces. */
|
||||
/* Indent or unindent the current line (or, if the mark is on, all lines
|
||||
* covered by the mark) len columns, depending on whether len is
|
||||
* positive or negative. If the TABS_TO_SPACES flag is set, indent or
|
||||
* unindent by len spaces. Otherwise, indent or unindent by (len /
|
||||
* tabsize) tabs and (len % tabsize) spaces. */
|
||||
void do_indent(ssize_t cols)
|
||||
{
|
||||
bool indent_changed = FALSE;
|
||||
@@ -2197,7 +2197,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
|
||||
if (!WIFEXITED(alt_spell_status) ||
|
||||
WEXITSTATUS(alt_spell_status) != 0) {
|
||||
char *altspell_error;
|
||||
char *alt_spell_error;
|
||||
char *invoke_error = _("Error invoking \"%s\"");
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -2205,11 +2205,11 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
openfile->mark_set = old_mark_set;
|
||||
#endif
|
||||
|
||||
altspell_error =
|
||||
alt_spell_error =
|
||||
charalloc(strlen(invoke_error) +
|
||||
strlen(alt_speller) + 1);
|
||||
sprintf(altspell_error, invoke_error, alt_speller);
|
||||
return altspell_error;
|
||||
sprintf(alt_spell_error, invoke_error, alt_speller);
|
||||
return alt_spell_error;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -2301,7 +2301,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
* specified, use it. Otherwise, use the internal spell checker. */
|
||||
void do_spell(void)
|
||||
{
|
||||
int i;
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
const char *spell_msg;
|
||||
@@ -2311,14 +2311,14 @@ void do_spell(void)
|
||||
return;
|
||||
}
|
||||
|
||||
i =
|
||||
status =
|
||||
#ifndef NANO_TINY
|
||||
(openfile->mark_set) ? write_marked_file(temp, temp_file, TRUE,
|
||||
openfile->mark_set ? write_marked_file(temp, temp_file, TRUE,
|
||||
OVERWRITE) :
|
||||
#endif
|
||||
write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
|
||||
if (i == -1) {
|
||||
if (!status) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
free(temp);
|
||||
return;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -46,7 +46,7 @@ int digits(size_t n)
|
||||
}
|
||||
|
||||
/* Return the user's home directory. We use $HOME, and if that fails,
|
||||
* we fall back on getpwuid(). */
|
||||
* we fall back on the home directory of the effective user ID. */
|
||||
void get_homedir(void)
|
||||
{
|
||||
if (homedir == NULL) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* winio.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta *
|
||||
* Copyright (C) 2005, 2006 David Lawrence Ramsey *
|
||||
* Copyright (C) 2005, 2006, 2007 David Lawrence Ramsey *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2, or (at your option) *
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <ctype.h>
|
||||
|
||||
static int *key_buffer = NULL;
|
||||
/* The keystroke buffer, containing all the keystrokes we have
|
||||
* at a given point. */
|
||||
/* The keystroke buffer, containing all the keystrokes we
|
||||
* haven't handled yet at a given point. */
|
||||
static size_t key_buffer_len = 0;
|
||||
/* The length of the keystroke buffer. */
|
||||
static int statusblank = 0;
|
||||
@@ -3213,7 +3213,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"(c) 1999, 2000, 2001, 2002, 2003, 2004 Chris Allegretta",
|
||||
"(c) 2005, 2006 David Lawrence Ramsey",
|
||||
"(c) 2005, 2006, 2007 David Lawrence Ramsey",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
|
||||
Reference in New Issue
Block a user