From 717f990ec4f3e639aab44f7091d7cd6db0e6c005 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Wed, 14 Aug 2013 13:06:43 +0000 Subject: [PATCH] Require that the keywords have whitespace. Prevents ^char matching "charges" Too bad we cannot use word separator regex portably. --- magic/Magdir/c-lang | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/magic/Magdir/c-lang b/magic/Magdir/c-lang index 41dfb628..cd17648a 100644 --- a/magic/Magdir/c-lang +++ b/magic/Magdir/c-lang @@ -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 # @@ -12,30 +12,30 @@ # 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 -- 2.49.0