summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dbf7c84)
raw allows to output a header as in the input, no changes are done
by mhl. This is written for whatnow2. whatnow2 shall safe some data
in the draft and use mhl with ignore to remove this data. Also other tools can
use mhl to filter some header fields out of a message without changing the
message itself.
#define SPLIT 0x001000 /* split headers (don't concatenate) */
#define NONEWLINE 0x002000 /* don't write trailing newline */
#define RTRIM 0x004000 /* trim trailing whitespace */
#define SPLIT 0x001000 /* split headers (don't concatenate) */
#define NONEWLINE 0x002000 /* don't write trailing newline */
#define RTRIM 0x004000 /* trim trailing whitespace */
-#define LBITS "\020\01NOCOMPONENT\02UPPERCASE\03CENTER\04CLEARTEXT\05EXTRA\06HDROUTPUT\07LEFTADJUST\010COMPRESS\011ADDRFMT\012DATEFMT\013FORMAT\014INIT\015SPLIT\016NONEWLINE\017RTRIM"
+#define RAW 0x008000 /* print the raw input */
+#define LBITS "\020\01NOCOMPONENT\02UPPERCASE\03CENTER\04CLEARTEXT\05EXTRA\06HDROUTPUT\07LEFTADJUST\010COMPRESS\011ADDRFMT\012DATEFMT\013FORMAT\014INIT\015SPLIT\016NONEWLINE\017RTRIM\020RAW"
#define GFLAGS (NOCOMPONENT | UPPERCASE | CENTER | LEFTADJUST | COMPRESS | SPLIT)
struct mcomp {
#define GFLAGS (NOCOMPONENT | UPPERCASE | CENTER | LEFTADJUST | COMPRESS | SPLIT)
struct mcomp {
static struct triple triples[] = {
{ "nocomponent", NOCOMPONENT, 0 },
static struct triple triples[] = {
{ "nocomponent", NOCOMPONENT, 0 },
- { "uppercase", UPPERCASE, 0 },
+ { "uppercase", UPPERCASE, RAW },
{ "nouppercase", 0, UPPERCASE },
{ "nouppercase", 0, UPPERCASE },
- { "center", CENTER, 0 },
+ { "center", CENTER, RAW },
{ "nocenter", 0, CENTER },
{ "nocenter", 0, CENTER },
- { "leftadjust", LEFTADJUST, 0 },
+ { "leftadjust", LEFTADJUST, RAW },
{ "noleftadjust", 0, LEFTADJUST },
{ "noleftadjust", 0, LEFTADJUST },
- { "compress", COMPRESS, 0 },
+ { "compress", COMPRESS, RAW },
{ "nocompress", 0, COMPRESS },
{ "split", SPLIT, 0 },
{ "nosplit", 0, SPLIT },
{ "nocompress", 0, COMPRESS },
{ "split", SPLIT, 0 },
{ "nosplit", 0, SPLIT },
+ { "rtrim", RTRIM, RAW },
- { "addrfield", ADDRFMT, DATEFMT },
- { "datefield", DATEFMT, ADDRFMT },
- { "newline", 0, NONEWLINE },
+ { "raw", RAW|SPLIT|NOCOMPONENT|NONEWLINE, UPPERCASE|CENTER|LEFTADJUST|COMPRESS|DATEFMT|ADDRFMT },
+ { "addrfield", ADDRFMT, DATEFMT|RAW },
+ { "datefield", DATEFMT, ADDRFMT|RAW },
+ { "newline", 0, NONEWLINE|RAW },
{ "nonewline", NONEWLINE, 0 },
{ NULL, 0, 0 }
};
{ "nonewline", NONEWLINE, 0 },
{ NULL, 0, 0 }
};
static void
putcomp(struct mcomp *c1, struct mcomp *c2, int flag)
{
static void
putcomp(struct mcomp *c1, struct mcomp *c2, int flag)
{
+ if (c1->c_flags & RAW) {
+ switch (flag) {
+ case ONECOMP:
+ printf("%s:%s", c1->c_name, c1->c_text);
+ break;
+ case TWOCOMP:
+ printf("%s:%s", c2->c_name, c2->c_text);
+ break;
+ case BODYCOMP:
+ fputs(c2->c_text, stdout);
+ break;
+ default:
+ adios(EX_SOFTWARE, NULL, "BUG: putcomp() is called with a unknown flag");
+ }
+ return;
+ }
+
if (c1->c_fstr && (c1->c_flags & (ADDRFMT | DATEFMT | FORMAT)))
mcomp_format(c1, c2);
if (c1->c_fstr && (c1->c_flags & (ADDRFMT | DATEFMT | FORMAT)))
mcomp_format(c1, c2);
c1->c_flags &= ~HDROUTPUT; /* Buffer ended on a newline */
}
c1->c_flags &= ~HDROUTPUT; /* Buffer ended on a newline */
}
static char *
oneline(char *stuff, long flags)
{
static char *
oneline(char *stuff, long flags)
{
static void
putstr(char *string)
{
static void
putstr(char *string)
{