nano: bump to 2.9.8, use libmagic, add small gcc2 patch. (#2697)

This commit is contained in:
fbrosson
2018-06-16 21:23:44 +00:00
parent 85d86bca0e
commit 4fc82ec8f9
2 changed files with 197 additions and 4 deletions

View File

@@ -10,13 +10,14 @@ functionality. Features include:
- Warnings for un-writable files
- More syntax highlighting samples (Fortran, objC, OCaml, Makefiles)"
HOMEPAGE="https://www.nano-editor.org/"
COPYRIGHT="1999-2017 Free Software Foundation, Inc."
COPYRIGHT="1999-2018 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
REVISION="2"
REVISION="1"
SOURCE_URI="https://www.nano-editor.org/dist/v2.9/nano-$portVersion.tar.gz"
CHECKSUM_SHA256="f12058ead9955cb841c1c5e3b9aec6ba93114a807580e928de0eaf6144c91074"
CHECKSUM_SHA256="07192c320b74c1fb78437021e9affa6a9d55b806ee012de601902392eaa03601"
PATCHES="nano-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 ?x86 x86_64"
ARCHITECTURES="x86_gcc2 x86 x86_64"
PROVIDES="
nano = $portVersion compat >= 2
@@ -26,11 +27,13 @@ PROVIDES="
REQUIRES="
haiku
cmd:groff
lib:libmagic
lib:libncurses
"
BUILD_REQUIRES="
haiku_devel
devel:libmagic
devel:libncurses
"
BUILD_PREREQUIRES="
@@ -54,3 +57,8 @@ INSTALL()
{
make install
}
TEST()
{
make check
}

View File

@@ -0,0 +1,185 @@
From 8158628bb0ec27f5a44000efbe08be00a4f63aea Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Sat, 16 Jun 2018 21:07:34 +0000
Subject: C89 fixes for gcc2 compatibility
diff --git a/lib/glob.c b/lib/glob.c
index a5e4e93..d9c7c0f 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -141,8 +141,11 @@ convert_dirent (const struct dirent *source)
struct readdir_result result = { NULL, };
return result;
}
+ else
+ {
struct readdir_result result = READDIR_RESULT_INITIALIZER (source);
return result;
+ }
}
#ifndef COMPILE_GLOB64
@@ -497,6 +500,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
else
{
char *newp;
+ bool drive_root;
dirlen = filename - pattern;
#if defined __MSDOS__ || defined WINDOWS32
@@ -532,18 +536,19 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
++filename;
#if defined __MSDOS__ || defined WINDOWS32
- bool drive_root = (dirlen > 1
+ drive_root = (dirlen > 1
&& (dirname[dirlen - 1] == ':'
|| (dirlen > 2 && dirname[dirlen - 2] == ':'
&& dirname[dirlen - 1] == '/')));
#else
- bool drive_root = false;
+ drive_root = false;
#endif
if (filename[0] == '\0' && dirlen > 1 && !drive_root)
/* "pattern/". Expand "pattern", appending slashes. */
{
int orig_flags = flags;
+ int val;
if (!(flags & GLOB_NOESCAPE) && dirname[dirlen - 1] == '\\')
{
/* "pattern\\/". Remove the final backslash if it hasn't
@@ -557,7 +562,7 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
flags &= ~(GLOB_NOCHECK | GLOB_NOMAGIC);
}
}
- int val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
+ val = glob (dirname, flags | GLOB_MARK, errfunc, pglob);
if (val == 0)
pglob->gl_flags = ((pglob->gl_flags & ~GLOB_MARK)
| (flags & GLOB_MARK));
@@ -775,12 +780,11 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
/* Look up specific user's home directory. */
{
struct passwd *p;
+ struct passwd pwbuf;
struct scratch_buffer pwtmpbuf;
scratch_buffer_init (&pwtmpbuf);
# if defined HAVE_GETPWNAM_R || defined _LIBC
- struct passwd pwbuf;
-
while (getpwnam_r (user_name, &pwbuf,
pwtmpbuf.data, pwtmpbuf.length, &p)
== ERANGE)
@@ -1400,7 +1404,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
while (1)
{
struct globnames *old = names;
- for (size_t i = 0; i < cur; ++i)
+ size_t i;
+ for (i = 0; i < cur; ++i)
free (names->name[i]);
names = names->next;
/* NB: we will not leak memory here if we exit without
@@ -1425,7 +1430,8 @@ glob_in_dir (const char *pattern, const char *directory, int flags,
while (1)
{
struct globnames *old = names;
- for (size_t i = 0; i < cur; ++i)
+ size_t i;
+ for (i = 0; i < cur; ++i)
new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
= names->name[i];
names = names->next;
diff --git a/lib/malloc/scratch_buffer_set_array_size.c b/lib/malloc/scratch_buffer_set_array_size.c
index 4e43e7c..2cef316 100644
--- a/lib/malloc/scratch_buffer_set_array_size.c
+++ b/lib/malloc/scratch_buffer_set_array_size.c
@@ -29,6 +29,7 @@ __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
size_t nelem, size_t size)
{
size_t new_length = nelem * size;
+ char *new_ptr;
/* Avoid overflow check if both values are small. */
if ((nelem | size) >> (sizeof (size_t) * CHAR_BIT / 2) != 0
@@ -48,7 +49,7 @@ __libc_scratch_buffer_set_array_size (struct scratch_buffer *buffer,
/* Discard old buffer. */
scratch_buffer_free (buffer);
- char *new_ptr = malloc (new_length);
+ new_ptr = malloc (new_length);
if (new_ptr == NULL)
{
/* Buffer must remain valid to free. */
diff --git a/src/browser.c b/src/browser.c
index 1213361..ce3df39 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -224,6 +224,7 @@ char *do_browser(char *path)
} else if (func == to_last_file) {
selected = filelist_len - 1;
} else if (func == goto_dir_void) {
+ size_t j;
/* Ask for the directory to go to. */
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
/* TRANSLATORS: This is a prompt. */
@@ -258,7 +259,7 @@ char *do_browser(char *path)
/* In case the specified directory cannot be entered, select it
* (if it is in the current list) so it will be highlighted. */
- for (size_t j = 0; j < filelist_len; j++)
+ for (j = 0; j < filelist_len; j++)
if (strcmp(filelist[j], path) == 0)
selected = j;
diff --git a/src/global.c b/src/global.c
index fc5fad3..2bf3aa5 100644
--- a/src/global.c
+++ b/src/global.c
@@ -1374,7 +1374,8 @@ void shortcut_init(void)
/* Assign one function's shortcuts to another function. */
void replace_scs_for(void (*oldfunc)(void), void (*newfunc)(void))
{
- for (sc *s = sclist; s != NULL; s = s->next)
+ sc *s;
+ for (s = sclist; s != NULL; s = s->next)
if (s->func == oldfunc)
s->func = newfunc;
}
diff --git a/src/winio.c b/src/winio.c
index 281488a..686df45 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -290,7 +290,8 @@ void unget_kbinput(int kbinput, bool metakey)
/* Insert the given string into the keyboard buffer. */
void implant(const char *string)
{
- for (int i = strlen(string); i > 0; i--)
+ int i;
+ for (i = strlen(string); i > 0; i--)
put_back(string[i - 1]);
}
#endif
@@ -1267,6 +1268,7 @@ int arrow_from_abcd(int kbinput)
int parse_escape_sequence(WINDOW *win, int kbinput)
{
int retval, *sequence, length, consumed;
+ int i;
/* Put back the non-escape code, then grab at most five integers
* (the longest possible escape sequence) from the keybuffer and
@@ -1277,7 +1279,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
retval = convert_sequence(sequence, length, &consumed);
/* If not all grabbed integers were consumed, put the leftovers back. */
- for (int i = length - 1; i >= consumed; i--)
+ for (i = length - 1; i >= consumed; i--)
put_back(sequence[i]);
free(sequence);
--
2.17.1