zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Problem with history special parameter
Date: Wed, 19 Jan 2000 17:36:16 +0100 (MET)	[thread overview]
Message-ID: <200001191636.RAA16829@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Wed, 19 Jan 2000 12:48:55 +0000


Peter Stephenson wrote:

> The first time I print out the keys to the history associative array (print
> ${(k)history}) I get:
> 
> %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK %s.LOCK
> 
> for all elements.  The second time I just get a blank.
> 
> This is with zsh/parameter loaded, obviously.

Oops. Keys were not built. This also change the funcs for the job
parameters to avoid building the keys if we are only counting the
entries.


Bye
 Sven

diff -ru ../z.old/Src/Modules/parameter.c Src/Modules/parameter.c
--- ../z.old/Src/Modules/parameter.c	Wed Jan 19 17:16:57 2000
+++ Src/Modules/parameter.c	Wed Jan 19 17:33:09 2000
@@ -1086,12 +1086,12 @@
     pm.level = 0;
 
     while (he) {
-	if (func != scancountparams &&
-	    ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
-	     !(flags & SCANPM_WANTKEYS))) {
+	if (func != scancountparams) {
 	    sprintf(buf, "%d", he->histnum);
 	    pm.nam = dupstring(buf);
-	    pm.u.str = dupstring(he->text);
+	    if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
+		!(flags & SCANPM_WANTKEYS))
+		pm.u.str = dupstring(he->text);
 	}
 	func((HashNode) &pm, flags);
 
@@ -1209,12 +1209,13 @@
     for (job = 1; job < MAXJOB; job++) {
 	if (jobtab[job].stat && jobtab[job].procs &&
 	    !(jobtab[job].stat & STAT_NOPRINT)) {
-	    sprintf(buf, "%d", job);
-	    pm.nam = dupstring(buf);
-	    if (func != scancountparams &&
-		((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
-		 !(flags & SCANPM_WANTKEYS)))
-		pm.u.str = pmjobtext(job);
+	    if (func != scancountparams) {
+		sprintf(buf, "%d", job);
+		pm.nam = dupstring(buf);
+		if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
+		    !(flags & SCANPM_WANTKEYS))
+		    pm.u.str = pmjobtext(job);
+	    }
 	    func((HashNode) &pm, flags);
 	}
     }
@@ -1314,12 +1315,13 @@
     for (job = 1; job < MAXJOB; job++) {
 	if (jobtab[job].stat && jobtab[job].procs &&
 	    !(jobtab[job].stat & STAT_NOPRINT)) {
-	    sprintf(buf, "%d", job);
-	    pm.nam = dupstring(buf);
-	    if (func != scancountparams &&
-		((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
-		 !(flags & SCANPM_WANTKEYS)))
-		pm.u.str = pmjobstate(job);
+	    if (func != scancountparams) {
+		sprintf(buf, "%d", job);
+		pm.nam = dupstring(buf);
+		if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
+		    !(flags & SCANPM_WANTKEYS))
+		    pm.u.str = pmjobstate(job);
+	    }
 	    func((HashNode) &pm, flags);
 	}
     }
@@ -1391,12 +1393,13 @@
     for (job = 1; job < MAXJOB; job++) {
        if (jobtab[job].stat && jobtab[job].procs &&
            !(jobtab[job].stat & STAT_NOPRINT)) {
-           sprintf(buf, "%d", job);
-           pm.nam = dupstring(buf);
-           if (func != scancountparams &&
-               ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
-                !(flags & SCANPM_WANTKEYS)))
-               pm.u.str = pmjobdir(job);
+           if (func != scancountparams) {
+	       sprintf(buf, "%d", job);
+	       pm.nam = dupstring(buf);
+               if ((flags & (SCANPM_WANTVALS|SCANPM_MATCHVAL)) ||
+		   !(flags & SCANPM_WANTKEYS))
+		   pm.u.str = pmjobdir(job);
+	   }
            func((HashNode) &pm, flags);
        }
     }

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-01-19 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-19 16:36 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-01-19 12:48 Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200001191636.RAA16829@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).