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 { "buildmimeproc", &buildmimeproc },
40 { "editor", &defaulteditor },
41 { "fileproc", &fileproc },
42 { "foldprot", &foldprot },
43 { "incproc", &incproc },
45 { "mailproc", &mailproc },
46 { "mhlproc", &mhlproc },
47 { "mimetypequeryproc", &mimetypequeryproc },
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 { "backup-prefix", &backup_prefix },
60 { "altmsg-link", &altmsglink },
61 { "draft-folder", &draftfolder },
69 static char *p_find(char *);
73 main(int argc, char **argv)
75 int i, compp = 0, missed = 0;
76 int all = 0, debug = 0;
78 char *cp, buf[BUFSIZ], **argp;
79 char **arguments, *comps[MAXARGS];
81 invo_name = mhbasename(argv[0]);
83 /* read user profile/context */
86 arguments = getarguments(invo_name, argc, argv, 1);
89 while ((cp = *argp++)) {
91 switch (smatch(++cp, switches)) {
93 ambigsw(cp, switches);
96 adios(NULL, "-%s unknown", cp);
99 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
100 print_help(buf, switches, 1);
103 print_version(invo_name);
130 advise(NULL, "profile-components ignored with -all");
133 advise(NULL, "-%scomponents ignored with -all",
134 components ? "" : "no");
136 /* print all entries in context/profile list */
137 for (np = m_defs; np; np = np->n_next)
138 printf("%s: %s\n", np->n_name, np->n_field);
144 ** Print the current value of everything in
145 ** procs array. This will show their current
146 ** value (as determined after context is read).
148 for (ps = procs; ps->p_name; ps++)
149 printf("%s: %s\n", ps->p_name,
150 *ps->p_field ? *ps->p_field : "");
154 components = compp > 1;
156 for (i = 0; i < compp; i++) {
157 register char *value;
159 value = context_find(comps[i]);
161 value = p_find(comps[i]);
164 printf("%s: ", comps[i]);
166 printf("%s\n", value);
182 for (ps = procs; ps->p_name; ps++)
183 if (!mh_strcasecmp(ps->p_name, str))
184 return (*ps->p_field);