head 1.1; branch 1.1.1; access; symbols FILE5_48:1.1.1.8 netbsd-11-0-RC4:1.1.1.7 netbsd-11-0-RC3:1.1.1.7 netbsd-11-0-RC2:1.1.1.7 netbsd-11-0-RC1:1.1.1.7 perseant-exfatfs-base-20250801:1.1.1.7 netbsd-11:1.1.1.7.0.4 netbsd-11-base:1.1.1.7 netbsd-10-1-RELEASE:1.1.1.6 perseant-exfatfs-base-20240630:1.1.1.7 perseant-exfatfs:1.1.1.7.0.2 perseant-exfatfs-base:1.1.1.7 netbsd-8-3-RELEASE:1.1.1.5 netbsd-9-4-RELEASE:1.1.1.6 netbsd-10-0-RELEASE:1.1.1.6 netbsd-10-0-RC6:1.1.1.6 netbsd-10-0-RC5:1.1.1.6 netbsd-10-0-RC4:1.1.1.6 netbsd-10-0-RC3:1.1.1.6 netbsd-10-0-RC2:1.1.1.6 netbsd-10-0-RC1:1.1.1.6 FILE5_45:1.1.1.7 netbsd-10:1.1.1.6.0.10 netbsd-10-base:1.1.1.6 FILE5_43:1.1.1.6 netbsd-9-3-RELEASE:1.1.1.6 cjep_sun2x-base1:1.1.1.6 cjep_sun2x:1.1.1.6.0.8 cjep_sun2x-base:1.1.1.6 cjep_staticlib_x-base1:1.1.1.6 netbsd-9-2-RELEASE:1.1.1.6 cjep_staticlib_x:1.1.1.6.0.6 cjep_staticlib_x-base:1.1.1.6 FILE5_40:1.1.1.6 netbsd-9-1-RELEASE:1.1.1.6 FILE5_39:1.1.1.6 phil-wifi-20200421:1.1.1.6 phil-wifi-20200411:1.1.1.6 is-mlppp:1.1.1.6.0.4 is-mlppp-base:1.1.1.6 phil-wifi-20200406:1.1.1.6 netbsd-8-2-RELEASE:1.1.1.5 netbsd-9-0-RELEASE:1.1.1.6 netbsd-9-0-RC2:1.1.1.6 FILE5_38:1.1.1.6 netbsd-9-0-RC1:1.1.1.6 phil-wifi-20191119:1.1.1.6 netbsd-9:1.1.1.6.0.2 netbsd-9-base:1.1.1.6 phil-wifi-20190609:1.1.1.6 netbsd-8-1-RELEASE:1.1.1.5 FILE5_37:1.1.1.6 netbsd-8-1-RC1:1.1.1.5 pgoyette-compat-merge-20190127:1.1.1.5 pgoyette-compat-20190127:1.1.1.5 pgoyette-compat-20190118:1.1.1.5 pgoyette-compat-1226:1.1.1.5 pgoyette-compat-1126:1.1.1.5 pgoyette-compat-1020:1.1.1.5 FILE5_35:1.1.1.5 pgoyette-compat-0930:1.1.1.5 pgoyette-compat-0906:1.1.1.5 netbsd-7-2-RELEASE:1.1.1.4 pgoyette-compat-0728:1.1.1.5 netbsd-8-0-RELEASE:1.1.1.5 phil-wifi:1.1.1.5.0.10 phil-wifi-base:1.1.1.5 pgoyette-compat-0625:1.1.1.5 netbsd-8-0-RC2:1.1.1.5 pgoyette-compat-0521:1.1.1.5 pgoyette-compat-0502:1.1.1.5 pgoyette-compat-0422:1.1.1.5 netbsd-8-0-RC1:1.1.1.5 FILE5_33:1.1.1.5 pgoyette-compat-0415:1.1.1.5 pgoyette-compat-0407:1.1.1.5 pgoyette-compat-0330:1.1.1.5 pgoyette-compat-0322:1.1.1.5 pgoyette-compat-0315:1.1.1.5 netbsd-7-1-2-RELEASE:1.1.1.4 pgoyette-compat:1.1.1.5.0.8 pgoyette-compat-base:1.1.1.5 netbsd-7-1-1-RELEASE:1.1.1.4 matt-nb8-mediatek:1.1.1.5.0.6 matt-nb8-mediatek-base:1.1.1.5 FILE5_32:1.1.1.5 perseant-stdc-iso10646:1.1.1.5.0.4 perseant-stdc-iso10646-base:1.1.1.5 netbsd-8:1.1.1.5.0.2 netbsd-8-base:1.1.1.5 FILE5_31:1.1.1.5 prg-localcount2-base3:1.1.1.4 prg-localcount2-base2:1.1.1.4 prg-localcount2-base1:1.1.1.4 prg-localcount2:1.1.1.4.0.14 prg-localcount2-base:1.1.1.4 pgoyette-localcount-20170426:1.1.1.4 bouyer-socketcan-base1:1.1.1.4 pgoyette-localcount-20170320:1.1.1.4 netbsd-7-1:1.1.1.4.0.12 netbsd-7-1-RELEASE:1.1.1.4 netbsd-7-1-RC2:1.1.1.4 FILE5_30:1.1.1.4 netbsd-7-nhusb-base-20170116:1.1.1.4 bouyer-socketcan:1.1.1.4.0.10 bouyer-socketcan-base:1.1.1.4 pgoyette-localcount-20170107:1.1.1.4 netbsd-7-1-RC1:1.1.1.4 pgoyette-localcount-20161104:1.1.1.4 netbsd-7-0-2-RELEASE:1.1.1.4 localcount-20160914:1.1.1.4 netbsd-7-nhusb:1.1.1.4.0.8 netbsd-7-nhusb-base:1.1.1.4 pgoyette-localcount-20160806:1.1.1.4 pgoyette-localcount-20160726:1.1.1.4 pgoyette-localcount:1.1.1.4.0.6 pgoyette-localcount-base:1.1.1.4 netbsd-7-0-1-RELEASE:1.1.1.4 netbsd-7-0:1.1.1.4.0.4 netbsd-7-0-RELEASE:1.1.1.4 netbsd-7-0-RC3:1.1.1.4 netbsd-7-0-RC2:1.1.1.4 netbsd-7-0-RC1:1.1.1.4 FILE5_22:1.1.1.4 FILE5_20:1.1.1.4 netbsd-6-0-6-RELEASE:1.1.1.3 netbsd-6-1-5-RELEASE:1.1.1.3 netbsd-7:1.1.1.4.0.2 netbsd-7-base:1.1.1.4 FILE5_19:1.1.1.4 yamt-pagecache-base9:1.1.1.3 yamt-pagecache-tag8:1.1.1.3 netbsd-6-1-4-RELEASE:1.1.1.3 netbsd-6-0-5-RELEASE:1.1.1.3 tls-earlyentropy:1.1.1.3.0.20 tls-earlyentropy-base:1.1.1.4 riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.1.1.3 riastradh-drm2-base3:1.1.1.3 netbsd-6-1-3-RELEASE:1.1.1.3 netbsd-6-0-4-RELEASE:1.1.1.3 FILE5_16:1.1.1.3 netbsd-6-1-2-RELEASE:1.1.1.3 netbsd-6-0-3-RELEASE:1.1.1.3 netbsd-6-1-1-RELEASE:1.1.1.3 riastradh-drm2-base2:1.1.1.3 riastradh-drm2-base1:1.1.1.3 riastradh-drm2:1.1.1.3.0.12 riastradh-drm2-base:1.1.1.3 netbsd-6-1:1.1.1.3.0.18 netbsd-6-0-2-RELEASE:1.1.1.3 netbsd-6-1-RELEASE:1.1.1.3 khorben-n900:1.1.1.3.0.16 netbsd-6-1-RC4:1.1.1.3 netbsd-6-1-RC3:1.1.1.3 agc-symver:1.1.1.3.0.14 agc-symver-base:1.1.1.3 FILE5_14:1.1.1.3 netbsd-6-1-RC2:1.1.1.3 netbsd-6-1-RC1:1.1.1.3 yamt-pagecache-base8:1.1.1.3 FILE_5_12:1.1.1.3 netbsd-6-0-1-RELEASE:1.1.1.3 yamt-pagecache-base7:1.1.1.3 matt-nb6-plus-nbase:1.1.1.3 yamt-pagecache-base6:1.1.1.3 netbsd-6-0:1.1.1.3.0.10 netbsd-6-0-RELEASE:1.1.1.3 netbsd-6-0-RC2:1.1.1.3 tls-maxphys:1.1.1.3.0.8 tls-maxphys-base:1.1.1.4 matt-nb6-plus:1.1.1.3.0.6 matt-nb6-plus-base:1.1.1.3 netbsd-6-0-RC1:1.1.1.3 yamt-pagecache-base5:1.1.1.3 yamt-pagecache-base4:1.1.1.3 FILE5_11:1.1.1.3 netbsd-6:1.1.1.3.0.4 netbsd-6-base:1.1.1.3 yamt-pagecache-base3:1.1.1.3 yamt-pagecache-base2:1.1.1.3 yamt-pagecache:1.1.1.3.0.2 yamt-pagecache-base:1.1.1.3 FILE5_09:1.1.1.3 cherry-xenmp:1.1.1.2.0.2 cherry-xenmp-base:1.1.1.2 FILE5_07:1.1.1.2 bouyer-quota2-nbase:1.1.1.1 bouyer-quota2:1.1.1.1.0.4 bouyer-quota2-base:1.1.1.1 matt-mips64-premerge-20101231:1.1.1.1 matt-premerge-20091211:1.1.1.1 jym-xensuspend-base:1.1.1.1 jym-xensuspend:1.1.1.1.0.2 jym-xensuspend-nbase:1.1.1.1 FILE5_03:1.1.1.1 CHRISTOS:1.1.1; locks; strict; comment @# @; 1.1 date 2009.05.08.16.35.09; author christos; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2009.05.08.16.35.09; author christos; state Exp; branches 1.1.1.1.2.1; next 1.1.1.2; 1.1.1.2 date 2011.05.12.20.47.04; author christos; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2011.09.16.20.37.49; author christos; state Exp; branches 1.1.1.3.8.1 1.1.1.3.20.1; next 1.1.1.4; 1.1.1.4 date 2014.06.13.01.48.25; author christos; state Exp; branches; next 1.1.1.5; commitid jtTYsE5FmJU6MiEx; 1.1.1.5 date 2017.05.24.23.59.57; author christos; state Exp; branches 1.1.1.5.10.1; next 1.1.1.6; commitid WbyOU2LBE5qOyHSz; 1.1.1.6 date 2019.05.22.17.19.57; author christos; state Exp; branches; next 1.1.1.7; commitid VXeNRYYruN1MWdoB; 1.1.1.7 date 2023.08.18.18.36.51; author christos; state Exp; branches; next 1.1.1.8; commitid IX26ghc1E2S0AiBE; 1.1.1.8 date 2026.06.10.15.59.14; author christos; state Exp; branches; next ; commitid 3UWc0DrzTz7bHgJG; 1.1.1.1.2.1 date 2009.05.08.16.35.09; author jym; state dead; branches; next 1.1.1.1.2.2; 1.1.1.1.2.2 date 2009.05.13.18.51.59; author jym; state Exp; branches; next ; 1.1.1.3.8.1 date 2014.08.19.23.46.47; author tls; state Exp; branches; next ; commitid jTnpym9Qu0o4R1Nx; 1.1.1.3.20.1 date 2014.08.10.07.07.10; author tls; state Exp; branches; next ; commitid b1wUlsZGswrdGMLx; 1.1.1.5.10.1 date 2019.06.10.21.44.46; author christos; state Exp; branches; next ; commitid jtc8rnCzWiEEHGqB; desc @@ 1.1 log @Initial revision @ text @ #------------------------------------------------------------------------------ # printer: file(1) magic for printer-formatted files # # PostScript, updated by Daniel Quinlan (quinlan@@yggdrasil.com) 0 string %! PostScript document text !:mime application/postscript !:apple ASPSTEXT >2 string PS-Adobe- conforming >>11 string >\0 DSC level %.3s >>>15 string EPS \b, type %s >>>15 string Query \b, type %s >>>15 string ExitServer \b, type %s >>>15 search/1000 %%LanguageLevel:\ >>>>&0 string >\0 \b, Level %s # Some PCs have the annoying habit of adding a ^D as a document separator 0 string \004%! PostScript document text !:mime application/postscript !:apple ASPSTEXT >3 string PS-Adobe- conforming >>12 string >\0 DSC level %.3s >>>16 string EPS \b, type %s >>>16 string Query \b, type %s >>>16 string ExitServer \b, type %s >>>16 search/1000 %%LanguageLevel:\ >>>>&0 string >\0 \b, Level %s 0 string \033%-12345X%!PS PostScript document # DOS EPS Binary File Header # From: Ed Sznyter 0 belong 0xC5D0D3C6 DOS EPS Binary File >4 long >0 Postscript starts at byte %d >>8 long >0 length %d >>>12 long >0 Metafile starts at byte %d >>>>16 long >0 length %d >>>20 long >0 TIFF starts at byte %d >>>>24 long >0 length %d # Summary: Adobe's PostScript Printer Description File # Extension: .ppd # Reference: http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf, Section 3.8 # Submitted by: Yves Arrouye # 0 string *PPD-Adobe:\x20 PPD file >&0 string x \b, version %s # HP Printer Job Language 0 string \033%-12345X@@PJL HP Printer Job Language data # HP Printer Job Language # The header found on Win95 HP plot files is the "Silliest Thing possible" # (TM) # Every driver puts the language at some random position, with random case # (LANGUAGE and Language) # For example the LaserJet 5L driver puts the "PJL ENTER LANGUAGE" in line 10 # From: Uwe Bonnes # 0 string \033%-12345X@@PJL HP Printer Job Language data >&0 string >\0 %s >>&0 string >\0 %s >>>&0 string >\0 %s >>>>&0 string >\0 %s #>15 string \ ENTER\ LANGUAGE\ = #>31 string PostScript PostScript # HP Printer Control Language, Daniel Quinlan (quinlan@@yggdrasil.com) 0 string \033E\033 HP PCL printer data >3 string \&l0A - default page size >3 string \&l1A - US executive page size >3 string \&l2A - US letter page size >3 string \&l3A - US legal page size >3 string \&l26A - A4 page size >3 string \&l80A - Monarch envelope size >3 string \&l81A - No. 10 envelope size >3 string \&l90A - Intl. DL envelope size >3 string \&l91A - Intl. C5 envelope size >3 string \&l100A - Intl. B5 envelope size >3 string \&l-81A - No. 10 envelope size (landscape) >3 string \&l-90A - Intl. DL envelope size (landscape) # IMAGEN printer-ready files: 0 string @@document( Imagen printer # this only works if "language xxx" is first item in Imagen header. >10 string language\ impress (imPRESS data) >10 string language\ daisy (daisywheel text) >10 string language\ diablo (daisywheel text) >10 string language\ printer (line printer emulation) >10 string language\ tektronix (Tektronix 4014 emulation) # Add any other languages that your Imagen uses - remember # to keep the word `text' if the file is human-readable. # [GRR 950115: missing "postscript" or "ultrascript" (whatever it was called)] # # Now magic for IMAGEN font files... 0 string Rast RST-format raster font data >45 string >0 face %s # From Jukka Ukkonen 0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data # From # These are the /etc/magic entries to decode data sent to an Epson printer. 0 string \x1B\x40\x1B\x28\x52\x08\x00\x00REMOTE1P Epson Stylus Color 460 data #------------------------------------------------------------------------------ # zenographics: file(1) magic for Zenographics ZjStream printer data # Rick Richardson rickr@@mn.rr.com 0 string JZJZ >0x12 string ZZ Zenographics ZjStream printer data (big-endian) 0 string ZJZJ >0x12 string ZZ Zenographics ZjStream printer data (little-endian) #------------------------------------------------------------------------------ # Oak Technologies printer stream # Rick Richardson 0 string OAK >0x07 byte 0 >0x0b byte 0 Oak Technologies printer stream # This would otherwise be recognized as PostScript - nick@@debian.org 0 string %!VMF SunClock's Vector Map Format data #------------------------------------------------------------------------------ # HP LaserJet 1000 series downloadable firmware file 0 string \xbe\xefABCDEFGH HP LaserJet 1000 series downloadable firmware # From: Paolo # Epson ESC/Page, ESC/PageColor 0 string \x1b\x01@@EJL Epson ESC/Page language printer data @ 1.1.1.1 log @from ftp.astron.com @ text @@ 1.1.1.2 log @from ftp.astron.com. - many security related fixes - no MAXPATHLEN limits - fixed missing text specification on ascii magic - new ``pascal'' style string formats - whitespace comparison fix - more magic @ text @a2 1 # $File: printer,v 1.24 2011/05/08 16:34:51 christos Exp $ d7 1 a7 1 0 string/t %! PostScript document text a65 4 # From: Stefan Thurner 0 string \033%-12345X@@PJL >&0 search/10000 %! PJL encapsulated PostScript document text @ 1.1.1.3 log @from ftp.astron.com: - elf seeking fixes - improvements in cdf parsing - waitpid only for our child - magic fixes and additions @ text @d3 1 a3 1 # $File: printer,v 1.25 2011/05/20 23:31:46 christos Exp $ d8 1 a8 1 0 string %! PostScript document text @ 1.1.1.3.8.1 log @Rebase to HEAD as of a few days ago. @ text @d3 1 a3 1 # $File: printer,v 1.26 2014/04/12 14:51:52 christos Exp $ a70 16 # Rick Richardson # For Fuji-Xerox Printers - HBPL stands for Host Based Printer Language # For Oki Data Printers - HIPERC # For Konica Minolta Printers - LAVAFLOW # For Samsung Printers - QPDL # For HP Printers - ZJS stands for Zenographics ZJStream 0 string \033%-12345X@@PJL HP Printer Job Language data >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HBPL - HBPL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HIPERC - Oki Data HIPERC >0 search/10000 @@PJL\ ENTER\ LANGUAGE=LAVAFLOW - Konica Minolta LAVAFLOW >0 search/10000 @@PJL\ ENTER\ LANGUAGE=QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE\ =\ QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=ZJS - HP ZJS d111 1 a111 1 # Rick Richardson d120 1 a120 1 # Rick Richardson @ 1.1.1.3.20.1 log @Rebase. @ text @d3 1 a3 1 # $File: printer,v 1.26 2014/04/12 14:51:52 christos Exp $ a70 16 # Rick Richardson # For Fuji-Xerox Printers - HBPL stands for Host Based Printer Language # For Oki Data Printers - HIPERC # For Konica Minolta Printers - LAVAFLOW # For Samsung Printers - QPDL # For HP Printers - ZJS stands for Zenographics ZJStream 0 string \033%-12345X@@PJL HP Printer Job Language data >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HBPL - HBPL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HIPERC - Oki Data HIPERC >0 search/10000 @@PJL\ ENTER\ LANGUAGE=LAVAFLOW - Konica Minolta LAVAFLOW >0 search/10000 @@PJL\ ENTER\ LANGUAGE=QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE\ =\ QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=ZJS - HP ZJS d111 1 a111 1 # Rick Richardson d120 1 a120 1 # Rick Richardson @ 1.1.1.4 log @import file-5.19 2014-06-09 9:04 Christos Zoulas * Misc buffer overruns and missing buffer size tests in cdf parsing (Francisco Alonso, Jan Kaluza) 2014-06-02 14:50 Christos Zoulas * Enforce limit of 8K on regex searches that have no limits * Allow the l modifier for regex to mean line count. Default to byte count. If line count is specified, assume a max of 80 characters per line to limit the byte count. * Don't allow conversions to be used for dates, allowing the mask field to be used as an offset. 2014-05-30 12:51 Christos Zoulas * Make the range operator limit the length of the regex search. 2014-05-14 19:23 Christos Zoulas * PR/347: Windows fixes * PR/352: Hangul word processor recognition * PR/354: Encoding irregularities in text files 2014-05-06 6:12 Christos Zoulas * Fix uninitialized title in CDF files (Jan Kaluza) 2014-05-04 14:55 Christos Zoulas * PR/351: Fix compilation of empty files 2014-04-30 17:39 Christos Zoulas * Fix integer formats: We don't specify 'l' or 'h' and 'hh' specifiers anymore, only 'll' for quads and nothing for the rest. This is so that magic writing is simpler. 2014-04-01 15:25 Christos Zoulas * PR/341: Jan Kaluza, fix memory leak * PR/342: Jan Kaluza, fix out of bounds read 2014-03-28 15:25 Christos Zoulas * Fix issue with long formats not matching fmtcheck @ text @d3 1 a3 1 # $File: printer,v 1.26 2014/04/12 14:51:52 christos Exp $ a70 16 # Rick Richardson # For Fuji-Xerox Printers - HBPL stands for Host Based Printer Language # For Oki Data Printers - HIPERC # For Konica Minolta Printers - LAVAFLOW # For Samsung Printers - QPDL # For HP Printers - ZJS stands for Zenographics ZJStream 0 string \033%-12345X@@PJL HP Printer Job Language data >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HBPL - HBPL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=HIPERC - Oki Data HIPERC >0 search/10000 @@PJL\ ENTER\ LANGUAGE=LAVAFLOW - Konica Minolta LAVAFLOW >0 search/10000 @@PJL\ ENTER\ LANGUAGE=QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE\ =\ QPDL - Samsung QPDL >0 search/10000 @@PJL\ ENTER\ LANGUAGE=ZJS - HP ZJS d111 1 a111 1 # Rick Richardson d120 1 a120 1 # Rick Richardson @ 1.1.1.5 log @Import file-5.31; mostly oss-fuzz found bugs. @ text @d3 1 a3 1 # $File: printer,v 1.28 2017/03/17 22:20:22 christos Exp $ d16 1 a16 1 >>>15 search/1000 %%LanguageLevel:\040 d27 1 a27 1 >>>16 search/1000 %%LanguageLevel:\040 d52 1 a52 1 # The header found on Win95 HP plot files is the "Silliest Thing possible" d58 1 a58 1 # d60 4 a63 4 >&0 string >\0 %s >>&0 string >\0 %s >>>&0 string >\0 %s >>>>&0 string >\0 %s d146 1 a146 1 0 string \xbe\xefABCDEFGH HP LaserJet 1000 series downloadable firmware d149 1 a149 1 # Epson ESC/Page, ESC/PageColor @ 1.1.1.5.10.1 log @Sync with HEAD @ text @d3 1 a3 1 # $File: printer,v 1.29 2019/04/19 00:42:27 christos Exp $ d43 1 a43 1 # Reference: https://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf, Section 3.8 @ 1.1.1.6 log @2019-05-14 22:26 Christos Zoulas * release 5.37 2019-05-09 22:27 Christos Zoulas * Make sure that continuation separators are printed with -k within softmagic 2019-05-06 22:27 Christos Zoulas * Change SIGPIPE saving and restoring during compression to use sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko) * Cache stat(2) calls more to reduce number of calls (Denys Vlasenko) 2019-05-06 17:25 Christos Zoulas * PR/77: Handle --mime-type and -k correctly. 2019-05-03 15:26 Christos Zoulas * Switch decompression code to use vfork() because tools like rpmdiff and rpmbuild call libmagic with large process footprints (Denys Vlasenko) 2019-04-07 14:05 Christos Zoulas * PR/75: --enable-zlib, did not work. 2019-02-27 11:54 Christos Zoulas * Improve regex efficiency (Michael Schroeder) by: 1. Prefixing regex searches with regular search for keywords where possible 2. Using memmem(3) where available @ text @d3 1 a3 1 # $File: printer,v 1.29 2019/04/19 00:42:27 christos Exp $ d43 1 a43 1 # Reference: https://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf, Section 3.8 @ 1.1.1.7 log @Update to file-5.45 (Last was file-5.44) 2023-07-27 15:45 Christos Zoulas * release 5.45 2023-07-17 11:53 Christos Zoulas * PR/465: psrok1: Avoid muslc asctime_r crash 2023-05-21 13:05 Christos Zoulas * add SIMH tape format support 2023-02-09 12:50 Christos Zoulas * bump the max size of the elf section notes to be read to 128K and make it configurable 2023-01-08 1:08 Christos Zoulas * PR/415: Fix decompression with program returning empty 2022-12-26 1:47 Christos Zoulas * PR/408: fix -p with seccomp * PR/412: fix MinGW compilation @ text @d3 1 a3 1 # $File: printer,v 1.34 2023/06/16 19:27:12 christos Exp $ d33 4 a36 24 # Update: Joerg Jenderek # URL: http://fileformats.archiveteam.org/wiki/Encapsulated_PostScript # Reference: http://mark0.net/download/triddefs_xml.7z/defs/eps-adobe.trid.xml # Note: called "Encapsulated PostScript binary" by TrID and # verified partly by ImageMagick `identify -verbose *` as EPT (Encapsulated PostScript with TIFF preview) 0 belong 0xC5D0D3C6 # skip DROID fmt-122-signature-id-174.eps fmt-123-signature-id-178.eps fmt-124-signature-id-180.eps # by looking for content after header # GRR: in version 5.44 unequal and not endian variant not working! >32 ulelong >0 DOS EPS Binary File !:mime image/x-eps # TODO: check that "long" is false on big endian machines # Postscript often (850/857) comes after header; so values like: 30 32 or 2788 10644 43350 71828 >>4 long >0 at byte %d # 1 space char after length value to get phrase like "length 263893 PostScript document text" >>>8 long >0 length %d # PostScript document text handled by ./printer >>>>(4.l) indirect x # Reference: http://mark0.net/download/triddefs_xml.7z/defs/e/eps-wmf.trid.xml # Note: called "Encapsulated PostScript binary (with WMF preview)" by TrID # verified partly by XnView `nconvert -info *.EP?` as TIFF epsp >>>>12 long >0 at byte %d !:ext eps # GRR: in file version 5.44 calling indirect of ./msdos produce phrase like "length 452\012- Windows metafile" d38 2 a39 11 # Windows metafile data handled by ./msdos >>>>>(12.l) indirect x # Reference: http://mark0.net/download/triddefs_xml.7z/defs/e/eps-tiff.trid.xml # Note: called "Encapsulated PostScript binary (with TIFF preview)" by TrID >>>>20 long >0 at byte %d # For the variant with the TIFF preview image sometimes the file extension ept is used !:ext eps/ept # GRR: in file version 5.44 calling indirect of ./images produce phrase like "length 43320\012- TIFF image data," >>>>>24 long >0 length %d # TIFF image data handled by ./images >>>>>>(20.l) indirect x a47 2 !:ext ppd !:mime application/vnd.cups-ppd d85 1 a85 10 # Summary: Hewlett-Packard printer firmware update # From: Joerg Jenderek # URL: https://support.hp.com/us-en/drivers/selfservice/hp-envy-6000e-all-in-one-printer-series/2100187505/model/2100187513 # Note: firmware update tested with ENVY 6000 All-in-One Printer 0 string @@PJL\ ENTER\ LANGUAGE=FWUPDATE2 HP Printer firmware update #!:mime application/octet-stream #!:mime application/x-hp-firmware # https://ftp.hp.com/pub/softlib/software13/printers/en6000/2214/EN6000_2214B.exe # vasari_base_dist_pp1_001.2214B_nonassert_appsigned_lbi_rootfs_secure_signed.ful2 !:ext ful2 a150 88 # Summary: Hewlett-Packard Graphics Language # From: Joerg Jenderek # URL: http://fileformats.archiveteam.org/wiki/HP-GL # https://en.wikipedia.org/wiki/HPGL # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hpg.trid.xml # Note: called "Hewlett-Packard Graphics Language" by TrID and # "Hewlett Packard Graphics Language" by DROID via PUID x-fmt/293 and # HPGL by XnView command `nconvert -info *` # initialize, start a plotting job 0 string IN; >0 use hpgl # fill.plt 0 string INPS >0 use hpgl # http://ftp.funet.fi/index/graphics/packages/hpgl2ps/hpgl2ps.tar.Z/hpgl2ps/test1.hpgl 0 string DF; >0 use hpgl # http://ftp.funet.fi/index/graphics/packages/hpgl2ps/hpgl2ps.tar.Z/hpgl2ps/test3.hpgl # Select Pen n; If no pen number or 0, the controller performs an end of file command; n in range between -32767 and 32768 like: 6 0 string SP # skip text Linux-syscall-note inside qemu sources starting with SPDX-Exception-Identifier: Linux-syscall-note # by checking for valid Pen number >2 regex \^([0-9]{1,5}) #>2 regex \^([0-9]{1,5}) PEN_NUMBER=%s >>0 use hpgl # charsize.hp pages.hp set the scaling points (P1 and P2) to their default positions 0 string IP0 >0 use hpgl # ci.hp 0 string CO\040 >0 use hpgl # iw.hp 286x192.5_lh.hpg 286x192.5_lq.hpg 0 string PS\040 >0 use hpgl # thick.hp 0 string PS9 >0 use hpgl # ul.hp 0 string PS4 >0 use hpgl # la.hp 0 string BP >0 use hpgl # miter.hp # Plot Absolute x,y{,x,y{...}}; x and y in range between -32767 and 32768 like: PA4000,3000; 0 string PA # skip shell scripts test_msa_run_32r5eb.sh test_msa_run_32r5eb.sh with variable PATH_TO_QEMU # by checking for valid x coordinate >2 regex \^([-]{0,1}[0-9]{1,5}) #>2 regex \^([-]{0,1}[0-9]{1,5}) COORDINATE=%s >>0 use hpgl # pw.hpg number of pens x 0 string NP >0 use hpgl # win_1.hp #0 string \003INCA WHAT_IS_THAT #>0 use hpgl # Reference: http://mark0.net/download/triddefs_xml.7z/defs/h/hpgl2.trid.xml # Note: called "Hewlett-Packard Graphics Language 2" by TrID 0 string \033%-1B Hewlett-Packard Graphics Language 2 !:mime application/vnd.hp-HPGL # like: dt.plt !:ext plt #!:ext plt/gl2/hpg2/spl # remaining part after escsape sequnce >5 string x with "%-.10s" # display Hewlett-Packard Graphics Language vector graphic information 0 name hpgl >0 string x Hewlett-Packard Graphics Language #!:mime vector/x-hpgl # https://www.iana.org/assignments/media-types/application/vnd.hp-HPGL !:mime application/vnd.hp-HPGL # no example with HPL suffix found !:ext hpgl/hpg/hp/plt # like: "IN;" "DF;IN;LT;PU1000,1000;PD2000,10" "SP6;DI0,1;SR0.70,1.90;SC0,800," # "CO Concentric circles drawn with different linewidths;" >0 string x \b, starting with "%-.54s" # continue but not for 1 long line without CR or LF >>&0 ubyte <0x0E #>>&0 ubyte <0x0E TERMINATOR=%x # second line after 1 terminator character >>>&0 string >\r with "%-.10s" # next character again CR or LF >>>&0 ubyte <0x0E #>>>&0 ubyte <0x0E 2ND_CHARACTER=%x # second line after 2 terminator characters >>>>&0 string >\r with "%-.10s" @ 1.1.1.8 log @Import file-5.48 (previous was file-5.45) 2026-05-07 11:32 Christos Zoulas * release 5.48 2026-05-11 15:55 Christos Zoulas * add landlock support (valoq) 2026-04-19 15:55 Christos Zoulas * add BE/LE GUID 2026-04-17 11:05 Christos Zoulas * multiple fixes to prevent integer overflow in 32 bits (kerwin) 2026-04-15 12:40 Christos Zoulas * PR/745: streamout: Don't flush when trying to set negative offsets on pipes, just continue, fixes 'cat file.zip | file -' * PR/753: vmihalko: Fix race is magic_getpath() 2026-03-11 15:14 Christos Zoulas * PR/728: Anton Monroe: Reinstate regex/c 2026-02-26 11:32 Christos Zoulas * release 5.47 2026-02-04 09:54 Christos Zoulas * Better multi-compound document identification by following the order of the directories entries. (Thomas Ledoux) 2026-01-19 14:00 Christos Zoulas * if stat fails, don't attempt to restore times (Steven Grubb) 2025-05-28 15:20 Christos Zoulas * PR/622: Odd_Bloke: Handle negative offsets in file_buffer(), when fd is not available. 2025-05-28 12:50 Christos Zoulas * PR/655: jsummers: Obey str_flags in strings like we do for search and regex * PR/659: Pitzl: Apply MAGIC_CONTINUE to annotations; i.e. print only the first, unless -k is specified. 2024-12-19 14:44 Christos Zoulas * PR/592: allow + in format strings * PR/592: signed operations should be done in signed context 2024-12-05 13:50 Christos Zoulas * PR/578: jsummers: Don't crash on cygwin when tm_mon == -1 * PR/579: net147: Fix stack overrun. 2024-11-27 14:44 Christos Zoulas * release 5.46 * Add OFFPOSITIVE 2024-11-25 13:56 Christos Zoulas * avoid leaking symbols in libmagic 2024-11-10 13:56 Christos Zoulas * PR/562: jsummers: Search/regex offsets are absolute to the beginning of the file, so adjust them by subtracting the offset that the "use" starts so that we don't double-count it. 2024-11-09 19:30 Christos Zoulas * PR/543: matshch: bump nbuf so we can get the flags into the buffer. 2024-11-02 14:34 Christos Zoulas * Add Android elf notes (enh) 2023-12-29 12:55 Christos Zoulas * Add limit for number of magic warnings allowed 2023-07-29 12:55 Christos Zoulas * check regex bounds (found by clusterfuzz) @ text @d3 1 a3 1 # $File: printer,v 1.36 2024/08/27 18:50:57 christos Exp $ d89 13 d109 1 a115 2 # From: Stefan Thurner >&0 search/10000 %! PJL encapsulated PostScript document text d233 2 a234 3 # Too weak #0 string BP #>0 use hpgl d244 2 a245 3 # Too weak #0 string NP #>0 use hpgl @ 1.1.1.1.2.1 log @file printer was added on branch jym-xensuspend on 2009-05-13 18:51:59 +0000 @ text @d1 129 @ 1.1.1.1.2.2 log @Sync with HEAD. Second commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html @ text @a0 129 #------------------------------------------------------------------------------ # printer: file(1) magic for printer-formatted files # # PostScript, updated by Daniel Quinlan (quinlan@@yggdrasil.com) 0 string %! PostScript document text !:mime application/postscript !:apple ASPSTEXT >2 string PS-Adobe- conforming >>11 string >\0 DSC level %.3s >>>15 string EPS \b, type %s >>>15 string Query \b, type %s >>>15 string ExitServer \b, type %s >>>15 search/1000 %%LanguageLevel:\ >>>>&0 string >\0 \b, Level %s # Some PCs have the annoying habit of adding a ^D as a document separator 0 string \004%! PostScript document text !:mime application/postscript !:apple ASPSTEXT >3 string PS-Adobe- conforming >>12 string >\0 DSC level %.3s >>>16 string EPS \b, type %s >>>16 string Query \b, type %s >>>16 string ExitServer \b, type %s >>>16 search/1000 %%LanguageLevel:\ >>>>&0 string >\0 \b, Level %s 0 string \033%-12345X%!PS PostScript document # DOS EPS Binary File Header # From: Ed Sznyter 0 belong 0xC5D0D3C6 DOS EPS Binary File >4 long >0 Postscript starts at byte %d >>8 long >0 length %d >>>12 long >0 Metafile starts at byte %d >>>>16 long >0 length %d >>>20 long >0 TIFF starts at byte %d >>>>24 long >0 length %d # Summary: Adobe's PostScript Printer Description File # Extension: .ppd # Reference: http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf, Section 3.8 # Submitted by: Yves Arrouye # 0 string *PPD-Adobe:\x20 PPD file >&0 string x \b, version %s # HP Printer Job Language 0 string \033%-12345X@@PJL HP Printer Job Language data # HP Printer Job Language # The header found on Win95 HP plot files is the "Silliest Thing possible" # (TM) # Every driver puts the language at some random position, with random case # (LANGUAGE and Language) # For example the LaserJet 5L driver puts the "PJL ENTER LANGUAGE" in line 10 # From: Uwe Bonnes # 0 string \033%-12345X@@PJL HP Printer Job Language data >&0 string >\0 %s >>&0 string >\0 %s >>>&0 string >\0 %s >>>>&0 string >\0 %s #>15 string \ ENTER\ LANGUAGE\ = #>31 string PostScript PostScript # HP Printer Control Language, Daniel Quinlan (quinlan@@yggdrasil.com) 0 string \033E\033 HP PCL printer data >3 string \&l0A - default page size >3 string \&l1A - US executive page size >3 string \&l2A - US letter page size >3 string \&l3A - US legal page size >3 string \&l26A - A4 page size >3 string \&l80A - Monarch envelope size >3 string \&l81A - No. 10 envelope size >3 string \&l90A - Intl. DL envelope size >3 string \&l91A - Intl. C5 envelope size >3 string \&l100A - Intl. B5 envelope size >3 string \&l-81A - No. 10 envelope size (landscape) >3 string \&l-90A - Intl. DL envelope size (landscape) # IMAGEN printer-ready files: 0 string @@document( Imagen printer # this only works if "language xxx" is first item in Imagen header. >10 string language\ impress (imPRESS data) >10 string language\ daisy (daisywheel text) >10 string language\ diablo (daisywheel text) >10 string language\ printer (line printer emulation) >10 string language\ tektronix (Tektronix 4014 emulation) # Add any other languages that your Imagen uses - remember # to keep the word `text' if the file is human-readable. # [GRR 950115: missing "postscript" or "ultrascript" (whatever it was called)] # # Now magic for IMAGEN font files... 0 string Rast RST-format raster font data >45 string >0 face %s # From Jukka Ukkonen 0 string \033[K\002\0\0\017\033(a\001\0\001\033(g Canon Bubble Jet BJC formatted data # From # These are the /etc/magic entries to decode data sent to an Epson printer. 0 string \x1B\x40\x1B\x28\x52\x08\x00\x00REMOTE1P Epson Stylus Color 460 data #------------------------------------------------------------------------------ # zenographics: file(1) magic for Zenographics ZjStream printer data # Rick Richardson rickr@@mn.rr.com 0 string JZJZ >0x12 string ZZ Zenographics ZjStream printer data (big-endian) 0 string ZJZJ >0x12 string ZZ Zenographics ZjStream printer data (little-endian) #------------------------------------------------------------------------------ # Oak Technologies printer stream # Rick Richardson 0 string OAK >0x07 byte 0 >0x0b byte 0 Oak Technologies printer stream # This would otherwise be recognized as PostScript - nick@@debian.org 0 string %!VMF SunClock's Vector Map Format data #------------------------------------------------------------------------------ # HP LaserJet 1000 series downloadable firmware file 0 string \xbe\xefABCDEFGH HP LaserJet 1000 series downloadable firmware # From: Paolo # Epson ESC/Page, ESC/PageColor 0 string \x1b\x01@@EJL Epson ESC/Page language printer data @