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 { "listproc", &listproc },
43 { "mailproc", &mailproc },
44 { "mhlproc", &mhlproc },
45 { "mimetypequeryproc", &mimetypequeryproc },
46 { "msgprot", &msgprot },
47 { "pager", &defaultpager },
48 { "postproc", &postproc },
49 { "rmmproc", &rmmproc },
50 { "sendmail", &sendmail },
51 { "sendproc", &sendproc },
52 { "showmimeproc", &showmimeproc },
53 { "showproc", &showproc },
54 { "version", &version_num },
55 { "whatnowproc", &whatnowproc },
56 { "etcdir", &mhetcdir },
57 { "backup-prefix", &backup_prefix },
58 { "altmsg-link", &altmsglink },
59 { "draft-folder", &draftfolder },
67 static char *p_find(char *);
71 main(int argc, char **argv)
73 int i, compp = 0, missed = 0;
74 int all = 0, debug = 0;
76 char *cp, buf[BUFSIZ], **argp;
77 char **arguments, *comps[MAXARGS];
79 invo_name = mhbasename(argv[0]);
81 /* read user profile/context */
84 arguments = getarguments(invo_name, argc, argv, 1);
87 while ((cp = *argp++)) {
89 switch (smatch(++cp, switches)) {
91 ambigsw(cp, switches);
94 adios(NULL, "-%s unknown", cp);
97 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
98 print_help(buf, switches, 1);
101 print_version(invo_name);
128 advise(NULL, "profile-components ignored with -all");
131 advise(NULL, "-%scomponents ignored with -all",
132 components ? "" : "no");
134 /* print all entries in context/profile list */
135 for (np = m_defs; np; np = np->n_next)
136 printf("%s: %s\n", np->n_name, np->n_field);
142 ** Print the current value of everything in
143 ** procs array. This will show their current
144 ** value (as determined after context is read).
146 for (ps = procs; ps->p_name; ps++)
147 printf("%s: %s\n", ps->p_name,
148 *ps->p_field ? *ps->p_field : "");
152 components = compp > 1;
154 for (i = 0; i < compp; i++) {
155 register char *value;
157 value = context_find(comps[i]);
159 value = p_find(comps[i]);
162 printf("%s: ", comps[i]);
164 printf("%s\n", value);
180 for (ps = procs; ps->p_name; ps++)
181 if (!mh_strcasecmp(ps->p_name, str))
182 return (*ps->p_field);