Sujet : Re: Rationale for aligning data on even bytes in a Unix shell file?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 26. Apr 2025, 22:34:22
Autres entêtes
Organisation : None to speak of
Message-ID : <87bjsippy9.fsf@nosuchdomain.example.com>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13)
scott@slp53.sl.home (Scott Lurndal) writes:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
In a "C" file (of the Kornshell software) I stumbled across this
comment: "Each command in the history file starts on an even byte
and is null-terminated."
>
I wonder what's the reason behind that even-byte-alignment, on "C"
level or on Unix/files level. Any ideas?
>
Possibly to support 16-bit character sets?
I don't think it supports 16-bit character sets.
Unlike bash history files, which are plain text, ksh history files
are in a binary format.
I don't know whether the format includes any multi-byte integers.
If it does, reading such values directly into memory might be easier
on some platforms if they're aligned.
The relevant source file is src/cmd/ksh93/edit/history.c, in
<
https://github.com/ksh93/ksh>. It has functions to manipulate the
history file, but I don't see a full description of the file format.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */