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 { "foldprot", &foldprot },
41 { "listproc", &listproc },
42 { "mimetypequeryproc", &mimetypequeryproc },
43 { "msgprot", &msgprot },
44 { "pager", &defaultpager },
45 { "sendmail", &sendmail },
46 { "version", &version_num },
47 { "whatnowproc", &whatnowproc },
48 { "etcdir", &mhetcdir },
49 { "backup-prefix", &backup_prefix },
50 { "draft-folder", &draftfolder },
51 { "trash-folder", &trashfolder },
59 static char *p_find(char *);
63 main(int argc, char **argv)
65 int i, compp = 0, missed = 0;
66 int all = 0, debug = 0;
68 char *cp, buf[BUFSIZ], **argp;
69 char **arguments, *comps[MAXARGS];
71 invo_name = mhbasename(argv[0]);
73 /* read user profile/context */
76 arguments = getarguments(invo_name, argc, argv, 1);
79 while ((cp = *argp++)) {
81 switch (smatch(++cp, switches)) {
83 ambigsw(cp, switches);
86 adios(NULL, "-%s unknown", cp);
89 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
90 print_help(buf, switches, 1);
93 print_version(invo_name);
120 advise(NULL, "profile-components ignored with -all");
123 advise(NULL, "-%scomponents ignored with -all",
124 components ? "" : "no");
126 /* print all entries in context/profile list */
127 for (np = m_defs; np; np = np->n_next)
128 printf("%s: %s\n", np->n_name, np->n_field);
134 ** Print the current value of everything in
135 ** procs array. This will show their current
136 ** value (as determined after context is read).
138 for (ps = procs; ps->p_name; ps++)
139 printf("%s: %s\n", ps->p_name,
140 *ps->p_field ? *ps->p_field : "");
144 components = compp > 1;
146 for (i = 0; i < compp; i++) {
147 register char *value;
149 value = context_find(comps[i]);
151 value = p_find(comps[i]);
154 printf("%s: ", comps[i]);
156 printf("%s\n", value);
172 for (ps = procs; ps->p_name; ps++)
173 if (!mh_strcasecmp(ps->p_name, str))
174 return (*ps->p_field);