1
1

Converting #ifdef ENABLE_NANORC to #ifndef DISABLE_NANORC.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
Benno Schulenberg 2014-04-13 20:50:20 +00:00
родитель b988132343
Коммит eea0908236
14 изменённых файлов: 70 добавлений и 62 удалений

Просмотреть файл

@ -9,6 +9,8 @@
* configure.ac, doc/texinfo/nano.texi: Make --enable-tiny disable
the use of libmagic, and document the --disable-libmagic flag.
* src/nano.c (version): Print the correct --enable/--disable option.
* configure.ac, src/*, doc/texinfo/nano.texi: Convert all occurrences
of #ifdef ENABLE_NANORC to #ifndef DISABLE_NANORC, and adapt for it.
2014-04-10 Benno Schulenberg <bensberg@justemail.net>
* doc/syntax/Makefile.am: Add four recent syntaxes to the packlist.

Просмотреть файл

@ -121,8 +121,9 @@ fi
AC_ARG_ENABLE(nanorc,
AS_HELP_STRING([--disable-nanorc], [Disable use of .nanorc files]))
if test "x$enable_nanorc" != xno; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.])
if test "x$enable_nanorc" = xno; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
else
nanorc_support=yes
fi
@ -193,6 +194,9 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_multibuffer" != xyes; then
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
fi
if test "x$enable_nanorc" != xyes; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
fi
if test "x$enable_operatingdir" != xyes; then
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
fi

Просмотреть файл

@ -872,6 +872,12 @@ command-line option, which enables the mouse functionality.
Disable support for opening multiple files at a time and switching
between them on the fly.
@item --disable-nanorc
Disable support for reading the nanorc files at startup. With such
support, you can store custom settings in a system-wide and a per-user
nanorc file rather than having to pass command-line options to get
the desired behavior. See @xref{Nanorc Files}, for more info.
@item --disable-operatingdir
Disable setting the operating directory. This also eliminates the -o
command-line option, which sets the operating directory.
@ -896,12 +902,6 @@ code. It also disables the function toggles.
Enable support for runtime debug output. This can get pretty messy, so
chances are you only want this feature when you're working on the nano source.
@item --enable-nanorc
Enable support for reading the nanorc file at startup. You can store
custom settings in the nanorc file rather than having to pass command
line options to get desired behavior. See @xref{Nanorc Files}, for
more info.
@item --disable-nls
Disables Native Language support. This will disable use of the
available GNU @code{nano} translations.

Просмотреть файл

@ -891,7 +891,7 @@ char *mbrevstrpbrk(const char *s, const char *accept, const char
}
#endif /* !NANO_TINY */
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
/* Return TRUE if the string s contains one or more blank characters,
* and FALSE otherwise. */
bool has_blank_chars(const char *s)
@ -933,7 +933,7 @@ bool has_blank_mbchars(const char *s)
#endif
return has_blank_chars(s);
}
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#endif /* !DISABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
#ifdef ENABLE_UTF8
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
@ -945,7 +945,7 @@ bool is_valid_unicode(wchar_t wc)
}
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
/* Check if the string s is a valid multibyte string. Return TRUE if it
* is, and FALSE otherwise. */
bool is_valid_mbstring(const char *s)
@ -958,4 +958,4 @@ bool is_valid_mbstring(const char *s)
#endif
TRUE;
}
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */

Просмотреть файл

@ -475,7 +475,7 @@ bool close_buffer(void)
if (openfile == openfile->next)
return FALSE;
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs()+1);
#endif
@ -1185,7 +1185,7 @@ void do_insertfile(
}
#endif
#if !defined(DISABLE_MULTIBUFFER) && defined(ENABLE_NANORC)
#if !defined(DISABLE_MULTIBUFFER) && !defined(DISABLE_NANORC)
if (ISSET(MULTIBUFFER)) {
/* Update the screen to account for the current
* buffer. */
@ -2891,7 +2891,7 @@ const char *tail(const char *foo)
return tmp;
}
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
/* Return the constructed dorfile path, or NULL if we can't find the home
* directory. The string is dynamically allocated, and should be
* freed. */
@ -2939,7 +2939,6 @@ void history_error(const char *msg, ...)
fprintf(stderr, _("\nPress Enter to continue\n"));
while (getchar() != '\n')
;
}
/* Now that we have more than one history file, let's just rely on a
@ -3158,7 +3157,7 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
char *fullpath = get_full_path(file);
if (fullpath == NULL)
return 0;
return 0;
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
if (!strcmp(posptr->filename, fullpath)) {
@ -3232,4 +3231,4 @@ void load_poshistory(void)
}
}
#endif /* !NANO_TINY && ENABLE_NANORC */
#endif /* !NANO_TINY && !DISABLE_NANORC */

Просмотреть файл

