cscalls toolman page
NAME
cscalls -- cscope version of ccalls(1)
SYNOPSIS
cscalls [-d|f|g|I|l|p|P|S|t] [-s] [-F char]
[cscope.out_file]
DESCRIPTION
cscalls extracts function call, parameter, #include and
other information from the file produced when the tool
cscope was executed.
cscalls is useful for formatting function call and parame-
ter data for use by the tree drawing program dt.
If no file is specified on the command line, cscalls
defaults to using the file cscope.out in the current
directory.
-d Write to standard output the name of each file
and the #defines it contains, e.g.:
init.c MAXLEN init.c NULL wrap.c BUFSIZE
-f Write to standard output the source file name,
function name, and starting and ending line num-
bers for each function.
-Fchar Use char as output field separator character.
If -F is not specified, a space is used as the
default.
-g Write to standard output the name of each file
and global variable defined in that file. The
format of each line will be:
filename.c variable
-I Output source file names and the source files
they #include. cscalls writes this information
to standard output, one set per line, in the
form:
file.c file.h
meaning that source file file.c contains the C
preprocessor #include directive to include file
file.h. cscalls does not recognize the differ-
ence between these two statements:
#include "file.h"
and
#include <file.h>
-l Write to standard output the name of each func-
tions and local variable defined in that func-
tion. The format of each line will be:
functionname variable
-P Write to standard output pairs of function names
and calling parameters.
-p Output function names and parameters. cscalls
writes function names and parameters to standard
output, one set per line, in the form:
fcn fcn(arg1,arg2,arg3)
meaning that function fcn accepts the arguments
arg1, arg2, and arg3.
To avoid possible conflict with the field sepa-
rator character, no spaces will be printed
between the comma separated arguments.
Without the -p argument, cscalls writes function
pairs to standard output, one pair per line, in
the form:
f1 f2
meaning that function f1 calls function f2.
Regardless of whether or not -p is specified,
each field is separated by field separator char-
acter (see -F option).
-S Write to standard output structure names and
elements.
-s Skip calls to these UNIX system calls and sub-
routines:
_exit, _tolower, _toupper, a64l, abort, abs,
access, acct, acos, advfs, alarm, asctime, asin,
assert, atan, atan2, atof, atoi, atol, brk,
bsearch, calloc, ceil, chdir, chmod, chown,
chroot, clearerr, clock, close, cos, cosh,
creat, crypt, ctermid, ctime, curses, cuserid,
ddim, dial, dim, dkbreak, dkdial, dkenviron,
dkeof, dkerr, dkmgr, dkminor, dknamer, dksplice,
dkxstdio, dprod, drand48, dup, ecvt, edata,
encrypt, end, endgrent, endpwent, endutent,
erand48, erf, erfc, errno, etext, execl, execle,
execlp, execv, execve, execvp, exit, exp, fabs,
fclose, fcntl, fcvt, fdopen, feof, ferror,
fflush, fgetc, fgetgrent, fgetpwent, fgets,
fileno, floor, fmod, fopen, fork, fprintf,
fputc, fputs, fread, free, freopen, frexp,
fscanf, fseek, fstat, fstatfs, ftell, ftok, ftw,
fwrite, gamma, gcvt, getc, getchar, getcwd, get-
dents, getegid, getenv, geteuid, getgid, get-
grent, getgrgid, getgrnam, getlogin, getmsg,
getopt, getpass, getpgrp, getpid, getppid,
getpw, getpwent, getpwnam, getpwuid, gets,
getuid, getutent, getutid, getutline, getw,
gmtime, gsignal, hcreate, hdestroy, hsearch,
hypot, iargc, idim, ioctl, irand, isalnum, isal-
pha, isascii, isatty, iscntrl, isdigit, isgraph,
islower, isprint, ispunct, isspace, isupper,
isxdigit, j0, j1, jn, jrand48, kill, l3tol,
l64a, lcong48, ldaclose, ldahread, ldaopen,
ldclose, ldexp, ldfhread, ldgetname, ldlinit,
ldlitem, ldlread, ldlseek, ldnlseek, ldnrseek,
ldnshread, ldnsseek, ldohseek, ldopen, ldrseek,
ldshread, ldsseek, ldtbindex, ldtbread, ldtb-
seek, lfind, lge, lgt, link, lle, llt, local-
time, lockf, log, log10, logname, longjmp,
lrand48, lsearch, lseek, ltol3, mallinfo, mal-
loc, mallopt, maphost, matherr, memccpy, memchr,
memcmp, memcpy, memset, mkdir, mknod, mktemp,
modf, monitor, mount, mrand48, msgctl, msgget,
nice, nlist, nrand48, open, pause, pclose, per-
ror, pipe, plock, plot, popen, pow, ppremote,
printf, profil, ptrace, putc, putchar, putenv,
putmsg, putpwent, puts, pututline, putw, qsort,
rand, read, realloc, regcmp, regex, rewind, rex-
ecl, rexecv, rfstart, rmdir, sbrk, scanf,
seed48, semctl, semget, semop, setbuf, setgid,
setgrent, setjmp, setkey, setpgrp, setpwent,
setuid, setutent, setvbuf, sgetl, shmctl,
shmget, sighold, sigignore, signal, sigpause,
sigrelse, sigset, sin, sinh, sleep, sprintf,
sputl, sqrt, srand, srand48, sscanf, ssignal,
stat, statfs, stdio, stdipc, stime, strcat,
strchr, strcmp, strcpy, strcspn, strlen, strn-
cat, strncmp, strncpy, strpbrk, strrchr, strspn,
strtod, strtok, strtol, swab, sync, sys_errlist,
sys_nerr, sysfs, system, t_accept, t_alloc,
t_bind, t_close, t_connect, t_error, t_free,
t_getinfo, t_getstate, t_listen, t_look, t_open,
t_optmgmt, t_rcv, t_rcvconnect, t_rcvdis,
t_rcvrel, t_rcvudata, t_rcvuderr, t_snd, t_snd-
dis, t_sndrel, t_sndudata, t_sync, t_unbind,
tan, tanh, tdelete, tempnam, tfind, time, times,
tmpfile, tmpnam, toascii, tolower, toupper,
tsearch, ttyname, ttyslot, twalk, tzset, ulimit,
umask, umount, uname, undial, ungetc, unlink,
ustat, utime, utmpname, vfprintf, vprintf,
vsprintf, wait, write, y0, y1, and yn.
If -s is not specified, calls to UNIX system
calls and subroutines will be treated the same
as other function calls and displayed on stan-
dard output.
-t Write to standard output file names and typedef
names.
EXAMPLES:
Upcoming examples make use of the following C program, in
file.c:
main(argv, argc)
char *argv[];
int argc;
{
int x;
x = calculate(12, 5);
printf("x is: %d", x);
}
int calculate(a, b)
int a;
int b;
{
int sum;
sum = square(a) + square(b);
return(sum);
}
int square(n)
int n;
{
return(n * n);
}
cscalls, without any arguments, produces these lines:
main calculate
main printf
calculate square
cscalls -F:
produces these lines:
main:calculate
main:printf
calculate:square
cscalls -F: -p
produces these lines:
main:main(argv,argc)
calculate:calculate(a,b)
square:square(n)
cscalls -f
produces these lines:
file.c main 1 9
file.c calculate 11 19
file.c square 21 25
EXAMPLE:
To produce a structure chart of C function calls, one may
execute:
cscope -b file1.c file2.c ...
cscalls | dt
Where a large number of functions are involved, eliminat-
ing duplicate data may speed execution of the chart draw-
ing:
cscope -b file1.c file2.c ...
cscalls | sort -u | dt
To produce a structure chart of C function calls, includ-
ing parameters, one may execute:
cscope -b file1.c file2.c ...
cscalls -p > fcn.parameters
cscalls | dt -x fcn.parameters
EXIT CODES
0 for no errors; 1 for any error.
DIAGNOSTICS
All error messages are written to standard error and are
intended to be self-explanatory.
SEE ALSO
ccalls(1), cscope(1)
WARNINGS
cscalls prints function parameters from the called func-
tion point of view, rather than that of the caller func-
tion.
AUTHOR
The cscalls emulation was written by Mark Skeates.
PROVIDER
The cscalls tool is provided by Mark Skeates.
SEE ALSO
dt - A Program for Visualizing Complex Problems Using Sim-
ple Terminals, by R. S. Parnass, AT&T Bell Laboratories
technical memorandum 55545-880516-01TM.
dt(1), cscope(1)
Man(1) output converted with man2html