2009-12-01 Kamil Dudka <kdudka@redhat.com>
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
macro IGNORE_CALL_RESULT.
2009-12-01 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
Christian Weisgerber.
* doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.
2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init) - Add support for ^P and ^N in the help menu.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
15
ChangeLog
15
ChangeLog
@@ -1,6 +1,19 @@
|
|||||||
|
2009-12-01 Kamil Dudka <kdudka@redhat.com>
|
||||||
|
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
|
||||||
|
macro IGNORE_CALL_RESULT.
|
||||||
|
|
||||||
|
2009-12-01 Chris Allegretta <chrisa@asty.org>
|
||||||
|
* global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
|
||||||
|
Christian Weisgerber.
|
||||||
|
* doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.
|
||||||
|
|
||||||
|
2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
|
||||||
|
* global.c (shortcut_init) - Add support for ^P and ^N in the help menu.
|
||||||
|
|
||||||
GNU nano 2.2.0 - 2009.11.30
|
GNU nano 2.2.0 - 2009.11.30
|
||||||
2009-11-29 Chris Allegretta <chrisa@asty.org>
|
2009-11-29 Chris Allegretta <chrisa@asty.org>
|
||||||
* prompt.c (get_prompt_string) - Universally handle help key when is disabled. Fixes Savannah
|
* prompt.c (get_prompt_string) - Universally handle help key when is
|
||||||
|
disabled. Fixes Savannah
|
||||||
bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
|
bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
|
||||||
* chars.c, files.c: Add junk vars to silence the compiler. Sigh.
|
* chars.c, files.c: Add junk vars to silence the compiler. Sigh.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
AC_INIT([GNU nano], [2.2.0], [nano-devel@gnu.org], [nano])
|
AC_INIT([GNU nano], [2.2.0-svn], [nano-devel@gnu.org], [nano])
|
||||||
AC_CONFIG_SRCDIR([src/nano.c])
|
AC_CONFIG_SRCDIR([src/nano.c])
|
||||||
AC_CANONICAL_TARGET([])
|
AC_CANONICAL_TARGET([])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ followed by an alpha character or the word "Space".
|
|||||||
Example: ^C
|
Example: ^C
|
||||||
.TP
|
.TP
|
||||||
.B M-
|
.B M-
|
||||||
followed by a prinable character or the word "Space".
|
followed by a printable character or the word "Space".
|
||||||
Example: M-C
|
Example: M-C
|
||||||
.TP
|
.TP
|
||||||
.B F
|
.B F
|
||||||
|
|||||||
40
src/chars.c
40
src/chars.c
@@ -79,6 +79,16 @@ bool is_byte(int c)
|
|||||||
return ((unsigned int)c == (unsigned char)c);
|
return ((unsigned int)c == (unsigned char)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void mbtowc_reset(void)
|
||||||
|
{
|
||||||
|
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void wctomb_reset(void)
|
||||||
|
{
|
||||||
|
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||||
|
}
|
||||||
|
|
||||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||||
bool is_alnum_mbchar(const char *c)
|
bool is_alnum_mbchar(const char *c)
|
||||||
{
|
{
|
||||||
@@ -89,7 +99,7 @@ bool is_alnum_mbchar(const char *c)
|
|||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = bad_wchar;
|
wc = bad_wchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +119,7 @@ bool is_blank_mbchar(const char *c)
|
|||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = bad_wchar;
|
wc = bad_wchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +166,7 @@ bool is_cntrl_mbchar(const char *c)
|
|||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = bad_wchar;
|
wc = bad_wchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +187,7 @@ bool is_punct_mbchar(const char *c)
|
|||||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||||
|
|
||||||
if (c_mb_len < 0) {
|
if (c_mb_len < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = bad_wchar;
|
wc = bad_wchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,14 +253,14 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
|||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
*crep_len = bad_mbchar_len;
|
*crep_len = bad_mbchar_len;
|
||||||
strncpy(crep, bad_mbchar, *crep_len);
|
strncpy(crep, bad_mbchar, *crep_len);
|
||||||
} else {
|
} else {
|
||||||
*crep_len = wctomb(crep, control_wrep(wc));
|
*crep_len = wctomb(crep, control_wrep(wc));
|
||||||
|
|
||||||
if (*crep_len < 0) {
|
if (*crep_len < 0) {
|
||||||
int shutup = wctomb(NULL, 0);
|
wctomb_reset();
|
||||||
*crep_len = 0;
|
*crep_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,14 +288,14 @@ char *mbrep(const char *c, char *crep, int *crep_len)
|
|||||||
|
|
||||||
/* Reject invalid Unicode characters. */
|
/* Reject invalid Unicode characters. */
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
*crep_len = bad_mbchar_len;
|
*crep_len = bad_mbchar_len;
|
||||||
strncpy(crep, bad_mbchar, *crep_len);
|
strncpy(crep, bad_mbchar, *crep_len);
|
||||||
} else {
|
} else {
|
||||||
*crep_len = wctomb(crep, wc);
|
*crep_len = wctomb(crep, wc);
|
||||||
|
|
||||||
if (*crep_len < 0) {
|
if (*crep_len < 0) {
|
||||||
int shutup = wctomb(NULL, 0);
|
wctomb_reset();
|
||||||
*crep_len = 0;
|
*crep_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +321,7 @@ int mbwidth(const char *c)
|
|||||||
int width;
|
int width;
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = bad_wchar;
|
wc = bad_wchar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +366,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
|||||||
|
|
||||||
/* Reject invalid Unicode characters. */
|
/* Reject invalid Unicode characters. */
|
||||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||||
int shutup = wctomb(NULL, 0);
|
wctomb_reset();
|
||||||
*chr_mb_len = 0;
|
*chr_mb_len = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -388,7 +398,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
|||||||
/* If buf contains an invalid multibyte character, only
|
/* If buf contains an invalid multibyte character, only
|
||||||
* interpret buf's first byte. */
|
* interpret buf's first byte. */
|
||||||
if (buf_mb_len < 0) {
|
if (buf_mb_len < 0) {
|
||||||
int shutup = mblen(NULL, 0);
|
IGNORE_CALL_RESULT(mblen(NULL, 0));
|
||||||
buf_mb_len = 1;
|
buf_mb_len = 1;
|
||||||
} else if (buf_mb_len == 0)
|
} else if (buf_mb_len == 0)
|
||||||
buf_mb_len++;
|
buf_mb_len++;
|
||||||
@@ -545,7 +555,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
|||||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
|
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
|
||||||
|
|
||||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
|
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
ws1 = (unsigned char)*s1_mb;
|
ws1 = (unsigned char)*s1_mb;
|
||||||
bad_s1_mb = TRUE;
|
bad_s1_mb = TRUE;
|
||||||
}
|
}
|
||||||
@@ -553,7 +563,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
|||||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
|
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
|
||||||
|
|
||||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
|
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
ws2 = (unsigned char)*s2_mb;
|
ws2 = (unsigned char)*s2_mb;
|
||||||
bad_s2_mb = TRUE;
|
bad_s2_mb = TRUE;
|
||||||
}
|
}
|
||||||
@@ -781,7 +791,7 @@ char *mbstrchr(const char *s, const char *c)
|
|||||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||||
|
|
||||||
if (c_mb_len < 0) {
|
if (c_mb_len < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
wc = (unsigned char)*c;
|
wc = (unsigned char)*c;
|
||||||
bad_c_mb = TRUE;
|
bad_c_mb = TRUE;
|
||||||
}
|
}
|
||||||
@@ -790,7 +800,7 @@ char *mbstrchr(const char *s, const char *c)
|
|||||||
int s_mb_len = parse_mbchar(s, s_mb, NULL);
|
int s_mb_len = parse_mbchar(s, s_mb, NULL);
|
||||||
|
|
||||||
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
|
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
|
||||||
int shutup = mbtowc(NULL, NULL, 0);
|
mbtowc_reset();
|
||||||
ws = (unsigned char)*s;
|
ws = (unsigned char)*s;
|
||||||
bad_s_mb = TRUE;
|
bad_s_mb = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1092,7 +1092,6 @@ char *get_full_path(const char *origpath)
|
|||||||
char *d_here, *d_there, *d_there_file = NULL;
|
char *d_here, *d_there, *d_there_file = NULL;
|
||||||
const char *last_slash;
|
const char *last_slash;
|
||||||
bool path_only;
|
bool path_only;
|
||||||
int shutup;
|
|
||||||
|
|
||||||
if (origpath == NULL)
|
if (origpath == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1191,7 +1190,7 @@ char *get_full_path(const char *origpath)
|
|||||||
/* Finally, go back to the path specified in d_here,
|
/* Finally, go back to the path specified in d_here,
|
||||||
* where we were before. We don't check for a chdir()
|
* where we were before. We don't check for a chdir()
|
||||||
* error, since we can do nothing if we get one. */
|
* error, since we can do nothing if we get one. */
|
||||||
shutup = chdir(d_here);
|
IGNORE_CALL_RESULT(chdir(d_here));
|
||||||
|
|
||||||
/* Free d_here, since we're done using it. */
|
/* Free d_here, since we're done using it. */
|
||||||
free(d_here);
|
free(d_here);
|
||||||
|
|||||||
12
src/global.c
12
src/global.c
@@ -739,11 +739,11 @@ void shortcut_init(bool unjustify)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
add_to_funcs(DO_FIRST_LINE,
|
add_to_funcs(DO_FIRST_LINE,
|
||||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
|
||||||
first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
|
first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
|
||||||
|
|
||||||
add_to_funcs(DO_LAST_LINE,
|
add_to_funcs(DO_LAST_LINE,
|
||||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
|
||||||
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
|
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
|
||||||
|
|
||||||
|
|
||||||
@@ -1084,10 +1084,10 @@ void shortcut_init(bool unjustify)
|
|||||||
add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE);
|
add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE);
|
||||||
add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE);
|
add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE);
|
||||||
add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE);
|
add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE);
|
||||||
add_to_sclist(MMAIN|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
|
||||||
add_to_sclist(MMAIN|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
|
||||||
add_to_sclist(MMAIN|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
|
||||||
add_to_sclist(MMAIN|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
|
add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
|
||||||
add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE);
|
add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE);
|
||||||
add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE);
|
add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE);
|
||||||
add_to_sclist(MALL, "^E", DO_END, 0, TRUE);
|
add_to_sclist(MALL, "^E", DO_END, 0, TRUE);
|
||||||
|
|||||||
@@ -54,6 +54,9 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Suppress warnings for __attribute__((warn_unused_result)) */
|
||||||
|
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
||||||
|
|
||||||
/* Macros for flags. */
|
/* Macros for flags. */
|
||||||
#define FLAGOFF(flag) ((flag) / (sizeof(unsigned) * 8))
|
#define FLAGOFF(flag) ((flag) / (sizeof(unsigned) * 8))
|
||||||
#define FLAGMASK(flag) (1 << ((flag) % (sizeof(unsigned) * 8)))
|
#define FLAGMASK(flag) (1 << ((flag) % (sizeof(unsigned) * 8)))
|
||||||
|
|||||||
Reference in New Issue
Block a user