]>
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
55 static struct proc procs
[] = {
56 { "context", &context
},
57 { "mh-sequences", &mh_seq
},
58 { "buildmimeproc", &buildmimeproc
},
59 { "fileproc", &fileproc
},
60 { "foldprot", &foldprot
},
61 { "formatproc", &formatproc
},
62 { "incproc", &incproc
},
64 { "mailproc", &mailproc
},
65 { "mhlproc", &mhlproc
},
66 { "moreproc", &moreproc
},
67 { "msgprot", &msgprot
},
68 { "mshproc", &mshproc
},
69 { "packproc", &packproc
},
70 { "postproc", &postproc
},
71 { "rmmproc", &rmmproc
},
72 { "sendproc", &sendproc
},
73 { "showmimeproc", &showmimeproc
},
74 { "showproc", &showproc
},
75 { "version", &version_num
},
76 { "vmhproc", &vmhproc
},
77 { "whatnowproc", &whatnowproc
},
78 { "whomproc", &whomproc
},
79 { "etcdir", &mhetcdir
},
80 { "libdir", &mhlibdir
},
81 { "sbackup", &sbackup
},
82 { "lockmethod", &lockmethod
},
90 static char *p_find(char *);
94 main(int argc
, char **argv
)
96 int i
, compp
= 0, missed
= 0;
97 int all
= 0, debug
= 0;
99 char *cp
, buf
[BUFSIZ
], **argp
;
100 char **arguments
, *comps
[MAXARGS
];
102 invo_name
= r1bindex (argv
[0], '/');
104 /* read user profile/context */
107 arguments
= getarguments (invo_name
, argc
, argv
, 1);
110 while ((cp
= *argp
++)) {
112 switch (smatch (++cp
, switches
)) {
114 ambigsw (cp
, switches
);
117 adios (NULL
, "-%s unknown", cp
);
120 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
122 print_help (buf
, switches
, 1);
125 print_version(invo_name
);
152 advise(NULL
, "profile-components ignored with -all");
155 advise(NULL
, "-%scomponents ignored with -all",
156 components
? "" : "no");
158 /* print all entries in context/profile list */
159 for (np
= m_defs
; np
; np
= np
->n_next
)
160 printf("%s: %s\n", np
->n_name
, np
->n_field
);
166 * Print the current value of everything in
167 * procs array. This will show their current
168 * value (as determined after context is read).
170 for (ps
= procs
; ps
->p_name
; ps
++)
171 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
175 components
= compp
> 1;
177 for (i
= 0; i
< compp
; i
++) {
178 register char *value
;
180 value
= context_find (comps
[i
]);
182 value
= p_find (comps
[i
]);
185 printf("%s: ", comps
[i
]);
187 printf("%s\n", value
);
203 for (ps
= procs
; ps
->p_name
; ps
++)
204 if (!strcasecmp (ps
->p_name
, str
? str
: ""))
205 return (*ps
->p_field
);