]>
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 extern char *mhlibdir
;
16 extern char *mhetcdir
;
18 char *sbackup
= BACKUP_PREFIX
;
20 #define MHPARAM_SWITCHES \
21 X("components", 0, COMPSW) \
22 X("nocomponents", 0, NCOMPSW) \
24 X("version", 0, VERSIONSW) \
25 X("help", 0, HELPSW) \
26 X("debug", 5, DEBUGSW) \
28 #define X(sw, minchars, id) id,
29 DEFINE_SWITCH_ENUM(MHPARAM
);
32 #define X(sw, minchars, id) { sw, minchars, id },
33 DEFINE_SWITCH_ARRAY(MHPARAM
, switches
);
41 static struct proc procs
[] = {
42 { "context", &context
},
43 { "mh-sequences", &mh_seq
},
44 { "buildmimeproc", &buildmimeproc
},
45 { "fileproc", &fileproc
},
46 { "foldprot", &foldprot
},
47 { "formatproc", &formatproc
},
48 { "incproc", &incproc
},
50 { "mailproc", &mailproc
},
51 { "mhlproc", &mhlproc
},
52 { "moreproc", &moreproc
},
53 { "msgprot", &msgprot
},
54 { "mshproc", &mshproc
},
55 { "packproc", &packproc
},
56 { "postproc", &postproc
},
57 { "rmmproc", &rmmproc
},
58 { "sendproc", &sendproc
},
59 { "showmimeproc", &showmimeproc
},
60 { "showproc", &showproc
},
61 { "version", &version_num
},
62 { "vmhproc", &vmhproc
},
63 { "whatnowproc", &whatnowproc
},
64 { "whomproc", &whomproc
},
65 { "etcdir", &mhetcdir
},
66 { "libdir", &mhlibdir
},
67 { "sbackup", &sbackup
},
75 static char *p_find(char *);
79 main(int argc
, char **argv
)
81 int i
, compp
= 0, missed
= 0;
82 int all
= 0, debug
= 0;
84 char *cp
, buf
[BUFSIZ
], **argp
;
85 char **arguments
, *comps
[MAXARGS
];
87 invo_name
= r1bindex (argv
[0], '/');
89 /* read user profile/context */
92 arguments
= getarguments (invo_name
, argc
, argv
, 1);
95 while ((cp
= *argp
++)) {
97 switch (smatch (++cp
, switches
)) {
99 ambigsw (cp
, switches
);
102 adios (NULL
, "-%s unknown", cp
);
105 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
107 print_help (buf
, switches
, 1);
110 print_version(invo_name
);
137 advise(NULL
, "profile-components ignored with -all");
140 advise(NULL
, "-%scomponents ignored with -all",
141 components
? "" : "no");
143 /* print all entries in context/profile list */
144 for (np
= m_defs
; np
; np
= np
->n_next
)
145 printf("%s: %s\n", np
->n_name
, np
->n_field
);
151 * Print the current value of everything in
152 * procs array. This will show their current
153 * value (as determined after context is read).
155 for (ps
= procs
; ps
->p_name
; ps
++)
156 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
160 components
= compp
> 1;
162 for (i
= 0; i
< compp
; i
++) {
163 register char *value
;
165 value
= context_find (comps
[i
]);
167 value
= p_find (comps
[i
]);
170 printf("%s: ", comps
[i
]);
172 printf("%s\n", value
);
188 for (ps
= procs
; ps
->p_name
; ps
++)
189 if (!mh_strcasecmp (ps
->p_name
, str
))
190 return (*ps
->p_field
);