@ -88,7 +88,7 @@ char *matchbrackets = NULL;
* searches. */
#endif
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
char *whitespace = NULL;
/* The characters used when displaying the first characters of
* tabs and spaces. */
@ -1593,7 +1593,7 @@ sc *strtosc(char *input)
return s;
}
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
/* Same thing as above but for the menu. */
int strtomenu(char *input)
{
@ -1729,7 +1729,7 @@ void thanks_for_all_the_fish(void)
if (replaceage != NULL)
free_filestruct(replaceage);
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
if (homedir != NULL)
free(homedir);
#endif

Просмотреть файл

@ -216,7 +216,7 @@ void help_init(void)
int scsfound = 0;
#ifndef NANO_TINY
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
UNSET(WHITESPACE_DISPLAY);
@ -474,7 +474,7 @@ void help_init(void)
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
#endif

Просмотреть файл

@ -48,7 +48,7 @@
static int oldinterval = -1;
/* Used to store the user's original mouse click interval. */
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
static bool no_rcfiles = FALSE;
/* Should we ignore all rcfiles? */
#endif
@ -613,7 +613,7 @@ void finish(void)
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &oldterm);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
if (!no_rcfiles && ISSET(HISTORYLOG))
save_history();
if (!no_rcfiles && ISSET(POS_HISTORY)) {
@ -856,7 +856,7 @@ void usage(void)
#ifndef DISABLE_MULTIBUFFER
print_opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
#ifndef NANO_TINY
print_opt("-G", "--locking",
N_("Use (vim-style) lock files"));
@ -992,6 +992,9 @@ void version(void)
#ifndef DISABLE_MOUSE
printf(" --enable-mouse");
#endif
#ifndef DISABLE_NANORC
printf(" --enable-nanorc");
#endif
#ifndef DISABLE_MULTIBUFFER
printf(" --enable-multibuffer");
#endif
@ -1032,6 +1035,9 @@ void version(void)
#ifdef DISABLE_MULTIBUFFER
printf(" --disable-multibuffer");
#endif
#ifdef DISABLE_NANORC
printf(" --disable-nanorc");
#endif
#ifdef DISABLE_OPERATINGDIR
printf(" --disable-operatingdir");
#endif
@ -1052,9 +1058,6 @@ void version(void)
#ifdef DEBUG
printf(" --enable-debug");
#endif
#ifdef ENABLE_NANORC
printf(" --enable-nanorc");
#endif
#ifndef ENABLE_NLS
printf(" --disable-nls");
#endif
@ -1428,7 +1431,7 @@ void do_toggle(int flag)
case SUSPEND:
signal_init();
break;
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
case WHITESPACE_DISPLAY:
titlebar(NULL);
edit_refresh();
@ -2107,7 +2110,7 @@ int main(int argc, char **argv)
#ifndef DISABLE_MULTIBUFFER
{"multibuffer", 0, NULL, 'F'},
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
{"ignorercfiles", 0, NULL, 'I'},
#endif
{"rebindkeypad", 0, NULL, 'K'},
@ -2191,7 +2194,7 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
#endif
#if !defined(ENABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
#if defined(DISABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
/* 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)
@ -2241,7 +2244,7 @@ int main(int argc, char **argv)
SET(MULTIBUFFER);
break;
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
#ifndef NANO_TINY
case 'G':
SET(LOCKING);
@ -2408,7 +2411,7 @@ int main(int argc, char **argv)
if (ISSET(RESTRICTED)) {
UNSET(SUSPEND);
UNSET(BACKUP_FILE);
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
no_rcfiles = TRUE;
#endif
}
@ -2420,7 +2423,7 @@ int main(int argc, char **argv)
/* We've read through the command line options. Now back up the flags
* and values that are set, and read the rcfile(s). If the values
* haven't changed afterward, restore the backed-up values. */
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
if (!no_rcfiles) {
#ifndef DISABLE_OPERATINGDIR
char *operating_dir_cpy = operating_dir;
@ -2503,7 +2506,7 @@ int main(int argc, char **argv)
else if (geteuid() == NANO_ROOT_UID)
SET(NO_WRAP);
#endif
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */
#ifndef DISABLE_WRAPPING
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
@ -2520,7 +2523,7 @@ int main(int argc, char **argv)
#ifndef NANO_TINY
/* Set up the search/replace history. */
history_init();
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
if (!no_rcfiles) {
if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
if (check_dotnano() == 0) {
@ -2533,7 +2536,7 @@ int main(int argc, char **argv)
if (ISSET(POS_HISTORY))
load_poshistory();
}
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */
/* Set up the backup directory (unless we're using restricted mode,
* in which case backups are disabled, since they would allow
@ -2604,7 +2607,7 @@ int main(int argc, char **argv)
if (matchbrackets == NULL)
matchbrackets = mallocstrcpy(NULL, "(<[{)>]}");
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
/* If whitespace wasn't specified, set its default value. If we're
* using UTF-8, it's Unicode 00BB (Right-Pointing Double Angle
* Quotation Mark) and Unicode 00B7 (Middle Dot). Otherwise, it's
@ -2623,7 +2626,7 @@ int main(int argc, char **argv)
whitespace_len[1] = 1;
}
}
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */
#endif /* !NANO_TINY */
/* If tabsize wasn't specified, set its default value. */
@ -2703,7 +2706,7 @@ int main(int argc, char **argv)
iline = 1;
icol = 1;
}
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;
@ -2750,7 +2753,7 @@ int main(int argc, char **argv)
if (startline > 1 || startcol > 1)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
FALSE);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol;

Просмотреть файл

@ -438,7 +438,7 @@ typedef struct shortcut {
/* Next shortcut. */
} shortcut;
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
typedef struct rcoption {
const char *name;
/* The name of the rcfile option. */

Просмотреть файл

@ -60,7 +60,7 @@ extern openfilestruct *openfile;
extern char *matchbrackets;
#endif
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
extern char *whitespace;
extern int whitespace_len[2];
extern undo_type last_action;
@ -221,14 +221,14 @@ char *revstrpbrk(const char *s, const char *accept, const char
char *mbrevstrpbrk(const char *s, const char *accept, const char
*rev_start);
#endif
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
bool has_blank_chars(const char *s);
bool has_blank_mbchars(const char *s);
#endif
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
bool is_valid_mbstring(const char *s);
#endif
@ -325,7 +325,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
*lastwastab, void (*refresh_func)(void), bool *list);
#endif
const char *tail(const char *foo);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
char *histfilename(void);
void load_history(void);
bool writehist(FILE *hist, filestruct *histhead);
@ -551,7 +551,7 @@ void do_prompt_abort(void);
int do_yesno_prompt(bool all, const char *msg);
/* All functions in rcfile.c. */
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
void rcfile_error(const char *msg, ...);
char *parse_next_word(char *ptr);
char *parse_argument(char *ptr);
@ -615,7 +615,7 @@ void do_gotopos(ssize_t pos_line, size_t pos_x, ssize_t pos_y, size_t
#ifndef NANO_TINY
bool find_bracket_match(bool reverse, const char *bracket_set);
void do_find_bracket(void);
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
bool history_has_changed(void);
#endif
void history_init(void);
@ -701,7 +701,7 @@ void align(char **str);
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
#ifndef HAVE_GETLINE
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
#endif

Просмотреть файл

@ -31,7 +31,7 @@
#include <unistd.h>
#include <ctype.h>
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
static const rcoption rcopts[] = {
{"boldtext", BOLD_TEXT},
@ -1356,4 +1356,4 @@ void do_rcfile(void)
#endif
}
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */

Просмотреть файл

@ -32,7 +32,7 @@
static bool search_last_line = FALSE;
/* Have we gone past the last line while searching? */
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
static bool history_changed = FALSE;
/* Have any of the history lists changed? */
#endif
@ -1292,7 +1292,7 @@ void do_find_bracket(void)
free(found_ch);
}
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
/* Indicate whether any of the history lists have changed. */
bool history_has_changed(void)
{
@ -1395,7 +1395,7 @@ void update_history(filestruct **h, const char *s)
*hbot = (*hbot)->next;
(*hbot)->data = mallocstrcpy(NULL, "");
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
/* Indicate that the history's been changed. */
history_changed = TRUE;
#endif

Просмотреть файл

@ -187,7 +187,7 @@ void sunder(char *str)
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA. */
#ifdef ENABLE_NANORC
#ifndef DISABLE_NANORC
#ifndef HAVE_GETDELIM
/* This function is equivalent to getdelim(). */
@ -247,7 +247,7 @@ ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
return getdelim(lineptr, n, '\n', stream);
}
#endif
#endif /* ENABLE_NANORC */
#endif /* !DISABLE_NANORC */
#ifdef HAVE_REGEX_H
/* Do the compiled regex in preg and the regex in string match the

Просмотреть файл

@ -1995,7 +1995,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
/* If buf contains a tab character, interpret it. */
if (*buf_mb == '\t') {
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
if (ISSET(WHITESPACE_DISPLAY)) {
int i;
@ -2030,7 +2030,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
free(ctrl_buf_mb);
/* If buf contains a space character, interpret it. */
} else if (*buf_mb == ' ') {
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
if (ISSET(WHITESPACE_DISPLAY)) {
int i;
@ -2278,7 +2278,7 @@ void statusbar(const char *msg, ...)
va_list ap;
char *bar, *foo;
size_t start_x, foo_len;
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
bool old_whitespace;
#endif
@ -2294,7 +2294,7 @@ void statusbar(const char *msg, ...)
blank_statusbar();
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
old_whitespace = ISSET(WHITESPACE_DISPLAY);
UNSET(WHITESPACE_DISPLAY);
#endif
@ -2302,7 +2302,7 @@ void statusbar(const char *msg, ...)
vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap);
va_end(ap);
foo = display_string(bar, 0, COLS - 4, FALSE);
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
#if !defined(NANO_TINY) && !defined(DISABLE_NANORC)
if (old_whitespace)
SET(WHITESPACE_DISPLAY);
#endif