]>
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 invoname-string-type.
29 * If entry is found but is empty, returns NULL.
32 context_find_by_type (const char *string
, const char *type
,
33 const char *subtype
) {
39 cp
= concat (invo_name
, "-", string
, "-", type
, "/", subtype
, NULL
);
40 if ((value
= context_find (cp
)) != NULL
&& *value
== '\0') value
= NULL
;
47 cp
= concat (invo_name
, "-", string
, "-", type
, NULL
);
48 if ((value
= context_find (cp
)) != NULL
&& *value
== '\0') value
= NULL
;