]>
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.
14 #define MHPARAM_SWITCHES \
15 X("components", 0, COMPSW) \
16 X("nocomponents", 0, NCOMPSW) \
18 X("version", 0, VERSIONSW) \
19 X("help", 0, HELPSW) \
20 X("debug", 5, DEBUGSW) \
22 #define X(sw, minchars, id) id,
23 DEFINE_SWITCH_ENUM(MHPARAM
);
26 #define X(sw, minchars, id) { sw, minchars, id },
27 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
30 extern char *mhbindir
;
31 extern char *mhlibexecdir
;
32 extern char *mhetcdir
;
33 extern char *mhdocdir
;
35 static char *sbackup
= BACKUP_PREFIX
;
37 static char *datalocking
= "fcntl";
38 static char *localmbox
= "";
39 static int localmbox_primed
= 0;
41 extern char *spoollocking
;
57 static char *mimetypeproc
=
64 static char *mimeencodingproc
=
65 #ifdef MIMEENCODINGPROC
90 static struct proc procs
[] = {
91 { "context", &context
},
92 { "mh-sequences", &mh_seq
},
93 { "buildmimeproc", &buildmimeproc
},
94 { "fileproc", &fileproc
},
95 { "foldprot", &foldprot
},
96 { "formatproc", &formatproc
},
97 { "incproc", &incproc
},
99 { "mailproc", &mailproc
},
100 { "mhlproc", &mhlproc
},
101 { "mimetypeproc", &mimetypeproc
},
102 { "mimeencodingproc", &mimeencodingproc
},
103 { "moreproc", &moreproc
},
104 { "msgprot", &msgprot
},
105 { "packproc", &packproc
},
106 { "postproc", &postproc
},
107 { "rmmproc", &rmmproc
},
108 { "sendproc", &sendproc
},
109 { "showmimeproc", &showmimeproc
},
110 { "showproc", &showproc
},
111 { "version", &version_num
},
112 { "whatnowproc", &whatnowproc
},
113 { "whomproc", &whomproc
},
114 { "bindir", &mhbindir
},
115 { "libexecdir", &mhlibexecdir
},
116 { "libdir", &mhlibexecdir
},
117 { "etcdir", &mhetcdir
},
118 { "docdir", &mhdocdir
},
119 { "localmbox", &localmbox
},
120 { "sbackup", &sbackup
},
121 { "datalocking", &datalocking
},
122 { "spoollocking", &spoollocking
},
134 static char *p_find(char *);
138 main(int argc
, char **argv
)
140 int i
, compp
= 0, missed
= 0;
141 int all
= 0, debug
= 0;
143 char *cp
, buf
[BUFSIZ
], **argp
;
144 char **arguments
, *comps
[MAXARGS
];
146 if (nmh_init(argv
[0], 2)) { return 1; }
148 arguments
= getarguments (invo_name
, argc
, argv
, 1);
151 while ((cp
= *argp
++)) {
153 switch (smatch (++cp
, switches
)) {
155 ambigsw (cp
, switches
);
158 adios (NULL
, "-%s unknown", cp
);
161 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
163 print_help (buf
, switches
, 1);
166 print_version(invo_name
);
186 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
187 localmbox
= getlocalmbox();
188 localmbox_primed
= 1;
197 inform("profile-components ignored with -all");
200 inform("-%scomponents ignored with -all",
201 components
? "" : "no");
203 /* Print all entries in context/profile list. That does not
204 include entries in mts.conf, such as spoollocking. */
205 for (np
= m_defs
; np
; np
= np
->n_next
)
206 printf("%s: %s\n", np
->n_name
, np
->n_field
);
213 /* In case datalocking was set in profile. */
214 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
216 /* In case spoollocking was set in mts.conf. */
219 /* Also set localmbox here */
220 if (! localmbox_primed
) {
221 localmbox
= getlocalmbox();
222 localmbox_primed
= 1;
226 * Print the current value of everything in
227 * procs array. This will show their current
228 * value (as determined after context is read).
230 for (ps
= procs
; ps
->p_name
; ps
++)
231 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
237 components
= compp
> 1;
239 for (i
= 0; i
< compp
; i
++) {
242 if (! strcmp ("spoollocking", comps
[i
])) {
243 /* In case spoollocking was set in mts.conf. */
247 value
= context_find (comps
[i
]);
249 value
= p_find (comps
[i
]);
252 printf("%s: ", comps
[i
]);
255 } else if (missed
< 120)
270 for (ps
= procs
; ps
->p_name
; ps
++)
271 if (!strcasecmp (ps
->p_name
, str
))
272 return (*ps
->p_field
);