summaryrefslogtreecommitdiff
path: root/Src/Modules
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc /Src/Modules
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/mathfunc.c9
-rw-r--r--Src/Modules/parameter.c40
-rw-r--r--Src/Modules/parameter.mdd2
-rw-r--r--Src/Modules/stat.c4
-rw-r--r--Src/Modules/zpty.c33
5 files changed, 83 insertions, 5 deletions
diff --git a/Src/Modules/mathfunc.c b/Src/Modules/mathfunc.c
index 04483b555..efadd86ff 100644
--- a/Src/Modules/mathfunc.c
+++ b/Src/Modules/mathfunc.c
@@ -340,7 +340,16 @@ math_func(char *name, int argc, mnumber *argv, int id)
break;
case MF_GAMMA:
+#ifdef HAVE_TGAMMA
+ retd = tgamma(argd);
+#else
+#ifdef HAVE_SIGNGAM
+ retd = lgamma(argd);
+ retd = signgam*exp(retd);
+#else /*XXX assume gamma(x) returns Gamma(x), not log(|Gamma(x)|) */
retd = gamma(argd);
+#endif
+#endif
break;
case MF_HYPOT:
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index a029c9cb4..22148f991 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -759,6 +759,38 @@ disreswordsgetfn(UNUSED(Param pm))
return getreswords(DISABLED);
}
+/* Functions for the patchars special parameter. */
+
+/**/
+static char **
+getpatchars(int dis)
+{
+ int i;
+ char **ret, **p;
+
+ p = ret = (char **) zhalloc(ZPC_COUNT * sizeof(char *));
+
+ for (i = 0; i < ZPC_COUNT; i++)
+ if (zpc_strings[i] && !dis == !zpc_disables[i])
+ *p++ = dupstring(zpc_strings[i]);
+
+ *p = NULL;
+
+ return ret;
+}
+
+static char **
+patcharsgetfn(UNUSED(Param pm))
+{
+ return getpatchars(0);
+}
+
+static char **
+dispatcharsgetfn(UNUSED(Param pm))
+{
+ return getpatchars(1);
+}
+
/* Functions for the options special parameter. */
/**/
@@ -2018,6 +2050,10 @@ static const struct gsu_array reswords_gsu =
{ reswordsgetfn, arrsetfn, stdunsetfn };
static const struct gsu_array disreswords_gsu =
{ disreswordsgetfn, arrsetfn, stdunsetfn };
+static const struct gsu_array patchars_gsu =
+{ patcharsgetfn, arrsetfn, stdunsetfn };
+static const struct gsu_array dispatchars_gsu =
+{ dispatcharsgetfn, arrsetfn, stdunsetfn };
static const struct gsu_array dirs_gsu =
{ dirsgetfn, dirssetfn, stdunsetfn };
static const struct gsu_array historywords_gsu =
@@ -2038,6 +2074,8 @@ static struct paramdef partab[] = {
&pmdisfunctions_gsu, getpmdisfunction, scanpmdisfunctions),
SPECIALPMDEF("dis_galiases", 0,
&pmdisgaliases_gsu, getpmdisgalias, scanpmdisgaliases),
+ SPECIALPMDEF("dis_patchars", PM_ARRAY|PM_READONLY,
+ &dispatchars_gsu, NULL, NULL),
SPECIALPMDEF("dis_reswords", PM_ARRAY|PM_READONLY,
&disreswords_gsu, NULL, NULL),
SPECIALPMDEF("dis_saliases", 0,
@@ -2072,6 +2110,8 @@ static struct paramdef partab[] = {
&pmoptions_gsu, getpmoption, scanpmoptions),
SPECIALPMDEF("parameters", PM_READONLY,
NULL, getpmparameter, scanpmparameters),
+ SPECIALPMDEF("patchars", PM_ARRAY|PM_READONLY,
+ &patchars_gsu, NULL, NULL),
SPECIALPMDEF("reswords", PM_ARRAY|PM_READONLY,
&reswords_gsu, NULL, NULL),
SPECIALPMDEF("saliases", 0,
diff --git a/Src/Modules/parameter.mdd b/Src/Modules/parameter.mdd
index eb48d5f2a..a91a5dc09 100644
--- a/Src/Modules/parameter.mdd
+++ b/Src/Modules/parameter.mdd
@@ -2,6 +2,6 @@ name=zsh/parameter
link=either
load=yes
-autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
+autofeatures="p:parameters p:commands p:functions p:dis_functions p:funcfiletrace p:funcsourcetrace p:funcstack p:functrace p:builtins p:dis_builtins p:reswords p:dis_reswords p:patchars p:dis_patchars p:options p:modules p:dirstack p:history p:historywords p:jobtexts p:jobdirs p:jobstates p:nameddirs p:userdirs p:aliases p:dis_aliases p:galiases p:dis_galiases p:saliases p:dis_saliases"
objects="parameter.o"
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index a3e95bb59..edae0841e 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -339,7 +339,7 @@ statprint(struct stat *sbuf, char *outbuf, char *fname, int iwhich, int flags)
* -H hash: as for -A array, but returns a hash with the keys being those
* from stat -l
* -F fmt: specify a $TIME-like format for printing times; the default
- * is the (CTIME-like) "%a %b %e %k:%M:%S". This option implies
+ * is the (CTIME-like) "%a %b %e %k:%M:%S %Z %Y". This option implies
* -s as it is not useful for numerical times.
*
* +type selects just element type of stat buffer (-l gives list):
@@ -361,7 +361,7 @@ bin_stat(char *name, char **args, Options ops, UNUSED(int func))
struct stat statbuf;
int found = 0, nargs;
- timefmt = "%a %b %e %k:%M:%S";
+ timefmt = "%a %b %e %k:%M:%S %Z %Y";
for (; *args && (**args == '+' || **args == '-'); args++) {
char *arg = *args+1;
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 25ec7dfea..fca0cc172 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -293,8 +293,8 @@ static int
newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
{
Ptycmd p;
- int master, slave, pid, oineval = ineval;
- char *oscriptname = scriptname;
+ int master, slave, pid, oineval = ineval, ret;
+ char *oscriptname = scriptname, syncch;
Eprog prog;
/* code borrowed from bin_eval() */
@@ -344,6 +344,8 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
if (get_pty(0, &slave))
exit(1);
+ SHTTY = slave;
+ attachtty(mypid);
#ifdef TIOCGWINSZ
/* Set the window size before associating with the terminal *
* so that we don't get hit with a SIGWINCH. I'm paranoid. */
@@ -396,8 +398,23 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
setsparam("TTY", ztrdup(ttystrname));
opts[INTERACTIVE] = 0;
+
+ syncch = 0;
+ do {
+ ret = write(1, &syncch, 1);
+ } while (ret != 1 && (
+#ifdef EWOULDBLOCK
+ errno == EWOULDBLOCK ||
+#else
+#ifdef EAGAIN
+ errno == EAGAIN ||
+#endif
+#endif
+ errno == EINTR));
+
execode(prog, 1, 0, "zpty");
stopmsg = 2;
+ mypid = 0; /* trick to ensure we _exit() */
zexit(lastval, 0);
}
master = movefd(master);
@@ -430,6 +447,18 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
scriptname = oscriptname;
ineval = oineval;
+ do {
+ ret = read(master, &syncch, 1);
+ } while (ret != 1 && (
+#ifdef EWOULDBLOCK
+ errno == EWOULDBLOCK ||
+#else
+#ifdef EAGAIN
+ errno == EAGAIN ||
+#endif
+#endif
+ errno == EINTR));
+
return 0;
}