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