nano moved here.
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
From ffb42bb0d87586adac14144b98333eb52808ce99 Mon Sep 17 00:00:00 2001
|
||||
From: Mehmet Emre Atasever <memre@pardus.org.tr>
|
||||
Date: Sun, 26 Jun 2011 18:39:04 +0300
|
||||
Subject: [PATCH] nanorc default settings changes
|
||||
|
||||
Some default settings are not so convenient for Pisi Linux nano users.
|
||||
|
||||
also fixes bugs (#pb18483, #pb18484)
|
||||
---
|
||||
doc/nanorc.sample.in | 64 +++++++++++++++++++++++++-------------------------
|
||||
1 files changed, 32 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/doc/nanorc.sample.in b/doc/nanorc.sample.in
|
||||
index f164c26..24d3c7b 100644
|
||||
--- a/doc/nanorc.sample.in
|
||||
+++ b/doc/nanorc.sample.in
|
||||
@@ -25,17 +25,17 @@
|
||||
# set backupdir ""
|
||||
|
||||
## Do backwards searches by default.
|
||||
-# set backwards
|
||||
+set backwards
|
||||
|
||||
## Use bold text instead of reverse video text.
|
||||
-# set boldtext
|
||||
+set boldtext
|
||||
|
||||
## The characters treated as closing brackets when justifying
|
||||
## paragraphs. They cannot contain blank characters. Only closing
|
||||
## punctuation, optionally followed by closing brackets, can end
|
||||
## sentences.
|
||||
##
|
||||
-# set brackets ""')>]}"
|
||||
+set brackets ""')>]}"
|
||||
|
||||
## Do case sensitive searches by default.
|
||||
# set casesensitive
|
||||
@@ -60,7 +60,7 @@
|
||||
## searches. They cannot contain blank characters. The former set must
|
||||
## come before the latter set, and both must be in the same order.
|
||||
##
|
||||
-# set matchbrackets "(<[{)>]}"
|
||||
+set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
# set morespace
|
||||
@@ -139,7 +139,7 @@
|
||||
# set smarthome
|
||||
|
||||
## Use smooth scrolling as the default.
|
||||
-# set smooth
|
||||
+set smooth
|
||||
|
||||
## Enable soft line wrapping (AKA full line display).
|
||||
# set softwrap
|
||||
@@ -153,7 +153,7 @@
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
-# set tabsize 8
|
||||
+set tabsize 4
|
||||
|
||||
## Convert typed tabs to spaces.
|
||||
# set tabstospaces
|
||||
@@ -234,79 +234,79 @@
|
||||
|
||||
|
||||
## Nanorc files
|
||||
-# include "@PKGDATADIR@/nanorc.nanorc"
|
||||
+include "@PKGDATADIR@/nanorc.nanorc"
|
||||
|
||||
## C/C++
|
||||
-# include "@PKGDATADIR@/c.nanorc"
|
||||
+include "@PKGDATADIR@/c.nanorc"
|
||||
|
||||
## Makefiles
|
||||
-# include "@PKGDATADIR@/makefile.nanorc"
|
||||
+include "@PKGDATADIR@/makefile.nanorc"
|
||||
|
||||
## Cascading Style Sheets
|
||||
-# include "@PKGDATADIR@/css.nanorc"
|
||||
+include "@PKGDATADIR@/css.nanorc"
|
||||
|
||||
## Debian files
|
||||
-# include "@PKGDATADIR@/debian.nanorc"
|
||||
+include "@PKGDATADIR@/debian.nanorc"
|
||||
|
||||
## Gentoo files
|
||||
-# include "@PKGDATADIR@/gentoo.nanorc"
|
||||
+include "@PKGDATADIR@/gentoo.nanorc"
|
||||
|
||||
## HTML
|
||||
-# include "@PKGDATADIR@/html.nanorc"
|
||||
+include "@PKGDATADIR@/html.nanorc"
|
||||
|
||||
## PHP
|
||||
-# include "@PKGDATADIR@/php.nanorc"
|
||||
+include "@PKGDATADIR@/php.nanorc"
|
||||
|
||||
## TCL
|
||||
-# include "@PKGDATADIR@/tcl.nanorc"
|
||||
+include "@PKGDATADIR@/tcl.nanorc"
|
||||
|
||||
## TeX
|
||||
-# include "@PKGDATADIR@/tex.nanorc"
|
||||
+include "@PKGDATADIR@/tex.nanorc"
|
||||
|
||||
## Quoted emails (under e.g. mutt)
|
||||
-# include "@PKGDATADIR@/mutt.nanorc"
|
||||
+include "@PKGDATADIR@/mutt.nanorc"
|
||||
|
||||
## Patch files
|
||||
-# include "@PKGDATADIR@/patch.nanorc"
|
||||
+include "@PKGDATADIR@/patch.nanorc"
|
||||
|
||||
## Manpages
|
||||
-# include "@PKGDATADIR@/man.nanorc"
|
||||
+include "@PKGDATADIR@/man.nanorc"
|
||||
|
||||
## Groff
|
||||
-# include "@PKGDATADIR@/groff.nanorc"
|
||||
+include "@PKGDATADIR@/groff.nanorc"
|
||||
|
||||
## Perl
|
||||
-# include "@PKGDATADIR@/perl.nanorc"
|
||||
+include "@PKGDATADIR@/perl.nanorc"
|
||||
|
||||
## Python
|
||||
-# include "@PKGDATADIR@/python.nanorc"
|
||||
+include "@PKGDATADIR@/python.nanorc"
|
||||
|
||||
## Ruby
|
||||
-# include "@PKGDATADIR@/ruby.nanorc"
|
||||
+include "@PKGDATADIR@/ruby.nanorc"
|
||||
|
||||
## Java
|
||||
-# include "@PKGDATADIR@/java.nanorc"
|
||||
+include "@PKGDATADIR@/java.nanorc"
|
||||
|
||||
## Fortran
|
||||
-# include "@PKGDATADIR@/fortran.nanorc"
|
||||
+include "@PKGDATADIR@/fortran.nanorc"
|
||||
|
||||
## Objective-C
|
||||
-# include "@PKGDATADIR@/objc.nanorc"
|
||||
+include "@PKGDATADIR@/objc.nanorc"
|
||||
|
||||
## OCaml
|
||||
-# include "@PKGDATADIR@/ocaml.nanorc"
|
||||
+include "@PKGDATADIR@/ocaml.nanorc"
|
||||
|
||||
## AWK
|
||||
-# include "@PKGDATADIR@/awk.nanorc"
|
||||
+include "@PKGDATADIR@/awk.nanorc"
|
||||
|
||||
## Assembler
|
||||
-# include "@PKGDATADIR@/asm.nanorc"
|
||||
+include "@PKGDATADIR@/asm.nanorc"
|
||||
|
||||
## Bourne shell scripts
|
||||
-# include "@PKGDATADIR@/sh.nanorc"
|
||||
+include "@PKGDATADIR@/sh.nanorc"
|
||||
|
||||
## POV-Ray
|
||||
-# include "@PKGDATADIR@/pov.nanorc"
|
||||
+include "@PKGDATADIR@/pov.nanorc"
|
||||
|
||||
## XML-type files
|
||||
-# include "@PKGDATADIR@/xml.nanorc"
|
||||
+include "@PKGDATADIR@/xml.nanorc"
|
||||
--
|
||||
1.7.5.4
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
From fc87b0a32c130a2b3ab37e614d4a1c6c8e5d70e7 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 19 Aug 2010 13:58:12 +0200
|
||||
Subject: [PATCH 1/2] check stat's result and avoid calling stat on a NULL pointer
|
||||
|
||||
---
|
||||
src/files.c | 33 +++++++++++++++++++++++++--------
|
||||
1 files changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index f6efbf1..99cc1b8 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -103,6 +103,24 @@ void initialize_buffer_text(void)
|
||||
openfile->totsize = 0;
|
||||
}
|
||||
|
||||
+#ifndef NANO_TINY
|
||||
+/* If *pstat is NULL, perform a stat call with the given file name. On success,
|
||||
+ * *pstat points to a newly allocated buffer that contains the stat's result.
|
||||
+ * On stat's failure, the NULL pointer in *pstat is left intact. */
|
||||
+void stat_if_needed(const char *filename, struct stat **pstat)
|
||||
+{
|
||||
+ struct stat *tmp;
|
||||
+ if (*pstat)
|
||||
+ return;
|
||||
+
|
||||
+ tmp = (struct stat *)nmalloc(sizeof(struct stat));
|
||||
+ if (0 == stat(filename, tmp))
|
||||
+ *pstat = tmp;
|
||||
+ else
|
||||
+ free(tmp);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* If it's not "", filename is a file to open. We make a new buffer, if
|
||||
* necessary, and then open and read the file, if applicable. */
|
||||
void open_buffer(const char *filename, bool undoable)
|
||||
@@ -148,11 +166,7 @@ void open_buffer(const char *filename, bool undoable)
|
||||
if (rc > 0) {
|
||||
read_file(f, rc, filename, undoable, new_buffer);
|
||||
#ifndef NANO_TINY
|
||||
- if (openfile->current_stat == NULL) {
|
||||
- openfile->current_stat =
|
||||
- (struct stat *)nmalloc(sizeof(struct stat));
|
||||
- stat(filename, openfile->current_stat);
|
||||
- }
|
||||
+ stat_if_needed(filename, &openfile->current_stat);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1532,8 +1546,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
* specified it interactively), stat and save the value
|
||||
* or else we will chase null pointers when we do
|
||||
* modtime checks, preserve file times, etc. during backup */
|
||||
- if (openfile->current_stat == NULL && !tmp && realexists)
|
||||
- stat(realname, openfile->current_stat);
|
||||
+ if (!tmp && realexists)
|
||||
+ stat_if_needed(realname, &openfile->current_stat);
|
||||
|
||||
/* We backup only if the backup toggle is set, the file isn't
|
||||
* temporary, and the file already exists. Furthermore, if we
|
||||
@@ -1924,7 +1938,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
if (openfile->current_stat == NULL)
|
||||
openfile->current_stat =
|
||||
(struct stat *)nmalloc(sizeof(struct stat));
|
||||
- stat(realname, openfile->current_stat);
|
||||
+ if (stat(realname, openfile->current_stat)) {
|
||||
+ free(openfile->current_stat);
|
||||
+ openfile->current_stat = NULL;
|
||||
+ }
|
||||
#endif
|
||||
|
||||
statusbar(P_("Wrote %lu line", "Wrote %lu lines",
|
||||
--
|
||||
1.7.4
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
From 23510b930ea31f7de8005e2f0ff6cab7062b4e26 Mon Sep 17 00:00:00 2001
|
||||
From: Kamil Dudka <kdudka@redhat.com>
|
||||
Date: Thu, 19 Aug 2010 15:23:06 +0200
|
||||
Subject: [PATCH 2/2] use futimens() if available, instead of utime()
|
||||
|
||||
---
|
||||
config.h.in | 3 +++
|
||||
configure | 2 +-
|
||||
configure.ac | 2 +-
|
||||
src/files.c | 48 +++++++++++++++++++++++++++++++++++-------------
|
||||
4 files changed, 40 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/config.h.in b/config.h.in
|
||||
index 52e13f1..cb17b29 100644
|
||||
--- a/config.h.in
|
||||
+++ b/config.h.in
|
||||
@@ -64,6 +64,9 @@
|
||||
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
|
||||
#undef HAVE_DOPRNT
|
||||
|
||||
+/* Define to 1 if you have the `futimens' function. */
|
||||
+#undef HAVE_FUTIMENS
|
||||
+
|
||||
/* Define to 1 if you have the `getdelim' function. */
|
||||
#undef HAVE_GETDELIM
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 02733c7..1805e53 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7484,7 +7484,7 @@ fi
|
||||
|
||||
|
||||
|
||||
-for ac_func in getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf
|
||||
+for ac_func in futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 66f8ee3..f4975d3 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -415,7 +415,7 @@ fi])
|
||||
|
||||
dnl Checks for functions.
|
||||
|
||||
-AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
+AC_CHECK_FUNCS(futimens getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen vsnprintf)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth)
|
||||
diff --git a/src/files.c b/src/files.c
|
||||
index 99cc1b8..9a1bdcc 100644
|
||||
--- a/src/files.c
|
||||
+++ b/src/files.c
|
||||
@@ -1455,6 +1455,29 @@ int copy_file(FILE *inn, FILE *out)
|
||||
return retval;
|
||||
}
|
||||
|
||||
+#ifdef HAVE_FUTIMENS
|
||||
+/* set atime/mtime by file descriptor */
|
||||
+int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
|
||||
+{
|
||||
+ struct timespec times[2];
|
||||
+ (void) filename;
|
||||
+
|
||||
+ times[0].tv_sec = ut->actime;
|
||||
+ times[1].tv_sec = ut->modtime;
|
||||
+ times[0].tv_nsec = 0L;
|
||||
+ times[1].tv_nsec = 0L;
|
||||
+
|
||||
+ return futimens(fd, times);
|
||||
+}
|
||||
+#else
|
||||
+/* set atime/mtime by file name */
|
||||
+int utime_wrap(int fd, const char *filename, struct utimbuf *ut)
|
||||
+{
|
||||
+ (void) fd;
|
||||
+ return utime(filename, ut);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* 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
|
||||
@@ -1694,6 +1717,18 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
fprintf(stderr, "Backing up %s to %s\n", realname, backupname);
|
||||
#endif
|
||||
|
||||
+ /* Set backup's file metadata. */
|
||||
+ if (utime_wrap(backup_fd, backupname, &filetime) == -1
|
||||
+ && !ISSET(INSECURE_BACKUP)) {
|
||||
+ statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
+ strerror(errno));
|
||||
+ /* If we can't write to the backup, DONT go on, since
|
||||
+ whatever caused the backup file to fail (e.g. disk
|
||||
+ full may well cause the real file write to fail, which
|
||||
+ means we could lose both the backup and the original! */
|
||||
+ goto cleanup_and_exit;
|
||||
+ }
|
||||
+
|
||||
/* Copy the file. */
|
||||
copy_status = copy_file(f, backup_file);
|
||||
|
||||
@@ -1704,19 +1739,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
- /* And set its metadata. */
|
||||
- if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
- if (prompt_failed_backupwrite(backupname))
|
||||
- goto skip_backup;
|
||||
- statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
- strerror(errno));
|
||||
- /* If we can't write to the backup, DONT go on, since
|
||||
- whatever caused the backup file to fail (e.g. disk
|
||||
- full may well cause the real file write to fail, which
|
||||
- means we could lose both the backup and the original! */
|
||||
- goto cleanup_and_exit;
|
||||
- }
|
||||
-
|
||||
free(backupname);
|
||||
}
|
||||
|
||||
--
|
||||
1.7.4
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
po/Makefile.in.in | 1 +
|
||||
src/nano.c | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
|
||||
index ada8bb4..f7b2a95 100644
|
||||
--- a/po/Makefile.in.in
|
||||
+++ b/po/Makefile.in.in
|
||||
@@ -20,6 +20,7 @@ VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
+datarootdir = @datarootdir@
|
||||
datadir = @datadir@
|
||||
localedir = $(datadir)/locale
|
||||
gettextsrcdir = $(datadir)/gettext/po
|
||||
diff --git a/src/nano.c b/src/nano.c
|
||||
index 269ab29..5b605bf 100644
|
||||
--- a/src/nano.c
|
||||
+++ b/src/nano.c
|
||||
@@ -1925,7 +1925,7 @@ precalc_cleanup:
|
||||
* TRUE. */
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
{
|
||||
- size_t current_len, orig_lenpt, i = 0;
|
||||
+ size_t current_len, orig_lenpt = 0, i = 0;
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
int char_buf_len;
|
||||
|
||||
diff --git a/src/search.c b/src/search.c
|
||||
index ca93098..3451600 100644
|
||||
--- a/src/search.c
|
||||
+++ b/src/search.c
|
||||
@@ -138,7 +138,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
int i = 0;
|
||||
char *buf;
|
||||
sc *s;
|
||||
- void (*func)(void);
|
||||
+ void (*func)(void) = (void (*)(void))0;
|
||||
bool meta_key = FALSE, func_key = FALSE;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
Reference in New Issue
Block a user