head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-10-2-RELEASE:1.1.1.5
	netbsd-9-5-RELEASE:1.1.1.3
	netbsd-11-0-RELEASE:1.1.1.6
	netbsd-11-0-RC7:1.1.1.6
	netbsd-11-0-RC6:1.1.1.6
	netbsd-11-0-RC5:1.1.1.6
	FILE5_48:1.1.1.7
	netbsd-11-0-RC4:1.1.1.6
	netbsd-11-0-RC3:1.1.1.6
	netbsd-11-0-RC2:1.1.1.6
	netbsd-11-0-RC1:1.1.1.6
	perseant-exfatfs-base-20250801:1.1.1.6
	netbsd-11:1.1.1.6.0.4
	netbsd-11-base:1.1.1.6
	netbsd-10-1-RELEASE:1.1.1.5
	perseant-exfatfs-base-20240630:1.1.1.6
	perseant-exfatfs:1.1.1.6.0.2
	perseant-exfatfs-base:1.1.1.6
	netbsd-8-3-RELEASE:1.1.1.2
	netbsd-9-4-RELEASE:1.1.1.3
	netbsd-10-0-RELEASE:1.1.1.5
	netbsd-10-0-RC6:1.1.1.5
	netbsd-10-0-RC5:1.1.1.5
	netbsd-10-0-RC4:1.1.1.5
	netbsd-10-0-RC3:1.1.1.5
	netbsd-10-0-RC2:1.1.1.5
	netbsd-10-0-RC1:1.1.1.5
	FILE5_45:1.1.1.6
	netbsd-10:1.1.1.5.0.2
	netbsd-10-base:1.1.1.5
	FILE5_43:1.1.1.5
	netbsd-9-3-RELEASE:1.1.1.3
	cjep_sun2x-base1:1.1.1.4
	cjep_sun2x:1.1.1.4.0.6
	cjep_sun2x-base:1.1.1.4
	cjep_staticlib_x-base1:1.1.1.4
	netbsd-9-2-RELEASE:1.1.1.3
	cjep_staticlib_x:1.1.1.4.0.4
	cjep_staticlib_x-base:1.1.1.4
	FILE5_40:1.1.1.4
	netbsd-9-1-RELEASE:1.1.1.3
	FILE5_39:1.1.1.4
	phil-wifi-20200421:1.1.1.4
	phil-wifi-20200411:1.1.1.4
	is-mlppp:1.1.1.4.0.2
	is-mlppp-base:1.1.1.4
	phil-wifi-20200406:1.1.1.4
	netbsd-8-2-RELEASE:1.1.1.2
	netbsd-9-0-RELEASE:1.1.1.3
	netbsd-9-0-RC2:1.1.1.3
	FILE5_38:1.1.1.4
	netbsd-9-0-RC1:1.1.1.3
	phil-wifi-20191119:1.1.1.3
	netbsd-9:1.1.1.3.0.2
	netbsd-9-base:1.1.1.3
	phil-wifi-20190609:1.1.1.3
	netbsd-8-1-RELEASE:1.1.1.2
	FILE5_37:1.1.1.3
	netbsd-8-1-RC1:1.1.1.2
	pgoyette-compat-merge-20190127:1.1.1.2
	pgoyette-compat-20190127:1.1.1.2
	pgoyette-compat-20190118:1.1.1.2
	pgoyette-compat-1226:1.1.1.2
	pgoyette-compat-1126:1.1.1.2
	pgoyette-compat-1020:1.1.1.2
	FILE5_35:1.1.1.2
	pgoyette-compat-0930:1.1.1.2
	pgoyette-compat-0906:1.1.1.2
	netbsd-7-2-RELEASE:1.1.1.1
	pgoyette-compat-0728:1.1.1.2
	netbsd-8-0-RELEASE:1.1.1.2
	phil-wifi:1.1.1.2.0.12
	phil-wifi-base:1.1.1.2
	pgoyette-compat-0625:1.1.1.2
	netbsd-8-0-RC2:1.1.1.2
	pgoyette-compat-0521:1.1.1.2
	pgoyette-compat-0502:1.1.1.2
	pgoyette-compat-0422:1.1.1.2
	netbsd-8-0-RC1:1.1.1.2
	FILE5_33:1.1.1.2
	pgoyette-compat-0415:1.1.1.2
	pgoyette-compat-0407:1.1.1.2
	pgoyette-compat-0330:1.1.1.2
	pgoyette-compat-0322:1.1.1.2
	pgoyette-compat-0315:1.1.1.2
	netbsd-7-1-2-RELEASE:1.1.1.1
	pgoyette-compat:1.1.1.2.0.10
	pgoyette-compat-base:1.1.1.2
	netbsd-7-1-1-RELEASE:1.1.1.1
	matt-nb8-mediatek:1.1.1.2.0.8
	matt-nb8-mediatek-base:1.1.1.2
	FILE5_32:1.1.1.2
	perseant-stdc-iso10646:1.1.1.2.0.6
	perseant-stdc-iso10646-base:1.1.1.2
	netbsd-8:1.1.1.2.0.4
	netbsd-8-base:1.1.1.2
	FILE5_31:1.1.1.2
	prg-localcount2-base3:1.1.1.2
	prg-localcount2-base2:1.1.1.2
	prg-localcount2-base1:1.1.1.2
	prg-localcount2:1.1.1.2.0.2
	prg-localcount2-base:1.1.1.2
	pgoyette-localcount-20170426:1.1.1.2
	bouyer-socketcan-base1:1.1.1.2
	pgoyette-localcount-20170320:1.1.1.2
	netbsd-7-1:1.1.1.1.0.16
	netbsd-7-1-RELEASE:1.1.1.1
	netbsd-7-1-RC2:1.1.1.1
	FILE5_30:1.1.1.2
	netbsd-7-nhusb-base-20170116:1.1.1.1
	bouyer-socketcan:1.1.1.1.0.14
	bouyer-socketcan-base:1.1.1.1
	pgoyette-localcount-20170107:1.1.1.1
	netbsd-7-1-RC1:1.1.1.1
	pgoyette-localcount-20161104:1.1.1.1
	netbsd-7-0-2-RELEASE:1.1.1.1
	localcount-20160914:1.1.1.1
	netbsd-7-nhusb:1.1.1.1.0.12
	netbsd-7-nhusb-base:1.1.1.1
	pgoyette-localcount-20160806:1.1.1.1
	pgoyette-localcount-20160726:1.1.1.1
	pgoyette-localcount:1.1.1.1.0.10
	pgoyette-localcount-base:1.1.1.1
	netbsd-7-0-1-RELEASE:1.1.1.1
	netbsd-7-0:1.1.1.1.0.8
	netbsd-7-0-RELEASE:1.1.1.1
	netbsd-7-0-RC3:1.1.1.1
	netbsd-7-0-RC2:1.1.1.1
	netbsd-7-0-RC1:1.1.1.1
	FILE5_22:1.1.1.1
	FILE5_20:1.1.1.1
	tls-maxphys-base:1.1.1.1
	tls-maxphys:1.1.1.1.0.6
	netbsd-7:1.1.1.1.0.4
	netbsd-7-base:1.1.1.1
	tls-earlyentropy:1.1.1.1.0.2
	tls-earlyentropy-base:1.1.1.1
	FILE5_19:1.1.1.1
	CHRISTOS:1.1.1;
locks; strict;
comment	@# @;


1.1
date	2014.06.13.01.48.24;	author christos;	state Exp;
branches
	1.1.1.1;
next	;
commitid	jtTYsE5FmJU6MiEx;

1.1.1.1
date	2014.06.13.01.48.24;	author christos;	state Exp;
branches
	1.1.1.1.2.1
	1.1.1.1.6.1
	1.1.1.1.10.1
	1.1.1.1.14.1;
next	1.1.1.2;
commitid	jtTYsE5FmJU6MiEx;

1.1.1.2
date	2017.02.10.17.42.58;	author christos;	state Exp;
branches
	1.1.1.2.12.1;
next	1.1.1.3;
commitid	HAP3kn9Hn6ovMqFz;

1.1.1.3
date	2019.05.22.17.19.57;	author christos;	state Exp;
branches;
next	1.1.1.4;
commitid	VXeNRYYruN1MWdoB;

1.1.1.4
date	2019.12.17.02.23.53;	author christos;	state Exp;
branches;
next	1.1.1.5;
commitid	vqYTz60fS9PNg0PB;

1.1.1.5
date	2022.09.24.20.07.54;	author christos;	state Exp;
branches;
next	1.1.1.6;
commitid	Nf6F9kcpc0EPC9VD;

1.1.1.6
date	2023.08.18.18.36.50;	author christos;	state Exp;
branches;
next	1.1.1.7;
commitid	IX26ghc1E2S0AiBE;

1.1.1.7
date	2026.06.10.15.59.14;	author christos;	state Exp;
branches;
next	;
commitid	3UWc0DrzTz7bHgJG;

