add various cosmetic and #ifdef fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3790 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-07-18 18:16:30 +00:00
parent a5ad825f30
commit 935594b14a
5 changed files with 43 additions and 26 deletions

View File

@ -104,6 +104,11 @@ CVS code -
- nano.h:
- Remove the manual disabling of color support if regex.h isn't
found, as configure.ac now handles that. (DLR)
- If DISABLE_WRAPPING is defined, undefine DISABLE_ROOTWRAP, as
the latter makes no sense when the former is set, and adjust
all #ifdefs that check for both being enabled. (DLR)
- If HAVE_REGEX_H isn't defined, undefine ENABLE_COLOR, as the
latter is useless without regex support. (DLR)
- search.c:
replace_regexp()
- Remove unnecessary casting of c to int. (DLR)
@ -125,6 +130,9 @@ CVS code -
enable color support. (DLR)
- Fix the spacing of the error message displayed when slcurses.h
isn't found. (DLR)
- If we use the --disable-wrapping option, ignore the
--disable-wrapping-as-root option. (DLR)
- Add minor cosmetic tweaks. (DLR)
- doc/syntax/c.nanorc:
- Since .i and .ii are preprocessed C and C++ output, colorize
them here. (Mike Frysinger)

View File

@ -39,7 +39,7 @@ dnl Internationalization macros.
AM_GNU_GETTEXT_VERSION(0.11.5)
AM_GNU_GETTEXT([external], [need-ngettext])
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
AM_CONDITIONAL(USE_NLS, test x$USE_NLS = xyes)
dnl Data location.
@ -56,8 +56,7 @@ dnl Checks for options.
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging (disabled by default)],
[if test x$enableval = xyes; then
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
debug_support=yes
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.]) debug_support=yes
fi])
if test x$debug_support != xyes; then
@ -215,8 +214,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
CURSES_LIB_WIDE=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang"
@ -242,8 +240,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
CURSES_LIB_WIDE=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
@ -264,8 +261,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
CURSES_LIB_WIDE=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
@ -302,8 +298,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang"
else
@ -328,8 +323,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
else
@ -349,8 +343,7 @@ int main(void)
return 0;
}],
[AC_MSG_RESULT(yes)
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
slang_support=yes
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.]) slang_support=yes
if test x$with_slang != xyes; then
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
else
@ -378,7 +371,7 @@ int main(void)
;;
esac], [AC_MSG_RESULT(no)])
AM_CONDITIONAL(USE_COLOR, test "x$color_support" = "xyes")
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
dnl Checks for functions.

View File

@ -872,7 +872,7 @@ void version(void)
#ifdef DISABLE_WRAPPING
printf(" --disable-wrapping");
#endif
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
#ifdef DISABLE_ROOTWRAP
printf(" --disable-wrapping-as-root");
#endif
#ifdef ENABLE_COLOR
@ -1743,9 +1743,9 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
#endif
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
/* If we don't have rcfile support, we're root, and
* --disable-wrapping-as-root is used, turn wrapping off. */
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAP)
/* If we don't have rcfile support, --disable-wrapping-as-root is
* used, and we're root, turn wrapping off. */
if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif
@ -2008,7 +2008,9 @@ int main(int argc, char **argv)
tabsize = tabsize_cpy;
flags |= flags_cpy;
}
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
#ifdef DISABLE_ROOTWRAP
/* If we don't have any rcfiles, --disable-wrapping-as-root is used,
* and we're root, turn wrapping off. */
else if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif

View File

@ -143,10 +143,24 @@
#ifndef NCURSES_MOUSE_VERSION
#define DISABLE_MOUSE 1
#endif
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#ifdef DISABLE_WRAPPING
/* If both wrapping and justifying are disabled, disable all the code
* used by either of the two. */
#ifdef DISABLE_JUSTIFY
#define DISABLE_WRAPJUSTIFY 1
#endif
/* If wrapping is disabled, turn the --disable-wrapping-as-root option
* off, as it's useless then. */
#ifdef DISABLE_ROOTWRAP
#undef DISABLE_ROOTWRAP
#endif
#endif
/* If regex support is disabled, turn color support off, as it's useless
* then. */
#ifndef HAVE_REGEX_H
#undef ENABLE_COLOR
#endif
/* Enumeration types. */
typedef enum {

View File

@ -880,10 +880,10 @@ void do_rcfile(void)
#endif
);
#if defined(DISABLE_ROOTWRAP) && !defined(DISABLE_WRAPPING)
#ifdef DISABLE_ROOTWRAP
/* We've already read SYSCONFDIR/nanorc, if it's there. If we're
* root and --disable-wrapping-as-root is used, turn wrapping
* off now. */
* root, and --disable-wrapping-as-root is used, turn wrapping off
* now. */
if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif