From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by werple.net.au (8.7/8.7.1) with ESMTP id UAA27465 for ; Mon, 19 Feb 1996 20:34:46 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id EAA02531; Mon, 19 Feb 1996 04:18:20 -0500 (EST) Resent-Date: Mon, 19 Feb 1996 04:18:20 -0500 (EST) Message-Id: <7271.9602190912@pyro.swan.ac.uk> To: Jeff Blank Cc: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: Re: 2.6b13 history question In-Reply-To: "jfblank@mtu.edu"'s message of "Sat, 17 Feb 96 17:35:37 EST." <199602172235.RAA09677@bullwinkle.tc.mtu.edu> Date: Mon, 19 Feb 96 09:12:09 +0000 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-ID: <"kLy0m.0.Td.R14An"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/773 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu jfblank@mtu.edu wrote: > there are some differences in the way history is handled...for example, > ls -l ChangeLog > ls -l ChangeLog > ls -l ChangeLog > ^space > ls -l ChangeLog > ^no space > (etc...) all show up as separate history entries due to varying amounts of > space (even with histingoredups set). This is deliberate --- or at least known. The shell now always stores the line literally, instead of a pruned-down version with words separated by a special token. I didn't think it worth adding any code to change this, since if you're repeating the last line I supposed you wouldn't need to change the spaces. If this seems important, the comparison can be changed to ignore space. This will do it, though perhaps someone else can think of a less verbose way. *** hist.c.ign Mon Jan 15 17:10:25 1996 --- hist.c Mon Feb 19 10:06:59 1996 *************** *** 537,542 **** --- 537,570 ---- histremmed = 1; } + /* compare line, ignoring multiple white space for HIST_IGNORE_DUPS */ + + /**/ + int + strspacecmp(char *s1, char *s2) + { + /* ignore initial blanks */ + int blankflag = 1; + + for (; *s1 && *s2; s1++, s2++) + if ((iblank(*s1) && iblank(*s2)) || blankflag) { + while (iblank(*s1)) + s1++; + while (iblank(*s2)) + s2++; + blankflag--; + } else if (*s1 != *s2) + return (int)*s2 - (int)*s1; + + /* ignore trailing blanks when one string has already terminated */ + while (iblank(*s1)) + s1++; + while (iblank(*s2)) + s2++; + + return (int)*s2 - (int)*s1; + } + /* say we're done using the history mechanism */ /**/ *************** *** 567,573 **** save = 0; he = gethistent(curhist - 1); if (!*chline || !strcmp(chline, "\n") || ! (isset(HISTIGNOREDUPS) && he->text && !strcmp(he->text, chline)) || (isset(HISTIGNORESPACE) && spaceflag)) save = 0; } --- 595,602 ---- save = 0; he = gethistent(curhist - 1); if (!*chline || !strcmp(chline, "\n") || ! (isset(HISTIGNOREDUPS) && he->text && ! !strspacecmp(he->text, chline)) || (isset(HISTIGNORESPACE) && spaceflag)) save = 0; } -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77330 Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.