1.1.1.1.2.1
date	2014.06.13.01.48.24;	author tls;	state dead;
branches;
next	1.1.1.1.2.2;
commitid	b1wUlsZGswrdGMLx;

1.1.1.1.2.2
date	2014.08.10.07.07.10;	author tls;	state Exp;
branches;
next	;
commitid	b1wUlsZGswrdGMLx;

1.1.1.1.6.1
date	2014.06.13.01.48.24;	author tls;	state dead;
branches;
next	1.1.1.1.6.2;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.1.6.2
date	2014.08.19.23.46.47;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.1.1.1.10.1
date	2017.03.20.06.52.19;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.1.1.1.14.1
date	2017.04.21.16.51.24;	author bouyer;	state Exp;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.1.1.2.12.1
date	2019.06.10.21.44.46;	author christos;	state Exp;
branches;
next	1.1.1.2.12.2;
commitid	jtc8rnCzWiEEHGqB;

1.1.1.2.12.2
date	2020.04.08.14.04.04;	author martin;	state Exp;
branches;
next	;
commitid	Qli2aW9E74UFuA3C;


desc
@@


1.1
log
@Initial revision
@
text
@

#------------------------------------------------------------------------------
# $File: map,v 1.1 2014/06/03 18:22:25 christos Exp $
# map:  file(1) magic for Map data
#

# Garmin .FIT files http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
8	string	.FIT		FIT Map data
>15	byte	0
>>35	belong	x		\b, unit id %d
# 20 years after unix epoch
>>39	lelong	x		\b, serial %u
>>43	ledate/631152000 x	\b, %s

>>47	leshort x		\b, manufacturer %d
>>47	leshort	1		\b (garmin)
>>49	leshort x		\b, product %d
>>53	byte	x		\b, type %d
>>53	byte	1		\b (Device)
>>53	byte	2		\b (Settings)
>>53	byte	3		\b (Sports/Cycling)
>>53	byte	4		\b (Activity)
>>53	byte	8		\b (Elevations)
>>53	byte	10		\b (Totals)
@


1.1.1.1
log
@import file-5.19

2014-06-09   9:04  Christos Zoulas <christos@@zoulas.com>

	* Misc buffer overruns and missing buffer size tests in cdf parsing
	  (Francisco Alonso, Jan Kaluza)

2014-06-02  14:50  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* Make the range operator limit the length of the
	  regex search.

2014-05-14  19:23  Christos Zoulas <christos@@zoulas.com>

	* PR/347: Windows fixes
	* PR/352: Hangul word processor recognition
	* PR/354: Encoding irregularities in text files

2014-05-06  6:12  Christos Zoulas <christos@@zoulas.com>

	* Fix uninitialized title in CDF files (Jan Kaluza)

2014-05-04  14:55  Christos Zoulas <christos@@zoulas.com>

	* PR/351: Fix compilation of empty files

2014-04-30  17:39  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/341: Jan Kaluza, fix memory leak
	* PR/342: Jan Kaluza, fix out of bounds read

2014-03-28  15:25  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with long formats not matching fmtcheck
@
text
@@


1.1.1.1.14.1
log
@Sync with HEAD
@
text
@d4 1
a4 1
# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $
d12 1
d14 1
a14 4
# http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
# 20 years after unix epoch
# TZ=GMT date -d '1989-12-31 0:00' +%s
>>43	leldate+631065600	x	\b, %s
a25 14

# TOM TOM GPS watches ttbin files:
# http://github.com/ryanbinns/ttwatch/tree/master/ttbin
# From: Daniel Lenski
0	byte	0x20
>1	leshort	0x0007
>>0x76	byte	0x20
>>>0x77	leshort	0x0075		TomTom activity file, v7
>>>>8	leldate	x		(%s,
>>>>3	byte    x		device firmware %d.
>>>>4	byte	x		\b%d.
>>>>5	byte	x		\b%d,
>>>>6	leshort	x		product ID %04d)

@


1.1.1.1.10.1
log
@Sync with HEAD
@
text
@d4 1
a4 1
# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $
d12 1
d14 1
a14 4
# http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
# 20 years after unix epoch
# TZ=GMT date -d '1989-12-31 0:00' +%s
>>43	leldate+631065600	x	\b, %s
a25 14

# TOM TOM GPS watches ttbin files:
# http://github.com/ryanbinns/ttwatch/tree/master/ttbin
# From: Daniel Lenski
0	byte	0x20
>1	leshort	0x0007
>>0x76	byte	0x20
>>>0x77	leshort	0x0075		TomTom activity file, v7
>>>>8	leldate	x		(%s,
>>>>3	byte    x		device firmware %d.
>>>>4	byte	x		\b%d.
>>>>5	byte	x		\b%d,
>>>>6	leshort	x		product ID %04d)

@


1.1.1.2
log
@2017-02-10  12:24  Christos Zoulas <christos@@zoulas.com>

	* release 5.30

2017-02-07  23:27  Christos Zoulas <christos@@zoulas.com>

	* If we exceeded the offset in a search return no match
	  (Christoph Biedl)
	* Be more lenient on corrupt CDF files (Christoph Biedl)

2017-02-04  16:46  Christos Zoulas <christos@@zoulas.com>

	* pacify ubsan sign extension (oss-fuzz/524)

2017-02-01  12:42  Christos Zoulas <christos@@zoulas.com>

	* off by one in cdf parsing (PR/593)
	* report debugging sections in elf (PR/591)

2016-11-06  10:52  Christos Zoulas <christos@@zoulas.com>

	* Allow @@@@@@ in extensions
	* Add missing overflow check in der magic (Jonas Wagner)

2016-10-25  10:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.29

2016-10-24  11:20  Christos Zoulas <christos@@zoulas.com>

	* der getlength overflow (Jonas Wagner)
	* multiple magic file load failure (Christoph Biedl)

2016-10-17  11:26  Christos Zoulas <christos@@zoulas.com>

	* CDF parsing improvements (Guy Helmer)

2016-07-20   7:26  Christos Zoulas <christos@@zoulas.com>

	* Add support for signed indirect offsets

2016-07-18   7:41  Christos Zoulas <christos@@zoulas.com>

	* cat /dev/null | file - should print empty (Christoph Biedl)

2016-07-05  15:20  Christos Zoulas <christos@@zoulas.com>

	* Bump string size from 64 to 96.

2016-06-13  20:20  Christos Zoulas <christos@@zoulas.com>

	* PR/556: Fix separators on annotations.

2016-06-13  19:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.28
	* fix leak on allocation failure

2016-06-01   1:20  Christos Zoulas <christos@@zoulas.com>

	* PR/555: Avoid overflow for offset > nbytes
	* PR/550: Segv on DER parsing:
	    - use the correct variable for length
	    - set offset to 0 on failure.

2016-05-13  12:00  Christos Zoulas <christos@@zoulas.com>

	* release 5.27

2016-04-18   9:35  Christos Zoulas <christos@@zoulas.com>

	* Errors comparing DER entries or computing offsets
	  are just indications of malformed non-DER files.
	  Don't print them.
	* Offset comparison was off-by-one.
	* Fix compression code (Werner Fink)
	* Put new bytes constant in the right file (not the generated one)

2016-04-16  18:34  Christos Zoulas <christos@@zoulas.com>

	* release 5.26

2016-03-31  13:50  Christos Zoulas <christos@@zoulas.com>

	* make the number of bytes read from files configurable.

2016-03-21  13:40  Christos Zoulas <christos@@zoulas.com>

	* Add bounds checks for DER code (discovered by Thomas Jarosch)
	* Change indirect recursion limit to indirect use count and
	  bump from 15 to 50 to prevent abuse.

2016-03-13  20:39  Christos Zoulas <christos@@zoulas.com>

	* Add -00 which prints filename\0description\0

2016-03-01  13:28  Christos Zoulas <christos@@zoulas.com>

	* Fix ID3 indirect parsing

2016-01-19  10:18  Christos Zoulas <christos@@zoulas.com>

	* add DER parsing capability

2015-11-13  10:35  Christos Zoulas <christos@@zoulas.com>

	* provide dprintf(3) for the OS's that don't have it.

2015-11-11  16:25  Christos Zoulas <christos@@zoulas.com>

	* redo the compression code report decompression errors

2015-11-10  23:25  Christos Zoulas <christos@@zoulas.com>

	* REG_STARTEND code is not working as expected, delete it.

2015-11-09  16:05  Christos Zoulas <christos@@zoulas.com>

	* Add zlib support if we have it.

2015-11-05  11:22  Christos Zoulas <christos@@zoulas.com>

	* PR/492: compression forking was broken with magic_buffer.

2015-09-16   9:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.25

2015-09-11  13:25  Christos Zoulas <christos@@zoulas.com>

	* add a limit to the length of regex searches

2015-09-08   9:50  Christos Zoulas <christos@@zoulas.com>

	* fix problems with --parameter (Christoph Biedl)

