From 4093cb550d4c7acdef1314ebe255eba07ef1f3d1 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 29 May 2019 17:55:10 -0400 Subject: Add xx -p option --- bin/man1/xx.1 | 9 +++++++++ bin/xx.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/man1/xx.1 b/bin/man1/xx.1 index 3fbcbd70..d38789a7 100644 --- a/bin/man1/xx.1 +++ b/bin/man1/xx.1 @@ -11,6 +11,7 @@ .Op Fl arsz .Op Fl c Ar cols .Op Fl g Ar group +.Op Fl p Ar count .Op Ar file . .Sh DESCRIPTION @@ -42,6 +43,14 @@ The default .Ar group is 8. . +.It Fl p Ar count +Output a blank line after every +.Ar count +bytes. +.Ar count +must be a multiple of +.Ar cols . +. .It Fl r Reverse hexdump. Read hexadecimal input diff --git a/bin/xx.c b/bin/xx.c index 1dd7ce5e..39d7ec07 100644 --- a/bin/xx.c +++ b/bin/xx.c @@ -34,10 +34,11 @@ static bool zero(const byte *ptr, size_t size) { static struct { size_t cols; size_t group; + size_t blank; bool ascii; bool offset; bool skip; -} options = { 16, 8, true, true, false }; +} options = { 16, 8, 0, true, true, false }; static void dump(FILE *file) { bool skip = false; @@ -59,6 +60,12 @@ static void dump(FILE *file) { } } + if (options.blank) { + if (offset && offset % options.blank == 0) { + printf("\n"); + } + } + if (options.offset) { printf("%08zX: ", offset); } @@ -106,11 +113,12 @@ int main(int argc, char *argv[]) { const char *path = NULL; int opt; - while (0 < (opt = getopt(argc, argv, "ac:g:rsz"))) { + while (0 < (opt = getopt(argc, argv, "ac:g:p:rsz"))) { switch (opt) { break; case 'a': options.ascii ^= true; break; case 'c': options.cols = strtoul(optarg, NULL, 0); break; case 'g': options.group = strtoul(optarg, NULL, 0); + break; case 'p': options.blank = strtoul(optarg, NULL, 0); break; case 'r': reverse = true; break; case 's': options.offset ^= true; break; case 'z': options.skip ^= true; -- cgit 1.4.1 />
path: root/bin/1sh/libedit/sig.c (unfollow)
Commit message (Collapse)Author
2019-09-22Revert "Enable cookies in title"June McEnroe
This reverts commit 279111dda15dd9170e11b9688eb973f2af2e6300.
2019-09-20Enable cookies in titleJune McEnroe
Perhaps this will make it less suspicious to Google. Who knows.
2019-09-16Use sensitivity aliases in TF2June McEnroe
2019-09-16Add The Just CityJune McEnroe
2019-09-12Only GET the final redirect locationJune McEnroe
2019-09-12Consume entire bodyJune McEnroe
Aborting the request and leaving data around may be causing intermittent errors. Just discard the rest of the data.
2019-09-10Add title -v flagJune McEnroe
2019-09-10Use curl error bufferJune McEnroe
2019-09-10Set Accept-Encoding in titleJune McEnroe
Because apparently it's fine for servers to respond with Content-Encoding you didn't ask for, and curl won't decode it if you didn't ask for it.
2019-09-08Set title User-AgentJune McEnroe
Some things don't like you if you don't send one.
2019-09-07Add -x flag to titleJune McEnroe
2019-09-07Ignore SIGPIPE in relayJune McEnroe
Allows restarting consumers safely.
2019-09-07Add A Memory Called EmpireJune McEnroe
2019-09-05Handle lack of Content-TypeJune McEnroe
2019-09-05Use CURLINFO_CONTENT_TYPEJune McEnroe
Oops, didn't see this.
2019-09-05Decode entities in titlesJune McEnroe
2019-09-05Print title as soon as it's availableJune McEnroe
2019-09-05Use CURL_PREFIX to set flagsJune McEnroe
2019-09-05Add titleJune McEnroe
2019-09-04Add Avorter n'est pas tuerJune McEnroe
2019-08-29Unset executable on shell scriptsJune McEnroe
2019-08-29Add long-missing setopt to bin.7June McEnroe
2019-08-29Add editJune McEnroe