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 { "mimetypequeryproc", &mimetypequeryproc },
44 { "msgprot", &msgprot },
45 { "pager", &defaultpager },
46 { "rmmproc", &rmmproc },
47 { "sendmail", &sendmail },
48 { "version", &version_num },
49 { "whatnowproc", &whatnowproc },
50 { "etcdir", &mhetcdir },
51 { "backup-prefix", &backup_prefix },
52 { "altmsg-link", &altmsglink },
53 { "draft-folder", &draftfolder },
61 static char *p_find(char *);
65 main(int argc, char **argv)
67 int i, compp = 0, missed = 0;
68 int all = 0, debug = 0;
70 char *cp, buf[BUFSIZ], **argp;
71 char **arguments, *comps[MAXARGS];
73 invo_name = mhbasename(argv[0]);
75 /* read user profile/context */
78 arguments = getarguments(invo_name, argc, argv, 1);
81 while ((cp = *argp++)) {
83 switch (smatch(++cp, switches)) {
85 ambigsw(cp, switches);
88 adios(NULL, "-%s unknown", cp);
91 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
92 print_help(buf, switches, 1);
95 print_version(invo_name);
122 advise(NULL, "profile-components ignored with -all");
125 advise(NULL, "-%scomponents ignored with -all",
126 components ? "" : "no");
128 /* print all entries in context/profile list */
129 for (np = m_defs; np; np = np->n_next)
130 printf("%s: %s\n", np->n_name, np->n_field);
136 ** Print the current value of everything in
137 ** procs array. This will show their current
138 ** value (as determined after context is read).
140 for (ps = procs; ps->p_name; ps++)
141 printf("%s: %s\n", ps->p_name,
142 *ps->p_field ? *ps->p_field : "");
146 components = compp > 1;
148 for (i = 0; i < compp; i++) {
149 register char *value;
151 value = context_find(comps[i]);
153 value = p_find(comps[i]);
156 printf("%s: ", comps[i]);
158 printf("%s\n", value);
174 for (ps = procs; ps->p_name; ps++)
175 if (!mh_strcasecmp(ps->p_name, str))
176 return (*ps->p_field);