]>
diplodocus.org Git - nmh/blob - uip/mhparam.c
33f0657477adecbf6816e8c8ca23f331fe6eeb08
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 *mhlibdir
;
33 extern char *mhetcdir
;
35 static char *sbackup
= BACKUP_PREFIX
;
37 static char *datalocking
= "fcntl";
38 static char *localmbox
= "";
40 extern char *spoollocking
;
56 static char *mimetypeproc
=
63 static char *mimeencodingproc
=
64 #ifdef MIMEENCODINGPROC
82 static struct proc procs
[] = {
83 { "context", &context
},
84 { "mh-sequences", &mh_seq
},
85 { "buildmimeproc", &buildmimeproc
},
86 { "fileproc", &fileproc
},
87 { "foldprot", &foldprot
},
88 { "formatproc", &formatproc
},
89 { "incproc", &incproc
},
91 { "mailproc", &mailproc
},
92 { "mhlproc", &mhlproc
},
93 { "mimetypeproc", &mimetypeproc
},
94 { "mimeencodingproc", &mimeencodingproc
},
95 { "moreproc", &moreproc
},
96 { "msgprot", &msgprot
},
97 { "mshproc", &mshproc
},
98 { "packproc", &packproc
},
99 { "postproc", &postproc
},
100 { "rmmproc", &rmmproc
},
101 { "sendproc", &sendproc
},
102 { "showmimeproc", &showmimeproc
},
103 { "showproc", &showproc
},
104 { "version", &version_num
},
105 { "vmhproc", &vmhproc
},
106 { "whatnowproc", &whatnowproc
},
107 { "whomproc", &whomproc
},
108 { "etcdir", &mhetcdir
},
109 { "libdir", &mhlibdir
},
110 { "localmbox", &localmbox
},
111 { "sbackup", &sbackup
},
112 { "datalocking", &datalocking
},
113 { "spoollocking", &spoollocking
},
124 static char *p_find(char *);
128 main(int argc
, char **argv
)
130 int i
, compp
= 0, missed
= 0;
131 int all
= 0, debug
= 0;
133 char *cp
, buf
[BUFSIZ
], **argp
;
134 char **arguments
, *comps
[MAXARGS
];
136 if (nmh_init(argv
[0], 1)) { return 1; }
138 arguments
= getarguments (invo_name
, argc
, argv
, 1);
141 while ((cp
= *argp
++)) {
143 switch (smatch (++cp
, switches
)) {
145 ambigsw (cp
, switches
);
148 adios (NULL
, "-%s unknown", cp
);
151 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
153 print_help (buf
, switches
, 1);
156 print_version(invo_name
);
183 advise(NULL
, "profile-components ignored with -all");
186 advise(NULL
, "-%scomponents ignored with -all",
187 components
? "" : "no");
189 /* print all entries in context/profile list */
190 for (np
= m_defs
; np
; np
= np
->n_next
)
191 printf("%s: %s\n", np
->n_name
, np
->n_field
);
196 /* Need to see if datalocking was set in profile. */
197 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
199 /* Also set localmbox here */
200 localmbox
= getlocalmbox();
203 * Print the current value of everything in
204 * procs array. This will show their current
205 * value (as determined after context is read).
207 for (ps
= procs
; ps
->p_name
; ps
++)
208 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
212 components
= compp
> 1;
214 for (i
= 0; i
< compp
; i
++) {
215 register char *value
;
217 value
= context_find (comps
[i
]);
219 value
= p_find (comps
[i
]);
222 printf("%s: ", comps
[i
]);
224 printf("%s\n", value
);
240 for (ps
= procs
; ps
->p_name
; ps
++)
241 if (!strcasecmp (ps
->p_name
, str
? str
: ""))
242 return (*ps
->p_field
);