]>
diplodocus.org Git - nmh/blob - sbr/context_find.c
3 * context_find.c -- find an entry in the context/profile list
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
14 context_find (const char *str
)
18 for (np
= m_defs
; np
; np
= np
->n_next
)
19 if (!strcasecmp (np
->n_name
? np
->n_name
: "", str
? str
: ""))
27 * Helper function to search first, if subtype is non-NULL, for
28 * invoname-string-type/subtype and then, if not yet found,
29 * invoname-string-type. If entry is found but is empty, it is
30 * treated as not found.
33 context_find_by_type (const char *string
, const char *type
,
34 const char *subtype
) {
40 cp
= concat (invo_name
, "-", string
, "-", type
, "/", subtype
, NULL
);
41 if ((value
= context_find (cp
)) != NULL
&& *value
== '\0') value
= NULL
;
48 cp
= concat (invo_name
, "-", string
, "-", type
, NULL
);
49 if ((value
= context_find (cp
)) != NULL
&& *value
== '\0') value
= NULL
;