2015-07-11  10:35  Christos Zoulas <christos@@zoulas.com>

	* Windows fixes PR/466 (Jason Hood)

2015-07-09  10:35  Christos Zoulas <christos@@zoulas.com>

	* release 5.24

2015-06-11   8:52  Christos Zoulas <christos@@zoulas.com>

	* redo long option encoding to fix off-by-one in 5.23

2015-06-10  13:50  Christos Zoulas <christos@@zoulas.com>

	* release 5.23

2015-06-09  16:10  Christos Zoulas <christos@@zoulas.com>

	* Fix issue with regex range for magic with offset
	* Always return true from mget with USE (success to mget not match
	  indication). Fixes mime evaluation after USE magic
	* PR/459: Don't insert magic entries to the list if there are parsing
	  errors for them.

2015-06-03  16:00  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Add utf-7 encoding

2015-06-03  14:30  Christos Zoulas <christos@@zoulas.com>

	* PR/455: Implement -Z, look inside, but don't report on compression
	* PR/454: Fix allocation error on bad magic.

2015-05-29  10:30  Christos Zoulas <christos@@zoulas.com>

	* handle MAGIC_CONTINUE everywhere, not just in softmagic

2015-05-21  14:30  Christos Zoulas <christos@@zoulas.com>

	* don't print descriptions for NAME types when mime.

2015-04-09  15:59  Christos Zoulas <christos@@zoulas.com>

	* Add --extension to list the known extensions for this file type
	  Idea by Andrew J Roazen

2015-02-14  12:23  Christos Zoulas <christos@@zoulas.com>

	* Bump file search buffer size to 1M.

2015-01-09  14:35  Christos Zoulas <christos@@zoulas.com>

	* Fix multiple issues with date formats reported by Christoph Biedl:
		- T_LOCAL meaning was reversed
		- Arithmetic did not work
	  Also stop adjusting daylight savings for gmt printing.

2015-01-05  13:00  Christos Zoulas <christos@@zoulas.com>

	* PR/411: Fix memory corruption from corrupt cdf file.
@
text
@d4 1
a4 1
# $File: map,v 1.4 2015/08/10 05:18:27 christos Exp $
d12 1
d14 1
a14 4
# http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
# 20 years after unix epoch
# TZ=GMT date -d '1989-12-31 0:00' +%s
>>43	leldate+631065600	x	\b, %s
a25 14

# TOM TOM GPS watches ttbin files:
# http://github.com/ryanbinns/ttwatch/tree/master/ttbin
# From: Daniel Lenski
0	byte	0x20
>1	leshort	0x0007
>>0x76	byte	0x20
>>>0x77	leshort	0x0075		TomTom activity file, v7
>>>>8	leldate	x		(%s,
>>>>3	byte    x		device firmware %d.
>>>>4	byte	x		\b%d.
>>>>5	byte	x		\b%d,
>>>>6	leshort	x		product ID %04d)

@


1.1.1.2.12.1
log
@Sync with HEAD
@
text
@d4 1
a4 1
# $File: map,v 1.7 2019/04/30 04:02:04 christos Exp $
d8 1
a8 1
# Garmin .FIT files https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
d13 1
a13 1
# https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
a28 290
# Summary: Garmin map
# From:	Joerg Jenderek
# URL: https://en.wikipedia.org/wiki/Garmin_.img
# Reference: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format
# sourceforge.net/projects/garmin-img/files/IMG%20File%20Format/1.0/imgformat-1.0.pdf
# GRR: similar to MBR boot sector handled by ./filesystems
0x1FE	leshort		=0xAA55
# look for valid map signature
>0x13	string		=IMG\0
>>0	use		garmin-map
0	name				garmin-map
>0	ubyte		x		Garmin
!:mime	application/x-garmin-map
# If non-zero, every byte of the entire .img file is to be XORed with this value
>0	ubyte		!0		\b, 0x%x XORed
# goto block before FAT
>(0x40.b*512)	ubyte	x
# 1st fat name "DLLINFO TXT" only found for vpm
>>&512 		string	=DLLINFO\ TXT 	map (Voice Processing)
# there exist 2 other Garmin VPM formats; see ./audio
!:ext	vpm
# Deutsch__Yannick_D4481-00_0210.vpm
#>>>512	search/0x0116da60/s	RIFF	\b; with
# determine type voice type by ./riff
#>>>>&0	indirect	x	\b
>>&512 		string	!DLLINFO\ TXT 	map
!:ext	img
# 9 zeros
>1 	ubelong		!0 		\b, zeroes 0x%x
# Map's version major
>8	ubyte		x		v%u
# Map's version minor
>9	ubyte		x		\b.%.2u
# Map description[20], 0x20 padded
>0x49	string		x		%.20s
# Map name, continued (0x20 padded, \0 terminated)
>0x65	string		>\ 		\b%.31s
# Update year (+1900 for val >= 0x63, +2000 for val <= 0x62)
>0xB	ubyte		x		\b, updated
>>0xB	ubyte		>0x62
>>>0xB	ubyte-100	x		20%.2u
>>0xB	ubyte		<0x63
>>>0xB	ubyte		x		20%.2u
# Update month (0-11)
>0xA	ubyte		x		\b-%.2u
# All zeroes
>0xc 	uleshort	!0 		\b, zeroes 0x%x
# Mapsource flag, 1 - file created by Mapsource, 0 - Garmin map visible in Basecamp and Homeport 
#>0xE	ubyte		!0		\b, Mapsource flag 0x%x
>0xE	ubyte		1		\b, Mapsource
# Checksum, sum of all bytes modulo 256 should be 0
#>0xF	ubyte		x		\b, Checksum 0x%x
# Signature: DSKIMG 0x00 or DSDIMG 0x00 for demo map 
>0x10	string		!DSKIMG		\b, signature "%.7s"
>0x39	use		garmin-date
# Map file identifier like GARMIN\0
>0x41	string		!GARMIN		\b, id "%.7s"
# Block size exponent, E1; appears to always be 0x09; minimum block size 512 bytes
>0x61	ubyte		!0x09		\b, E1=%u
# Block size exponent, E2 ; file blocksize=2**(E1+E2)
>>0x62	ubyte		x		\b, E2=%u
>0x61	ubyte		=0x09		\b, blocksize
>>0x62	ubyte		0		512
>>0x62	ubyte		1		1024
>>0x62	ubyte		2		2048
>>0x62	ubyte		3		4096
>>0x62	ubyte		4		8192
>>0x62	ubyte		5		16384
>>0x62	default		x
>>>0x62	ubyte		x		E2=%u
# MBR signature
>0x1FE	leshort		!0xAA55		\b, invalid MBR
# 512 zeros
>0x200 	uquad		!0		\b, zeroes 0x%llx
# First sub-file offset (absolute); sometimes NO/UNKNOWN sub file!
>0x40C	ulelong		>0		\b, at 0x%x
# sub-file Header length
#>>(0x40C.l)	uleshort	x	\b, header len 0x%x
>>(0x40C.l)	uleshort	x	%u bytes
# sub-file Type[10] like "GARMIN RGN" "GARMIN TRE", "GARMIN TYP", etc.
>>(0x40C.l+2)	ubyte	>0x1F
>>>(0x40C.l+2)	ubyte	<0xFF
>>>>(0x40C.l+2)	string	x		"%.10s"
# 0x00 for most maps, 0x80 for locked maps (City Nav, City Select, etc.) 
>>>>(0x40C.l+13)	ubyte	>0		\b, locked 0x%x
# Block sequence numbers like 0000 0100 0200 ... FFFF
# >0x420	ubequad		>0	\b, seq. 0x%16.16llx
# >>0x428	ubequad		>0	\b%16.16llx
# >>>0x430	ubequad	>0	\b%16.16llx
# >>>>0x438	ubequad	>0	\b%16.16llx
# >>>>>0x440	ubequad	>0	\b%16.16llx
# >>>>>>0x448	ubequad	>0	\b%16.16llx
# >>>>>>>0x450	ubequad	>0	\b%16.16llx
# >>>>>>>>0x458	ubequad	>0	\b%16.16llx
# >>>>>>>>>0x460	ubequad	>0	\b%16.16llx
# >>>>>>>>>>0x468	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>0x470	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>0x478	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>0x480	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>0x488	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>0x490	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>0x498	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>>0x4A0	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>>>0x4A8	ubequad	>0	\b%16.16llx
# look for end of FAT
#>>0x420	search/512/s	\xff\xff	FAT END
# Physical block number of FAT header
#>0x40	ubyte		x		\b, FAT at phy. block %u
>0x40	ubyte		x
>>(0x40.b*512)	ubyte	x
# 1st FAT block
>>>&511 	use	garmin-fat
# 2nd FAT block
>>>&1023 	use	garmin-fat
# 3th FAT block
>>>&1535 	use	garmin-fat
# 4th FAT block
>>>&2047 	use	garmin-fat
# ... xth FAT block
#
# 314 zeros but not in vpm and also gmaptz.img
>0x84 	uquad		!0		\b, at 0x84 0x%llx
# display FileAllocationTable block entry in garmin map
0	name				garmin-fat
>0	ubyte		x		\b;
# sub file part; 0x0003 seems to be garbage
>0x10	uleshort	!0		next 0x%4.4x
>0x10	uleshort	=0
# fat flag 0~dummy block 1~true sub file
>>0	ubyte		!1		flag %u 
>>0	ubyte		=1
# sub-file name like MAKEGMAP 12345678
>>>0x1	string		x		%.8s
# sub-file typ like RGN TRE MDR LBL
>>>0x9	string		x		\b.%.3s
# size of sub file
>>>0xC	ulelong		x		\b, %u bytes
# 32-bit block sequence numbers
#>>>0x20	ubequad		x		\b, seq. 0x%16.16llx

