Tarsnap / tarsnap

Command-line client code for Tarsnap.
https://tarsnap.com
Other
864 stars 60 forks source link

Add --list-archives --null #576

Closed gperciva closed 11 months ago

gperciva commented 1 year ago

Requested in #294.

(During that discussion in 2017, I didn't realize that struct tapemetadata stored char ** argv; I assumed that it constructed a space-separated string upon archive creation and stored that.)

This PR has an unusual way of unambigiously representing argv: using multiple null characters.

NB: in the above example, xxd represents 0x00 with a . but all of my archives were created with the ./tarsnap binary. So if you look at the ascii representation, at first glance it might appear that there's 3 nulls before the command-line begins, but the hex confirms that it's the desired two 0x00 followed by a 0x2e.

I do not expect that --list-archives --null -v -v would be useful to any end users; it's only intended for programmers working on a gui or cli for tarsnap.