]>
diplodocus.org Git - nmh/blob - uip/mhparam.c
3 * mhparam.c -- print mh_profile values
5 * Originally contributed by
6 * Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
8 * This code is Copyright (c) 2002, by the authors of nmh. See the
9 * COPYRIGHT file in the root directory of the nmh distribution for
10 * 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 int localmbox_primed
= 0;
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 { "libdir", &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 *);
140 main(int argc
, char **argv
)
142 int i
, compp
= 0, missed
= 0;
143 int all
= 0, debug
= 0;
145 char *cp
, buf
[BUFSIZ
], **argp
;
146 char **arguments
, *comps
[MAXARGS
];
148 if (nmh_init(argv
[0], 2)) { return 1; }
150 arguments
= getarguments (invo_name
, argc
, argv
, 1);
153 while ((cp
= *argp
++)) {
155 switch (smatch (++cp
, switches
)) {
157 ambigsw (cp
, switches
);
160 adios (NULL
, "-%s unknown", cp
);
163 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
165 print_help (buf
, switches
, 1);
168 print_version(invo_name
);
188 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
189 localmbox
= getlocalmbox();
190 localmbox_primed
= 1;
199 advise(NULL
, "profile-components ignored with -all");
202 advise(NULL
, "-%scomponents ignored with -all",
203 components
? "" : "no");
205 /* Print all entries in context/profile list. That does not
206 include entries in mts.conf, such as spoollocking. */
207 for (np
= m_defs
; np
; np
= np
->n_next
)
208 printf("%s: %s\n", np
->n_name
, np
->n_field
);
215 /* In case datalocking was set in profile. */
216 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
218 /* In case spoollocking was set in mts.conf. */
221 /* Also set localmbox here */
222 if (! localmbox_primed
) {
223 localmbox
= getlocalmbox();
224 localmbox_primed
= 1;
228 * Print the current value of everything in
229 * procs array. This will show their current
230 * value (as determined after context is read).
232 for (ps
= procs
; ps
->p_name
; ps
++)
233 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
239 components
= compp
> 1;
241 for (i
= 0; i
< compp
; i
++) {
244 if (! strcmp ("spoollocking", comps
[i
])) {
245 /* In case spoollocking was set in mts.conf. */
249 value
= context_find (comps
[i
]);
251 value
= p_find (comps
[i
]);
254 printf("%s: ", comps
[i
]);
257 } else if (missed
< 120)
272 for (ps
= procs
; ps
->p_name
; ps
++)
273 if (!strcasecmp (ps
->p_name
, str
))
274 return (*ps
->p_field
);