]>
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.
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 *mhlibdir
;
32 extern char *mhetcdir
;
34 char *sbackup
= BACKUP_PREFIX
;
37 #if defined FCNTL_LOCKING
39 #elif defined FLOCK_LOCKING
41 #elif defined LOCKF_LOCKING
43 #elif defined DOT_LOCKING
71 char *mimeencodingproc
=
72 #ifdef MIMEENCODINGPROC
83 static struct proc procs
[] = {
84 { "context", &context
},
85 { "mh-sequences", &mh_seq
},
86 { "buildmimeproc", &buildmimeproc
},
87 { "fileproc", &fileproc
},
88 { "foldprot", &foldprot
},
89 { "formatproc", &formatproc
},
90 { "incproc", &incproc
},
92 { "mailproc", &mailproc
},
93 { "mhlproc", &mhlproc
},
94 { "mimetypeproc", &mimetypeproc
},
95 { "mimeencodingproc", &mimeencodingproc
},
96 { "moreproc", &moreproc
},
97 { "msgprot", &msgprot
},
98 { "mshproc", &mshproc
},
99 { "packproc", &packproc
},
100 { "postproc", &postproc
},
101 { "rmmproc", &rmmproc
},
102 { "sendproc", &sendproc
},
103 { "showmimeproc", &showmimeproc
},
104 { "showproc", &showproc
},
105 { "version", &version_num
},
106 { "vmhproc", &vmhproc
},
107 { "whatnowproc", &whatnowproc
},
108 { "whomproc", &whomproc
},
109 { "etcdir", &mhetcdir
},
110 { "libdir", &mhlibdir
},
111 { "sbackup", &sbackup
},
112 { "lockmethod", &lockmethod
},
122 static char *p_find(char *);
126 main(int argc
, char **argv
)
128 int i
, compp
= 0, missed
= 0;
129 int all
= 0, debug
= 0;
131 char *cp
, buf
[BUFSIZ
], **argp
;
132 char **arguments
, *comps
[MAXARGS
];
134 if (nmh_init(argv
[0], 1)) { return 1; }
136 arguments
= getarguments (invo_name
, argc
, argv
, 1);
139 while ((cp
= *argp
++)) {
141 switch (smatch (++cp
, switches
)) {
143 ambigsw (cp
, switches
);
146 adios (NULL
, "-%s unknown", cp
);
149 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
151 print_help (buf
, switches
, 1);
154 print_version(invo_name
);
181 advise(NULL
, "profile-components ignored with -all");
184 advise(NULL
, "-%scomponents ignored with -all",
185 components
? "" : "no");
187 /* print all entries in context/profile list */
188 for (np
= m_defs
; np
; np
= np
->n_next
)
189 printf("%s: %s\n", np
->n_name
, np
->n_field
);
195 * Print the current value of everything in
196 * procs array. This will show their current
197 * value (as determined after context is read).
199 for (ps
= procs
; ps
->p_name
; ps
++)
200 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
204 components
= compp
> 1;
206 for (i
= 0; i
< compp
; i
++) {
207 register char *value
;
209 value
= context_find (comps
[i
]);
211 value
= p_find (comps
[i
]);
214 printf("%s: ", comps
[i
]);
216 printf("%s\n", value
);
232 for (ps
= procs
; ps
->p_name
; ps
++)
233 if (!strcasecmp (ps
->p_name
, str
? str
: ""))
234 return (*ps
->p_field
);