]> granicus.if.org Git - file/commitdiff
use explicit character cleasses instead of the shorthand \s \w which is
authorChristos Zoulas <christos@zoulas.com>
Tue, 4 Apr 2017 20:34:24 +0000 (20:34 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 4 Apr 2017 20:34:24 +0000 (20:34 +0000)
not supported by the BSD regex code.

magic/Magdir/commands
magic/Magdir/images
magic/Magdir/python

index b5daeea52d37cc3c3de6fd6f7b2698d69ea79f3c..1a46efd8f307373eb1118e1ef978e5d1893a1621 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: commands,v 1.55 2016/07/10 12:44:24 christos Exp $
+# $File: commands,v 1.57 2017/04/04 20:34:24 christos Exp $
 # commands:  file(1) magic for various shells and interpreters
 #
 #0     string/w        :                       shell archive or script for antique kernel text
@@ -56,7 +56,7 @@
 !:mime text/x-awk
 0      string/wt       #!\ /usr/bin/awk        awk script text executable
 !:mime text/x-awk
-0      regex/4096      =^\\s{0,100}BEGIN\\s{0,100}[{]  awk or perl script text
+0      regex/4096      =^[A-Za-z0-9_]{0,100}BEGIN[A-Za-z0-9_]{0,100}[{]        awk or perl script text
 
 # AT&T Bell Labs' Plan 9 shell
 0      string/wt       #!\ /bin/rc     Plan 9 rc shell script text executable
index f739e63375562e7f37036c4f67f23e104e3b85a9..ce68e00d628af529e5d20e6e71a778f360af0ce0 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: images,v 1.122 2017/03/17 21:35:28 christos Exp $
+# $File: images,v 1.123 2017/04/04 20:34:24 christos Exp $
 # images:  file(1) magic for image formats (see also "iff", and "c-lang" for
 # XPM bitmaps)
 #
 >>>&0  regex           =[0-9]{1,50}                    \b %s
 
 0      search/1        P1
->0     regex/4         P1\\s
+>0     regex/4         P1[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, bitmap
 !:strength + 45
 !:mime image/x-portable-bitmap
 
 0      search/1        P2
->0     regex/4         P2\\s
+>0     regex/4         P2[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, greymap
 !:strength + 45
 !:mime image/x-portable-greymap
 
 0      search/1        P3
->0     regex/4         P3\\s
+>0     regex/4         P3[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, pixmap
 !:strength + 45
 !:mime image/x-portable-pixmap
 
 0      string          P4
->0     regex/4         P4\\s
+>0     regex/4         P4[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, rawbits, bitmap
 !:strength + 45
 !:mime image/x-portable-bitmap
 
 0      string          P5
->0     regex/4         P5\\s
+>0     regex/4         P5[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, rawbits, greymap
 !:strength + 45
 !:mime image/x-portable-greymap
 
 0      string          P6
->0     regex/4         P6\\s
+>0     regex/4         P6[A-Za-z0-9_]
 >>0    use             netpbm
 >>>0   string          x       \b, rawbits, pixmap
 !:strength + 45
index 1374947a3df03867d1b8c31450bcc6ed0f1296f9..1f481e399d219bfcbd11aaf587d602b950c01f2b 100644 (file)
@@ -1,6 +1,6 @@
 
 #------------------------------------------------------------------------------
-# $File: python,v 1.28 2015/09/16 22:19:54 christos Exp $
+# $File: python,v 1.30 2017/04/04 20:34:24 christos Exp $
 # python:  file(1) magic for python
 #
 # Outlook puts """ too for urgent messages
@@ -41,7 +41,7 @@
 
 
 # from module.submodule import func1, func2
-0      regex   \^from\\s+(\\w|\\.)+\\s+import.*$       Python script text executable
+0      regex           \^from[\040\t\f\r\n]+([A-Za-z0-9_]|\\.)+[\040\t\f\r\n]+import.*$        Python script text executable
 !:mime text/x-python
 
 # def __init__ (self, ...):
@@ -62,7 +62,7 @@
 # except: or finally:
 # block
 0      search/4096     try:
->&0    regex   \^\\s*except.*: Python script text executable
+>&0    regex   \^[A-Za-z0-9_]*except.*:        Python script text executable
 !:mime text/x-python
 >&0    search/4096     finally:        Python script text executable
 !:mime text/x-python