aboutsummaryrefslogtreecommitdiff
path: root/src/match_exact.c
blob: 2a2caf4e75f08b8cffe1ebcf17aa0fe73035346a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* This file is part of genrc
Copyryght (C) 2018 Sergey Poznyakoff
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
*/
#include "genrc.h"

void
match_exact_init(PROCSCANBUF buf, char const *pattern)
{
	buf->pattern = xstrdup(pattern ? pattern : genrc_program);
}

void
match_exact_free(PROCSCANBUF buf)
{
	free(buf->pattern);
}

int
match_exact(PROCSCANBUF buf, char const *arg)
{
	return ((buf->flags & PROCF_ICASE) ? strcasecmp : strcmp)
		((char*)buf->pattern, arg);
}

Return to:

Send suggestions and report system problems to the System administrator.