]>
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.
15 #define MHPARAM_SWITCHES \
16 X("components", 0, COMPSW) \
17 X("nocomponents", 0, NCOMPSW) \
19 X("version", 0, VERSIONSW) \
20 X("help", 0, HELPSW) \
21 X("debug", 5, DEBUGSW) \
23 #define X(sw, minchars, id) id,
24 DEFINE_SWITCH_ENUM(MHPARAM
);
27 #define X(sw, minchars, id) { sw, minchars, id },
28 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
31 extern char *mhbindir
;
32 extern char *mhlibexecdir
;
33 extern char *mhetcdir
;
34 extern char *mhdocdir
;
36 static char *sbackup
= BACKUP_PREFIX
;
38 static char *datalocking
= "fcntl";
39 static char *localmbox
= "";
40 static int localmbox_primed
= 0;
42 extern char *spoollocking
;
58 static char *mimetypeproc
=
65 static char *mimeencodingproc
=
66 #ifdef MIMEENCODINGPROC
91 static struct proc procs
[] = {
92 { "context", &context
},
93 { "mh-sequences", &mh_seq
},
94 { "buildmimeproc", &buildmimeproc
},
95 { "fileproc", &fileproc
},
96 { "foldprot", &foldprot
},
97 { "formatproc", &formatproc
},
98 { "incproc", &incproc
},
100 { "mailproc", &mailproc
},
101 { "mhlproc", &mhlproc
},
102 { "mimetypeproc", &mimetypeproc
},
103 { "mimeencodingproc", &mimeencodingproc
},
104 { "moreproc", &moreproc
},
105 { "msgprot", &msgprot
},
106 { "packproc", &packproc
},
107 { "postproc", &postproc
},
108 { "rmmproc", &rmmproc
},
109 { "sendproc", &sendproc
},
110 { "showmimeproc", &showmimeproc
},
111 { "showproc", &showproc
},
112 { "version", &version_num
},
113 { "whatnowproc", &whatnowproc
},
114 { "whomproc", &whomproc
},
115 { "bindir", &mhbindir
},
116 { "libexecdir", &mhlibexecdir
},
117 { "libdir", &mhlibexecdir
},
118 { "etcdir", &mhetcdir
},
119 { "docdir", &mhdocdir
},
120 { "localmbox", &localmbox
},
121 { "sbackup", &sbackup
},
122 { "datalocking", &datalocking
},
123 { "spoollocking", &spoollocking
},
135 static char *p_find(char *);
139 main(int argc
, char **argv
)
141 int i
, compp
= 0, missed
= 0;
142 int all
= 0, debug
= 0;
144 char *cp
, buf
[BUFSIZ
], **argp
;
145 char **arguments
, *comps
[MAXARGS
];
147 if (nmh_init(argv
[0], 2)) { return 1; }
149 arguments
= getarguments (invo_name
, argc
, argv
, 1);
152 while ((cp
= *argp
++)) {
154 switch (smatch (++cp
, switches
)) {
156 ambigsw (cp
, switches
);
159 adios (NULL
, "-%s unknown", cp
);
162 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
164 print_help (buf
, switches
, 1);
167 print_version(invo_name
);
187 if (strcmp("localmbox", cp
) == 0 && ! localmbox_primed
) {
188 localmbox
= getlocalmbox();
189 localmbox_primed
= 1;
198 inform("profile-components ignored with -all");
201 inform("-%scomponents ignored with -all",
202 components
? "" : "no");
204 /* Print all entries in context/profile list. That does not
205 include entries in mts.conf, such as spoollocking. */
206 for (np
= m_defs
; np
; np
= np
->n_next
)
207 printf("%s: %s\n", np
->n_name
, np
->n_field
);
214 /* In case datalocking was set in profile. */
215 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
217 /* In case spoollocking was set in mts.conf. */
220 /* Also set localmbox here */
221 if (! localmbox_primed
) {
222 localmbox
= getlocalmbox();
223 localmbox_primed
= 1;
227 * Print the current value of everything in
228 * procs array. This will show their current
229 * value (as determined after context is read).
231 for (ps
= procs
; ps
->p_name
; ps
++)
232 printf ("%s: %s\n", ps
->p_name
, FENDNULL(*ps
->p_field
));
238 components
= compp
> 1;
240 for (i
= 0; i
< compp
; i
++) {
243 if (! strcmp ("spoollocking", comps
[i
])) {
244 /* In case spoollocking was set in mts.conf. */
248 value
= context_find (comps
[i
]);
250 value
= p_find (comps
[i
]);
253 printf("%s: ", comps
[i
]);
256 } else if (missed
< 120)
271 for (ps
= procs
; ps
->p_name
; ps
++)
272 if (!strcasecmp (ps
->p_name
, str
))
273 return (*ps
->p_field
);