1#------------------------------------------------------------------------------ 2# $File: c-lang,v 1.22 2015/10/29 18:49:11 christos Exp $ 3# c-lang: file(1) magic for C and related languages programs 4# 5# The strength is to beat standard HTML 6 7# BCPL 80 search/8192 "libhdr" BCPL source text 9!:mime text/x-bcpl 100 search/8192 "LIBHDR" BCPL source text 11!:mime text/x-bcpl 12 13# C 140 regex \^#include C source text 15!:strength +25 16!:mime text/x-c 170 regex \^char[\ \t\n]+ C source text 18!:mime text/x-c 190 regex \^double[\ \t\n]+ C source text 20!:mime text/x-c 210 regex \^extern[\ \t\n]+ C source text 22!:mime text/x-c 230 regex \^float[\ \t\n]+ C source text 24!:mime text/x-c 250 regex \^struct[\ \t\n]+ C source text 26!:mime text/x-c 270 regex \^union[\ \t\n]+ C source text 28!:mime text/x-c 290 search/8192 main( C source text 30!:mime text/x-c 31 32# C++ 33# The strength of these rules is increased so they beat the C rules above 340 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text 35!:strength + 30 36!:mime text/x-c++ 370 regex \^virtual[\ \t\n]+ C++ source text 38!:strength + 30 39!:mime text/x-c++ 400 regex \^class[\ \t\n]+ C++ source text 41!:strength + 30 42!:mime text/x-c++ 430 regex \^public: C++ source text 44!:strength + 30 45!:mime text/x-c++ 460 regex \^private: C++ source text 47!:strength + 30 48!:mime text/x-c++ 49 50# From: Mikhail Teterin <mi@aldan.algebra.com> 510 string cscope cscope reference data 52>7 string x version %.2s 53# We skip the path here, because it is often long (so file will 54# truncate it) and mostly redundant. 55# The inverted index functionality was added some time between 56# versions 11 and 15, so look for -q if version is above 14: 57>7 string >14 58>>10 search/100 \ -q\ with inverted index 59>10 search/100 \ -c\ text (non-compressed) 60