zsh: add C89 fixes for gcc2 compatibility

This commit is contained in:
fbrosson
2018-04-14 18:28:38 +00:00
committed by Leorize
parent 92847ab7d9
commit cdde99e18c
2 changed files with 91 additions and 1 deletions

View File

@@ -159,3 +159,93 @@ index 75069c2..7dc785d 100644
--
2.17.0
From 4f73ea2426a76e4e8d07c91cf8cc4f4a967ef815 Mon Sep 17 00:00:00 2001
From: fbrosson <fbrosson@localhost>
Date: Sat, 14 Apr 2018 18:11:49 +0000
Subject: C89 fixes for gcc2 compatibility
diff --git a/Src/exec.c b/Src/exec.c
index e154d12..dba5f37 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3034,10 +3034,11 @@ execcmd_exec(Estate state, Execcmd_params eparams,
}
if (exec_argv0) {
char *str, *s;
+ size_t sz;
exec_argv0 = dupstring(exec_argv0);
remnulargs(exec_argv0);
untokenize(exec_argv0);
- size_t sz = strlen(exec_argv0);
+ sz = strlen(exec_argv0);
str = s = zalloc(5 + 1 + sz + 1);
strcpy(s, "ARGV0=");
s+=6;
diff --git a/Src/init.c b/Src/init.c
index c537266..1686a3c 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1275,8 +1275,9 @@ run_init_scripts(void)
sourcehome(".profile");
if (interact) {
+ char *s;
noerrs = 2;
- char *s = getsparam("ENV");
+ s = getsparam("ENV");
if (s) {
s = dupstring(s);
if (!parsestr(&s)) {
diff --git a/Src/parse.c b/Src/parse.c
index 47e5a24..38890e5 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -403,8 +403,9 @@ ecstrcode(char *s)
unsigned val = hasher(s);
if ((l = strlen(s) + 1) && l <= 4) {
+ wordcode c;
t = has_token(s);
- wordcode c = (t ? 3 : 2);
+ c = (t ? 3 : 2);
switch (l) {
case 4: c |= ((wordcode) STOUC(s[2])) << 19;
case 3: c |= ((wordcode) STOUC(s[1])) << 11;
diff --git a/Src/utils.c b/Src/utils.c
index 180693d..f7b36d6 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -138,10 +138,11 @@ set_widearray(char *mb_array, Widechar_array wca)
static void
zwarning(const char *cmd, const char *fmt, va_list ap)
{
+ char *prefix;
if (isatty(2))
zleentry(ZLE_CMD_TRASH);
- char *prefix = scriptname ? scriptname : (argzero ? argzero : "");
+ prefix = scriptname ? scriptname : (argzero ? argzero : "");
if (cmd) {
if (unset(SHINSTDIN) || locallevel) {
@@ -2763,6 +2764,7 @@ int
checkrmall(char *s)
{
DIR *rmd;
+ const int max_count = 100;
int count = 0;
if (!shout)
return 1;
@@ -2772,7 +2774,6 @@ checkrmall(char *s)
else
s = dyncat("/", s);
}
- const int max_count = 100;
if ((rmd = opendir(unmeta(s)))) {
int ignoredots = !isset(GLOBDOTS);
/* ### TODO: Passing ignoredots here is wrong. See workers/41672
--
2.17.0

View File

@@ -14,7 +14,7 @@ SOURCE_URI_2="https://downloads.sf.net/zsh/zsh-$portVersion-doc.tar.xz"
CHECKSUM_SHA256_2="b995c16a2ded516b6e07883932640fcca8b53b1b8a1934094a8a32ef087f52fc"
PATCHES="zsh-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 x86 x86_64"
ARCHITECTURES="x86_gcc2 ?x86 x86_64"
GLOBAL_WRITABLE_FILES="
settings/zsh directory keep-old