dif 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. #------------------------------------------------------------------------------
  2. # $File: dif,v 1.1 2020/04/09 19:14:01 christos Exp $
  3. # dif: file(1) magic for DIF text files
  4. #------------------------------------------------------------------------------
  5. # From: Joerg Jenderek
  6. # URL: http://en.wikipedia.org/wiki/Data_Interchange_Format
  7. # http://fileformats.archiveteam.org/wiki/Data_Interchange_Format
  8. # Note: called by TrID "Data Interchange Format",
  9. # by DROID x-fmt/368 "VisiCalc Database"
  10. 0 string TABLE
  11. # skip text starting with TABLE by looking for numeric version on 2nd line
  12. >6 search/2 0,
  13. # skip DROID x-fmt-41-signature-id-380.dif by looking for key word TUPLES at the beginning
  14. >>27 search/128 TUPLES Data Interchange Format
  15. # https://www.pcmatic.com/company/libraries/fileextension/detail.asp?ext=dif.html
  16. #!:mime application/x-dif-spreadsheet Gnumeric
  17. # https://github.com/LibreOffice/online/blob/master/discovery.xml
  18. #!:mime application/x-dif-document LibreOffice
  19. # https://www.wikidata.org/wiki/Wikidata:WikiProject_Informatics/File_formats/Lists/File_formats
  20. !:mime application/x-dif
  21. # https://extension.nirsoft.net/dif
  22. #!:mime application/vnd.ms-excel
  23. #!:mime text/plain
  24. !:ext dif
  25. # look for double quote 0x22 on 3rd line
  26. >>>10 search/3 "
  27. # skip if next character also double quote
  28. >>>>&0 ubyte !0x22 \b, generator or table name
  29. # comment like EXCEL, pwm enclosed in double quotes
  30. >>>>>&-2 string x %s