When seeking or skipping to a byte, writing or reading starts at the byte immediately subsequent to the specified byte.
This is, in my view, undesirable. Suppose I want to use dj to programmatically write to various positions within a file, specified by a shell variable. I could construct a command such as dj -s $POS, and would expect to be able to simply specify the first index (either 0 or 1 depending on the implementation) to write to the first byte in the file. The current implementation of dj actually behaves in this manner, with the byte indices starting at 0.
While I view this as a good thing, there's a clear disagreement between the documentation and the implementation that needs to be rectified. Ideally, that rectification takes place within the docs, but this obviously warrants some discussion.
From `DESCRIPTION` in `dj(1)` (docs branch):
> When seeking or skipping to a byte, writing or reading starts at the byte immediately subsequent to the specified byte.
This is, in my view, undesirable. Suppose I want to use `dj` to programmatically write to various positions within a file, specified by a shell variable. I could construct a command such as `dj -s $POS`, and would expect to be able to simply specify the first index (either 0 or 1 depending on the implementation) to write to the first byte in the file. The current implementation of `dj` actually behaves in this manner, with the byte indices starting at 0.
```sh
$ printf '0123456789' | dj -s 0 -c 1 -b 1 2> /dev/null
0
```
```sh
$ printf '0123456789' | dj -s 1 -c 1 -b 1 2> /dev/null
1
```
While I view this as a good thing, there's a clear disagreement between the documentation and the implementation that needs to be rectified. Ideally, that rectification takes place within the docs, but this obviously warrants some discussion.
emma
was assigned by silt2024-06-05 20:59:24 -06:00
trinity
was assigned by silt2024-06-05 20:59:24 -06:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
From
DESCRIPTIONindj(1)(docs branch):This is, in my view, undesirable. Suppose I want to use
djto programmatically write to various positions within a file, specified by a shell variable. I could construct a command such asdj -s $POS, and would expect to be able to simply specify the first index (either 0 or 1 depending on the implementation) to write to the first byte in the file. The current implementation ofdjactually behaves in this manner, with the byte indices starting at 0.While I view this as a good thing, there's a clear disagreement between the documentation and the implementation that needs to be rectified. Ideally, that rectification takes place within the docs, but this obviously warrants some discussion.
I am on the side of rectifying it in the docs: skipping and seeking should start reading and writing on the byte specified.
docsto djThis seems to have been fixed. #125 adds further clarification. Please reopen if you still have issue.
#134 further clarifies this.