Artifact cc8033965c24feaa70b4c5c2a6e62c9a2b27de4100868638bf1c65f64b9799ca:
- File filter.c — part of check-in [c14cf350df] at 2014-05-15 21:36:21 on branch manualheaven — Move src and doc files to top directory (user: base@atomicules.co.uk size: 3692) [more...]
- File
src/filter.c
— part of check-in
[11403de3f1]
at
2011-01-30 19:00:30
on branch origin/tweaks
— Fix more compiler warnings
git-svn-id: https://pwman.svn.sourceforge.net/svnroot/pwman/trunk@117 db5f1c25-4851-472e-ac1e-5437d07aece1 (user: gagravarr@users.sourceforge.net size: 3692)
0000: 2f 2a 0a 20 2a 20 20 50 57 4d 61 6e 20 2d 20 70 /*. * PWMan - p
0010: 61 73 73 77 6f 72 64 20 6d 61 6e 61 67 65 6d 65 assword manageme
0020: 6e 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 0a 20 nt application.
0030: 2a 0a 20 2a 20 20 43 6f 70 79 72 69 67 68 74 20 *. * Copyright
0040: 28 43 29 20 32 30 30 32 20 20 49 76 61 6e 20 4b (C) 2002 Ivan K
0050: 65 6c 6c 79 20 3c 69 76 61 6e 40 69 76 61 6e 6b elly <ivan@ivank
0060: 65 6c 6c 79 2e 6e 65 74 3e 0a 20 2a 0a 20 2a 20 elly.net>. *. *
0070: 20 54 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 This program is
0080: 20 66 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 free software;
0090: 79 6f 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 you can redistri
00a0: 62 75 74 65 20 69 74 20 61 6e 64 2f 6f 72 20 6d bute it and/or m
00b0: 6f 64 69 66 79 0a 20 2a 20 20 69 74 20 75 6e 64 odify. * it und
00c0: 65 72 20 74 68 65 20 74 65 72 6d 73 20 6f 66 20 er the terms of
00d0: 74 68 65 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 the GNU General
00e0: 50 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 61 Public License a
00f0: 73 20 70 75 62 6c 69 73 68 65 64 20 62 79 0a 20 s published by.
0100: 2a 20 20 74 68 65 20 46 72 65 65 20 53 6f 66 74 * the Free Soft
0110: 77 61 72 65 20 46 6f 75 6e 64 61 74 69 6f 6e 3b ware Foundation;
0120: 20 65 69 74 68 65 72 20 76 65 72 73 69 6f 6e 20 either version
0130: 32 20 6f 66 20 74 68 65 20 4c 69 63 65 6e 73 65 2 of the License
0140: 2c 20 6f 72 0a 20 2a 20 20 28 61 74 20 79 6f 75 , or. * (at you
0150: 72 20 6f 70 74 69 6f 6e 29 20 61 6e 79 20 6c 61 r option) any la
0160: 74 65 72 20 76 65 72 73 69 6f 6e 2e 0a 20 2a 0a ter version.. *.
0170: 20 2a 20 20 54 68 69 73 20 70 72 6f 67 72 61 6d * This program
0180: 20 69 73 20 64 69 73 74 72 69 62 75 74 65 64 20 is distributed
0190: 69 6e 20 74 68 65 20 68 6f 70 65 20 74 68 61 74 in the hope that
01a0: 20 69 74 20 77 69 6c 6c 20 62 65 20 75 73 65 66 it will be usef
01b0: 75 6c 2c 0a 20 2a 20 20 62 75 74 20 57 49 54 48 ul,. * but WITH
01c0: 4f 55 54 20 41 4e 59 20 57 41 52 52 41 4e 54 59 OUT ANY WARRANTY
01d0: 3b 20 77 69 74 68 6f 75 74 20 65 76 65 6e 20 74 ; without even t
01e0: 68 65 20 69 6d 70 6c 69 65 64 20 77 61 72 72 61 he implied warra
01f0: 6e 74 79 20 6f 66 0a 20 2a 20 20 4d 45 52 43 48 nty of. * MERCH
0200: 41 4e 54 41 42 49 4c 49 54 59 20 6f 72 20 46 49 ANTABILITY or FI
0210: 54 4e 45 53 53 20 46 4f 52 20 41 20 50 41 52 54 TNESS FOR A PART
0220: 49 43 55 4c 41 52 20 50 55 52 50 4f 53 45 2e 20 ICULAR PURPOSE.
0230: 20 53 65 65 20 74 68 65 0a 20 2a 20 20 47 4e 55 See the. * GNU
0240: 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 General Public
0250: 4c 69 63 65 6e 73 65 20 66 6f 72 20 6d 6f 72 65 License for more
0260: 20 64 65 74 61 69 6c 73 2e 0a 20 2a 0a 20 2a 20 details.. *. *
0270: 20 59 6f 75 20 73 68 6f 75 6c 64 20 68 61 76 65 You should have
0280: 20 72 65 63 65 69 76 65 64 20 61 20 63 6f 70 79 received a copy
0290: 20 6f 66 20 74 68 65 20 47 4e 55 20 47 65 6e 65 of the GNU Gene
02a0: 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65 6e ral Public Licen
02b0: 73 65 0a 20 2a 20 20 61 6c 6f 6e 67 20 77 69 74 se. * along wit
02c0: 68 20 74 68 69 73 20 70 72 6f 67 72 61 6d 3b 20 h this program;
02d0: 69 66 20 6e 6f 74 2c 20 77 72 69 74 65 20 74 6f if not, write to
02e0: 20 74 68 65 20 46 72 65 65 20 53 6f 66 74 77 61 the Free Softwa
02f0: 72 65 0a 20 2a 20 20 46 6f 75 6e 64 61 74 69 6f re. * Foundatio
0300: 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 54 65 6d 70 n, Inc., 59 Temp
0310: 6c 65 20 50 6c 61 63 65 2c 20 53 75 69 74 65 20 le Place, Suite
0320: 33 33 30 2c 20 42 6f 73 74 6f 6e 2c 20 4d 41 20 330, Boston, MA
0330: 20 30 32 31 31 31 2d 31 33 30 37 20 20 55 53 41 02111-1307 USA
0340: 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64 65 20 3c . */..#include <
0350: 73 74 64 6c 69 62 2e 68 3e 0a 23 69 6e 63 6c 75 stdlib.h>.#inclu
0360: 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 0a 23 69 de <string.h>.#i
0370: 6e 63 6c 75 64 65 20 3c 70 77 6d 61 6e 2e 68 3e nclude <pwman.h>
0380: 0a 23 69 6e 63 6c 75 64 65 20 3c 75 69 2e 68 3e .#include <ui.h>
0390: 0a 0a 2f 2a 78 74 65 72 6e 20 69 6e 74 20 63 75 ../*xtern int cu
03a0: 72 69 74 65 6d 3b 2a 2f 0a 0a 50 77 46 69 6c 74 ritem;*/..PwFilt
03b0: 65 72 20 2a 0a 66 69 6c 74 65 72 5f 6e 65 77 28 er *.filter_new(
03c0: 29 0a 7b 0a 09 50 77 46 69 6c 74 65 72 20 2a 6e ).{..PwFilter *n
03d0: 65 77 3b 0a 0a 09 6e 65 77 20 3d 20 6d 61 6c 6c ew;...new = mall
03e0: 6f 63 28 73 69 7a 65 6f 66 28 50 77 46 69 6c 74 oc(sizeof(PwFilt
03f0: 65 72 29 29 3b 0a 09 69 66 28 6e 65 77 20 3d 3d er));..if(new ==
0400: 20 4e 55 4c 4c 29 20 7b 0a 09 09 70 77 5f 61 62 NULL) {...pw_ab
0410: 6f 72 74 28 22 46 61 69 6c 65 64 20 74 6f 20 61 ort("Failed to a
0420: 6c 6c 6f 63 61 74 65 20 6d 65 6d 6f 72 79 20 74 llocate memory t
0430: 6f 20 68 6f 6c 64 20 66 69 6c 74 65 72 69 6e 67 o hold filtering
0440: 20 64 65 74 61 69 6c 73 21 22 29 3b 0a 09 7d 0a details!");..}.
0450: 0a 09 6e 65 77 2d 3e 66 69 65 6c 64 20 3d 20 2d ..new->field = -
0460: 31 3b 0a 09 6e 65 77 2d 3e 66 69 6c 74 65 72 20 1;..new->filter
0470: 3d 20 6d 61 6c 6c 6f 63 28 53 54 52 49 4e 47 5f = malloc(STRING_
0480: 4c 4f 4e 47 29 3b 0a 09 69 66 28 6e 65 77 20 3d LONG);..if(new =
0490: 3d 20 4e 55 4c 4c 29 20 7b 0a 09 09 70 77 5f 61 = NULL) {...pw_a
04a0: 62 6f 72 74 28 22 46 61 69 6c 65 64 20 74 6f 20 bort("Failed to
04b0: 61 6c 6c 6f 63 61 74 65 20 6d 65 6d 6f 72 79 20 allocate memory
04c0: 74 6f 20 68 6f 6c 64 20 66 69 6c 74 65 72 69 6e to hold filterin
04d0: 67 20 74 65 72 6d 21 22 29 3b 0a 09 7d 0a 09 6e g term!");..}..n
04e0: 65 77 2d 3e 66 69 6c 74 65 72 5b 30 5d 20 3d 20 ew->filter[0] =
04f0: 30 3b 0a 0a 09 72 65 74 75 72 6e 20 6e 65 77 3b 0;...return new;
0500: 0a 7d 0a 0a 2f 2a 0a 20 2a 20 53 74 72 69 6e 67 .}../*. * String
0510: 20 63 68 65 63 6b 69 6e 67 20 6f 6e 6c 79 20 63 checking only c
0520: 61 73 65 20 69 6e 73 65 6e 73 69 74 69 76 65 20 ase insensitive
0530: 75 73 69 6e 67 20 67 6e 75 20 67 6c 69 62 63 0a using gnu glibc.
0540: 20 2a 2f 0a 73 74 61 74 69 63 20 63 68 61 72 2a */.static char*
0550: 0a 66 69 6c 74 65 72 5f 73 74 72 63 61 73 65 73 .filter_strcases
0560: 74 72 28 63 68 61 72 20 2a 68 61 79 73 74 61 63 tr(char *haystac
0570: 6b 2c 20 63 68 61 72 20 2a 6e 65 65 64 6c 65 29 k, char *needle)
0580: 7b 0a 09 2f 2f 20 4e 65 76 65 72 20 6d 61 74 63 {..// Never matc
0590: 68 65 73 20 69 66 20 6e 75 6c 6c 2f 65 6d 70 74 hes if null/empt
05a0: 79 20 73 74 72 69 6e 67 20 67 69 76 65 6e 0a 09 y string given..
05b0: 69 66 28 68 61 79 73 74 61 63 6b 20 3d 3d 20 4e if(haystack == N
05c0: 55 4c 4c 29 20 7b 0a 09 09 72 65 74 75 72 6e 20 ULL) {...return
05d0: 30 3b 0a 09 7d 0a 09 69 66 28 73 74 72 6c 65 6e 0;..}..if(strlen
05e0: 28 68 61 79 73 74 61 63 6b 29 20 3d 3d 20 30 29 (haystack) == 0)
05f0: 20 7b 0a 09 09 72 65 74 75 72 6e 20 30 3b 0a 09 {...return 0;..
0600: 7d 0a 0a 23 69 66 64 65 66 20 48 41 56 45 5f 53 }..#ifdef HAVE_S
0610: 54 52 43 41 53 45 53 54 52 0a 09 72 65 74 75 72 TRCASESTR..retur
0620: 6e 20 28 63 68 61 72 2a 29 73 74 72 63 61 73 65 n (char*)strcase
0630: 73 74 72 28 68 61 79 73 74 61 63 6b 2c 20 6e 65 str(haystack, ne
0640: 65 64 6c 65 29 3b 0a 23 65 6c 73 65 0a 09 72 65 edle);.#else..re
0650: 74 75 72 6e 20 28 63 68 61 72 2a 29 73 74 72 73 turn (char*)strs
0660: 74 72 28 68 61 79 73 74 61 63 6b 2c 20 6e 65 65 tr(haystack, nee
0670: 64 6c 65 29 3b 0a 23 65 6e 64 69 66 0a 7d 0a 0a dle);.#endif.}..
0680: 69 6e 74 0a 66 69 6c 74 65 72 5f 61 70 70 6c 79 int.filter_apply
0690: 28 50 77 20 2a 70 77 2c 20 50 77 46 69 6c 74 65 (Pw *pw, PwFilte
06a0: 72 2a 20 66 69 6c 29 0a 7b 0a 09 69 66 28 20 28 r* fil).{..if( (
06b0: 66 69 6c 20 3d 3d 20 4e 55 4c 4c 29 20 7c 7c 20 fil == NULL) ||
06c0: 28 66 69 6c 2d 3e 66 69 6c 74 65 72 20 3d 3d 20 (fil->filter ==
06d0: 4e 55 4c 4c 29 20 29 7b 0a 09 09 2f 2a 20 6e 6f NULL) ){.../* no
06e0: 20 66 69 6c 74 65 72 20 6f 62 6a 65 63 74 20 2a filter object *
06f0: 2f 0a 09 09 72 65 74 75 72 6e 20 31 3b 0a 09 7d /...return 1;..}
0700: 0a 09 69 66 28 20 73 74 72 6c 65 6e 28 66 69 6c ..if( strlen(fil
0710: 2d 3e 66 69 6c 74 65 72 29 20 3d 3d 20 30 20 29 ->filter) == 0 )
0720: 7b 0a 09 09 2f 2a 20 6e 6f 20 66 69 6c 74 65 72 {.../* no filter
0730: 20 2a 2f 0a 09 09 72 65 74 75 72 6e 20 31 3b 0a */...return 1;.
0740: 09 7d 0a 09 73 77 69 74 63 68 28 66 69 6c 2d 3e .}..switch(fil->
0750: 66 69 65 6c 64 29 7b 0a 09 09 63 61 73 65 20 30 field){...case 0
0760: 3a 0a 09 09 09 69 66 28 20 66 69 6c 74 65 72 5f :....if( filter_
0770: 73 74 72 63 61 73 65 73 74 72 28 70 77 2d 3e 6e strcasestr(pw->n
0780: 61 6d 65 2c 20 66 69 6c 2d 3e 66 69 6c 74 65 72 ame, fil->filter
0790: 29 20 29 7b 0a 09 09 09 09 72 65 74 75 72 6e 20 ) ){.....return
07a0: 31 3b 0a 09 09 09 7d 09 09 09 09 09 0a 09 09 09 1;....}.........
07b0: 62 72 65 61 6b 3b 0a 09 09 63 61 73 65 20 31 3a break;...case 1:
07c0: 0a 09 09 09 69 66 28 20 66 69 6c 74 65 72 5f 73 ....if( filter_s
07d0: 74 72 63 61 73 65 73 74 72 28 70 77 2d 3e 68 6f trcasestr(pw->ho
07e0: 73 74 2c 20 66 69 6c 2d 3e 66 69 6c 74 65 72 29 st, fil->filter)
07f0: 20 29 7b 0a 09 09 09 09 72 65 74 75 72 6e 20 31 ){.....return 1
0800: 3b 0a 09 09 09 7d 0a 09 09 09 62 72 65 61 6b 3b ;....}....break;
0810: 0a 09 09 63 61 73 65 20 32 3a 0a 09 09 09 69 66 ...case 2:....if
0820: 28 20 66 69 6c 74 65 72 5f 73 74 72 63 61 73 65 ( filter_strcase
0830: 73 74 72 28 70 77 2d 3e 75 73 65 72 2c 20 66 69 str(pw->user, fi
0840: 6c 2d 3e 66 69 6c 74 65 72 29 20 29 7b 0a 09 09 l->filter) ){...
0850: 09 09 72 65 74 75 72 6e 20 31 3b 0a 09 09 09 7d ..return 1;....}
0860: 0a 09 09 09 62 72 65 61 6b 3b 0a 09 09 63 61 73 ....break;...cas
0870: 65 20 33 3a 0a 09 09 09 69 66 28 20 66 69 6c 74 e 3:....if( filt
0880: 65 72 5f 73 74 72 63 61 73 65 73 74 72 28 70 77 er_strcasestr(pw
0890: 2d 3e 6c 61 75 6e 63 68 2c 20 66 69 6c 2d 3e 66 ->launch, fil->f
08a0: 69 6c 74 65 72 29 20 29 7b 0a 09 09 09 09 72 65 ilter) ){.....re
08b0: 74 75 72 6e 20 31 3b 0a 09 09 09 7d 0a 09 09 09 turn 1;....}....
08c0: 62 72 65 61 6b 3b 0a 09 09 64 65 66 61 75 6c 74 break;...default
08d0: 3a 0a 2f 2a 09 09 09 66 70 72 69 6e 74 66 28 73 :./*...fprintf(s
08e0: 74 64 65 72 72 2c 20 22 49 6e 76 61 6c 69 64 20 tderr, "Invalid
08f0: 66 69 6c 74 65 72 20 66 69 65 6c 64 20 25 64 5c filter field %d\
0900: 6e 22 2c 20 66 69 6c 2d 3e 66 69 65 6c 64 29 3b n", fil->field);
0910: 2a 2f 0a 09 09 09 62 72 65 61 6b 3b 0a 09 7d 0a */....break;..}.
0920: 09 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 76 6f .return 0;.}..vo
0930: 69 64 0a 66 69 6c 74 65 72 5f 67 65 74 28 29 0a id.filter_get().
0940: 7b 0a 09 63 68 61 72 20 63 3b 0a 0a 09 75 69 5f {..char c;...ui_
0950: 73 74 61 74 75 73 6c 69 6e 65 5f 61 73 6b 5f 63 statusline_ask_c
0960: 68 61 72 28 22 46 69 6c 74 65 72 20 77 68 69 63 har("Filter whic
0970: 68 20 66 69 65 6c 64 3f 20 28 6e 29 61 6d 65 20 h field? (n)ame
0980: 28 68 29 6f 73 74 20 28 75 29 73 65 72 20 28 6c (h)ost (u)ser (l
0990: 29 61 75 6e 63 68 20 6e 28 6f 29 6e 65 22 2c 20 )aunch n(o)ne",
09a0: 26 63 2c 20 22 6e 68 75 6c 6f 5c 6e 22 29 3b 0a &c, "nhulo\n");.
09b0: 09 73 77 69 74 63 68 28 63 29 7b 0a 09 09 63 61 .switch(c){...ca
09c0: 73 65 20 27 6e 27 3a 0a 09 09 09 6f 70 74 69 6f se 'n':....optio
09d0: 6e 73 2d 3e 66 69 6c 74 65 72 2d 3e 66 69 65 6c ns->filter->fiel
09e0: 64 20 3d 20 30 3b 0a 09 09 09 62 72 65 61 6b 3b d = 0;....break;
09f0: 0a 09 09 63 61 73 65 20 27 68 27 3a 0a 09 09 09 ...case 'h':....
0a00: 6f 70 74 69 6f 6e 73 2d 3e 66 69 6c 74 65 72 2d options->filter-
0a10: 3e 66 69 65 6c 64 20 3d 20 31 3b 0a 09 09 09 62 >field = 1;....b
0a20: 72 65 61 6b 3b 0a 09 09 63 61 73 65 20 27 75 27 reak;...case 'u'
0a30: 3a 0a 09 09 09 6f 70 74 69 6f 6e 73 2d 3e 66 69 :....options->fi
0a40: 6c 74 65 72 2d 3e 66 69 65 6c 64 20 3d 20 32 3b lter->field = 2;
0a50: 0a 09 09 09 62 72 65 61 6b 3b 0a 09 09 63 61 73 ....break;...cas
0a60: 65 20 27 6c 27 3a 0a 09 09 09 6f 70 74 69 6f 6e e 'l':....option
0a70: 73 2d 3e 66 69 6c 74 65 72 2d 3e 66 69 65 6c 64 s->filter->field
0a80: 20 3d 20 33 3b 0a 09 09 09 62 72 65 61 6b 3b 0a = 3;....break;.
0a90: 09 09 63 61 73 65 20 27 6f 27 3a 0a 09 09 64 65 ..case 'o':...de
0aa0: 66 61 75 6c 74 3a 0a 09 09 09 6f 70 74 69 6f 6e fault:....option
0ab0: 73 2d 3e 66 69 6c 74 65 72 2d 3e 66 69 65 6c 64 s->filter->field
0ac0: 20 3d 20 2d 31 3b 0a 09 09 09 6f 70 74 69 6f 6e = -1;....option
0ad0: 73 2d 3e 66 69 6c 74 65 72 2d 3e 66 69 6c 74 65 s->filter->filte
0ae0: 72 5b 30 5d 20 3d 20 30 3b 0a 0a 09 09 09 75 69 r[0] = 0;.....ui
0af0: 6c 69 73 74 5f 72 65 66 72 65 73 68 28 29 3b 0a list_refresh();.
0b00: 09 09 09 72 65 74 75 72 6e 3b 0a 09 09 09 62 72 ...return;....br
0b10: 65 61 6b 3b 0a 09 7d 0a 09 75 69 5f 73 74 61 74 eak;..}..ui_stat
0b20: 75 73 6c 69 6e 65 5f 61 73 6b 5f 73 74 72 28 22 usline_ask_str("
0b30: 53 74 72 69 6e 67 20 74 6f 20 73 65 61 72 63 68 String to search
0b40: 20 66 6f 72 3a 20 22 2c 20 6f 70 74 69 6f 6e 73 for: ", options
0b50: 2d 3e 66 69 6c 74 65 72 2d 3e 66 69 6c 74 65 72 ->filter->filter
0b60: 2c 20 53 54 52 49 4e 47 5f 4d 45 44 49 55 4d 29 , STRING_MEDIUM)
0b70: 3b 0a 0a 09 63 75 72 72 65 6e 74 5f 70 77 5f 73 ;...current_pw_s
0b80: 75 62 6c 69 73 74 2d 3e 63 75 72 72 65 6e 74 5f ublist->current_
0b90: 69 74 65 6d 20 3d 20 2d 31 3b 0a 09 75 69 6c 69 item = -1;..uili
0ba0: 73 74 5f 72 65 66 72 65 73 68 28 29 3b 0a 7d 0a st_refresh();.}.
0bb0: 0a 0a 69 6e 74 0a 66 69 6c 74 65 72 5f 61 6c 65 ..int.filter_ale
0bc0: 72 74 28 50 77 46 69 6c 74 65 72 2a 20 66 69 6c rt(PwFilter* fil
0bd0: 29 0a 7b 0a 09 63 68 61 72 20 61 6c 65 72 74 5b ).{..char alert[
0be0: 38 30 5d 3b 09 0a 0a 09 69 66 28 20 28 66 69 6c 80];....if( (fil
0bf0: 20 3d 3d 20 4e 55 4c 4c 29 20 7c 7c 20 28 66 69 == NULL) || (fi
0c00: 6c 2d 3e 66 69 6c 74 65 72 20 3d 3d 20 4e 55 4c l->filter == NUL
0c10: 4c 29 20 29 7b 0a 09 09 2f 2a 20 6e 6f 20 66 69 L) ){.../* no fi
0c20: 6c 74 65 72 20 6f 62 6a 65 63 74 20 2a 2f 0a 09 lter object */..
0c30: 09 72 65 74 75 72 6e 20 31 3b 0a 09 7d 0a 09 69 .return 1;..}..i
0c40: 66 28 20 73 74 72 6c 65 6e 28 66 69 6c 2d 3e 66 f( strlen(fil->f
0c50: 69 6c 74 65 72 29 20 3d 3d 20 30 20 29 7b 0a 09 ilter) == 0 ){..
0c60: 09 2f 2a 20 6e 6f 20 66 69 6c 74 65 72 20 2a 2f ./* no filter */
0c70: 0a 09 09 72 65 74 75 72 6e 20 31 3b 0a 09 7d 0a ...return 1;..}.
0c80: 09 73 77 69 74 63 68 28 66 69 6c 2d 3e 66 69 65 .switch(fil->fie
0c90: 6c 64 29 7b 0a 09 09 63 61 73 65 20 30 3a 0a 09 ld){...case 0:..
0ca0: 09 09 73 70 72 69 6e 74 66 28 61 6c 65 72 74 2c ..sprintf(alert,
0cb0: 20 22 20 28 46 69 6c 74 65 72 69 6e 67 20 6f 6e " (Filtering on
0cc0: 20 6e 61 6d 65 20 77 69 74 68 20 27 25 73 27 29 name with '%s')
0cd0: 22 2c 20 66 69 6c 2d 3e 66 69 6c 74 65 72 29 3b ", fil->filter);
0ce0: 0a 09 09 09 62 72 65 61 6b 3b 0a 09 09 63 61 73 ....break;...cas
0cf0: 65 20 31 3a 0a 09 09 09 73 70 72 69 6e 74 66 28 e 1:....sprintf(
0d00: 61 6c 65 72 74 2c 20 22 20 28 46 69 6c 74 65 72 alert, " (Filter
0d10: 69 6e 67 20 6f 6e 20 68 6f 73 74 20 77 69 74 68 ing on host with
0d20: 20 27 25 73 27 29 22 2c 20 66 69 6c 2d 3e 66 69 '%s')", fil->fi
0d30: 6c 74 65 72 29 3b 0a 09 09 09 62 72 65 61 6b 3b lter);....break;
0d40: 0a 09 09 63 61 73 65 20 32 3a 0a 09 09 09 73 70 ...case 2:....sp
0d50: 72 69 6e 74 66 28 61 6c 65 72 74 2c 20 22 20 28 rintf(alert, " (
0d60: 46 69 6c 74 65 72 69 6e 67 20 6f 6e 20 75 73 65 Filtering on use
0d70: 72 20 77 69 74 68 20 27 25 73 27 29 22 2c 20 66 r with '%s')", f
0d80: 69 6c 2d 3e 66 69 6c 74 65 72 29 3b 0a 09 09 63 il->filter);...c
0d90: 61 73 65 20 33 3a 0a 09 09 09 73 70 72 69 6e 74 ase 3:....sprint
0da0: 66 28 61 6c 65 72 74 2c 20 22 20 28 46 69 6c 74 f(alert, " (Filt
0db0: 65 72 69 6e 67 20 6f 6e 20 6c 61 75 6e 63 68 20 ering on launch
0dc0: 77 69 74 68 20 27 25 73 27 29 22 2c 20 66 69 6c with '%s')", fil
0dd0: 2d 3e 66 69 6c 74 65 72 29 3b 0a 09 09 64 65 66 ->filter);...def
0de0: 61 75 6c 74 3a 0a 2f 2a 09 09 09 66 70 72 69 6e ault:./*...fprin
0df0: 74 66 28 73 74 64 65 72 72 2c 20 22 49 6e 76 61 tf(stderr, "Inva
0e00: 6c 69 64 20 66 69 6c 74 65 72 20 66 69 65 6c 64 lid filter field
0e10: 20 25 64 5c 6e 22 2c 20 66 69 6c 2d 3e 66 69 65 %d\n", fil->fie
0e20: 6c 64 29 3b 2a 2f 0a 09 09 09 62 72 65 61 6b 3b ld);*/....break;
0e30: 0a 09 7d 0a 0a 09 75 69 5f 73 74 61 74 75 73 6c ..}...ui_statusl
0e40: 69 6e 65 5f 63 6c 65 61 72 28 29 3b 0a 09 75 69 ine_clear();..ui
0e50: 5f 73 74 61 74 75 73 6c 69 6e 65 5f 6d 73 67 28 _statusline_msg(
0e60: 61 6c 65 72 74 29 3b 0a 7d 0a 0a 0a alert);.}...