summaryrefslogtreecommitdiffstats
path: root/template.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2004-11-19 17:22:30 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2004-11-19 17:22:30 +0000
commitc20ca039710ef57cd6109e572e8be1fccfbeb115 (patch)
tree048968c10f087aafb08a42e5c49f7304a92cee00 /template.c
parentdf4d27d7532268a278668983fe11c7f1d384227e (diff)
downloadrsyslog-c20ca039710ef57cd6109e572e8be1fccfbeb115.tar.gz
rsyslog-c20ca039710ef57cd6109e572e8be1fccfbeb115.tar.xz
rsyslog-c20ca039710ef57cd6109e572e8be1fccfbeb115.zip
coming very close - all but the network sender are working again (but with
templates ;))
Diffstat (limited to 'template.c')
-rw-r--r--template.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/template.c b/template.c
index 3b0f3d16..9a35b5e2 100644
--- a/template.c
+++ b/template.c
@@ -81,6 +81,7 @@ static int do_Constant(char **pp, struct template *pTpl)
register char *p;
sbStrBObj *pStrB;
struct templateEntry *pTpe;
+ int i;
assert(pp != NULL);
assert(*pp != NULL);
@@ -103,6 +104,10 @@ static int do_Constant(char **pp, struct template *pTpl)
sbStrBAppendChar(pStrB, '\n');
++p;
break;
+ case 'r':
+ sbStrBAppendChar(pStrB, '\r');
+ ++p;
+ break;
case '\\':
sbStrBAppendChar(pStrB, '\\');
++p;
@@ -111,6 +116,22 @@ static int do_Constant(char **pp, struct template *pTpl)
sbStrBAppendChar(pStrB, '%');
++p;
break;
+ case '0': /* numerical escape sequence */
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ i = 0;
+ while(*p && isdigit(*p)) {
+ i = i * 10 + *p++ - '0';
+ }
+ sbStrBAppendChar(pStrB, i);
+ break;
default:
sbStrBAppendChar(pStrB, *p++);
break;
@@ -206,7 +227,7 @@ struct template *tplAddLine(char* pName, char** ppRestOfConfLine)
pTpl->iLenTemplate = strlen(pName);
pTpl->pszTemplate = (char*) malloc(sizeof(char) * pTpl->iLenTemplate);
if(pTpl->pszTemplate == NULL) {
- printf("could not alloc memory Template"); /* TODO: change to dprintf()! */
+ /rintf("could not alloc memory Template"); /* TODO: change to dprintf()! */
free(pTpl->pszName);
pTpl->pszName = NULL;
pTpl->iLenName = 0;