]>
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
;
21 static struct swit switches
[] = {
25 { "nocomponents", 0 },
42 static struct proc procs
[] = {
43 { "context", &context
},
44 { "mh-sequences", &mh_seq
},
45 { "buildmimeproc", &buildmimeproc
},
46 { "faceproc", &faceproc
},
47 { "fileproc", &fileproc
},
48 { "foldprot", &foldprot
},
49 { "formatproc", &formatproc
},
50 { "incproc", &incproc
},
51 { "installproc", &installproc
},
53 { "mailproc", &mailproc
},
54 { "mhlproc", &mhlproc
},
55 { "moreproc", &moreproc
},
56 { "msgprot", &msgprot
},
57 { "mshproc", &mshproc
},
58 { "packproc", &packproc
},
59 { "postproc", &postproc
},
60 { "rmfproc", &rmfproc
},
61 { "rmmproc", &rmmproc
},
62 { "sendproc", &sendproc
},
63 { "showmimeproc", &showmimeproc
},
64 { "showproc", &showproc
},
65 { "version", &version_num
},
66 { "vmhproc", &vmhproc
},
67 { "whatnowproc", &whatnowproc
},
68 { "whomproc", &whomproc
},
69 { "etcdir", &mhetcdir
},
70 { "libdir", &mhlibdir
},
71 { "sbackup", &sbackup
},
80 static char *p_find(char *);
84 main(int argc
, char **argv
)
86 int i
, compp
= 0, missed
= 0;
87 int all
= 0, debug
= 0;
89 char *cp
, buf
[BUFSIZ
], **argp
;
90 char **arguments
, *comps
[MAXARGS
];
92 invo_name
= r1bindex (argv
[0], '/');
94 /* read user profile/context */
97 arguments
= getarguments (invo_name
, argc
, argv
, 1);
100 while ((cp
= *argp
++)) {
102 switch (smatch (++cp
, switches
)) {
104 ambigsw (cp
, switches
);
107 adios (NULL
, "-%s unknown", cp
);
110 snprintf (buf
, sizeof(buf
), "%s [profile-components] [switches]",
112 print_help (buf
, switches
, 1);
115 print_version(invo_name
);
142 advise(NULL
, "profile-components ignored with -all");
145 advise(NULL
, "-%scomponents ignored with -all",
146 components
? "" : "no");
148 /* print all entries in context/profile list */
149 for (np
= m_defs
; np
; np
= np
->n_next
)
150 printf("%s: %s\n", np
->n_name
, np
->n_field
);
156 * Print the current value of everything in
157 * procs array. This will show their current
158 * value (as determined after context is read).
160 for (ps
= procs
; ps
->p_name
; ps
++)
161 printf ("%s: %s\n", ps
->p_name
, *ps
->p_field
? *ps
->p_field
: "");
165 components
= compp
> 1;
167 for (i
= 0; i
< compp
; i
++) {
168 register char *value
;
170 value
= context_find (comps
[i
]);
172 value
= p_find (comps
[i
]);
175 printf("%s: ", comps
[i
]);
177 printf("%s\n", value
);
193 for (ps
= procs
; ps
->p_name
; ps
++)
194 if (!mh_strcasecmp (ps
->p_name
, str
))
195 return (*ps
->p_field
);