#	display date stored inside Garmin maps like yyyy-mm-dd h:mm:ss
0	name				garmin-date
# year like 2018
>0 	uleshort	x 		\b, created %u
# month (0-11)
>2	ubyte		x		\b-%.2u
# day (1-31)
>3	ubyte		x		\b-%.2u
# hour (0-23)
>4	ubyte		x		%u
# minute (0-59)
>5	ubyte		x		\b:%.2u
# second (0-59)
>6	ubyte		x		\b:%.2u

# Summary: Garmin Map subfiles
# From:	Joerg Jenderek
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format
# Garmin Common Header
2	string	GARMIN\ 
# skip ASCII text by checking for low header length
>0	uleshort <0x1000	Garmin map,
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/GMP_Subfile_Format
>>9	string	GMP				subtile
!:mime			application/x-garmin-gpm
!:ext			gmp
# copyright message
>>>(0.s)		string		x	%s
>>>0x0E 		use		garmin-date
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/MDR_Subfile_Format
# This contains the searchable address table used for finding routing destinations
>>9	string	MDR				address table
!:mime			application/x-garmin-mdr
!:ext			mdr
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/NOD_Subfile_Format
# http://svn.parabola.me.uk/display/trunk/doc/nod.txt
# This contains the routing information
>>9	string	NOD				routing
!:mime			application/x-garmin-nod
!:ext			nod
>>>0x0E 		use		garmin-date
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes NOD1
#>>>0x25			ulelong		x	\b, at 0x%x
#>>>0x29			ulelong		x	0x%x bytes NOD2
#>>>0x31			ulelong		x	\b, at 0x%x
#>>>0x35			ulelong		x	0x%x bytes NOD3
# URL: http://www.pinns.co.uk/osm/net.html
# routable highways (length, direction, allowed speed,house address information)
>>9	string	NET				highways
!:mime			application/x-garmin-net
!:ext			net
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes NET1
#>>>0x22			ulelong		>0
#>>>>0x1E		ulelong		x	\b, at 0x%x
#>>>>0x22		ulelong		x	0x%x bytes NET2
#>>>0x2B			ulelong		>0
#>>>>0x27		ulelong		x	\b, at 0x%x
#>>>>0x2B		ulelong		x	0x%x bytes NET3
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/LBL_Subfile_Format
>>9	string	LBL				labels
!:mime			application/x-garmin-lbl
!:ext			lbl
>>>(0.s)		string	x	%s
# Label coding type 6h 9h and ah
>>>0x1E			ubyte		x	\b, coding type 0x%x
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes LBL1
#>>>0x1F			ulelong		x	\b, at 0x%x
#>>>0x23			ulelong		x	0x%x bytes LBL2
#>>>0x2D			ulelong		x	\b, at 0x%x
#>>>0x31			ulelong		x	0x%x bytes LBL3
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/SRT_Subfile_Format
# A lookup table of the chars in the map's codepage, and their collating sequence
>>9	string	SRT				sort table
!:mime			application/x-garmin-srt
!:ext			srt
>>>0x0E 		use		garmin-date
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/TRE_Subfile_Format
>>9	string	TRE				tree
!:mime			application/x-garmin-tre
!:ext			tre
# title like City Nav Europe NTU 2019.2 Basemap
# or OSM Street map
>>>(0.s)		string		x	%s
# 2nd title like Copyright 1995-2018 by GARMIN Corporation.
# or http://www.openstreetmap.org/
>>>>&1			string		x	%s
>>>0x0E 		use		garmin-date
#>>>0x21			ulelong		x	\b, at 0x%x
#>>>0x25			ulelong		x	0x%x bytes TRE1
#>>>0x29			ulelong		x	\b, at 0x%x
#>>>0x2D			ulelong		x	0x%x bytes TRE2
#>>>0x31			ulelong		x	\b, at 0x%x
#>>>0x35			ulelong		x	0x%x bytes TRE3
# Copyright record size
#>>>0x39			uleshort	x	\b, copyright record size %u
# Map ID
>>>0x74			ulelong		x	\b, ID 0x%x
# URL: https://www.gpspower.net/garmin-tutorials/353310-basecamp-installing-free-desktop-map.html
# For road traffic information service (RDS/TMS/TMC). Commonly seen in City Navigator maps
>>9	string	TRF				traffic,
!:mime			application/x-garmin-trf
!:ext			trf
# city/region like Preitenegg
>>>(0.s+1) 		string		x	1st %s
# highway part like L606/L148
>>>>&1			string		x	%s
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/Format
# Reference: http://www.pinns.co.uk/osm/typformat.html
# customize the appearance of objects. For GPS and MapSource/Qlandkarte better looking maps
>>9	string	TYP				types
!:mime			application/x-garmin-typ
!:ext			typ
>>>0x0E 		use		garmin-date
# character set 1252 65001~UTF8
>>>0x15			uleshort	x	\b, code page %u
# POIs
#>>>0x17			ulelong		x	\b, at 0x%x
#>>>0x1B			ulelong		x	0x%x bytes TYP1
# extra pois
#>>>0x5B			ulelong		x	\b, at 0x%x
#>>>0x5F			ulelong		x	0x%x bytes TYP8
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/RGN_Subfile_Format
# http://www.pinns.co.uk/osm/RGN.html
# region data used by the Garmin software
>>9	string	RGN				region
!:mime			application/x-garmin-rgn
!:ext			rgn
# POIs,Indexed POIs,Polylines or Polygons or first map level
#>>>0x15			ulelong	       x	\b, at 0x%x
#>>>0x19			ulelong	       x	0x%x bytes RGN1
# polygons with extended types
#>>>0x21			ulelong	       >0
#>>>>0x1D		ulelong	       x	\b, at 0x%x
#>>>>0x21		ulelong	       x	0x%x bytes RGN2
# polylines with extended types
#>>>0x3D			ulelong	       >0
#>>>>0x39		ulelong	       x	\b, at 0x%x
#>>>>0x3D		ulelong	       x	0x%x bytes RGN3
# extended POIs
#>>>0x59			ulelong	       >0
#>>>>0x55		ulelong	       x	\b, at 0x%x
#>>>>0x59		ulelong	       x	0x%x bytes RGN3
#>>9	default		x		unknown map type
# Header length; GMP:31h 35h 3Dh,MDR:11Eh 238h 2C4h 310h,NOD:3Fh 7Fh,NET:64h,
# LBL:2A9h,SRT:1Dh 25h 27h,TRE:CFh 135h,TRF:5Ah,TYP:5Bh 6Eh 7Ch AEh,RGN:7Dh
>>0	uleshort	x		\b, header length 0x%x

d30 1
a30 1
# https://github.com/ryanbinns/ttwatch/tree/master/ttbin
@


