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 { "faceproc", &faceproc },
46 { "fileproc", &fileproc },
47 { "foldprot", &foldprot },
48 { "formatproc", &formatproc },
49 { "incproc", &incproc },
50 { "installproc", &installproc },
52 { "mailproc", &mailproc },
53 { "mhlproc", &mhlproc },
54 { "moreproc", &moreproc },
55 { "msgprot", &msgprot },
56 { "mshproc", &mshproc },
57 { "packproc", &packproc },
58 { "postproc", &postproc },
59 { "rmmproc", &rmmproc },
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 { "sbackup", &sbackup },
77 static char *p_find(char *);
81 main(int argc, char **argv)
83 int i, compp = 0, missed = 0;
84 int all = 0, debug = 0;
86 char *cp, buf[BUFSIZ], **argp;
87 char **arguments, *comps[MAXARGS];
89 invo_name = r1bindex (argv[0], '/');
91 /* read user profile/context */
94 arguments = getarguments (invo_name, argc, argv, 1);
97 while ((cp = *argp++)) {
99 switch (smatch (++cp, switches)) {
101 ambigsw (cp, switches);
104 adios (NULL, "-%s unknown", cp);
107 snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
109 print_help (buf, switches, 1);
112 print_version(invo_name);
139 advise(NULL, "profile-components ignored with -all");
142 advise(NULL, "-%scomponents ignored with -all",
143 components ? "" : "no");
145 /* print all entries in context/profile list */
146 for (np = m_defs; np; np = np->n_next)
147 printf("%s: %s\n", np->n_name, np->n_field);
153 * Print the current value of everything in
154 * procs array. This will show their current
155 * value (as determined after context is read).
157 for (ps = procs; ps->p_name; ps++)
158 printf ("%s: %s\n", ps->p_name, *ps->p_field ? *ps->p_field : "");
162 components = compp > 1;
164 for (i = 0; i < compp; i++) {
165 register char *value;
167 value = context_find (comps[i]);
169 value = p_find (comps[i]);
172 printf("%s: ", comps[i]);
174 printf("%s\n", value);
190 for (ps = procs; ps->p_name; ps++)
191 if (!mh_strcasecmp (ps->p_name, str))
192 return (*ps->p_field);