From 784c413690c71212ad9e08bb093414abd1cacc08 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 6 Aug 1999 18:01:35 +0000 Subject: zsh-3.1.6-pws-1 --- Src/hist.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Src/hist.c') diff --git a/Src/hist.c b/Src/hist.c index 52e3e1394..8d8fba4af 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -577,6 +577,18 @@ histsubchar(int c) case 'q': quote(&sline); break; + case 'Q': + { + int one = noerrs, oef = errflag; + + noerrs = 1; + parse_subst_string(sline); + noerrs = one; + errflag = oef; + remnulargs(sline); + untokenize(sline); + } + break; case 'x': quotebreak(&sline); break; @@ -1947,6 +1959,7 @@ lockhistfile(char *fn, int keep_trying) int fd, len = strlen(fn); char *tmpfile, *lockfile; +#ifdef HAVE_LINK tmpfile = zalloc(len + 10 + 1); sprintf(tmpfile, "%s.%ld", fn, (long)mypid); if ((fd = open(tmpfile, O_RDWR|O_CREAT|O_EXCL, 0644)) >= 0) { @@ -1973,6 +1986,21 @@ lockhistfile(char *fn, int keep_trying) } unlink(tmpfile); free(tmpfile); +#else /* not HAVE_LINK */ + lockfile = zalloc(len + 5 + 1); + sprintf(lockfile, "%s.LOCK", fn); + while ((fd = open(lockfile, O_CREAT|O_EXCL, 0644)) < 0) { + if (errno == EEXIST) continue; + else if (keep_trying) { + if (time(NULL) - sb.st_mtime < 10) + sleep(1); + continue; + } + lockhistct--; + break; + } + free(lockfile); +#endif /* HAVE_LINK */ } return ct != lockhistct; } -- cgit 1.4.1