]>
diplodocus.org Git - nmh/blob - uip/mhparam.c
1 /* mhparam.c -- print mh_profile values
3 * Originally contributed by
4 * Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
6 * This code is Copyright (c) 2002, by the authors of nmh. See the
7 * COPYRIGHT file in the root directory of the nmh distribution for
8 * complete copyright information.
16 #define MHPARAM_SWITCHES \
17 X("components", 0, COMPSW) \
18 X("nocomponents", 0, NCOMPSW) \
20 X("version", 0, VERSIONSW) \
21 X("help", 0, HELPSW) \
22 X("debug", 5, DEBUGSW) \
24 #define X(sw, minchars, id) id,
25 DEFINE_SWITCH_ENUM(MHPARAM
);
28 #define X(sw, minchars, id) { sw, minchars, id },
29 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
32 extern char *mhbindir
;
33 extern char *mhlibexecdir
;
34 extern char *mhetcdir
;
35 extern char *mhdocdir
;
37 static char *sbackup
= BACKUP_PREFIX
;
39 static char *datalocking
= "fcntl";
40 static char *localmbox
= "";
41 static bool localmbox_primed
;
43 extern char *spoollocking
;
59 static char *mimetypeproc
=
66 static char *mimeencodingproc
=
67 #ifdef MIMEENCODINGPROC
92 static struct proc procs
[] = {
93 { "context", &context
},
94 { "mh-sequences", &mh_seq
},
95 { "buildmimeproc", &buildmimeproc
},
96 { "fileproc", &fileproc
},
97 { "foldprot", &foldprot
},
98 { "formatproc", &formatproc
},
99 { "incproc", &incproc
},
101 { "mailproc", &mailproc
},
102 { "mhlproc", &mhlproc
},
103 { "mimetypeproc", &mimetypeproc
},
104 { "mimeencodingproc", &mimeencodingproc
},
105 { "moreproc", &moreproc
},
106 { "msgprot", &msgprot
},
107 { "packproc", &packproc
},
108 { "postproc", &postproc
},
109 { "rmmproc", &rmmproc
},
110 { "sendproc", &sendproc
},
111 { "showmimeproc", &showmimeproc
},
112 { "showproc", &showproc
},
113 { "version", &version_num
},
114 { "whatnowproc", &whatnowproc
},
115 { "whomproc", &whomproc
},
116 { "bindir", &mhbindir
},
117 { "libexecdir", &mhlibexecdir
},
118 { "etcdir", &mhetcdir
},
119 { "docdir", &mhdocdir
},
120 { "localmbox", &localmbox
},
121 { "sbackup", &sbackup
},
122 { "datalocking", &datalocking
},
123 { "spoollocking", &spoollocking
},
135 static char *p_find(char *) PURE
;
139 main(int argc
, char **argv
)
146 char *cp
, buf
[BUFSIZ
], **argp
;
147 char **arguments
, *comps
[MAXARGS
];
149 if (nmh_init(argv
[0], true, false)) { return 1; }
151 arguments
= getarguments (invo_name
, argc
, argv
, 1);
154 while ((cp
= *argp
++)) {
156 switch (smatch (++cp
, switches
)) {
158 ambigsw (cp
, switches
);
161 die("-%s unknown", cp
);
164 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
166 print_help (buf
, switches
, 1);
169 print_version(invo_name
);
189 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
190 localmbox
= getlocalmbox();
191 localmbox_primed
= true;
200 inform("profile-components ignored with -all");
203 inform("-%scomponents ignored with -all",
204 components
? "" : "no");
206 /* Print all entries in context/profile list. That does not
207 include entries in mts.conf, such as spoollocking. */
208 for (np
= m_defs
; np
; np
= np
->n_next
)
209 printf("%s: %s\n", np
->n_name
, np
->n_field
);
216 /* In case datalocking was set in profile. */
217 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
219 /* In case spoollocking was set in mts.conf. */
222 /* Also set localmbox here */
223 if (! localmbox_primed
) {
224 localmbox
= getlocalmbox();
225 localmbox_primed
= true;
229 * Print the current value of everything in
230 * procs array. This will show their current
231 * value (as determined after context is read).
233 for (ps
= procs
; ps
->p_name
; ps
++)
234 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
241 components
= compp
> 1;
243 for (i
= 0; i
< compp
; i
++) {
246 if (! strcmp ("spoollocking", comps
[i
])) {
247 /* In case spoollocking was set in mts.conf. */
251 value
= context_find (comps
[i
]);
253 value
= p_find (comps
[i
]);
256 printf("%s: ", comps
[i
]);
273 for (ps
= procs
; ps
->p_name
; ps
++)
274 if (!strcasecmp (ps
->p_name
, str
))