make the elf cpu test try both byte orders. perhaps bytes 18 and 19 are actually a short? Reference: /n/sources/patch/applied/file-elf-bo Date: Tue Jan 4 15:41:13 CET 2005 --- /sys/src/cmd/file.c Tue Jan 4 15:41:13 2005 +++ /sys/src/cmd/file.c Tue Jan 4 15:41:13 2005 @@ -1235,7 +1235,16 @@ if (memcmp(buf, "\x7fELF", 4) == 0){ if (!mime){ int n = (buf[19] << 8) | buf[18]; - char *p = (n > 0 && n < nelem(cpu) && cpu[n])? cpu[n]: "unknown"; + char *p = "unknown"; + + if (n > 0 && n < nelem(cpu) && cpu[n]) + p = cpu[n]; + else { + /* try the other byte order */ + n = (buf[18] << 8) | buf[19]; + if (n > 0 && n < nelem(cpu) && cpu[n]) + p = cpu[n]; + } print("%s ELF executable\n", p); } else