[hackers] [sbase] Support NUL containing lines in head(1) || FRIGN

From: <git_AT_suckless.org>
Date: Thu, 10 Mar 2016 09:48:17 +0100 (CET)

commit 45b42516d46f869f5f261fd59efa601f83a39607
Author: FRIGN <dev_AT_frign.de>
AuthorDate: Mon Mar 7 10:48:17 2016 +0100
Commit: sin <sin_AT_2f30.org>
CommitDate: Thu Mar 10 08:48:09 2016 +0000

    Support NUL containing lines in head(1)
    
    Very trivial this time.

diff --git a/README b/README
index f814284..1a9a460 100644
--- a/README
+++ b/README
_AT_@ -40,7 +40,7 @@ The following tools are implemented:
  #*|o fold .
 0=*|o getconf (-v)
  =*|o grep .
- =*|o head .
+0=*|o head .
 0=*|x hostname .
 0=*|x install .
  =* o join .
diff --git a/head.c b/head.c
index a99b6f4..ae550c0 100644
--- a/head.c
+++ b/head.c
_AT_@ -14,7 +14,7 @@ head(FILE *fp, const char *fname, size_t n)
         ssize_t len;
 
         while (i < n && (len = getline(&buf, &size, fp)) > 0) {
- fputs(buf, stdout);
+ fwrite(buf, 1, len, stdout);
                 i += (len && (buf[len - 1] == '\n'));
         }
         free(buf);
Received on Thu Mar 10 2016 - 09:48:17 CET

This archive was generated by hypermail 2.3.0 : Thu Mar 10 2016 - 10:00:42 CET