Linefeeds in Squeak source code

Tom Burns tburns at appnet.net
Tue May 11 22:02:02 UTC 1999


> Does anyone know whether there are guidelines for deciding 
> that a file is "text"?  For all I know, if the first 100 
> characters (ie the version banner) contained a couple of 
> weird character codes, it would suffice to discourage all the 
> standard network programs from messing with it.

>From the Solaris man page for "file":
================
     If file appears to be a text file, file examines  the  first
     512  bytes  and tries to determine its programming language.
     If file is an executable  a.out,  file  prints  the  version
     stamp, provided it is greater than 0.  If file is a symbolic
     link, by default the link is followed  and  file  tests  the
     file to which the symbolic link refers.

     By default, file uses /etc/magic to identify files that have
     a  magic number.  A magic number is a numeric or string con-
     stant that indicates the file type.   See  magic(4)  for  an
     explanation of the format of /etc/magic.
================

So, in the case of the 'file' program on UNIX, it appears that the first 512
bytes are significant, as well as a check against the magic numbers.  The
magic numbers usually appear in the first 6 or so bytes.  For example, PKZIP
files have "PK" followed by numbers indicating the version, IIRC.

Perhaps just adding a few binary characters to the front of a sources file
in the form of a footprint and then FTPing and archiving/extracting is the
best way to find out for sure.

t
--
Tom Burns -- tburns at appnet.net -- http://www.aisys.com
AppNet Midwest -- http://www.appnet.net





More information about the Squeak-dev mailing list