#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 {
static struct triple triples[] = {
{ "nocomponent", NOCOMPONENT, 0 },
- { "uppercase", UPPERCASE, 0 },
+ { "uppercase", UPPERCASE, RAW },
{ "nouppercase", 0, UPPERCASE },
- { "center", CENTER, 0 },
+ { "center", CENTER, RAW },
{ "nocenter", 0, CENTER },
- { "leftadjust", LEFTADJUST, 0 },
+ { "leftadjust", LEFTADJUST, RAW },
{ "noleftadjust", 0, LEFTADJUST },
- { "compress", COMPRESS, 0 },
+ { "compress", COMPRESS, RAW },
{ "nocompress", 0, COMPRESS },
{ "split", SPLIT, 0 },
{ "nosplit", 0, SPLIT },
- { "rtrim", RTRIM, 0 },
+ { "rtrim", RTRIM, RAW },
{ "nortrim", 0, RTRIM },
- { "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 }
};
*head = *tail = NULL;
}
-
static void
putcomp(struct mcomp *c1, struct mcomp *c2, int flag)
{
return;
}
+ 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);
c1->c_flags &= ~HDROUTPUT; /* Buffer ended on a newline */
}
-
static char *
oneline(char *stuff, long flags)
{
return ret;
}
-
static void
putstr(char *string)
{