]>
diplodocus.org Git - nmh/blob - uip/mhparam.c
d31c825d1903e2e6c20bb415117175436b33378f
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.
12 #include "sbr/print_help.h"
13 #include "sbr/error.h"
18 #define MHPARAM_SWITCHES \
19 X("components", 0, COMPSW) \
20 X("nocomponents", 0, NCOMPSW) \
22 X("version", 0, VERSIONSW) \
23 X("help", 0, HELPSW) \
24 X("debug", 5, DEBUGSW) \
26 #define X(sw, minchars, id) id,
27 DEFINE_SWITCH_ENUM(MHPARAM
);
30 #define X(sw, minchars, id) { sw, minchars, id },
31 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
34 extern char *mhbindir
;
35 extern char *mhlibexecdir
;
36 extern char *mhetcdir
;
37 extern char *mhdocdir
;
39 static char *sbackup
= BACKUP_PREFIX
;
41 static char *datalocking
= "fcntl";
42 static char *localmbox
= "";
43 static bool localmbox_primed
;
45 extern char *spoollocking
;
61 static char *mimetypeproc
=
68 static char *mimeencodingproc
=
69 #ifdef MIMEENCODINGPROC
94 static struct proc procs
[] = {
95 { "context", &context
},
96 { "mh-sequences", &mh_seq
},
97 { "buildmimeproc", &buildmimeproc
},
98 { "fileproc", &fileproc
},
99 { "foldprot", &foldprot
},
100 { "formatproc", &formatproc
},
101 { "incproc", &incproc
},
103 { "mailproc", &mailproc
},
104 { "mhlproc", &mhlproc
},
105 { "mimetypeproc", &mimetypeproc
},
106 { "mimeencodingproc", &mimeencodingproc
},
107 { "moreproc", &moreproc
},
108 { "msgprot", &msgprot
},
109 { "packproc", &packproc
},
110 { "postproc", &postproc
},
111 { "rmmproc", &rmmproc
},
112 { "sendproc", &sendproc
},
113 { "showmimeproc", &showmimeproc
},
114 { "showproc", &showproc
},
115 { "version", &version_num
},
116 { "whatnowproc", &whatnowproc
},
117 { "whomproc", &whomproc
},
118 { "bindir", &mhbindir
},
119 { "libexecdir", &mhlibexecdir
},
120 { "etcdir", &mhetcdir
},
121 { "docdir", &mhdocdir
},
122 { "localmbox", &localmbox
},
123 { "sbackup", &sbackup
},
124 { "datalocking", &datalocking
},
125 { "spoollocking", &spoollocking
},
137 static char *p_find(char *) PURE
;
141 main(int argc
, char **argv
)
148 char *cp
, buf
[BUFSIZ
], **argp
;
149 char **arguments
, *comps
[MAXARGS
];
151 if (nmh_init(argv
[0], true, false)) { return 1; }
153 arguments
= getarguments (invo_name
, argc
, argv
, 1);
156 while ((cp
= *argp
++)) {
158 switch (smatch (++cp
, switches
)) {
160 ambigsw (cp
, switches
);
163 die("-%s unknown", cp
);
166 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
168 print_help (buf
, switches
, 1);
171 print_version(invo_name
);
191 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
192 localmbox
= getlocalmbox();
193 localmbox_primed
= true;
202 inform("profile-components ignored with -all");
205 inform("-%scomponents ignored with -all",
206 components
? "" : "no");
208 /* Print all entries in context/profile list. That does not
209 include entries in mts.conf, such as spoollocking. */
210 for (np
= m_defs
; np
; np
= np
->n_next
)
211 printf("%s: %s\n", np
->n_name
, np
->n_field
);
218 /* In case datalocking was set in profile. */
219 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
221 /* In case spoollocking was set in mts.conf. */
224 /* Also set localmbox here */
225 if (! localmbox_primed
) {
226 localmbox
= getlocalmbox();
227 localmbox_primed
= true;
231 * Print the current value of everything in
232 * procs array. This will show their current
233 * value (as determined after context is read).
235 for (ps
= procs
; ps
->p_name
; ps
++)
236 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
243 components
= compp
> 1;
245 for (i
= 0; i
< compp
; i
++) {
248 if (! strcmp ("spoollocking", comps
[i
])) {
249 /* In case spoollocking was set in mts.conf. */
253 value
= context_find (comps
[i
]);
255 value
= p_find (comps
[i
]);
258 printf("%s: ", comps
[i
]);
275 for (ps
= procs
; ps
->p_name
; ps
++)
276 if (!strcasecmp (ps
->p_name
, str
))