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;
21 static struct swit switches[] = {
25 { "nocomponents", 0 },
42 static struct proc procs [] = {
43 { "context", &context },
44 { "mh-sequences", &mh_seq },
45 { "buildmimeproc", &buildmimeproc },
46 { "faceproc", &faceproc },
47 { "fileproc", &fileproc },
48 { "foldprot", &foldprot },
49 { "formatproc", &formatproc },
50 { "incproc", &incproc },
51 { "installproc", &installproc },
53 { "mailproc", &mailproc },
54 { "mhlproc", &mhlproc },
55 { "moreproc", &moreproc },
56 { "msgprot", &msgprot },
57 { "mshproc", &mshproc },
58 { "packproc", &packproc },
59 { "postproc", &postproc },
60 { "rmmproc", &rmmproc },
61 { "sendproc", &sendproc },
62 { "showmimeproc", &showmimeproc },
63 { "showproc", &showproc },
64 { "version", &version_num },
65 { "vmhproc", &vmhproc },
66 { "whatnowproc", &whatnowproc },
67 { "whomproc", &whomproc },
68 { "etcdir", &mhetcdir },
69 { "libdir", &mhlibdir },
70 { "sbackup", &sbackup },
79 static char *p_find(char *);
83 main(int argc, char **argv)
85 int i, compp = 0, missed = 0;
86 int all = 0, debug = 0;
88 char *cp, buf[BUFSIZ], **argp;
89 char **arguments, *comps[MAXARGS];
91 invo_name = r1bindex (argv[0], '/');
93 /* read user profile/context */
96 arguments = getarguments (invo_name, argc, argv, 1);
99 while ((cp = *argp++)) {
101 switch (smatch (++cp, switches)) {
103 ambigsw (cp, switches);
106 adios (NULL, "-%s unknown", cp);
109 snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
111 print_help (buf, switches, 1);
114 print_version(invo_name);
141 advise(NULL, "profile-components ignored with -all");
144 advise(NULL, "-%scomponents ignored with -all",
145 components ? "" : "no");
147 /* print all entries in context/profile list */
148 for (np = m_defs; np; np = np->n_next)
149 printf("%s: %s\n", np->n_name, np->n_field);
155 * Print the current value of everything in
156 * procs array. This will show their current
157 * value (as determined after context is read).
159 for (ps = procs; ps->p_name; ps++)
160 printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
164 components = compp > 1;
166 for (i = 0; i < compp; i++) {
167 register char *value;
169 value = context_find (comps[i]);
171 value = p_find (comps[i]);
174 printf("%s: ", comps[i]);
176 printf("%s\n", value);
192 for (ps = procs; ps->p_name; ps++)
193 if (!mh_strcasecmp (ps->p_name, str))
194 return (*ps->p_field);