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 { "attachment-header", &attach_hdr },
39 { "context", &context },
40 { "mh-sequences", &mh_seq },
41 { "buildmimeproc", &buildmimeproc },
42 { "editor", &defaulteditor },
43 { "fileproc", &fileproc },
44 { "foldprot", &foldprot },
45 { "incproc", &incproc },
47 { "mailproc", &mailproc },
48 { "mhlproc", &mhlproc },
49 { "moreproc", &moreproc },
50 { "msgprot", &msgprot },
51 { "postproc", &postproc },
52 { "rmmproc", &rmmproc },
53 { "sendmail", &sendmail },
54 { "sendproc", &sendproc },
55 { "showmimeproc", &showmimeproc },
56 { "showproc", &showproc },
57 { "version", &version_num },
58 { "whatnowproc", &whatnowproc },
59 { "etcdir", &mhetcdir },
60 { "libdir", &mhlibdir },
61 { "backup-prefix", &backup_prefix },
62 { "altmsg-link", &altmsglink },
63 { "draft-folder", &draftfolder },
71 static char *p_find(char *);
75 main(int argc, char **argv)
77 int i, compp = 0, missed = 0;
78 int all = 0, debug = 0;
80 char *cp, buf[BUFSIZ], **argp;
81 char **arguments, *comps[MAXARGS];
83 invo_name = mhbasename(argv[0]);
85 /* read user profile/context */
88 arguments = getarguments(invo_name, argc, argv, 1);
91 while ((cp = *argp++)) {
93 switch (smatch(++cp, switches)) {
95 ambigsw(cp, switches);
98 adios(NULL, "-%s unknown", cp);
101 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
102 print_help(buf, switches, 1);
105 print_version(invo_name);
132 advise(NULL, "profile-components ignored with -all");
135 advise(NULL, "-%scomponents ignored with -all",
136 components ? "" : "no");
138 /* print all entries in context/profile list */
139 for (np = m_defs; np; np = np->n_next)
140 printf("%s: %s\n", np->n_name, np->n_field);
146 ** Print the current value of everything in
147 ** procs array. This will show their current
148 ** value (as determined after context is read).
150 for (ps = procs; ps->p_name; ps++)
151 printf("%s: %s\n", ps->p_name,
152 *ps->p_field ? *ps->p_field : "");
156 components = compp > 1;
158 for (i = 0; i < compp; i++) {
159 register char *value;
161 value = context_find(comps[i]);
163 value = p_find(comps[i]);
166 printf("%s: ", comps[i]);
168 printf("%s\n", value);
184 for (ps = procs; ps->p_name; ps++)
185 if (!mh_strcasecmp(ps->p_name, str))
186 return (*ps->p_field);