Hi,
Added a barebones strings(1) implementation. Let me know
if you guys want this.
Thanks,
sin
From 311992f992c040caf2347c21e35757d713ca7c8d Mon Sep 17 00:00:00 2001
From: sin s...@2f30.org
Date: Wed, 14 Aug 2013 10:41:55 +0100
Subject: [PATCH] Add strings(1)
---
Makefile | 1 +
strings.c
2013/8/14 sin s...@2f30.org:
Hi,
Added a barebones strings(1) implementation. Let me know
if you guys want this.
Thanks,
sin
Aren't you printf() ing non-null-terminated string? This can explode.
+ while ((r = read(fd, c, 1) 0)) {
+ offset++;
+ if (isprint(c)) {
+ span++;
I think is better use the buffer interface here. Calling getc
will save a lot of system calls and it will improve the performace
of the application.
--
Roberto E.
On Wed, Aug 14, 2013 at 11:59:22AM -0400, Galos, David wrote:
+ while ((r = read(fd, c, 1) 0)) {
+ offset++;
+ if (isprint(c)) {
+ span++;
I think is better use the buffer interface here. Calling getc
will save a lot of system calls