Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: Is /etc/magic machine independent? Message-ID: <7115@auspex.auspex.com> Date: 10 Apr 91 18:18:46 GMT References: <1991Apr9.203847.3584@motcad.portal.com> Organization: Auspex Systems, Santa Clara Lines: 27 >Is file's magic number database (/etc/magic) machine independant >or must you have a different version for big and little endian >machines? "string" entries are machine-independent. "short" and "long" entries are machine-dependent. It would be nice if 1) there were "cstring" entries, which would look like "string" entries except that they could include C-style escapes, e.g. 0 cstring \037\036 packed data 0 cstring \377\037 compacted data 0 cstring \037\235 compressed data, >2 byte&0x80 >0 block compressed, >2 byte&0x1f x %d bits 0 cstring \032\001 Compiled Terminfo Entry (the "byte&0x80" and "byte&0x1f" are Sun enhancements; "file" should be taught to support them as well - Sun's "file" supports C-style strings with "string", which wasn't really the right thing to do, as it means any string containing backslashes has to escape the backslases, e.g. 0 string \\begindata Andrew Toolkit document ) and 2) there were "beshort", "belong", "leshort", and "lelong" entries, which would be for "short" and "long" quantities to be interpreted as big-endian and little-endian values, rather than being interpreted in the native byte order.