edrdos icon indicating copy to clipboard operation
edrdos copied to clipboard

Do not store same command line multiple times in HISTORY

Open mateuszviste opened this issue 1 year ago • 9 comments

HISTORY=ON apparently allocates some 576 bytes of memory and use it to keep about 15 commands.

It would be nice for this to be configurable. This would allow to lower the footprint on very, very restrained systems. For example on a 256K machine the user might prefer to set the history to 4 last commands, which would limit the memory usage yet still provide a history buffer that is comfortable most of the time. This could be configured for example through HISTORY=4 ("save last 4 commands only") or HISTORY=100 ("use a 100 bytes buffer for HISTORY"), depending how the history logic is currently implemented.

Another desirable improvement would be for the kernel to not store the same consecutive command. For instance running 3x DIR makes the command to appear 3 times in history.

mateuszviste avatar Nov 25 '24 14:11 mateuszviste

Source indicates that HISTORY=ON,256 might do the trick (setting history to 256 bytes). The valid range seems to be 128-4096 bytes. But did not test it yet.

boeckmann avatar Nov 25 '24 14:11 boeckmann

;
;	This function modifies the History buffer support provided by
;	DR DOS the defaults are History OFF, 512 byte buffers,
;	Insert ON, Search OFF, Matching OFF.
;
func_history:	; HISTORY = ON|OFF[,NNNN[,ON|OFF[,ON|OFF[,ON|OFF]]]]

boeckmann avatar Nov 25 '24 15:11 boeckmann

The kernel itself gives such hint:

image

would you know what is the second ON/OFF setting for?

mateuszviste avatar Nov 25 '24 16:11 mateuszviste

According to the source code the syntax is more elaborate than the kernel's message suggests:

HISTORY=ON_OFF[,MEMSIZE[,INSERT_STATE[,SEARCH_STATE[,MATCH_STATE]]]]

What are INSERT_STATE, SEARCH_STATE and MATCH_STATE remains to be found.

mateuszviste avatar Nov 25 '24 16:11 mateuszviste

This version of HISTORY was designed exclusively for DR-DOS, Enhanced DR-DOS, OpenDOS, Novell DOS, and its siblings. Not suitable for MS-DOS, PC-DOS and many others.

Generally speaking, HISTORY is usually implemented as a sub function of the DOSKEY external command. However, other DOS implementation such as PTS-DOS and X-DOS have also implemented it explicitly as an external command.

In the DR-DOS family of products, HISTORY is present as a statement in its CONFIG.SYS counterpart. Its syntax is quite cumbersome for average users to comprehend. So, much like the FASTOPEN external command in DR-DOS, this particular implementation of HISTORY helps to clarify its functionality and proper usage.

HISTORY is Public Domain Software. Binary release only.

Ignacio F. Gully HISTORY's author

HISTORY.ZIP

igully avatar Aug 14 '25 21:08 igully

Anything to do here apart from documenting this stuff?

boeckmann avatar Sep 23 '25 13:09 boeckmann

Improvement suggestion could be summarized as "do not store same command line multiple times in history"?

boeckmann avatar Sep 23 '25 13:09 boeckmann

Anything to do here apart from documenting this stuff?

Ignacio documented it extensively here: http://svardos.org/phpamb.php?fname=help/help-en&f=kerncfg.ama

Improvement suggestion could be summarized as "do not store same command line multiple times in history"?

Indeed, albeit it is a really minor "nice to have" thing - I am not sure it's worth polluting the list of issues with this, so feel free to close & ignore.

The important thing was to have clarity on how it works, and that is nicely covered with Ignacio's contribution to the SvarDOS HELP. :)

mateuszviste avatar Sep 23 '25 13:09 mateuszviste

Will leave it open, but rename the issue for better clarity.

boeckmann avatar Sep 23 '25 13:09 boeckmann