1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#------------------------------------------------------------------------------
# $File: c-lang,v 1.24 2016/07/01 23:31:13 christos Exp $
# c-lang: file(1) magic for C and related languages programs
#
# The strength is to beat standard HTML
# BCPL
0 search/8192 "libhdr" BCPL source text
!:mime text/x-bcpl
0 search/8192 "LIBHDR" BCPL source text
!:mime text/x-bcpl
# C
0 regex \^#include C source text
!:strength +25
!:mime text/x-c
0 regex \^char[\ \t\n]+ C source text
!:mime text/x-c
0 regex \^double[\ \t\n]+ C source text
!:mime text/x-c
0 regex \^extern[\ \t\n]+ C source text
!:mime text/x-c
0 regex \^float[\ \t\n]+ C source text
!:mime text/x-c
0 regex \^struct[\ \t\n]+ C source text
!:mime text/x-c
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[\ \t]+<.*>[\ \t\n]+ C++ source text
!:strength + 30
!:mime text/x-c++
0 regex \^virtual[\ \t\n]+ C++ source text
!:strength + 30
!:mime text/x-c++
0 regex \^class[\ \t\n]+ C++ source text
# But class is reduced to avoid beating php (Jens Schleusener)
!:strength + 13
!:mime text/x-c++
0 regex \^public: C++ source text
!:strength + 30
!:mime text/x-c++
0 regex \^private: C++ source text
!:strength + 30
!:mime text/x-c++
# Objective-C
0 regex \^#import Objective-C source text
!:strength +25
!:mime text/x-objective-c
# From: Mikhail Teterin <mi@aldan.algebra.com>
0 string cscope cscope reference data
>7 string x version %.2s
# We skip the path here, because it is often long (so file will
# truncate it) and mostly redundant.
# The inverted index functionality was added some time between
# versions 11 and 15, so look for -q if version is above 14:
>7 string >14
>>10 search/100 \ -q\ with inverted index
>10 search/100 \ -c\ text (non-compressed)
|