📄 filter.c
字号:
/* Copyright (C) 2004,2005,2006 Bull S.A. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#if HAVE_CONFIG_H#include <config.h>#endif#include "types.h"#include "glib_hash.h"#include "modules.h"static int *eventtable;static GHashTable *hashtable_pid, *hashtable_object;static int ok = 1;static int pid_search = 0, name_search = 0;static int init (pid_t *list_pid, int *list_event, char **list_name) { int i; if (list_pid) { hashtable_pid = g_hash_table_new (g_int_hash, g_int_equal); pid_search = 1; for (i = 0; list_pid[i]; i++) g_hash_table_insert (hashtable_pid, list_pid + i, &ok); } eventtable = list_event; if (list_name) { hashtable_object = g_hash_table_new (g_str_hash, g_str_equal); name_search = 1; for (i = 0; list_name[i]; i++) g_hash_table_insert (hashtable_object, list_name[i], &ok); } return 0;}static int accept (pid_t pid, ptt_event_t event, char **list_name) { if (pid_search && g_hash_table_lookup (hashtable_pid, &pid) == NULL) return 0; if (eventtable[event] == 0) return 0; if (name_search) { int i; for(i = 0; list_name[i]; i++) if (g_hash_table_lookup (hashtable_object, list_name[i])) break; if (list_name[i] == 0) return 0; } return 1;}static void close () { if (pid_search) g_hash_table_destroy (hashtable_pid); if (name_search) g_hash_table_destroy (hashtable_object);}struct filter filter = { .init = init, .accept = accept, .close = close};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -