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 char *sbackup = BACKUP_PREFIX;
20 static struct swit switches[] = {
24 { "nocomponents", 0 },
41 static struct proc procs [] = {
42 { "context", &context },
43 { "mh-sequences", &mh_seq },
44 { "buildmimeproc", &buildmimeproc },
45 { "fileproc", &fileproc },
46 { "foldprot", &foldprot },
47 { "formatproc", &formatproc },
48 { "incproc", &incproc },
49 { "installproc", &installproc },
51 { "mailproc", &mailproc },
52 { "mhlproc", &mhlproc },
53 { "moreproc", &moreproc },
54 { "msgprot", &msgprot },
55 { "mshproc", &mshproc },
56 { "packproc", &packproc },
57 { "postproc", &postproc },
58 { "rmmproc", &rmmproc },
59 { "sendproc", &sendproc },
60 { "showmimeproc", &showmimeproc },
61 { "showproc", &showproc },
62 { "version", &version_num },
63 { "vmhproc", &vmhproc },
64 { "whatnowproc", &whatnowproc },
65 { "whomproc", &whomproc },
66 { "etcdir", &mhetcdir },
67 { "libdir", &mhlibdir },
68 { "sbackup", &sbackup },
76 static char *p_find(char *);
80 main(int argc, char **argv)
82 int i, compp = 0, missed = 0;
83 int all = 0, debug = 0;
85 char *cp, buf[BUFSIZ], **argp;
86 char **arguments, *comps[MAXARGS];
88 invo_name = r1bindex (argv[0], '/');
90 /* read user profile/context */
93 arguments = getarguments (invo_name, argc, argv, 1);
96 while ((cp = *argp++)) {
98 switch (smatch (++cp, switches)) {
100 ambigsw (cp, switches);
103 adios (NULL, "-%s unknown", cp);
106 snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
108 print_help (buf, switches, 1);
111 print_version(invo_name);
138 advise(NULL, "profile-components ignored with -all");
141 advise(NULL, "-%scomponents ignored with -all",
142 components ? "" : "no");
144 /* print all entries in context/profile list */
145 for (np = m_defs; np; np = np->n_next)
146 printf("%s: %s\n", np->n_name, np->n_field);
152 * Print the current value of everything in
153 * procs array. This will show their current
154 * value (as determined after context is read).
156 for (ps = procs; ps->p_name; ps++)
157 printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
161 components = compp > 1;
163 for (i = 0; i < compp; i++) {
164 register char *value;
166 value = context_find (comps[i]);
168 value = p_find (comps[i]);
171 printf("%s: ", comps[i]);
173 printf("%s\n", value);
189 for (ps = procs; ps->p_name; ps++)
190 if (!mh_strcasecmp (ps->p_name, str))
191 return (*ps->p_field);