about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2014-06-09 09:50:37 +0100
committerPeter Stephenson <pws@zsh.org>2014-06-09 09:50:37 +0100
commit6336347c9e02ebae565b2d62987d1052bcba5567 (patch)
treec57790ed50fa12ab04733286bd10990d59fb13d0 /Src
parent2ba4aa275e548ae9d4406e3bc8008bdfa1ce29eb (diff)
parent4f4d2b8247ef08e34fe73d91c0a8d8a2eb1f18c7 (diff)
downloadzsh-6336347c9e02ebae565b2d62987d1052bcba5567.tar.gz
zsh-6336347c9e02ebae565b2d62987d1052bcba5567.tar.xz
zsh-6336347c9e02ebae565b2d62987d1052bcba5567.zip
fix my own merge conflict with grammar changes
Diffstat (limited to 'Src')
-rw-r--r--Src/compat.c2
-rw-r--r--Src/glob.c11
-rw-r--r--Src/hist.c14
-rw-r--r--Src/mem.c6
-rw-r--r--Src/options.c1
-rw-r--r--Src/prototypes.h2
-rw-r--r--Src/signals.c2
-rw-r--r--Src/utils.c15
-rw-r--r--Src/zsh.h1
-rw-r--r--Src/zsh_system.h5
10 files changed, 36 insertions, 23 deletions
diff --git a/Src/compat.c b/Src/compat.c
index cc4e876da..b0bcb6265 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -37,7 +37,7 @@
 char *
 strstr(const char *s, const char *t)
 {
-    char *p1, *p2;
+    const char *p1, *p2;
 
     for (; *s; s++) {
         for (p1 = s, p2 = t; *p2; p1++, p2++)
diff --git a/Src/glob.c b/Src/glob.c
index c6cb3d2fc..15a5f70b7 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -462,18 +462,19 @@ scanner(Complist q, int shortcircuit)
     int errssofar = errsfound;
     struct dirsav ds;
 
-    init_dirsav(&ds);
     if (!q)
 	return;
+    init_dirsav(&ds);
 
     if ((closure = q->closure)) {
 	/* (foo/)# - match zero or more dirs */
 	if (q->closure == 2)	/* (foo/)## - match one or more dirs */
 	    q->closure = 1;
-	else
+	else {
 	    scanner(q->next, shortcircuit);
 	    if (shortcircuit && shortcircuit == matchct)
 		return;
+	}
     }
     p = q->pat;
     /* Now the actual matching for the current path section. */
@@ -518,10 +519,11 @@ scanner(Complist q, int shortcircuit)
 		}
 		if (add) {
 		    addpath(str, l);
-		    if (!closure || !statfullpath("", NULL, 1))
+		    if (!closure || !statfullpath("", NULL, 1)) {
 			scanner((q->closure) ? q : q->next, shortcircuit);
 			if (shortcircuit && shortcircuit == matchct)
 			    return;
+		    }
 		    pathbuf[pathpos = oppos] = '\0';
 		}
 	    }
@@ -618,11 +620,12 @@ scanner(Complist q, int shortcircuit)
 		    memcpy(subdirs + subdirlen, (char *)&errsfound,
 			   sizeof(int));
 		    subdirlen += sizeof(int);
-		} else
+		} else {
 		    /* if the last filename component, just add it */
 		    insert(fn, 1);
 		    if (shortcircuit && shortcircuit == matchct)
 			return;
+		}
 	    }
 	}
 	closedir(lock);
diff --git a/Src/hist.c b/Src/hist.c
index 1182994a2..64f88f559 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -935,9 +935,11 @@ hbegin(int dohist)
 
     hf = getsparam("HISTFILE");
     /*
-     * For INCAPPENDHISTORY, when interactive, save the history here
+     * For INCAPPENDHISTORYTIME, when interactive, save the history here
      * as it gives a better estimate of the times of commands.
      *
+     * If INCAPPENDHISTORY is also set we've already done it.
+     *
      * If SHAREHISTORY is also set continue to do so in the
      * standard place, because that's safer about reading and
      * rewriting history atomically.
@@ -950,7 +952,8 @@ hbegin(int dohist)
      * so that (correctly) nothing happens here.  But it shows
      * I thought about it.
      */