1.1.1.2.12.2
log
@Merge changes from current as of 20200406
@
text
@d4 1
a4 1
# $File: map,v 1.8 2019/12/01 22:46:23 christos Exp $
a318 77
# URL:		https://www.memotech.franken.de/FileFormats/
# Reference:	https://www.memotech.franken.de/FileFormats/Garmin_RGN_Format.pdf
# From:		Joerg Jenderek
0	string		KpGr		Garmin update
# format version like: 0064h~1.0
>0x4	uleshort	!0x0064
>>4	uleshort/100	x		\b, version %u
>>4	uleshort%100	x		\b.%u
# 1st Garmin entry
>6	use	garmin-entry
# 2nd Garmin entry
>(0x6.l+10)	ubyte		x
>>&0		use		garmin-entry
# 3rd entry
>(0x6.l+10)	ubyte		x
>>&(&0.l+4)	ubyte		x
>>>&0		use		garmin-entry
# look again at version to use default clause
>0x4	uleshort	x
# test for region content by looking for
# Garmin *.srf by ./images with normal builder name "SQA" or longer "hales"
# 1 space after equal sign
>>0x3a	search/5/s	GARMIN\ BITMAP	\b= 
!:mime	image/x-garmin-exe
!:ext	exe
>>>&0	indirect	x
# if not bitmap *.srf then region; 1 space after equal sign
>>0x3a	default		x		\b= 
!:mime	application/x-garmin-rgn
!:ext	rgn
# recursiv embedded
>>>0x3a	search/5/s	KpGrd
>>>>&0	indirect	x
# look for ZIP or JAR archive by ./archive and ./zip
>>>0x3a	search/5/s	PK\003\004
>>>>&0	indirect	x
# TODO: other garmin RGN record content like foo
#>>0x3a	search/5/s	bar		BAR
#		display information of Garmin RGN record
0	name	garmin-entry
# record length: 2 for Data, for Application often 1Bh sometimes 1Dh, "big" for Region
#>0	ulelong		x		\b, length 0x%x
# data record (ID='D') with version content like 0064h~1.0
>4	ubyte		=0x44
>>5	uleshort	!0x0064		\b; Data
>>>5	uleshort/100	x		\b, version %u
>>>5	uleshort%100	x		\b.%u
# Application Record (ID='A')
>4	ubyte		=0x41		\b; App
# version content like 00c8h~2.0
>>5	uleshort	!0x00C8
>>>5	uleshort/100	x		\b, version %u
>>>5	uleshort%100	x		\b.%u
# builder name like: SQA sqa build hales
>>7	string		x		\b, build by %s
# build date like: Oct 25 1999, Oct 1 2008, Feb 23 2009, Dec 15 2009
>>>&1	string		x		%s
# build time like: 11:26:12, 11:45:54, 14:16:13, 18:23:01
>>>>&1	string		x		%s
# region record (ID='R')
>4	ubyte		=0x52		\b; Region
# region ID:14~fw_all.bin: 78~ZIP, RGN or SRF bitmap; 148~ZIP or JAR; 249~display firmware; 251~WiFi or GCD firmware; 255~ZIP
>>5	uleshort	x		ID=%u
# delay in ms: like 0, 500
>>7	ulelong		!0		\b, %u ms
# region size (is record length - 10)
#>>11	ulelong		x		\b, length 0x%x
# region content like:
# "KpGr"~recursiv embedded,"GARMIN BITMAP"~Garmin Bitmap *.srf, "PK"~ZIP archive
#>>15	string		x		\b, content "%s"
>>15	ubequad		x		\b, content 0x%llx...
# This does NOT WORK!
#>>15	indirect	x		\b; contains 
>4	default		x		\b; other
# garmin Record ID Identifies the record content like: D A R
>>4	ubyte		x		ID '%c'

@


1.1.1.3
log
@2019-05-14  22:26  Christos Zoulas <christos@@zoulas.com>

	* release 5.37

2019-05-09  22:27  Christos Zoulas <christos@@zoulas.com>

	* Make sure that continuation separators are printed
	  with -k within softmagic

2019-05-06  22:27  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/77: Handle --mime-type and -k correctly.

2019-05-03  15:26  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/75: --enable-zlib, did not work.

2019-02-27  11:54  Christos Zoulas <christos@@zoulas.com>

	* Improve regex efficiency (Michael Schroeder) by:
		1. Prefixing regex searches with regular search
		   for keywords where possible
		2. Using memmem(3) where available
@
text
@d4 1
a4 1
# $File: map,v 1.7 2019/04/30 04:02:04 christos Exp $
d8 1
a8 1
# Garmin .FIT files https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
d13 1
a13 1
# https://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
a28 290
# Summary: Garmin map
# From:	Joerg Jenderek
# URL: https://en.wikipedia.org/wiki/Garmin_.img
# Reference: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format
# sourceforge.net/projects/garmin-img/files/IMG%20File%20Format/1.0/imgformat-1.0.pdf
# GRR: similar to MBR boot sector handled by ./filesystems
0x1FE	leshort		=0xAA55
# look for valid map signature
>0x13	string		=IMG\0
>>0	use		garmin-map
0	name				garmin-map
>0	ubyte		x		Garmin
!:mime	application/x-garmin-map
# If non-zero, every byte of the entire .img file is to be XORed with this value
>0	ubyte		!0		\b, 0x%x XORed
# goto block before FAT
>(0x40.b*512)	ubyte	x
# 1st fat name "DLLINFO TXT" only found for vpm
>>&512 		string	=DLLINFO\ TXT 	map (Voice Processing)
# there exist 2 other Garmin VPM formats; see ./audio
!:ext	vpm
# Deutsch__Yannick_D4481-00_0210.vpm
#>>>512	search/0x0116da60/s	RIFF	\b; with
# determine type voice type by ./riff
#>>>>&0	indirect	x	\b
>>&512 		string	!DLLINFO\ TXT 	map
!:ext	img
# 9 zeros
>1 	ubelong		!0 		\b, zeroes 0x%x
# Map's version major
>8	ubyte		x		v%u
# Map's version minor
>9	ubyte		x		\b.%.2u
# Map description[20], 0x20 padded
>0x49	string		x		%.20s
# Map name, continued (0x20 padded, \0 terminated)
>0x65	string		>\ 		\b%.31s
# Update year (+1900 for val >= 0x63, +2000 for val <= 0x62)
>0xB	ubyte		x		\b, updated
>>0xB	ubyte		>0x62
>>>0xB	ubyte-100	x		20%.2u
>>0xB	ubyte		<0x63
>>>0xB	ubyte		x		20%.2u
# Update month (0-11)
>0xA	ubyte		x		\b-%.2u
# All zeroes
>0xc 	uleshort	!0 		\b, zeroes 0x%x
# Mapsource flag, 1 - file created by Mapsource, 0 - Garmin map visible in Basecamp and Homeport 
#>0xE	ubyte		!0		\b, Mapsource flag 0x%x
>0xE	ubyte		1		\b, Mapsource
# Checksum, sum of all bytes modulo 256 should be 0
#>0xF	ubyte		x		\b, Checksum 0x%x
# Signature: DSKIMG 0x00 or DSDIMG 0x00 for demo map 
>0x10	string		!DSKIMG		\b, signature "%.7s"
>0x39	use		garmin-date
# Map file identifier like GARMIN\0
>0x41	string		!GARMIN		\b, id "%.7s"
# Block size exponent, E1; appears to always be 0x09; minimum block size 512 bytes
>0x61	ubyte		!0x09		\b, E1=%u
# Block size exponent, E2 ; file blocksize=2**(E1+E2)
>>0x62	ubyte		x		\b, E2=%u
>0x61	ubyte		=0x09		\b, blocksize
>>0x62	ubyte		0		512
>>0x62	ubyte		1		1024
>>0x62	ubyte		2		2048
>>0x62	ubyte		3		4096
>>0x62	ubyte		4		8192
>>0x62	ubyte		5		16384
>>0x62	default		x
>>>0x62	ubyte		x		E2=%u
# MBR signature
>0x1FE	leshort		!0xAA55		\b, invalid MBR
# 512 zeros
>0x200 	uquad		!0		\b, zeroes 0x%llx
# First sub-file offset (absolute); sometimes NO/UNKNOWN sub file!
>0x40C	ulelong		>0		\b, at 0x%x
# sub-file Header length
#>>(0x40C.l)	uleshort	x	\b, header len 0x%x
>>(0x40C.l)	uleshort	x	%u bytes
# sub-file Type[10] like "GARMIN RGN" "GARMIN TRE", "GARMIN TYP", etc.
>>(0x40C.l+2)	ubyte	>0x1F
>>>(0x40C.l+2)	ubyte	<0xFF
>>>>(0x40C.l+2)	string	x		"%.10s"
# 0x00 for most maps, 0x80 for locked maps (City Nav, City Select, etc.) 
>>>>(0x40C.l+13)	ubyte	>0		\b, locked 0x%x
# Block sequence numbers like 0000 0100 0200 ... FFFF
# >0x420	ubequad		>0	\b, seq. 0x%16.16llx
# >>0x428	ubequad		>0	\b%16.16llx
# >>>0x430	ubequad	>0	\b%16.16llx
# >>>>0x438	ubequad	>0	\b%16.16llx
# >>>>>0x440	ubequad	>0	\b%16.16llx
# >>>>>>0x448	ubequad	>0	\b%16.16llx
# >>>>>>>0x450	ubequad	>0	\b%16.16llx
# >>>>>>>>0x458	ubequad	>0	\b%16.16llx
# >>>>>>>>>0x460	ubequad	>0	\b%16.16llx
# >>>>>>>>>>0x468	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>0x470	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>0x478	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>0x480	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>0x488	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>0x490	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>0x498	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>>0x4A0	ubequad	>0	\b%16.16llx
# >>>>>>>>>>>>>>>>>>0x4A8	ubequad	>0	\b%16.16llx
# look for end of FAT
#>>0x420	search/512/s	\xff\xff	FAT END
# Physical block number of FAT header
#>0x40	ubyte		x		\b, FAT at phy. block %u
>0x40	ubyte		x
>>(0x40.b*512)	ubyte	x
# 1st FAT block
>>>&511 	use	garmin-fat
# 2nd FAT block
>>>&1023 	use	garmin-fat
# 3th FAT block
>>>&1535 	use	garmin-fat
# 4th FAT block
>>>&2047 	use	garmin-fat
# ... xth FAT block
#
# 314 zeros but not in vpm and also gmaptz.img
>0x84 	uquad		!0		\b, at 0x84 0x%llx
# display FileAllocationTable block entry in garmin map
0	name				garmin-fat
>0	ubyte		x		\b;
# sub file part; 0x0003 seems to be garbage
>0x10	uleshort	!0		next 0x%4.4x
>0x10	uleshort	=0
# fat flag 0~dummy block 1~true sub file
>>0	ubyte		!1		flag %u 
>>0	ubyte		=1
# sub-file name like MAKEGMAP 12345678
>>>0x1	string		x		%.8s
# sub-file typ like RGN TRE MDR LBL
>>>0x9	string		x		\b.%.3s
# size of sub file
>>>0xC	ulelong		x		\b, %u bytes
# 32-bit block sequence numbers
#>>>0x20	ubequad		x		\b, seq. 0x%16.16llx

