Find C function definition in from Shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find C function definition in from Shell script
# 1  
Old 12-15-2010
Find C function definition in from Shell script

Hi,

I am having list of C function names say
function1
function2
function3
and i am having many source files under my current directory.
Now i would like to find the file names which contains the function definition from my list.

It would be appreciable if you help on this.
Thanks in advance

~Saravana
# 2  
Old 12-15-2010
CScope is a free tool that allows you to find this, and more:
Code:
cscope $( find * -type f -name '*.[ch]*' -follow )
 
C symbol: sprintf
  File                      Function                 Line
0 stdio.h                   <global>                 190 extern int sprintf(char
                                                         *, const char *,...);
1 stdio.h                   <global>                 254 extern int sprintf();
2 OfferUtility.cpp          convertDB2Date           170 sprintf( year, "%4.4s",
                                                         db2DateStringCopy.data(
                                                         ) );
3 OfferUtility.cpp          convertDB2Date           171 sprintf( month,
                                                         "%2.2s",
                                                         db2DateStringCopy.data(
                                                         )+5 );
* 10 more lines - press the space bar to display more *
Find this C symbol:
Find this global definition:
Find functions called by this function:
Find functions calling this function:
Find this text string:
Change this text string:
Find this egrep pattern:
Find this file:
Find files #including this file:

It has a line oriented mode that I turned into a web service in a shell script!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Using grep to find C programming definition

Let's say I have a file written in C programming ... int function A (Param1, Param2) { .... } How to grep this function? I tried grep -ER '^functionA(.*)/n{' filename > result.txt Not work :mad: Please use CODE tags on all sample input, output, and code segments; not just on shell... (4 Replies)
Discussion started by: cmdcmd
4 Replies

2. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

3. Shell Programming and Scripting

What is the function of the following lines at the top of a shell script file: Directory and Script?

The file starts like this: Directory: <path to the script> Script: <script fife name> #!bin/ksh ##Comments <actual script> What is the use of the first two lines in the script? What if I save the file without them? What will be the effect? They are not comments. Im very new to this,... (4 Replies)
Discussion started by: remytom
4 Replies

4. Shell Programming and Scripting

Find function script

Hi everybody, I want your help on what, I suppose, might seem a simple task to many of you. the deal is to write a script that will look in a specific folder to see if there is any file whose size is bigger than say 1M and if so to execute a command. like if then log_rotate fi ... (3 Replies)
Discussion started by: lenci_xc
3 Replies

5. UNIX for Advanced & Expert Users

error:- sh: error importing function definition for `module

Hi, We have installed linux6(RHEL) OS and installed datastage application on that. First time installation worked fine and our all services related to datastage was up and running. When we stopped the datastage and restarted its giving below error while restart:- ./uv -admin -start ... (0 Replies)
Discussion started by: prasson_ibm
0 Replies

6. Fedora

Shell parameter definition

Hi Folks, I have a script called program.sh which was written by someone. I am supposed to edit it for my necessities. There is a line in the script that is as follows if ]; then echo -e "Option limit should be positive number and less than 1. Program aborts!" exit 1 ... (27 Replies)
Discussion started by: jacobs.smith
27 Replies

7. Homework & Coursework Questions

Shell script calling Perl function, sort and find data, write to new files

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I must write a shell script that calls two external Perl functions--one of which sorts the data in a file, and... (6 Replies)
Discussion started by: kowit010
6 Replies

8. Red Hat

how to call a particular function from one shell another shell script

please help me in this script shell script :1 *********** >cat file1.sh #!/bin/bash echo "this is first file" function var() { a=10 b=11 } function var_1() { c=12 d=13 (2 Replies)
Discussion started by: ponmuthu
2 Replies

9. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

10. Shell Programming and Scripting

script to find function names

hi, i am a newbie and have to write a rather complicated script. Assume that i have a variable called x and a C source code file say file1.c (these are the inputs of the script) and i need to find the names of all the functions in the C file containing x.Take the following code as an example: ... (2 Replies)
Discussion started by: samantha grace
2 Replies
Login or Register to Ask a Question