9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] file: detect webp files
@ 2021-04-03 17:24 kemal
  2021-04-03 17:32 ` cinap_lenrek
  0 siblings, 1 reply; 2+ messages in thread
From: kemal @ 2021-04-03 17:24 UTC (permalink / raw)
  To: 9front

this patch adds a small check to the "iff" function, so this
way file can detect webp files. tested with a webp file i
found randomly.

diff -r cc26fdf57bb2 sys/src/cmd/file.c
--- a/sys/src/cmd/file.c	Sat Mar 13 14:57:53 2021 +0100
+++ b/sys/src/cmd/file.c	Sat Apr 03 20:17:09 2021 +0300
@@ -962,6 +962,8 @@
 			print("%s\n", mime? "audio/wave": "wave audio");
 		else if (strncmp((char*)buf+8, "AVI ", 4) == 0)
 			print("%s\n", mime? "video/avi": "avi video");
+		else if (strncmp((char*)buf+8, "WEBP", 4) == 0)
+			print("%s\n", mime? "image/webp": "webp image");
 		else
 			print("%s\n", mime? OCTET : "riff file");
 		return 1;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-05  6:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-03 17:24 [9front] file: detect webp files kemal
2021-04-03 17:32 ` cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).