X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=sys%2Fsrc%2Fcmd%2Ffile.c;h=7da5abdaaf6540421d8d2c185eac40e181fb79b0;hb=8035bb7dd1a83e3b98b3bb54defe0dbf35c861cf;hp=2759cce8df922a375ba7ea25ce32a73a09ffcb7e;hpb=eb4ade60be10d0a039eb8e76001427947f2fbadb;p=plan9front.git diff --git a/sys/src/cmd/file.c b/sys/src/cmd/file.c index 2759cce8d..7da5abdaa 100644 --- a/sys/src/cmd/file.c +++ b/sys/src/cmd/file.c @@ -150,6 +150,7 @@ int ishtml(void); int isrfc822(void); int ismbox(void); int islimbo(void); +int ismp3(void); int ismung(void); int isp9bit(void); int isp9font(void); @@ -195,6 +196,7 @@ int (*call[])(void) = ismsdos, /* msdos exe (virus file attachement) */ isicocur, /* windows icon or cursor file */ isface, /* ascii face file */ + ismp3, /* last resorts */ ismung, /* entropy compressed/encrypted */ @@ -1135,6 +1137,23 @@ isas(void) return 1; } +int +ismp3(void) +{ + uchar *p, *e; + + p = buf; + e = p + nbuf-1; + while((p < e) && (p = memchr(p, 0xFF, e - p))){ + if((p[1] & 0xFE) == 0xFA){ + print(mime ? "audio/mpeg\n" : "mp3 audio\n"); + return 1; + } + p++; + } + return 0; +} + /* * low entropy means encrypted */