blob: dd8a9ec490b92cad18e8332c8939afdf647fd7cf [file] [log] [blame] [raw]
/*
* Copyright (C) 2007-2009 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id$
*/
#include "ipf.h"
#include <ctype.h>
void
printfieldhdr(words, field)
wordtab_t *words, *field;
{
wordtab_t *w;
char *s, *t;
int i;
if (field->w_value == -2) {
for (i = 0, w = words; w->w_word != NULL; ) {
if (w->w_value > 0) {
printfieldhdr(words, w);
w++;
if (w->w_value > 0)
putchar('\t');
} else {
w++;
}
}
return;
}
for (w = words; w->w_word != NULL; w++) {
if (w->w_value == field->w_value) {
if (w->w_word == field->w_word) {
s = strdup(w->w_word);
} else {
s = NULL;
}
if ((w->w_word != field->w_word) || (s == NULL)) {
PRINTF("%s", field->w_word);
} else {
for (t = s; *t != '\0'; t++) {
if (ISALPHA(*t) && ISLOWER(*t))
*t = toupper(*t);
}
PRINTF("%s", s);
free(s);
}
}
}
}