#	display date stored inside Garmin maps like yyyy-mm-dd h:mm:ss
0	name				garmin-date
# year like 2018
>0 	uleshort	x 		\b, created %u
# month (0-11)
>2	ubyte		x		\b-%.2u
# day (1-31)
>3	ubyte		x		\b-%.2u
# hour (0-23)
>4	ubyte		x		%u
# minute (0-59)
>5	ubyte		x		\b:%.2u
# second (0-59)
>6	ubyte		x		\b:%.2u

# Summary: Garmin Map subfiles
# From:	Joerg Jenderek
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/IMG_File_Format
# Garmin Common Header
2	string	GARMIN\ 
# skip ASCII text by checking for low header length
>0	uleshort <0x1000	Garmin map,
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/GMP_Subfile_Format
>>9	string	GMP				subtile
!:mime			application/x-garmin-gpm
!:ext			gmp
# copyright message
>>>(0.s)		string		x	%s
>>>0x0E 		use		garmin-date
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/MDR_Subfile_Format
# This contains the searchable address table used for finding routing destinations
>>9	string	MDR				address table
!:mime			application/x-garmin-mdr
!:ext			mdr
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/NOD_Subfile_Format
# http://svn.parabola.me.uk/display/trunk/doc/nod.txt
# This contains the routing information
>>9	string	NOD				routing
!:mime			application/x-garmin-nod
!:ext			nod
>>>0x0E 		use		garmin-date
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes NOD1
#>>>0x25			ulelong		x	\b, at 0x%x
#>>>0x29			ulelong		x	0x%x bytes NOD2
#>>>0x31			ulelong		x	\b, at 0x%x
#>>>0x35			ulelong		x	0x%x bytes NOD3
# URL: http://www.pinns.co.uk/osm/net.html
# routable highways (length, direction, allowed speed,house address information)
>>9	string	NET				highways
!:mime			application/x-garmin-net
!:ext			net
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes NET1
#>>>0x22			ulelong		>0
#>>>>0x1E		ulelong		x	\b, at 0x%x
#>>>>0x22		ulelong		x	0x%x bytes NET2
#>>>0x2B			ulelong		>0
#>>>>0x27		ulelong		x	\b, at 0x%x
#>>>>0x2B		ulelong		x	0x%x bytes NET3
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/LBL_Subfile_Format
>>9	string	LBL				labels
!:mime			application/x-garmin-lbl
!:ext			lbl
>>>(0.s)		string	x	%s
# Label coding type 6h 9h and ah
>>>0x1E			ubyte		x	\b, coding type 0x%x
#>>>0x15			ulelong		x	\b, at 0x%x
#>>>0x19			ulelong		x	0x%x bytes LBL1
#>>>0x1F			ulelong		x	\b, at 0x%x
#>>>0x23			ulelong		x	0x%x bytes LBL2
#>>>0x2D			ulelong		x	\b, at 0x%x
#>>>0x31			ulelong		x	0x%x bytes LBL3
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/SRT_Subfile_Format
# A lookup table of the chars in the map's codepage, and their collating sequence
>>9	string	SRT				sort table
!:mime			application/x-garmin-srt
!:ext			srt
>>>0x0E 		use		garmin-date
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/TRE_Subfile_Format
>>9	string	TRE				tree
!:mime			application/x-garmin-tre
!:ext			tre
# title like City Nav Europe NTU 2019.2 Basemap
# or OSM Street map
>>>(0.s)		string		x	%s
# 2nd title like Copyright 1995-2018 by GARMIN Corporation.
# or http://www.openstreetmap.org/
>>>>&1			string		x	%s
>>>0x0E 		use		garmin-date
#>>>0x21			ulelong		x	\b, at 0x%x
#>>>0x25			ulelong		x	0x%x bytes TRE1
#>>>0x29			ulelong		x	\b, at 0x%x
#>>>0x2D			ulelong		x	0x%x bytes TRE2
#>>>0x31			ulelong		x	\b, at 0x%x
#>>>0x35			ulelong		x	0x%x bytes TRE3
# Copyright record size
#>>>0x39			uleshort	x	\b, copyright record size %u
# Map ID
>>>0x74			ulelong		x	\b, ID 0x%x
# URL: https://www.gpspower.net/garmin-tutorials/353310-basecamp-installing-free-desktop-map.html
# For road traffic information service (RDS/TMS/TMC). Commonly seen in City Navigator maps
>>9	string	TRF				traffic,
!:mime			application/x-garmin-trf
!:ext			trf
# city/region like Preitenegg
>>>(0.s+1) 		string		x	1st %s
# highway part like L606/L148
>>>>&1			string		x	%s
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/Format
# Reference: http://www.pinns.co.uk/osm/typformat.html
# customize the appearance of objects. For GPS and MapSource/Qlandkarte better looking maps
>>9	string	TYP				types
!:mime			application/x-garmin-typ
!:ext			typ
>>>0x0E 		use		garmin-date
# character set 1252 65001~UTF8
>>>0x15			uleshort	x	\b, code page %u
# POIs
#>>>0x17			ulelong		x	\b, at 0x%x
#>>>0x1B			ulelong		x	0x%x bytes TYP1
# extra pois
#>>>0x5B			ulelong		x	\b, at 0x%x
#>>>0x5F			ulelong		x	0x%x bytes TYP8
# URL: https://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/RGN_Subfile_Format
# http://www.pinns.co.uk/osm/RGN.html
# region data used by the Garmin software
>>9	string	RGN				region
!:mime			application/x-garmin-rgn
!:ext			rgn
# POIs,Indexed POIs,Polylines or Polygons or first map level
#>>>0x15			ulelong	       x	\b, at 0x%x
#>>>0x19			ulelong	       x	0x%x bytes RGN1
# polygons with extended types
#>>>0x21			ulelong	       >0
#>>>>0x1D		ulelong	       x	\b, at 0x%x
#>>>>0x21		ulelong	       x	0x%x bytes RGN2
# polylines with extended types
#>>>0x3D			ulelong	       >0
#>>>>0x39		ulelong	       x	\b, at 0x%x
#>>>>0x3D		ulelong	       x	0x%x bytes RGN3
# extended POIs
#>>>0x59			ulelong	       >0
#>>>>0x55		ulelong	       x	\b, at 0x%x
#>>>>0x59		ulelong	       x	0x%x bytes RGN3
#>>9	default		x		unknown map type
# Header length; GMP:31h 35h 3Dh,MDR:11Eh 238h 2C4h 310h,NOD:3Fh 7Fh,NET:64h,
# LBL:2A9h,SRT:1Dh 25h 27h,TRE:CFh 135h,TRF:5Ah,TYP:5Bh 6Eh 7Ch AEh,RGN:7Dh
>>0	uleshort	x		\b, header length 0x%x

d30 1
a30 1
# https://github.com/ryanbinns/ttwatch/tree/master/ttbin
@


1.1.1.4
log
@Import 5.38:
	- Always accept -S (no sandbox) even if we don't support sandboxing
	- More syscalls elided for sandboxiing
	- For ELF dynamic means having an interpreter not just PT_DYNAMIC
	- Check for large ELF session header offset
	- When saving and restoring a locale, keep the locale name in our
	  own storage.
	- Add a flag to disable CSV file detection.
	- Don't pass NULL/0 to memset to appease sanitizers.
	- Avoid spurious prints when looks for extensions or apple strings
	  in fsmagic.
	- Add builtin decompressors for xz and and bzip.
	- Add a limit for the number of CDF elements.
	- More checks for overflow in CDF.
