Revision 12455,
986 bytes
checked in by danw, 26 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r12454,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | |
---|
2 | /* |
---|
3 | * context_foil.c -- foil search of profile and context |
---|
4 | * |
---|
5 | * $Id: context_foil.c,v 1.1.1.1 1999-02-07 18:14:07 danw Exp $ |
---|
6 | */ |
---|
7 | |
---|
8 | #include <h/mh.h> |
---|
9 | |
---|
10 | /* |
---|
11 | * Foil search of users .mh_profile |
---|
12 | * If error, return -1, else return 0 |
---|
13 | */ |
---|
14 | |
---|
15 | int |
---|
16 | context_foil (char *path) |
---|
17 | { |
---|
18 | register struct node *np; |
---|
19 | |
---|
20 | defpath = context = "/dev/null"; |
---|
21 | |
---|
22 | /* |
---|
23 | * If path is given, create a minimal profile/context list |
---|
24 | */ |
---|
25 | if (path) { |
---|
26 | if (!(m_defs = (struct node *) malloc (sizeof(*np)))) { |
---|
27 | advise (NULL, "unable to allocate profile storage"); |
---|
28 | return -1; |
---|
29 | } |
---|
30 | |
---|
31 | np = m_defs; |
---|
32 | if (!(np->n_name = strdup ("Path"))) { |
---|
33 | advise (NULL, "strdup failed"); |
---|
34 | return -1; |
---|
35 | } |
---|
36 | if (!(np->n_field = strdup (path))) { |
---|
37 | advise (NULL, "strdup failed"); |
---|
38 | return -1; |
---|
39 | } |
---|
40 | np->n_context = 0; |
---|
41 | np->n_next = NULL; |
---|
42 | |
---|
43 | if (mypath == NULL && (mypath = getenv ("HOME")) != NULL) |
---|
44 | if (!(mypath = strdup (mypath))) { |
---|
45 | advise (NULL, "strdup failed"); |
---|
46 | return -1; |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | return 0; |
---|
51 | } |
---|
52 | |
---|
Note: See
TracBrowser
for help on using the repository browser.