3 * mhparam.c -- print mh_profile values
5 * Originally contributed by
6 * Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
10 * This code is Copyright (c) 2002, by the authors of nmh. See the
11 * COPYRIGHT file in the root directory of the nmh distribution for
12 * complete copyright information.
17 extern char *mhlibdir;
18 extern char *mhetcdir;
20 char *sbackup = BACKUP_PREFIX;
23 static struct swit switches[] = {
27 { "nocomponents", 0 },
44 static struct proc procs [] = {
45 { "context", &context },
46 { "mh-sequences", &mh_seq },
47 { "buildmimeproc", &buildmimeproc },
48 { "faceproc", &faceproc },
49 { "fileproc", &fileproc },
50 { "foldprot", &foldprot },
51 { "incproc", &incproc },
52 { "installproc", &installproc },
54 { "mailproc", &mailproc },
55 { "mhlproc", &mhlproc },
56 { "moreproc", &moreproc },
57 { "msgprot", &msgprot },
58 { "mshproc", &mshproc },
59 { "packproc", &packproc },
60 { "postproc", &postproc },
61 { "rmfproc", &rmfproc },
62 { "rmmproc", &rmmproc },
63 { "sendproc", &sendproc },
64 { "showmimeproc", &showmimeproc },
65 { "showproc", &showproc },
66 { "version", &version_num },
67 { "vmhproc", &vmhproc },
68 { "whatnowproc", &whatnowproc },
69 { "whomproc", &whomproc },
70 { "etcdir", &mhetcdir },
71 { "libdir", &mhlibdir },
72 { "sbackup", &sbackup },
81 static char *p_find(char *);
85 main(int argc, char **argv)
87 int i, compp = 0, missed = 0;
88 int all = 0, debug = 0;
90 char *cp, buf[BUFSIZ], **argp;
91 char **arguments, *comps[MAXARGS];
93 invo_name = r1bindex (argv[0], '/');
95 /* read user profile/context */
98 arguments = getarguments (invo_name, argc, argv, 1);
101 while ((cp = *argp++)) {
103 switch (smatch (++cp, switches)) {
105 ambigsw (cp, switches);
108 adios (NULL, "-%s unknown", cp);
111 snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
113 print_help (buf, switches, 1);
116 print_version(invo_name);
143 advise(NULL, "profile-components ignored with -all");
146 advise(NULL, "-%scomponents ignored with -all",
147 components ? "" : "no");
149 /* print all entries in context/profile list */
150 for (np = m_defs; np; np = np->n_next)
151 printf("%s: %s\n", np->n_name, np->n_field);
157 * Print the current value of everything in
158 * procs array. This will show their current
159 * value (as determined after context is read).
161 for (ps = procs; ps->p_name; ps++)
162 printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
166 components = compp > 1;
168 for (i = 0; i < compp; i++) {
169 register char *value;
171 value = context_find (comps[i]);
173 value = p_find (comps[i]);
176 printf("%s: ", comps[i]);
178 printf("%s\n", value);
194 for (ps = procs; ps->p_name; ps++)
195 if (!mh_strcasecmp (ps->p_name, str))
196 return (*ps->p_field);