@
text
@d4 1
a4 1
# $File: map,v 1.8 2019/12/01 22:46:23 christos Exp $
a318 77
# URL:		https://www.memotech.franken.de/FileFormats/
# Reference:	https://www.memotech.franken.de/FileFormats/Garmin_RGN_Format.pdf
# From:		Joerg Jenderek
0	string		KpGr		Garmin update
# format version like: 0064h~1.0
>0x4	uleshort	!0x0064
>>4	uleshort/100	x		\b, version %u
>>4	uleshort%100	x		\b.%u
# 1st Garmin entry
>6	use	garmin-entry
# 2nd Garmin entry
>(0x6.l+10)	ubyte		x
>>&0		use		garmin-entry
# 3rd entry
>(0x6.l+10)	ubyte		x
>>&(&0.l+4)	ubyte		x
>>>&0		use		garmin-entry
# look again at version to use default clause
>0x4	uleshort	x
# test for region content by looking for
# Garmin *.srf by ./images with normal builder name "SQA" or longer "hales"
# 1 space after equal sign
>>0x3a	search/5/s	GARMIN\ BITMAP	\b= 
!:mime	image/x-garmin-exe
!:ext	exe
>>>&0	indirect	x
# if not bitmap *.srf then region; 1 space after equal sign
>>0x3a	default		x		\b= 
!:mime	application/x-garmin-rgn
!:ext	rgn
# recursiv embedded
>>>0x3a	search/5/s	KpGrd
>>>>&0	indirect	x
# look for ZIP or JAR archive by ./archive and ./zip
>>>0x3a	search/5/s	PK\003\004
>>>>&0	indirect	x
# TODO: other garmin RGN record content like foo
#>>0x3a	search/5/s	bar		BAR
#		display information of Garmin RGN record
0	name	garmin-entry
# record length: 2 for Data, for Application often 1Bh sometimes 1Dh, "big" for Region
#>0	ulelong		x		\b, length 0x%x
# data record (ID='D') with version content like 0064h~1.0
>4	ubyte		=0x44
>>5	uleshort	!0x0064		\b; Data
>>>5	uleshort/100	x		\b, version %u
>>>5	uleshort%100	x		\b.%u
# Application Record (ID='A')
>4	ubyte		=0x41		\b; App
# version content like 00c8h~2.0
>>5	uleshort	!0x00C8
>>>5	uleshort/100	x		\b, version %u
>>>5	uleshort%100	x		\b.%u
# builder name like: SQA sqa build hales
>>7	string		x		\b, build by %s
# build date like: Oct 25 1999, Oct 1 2008, Feb 23 2009, Dec 15 2009
>>>&1	string		x		%s
# build time like: 11:26:12, 11:45:54, 14:16:13, 18:23:01
>>>>&1	string		x		%s
# region record (ID='R')
>4	ubyte		=0x52		\b; Region
# region ID:14~fw_all.bin: 78~ZIP, RGN or SRF bitmap; 148~ZIP or JAR; 249~display firmware; 251~WiFi or GCD firmware; 255~ZIP
>>5	uleshort	x		ID=%u
# delay in ms: like 0, 500
>>7	ulelong		!0		\b, %u ms
# region size (is record length - 10)
#>>11	ulelong		x		\b, length 0x%x
# region content like:
# "KpGr"~recursiv embedded,"GARMIN BITMAP"~Garmin Bitmap *.srf, "PK"~ZIP archive
#>>15	string		x		\b, content "%s"
>>15	ubequad		x		\b, content 0x%llx...
# This does NOT WORK!
#>>15	indirect	x		\b; contains 
>4	default		x		\b; other
# garmin Record ID Identifies the record content like: D A R
>>4	ubyte		x		ID '%c'

@


1.1.1.5
log
@Import file-5.43+; last was file-5.40

2022-09-20  17:12  Christos Zoulas <christos@@zoulas.com>

	* fixed various clustefuzz issues

2022-09-19  15:54  Christos Zoulas <christos@@zoulas.com>

	* Fix error detection for decompression code (Vincent Mihalkovic)

2022-09-15  13:50  Christos Zoulas <christos@@zoulas.com>

	* Add MAGIC_NO_COMPRESS_FORK and use it to produce a more
	  meaningful error message if we are sandboxing.

2022-09-15  10:45  Christos Zoulas <christos@@zoulas.com>

	* Add built-in lzip decompression support (Michal Gorny)

2022-09-14  10:35  Christos Zoulas <christos@@zoulas.com>

	* Add built-in zstd decompression support (Martin Rodriguez Reboredo)

2022-09-13  14:55  Christos Zoulas <christos@@zoulas.com>

	* release 5.43

2022-09-10   9:17  Christos Zoulas <christos@@zoulas.com>

	* Add octal indirect magic (Michal Gorny)

2022-08-17  11:43  Christos Zoulas <christos@@zoulas.com>

	* PR/374: avoid infinite loop in non-wide code (piru)
	* PR/373: Obey MAGIC_CONTINUE with multiple magic files (vismarli)

2022-07-26  11:10  Christos Zoulas <christos@@zoulas.com>

	* Fix bug with large flist (Florian Weimer)

2022-07-07  13:21  Christos Zoulas <christos@@zoulas.com>

        * PR/364: Detect non-nul-terminated core filenames from QEMU
	  (mam-ableton)

2022-07-04  15:45  Christos Zoulas <christos@@zoulas.com>

	* PR/359: Add support for http://ndjson.org/ (darose)
	* PR/362: Fix wide printing (ro-ee)
	* PR/358: Fix width for -f - (jpalus)
	* PR/356: Fix JSON constant parsing (davewhite)

2022-06-10   9:40  Christos Zoulas <christos@@zoulas.com>

	* release 5.42

2022-05-31  14:50   Christos Zoulas <christos@@zoulas.com>

	* PR/348: add missing cases to prevent file from aborting on
	  random magic files.

2022-05-27  21:05   Christos Zoulas <christos@@zoulas.com>

	* PR/351: octalify filenames when not raw before printing.

2022-04-18  17:51   Christos Zoulas <christos@@zoulas.com>

	* fix regex cacheing bug (Dirk Mueller)
	* merge file_regcomp and file_regerror() to simplify the code
	  and reduce memory requirements for storing regexes (Dirk Mueller)

2022-03-19  12:56   Christos Zoulas <christos@@zoulas.com>

	* cache regex (Dirk Mueller)
	* detect filesystem full by flushing output (Dirk Mueller)

2021-11-19  12:36   Christos Zoulas <christos@@zoulas.com>

	* implement running decompressor programs using
	  posix_spawnp(2) instead of vfork(2)

2021-10-24  11:51   Christos Zoulas <christos@@zoulas.com>

	* Add support for msdos dates and times

2021-10-20   9:55   Christos Zoulas <christos@@zoulas.com>

	* use the system byte swapping functions if available (Werner Fink)

2021-10-18  11:57  Christos Zoulas <christos@@zoulas.com>

	* release 5.41

2021-09-23  03:51  Christos Zoulas <christos@@zoulas.com>

	* Avinash Sonawane: Fix tzname detection

2021-09-03  09:17  Christos Zoulas <christos@@zoulas.com>

	* Fix relationship tests with "search" magic, don't short circuit
	  logic

2021-07-13  01:06  Christos Zoulas <christos@@zoulas.com>

	* Fix memory leak in compile mode

2021-07-01  03:51  Christos Zoulas <christos@@zoulas.com>

	* PR/272: kiefermat: Only set returnval = 1 when we printed something
	  (in all cases print or !print). This simplifies the logic and fixes
	  the issue in the PR with -k and --mime-type there was no continuation
	  printed before the default case.

2021-06-30  13:07  Christos Zoulas <christos@@zoulas.com>

	* PR/270: Don't translate unprintable characters in %s magic formats
	  when -r
	* PR/269: Avoid undefined behavior with clang (adding offset to NULL)

2021-05-09  18:38  Christos Zoulas <christos@@zoulas.com>

	* Add a new flag (f) that requires that the match is a full word,
	   not a partial word match.
	* Add varint types (unused)

2021-04-19  17:17  Christos Zoulas <christos@@zoulas.com>

	* PR/256: mutableVoid: If the file is less than 3 bytes, use the file
	  length to determine type
	* PR/259: aleksandr.v.novichkov: mime printing through indirect magic
	  is not taken into account, use match directly so that it does.

2021-04-04  17:02  Christos Zoulas <christos@@zoulas.com>

	* count the total bytes found not the total byte positions
	  in order to determine encoding (Anatol Belski)
