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 { "mimetypequeryproc", &mimetypequeryproc },
50 { "moreproc", &moreproc },
51 { "msgprot", &msgprot },
52 { "postproc", &postproc },
53 { "rmmproc", &rmmproc },
54 { "sendmail", &sendmail },
55 { "sendproc", &sendproc },
56 { "showmimeproc", &showmimeproc },
57 { "showproc", &showproc },
58 { "version", &version_num },
59 { "whatnowproc", &whatnowproc },
60 { "etcdir", &mhetcdir },
61 { "libdir", &mhlibdir },
62 { "backup-prefix", &backup_prefix },
63 { "altmsg-link", &altmsglink },
64 { "draft-folder", &draftfolder },
72 static char *p_find(char *);
76 main(int argc, char **argv)
78 int i, compp = 0, missed = 0;
79 int all = 0, debug = 0;
81 char *cp, buf[BUFSIZ], **argp;
82 char **arguments, *comps[MAXARGS];
84 invo_name = mhbasename(argv[0]);
86 /* read user profile/context */
89 arguments = getarguments(invo_name, argc, argv, 1);
92 while ((cp = *argp++)) {
94 switch (smatch(++cp, switches)) {
96 ambigsw(cp, switches);
99 adios(NULL, "-%s unknown", cp);
102 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
103 print_help(buf, switches, 1);
106 print_version(invo_name);
133 advise(NULL, "profile-components ignored with -all");
136 advise(NULL, "-%scomponents ignored with -all",
137 components ? "" : "no");
139 /* print all entries in context/profile list */
140 for (np = m_defs; np; np = np->n_next)
141 printf("%s: %s\n", np->n_name, np->n_field);
147 ** Print the current value of everything in
148 ** procs array. This will show their current
149 ** value (as determined after context is read).
151 for (ps = procs; ps->p_name; ps++)
152 printf("%s: %s\n", ps->p_name,
153 *ps->p_field ? *ps->p_field : "");
157 components = compp > 1;
159 for (i = 0; i < compp; i++) {
160 register char *value;
162 value = context_find(comps[i]);
164 value = p_find(comps[i]);
167 printf("%s: ", comps[i]);
169 printf("%s\n", value);
185 for (ps = procs; ps->p_name; ps++)
186 if (!mh_strcasecmp(ps->p_name, str))
187 return (*ps->p_field);