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 static struct swit switches[] = {
18 { "nocomponents", 0 },
35 static struct proc procs [] = {
36 { "attachment-header", &attach_hdr },
37 { "context", &context },
38 { "mh-sequences", &mh_seq },
39 { "editor", &defaulteditor },
40 { "fileproc", &fileproc },
41 { "foldprot", &foldprot },
42 { "incproc", &incproc },
44 { "mailproc", &mailproc },
45 { "mhlproc", &mhlproc },
46 { "mimetypequeryproc", &mimetypequeryproc },
47 { "msgprot", &msgprot },
48 { "pager", &defaultpager },
49 { "postproc", &postproc },
50 { "rmmproc", &rmmproc },
51 { "sendmail", &sendmail },
52 { "sendproc", &sendproc },
53 { "showmimeproc", &showmimeproc },
54 { "showproc", &showproc },
55 { "version", &version_num },
56 { "whatnowproc", &whatnowproc },
57 { "etcdir", &mhetcdir },
58 { "backup-prefix", &backup_prefix },
59 { "altmsg-link", &altmsglink },
60 { "draft-folder", &draftfolder },
68 static char *p_find(char *);
72 main(int argc, char **argv)
74 int i, compp = 0, missed = 0;
75 int all = 0, debug = 0;
77 char *cp, buf[BUFSIZ], **argp;
78 char **arguments, *comps[MAXARGS];
80 invo_name = mhbasename(argv[0]);
82 /* read user profile/context */
85 arguments = getarguments(invo_name, argc, argv, 1);
88 while ((cp = *argp++)) {
90 switch (smatch(++cp, switches)) {
92 ambigsw(cp, switches);
95 adios(NULL, "-%s unknown", cp);
98 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
99 print_help(buf, switches, 1);
102 print_version(invo_name);
129 advise(NULL, "profile-components ignored with -all");
132 advise(NULL, "-%scomponents ignored with -all",
133 components ? "" : "no");
135 /* print all entries in context/profile list */
136 for (np = m_defs; np; np = np->n_next)
137 printf("%s: %s\n", np->n_name, np->n_field);
143 ** Print the current value of everything in
144 ** procs array. This will show their current
145 ** value (as determined after context is read).
147 for (ps = procs; ps->p_name; ps++)
148 printf("%s: %s\n", ps->p_name,
149 *ps->p_field ? *ps->p_field : "");
153 components = compp > 1;
155 for (i = 0; i < compp; i++) {
156 register char *value;
158 value = context_find(comps[i]);
160 value = p_find(comps[i]);
163 printf("%s: ", comps[i]);
165 printf("%s\n", value);
181 for (ps = procs; ps->p_name; ps++)
182 if (!mh_strcasecmp(ps->p_name, str))
183 return (*ps->p_field);