[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff thinking files are binaries?



Have a look at the code.

The -a flag makes it so that a variable, aflag, gets set.  The only
place this varible is used is in a routine called asciifile() which
returns 1 if the current file is an ASCII file.  If the flag is set,
it returns true immediately, otherwise it reads a number of characters
(BUFSIZ) and tests them with isprint() and isspace().

See src/usr.bin/diff, the files are diff.c and diffreg.c

Cheers,
Andreas


On Wed, 05 Jan 2005 16:45:15 +0100, Bram Van Dam <bramspam@telenet.be> wrote:
> Julian Leyh wrote:
> > yes... diff(1) says:
> >      -a      Treat all files as ASCII.
> 
> Am I to interpret this literally? As in "every character will be
> interpreted as a 7(or8)bit ASCII character" as opposed to the actual
> character set the file is in?
> 
> It will work as ASCII -- because these files happen to be ASCII -- but
> I'm just being curious here.
> 
> 


-- 
Andreas Kdhdri

1024D/C2E163CB