]>
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.
12 #include "sbr/print_version.h"
13 #include "sbr/print_help.h"
14 #include "sbr/error.h"
19 #define MHPARAM_SWITCHES \
20 X("components", 0, COMPSW) \
21 X("nocomponents", 0, NCOMPSW) \
23 X("version", 0, VERSIONSW) \
24 X("help", 0, HELPSW) \
25 X("debug", 5, DEBUGSW) \
27 #define X(sw, minchars, id) id,
28 DEFINE_SWITCH_ENUM(MHPARAM
);
31 #define X(sw, minchars, id) { sw, minchars, id },
32 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
35 extern char *mhbindir
;
36 extern char *mhlibexecdir
;
37 extern char *mhetcdir
;
38 extern char *mhdocdir
;
40 static char *sbackup
= BACKUP_PREFIX
;
42 static char *datalocking
= "fcntl";
43 static char *localmbox
= "";
44 static bool localmbox_primed
;
46 extern char *spoollocking
;
62 static char *mimetypeproc
=
69 static char *mimeencodingproc
=
70 #ifdef MIMEENCODINGPROC
95 static struct proc procs
[] = {
96 { "context", &context
},
97 { "mh-sequences", &mh_seq
},
98 { "buildmimeproc", &buildmimeproc
},
99 { "fileproc", &fileproc
},
100 { "foldprot", &foldprot
},
101 { "formatproc", &formatproc
},
102 { "incproc", &incproc
},
104 { "mailproc", &mailproc
},
105 { "mhlproc", &mhlproc
},
106 { "mimetypeproc", &mimetypeproc
},
107 { "mimeencodingproc", &mimeencodingproc
},
108 { "moreproc", &moreproc
},
109 { "msgprot", &msgprot
},
110 { "packproc", &packproc
},
111 { "postproc", &postproc
},
112 { "rmmproc", &rmmproc
},
113 { "sendproc", &sendproc
},
114 { "showmimeproc", &showmimeproc
},
115 { "showproc", &showproc
},
116 { "version", &version_num
},
117 { "whatnowproc", &whatnowproc
},
118 { "whomproc", &whomproc
},
119 { "bindir", &mhbindir
},
120 { "libexecdir", &mhlibexecdir
},
121 { "etcdir", &mhetcdir
},
122 { "docdir", &mhdocdir
},
123 { "localmbox", &localmbox
},
124 { "sbackup", &sbackup
},
125 { "datalocking", &datalocking
},
126 { "spoollocking", &spoollocking
},
138 static char *p_find(char *) PURE
;
142 main(int argc
, char **argv
)
149 char *cp
, buf
[BUFSIZ
], **argp
;
150 char **arguments
, *comps
[MAXARGS
];
152 if (nmh_init(argv
[0], true, false)) { return 1; }
154 arguments
= getarguments (invo_name
, argc
, argv
, 1);
157 while ((cp
= *argp
++)) {
159 switch (smatch (++cp
, switches
)) {
161 ambigsw (cp
, switches
);
164 die("-%s unknown", cp
);
167 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
169 print_help (buf
, switches
, 1);
172 print_version(invo_name
);
192 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
193 localmbox
= getlocalmbox();
194 localmbox_primed
= true;
203 inform("profile-components ignored with -all");
206 inform("-%scomponents ignored with -all",
207 components
? "" : "no");
209 /* Print all entries in context/profile list. That does not
210 include entries in mts.conf, such as spoollocking. */
211 for (np
= m_defs
; np
; np
= np
->n_next
)
212 printf("%s: %s\n", np
->n_name
, np
->n_field
);
219 /* In case datalocking was set in profile. */
220 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
222 /* In case spoollocking was set in mts.conf. */
225 /* Also set localmbox here */
226 if (! localmbox_primed
) {
227 localmbox
= getlocalmbox();
228 localmbox_primed
= true;
232 * Print the current value of everything in
233 * procs array. This will show their current
234 * value (as determined after context is read).
236 for (ps
= procs
; ps
->p_name
; ps
++)
237 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
244 components
= compp
> 1;
246 for (i
= 0; i
< compp
; i
++) {
249 if (! strcmp ("spoollocking", comps
[i
])) {
250 /* In case spoollocking was set in mts.conf. */
254 value
= context_find (comps
[i
]);
256 value
= p_find (comps
[i
]);
259 printf("%s: ", comps
[i
]);
276 for (ps
= procs
; ps
->p_name
; ps
++)
277 if (!strcasecmp (ps
->p_name
, str
))