version 1.4, 2007/06/08 17:56:04
|
version 1.5, 2007/06/12 18:19:46
|
|
|
/* | /* |
**============================================================================== | **============================================================================== |
** | ** |
** _DumpPolicyHelper() |
** DumpPolicyHelper() |
** | ** |
** Dump the policy table given by *policyTable* and *policyTableSize*. | ** Dump the policy table given by *policyTable* and *policyTableSize*. |
** Expand any macros in the entries. |
** Expand any macros in the entries, if requested. |
** | ** |
**============================================================================== | **============================================================================== |
*/ | */ |
| |
static void _DumpPolicyHelper( |
void DumpPolicyHelper( |
|
FILE* outputStream, |
const struct Policy* policyTable, | const struct Policy* policyTable, |
size_t policyTableSize, | size_t policyTableSize, |
int expandMacros) | int expandMacros) |
|
|
| |
if (expandMacros) | if (expandMacros) |
{ | { |
|
if (p->arg1) |
ExpandMacros(p->arg1, arg1); | ExpandMacros(p->arg1, arg1); |
| |
if (p->arg2) | if (p->arg2) |
|
|
} | } |
else | else |
{ | { |
|
if (p->arg1) |
Strlcpy(arg1, p->arg1, sizeof(arg1)); | Strlcpy(arg1, p->arg1, sizeof(arg1)); |
| |
if (p->arg2) | if (p->arg2) |
Strlcpy(arg2, p->arg2, sizeof(arg2)); | Strlcpy(arg2, p->arg2, sizeof(arg2)); |
} | } |
| |
|
fprintf(outputStream, "%s(", codeStr); |
|
if (p->arg1) |
|
fprintf(outputStream, "\"%s\"", arg1); |
if (p->arg2) | if (p->arg2) |
printf("%s(\"%s\", \"%s\")\n", codeStr, arg1, arg2); |
fprintf(outputStream, ", \"%s\"", arg2); |
else |
fprintf(outputStream, ")\n"); |
printf("%s(\"%s\")\n", codeStr, arg1); |
|
} | } |
} | } |
| |
|
|
** | ** |
** DumpPolicy() | ** DumpPolicy() |
** | ** |
** Dump both the static and dynamic policy tables. |
** Dump the static policy table. |
** | ** |
**============================================================================== | **============================================================================== |
*/ | */ |
| |
void DumpPolicy(int expandMacros) |
void DumpPolicy(FILE* outputStream, int expandMacros) |
{ | { |
printf("===== Policy:\n"); |
fprintf(outputStream, "===== Policy:\n"); |
| |
_DumpPolicyHelper( |
DumpPolicyHelper( |
_staticPolicyTable, _staticPolicyTableSize, expandMacros); |
outputStream, _staticPolicyTable, _staticPolicyTableSize, expandMacros); |
| |
putchar('\n'); |
putc('\n', outputStream); |
} | } |