Solved

File Command  Source Code

Posted on 2004-07-29
11
254 Views
Last Modified: 2006-11-17
Hi All,

Can any body give me the link to the Linux File Command  Source code??

This is urgent

Thanks
Sudhakar
0
Comment
Question by:sudhakar_koundinya
11 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 100 total points
ID: 11674201
Hi Dick_A_Barrett,

http://rpmfind.net/linux/rpm2html/search.php?query=file

download a .src rpm for your distro from the above link

Sunnycoder
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11674205
sudhakar_koundinya,

Sorry, I got the name wrong ... QP messed up

Sunnycoder
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 11674208
>> Hi Dick_A_Barrett??
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 11674212
ok
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11674216
Got the name from another question asker... The link is still valid :o) ... you should be able to get source code from the link
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 11674219
I understand that ;-)
0
 
LVL 14

Author Comment

by:sudhakar_koundinya
ID: 11674271
So whick regular expession do it use to identify text based douments???
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11674490
I believe it gets the information from the file headers and not regular expressions
0
 
LVL 8

Assisted Solution

by:ssnkumar
ssnkumar earned 30 total points
ID: 11675114
If you have a linux box, then the source code will be bundled in the same!
The path will be: /usr/src/linux/

-ssnkumar
0
 
LVL 22

Assisted Solution

by:grg99
grg99 earned 20 total points
ID: 11675788
Oh, sigh, the "file" command .....

Unix doesnt have any file signatures, so the dang foolish "file" command has to poke thru the file and make an estimated wildass guess.

For plain ASCII text files, not Unicode, a good guess would be:  It's a text file if 9X% of the characters are in the range 32..127, plus CR, LF, TAB.  That allows for the occasional Norwegian umlaut and such.  Might also check to see if lines are reasonable lengths, i.e. there's a CR-LF (for DOS) or just LF every 1 to 140 bytes or so.  You could also see if words are a reasonable length, i.e. average run between whitespace is between 4 and 15 or so.


If you want to guess the programming language, it gets a lot harder, as C, C++, csh, and Perl don't look all that different, except to a pretty good parser.  You could do some dumb heuristics, like if there's a few #include's, it's probably C or C++, if there's any "class", most likely C++, if there's lots of dollar-signs, maybe Perl.




0
 
LVL 23

Assisted Solution

by:Mysidia
Mysidia earned 100 total points
ID: 11677786
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now