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", 2 },
38 ** This list should contain all values of h/mh.h and config/config.c
39 ** TODO: Add the constants Nbby, MAXARGS, NUMATTRS, NAMESZ
41 static struct proc procs [] = {
42 { "#--Version--", &empty },
43 { "version", &version_num },
44 { "version-str", &version_str },
46 { "#--Path-and-File-Names--", &empty },
47 { "mypath", &mypath },
48 { "mmhdir", &mmhdir },
49 { "mmhpath", &mmhpath },
50 { "profile", &profile },
51 { "defpath", &defpath },
52 { "context", &context },
53 { "ctxpath", &ctxpath },
54 { "mhetcdir", &mhetcdir },
55 { "mailspool", &mailspool },
56 { "mailstore", &mailstore },
57 { "mh-sequences", &mh_seq },
59 { "#--Default-Programs--", &empty },
60 { "editor", &defaulteditor },
61 { "pager", &defaultpager },
62 { "sendmail", &sendmail },
63 { "listproc", &listproc },
64 { "whatnowproc", &whatnowproc },
65 { "mimetypequeryproc", &mimetypequeryproc },
67 { "#--Mail-Folder-Names--", &empty },
68 { "inbox", &defaultfolder },
69 { "draftfolder", &draftfolder },
70 { "trashfolder", &trashfolder },
72 { "#--Profile-and-Context-Component-Names--", &empty },
73 { "curfolder-component", &curfolder },
74 { "inbox-component", &inbox },
75 { "mimetypequery-component", &mimetypequery },
76 { "nmhstorage-component", &nmhstorage },
77 { "nsequence-component", &nsequence },
78 { "psequence-component", &psequence },
79 { "usequence-component", &usequence },
81 { "#--Mmh-specific-Mail-Header-Names--", &empty },
82 { "attachment-header", &attach_hdr },
83 { "enc-header", &enc_hdr },
84 { "sign-header", &sign_hdr },
86 { "#--File-Permissions--", &empty },
87 { "foldprot", &foldprot },
88 { "msgprot", &msgprot },
90 { "#--Template-File-Names--", &empty },
91 { "components", &components },
92 { "digestcomps", &digestcomps },
93 { "distcomps", &distcomps },
94 { "forwcomps", &forwcomps },
95 { "rcvdistcomps", &rcvdistcomps },
96 { "replcomps", &replcomps },
97 { "replgroupcomps", &replgroupcomps },
98 { "mhlformat", &mhlformat },
99 { "mhlreply", &mhlreply },
101 { "#--Default-Sequence-Names--", &empty },
102 { "seq-all", &seq_all },
103 { "seq-beyond", &seq_beyond },
104 { "seq-cur", &seq_cur },
105 { "seq-first", &seq_first },
106 { "seq-last", &seq_last },
107 { "seq-next", &seq_next },
108 { "previous-sequence", &seq_prev },
109 { "unseen-sequence", &seq_unseen },
110 { "sequence-negation", &seq_neg },
119 static char *p_find(char *);
123 main(int argc, char **argv)
125 int i, compp = 0, missed = 0;
126 int all = 0, debug = 0;
128 char *cp, buf[BUFSIZ], **argp;
129 char **arguments, *comps[MAXARGS];
131 invo_name = mhbasename(argv[0]);
135 arguments = getarguments(invo_name, argc, argv, 1);
138 while ((cp = *argp++)) {
140 switch (smatch(++cp, switches)) {
142 ambigsw(cp, switches);
143 /*sysexits.h EX_USAGE*/
146 adios(NULL, "-%s unknown", cp);
149 snprintf(buf, sizeof(buf), "%s [profile-components] [switches]", invo_name);
150 print_help(buf, switches, 1);
153 print_version(invo_name);
180 advise(NULL, "profile-components ignored with -all");
183 advise(NULL, "-%scomponents ignored with -all",
184 components ? "" : "no");
186 /* print all entries in context/profile list */
187 for (np = m_defs; np; np = np->n_next)
188 printf("%s: %s\n", np->n_name, np->n_field);
194 ** Print the current value of everything in
195 ** procs array. This will show their current
196 ** value (as determined after context is read).
198 for (ps = procs; ps->p_name; ps++)
199 printf("%s: %s\n", ps->p_name,
200 *ps->p_field ? *ps->p_field : "");
204 components = compp > 1;
206 for (i = 0; i < compp; i++) {
207 register char *value;
209 value = context_find(comps[i]);
211 value = p_find(comps[i]);
214 printf("%s: ", comps[i]);
216 printf("%s\n", value);
231 for (ps = procs; ps->p_name; ps++)
232 if (!mh_strcasecmp(ps->p_name, str))
233 return (*ps->p_field);