Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Mar 2003 15:23:19 -0500 (EST)
From:      Mikhail Teterin <mi@aldan.algebra.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        petef@FreeBSD.org
Subject:   bin/48983: make file(1)/magic(5) recognize cscope referenece files
Message-ID:  <200303062023.h26KNJIu047162@corbulon.video-collage.com>

next in thread | raw e-mail | index | archive | help

>Number:         48983
>Category:       bin
>Synopsis:       make file(1)/magic(5) recognize cscope referenece files
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 06 12:30:13 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Mikhail Teterin
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Virtual Estates, Inc.
>Environment:
System: FreeBSD mi.us.murex.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Fri Feb 28 13:11:26 EST 2003 mteterin@mi.us.murex.com:/misha/obj/misha/src/sys/Misha-g i386

>Description:
	The cscope's reference files (usually named "cscope.out") are not
	recognized as anything but "data".

>How-To-Repeat:

>Fix:

The file begins with
	"cscope <version> <directory>[ -c][ -q]

The <version> is -- so far -- a two-digit number, but <directory> is of
arbitrary length and file(1) truncates strings to 32 characters anyway.
So we skip it.

`` -c'' means the file is non-compressed (non-binary) and is human
readable.

The following can be added to whatever place appropriate among the
magic(5)'s components:

	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 betwen
	# versions 11 and 15, so look for -q if version is above 14:
	>7	string	>14
	>>10	regex	.+\ -q\	with inverted index
	>10	regex	.+\ -c\	text (non-compressed)

It has the following drawbacks however:

	1) relies on the undocumented "regex" type -- more of a problem with magic's
	   man page, perhaps;
	2) deems such files as "data", even if they are marked with ``-c'', which
	   makes them textual.

The first can be addressed (if needed) by simply leaving only the first
two lines (forget the -q and -c). The second needs someone better
skilled with regular expressions -- if -c is not found say: "data", if
it is present -- say: "text", but never both.
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303062023.h26KNJIu047162>