[hackers] [sbase] Fix last offset output using skip in od(1) || FRIGN

From: <git_AT_suckless.org>
Date: Wed, 30 Sep 2015 20:44:19 +0200 (CEST)

commit 98e7e75ec6e847249e19521dfac3c1674af45721
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Wed Sep 30 20:06:22 2015 +0200
Commit: sin <sin_AT_2f30.org>
CommitDate: Wed Sep 30 19:44:11 2015 +0100

    Fix last offset output using skip in od(1)
    
    Yeah, if the skipping is longer than the file itself, we need
    to take the skip value, not the address.
    Also, only print the last newline when we've actually printed
    at least 1 address.

diff --git a/od.c b/od.c
index f4315ba..9521605 100644
--- a/od.c
+++ b/od.c
_AT_@ -89,10 +89,10 @@ od(FILE *in, char *in_name, FILE *out, char *out_name)
                 if (feof(in) || ferror(in) || ferror(out))
                         break;
         }
- if (addr)
+ if (addr - skip > 0)
                 fputc('\n', out);
         if (radix != 'n') {
- printaddress(out, addr);
+ printaddress(out, MAX(addr, skip));
                 fputc('\n', out);
         }
 }
Received on Wed Sep 30 2015 - 20:44:19 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 30 2015 - 20:48:47 CEST