2 ** mhparam.c -- print mh_profile values
4 ** Originally contributed by
5 ** Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
7 ** This code is Copyright (c) 2002, by the authors of nmh. See the
8 ** COPYRIGHT file in the root directory of the nmh distribution for
9 ** complete copyright information.
14 extern char *mhlibdir;
16 static struct swit switches[] = {
20 { "nocomponents", 0 },
37 static struct proc procs [] = {
38 { "context", &context },
39 { "mh-sequences", &mh_seq },
40 { "buildmimeproc", &buildmimeproc },
41 { "editor", &defaulteditor },
42 { "fileproc", &fileproc },
43 { "foldprot", &foldprot },
44 { "incproc", &incproc },
46 { "mailproc", &mailproc },
47 { "mhlproc", &mhlproc },
48 { "moreproc", &moreproc },
49 { "msgprot", &msgprot },
50 { "postproc", &postproc },
51 { "rmmproc", &rmmproc },
52 { "sendmail", &sendmail },
53 { "sendproc", &sendproc },
54 { "showmimeproc", &showmimeproc },
55 { "showproc", &showproc },
56 { "version", &version_num },
57 { "whatnowproc", &whatnowproc },
58 { "etcdir", &mhetcdir },
59 { "libdir", &mhlibdir },
60 { "backup-prefix", &backup_prefix },
61 { "altmsg-link", &altmsglink },
62 { "draft-folder", &draftfolder },
70 static char *p_find(char *);
74 main(int argc, char **argv)
76 int i, compp = 0, missed = 0;
77 int all = 0, debug = 0;
79 char *cp, buf[BUFSIZ], **argp;
80 char **arguments, *comps[MAXARGS];
82 invo_name = mhbasename(argv[0]);
84 /* read user profile/context */
87 arguments = getarguments(invo_name, argc, argv, 1);
90 while ((cp = *argp++)) {
92 switch (smatch(++cp, switches)) {
94 ambigsw(cp, switches);
97 adios(NULL, "-%s unknown", cp);
100 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
101 print_help(buf, switches, 1);
104 print_version(invo_name);
131 advise(NULL, "profile-components ignored with -all");
134 advise(NULL, "-%scomponents ignored with -all",
135 components ? "" : "no");
137 /* print all entries in context/profile list */
138 for (np = m_defs; np; np = np->n_next)
139 printf("%s: %s\n", np->n_name, np->n_field);
145 ** Print the current value of everything in
146 ** procs array. This will show their current
147 ** value (as determined after context is read).
149 for (ps = procs; ps->p_name; ps++)
150 printf("%s: %s\n", ps->p_name,
151 *ps->p_field ? *ps->p_field : "");
155 components = compp > 1;
157 for (i = 0; i < compp; i++) {
158 register char *value;
160 value = context_find(comps[i]);
162 value = p_find(comps[i]);
165 printf("%s: ", comps[i]);
167 printf("%s\n", value);
183 for (ps = procs; ps->p_name; ps++)
184 if (!mh_strcasecmp(ps->p_name, str))
185 return (*ps->p_field);