Article View: comp.bugs.misc
Article #52file(1) does not recognize C code
From: Matt Costello
Date: Sat, 06 Dec 1986 06:40
Date: Sat, 06 Dec 1986 06:40
30 lines
1521 bytes
1521 bytes
The file program does not recognize most C programs as being
C, and instead calls them some sort of text file. Part of
the problem is that file only looks at the first 512 bytes of
the input and since it skips comments and preprocessor lines
this conspires to prevent it from reaching actual C code.
Compounding this problem is that its table of valid C keywords
is missing "static", so the standard line
static char SCCSid[] = "identifier string";
as the first C code at the top of a program will cause file(1)
to assume it is NOT C code.
SYSTEMS:
BSD4.2
SYSV.2
(probably all)
REPEAT-BY:
echo "static int a;" > /tmp/x.j
file /tmp/x.j
FIX:
Add the keyword "static" to the "c[]" table.
----
Matt Costello, matt@ncr-sd.SanDiego.NCR.COM (not registered yet)
{sdcsvax,cbatt,dcdwest,nosc.ARPA,ihnp4}!ncr-sd!matt
--
Matt Costello, matt@ncr-sd.SanDiego.NCR.COM (not registered yet)
{sdcsvax,cbatt,dcdwest,nosc.ARPA,ihnp4}!ncr-sd!matt
Technical Details
Message-ID:
<1261@ncr-sd.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!cmcl2!yale!husc6!panda!genrad!decvax!decwrl!pyramid!ncr-sd!mattShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!cmcl2!yale!husc6!panda!genrad!decvax!decwrl!pyramid!ncr-sd!matt From: matt@ncr-sd.UUCP (Matt Costello) Newsgroups: comp.bugs.misc Subject: file(1) does not recognize C code Message-ID: <1261@ncr-sd.UUCP> Date: Sat, 6-Dec-86 01:40:59 EST Article-I.D.: ncr-sd.1261 Posted: Sat Dec 6 01:40:59 1986 Date-Received: Sat, 6-Dec-86 21:41:35 EST Reply-To: matt@ncr-sd.UUCP (Matt Costello) Distribution: world Organization: NCR Corporation, San Diego Lines: 30