1 /* This file is part of the program psim.
3 Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
44 new_filter(const char *filt
,
47 while (strlen(filt
) > 0) {
49 /* break up the filt list */
50 char *end
= strchr(filt
, ',');
54 end
= strchr(filt
, '\0');
61 /* add to filter list */
62 new_filter
= ZALLOC(filter
);
63 new_filter
->flag
= (char*)zalloc(len
+ 1);
64 strncpy(new_filter
->flag
, filt
, len
);
65 new_filter
->next
= filters
;
74 is_filtered_out(const char *flags
,
77 while (strlen(flags
) > 0) {
79 filter
*filt
= filters
;
80 /* break the string up */
81 char *end
= strchr(flags
, ',');
85 end
= strchr(flags
, '\0');
92 /* check that it is present */
95 while (filt
!= NULL
) {
96 if (strncmp(flags
, filt
->flag
, len
) == 0
97 && strlen(filt
->flag
) == len
) {
112 it_is(const char *flag
,
115 int flag_len
= strlen(flag
);
116 while (*flags
!= '\0') {
117 if (!strncmp(flags
, flag
, flag_len
)
118 && (flags
[flag_len
] == ',' || flags
[flag_len
] == '\0'))
120 while (*flags
!= ',') {
133 main(int argc
, char **argv
)
135 filter
*filters
= NULL
;
138 printf("Usage: filter <flags> <filter> ...\n");
141 /* load the filter up */
142 for (i
= 2; i
< argc
; i
++)
143 filters
= new_filter(argv
[i
], filters
);
144 if (is_filtered_out(argv
[1], filters
))
This page took 0.031548 seconds and 4 git commands to generate.