about summary refs log tree commit diff
path: root/Src/Modules/parameter.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-19 17:43:41 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-19 17:43:41 +0000
commit6cc7e4a7f6ef2ba514a1c8cafc476f9ffc80548a (patch)
treec24a0da3697522eba37ed755885f83782bd932df /Src/Modules/parameter.c
parentaf259b89dcf8d2ca74ebbb6cefb1db4de6336146 (diff)
downloadzsh-6cc7e4a7f6ef2ba514a1c8cafc476f9ffc80548a.tar.gz
zsh-6cc7e4a7f6ef2ba514a1c8cafc476f9ffc80548a.tar.xz
zsh-6cc7e4a7f6ef2ba514a1c8cafc476f9ffc80548a.zip
zsh-workers/9373
Diffstat (limited to 'Src/Modules/parameter.c')
-rw-r--r--Src/Modules/parameter.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index b67d9557c..47fffde69 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -1086,12 +1086,12 @@ scanpmhistory(HashTable ht, ScanFunc func, int flags)
     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 @@ scanpmjobtexts(HashTable ht, ScanFunc func, int flags)
     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 @@ scanpmjobstates(HashTable ht, ScanFunc func, int flags)
     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 @@ scanpmjobdirs(HashTable ht, ScanFunc func, int flags)
     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);
        }
     }