[BusyBox] [PATCH] add optional SKIP arguments to cmp

Hideki IWAMOTO h-iwamoto at kit.hi-ho.ne.jp
Wed Mar 17 11:44:41 UTC 2004


On Wed, 17 Mar 2004 10:40:05 +0300, Vladimir N. Oleynik wrote...
> Hideki,
> 
> Hmm. Only theoreticaly first see (may be wrong):
> 
> > +static void skip_input(FILE *fp, unsigned long skip, const char *filename)
> > +{
> > +	if (skip > 0 && lseek(fileno(fp), skip, SEEK_CUR) < 0) {
> 
> You use lseek + getc. Your skiping make double size.
> 

Why? Getc will be called only when lseek fails.

> > +		while (skip-- > 0) {
> > +			if (getc(fp) == EOF) {
> 
> 
> --w
> vodz
> 
> 

----
Hideki IWAMOTO  h-iwamoto at kit.hi-ho.ne.jp




More information about the busybox mailing list