The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 08:39 AM
How to identify which device from ssd29? KhawHL SUN Solaris 10 05-13-2008 09:16 PM
identify this mobo blowFish@ubuntu What's on Your Mind? 0 07-17-2007 10:06 PM
how to identify files I cannot access wvdeijk UNIX for Dummies Questions & Answers 4 08-04-2006 02:18 AM
identify hardware patrickb Filesystems, Disks and Memory 0 02-21-2006 07:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 04-04-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
identify function

Does anyone know a shell command that identifies the functions from a C file? Thank you
Reply With Quote
Forum Sponsor
  #2  
Old 04-04-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
What are you trying to do - list functions in C source? Or in compiled binaries?
Reply With Quote
  #3  
Old 04-04-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
source

Quote:
Originally Posted by jim mcnamara
What are you trying to do - list functions in C source? Or in compiled binaries?
I want to get all the names of the functions from a C source file, by using a shell command.
Reply With Quote
  #4  
Old 04-04-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
There isn't a shell command that does that.

You need special software to parse the code. You can use splint to get information like that. Download it here:

http://www.splint.org/download.html
Reply With Quote
  #5  
Old 04-04-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
ok, thank you, I was told that there is such a command... my mistake. And thanks again for the link.
Reply With Quote
  #6  
Old 04-04-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,297
You could write a very complex shell script to find all occurrences of2words that come just before an open parenthesis, then do a unique sort on those words. Then you have to find a way to remove all of the external functions.

However, coders do funny things with declarations that really confuse a script. Generally, you need to write a lexer (lex & yacc) to parse source code correctly.
Reply With Quote
  #7  
Old 04-04-2006
Registered User
 

Join Date: Apr 2006
Posts: 5
That's exactly the kind of script I was trying to avoid. Hopefully, I'll find another way to do this. I encountered problems when differentiating between a declaration, a definition and a call of a function, as the regular expressions became very complex. That's when I was told that there already exists a command that does this (identifies each function)... just that I can't find it.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux, regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0