Re: [dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread sin
On Wed, Aug 14, 2013 at 06:40:01PM +0400, Alexander Sedov wrote: > 2013/8/14 sin : > > 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. Em no, it is using

Re: [dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread sin
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

Re: [dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread Galos, David
>> + 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. N

Re: [dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread Roberto E. Vargas Caballero
> + 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

Re: [dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread Alexander Sedov
2013/8/14 sin : > 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.

[dev] [sbase] [patch] Add strings(1)

2013-08-14 Thread sin
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 Date: Wed, 14 Aug 2013 10:41:55 +0100 Subject: [PATCH] Add strings(1) --- Makefile | 1 + strings.c | 70