]>
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
76 static struct proc procs
[] = {
77 { "context", &context
},
78 { "mh-sequences", &mh_seq
},
79 { "buildmimeproc", &buildmimeproc
},
80 { "fileproc", &fileproc
},
81 { "foldprot", &foldprot
},
82 { "formatproc", &formatproc
},
83 { "incproc", &incproc
},
85 { "mailproc", &mailproc
},
86 { "mhlproc", &mhlproc
},
87 { "mimetypeproc", &mimetypeproc
},
88 { "moreproc", &moreproc
},
89 { "msgprot", &msgprot
},
90 { "mshproc", &mshproc
},
91 { "packproc", &packproc
},
92 { "postproc", &postproc
},
93 { "rmmproc", &rmmproc
},
94 { "sendproc", &sendproc
},
95 { "showmimeproc", &showmimeproc
},
96 { "showproc", &showproc
},
97 { "version", &version_num
},
98 { "vmhproc", &vmhproc
},
99 { "whatnowproc", &whatnowproc
},
100 { "whomproc", &whomproc
},
101 { "etcdir", &mhetcdir
},
102 { "libdir", &mhlibdir
},
103 { "sbackup", &sbackup
},
104 { "lockmethod", &lockmethod
},
114 static char *p_find(char *);
118 main(int argc
, char **argv
)
120 int i
, compp
= 0, missed
= 0;
121 int all
= 0, debug
= 0;
123 char *cp
, buf
[BUFSIZ
], **argp
;
124 char **arguments
, *comps
[MAXARGS
];
126 invo_name
= r1bindex (argv
[0], '/');
128 /* read user profile/context */
131 arguments
= getarguments (invo_name
, argc
, argv
, 1);
134 while ((cp
= *argp
++)) {
136 switch (smatch (++cp
, switches
)) {
138 ambigsw (cp
, switches
);
141 adios (NULL
, "-%s unknown", cp
);
144 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
146 print_help (buf
, switches
, 1);
149 print_version(invo_name
);
176 advise(NULL
, "profile-components ignored with -all");
179 advise(NULL
, "-%scomponents ignored with -all",
180 components
? "" : "no");
182 /* print all entries in context/profile list */
183 for (np
= m_defs
; np
; np
= np
->n_next
)
184 printf("%s: %s\n", np
->n_name
, np
->n_field
);
190 * Print the current value of everything in
191 * procs array. This will show their current
192 * value (as determined after context is read).
194 for (ps
= procs
; ps
->p_name
; ps
++)
195 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
199 components
= compp
> 1;
201 for (i
= 0; i
< compp
; i
++) {
202 register char *value
;
204 value
= context_find (comps
[i
]);
206 value
= p_find (comps
[i
]);
209 printf("%s: ", comps
[i
]);
211 printf("%s\n", value
);
227 for (ps
= procs
; ps
->p_name
; ps
++)
228 if (!strcasecmp (ps
->p_name
, str
? str
: ""))
229 return (*ps
->p_field
);