csh history bug
Chris Torek
chris at mimsy.UUCP
Sat Apr 23 23:04:25 AEST 1988
In article <1245 at ucsfcca.ucsf.edu> rk9005 at cca.ucsf.edu (Roland McGrath) writes:
-Repeat-by:
- $ csh -f
- % set history=5000
- % echo foo
- foo
- % ^foo^bar
- echo bar
- bar
- % history
- 1 set history=5000
- 2 echo foo
- -1000 echo bar 3 echo bar
- 4 history
- %
-
- Any large value for `history' will do it. I have been unable to find
-the exact threshold, but anything larger than 2000 will always work, I think.
Not quite. Anything more than 1000+next_event+2 suffices. (I.e.,
if this is the very first command, 1004 is enough.)
The history number `-1000' should give a large hint. If you look
in /usr/src/bin/csh/sh.lex.c you will find where csh enters substitution
events as number -1000. The idea is that since
-most people don't set history to a big number,
the negative event will be discarded from the history list since
it occurred over 1000 commands ago.
-Aside: Can anyone with source access tell me what type is used for the
-value of `history', so I can make it 32767 or (2^31) - 1, or whatever?
`int', of course. The variable itself is a string, but it is converted
to an integer whenever needed (once per command!).
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at mimsy.umd.edu Path: uunet!mimsy!chris
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list