-    if (isset(INCAPPENDHISTORY) && !isset(SHAREHISTORY) &&
+    if (isset(INCAPPENDHISTORYTIME) && !isset(SHAREHISTORY) &&
+	!isset(INCAPPENDHISTORY) &&
 	!(histactive & HA_NOINC) && !strin && histsave_stack_pos == 0)
 	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
 }
@@ -1378,7 +1381,8 @@ hend(Eprog prog)
      * For normal INCAPPENDHISTORY case and reasoning, see hbegin().
      */
     if (isset(SHAREHISTORY) ? histfileIsLocked() :
-	(isset(INCAPPENDHISTORY) && histsave_stack_pos != 0))
+	(isset(INCAPPENDHISTORY) || (isset(INCAPPENDHISTORYTIME) &&
+				     histsave_stack_pos != 0)))
 	savehistfile(hf, 0, HFILE_USE_OPTIONS | HFILE_FAST);
     unlockhistfile(hf); /* It's OK to call this even if we aren't locked */
     /*
@@ -2542,7 +2546,7 @@ savehistfile(char *fn, int err, int writeflags)
     }
     if (writeflags & HFILE_USE_OPTIONS) {
 	if (isset(APPENDHISTORY) || isset(INCAPPENDHISTORY)
-	 || isset(SHAREHISTORY))
+	 || isset(INCAPPENDHISTORYTIME) || isset(SHAREHISTORY))
 	    writeflags |= HFILE_APPEND | HFILE_SKIPOLD;
 	else
 	    histfile_linect = 0;
@@ -2578,7 +2582,7 @@ savehistfile(char *fn, int err, int writeflags)
 		tmpfile = NULL;
 		if (err) {
 		    if (isset(APPENDHISTORY) || isset(INCAPPENDHISTORY)
-		     || isset(SHAREHISTORY))
+		     || isset(INCAPPENDHISTORYTIME) || isset(SHAREHISTORY))
 			zerr("rewriting %s would change its ownership -- skipped", fn);
 		    else
 			zerr("rewriting %s would change its ownership -- history not saved", fn);
diff --git a/Src/mem.c b/Src/mem.c
index a7f11a62b..f19817723 100644
--- a/Src/mem.c
+++ b/Src/mem.c
@@ -1508,7 +1508,7 @@ zsfree(char *p)
 MALLOC_RET_T
 realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
 {
-    struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mp, *mt;
+    struct m_hdr *m = (struct m_hdr *)(((char *)p) - M_ISIZE), *mt;
     char *r;
     int i, l = 0;
 
@@ -1524,10 +1524,10 @@ realloc(MALLOC_RET_T p, MALLOC_ARG_T size)
     /* check if we are reallocating a small block, if we do, we have
        to compute the size of the block from the sort of block it is in */
     for (i = 0; i < M_NSMALL; i++) {
-	for (mp = NULL, mt = m_small[i];
+	for (mt = m_small[i];
 	     mt && (((char *)mt) > ((char *)p) ||
 		    (((char *)mt) + mt->len) < ((char *)p));
-	     mp = mt, mt = mt->next);
+	     mt = mt->next);
 
 	if (mt) {
 	    l = M_BSLEN(mt->len);
diff --git a/Src/options.c b/Src/options.c
index e83dc5839..2163bff4d 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -165,6 +165,7 @@ static struct optname optns[] = {
 {{NULL, "ignoreclosebraces",  OPT_EMULATE},		 IGNORECLOSEBRACES},
 {{NULL, "ignoreeof",	      0},			 IGNOREEOF},
 {{NULL, "incappendhistory",   0},			 INCAPPENDHISTORY},
+{{NULL, "incappendhistorytime",   0},			 INCAPPENDHISTORYTIME},
 {{NULL, "interactive",	      OPT_SPECIAL},		 INTERACTIVE},
 {{NULL, "interactivecomments",OPT_BOURNE},		 INTERACTIVECOMMENTS},
 {{NULL, "ksharrays",	      OPT_EMULATE|OPT_BOURNE},	 KSHARRAYS},
diff --git a/Src/prototypes.h b/Src/prototypes.h
index 00988ac4c..e3db4f5ee 100644
--- a/Src/prototypes.h
+++ b/Src/prototypes.h
@@ -130,5 +130,5 @@ extern char *strerror _((int errnum));
 /***************************************************/
 
 #ifndef HAVE_MEMMOVE
-extern void bcopy _((const void *, void *, int));
+extern void bcopy _((const void *, void *, size_t));
 #endif
diff --git a/Src/signals.c b/Src/signals.c
index a6eb8038b..cb2b58161 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -369,7 +369,7 @@ signal_suspend(UNUSED(int sig), int wait_cmd)
 #ifdef POSIX_SIGNALS
 # ifdef BROKEN_POSIX_SIGSUSPEND
     sigprocmask(SIG_SETMASK, &set, &oset);
-    pause();
+    ret = pause();
     sigprocmask(SIG_SETMASK, &oset, NULL);
 # else /* not BROKEN_POSIX_SIGSUSPEND */
     ret = sigsuspend(&set);
diff --git a/Src/utils.c b/Src/utils.c
index 8b512bbd9..cef2abef8 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -2712,8 +2712,11 @@ ztrftimebuf(int *bufsizeptr, int decr)
 mod_export int
 ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm)
 {
-    int hr12, decr;
-#ifndef HAVE_STRFTIME
+    int hr12;
+#ifdef HAVE_STRFTIME
+    int decr;
+    char tmp[4];
+#else
     static char *astr[] =
     {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
     static char *estr[] =
@@ -2721,7 +2724,6 @@ ztrftime(char *buf, int bufsize, char *fmt, struct tm *tm)
      "Aug", "Sep", "Oct", "Nov", "Dec"};
 #endif
     char *origbuf = buf;
-    char tmp[4];
 
 
     while (*fmt)
@@ -4287,7 +4289,7 @@ zreaddir(DIR *dir, int ignoredots)
 #if defined(HAVE_ICONV) && defined(__APPLE__)
     if (!conv_ds)
 	conv_ds = iconv_open("UTF-8", "UTF-8-MAC");
-    if (conv_ds) {
+    if (conv_ds != (iconv_t)(-1)) {
 	/* Force initial state in case re-using conv_ds */
 	(void) iconv(conv_ds, 0, &orig_name_len, 0, &conv_name_len);
 
@@ -4298,12 +4300,11 @@ zreaddir(DIR *dir, int ignoredots)
 	conv_name_len = orig_name_len;
 	if (iconv(conv_ds,
 		  &orig_name_ptr, &orig_name_len,
-		  &conv_name_ptr, &conv_name_len) >= 0) {
-	  if (orig_name_len == 0) {
+		  &conv_name_ptr, &conv_name_len) != (size_t)(-1) &&
+	    orig_name_len == 0) {
 	    /* Completely converted, metafy and return */
 	    *conv_name_ptr = '\0';
 	    return metafy(conv_name, -1, META_STATIC);
-	  }
 	}
 	/* Error, or conversion incomplete, keep the original name */
     }
diff --git a/Src/zsh.h b/Src/zsh.h
index 620883b81..05d582cda 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -2115,6 +2115,7 @@ enum {
     IGNORECLOSEBRACES,
     IGNOREEOF,
     INCAPPENDHISTORY,
+    INCAPPENDHISTORYTIME,
     INTERACTIVE,
     INTERACTIVECOMMENTS,
     KSHARRAYS,
diff --git a/Src/zsh_system.h b/Src/zsh_system.h
index e68fd62f9..6887a135b 100644
--- a/Src/zsh_system.h
+++ b/Src/zsh_system.h
@@ -708,7 +708,10 @@ struct timezone {
 #endif
 
 #ifndef HAVE_MEMMOVE
-# define memmove(dest, src, len) bcopy((src), (dest), (len))
+# ifndef memmove
+static char *zmmv;
+# define memmove(dest, src, len) (bcopy((src), zmmv = (dest), (len)), zmmv)
+# endif
 #endif
 
 #ifndef offsetof