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

2013-08-14 Thread Alexander Sedov
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.



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 E. Vargas Caballero

k...@shike2.com
http://www.shike2.com



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 of system calls and it will improve the performace
  of the application.
 
 Not only that, using stdio is currently the sbase way.

Will fix and re-send.