Skip to content

Instantly share code, notes, and snippets.

@stagas
Created December 23, 2010 11:58
Show Gist options
  • Select an option

  • Save stagas/752879 to your computer and use it in GitHub Desktop.

Select an option

Save stagas/752879 to your computer and use it in GitHub Desktop.
select
/* Image Filetypes */
when match(1,'FFD8FFE00010'x'JFIF') then ftype = 'JPEG'
when match(1,'GIF8') then ftype = 'GIF'
when match(2,'PNG') then ftype = 'PNG'
when match(1,'0a0501'x) then ftype = 'PCX'
when match(9,'ILBM') & form then ftype = 'ILBM'
when match(1,'e31000'x) then ftype = 'ICON'
/* Sound Filetypes */
when match(1,'.snd') then ftype = 'AU'
when match(9,'AIFF') & form then ftype = 'AIFF'
when match(9,'8SVX') & form then ftype = '8SVX'
when match(9,'WAVE') & match(1,'RIFF') then ftype = 'WAVE'
when ~ascii & ext='MP3'|ext='MP2'|ext='MP1' then ftype = 'MPEGA'
/* Track Filetypes */
when ~ascii & ext = 'MOD'|pre = 'MOD.' then ftype = 'MOD'
when ~ascii & ext = 'MED'|pre = 'MED.' then ftype = 'MED'
when ~ascii & pre = 'THX.' then ftype = 'THX'
/* Video Filetypes */
when match(1,'00'x) & match(5,'m') then ftype = 'MOV'
when match(9,'ANIM') & form then ftype = 'ANIM'
/* Archive Filetypes */
when match(1,'LZX') then ftype = 'LZX'
when match(3,'-lh') & match(7,'-') then ftype = 'LHA'
when match(1,'PK') then ftype = 'ZIP'
/* Document Filetypes */
when ascii & ext = 'DOC' then ftype = 'DOC'
when ascii & ext = 'README' then ftype = 'README'
when ascii & match(1,'@database') then ftype = 'GUIDE'
when ascii & (ext = 'HTML'|ext = 'HTM'|match(1,'<HTML>')) then ftype = 'HTML'
when ascii & ext = 'C' then ftype = 'C-SRC'
when ascii & ext = 'S' then ftype = 'ASM-SRC'
when ascii & (ext='REXX'|ext='AMIRX'|ext='MLREXX') then ftype='REXX-SRC'
when ascii = 1 then ftype = 'TXT'
/* Misc Filetypes */
when match(1,'000003F300'x) then select
when ext = 'LIBRARY' then ftype = 'LIBRARY'
when ext = 'DATATYPE' then ftype = 'DATATYPE'
when ext = 'GADGET' then ftype = 'CLASS'
when ext = 'IMAGE' then ftype = 'CLASS'
when ext = 'CODEC' then ftype = 'CLASS'
when ext = 'CLASS' then ftype = 'CLASS'
otherwise ftype = 'EXE'
end
when ascii = 0 then ftype = 'BINARY'
otherwise nop
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment