3 * mhparam.c -- print mh_profile values
5 * Originally contributed by
6 * Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
8 * This code is Copyright (c) 2002, by the authors of nmh. See the
9 * COPYRIGHT file in the root directory of the nmh distribution for
10 * complete copyright information.
15 extern char *mhlibdir;
16 extern char *mhetcdir;
18 static struct swit switches[] = {
22 { "nocomponents", 0 },
39 static struct proc procs [] = {
40 { "context", &context },
41 { "mh-sequences", &mh_seq },
42 { "buildmimeproc", &buildmimeproc },
43 { "editor", &defaulteditor },
44 { "faceproc", &faceproc },
45 { "fileproc", &fileproc },
46 { "foldprot", &foldprot },
47 { "incproc", &incproc },
48 { "installproc", &installproc },
50 { "mailproc", &mailproc },
51 { "mhlproc", &mhlproc },
52 { "moreproc", &moreproc },
53 { "msgprot", &msgprot },
54 { "mshproc", &mshproc },
55 { "packproc", &packproc },
56 { "postproc", &postproc },
57 { "rmfproc", &rmfproc },
58 { "rmmproc", &rmmproc },
59 { "sendmail", &sendmail },
60 { "sendproc", &sendproc },
61 { "showmimeproc", &showmimeproc },
62 { "showproc", &showproc },
63 { "version", &version_num },
64 { "vmhproc", &vmhproc },
65 { "whatnowproc", &whatnowproc },
66 { "whomproc", &whomproc },
67 { "etcdir", &mhetcdir },
68 { "libdir", &mhlibdir },
69 { "backup-prefix", &backup_prefix },
70 { "altmsg-link", &altmsglink },
78 static char *p_find(char *);
82 main(int argc, char **argv)
84 int i, compp = 0, missed = 0;
85 int all = 0, debug = 0;
87 char *cp, buf[BUFSIZ], **argp;
88 char **arguments, *comps[MAXARGS];
90 invo_name = r1bindex (argv[0], '/');
92 /* read user profile/context */
95 arguments = getarguments (invo_name, argc, argv, 1);
98 while ((cp = *argp++)) {
100 switch (smatch (++cp, switches)) {
102 ambigsw (cp, switches);
105 adios (NULL, "-%s unknown", cp);
108 snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
110 print_help (buf, switches, 1);
113 print_version(invo_name);
140 advise(NULL, "profile-components ignored with -all");
143 advise(NULL, "-%scomponents ignored with -all",
144 components ? "" : "no");
146 /* print all entries in context/profile list */
147 for (np = m_defs; np; np = np->n_next)
148 printf("%s: %s\n", np->n_name, np->n_field);
154 * Print the current value of everything in
155 * procs array. This will show their current
156 * value (as determined after context is read).
158 for (ps = procs; ps->p_name; ps++)
159 printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
163 components = compp > 1;
165 for (i = 0; i < compp; i++) {
166 register char *value;
168 value = context_find (comps[i]);
170 value = p_find (comps[i]);
173 printf("%s: ", comps[i]);
175 printf("%s\n", value);
191 for (ps = procs; ps->p_name; ps++)
192 if (!mh_strcasecmp (ps->p_name, str))
193 return (*ps->p_field);