]>
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
;
36 char *datalocking
= "fcntl";
38 extern char *spoollocking
;
61 char *mimeencodingproc
=
62 #ifdef MIMEENCODINGPROC
73 static struct proc procs
[] = {
74 { "context", &context
},
75 { "mh-sequences", &mh_seq
},
76 { "buildmimeproc", &buildmimeproc
},
77 { "fileproc", &fileproc
},
78 { "foldprot", &foldprot
},
79 { "formatproc", &formatproc
},
80 { "incproc", &incproc
},
82 { "mailproc", &mailproc
},
83 { "mhlproc", &mhlproc
},
84 { "mimetypeproc", &mimetypeproc
},
85 { "mimeencodingproc", &mimeencodingproc
},
86 { "moreproc", &moreproc
},
87 { "msgprot", &msgprot
},
88 { "mshproc", &mshproc
},
89 { "packproc", &packproc
},
90 { "postproc", &postproc
},
91 { "rmmproc", &rmmproc
},
92 { "sendproc", &sendproc
},
93 { "showmimeproc", &showmimeproc
},
94 { "showproc", &showproc
},
95 { "version", &version_num
},
96 { "vmhproc", &vmhproc
},
97 { "whatnowproc", &whatnowproc
},
98 { "whomproc", &whomproc
},
99 { "etcdir", &mhetcdir
},
100 { "libdir", &mhlibdir
},
101 { "sbackup", &sbackup
},
102 { "datalocking", &datalocking
},
103 { "spoollocking", &spoollocking
},
113 static char *p_find(char *);
117 main(int argc
, char **argv
)
119 int i
, compp
= 0, missed
= 0;
120 int all
= 0, debug
= 0;
122 char *cp
, buf
[BUFSIZ
], **argp
;
123 char **arguments
, *comps
[MAXARGS
];
125 if (nmh_init(argv
[0], 1)) { return 1; }
127 arguments
= getarguments (invo_name
, argc
, argv
, 1);
130 while ((cp
= *argp
++)) {
132 switch (smatch (++cp
, switches
)) {
134 ambigsw (cp
, switches
);
137 adios (NULL
, "-%s unknown", cp
);
140 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
142 print_help (buf
, switches
, 1);
145 print_version(invo_name
);
172 advise(NULL
, "profile-components ignored with -all");
175 advise(NULL
, "-%scomponents ignored with -all",
176 components
? "" : "no");
178 /* print all entries in context/profile list */
179 for (np
= m_defs
; np
; np
= np
->n_next
)
180 printf("%s: %s\n", np
->n_name
, np
->n_field
);
185 /* Need to see if datalocking was set in profile. */
186 if ((cp
= context_find("datalocking"))) { datalocking
= cp
; }
189 * Print the current value of everything in
190 * procs array. This will show their current
191 * value (as determined after context is read).
193 for (ps
= procs
; ps
->p_name
; ps
++)
194 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
198 components
= compp
> 1;
200 for (i
= 0; i
< compp
; i
++) {
201 register char *value
;
203 value
= context_find (comps
[i
]);
205 value
= p_find (comps
[i
]);
208 printf("%s: ", comps
[i
]);
210 printf("%s\n", value
);
226 for (ps
= procs
; ps
->p_name
; ps
++)
227 if (!strcasecmp (ps
->p_name
, str
? str
: ""))
228 return (*ps
->p_field
);