From: Christos Zoulas Date: Thu, 10 Feb 2011 02:22:58 +0000 (+0000) Subject: handle "text executable" too. X-Git-Tag: FILE5_06~30 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88207acb482a1768aae0e8f9312d534174fb3597;p=file handle "text executable" too. --- diff --git a/src/ascmagic.c b/src/ascmagic.c index 0bc4bc2c..86b9fecf 100644 --- a/src/ascmagic.c +++ b/src/ascmagic.c @@ -36,7 +36,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: ascmagic.c,v 1.78 2011/02/03 01:43:33 christos Exp $") +FILE_RCSID("@(#)$File: ascmagic.c,v 1.79 2011/02/10 02:22:58 christos Exp $") #endif /* lint */ #include "magic.h" @@ -125,7 +125,7 @@ file_ascmagic_with_encoding(struct magic_set *ms, const unsigned char *buf, int n_lf = 0; int n_cr = 0; int n_nel = 0; - int score, curtype; + int score, curtype, executable = 0; size_t last_line_end = (size_t)-1; int has_long_lines = 0; @@ -259,8 +259,17 @@ subtype_identified: if (file_printedlen(ms)) { switch (file_replace(ms, " text$", ", ")) { case 0: - if (file_printf(ms, ", ") == -1) + switch (file_replace(ms, " text executable$", + ", ")) { + case 0: + if (file_printf(ms, ", ") == -1) + goto done; + case -1: goto done; + default: + executable = 1; + break; + } break; case -1: goto done; @@ -280,6 +289,10 @@ subtype_identified: if (file_printf(ms, " %s", type) == -1) goto done; + if (executable) + if (file_printf(ms, " executable") == -1) + goto done; + if (has_long_lines) if (file_printf(ms, ", with very long lines") == -1) goto done;