]>
diplodocus.org Git - nmh/blob - sbr/context_foil.c
3 * context_foil.c -- foil search of profile and context
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
15 * Foil search of users .mh_profile
16 * If error, return -1, else return 0
20 context_foil (char *path
)
22 register struct node
*np
;
24 defpath
= context
= "/dev/null";
27 * If path is given, create a minimal profile/context list
30 if (!(m_defs
= (struct node
*) malloc (sizeof(*np
)))) {
31 advise (NULL
, "unable to allocate profile storage");
36 if (!(np
->n_name
= strdup ("Path"))) {
37 advise (NULL
, "strdup failed");
40 if (!(np
->n_field
= strdup (path
))) {
41 advise (NULL
, "strdup failed");
47 if (mypath
== NULL
&& (mypath
= getenv ("HOME")) != NULL
)
48 if (!(mypath
= strdup (mypath
))) {
49 advise (NULL
, "strdup failed");