Solved

File Command  Source Code

Posted on 2004-07-29
11
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

729 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