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;
15 extern char *mhetcdir;
17 static struct swit switches[] = {
21 { "nocomponents", 0 },
38 static struct proc procs [] = {
39 { "context", &context },
40 { "mh-sequences", &mh_seq },
41 { "buildmimeproc", &buildmimeproc },
42 { "editor", &defaulteditor },
43 { "faceproc", &faceproc },
44 { "fileproc", &fileproc },
45 { "foldprot", &foldprot },
46 { "incproc", &incproc },
47 { "installproc", &installproc },
49 { "mailproc", &mailproc },
50 { "mhlproc", &mhlproc },
51 { "moreproc", &moreproc },
52 { "msgprot", &msgprot },
53 { "packproc", &packproc },
54 { "postproc", &postproc },
55 { "rmfproc", &rmfproc },
56 { "rmmproc", &rmmproc },
57 { "sendmail", &sendmail },
58 { "sendproc", &sendproc },
59 { "showmimeproc", &showmimeproc },
60 { "showproc", &showproc },
61 { "version", &version_num },
62 { "whatnowproc", &whatnowproc },
63 { "etcdir", &mhetcdir },
64 { "libdir", &mhlibdir },
65 { "backup-prefix", &backup_prefix },
66 { "altmsg-link", &altmsglink },
67 { "draft-folder", &draftfolder },
75 static char *p_find(char *);
79 main(int argc, char **argv)
81 int i, compp = 0, missed = 0;
82 int all = 0, debug = 0;
84 char *cp, buf[BUFSIZ], **argp;
85 char **arguments, *comps[MAXARGS];
87 invo_name = r1bindex(argv[0], '/');
89 /* read user profile/context */
92 arguments = getarguments(invo_name, argc, argv, 1);
95 while ((cp = *argp++)) {
97 switch (smatch(++cp, switches)) {
99 ambigsw(cp, switches);
102 adios(NULL, "-%s unknown", cp);
105 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
106 print_help(buf, switches, 1);
109 print_version(invo_name);
136 advise(NULL, "profile-components ignored with -all");
139 advise(NULL, "-%scomponents ignored with -all",
140 components ? "" : "no");
142 /* print all entries in context/profile list */
143 for (np = m_defs; np; np = np->n_next)
144 printf("%s: %s\n", np->n_name, np->n_field);
150 ** Print the current value of everything in
151 ** procs array. This will show their current
152 ** value (as determined after context is read).
154 for (ps = procs; ps->p_name; ps++)
155 printf("%s: %s\n", ps->p_name,
156 *ps->p_field ? *ps->p_field : "");
160 components = compp > 1;
162 for (i = 0; i < compp; i++) {
163 register char *value;
165 value = context_find(comps[i]);
167 value = p_find(comps[i]);
170 printf("%s: ", comps[i]);
172 printf("%s\n", value);
188 for (ps = procs; ps->p_name; ps++)
189 if (!mh_strcasecmp(ps->p_name, str))
190 return (*ps->p_field);