@
text
@d4 1
a4 1
# $File: map,v 1.9 2021/04/26 15:56:00 christos Exp $
d43 1
a43 1
>0	ubyte		!0		\b, %#x XORed
d57 1
a57 1
>1 	ubelong		!0 		\b, zeroes %#x
d75 1
a75 1
>0xc 	uleshort	!0 		\b, zeroes %#x
d77 1
a77 1
#>0xE	ubyte		!0		\b, Mapsource flag %#x
d80 1
a80 1
#>0xF	ubyte		x		\b, Checksum %#x
d102 1
a102 1
>0x200 	uquad		!0		\b, zeroes %#llx
d104 1
a104 1
>0x40C	ulelong		>0		\b, at %#x
d106 1
a106 1
#>>(0x40C.l)	uleshort	x	\b, header len %#x
d113 1
a113 1
>>>>(0x40C.l+13)	ubyte	>0		\b, locked %#x
d115 1
a115 1
# >0x420	ubequad		>0	\b, seq. %#16.16llx
d150 1
a150 1
>0x84 	uquad		!0		\b, at 0x84 %#llx
d155 1
a155 1
>0x10	uleshort	!0		next %#4.4x
d167 1
a167 1
#>>>0x20	ubequad		x		\b, seq. %#16.16llx
d210 6
a215 6
#>>>0x15			ulelong		x	\b, at %#x
#>>>0x19			ulelong		x	%#x bytes NOD1
#>>>0x25			ulelong		x	\b, at %#x
#>>>0x29			ulelong		x	%#x bytes NOD2
#>>>0x31			ulelong		x	\b, at %#x
#>>>0x35			ulelong		x	%#x bytes NOD3
d221 2
a222 2
#>>>0x15			ulelong		x	\b, at %#x
#>>>0x19			ulelong		x	%#x bytes NET1
d224 2
a225 2
#>>>>0x1E		ulelong		x	\b, at %#x
#>>>>0x22		ulelong		x	%#x bytes NET2
d227 2
a228 2
#>>>>0x27		ulelong		x	\b, at %#x
#>>>>0x2B		ulelong		x	%#x bytes NET3
d235 7
a241 7
>>>0x1E			ubyte		x	\b, coding type %#x
#>>>0x15			ulelong		x	\b, at %#x
#>>>0x19			ulelong		x	%#x bytes LBL1
#>>>0x1F			ulelong		x	\b, at %#x
#>>>0x23			ulelong		x	%#x bytes LBL2
#>>>0x2D			ulelong		x	\b, at %#x
#>>>0x31			ulelong		x	%#x bytes LBL3
d259 6
a264 6
#>>>0x21			ulelong		x	\b, at %#x
#>>>0x25			ulelong		x	%#x bytes TRE1
#>>>0x29			ulelong		x	\b, at %#x
#>>>0x2D			ulelong		x	%#x bytes TRE2
#>>>0x31			ulelong		x	\b, at %#x
#>>>0x35			ulelong		x	%#x bytes TRE3
d268 1
a268 1
>>>0x74			ulelong		x	\b, ID %#x
d288 2
a289 2
#>>>0x17			ulelong		x	\b, at %#x
#>>>0x1B			ulelong		x	%#x bytes TYP1
d291 2
a292 2
#>>>0x5B			ulelong		x	\b, at %#x
#>>>0x5F			ulelong		x	%#x bytes TYP8
d300 2
a301 2
#>>>0x15			ulelong	       x	\b, at %#x
#>>>0x19			ulelong	       x	%#x bytes RGN1
d304 2
a305 2
#>>>>0x1D		ulelong	       x	\b, at %#x
#>>>>0x21		ulelong	       x	%#x bytes RGN2
d308 2
a309 2
#>>>>0x39		ulelong	       x	\b, at %#x
#>>>>0x3D		ulelong	       x	%#x bytes RGN3
d312 2
a313 2
#>>>>0x55		ulelong	       x	\b, at %#x
#>>>>0x59		ulelong	       x	%#x bytes RGN3
d317 1
a317 1
>>0	uleshort	x		\b, header length %#x
d360 1
a360 1
#>0	ulelong		x		\b, length %#x
d385 1
a385 1
#>>11	ulelong		x		\b, length %#x
d389 1
a389 1
>>15	ubequad		x		\b, content %#llx...
@


1.1.1.6
log
@Update to file-5.45 (Last was file-5.44)

2023-07-27  15:45  Christos Zoulas <christos@@zoulas.com>

	* release 5.45

2023-07-17  11:53  Christos Zoulas <christos@@zoulas.com>

	* PR/465: psrok1: Avoid muslc asctime_r crash

2023-05-21  13:05  Christos Zoulas <christos@@zoulas.com>

	* add SIMH tape format support

2023-02-09  12:50  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/415: Fix decompression with program returning empty

2022-12-26   1:47  Christos Zoulas <christos@@zoulas.com>

	* PR/408: fix -p with seccomp
	* PR/412: fix MinGW compilation
@
text
@d4 1
a4 1
# $File: map,v 1.10 2023/02/03 20:41:57 christos Exp $
a408 5
# Garmin firmware:
# https://www.memotech.franken.de/FileFormats/Garmin_GCD_Format.pdf
# https://www.gpsrchive.com/GPSMAP/GPSMAP%2066sr/Firmware.html
0	string		GARMIN
>6	uleshort	100	GARMIN firmware (version 1.0)
@


1.1.1.7
log
@Import file-5.48 (previous was file-5.45)

2026-05-07  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.48

2026-05-11  15:55 Christos Zoulas <christos@@zoulas.com>

	* add landlock support (valoq)

2026-04-19  15:55 Christos Zoulas <christos@@zoulas.com>

	* add BE/LE GUID

2026-04-17  11:05 Christos Zoulas <christos@@zoulas.com>

	* multiple fixes to prevent integer overflow in 32 bits (kerwin)

2026-04-15  12:40 Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/728: Anton Monroe: Reinstate regex/c

2026-02-26  11:32  Christos Zoulas <christos@@zoulas.com>

	* release 5.47

2026-02-04  09:54  Christos Zoulas <christos@@zoulas.com>
	* Better multi-compound document identification by following the
	  order of the directories entries. (Thomas Ledoux)

2026-01-19  14:00  Christos Zoulas <christos@@zoulas.com>
	* if stat fails, don't attempt to restore times (Steven Grubb)

2025-05-28  15:20  Christos Zoulas <christos@@zoulas.com>

	* PR/622: Odd_Bloke: Handle negative offsets in file_buffer(),
	  when fd is not available.

2025-05-28  12:50  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* PR/592: allow + in format strings
	* PR/592: signed operations should be done in signed context

2024-12-05  13:50 Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>

	* release 5.46
	* Add OFFPOSITIVE

2024-11-25  13:56  Christos Zoulas <christos@@zoulas.com>

	* avoid leaking symbols in libmagic

2024-11-10  13:56  Christos Zoulas <christos@@zoulas.com>

	* 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 <christos@@zoulas.com>
 	* PR/543: matshch: bump nbuf so we can get the flags into the buffer.


2024-11-02  14:34  Christos Zoulas <christos@@zoulas.com>

 	* Add Android elf notes (enh)

2023-12-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* Add limit for number of magic warnings allowed

2023-07-29  12:55  Christos Zoulas <christos@@zoulas.com>

	* check regex bounds (found by clusterfuzz)
@
text
@d2 1
d4 1
a4 1
# $File: map,v 1.11 2024/06/10 23:09:52 christos Exp $
@


1.1.1.1.6.1
log
@file map was added on branch tls-maxphys on 2014-08-19 23:46:47 +0000
@
text
@d1 25
@


1.1.1.1.6.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a0 25


#------------------------------------------------------------------------------
# $File: map,v 1.1 2014/06/03 18:22:25 christos Exp $
# map:  file(1) magic for Map data
#

# Garmin .FIT files http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
8	string	.FIT		FIT Map data
>15	byte	0
>>35	belong	x		\b, unit id %d
# 20 years after unix epoch
>>39	lelong	x		\b, serial %u
>>43	ledate/631152000 x	\b, %s

>>47	leshort x		\b, manufacturer %d
>>47	leshort	1		\b (garmin)
>>49	leshort x		\b, product %d
>>53	byte	x		\b, type %d
>>53	byte	1		\b (Device)
>>53	byte	2		\b (Settings)
>>53	byte	3		\b (Sports/Cycling)
>>53	byte	4		\b (Activity)
>>53	byte	8		\b (Elevations)
>>53	byte	10		\b (Totals)
@


1.1.1.1.2.1
log
@file map was added on branch tls-earlyentropy on 2014-08-10 07:07:10 +0000
@
text
@d1 25
@


1.1.1.1.2.2
log
@Rebase.
@
text
@a0 25


#------------------------------------------------------------------------------
# $File: map,v 1.1 2014/06/03 18:22:25 christos Exp $
# map:  file(1) magic for Map data
#

# Garmin .FIT files http://pub.ks-and-ks.ne.jp/cycling/edge500_fit.shtml
8	string	.FIT		FIT Map data
>15	byte	0
>>35	belong	x		\b, unit id %d
# 20 years after unix epoch
>>39	lelong	x		\b, serial %u
>>43	ledate/631152000 x	\b, %s

>>47	leshort x		\b, manufacturer %d
>>47	leshort	1		\b (garmin)
>>49	leshort x		\b, product %d
>>53	byte	x		\b, type %d
>>53	byte	1		\b (Device)
>>53	byte	2		\b (Settings)
>>53	byte	3		\b (Sports/Cycling)
>>53	byte	4		\b (Activity)
>>53	byte	8		\b (Elevations)
>>53	byte	10		\b (Totals)
@


