4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / gprof / printlist.c
CommitLineData
c0bc4ef7 1/*
7e9de516
KB
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
ddb85eed 4 *
6ecf3d85 5 * %sccs.include.redist.c%
c0bc4ef7
DF
6 */
7
98a06e30 8#ifndef lint
7e9de516 9static char sccsid[] = "@(#)printlist.c 8.1 (Berkeley) %G%";
ddb85eed 10#endif /* not lint */
98a06e30
PK
11
12#include "gprof.h"
13
a441395b
PK
14 /*
15 * these are the lists of names:
16 * there is the list head and then the listname
17 * is a pointer to the list head
18 * (for ease of passing to stringlist functions).
19 */
3cdecae8
KM
20struct stringlist kfromhead = { 0 , 0 };
21struct stringlist *kfromlist = &kfromhead;
22struct stringlist ktohead = { 0 , 0 };
23struct stringlist *ktolist = &ktohead;
a441395b
PK
24struct stringlist fhead = { 0 , 0 };
25struct stringlist *flist = &fhead;
26struct stringlist Fhead = { 0 , 0 };
27struct stringlist *Flist = &Fhead;
28struct stringlist ehead = { 0 , 0 };
29struct stringlist *elist = &ehead;
30struct stringlist Ehead = { 0 , 0 };
31struct stringlist *Elist = &Ehead;
32
33addlist( listp , funcname )
34 struct stringlist *listp;
35 char *funcname;
98a06e30
PK
36{
37 struct stringlist *slp;
38
39 slp = (struct stringlist *) malloc( sizeof(struct stringlist));
40 if ( slp == (struct stringlist *) 0 ) {
41 fprintf( stderr, "gprof: ran out room for printlist\n" );
42 done();
43 }
a441395b 44 slp -> next = listp -> next;
98a06e30 45 slp -> string = funcname;
a441395b 46 listp -> next = slp;
98a06e30
PK
47}
48
49bool
a441395b
PK
50onlist( listp , funcname )
51 struct stringlist *listp;
52 char *funcname;
98a06e30
PK
53{
54 struct stringlist *slp;
55
a441395b 56 for ( slp = listp -> next ; slp ; slp = slp -> next ) {
98a06e30
PK
57 if ( ! strcmp( slp -> string , funcname ) ) {
58 return TRUE;
59 }
60 if ( funcname[0] == '_' && ! strcmp( slp -> string , &funcname[1] ) ) {
61 return TRUE;
62 }
63 }
64 return FALSE;
65}