c-lang 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #------------------------------------------------------------------------------
  2. # $File: c-lang,v 1.20 2015/07/27 14:33:10 christos Exp $
  3. # c-lang: file(1) magic for C and related languages programs
  4. #
  5. # BCPL
  6. 0 search/8192 "libhdr" BCPL source text
  7. !:mime text/x-bcpl
  8. 0 search/8192 "LIBHDR" BCPL source text
  9. !:mime text/x-bcpl
  10. # C
  11. 0 regex \^#include C source text
  12. !:mime text/x-c
  13. 0 regex \^char[\ \t\n]+ C source text
  14. !:mime text/x-c
  15. 0 regex \^double[\ \t\n]+ C source text
  16. !:mime text/x-c
  17. 0 regex \^extern[\ \t\n]+ C source text
  18. !:mime text/x-c
  19. 0 regex \^float[\ \t\n]+ C source text
  20. !:mime text/x-c
  21. 0 regex \^struct[\ \t\n]+ C source text
  22. !:mime text/x-c
  23. 0 regex \^union[\ \t\n]+ C source text
  24. !:mime text/x-c
  25. 0 search/8192 main( C source text
  26. !:mime text/x-c
  27. # C++
  28. # The strength of these rules is increased so they beat the C rules above
  29. 0 regex \^template[\ \t]+<.*>[\ \t\n]+ C++ source text
  30. !:strength + 5
  31. !:mime text/x-c++
  32. 0 regex \^virtual[\ \t\n]+ C++ source text
  33. !:strength + 5
  34. !:mime text/x-c++
  35. 0 regex \^class[\ \t\n]+ C++ source text
  36. !:strength + 5
  37. !:mime text/x-c++
  38. 0 regex \^public: C++ source text
  39. !:strength + 5
  40. !:mime text/x-c++
  41. 0 regex \^private: C++ source text
  42. !:strength + 5
  43. !:mime text/x-c++
  44. # From: Mikhail Teterin <mi@aldan.algebra.com>
  45. 0 string cscope cscope reference data
  46. >7 string x version %.2s
  47. # We skip the path here, because it is often long (so file will
  48. # truncate it) and mostly redundant.
  49. # The inverted index functionality was added some time between
  50. # versions 11 and 15, so look for -q if version is above 14:
  51. >7 string >14
  52. >>10 search/100 \ -q\ with inverted index
  53. >10 search/100 \ -c\ text (non-compressed)