You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

diff --git a/magic/Magdir/c-lang b/magic/Magdir/c-lang
index 0665627..fdefa8c 100644
--- a/magic/Magdir/c-lang
+++ b/magic/Magdir/c-lang
@@ -6,26 +6,36 @@
# BCPL
0 search/8192 "libhdr" BCPL source text
!:mime text/x-bcpl
+!:strength / 2
0 search/8192 "LIBHDR" BCPL source text
!:mime text/x-bcpl
+!:strength / 2
# C
0 regex \^#include C source text
!:mime text/x-c
+!:strength / 2
0 regex \^char C source text
!:mime text/x-c
+!:strength / 2
0 regex \^double C source text
!:mime text/x-c
+!:strength / 2
0 regex \^extern C source text
!:mime text/x-c
+!:strength / 2
0 regex \^float C source text
!:mime text/x-c
+!:strength / 2
0 regex \^struct C source text
!:mime text/x-c
+!:strength / 2
0 regex \^union C source text
!:mime text/x-c
+!:strength / 2
0 search/8192 main( C source text
!:mime text/x-c
+!:strength / 2
# C++
# The strength of these rules is increased so they beat the C rules above
diff --git a/magic/Magdir/perl b/magic/Magdir/perl
index e11f2ab..b02b2c2 100644
--- a/magic/Magdir/perl
+++ b/magic/Magdir/perl
@@ -28,10 +28,14 @@
# check the first line
0 search/1 package
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *; Perl5 module source text
+# to be tried before C source
+!:strength + 5
# not 'p', check other lines
0 search/1 !p
>0 regex \^package[\ \t]+[0-9A-Za-z_:]+\ *;
>>0 regex \^1\ *;|\^(use|sub|my)\ .*[(;{=] Perl5 module source text
+# to be tried before C source
+!:strength + 40