[comp.sources.d] /etc/magic recommended keywords

ian@sq.uucp (Ian F. Darwin) (11/13/88)

In article <1034@investor.UUCP>, Bob Peirce writes, in discussing
/etc/magic's contents:

>We changed data to file. 

As the author of one of the freeware file(1) commands in circulation, I would
like to suggest that this change is not optimal because it loses some useful
information and replaces it with redundant information.

The word "data" in the file command's output has a specific meaning: data is
non-readable data. Similarly "text" is readable text, "commands text" is
shell commands or similar commands. These words in the output of file(1) not
only are enshrined by tradition :-), but they are also used by some people
who write programs that look at the output of the file command. If you
change them, you will break such programs.

As a simple example of such a program, consider

	#! /bin/sh
	# printable - get printable file(s) in directory

	file * | grep text | sed 's/:.*//'

which you can use as
	printable | xargs lpr
or
	lpr `printable`
depending upon your religion.

I know people that use little scripts like this and depend
upon the file command doing the right thing. 

Please: keep "data" for non-printable data and "text" for
printable text.


Ian Darwin
ian@sq.com