]> granicus.if.org Git - file/commitdiff
Require that the keywords have whitespace. Prevents ^char matching "charges"
authorChristos Zoulas <christos@zoulas.com>
Wed, 14 Aug 2013 13:06:43 +0000 (13:06 +0000)
committerChristos Zoulas <christos@zoulas.com>
Wed, 14 Aug 2013 13:06:43 +0000 (13:06 +0000)
Too bad we cannot use word separator regex portably.

magic/Magdir/c-lang

index 41dfb628f919ab8092701e407b7bf01511fc74cc..cd17648a0e6cffa49269e4ec3558df68928697ee 100644 (file)
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: c-lang,v 1.17 2012/04/28 21:20:26 christos Exp $
+# $File: c-lang,v 1.18 2013/08/14 13:06:43 christos Exp $
 # c-lang:  file(1) magic for C and related languages programs
 #
 
 # C
 0      regex   \^#include      C source text
 !:mime text/x-c
-0      regex   \^char          C source text
+0      regex   \^char[\ \t\n]+ C source text
 !:mime text/x-c
-0      regex   \^double                C source text
+0      regex   \^double[\ \t\n]+               C source text
 !:mime text/x-c
-0      regex   \^extern                C source text
+0      regex   \^extern[\ \t\n]+               C source text
 !:mime text/x-c
-0      regex   \^float         C source text
+0      regex   \^float[\ \t\n]+                C source text
 !:mime text/x-c
-0      regex   \^struct                C source text
+0      regex   \^struct[\ \t\n]+               C source text
 !:mime text/x-c
-0      regex   \^union         C source text
+0      regex   \^union[\ \t\n]+                C source text
 !:mime text/x-c
 0      search/8192     main(           C source text
 !:mime text/x-c
 
 # C++
 # The strength of these rules is increased so they beat the C rules above
-0      regex   \^template      C++ source text
+0      regex   \^template[\ \t\n]+     C++ source text
 !:strength + 5
 !:mime text/x-c++
-0      regex   \^virtual               C++ source text
+0      regex   \^virtual[\ \t\n]+              C++ source text
 !:strength + 5
 !:mime text/x-c++
-0      regex   \^class         C++ source text
+0      regex   \^class[\ \t\n]+                C++ source text
 !:strength + 5
 !:mime text/x-c++
 0      regex   \^public:               C++ source text