]>
diplodocus.org Git - nmh/blob - uip/mhparam.c
178520b7e78c4496ee840d8f4a530e5a067a76e6
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/error.h"
17 #define MHPARAM_SWITCHES \
18 X("components", 0, COMPSW) \
19 X("nocomponents", 0, NCOMPSW) \
21 X("version", 0, VERSIONSW) \
22 X("help", 0, HELPSW) \
23 X("debug", 5, DEBUGSW) \
25 #define X(sw, minchars, id) id,
26 DEFINE_SWITCH_ENUM(MHPARAM
);
29 #define X(sw, minchars, id) { sw, minchars, id },
30 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
33 extern char *mhbindir
;
34 extern char *mhlibexecdir
;
35 extern char *mhetcdir
;
36 extern char *mhdocdir
;
38 static char *sbackup
= BACKUP_PREFIX
;
40 static char *datalocking
= "fcntl";
41 static char *localmbox
= "";
42 static bool localmbox_primed
;
44 extern char *spoollocking
;
60 static char *mimetypeproc
=
67 static char *mimeencodingproc
=
68 #ifdef MIMEENCODINGPROC
93 static struct proc procs
[] = {
94 { "context", &context
},
95 { "mh-sequences", &mh_seq
},
96 { "buildmimeproc", &buildmimeproc
},
97 { "fileproc", &fileproc
},
98 { "foldprot", &foldprot
},
99 { "formatproc", &formatproc
},
100 { "incproc", &incproc
},
102 { "mailproc", &mailproc
},
103 { "mhlproc", &mhlproc
},
104 { "mimetypeproc", &mimetypeproc
},
105 { "mimeencodingproc", &mimeencodingproc
},
106 { "moreproc", &moreproc
},
107 { "msgprot", &msgprot
},
108 { "packproc", &packproc
},
109 { "postproc", &postproc
},
110 { "rmmproc", &rmmproc
},
111 { "sendproc", &sendproc
},
112 { "showmimeproc", &showmimeproc
},
113 { "showproc", &showproc
},
114 { "version", &version_num
},
115 { "whatnowproc", &whatnowproc
},
116 { "whomproc", &whomproc
},
117 { "bindir", &mhbindir
},
118 { "libexecdir", &mhlibexecdir
},
119 { "etcdir", &mhetcdir
},
120 { "docdir", &mhdocdir
},
121 { "localmbox", &localmbox
},
122 { "sbackup", &sbackup
},
123 { "datalocking", &datalocking
},
124 { "spoollocking", &spoollocking
},
136 static char *p_find(char *) PURE
;
140 main(int argc
, char **argv
)
147 char *cp
, buf
[BUFSIZ
], **argp
;
148 char **arguments
, *comps
[MAXARGS
];
150 if (nmh_init(argv
[0], true, false)) { return 1; }
152 arguments
= getarguments (invo_name
, argc
, argv
, 1);
155 while ((cp
= *argp
++)) {
157 switch (smatch (++cp
, switches
)) {
159 ambigsw (cp
, switches
);
162 die("-%s unknown", cp
);
165 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
167 print_help (buf
, switches
, 1);
170 print_version(invo_name
);
190 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
191 localmbox
= getlocalmbox();
192 localmbox_primed
= true;
201 inform("profile-components ignored with -all");
204 inform("-%scomponents ignored with -all",
205 components
? "" : "no");
207 /* Print all entries in context/profile list. That does not
208 include entries in mts.conf, such as spoollocking. */
209 for (np
= m_defs
; np
; np
= np
->n_next
)
210 printf("%s: %s\n", np
->n_name
, np
->n_field
);
217 /* In case datalocking was set in profile. */
218 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
220 /* In case spoollocking was set in mts.conf. */
223 /* Also set localmbox here */
224 if (! localmbox_primed
) {
225 localmbox
= getlocalmbox();
226 localmbox_primed
= true;
230 * Print the current value of everything in
231 * procs array. This will show their current
232 * value (as determined after context is read).
234 for (ps
= procs
; ps
->p_name
; ps
++)
235 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
242 components
= compp
> 1;
244 for (i
= 0; i
< compp
; i
++) {
247 if (! strcmp ("spoollocking", comps
[i
])) {
248 /* In case spoollocking was set in mts.conf. */
252 value
= context_find (comps
[i
]);
254 value
= p_find (comps
[i
]);
257 printf("%s: ", comps
[i
]);
274 for (ps
= procs
; ps
->p_name
; ps
++)
275 if (!strcasecmp (ps
->p_name
, str
))